Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Issue 2719713002: Simplify whitespace layout object creation.

Created:
3 years, 10 months ago by emilio
Modified:
3 years, 9 months ago
Reviewers:
rune
CC:
chromium-reviews, sof, eae+blinkwatch, blink-reviews-dom_chromium.org, dglazkov+blink, blink-reviews, rwlbuis
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Simplify whitespace layout object creation. This makes whitespace layout object creation not look at the DOM tree, reducing the chances of bugs with display: contents and shadow DOM. BUG=686016, 657748

Patch Set 1 #

Total comments: 9
Unified diffs Side-by-side diffs Delta from patch set Stats (+70 lines, -44 lines) Patch
A third_party/WebKit/LayoutTests/fast/text/whitespace-text-nodes-float.html View 1 chunk +13 lines, -0 lines 2 comments Download
A third_party/WebKit/LayoutTests/fast/text/whitespace-text-nodes-float-expected.html View 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/LayoutTreeBuilderTraversal.h View 1 chunk +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/LayoutTreeBuilderTraversal.cpp View 4 chunks +17 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Text.cpp View 2 chunks +36 lines, -37 lines 7 comments Download

Messages

Total messages: 10 (5 generated)
emilio
Hi rune, you might be a good reviewer for this one? I checked in the ...
3 years, 10 months ago (2017-02-26 00:24:23 UTC) #6
rune
The description didn't give me much clue about what you're changing or why it would ...
3 years, 9 months ago (2017-02-26 21:45:12 UTC) #7
emilio
On 2017/02/26 21:45:12, rune wrote: > The description didn't give me much clue about what ...
3 years, 9 months ago (2017-02-26 22:06:54 UTC) #8
rune
https://codereview.chromium.org/2719713002/diff/1/third_party/WebKit/LayoutTests/fast/text/whitespace-text-nodes-float.html File third_party/WebKit/LayoutTests/fast/text/whitespace-text-nodes-float.html (right): https://codereview.chromium.org/2719713002/diff/1/third_party/WebKit/LayoutTests/fast/text/whitespace-text-nodes-float.html#newcode11 third_party/WebKit/LayoutTests/fast/text/whitespace-text-nodes-float.html:11: p.innerHTML = 'a<span class="f">x</span> <span class="f">y</span>b'; I don't think ...
3 years, 9 months ago (2017-02-27 10:38:06 UTC) #9
emilio
3 years, 9 months ago (2017-02-27 12:09:32 UTC) #10
https://codereview.chromium.org/2719713002/diff/1/third_party/WebKit/LayoutTe...
File third_party/WebKit/LayoutTests/fast/text/whitespace-text-nodes-float.html
(right):

https://codereview.chromium.org/2719713002/diff/1/third_party/WebKit/LayoutTe...
third_party/WebKit/LayoutTests/fast/text/whitespace-text-nodes-float.html:11:
p.innerHTML = 'a<span class="f">x</span> <span class="f">y</span>b';
On 2017/02/27 10:38:06, rune wrote:
> I don't think you're guaranteed that you have generated a layout tree on
onload?
> Are you trying to test (re-)attachment of the p descendants given that p
already
> has a box?
> 
> You should have a better pass condition. For instance: "SS<span>P</span>
> <span>A</span>PASS"
>  with a preceding: "<p>You should see the word PASS two times below.</p>".
> 
> Also, what would typically break is the case where you don't re-attach all
> siblings, for instance going from block to float where you didn't have a
> whitespace layout object, but needs one after changing the display type to
> float.

This is literally a copy-pasted test case from
https://bugs.chromium.org/p/chromium/issues/detail?id=556733, which is what
introduced
https://chromium.googlesource.com/chromium/src.git/+/2748c5cea72b053e64920d9b...,
but yeah, I'll add more test cases with better passing conditions.

https://codereview.chromium.org/2719713002/diff/1/third_party/WebKit/Source/c...
File third_party/WebKit/Source/core/dom/Text.cpp (right):

https://codereview.chromium.org/2719713002/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/dom/Text.cpp:297: *this, maxSiblingsToVisit,
&ranOutOfSiblings);
On 2017/02/27 10:38:06, rune wrote:
> Can't you send maxSiblingsToVisit as a non-const reference instead of adding
> ranOutOfSiblings?
> 
> Both before and after this CL you can visit nearly a 100 siblings if
> previousSiblingLayoutObject visits 49 and you have 50 out-of-flow boxes before
> that.

That's right. I can, but that'd be somewhat annoying for other callers that
don't want to limit it. I can pass it by pointer though, I guess.

https://codereview.chromium.org/2719713002/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/dom/Text.cpp:310:
emptyOrEndsWithWhitespace(toLayoutText(prev)->text())) {
On 2017/02/27 10:38:06, rune wrote:
> Is checking the previous layout object for white-space all that changes test
> expectations here?

Not totally sure about this, but it's likely. Actually, let me submit a CL with
this change, and another with the LayoutTreeBuilderTraversal limit fixes
separately before trying to land this.

https://codereview.chromium.org/2719713002/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/dom/Text.cpp:327: return !!prev;
On 2017/02/27 10:38:06, rune wrote:
> We still re-attach right-to-left? That means we'll always return false first
for
> white-space nodes while attaching inline siblings inside a block, but it will
be
> rectified correctly by reattachWhitespaceSiblings() after attaching the
previous
> inline?
> 
> It seems to me this code is changing the behavior for that case, at least.

Yes, I believe that's right. I don't think it matters a lot as long as
reattachWhitespaceSiblings does the right thing, though?

Powered by Google App Engine
This is Rietveld 408576698