267 Commits

Author SHA1 Message Date
Hixie
41c3e58e27 Use the baseline information exposed by C++ to pipe baseline data through RenderBox.
This also fixes the C++ side to give the right baseline information.
Previously it was giving the baseline distance for the font, but not
for the actual laid-out text.

I considered also providing a "defaultBaseline" accessor that returns
the distance for the actual dominant baseline, but it turns out right
now we never decide the baseline is ideographic. We always use the
alphabetic baseline. We should probably fix that...

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1200233002.
2015-06-24 17:01:14 -07:00
Hixie
dca45e1890 Expose baseline information in the Sky API.
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1208483002.
2015-06-24 11:24:45 -07:00
Ian Fischer
1799eacef5 Decouple Canvas from DisplayList and map Picture and PictureRecorder more directly to their Skia counterparts.
Also changes the framework dart code to use the
refactored APIs and fixes the various examples and
tests.

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

Review URL: https://codereview.chromium.org/1190123003.
2015-06-24 10:21:45 -07:00
Adam Barth
d8d7db82a0 Really remove config.h
This CL generated by |sed -i '/sky\/engine\/config.h/d'| and a manual sweep to
catch some oddballs.

TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1206763002.
2015-06-23 23:15:28 -07:00
Adam Barth
fd4527dd4a Don't crash if you call document.createText(null)
Fixes #165.

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

Review URL: https://codereview.chromium.org/1196463002.
2015-06-18 12:17:05 -07:00
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
Eric Seidel
1eb17996fb Make it possible to custom-paint without an Element.
This adds a new abstract 'Canvas' which is similar to SkCanvas.
PaintContext implements Canvas while still having its
own commit() method to cause the paint actions to apply to
the Element for the next frame.
This adds a new PictureRecorder which also implements Canvas
and has an endRecording() method which returns a Picture
(another new interface) which can be held from Dart.

There is also now a rootPicture setter on Document which takes
a Picture and will then make the Document draw that Picture
until changed.

This piggybacks on the existing custom painting system
which adds the painting at background-and-borders paint
time so technically if you both set rootPicture as well as
construct a DOM you will draw the DOM on top of your picture. :)

R=mpcomplete@chromium.org

Review URL: https://codereview.chromium.org/1122423009
2015-05-13 13:16:47 -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
a1d93b2847 Fix getChildElements.
It was returing all element descendants instead of all element
immediate children.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1048333006
2015-04-14 16:40:58 -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
Eric Seidel
3f96f9344e Remove -webkit-user-drag
Also cleaned up some uneeded comments in CSSValueKeywords.in

TBR=ojan@chromium.org

Review URL: https://codereview.chromium.org/1076353003
2015-04-10 13:01:18 -07:00
Ojan Vafai
9a7eb76c46 Remove dead code around anonymous renderers.
There's no way to create anonymous renderers anymore.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1070233002
2015-04-10 11:34:46 -07:00
Ojan Vafai
b9f182a6bd Stop rendering text inside flex boxes.
Text can only only inside paragraphs and inlines. This patch makes it
so we stop putting such text nodes in the render tree at all if their
parent is not a paragraph or an inline.

This is the final step in making it so that we don't create anonymous
renderers, which fixes a crash in the new custom layout code.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1077473002
2015-04-09 11:40:03 -07:00
Ojan Vafai
b9df2edb7d Delete RenderBlockFlow.
We only ever create RenderParagraphs now. The only non-trivial change here
is making RenderView a RenderFlexibleBox. This required changing custom.sky.
That test was written in a fragile way that behaved differently if we
did multiple layouts. Instead, having it be less racy and only change
values during the test itself.

This also throws a wrench in moving all the layout code to dart
because we can't set the layout manager on the RenderView. Maybe
we need to explicitly let you do so.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1068683002
2015-04-07 16:59:36 -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
43ebba749b Add more trace events to Sky
These will help us better understand what's happening.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1027913002
2015-03-20 15:07:24 -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
Eric Seidel
e3a8059796 Fix all dartanalyzer errors in dart:sky except the Native ones.
I also fixed all warnings. :)

This is the only error remaining:
[error] Native functions can only be declared in the SDK and code
that is loaded through native extensions

My understanding is that we need to do something similar to:
https://codereview.chromium.org/950063002/
in order to work around the 'native' issue.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/981733009
2015-03-05 13:36:48 -08:00
Eric Seidel
a3eeb2263c Fix multi-touch to work in SkyShell.
Before this patch it crashed.

Also updated the touch-demo to support multi-touch.

R=abarth@chromium.org
BUG=

Review URL: https://codereview.chromium.org/961483004
2015-02-26 12:23:18 -08:00
Rafael Weinstein
3ed20172df Fix tracing for Document::updateRenderTree
R=abarth@chromium.org, abarth
BUG=

Review URL: https://codereview.chromium.org/949313002
2015-02-24 12:15:40 -08:00
Rafael Weinstein
e53bba60a5 Add dart_invoke to tonic for calls into App code.
This patch adds utility functions which provide a single choke point for calling into sky application code. For now this is only serving the purpose of having a common trace event for calls into app code.

R=abarth@chromium.org, abarth
BUG=

Review URL: https://codereview.chromium.org/941153003
2015-02-24 12:11:19 -08:00
Adam Barth
b6f511c6a9 Port Sky widgets demo to Dart
This CL updates sky-box, sky-button, sky-checkbox, sky-input, and sky-radio to
work in Dart. We don't have a data binding system yet, so there's a bit more
plumbing in the code.

This CL adds support for sky-element@attributes, which lets you specify which
attributes your element supports. We use this information to synthesize getters
and setters for those attributes and to dispatch to mumbleChanged methods when
the attributes change.

I've also wrapped the widgets demo itself in a sky-scrollable so the whole
thing scrolls.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/946813005
2015-02-23 08:30:36 -08:00
Adam Barth
fe31fd0e4c Port sky-scrollable to Dart
This CL ports sky-scrollable to the new sky-element.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/950603002
2015-02-21 09:56:22 -08: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
89db30494d Remove two more uses of NodeList
We now use List<Node> instead, which is more idiomatic.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/941913002
2015-02-19 21:10:20 -08:00
Adam Barth
a033a3261b Add back Element#getBoundingClient rect
Hans is using this in Modular and we don't have a great replacement at the
moment.

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

Review URL: https://codereview.chromium.org/942543002
2015-02-19 10:02:16 -08:00
Adam Barth
0c35024cef querySelectorAll should return List<Element>
... instead of NodeList.

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

Review URL: https://codereview.chromium.org/943433002
2015-02-19 09:39:59 -08:00
Etienne Membrives
3ec2270eb2 Update from https://crrev.com/316786
List of manually-modified files:
gpu/command_buffer/service/in_process_command_buffer.cc
examples/sample_app/BUILD.gn
examples/sample_app/spinning_cube.cc
mojo/android/javatests/src/org/chromium/mojo/MojoTestCase.java
mojo/cc/context_provider_mojo.cc
mojo/cc/context_provider_mojo.h
mojo/common/trace_controller_impl.cc
mojo/gles2/command_buffer_client_impl.cc
mojo/gles2/command_buffer_client_impl.h
services/gles2/gpu_impl.cc
shell/android/apk/src/org/chromium/mojo/shell/MojoShellApplication.java
sky/engine/core/dom/Node.cpp
sky/shell/apk/src/org/domokit/sky/shell/SkyShellApplication.java
ui/events/latency_info.cc
ui/gfx/transform.cc
ui/gfx/transform.h
ui/gfx/transform_util.cc
ui/gfx/transform_util.h

Review URL: https://codereview.chromium.org/935333002
2015-02-19 17:27:12 +01: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
Eric Seidel
4790abe2f7 Remove the concept of pendingScripts from HTMLScriptRunner
We shouldn't need pendingScripts in ScriptRunner since
we should never be trying to run scripts when we're
not ready to run them.

However this wasn't completely true in the case of imports
there was code to have us break before any start tag after
an <import> was seen, but it was subtly wrong in that it
it would include the start-tag it was trying to break before
in the chunk it sent to the main thread.

This didn't run out to be the problem I was facing, but I fixed
it anyway.  The problem which was actually preventing me from
removing pendingScripts was adding a check inside
didRecieveParsedChunk... to check if imports were pending and
add the chunk to the list of pending chunks.

I also renamed m_speculations to m_pendingChunks since these
chunks are never speculative anymore.

We can't test the off-by-one import-breaking code with our
current system, but it would be trivial to test with a
self-closing custom element if/when we ever add custom
elements back to the system.

R=abarth@chromium.org
BUG=

Review URL: https://codereview.chromium.org/934083002
2015-02-17 16:13:30 -08:00
Eric Seidel
7c33481af9 Fix the tests after my previous commit.
This actually makes [Named] work, previously it was
generating invalid dart.

TBR=abarth@chromium.org
BUG=

Review URL: https://codereview.chromium.org/931273002
2015-02-17 11:09:27 -08:00
Eric Seidel
9aba803749 Add support for named arguments to our bindings generation.
This doesn't yet support having both named and optional
arguments, but once I have an example of that it should
be trivial to add.

I also cleaned up the generation a little so the generated
dart file looks nicer. :)

R=abarth@chromium.org
BUG=

Review URL: https://codereview.chromium.org/923093003
2015-02-17 11:00:07 -08:00
Adam Barth
f7e974680c Morph the APIs for Node, ParentNode, and Element closer to the specs
These still don't match the specs exactly, but they're much closer.

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

Review URL: https://codereview.chromium.org/924203002
2015-02-13 21:36:53 -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
e962904c7a Remove TRACE_EVENT indirection through blink::Platform
Normal trace events already go directly to base. This CL removes the remaining
trace events that were still indirected through blink::Platform. These were
just the half-finished inspector timeline trace events, which currently aren't
actually hooked up to anything.

This CL also removes the redunant "convertable to trace format" wrappers and
moves their one remaining use over to just using the version in base directly.

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

Review URL: https://codereview.chromium.org/889823002
2015-01-30 08:47:46 -08:00
Elliott Sprehn
fa70bea051 Remove CustomElementDescriptor.
In Sky we only need the localName of an element to describe
what it is. Remove this abstraction which is just a thin wrapper
around AtomicString.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/885713004
2015-01-28 20:46:24 -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