85 Commits

Author SHA1 Message Date
Eric Seidel
922ea790b8 Make it possible to draw Text in the new window/document-less world
I had to add back document.createText() since new Text()
does not work in the new world yet.

LayoutRoot is a new Dart-exposed class which holds the Frame and
all associated machinery, sufficient to trigger a restyle
and layout of the subtree.

This is all kinda hacky and I'm sure likely to cause many
crashes if folks call random methods on these disconnected
trees.

But this makes it at least possible to paint text for now
and we can improve this in the coming days.

This really should have Adam's review.  It's hugely hacky
but I'd like to negotiate out with him the timeline on
which we should fix some of these hacks.

R=ianh@google.com
TBR=abarth@chromium.org

Review URL: https://codereview.chromium.org/1148253003
2015-05-27 11:05:42 -07:00
Eric Seidel
d0613374d0 Make it possible to Paint elements into a display list.
Currently said elements need to be in the DOM and have
already been laid out for this to work, but follow-up patches
will remove these restrictions.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1144673002
2015-05-18 14:49:59 -07:00
Ojan Vafai
fc1dff4288 Expose minContentWidth/maxContentWidth and a callback for computing them.
This exposes the last hooks needed to implement flexbox layout. For now,
I didn't worry too much about the exact API we're exposing since this will
all change with the upcoming redesign (e.g. https://codereview.chromium.org/1093633002).

minContentWidth == the width if the element were to wrap at every wrapping point (not including border/padding)

maxContentWidth == the width if the element were to only wrap at hard wrapping points (e.g. \n inside a whitespace: pre).

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1101793003
2015-04-24 13:14:41 -07:00
Ojan Vafai
c8d918efa9 Make changing your layout manager work.
If your layout manager changes, then you need to setNeedsLayout,
otherwise the next frame doesn't even get scheduled. We already
correctly handle going from not having layout to having one or
vice versa by doing the more drastic reattaching since that
requires changing your actual render class.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1060013005
2015-04-15 11:08:32 -07:00
Ojan Vafai
7c974ed8cd Fix crash when removing layout managers.
We weren't correctly marking an element as needing style
recalc if it was *losing* it's layout manager. We were
only doing so when it was gaining a layout manager for
the first time.

Review URL: https://codereview.chromium.org/1082273004
2015-04-14 13:57:07 -07:00
Ojan Vafai
6bfa21b190 Make custom layout actually work.
-Temporarily add setting override width as well so that we correctly bypass in RenderBox::computeLogicalWidth.
-Add setNeedsLayout so that the author code can force layouts (e.g. when the container's width changes).
-Have setLayoutManager force a reattach of the element if it's renderer wasn't a custom layout one before.
-Remove the laying out of children from RenderCustomLayout::layout. This is the job of the author code.
-Add a test case.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1055263002
2015-04-06 12:53:35 -07:00
Ojan Vafai
ef34102c3b Revert "Revert "First iteration on custom layout.""
This reverts commit 44cf3b689cda2632fa649e2cd3fdbfcb7174f352.
https://codereview.chromium.org/1060443002 fixes the cause
of the test breakage.

TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1055243002
2015-04-02 15:17:10 -07:00
Benjamin Lerman
f1ee3cc379 Revert "First iteration on custom layout."
This reverts commit 4223122b79f5f7740bb2957138d14a63a2cea8d2.

This breaks sky tests.

TBR=ojan@chromium.org

Review URL: https://codereview.chromium.org/1051713007
2015-04-02 10:38:03 +02:00
Ojan Vafai
aecc73f1f5 First iteration on custom layout.
This allows setting x/y/width/height directly on an element
during a synchronous layout callback. At the moment, you can do
dangerous things (e.g. change tree structure). In a followup patch
we'll make that impossible via an IDL guard.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1023753007
2015-04-01 19:16:29 -07:00
Adam Barth
0dd797975c Remove <canvas>
Folks should use custom paint instead (see sky/engine/core/painting for a
sketch).

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/1001913003
2015-03-25 16:15:05 -07:00
Adam Barth
510cddef63 Integrate custom paint with the DocumentLifecycle
Instead of running paint requests during microtasks, we run them after updating
layout for the current frame. After draining all the paint requests, we then
drain whatever commits are available.

It's still possible that requestPaint callbacks can dirty style and layout
information, so we need to clean that information after servicing the requests.
Ideally we'd block these callbacks from dirtying style or layout information.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/1027563002
2015-03-19 21:58:14 -07:00
Adam Barth
81233b6df9 Add a basic custom painting facility to Sky
This CL adds just enough custom painting to Sky to make
sky/examples/painting/circle.sky draw a circle. Over time, we should be able to
elaborate this system into something interesting and to make it actually work
in a reasonable way.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/1017593005
2015-03-19 16:00:21 -07:00
Adam Barth
085b988e6a Make it possible for sky-element to register any tag name
... instead of hard-coding "example".

We do this by adding a custom constructor for Element that gets the |tagName|
property off the instance.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/943153002
2015-02-21 08:02:32 -08:00
Adam Barth
73b76dcca9 Rename Sky's custom2 to custom
We've removed the old implementation of custom elements. We can move the new
implementation into the proper place and give the classes their proper name.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/946083003
2015-02-20 17:35:47 -08:00
Adam Barth
dd5a9c9831 Delete sky/engine/core/dom/custom
This code is unused now that we have sky/engine/core/dom/custom2 working.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/950523002
2015-02-20 17:12:54 -08:00
Adam Barth
7d00bd5e06 Implement Custom Elements
This CL implements custom elements. The design is as follows:

1) Authors subclass Element and call registerElement.
2) When we create C++ elements for custom elements, we call the author's
   constructor synchronously.
3) The attach/detach/attributeChanged callbacks are called either:
   a) when exiting the current custom element callback scoped (e.g., before
      returning from appendChild), or
   b) when draining the microtask queue.

The implementation in this CL is a bit fragile because we don't detect name
registration conflicts and we let you create custom elements with the same name
as built-in elements. Also, not every part of the engine is prepared to execute
script synchronously below createElement. We'll need to iron out these issues
over time, but this CL is a start.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/943013002
2015-02-20 16:15:42 -08:00
Adam Barth
178be1d89d Remove almost all clients of isHTMLElement
This CL is progress towards deleting the concept of an HTMLElement entirely. We
won't actually get all the way there in this CL series, but we're getting
closer. This CL also will let us make custom elements just be Elements instead
of HTMLElements.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/942933003
2015-02-20 12:06:15 -08:00
Adam Barth
dff66fb1b7 Remove the concept of document.documentElement
Now documents can have many element children, all created equal.

R=esprehn@chromium.org, ojan@chromium.org

Review URL: https://codereview.chromium.org/928393003
2015-02-17 16:20:07 -08:00
Adam Barth
52b56750a1 Rename sky/engine/bindings2 to sky/engine/bindings
There's only one bindings system now.

TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/915293003
2015-02-12 20:16:17 -08:00
Adam Barth
f2d2e80e59 Merge the Sky Engine changes from the SkyDart branch
This CL flips the switch to make Sky use Dart.

TBR=eseidel@chromium.org
BUG=454613

Review URL: https://codereview.chromium.org/922893002
2015-02-12 15:06:03 -08:00
Adam Barth
54809a8877 Remove more scrolling code from Sky
None of this code does anything anymore.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/878303002
2015-01-27 15:20:14 -08:00
Adam Barth
c33c565f8b Remove ScrollableArea and Scrollbar
This code is unused.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/879993004
2015-01-27 12:08:24 -08:00
Elliott Sprehn
eb3e7d4b8b Get rid of Chrome, use Page.
This hides ChromeClient inside Page and gets rid of Chrome object.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/878673005
2015-01-26 18:06:24 -08:00
Elliott Sprehn
10f5a4043d Merge WebWidgetClient into WebViewClient.
They're always the same thing in sky. I also removed all the methods that
don't do anything in sky.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/880643007
2015-01-26 15:55:08 -08:00
Elliott Sprehn
ed2912af0b Remove PseudoId.
Sky doesn't have pseudo elements (::before, ::after, etc.)

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/883443003
2015-01-26 13:51:56 -08:00
Elliott Sprehn
2988fb5ad2 Remove ElementFlags system.
Tab index is the only thing using it now, we can do something more
explicit. I also simplified the tab index code a little bit.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/871203005
2015-01-26 13:29:52 -08:00
Elliott Sprehn
3d4800ed0c Move the CustomElementDefinition from ElementRareData to Element.
In Sky almost every element is a custom element, so this just bloats all
elements by having it in the rare data structure.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/880593003
2015-01-26 13:14:55 -08:00
Elliott Sprehn
c7c5328338 Remove InputMethodContext.
We'll probably want a really different API in sky, and this just makes
ElementRareData bigger for now and isn't hooked up to anything.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/880663002
2015-01-26 13:12:08 -08:00
Elliott Sprehn
44686c5f02 Remove hasInlineTransform bit.
We used to use this as a hint for compositing layers, but we don't have
layers anymore so we can remove it.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/869393002
2015-01-26 11:37:51 -08:00
Adam Barth
da75d15a1b Merge HTMLDocument into Document
HTMLDocument is the same as Document. We can merge them.

R=eseidel@google.com

Review URL: https://codereview.chromium.org/871383002
2015-01-25 23:48:53 -08:00
Adam Barth
e3f9e2de4b Remove more mouse-specific code
This CL removes a bunch of unused mouse-related code, including the
MouseRelatedEvent base class.

R=eseidel@google.com, eseidel@chromium.org

Review URL: https://codereview.chromium.org/873963003
2015-01-24 11:18:35 -08:00
Elliott Sprehn
0275d42ac7 Add the <t> element and ignore whitespace outside it.
We now only preserve the whitespace inside a <t> element inside
the parser. This removes the known n^2 from reattaching whitespace
which should make parsing and appending nodes faster. I also
removed the dead WhitespaceMode code from the parser, and made
the dom-seralizer.sky auto indent the markup so the test output
would be readable.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/867963006
2015-01-23 16:50:00 -08:00
Adam Barth
d7daaf4c7d Remove mouse events from Sky
We use pointer events now.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/870073003
2015-01-23 12:16:09 -08:00
Adam Barth
2c0b2f7ff9 Remove UseCounter
We'll eventually add this back but sometime in the future when we actually have
users.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/867903002
2015-01-22 18:26:55 -08:00
Adam Barth
63d7184715 Remove user gesture tracking
The developer has full control of Sky. We don't need to track whether something
was caused by a user gesture.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/868933003
2015-01-22 16:01:31 -08:00
Elliott Sprehn
93af6b3bf1 Don't store a RuleFeatureSet on ScopedStyleResolver.
Instead lets just iterate the list of sheets and ask each one questions. This
shouldn't be much slower since most widgets only have one sheet anyway.

I also moved the media query matching to the sheet collection. We weren't
correctly matching them since we only guarded the feature set, not the
addition to the list of active sheets.

R=abarth@chromium.org, ojan@chromium.org

Review URL: https://codereview.chromium.org/858423002
2015-01-21 17:00:06 -08:00
Elliott Sprehn
a489bb7128 Remove css !important
Sky doesn't have important, it just orders properties in the same order
as the rules you specified.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/860423004
2015-01-21 14:34:02 -08:00
Elliott Sprehn
0fcd743a64 Remove Element::textFromChildren().
Instead just use textContent() and teach HTMLStyleElement how to atomize
its children. I also added the optimization to Node::textContent so that
Text just returns its value instead of allocating a new buffer which
avoids malloc and copy when getting the textContent of text.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/864613002
2015-01-20 14:26:54 -08:00
Elliott Sprehn
992eaea546 Remove attrs sky doesn't support.
This removes the attributes sky doesn't intend to support. It
removes references to the attrs, but leaves behind a lot of
plumbing that will be cleaned up in the future. This at least
removes the API surface.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/855803002
2015-01-16 19:42:52 -08:00
Elliott Sprehn
1b2ab0c6db Don't queue mutation records when attributes don't change value.
There's no reason to queue records when an attribute didn't really
change value.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/840223006
2015-01-16 19:21:28 -08:00
Elliott Sprehn
9bb2664b06 Get rid of ensureStyleResolver().
It doesn't have side effects anymore, and active documents always
have a StyleResolver.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/838003008
2015-01-16 17:49:32 -08:00
Ojan Vafai
9bb804cf93 Delete focused by mouse code.
This is effectively dead code since we never set the
focused by mouse bit.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/790673006
2015-01-12 17:46:49 -08:00
Ojan Vafai
a198a95ea6 Delete invalidateTreeIfNeeded.
This is just setting and clearing paint invalidation dirty bits.
Also remove a bunch of the paint invalidation dirty bits entirely.
There's plenty more to do.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/791023006
2015-01-12 13:29:12 -08:00
Elliott Sprehn
059ceb6e3f Remove the remaining parts of ignorePendingStylesheets and placeholder styles.
This patch is largely just a rename since updateLayoutIgnorePendingStylesheets()
didn't really do anything except call updateLayout() now as nothing was reading
the ignorePendingStyleSheets state, and no callers used the synchronous post
layout task option which was meant for plugins (which Sky doesn't have).

Placeholder styles were related and just add confusion since things pretend to
be display: none while <import>'s are loading. We should expose a real API for
avoiding FOUC instead of pumping frames with display: none elements when
imports are loading.

I had to skip the layout/continuations.sky test since it always crashes now
with an ASSERT failure about a bad cast (filed as bug 446739). The bug already
existed, this patch just makes that one test hit it.

BUG=446739
R=ojan@chromium.org

Review URL: https://codereview.chromium.org/834693007
2015-01-07 10:54:41 -08:00
Elliott Sprehn
f4546b7716 Store features in the ScopedStyleResoolver.
This now means that using a class/id/attribute selector in one scope will
not cause style recalcs in other scopes in the page when something with
that feature changes.

It also removes an iteration over all the scopes that used to collect
features.

I also removed all the extra cases around adding/removing classes since
the general case can handle them.

In addition I removed the check for classStringHasClassName which looked
to see if the string was all whitespace. This check dated way back to
fixing an assert in code we don't even have anymore. Assertion fix aside
all the extra check optimized for was if you wrote class="  " with no
names, which will now cause an extra malloc of the SpaceSplitString::Data.
This seems super rare, it makes more sense to not scan the class string
every time the list of classes changes which is far more common than
setting a string of only whitespace.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/837883002
2015-01-06 22:22:44 -08:00
Elliott Sprehn
1da814b4c2 Remove custom element type extensions.
Sky doesn't really have many built in elements, we no longer support
<foo is="my-element">. This does mean you can't extend <import>,
<script> or <style>, but we'll figure that out later.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/831993005
2015-01-06 16:07:15 -08:00
Elliott Sprehn
0af96f055d Turn StyleSharing to 11.
In Sky we can style share if our TreeScopes have the same styles, our :host
styles are the same, and we'd inherit the same styles. This allows a lot of
simplification to the style sharing logic since we don't need to deal with
descendant selectors or tree boundary crossing rules:

- We can remove the logic that was checking that we were distributed
to the same insertion points since there's no ::content selectors.

- We can check the actual inherited values instead of looking at the
parentOrSHadowHostNode(). We used to look at the node in Blink because we
were checking that you'd get the same descendant selectors applied. In Sky
we instead want to make sure you'd inherit the same values. This also
means we don't need the element().parentOrShadowHostElement() != parent case
in the SharedStyleFinder which was trying to deal with descendant selectors
again.

I also removed the checks that were redundant with the checks inside
supportsStyleSharing() which we always check before adding sharing
candidates.

Finally by refactoring the code to make the TreeScope style check work it
exposed that the Document::styleSheets() and TreeScope::styleSheets() APIs
are now dead. A future patch will delete the now dead StyleSheetList class
as well.

This change makes the city-list application share between all the items in
the list, and all of the headers of the same type now share as well.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/796713002
2014-12-11 15:34:24 -08:00
Elliott Sprehn
c2916617b4 Merge ClassList into DOMTokenList.
In Sky we only have one implementation of DOMTokenList so we don't
need this virtual interface.

R=rafaelw@chromium.org

Review URL: https://codereview.chromium.org/789843004
2014-12-09 16:06:29 -08:00
Rafael Weinstein
f703b72f96 Fix Animations, Remove Compostior Animations.
This patch (re)hooks up animations so they start and removes the infrastructure required by blink to synchronize the compositor and main threads.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/772673002
2014-12-02 14:37:55 -08:00
Elliott Sprehn
061c71d806 Mostly merge HTMLElement into Element.
R=eseidel@chromium.org, ojan@chromium.org

Review URL: https://codereview.chromium.org/772133003
2014-12-02 12:00:21 -08:00