Commit 30e096fc authored by Jaeyong Bae's avatar Jaeyong Bae Committed by Commit Bot

[CSS] Apply first line style even if there are out-of-flow blocks

This patch means the code change to apply first line style on the first
innermost in-flow block even if there are out-of-flow blocks.
Following the spec (https://drafts.csswg.org/css-pseudo-4/#first-line-pseudo),
The first formatted line of an element must occur inside a block-level
descendant in the same flow (that is not out-of-flow due to floating or
positioning). So, we should skip out-of-flow children in
LayoutBlock::EnclosingFirstLineStyleBlock().

Bug: 979253
Change-Id: I58836b223b58816f731096a7a9f93e612278d42f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2485667
Commit-Queue: Jaeyong Bae <jdragon.bae@gmail.com>
Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#820337}
parent d4c1cae8
...@@ -1962,7 +1962,10 @@ const LayoutBlock* LayoutBlock::EnclosingFirstLineStyleBlock() const { ...@@ -1962,7 +1962,10 @@ const LayoutBlock* LayoutBlock::EnclosingFirstLineStyleBlock() const {
!parent_block->BehavesLikeBlockContainer()) !parent_block->BehavesLikeBlockContainer())
break; break;
auto* parent_layout_block = DynamicTo<LayoutBlock>(parent_block); auto* parent_layout_block = DynamicTo<LayoutBlock>(parent_block);
if (parent_layout_block->FirstChild() != first_line_block) const LayoutObject* first_child = parent_layout_block->FirstChild();
while (first_child->IsFloatingOrOutOfFlowPositioned())
first_child = first_child->NextSibling();
if (first_child != first_line_block)
break; break;
first_line_block = parent_layout_block; first_line_block = parent_layout_block;
} }
......
...@@ -5371,8 +5371,6 @@ crbug.com/974675 http/tests/devtools/sources/debugger-frameworks/frameworks-jque ...@@ -5371,8 +5371,6 @@ crbug.com/974675 http/tests/devtools/sources/debugger-frameworks/frameworks-jque
# Sheriff 2019-06-26 # Sheriff 2019-06-26
crbug.com/978966 [ Mac ] paint/markers/ellipsis-mixed-text-in-ltr-flow-with-markers.html [ Pass Failure ] crbug.com/978966 [ Mac ] paint/markers/ellipsis-mixed-text-in-ltr-flow-with-markers.html [ Pass Failure ]
crbug.com/979253 external/wpt/css/css-pseudo/first-line-with-out-of-flow.html [ Failure ]
# Sheriff 2019-06-27 # Sheriff 2019-06-27
crbug.com/979243 [ Mac ] editing/selection/inline-closest-leaf-child.html [ Pass Failure ] crbug.com/979243 [ Mac ] editing/selection/inline-closest-leaf-child.html [ Pass Failure ]
crbug.com/979336 [ Mac ] fast/dynamic/anonymous-block-orphaned-lines.html [ Pass Failure ] crbug.com/979336 [ Mac ] fast/dynamic/anonymous-block-orphaned-lines.html [ Pass Failure ]
......
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#first-line-pseudo">
<link rel="match" href="first-line-with-out-of-flow-ref.html">
<title>CSS Test: ::first-line with out of flow and nested div</title>
<style>
#block::first-line { color: green; }
</style>
<div id="block">
<div style="position: absolute"><br></div>
<div style="float: right"><br></div>
<div>
<div style="position: absolute"><br></div>
<div style="float: right"><br></div>
<div style="color: blue">
<div>
<div style="position: absolute"></div><span>This text <div style="position: absolute"></div></span><span>should be green.</span><br>
This text should be blue.
</div>
</div>
</div>
</div>
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#first-line-pseudo">
<link rel="match" href="first-line-with-out-of-flow-ref.html">
<title>CSS Test: ::first-line with out of flow and nested span</title>
<style>
#block::first-line { color: green; }
</style>
<div id="block">
<div style="position: absolute"><br></div>
<div style="float: right"><br></div>
<div>
<div style="position: absolute"><br></div>
<div style="float: right"><br></div>
<div style="color: blue">
<div>
<span style="position: absolute"></span><span>This text </span><span style="position: absolute"></span><span>should be green.</span><br>
This text should be blue.
</div>
</div>
</div>
</div>
<!DOCTYPE html> <!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#first-line-pseudo"> <link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#first-line-pseudo">
<link rel="match" href="first-line-with-out-of-flow-ref.html"> <link rel="match" href="first-line-with-out-of-flow-ref.html">
<title>CSS Test: ::first-line with out of flow</title>
<style> <style>
#block::first-line { color: green; } #block::first-line { color: green; }
</style> </style>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment