Commit 4cd4d67f authored by robhogan's avatar robhogan Committed by Commit bot

Restore behaviour of middle anonymous blocks inheriting style from inline parents

BUG=706324

Review-Url: https://codereview.chromium.org/2806123002
Cr-Commit-Position: refs/heads/master@{#465729}
parent 647872c5
......@@ -5,11 +5,11 @@ layer at (0,0) size 800x416
LayoutBlockFlow {BODY} at (8,8) size 784x400
LayoutBlockFlow (anonymous) at (0,0) size 784x0
LayoutInline {SPAN} at (0,0) size 0x0 [color=#008000]
LayoutBlockFlow (anonymous) at (0,0) size 784x200
LayoutBlockFlow (anonymous) at (0,0) size 784x200 [color=#008000]
LayoutBlockFlow {<pseudo:before>} at (0,0) size 784x200 [color=#0000FF]
LayoutTextFragment (anonymous) at (0,0) size 200x200
text run at (0,0) width 200: "A"
LayoutBlockFlow {DIV} at (0,200) size 784x0 [color=#008000]
LayoutBlockFlow {DIV} at (0,200) size 784x0
LayoutBlockFlow (anonymous) at (0,200) size 784x200
LayoutInline {SPAN} at (0,0) size 200x200 [color=#008000]
LayoutText {#text} at (0,0) size 200x200
......
<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<style>
.hidden {
visibility:hidden;
}
</style>
<a href="#" class="hidden">
<div id="div">Inside a</div>
</a>
<script>
test(function() {
if (window.eventSender) {
eventSender.dragMode = false;
eventSender.mouseMoveTo(10, 10);
var originalInfo = window.internals.getCurrentCursorInfo();
assert_equals(originalInfo, "type=Pointer hotSpot=0,0");
}
}, 'crbug.com/706324: Middle continuations should inherit the style of their inline parent, so when the cursor is placed over the anonymous block it should remain a pointer.');
</script>
......@@ -8,7 +8,7 @@ layer at (0,0) size 800x600
text run at (0,0) width 356: "This tests that a child style can override the :visited style."
LayoutInline {A} at (0,0) size 0x0 [color=#FF0000]
LayoutText {#text} at (0,0) size 0x0
LayoutBlockFlow (anonymous) at (0,20) size 784x20
LayoutBlockFlow (anonymous) at (0,20) size 784x20 [color=#FF0000]
LayoutBlockFlow {DIV} at (0,0) size 784x20 [color=#008000]
LayoutText {#text} at (0,0) size 267x19
text run at (0,0) width 267: "This text should be green (and underlined)"
......
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x600
LayoutBlockFlow {HTML} at (0,0) size 800x600
LayoutBlockFlow {BODY} at (8,8) size 784x584
LayoutBlockFlow (anonymous) at (0,0) size 784x20
LayoutText {#text} at (0,0) size 356x19
text run at (0,0) width 356: "This tests that a child style can override the :visited style."
LayoutInline {A} at (0,0) size 0x0 [color=#FF0000]
LayoutText {#text} at (0,0) size 0x0
LayoutBlockFlow (anonymous) at (0,20) size 784x20 [color=#FF0000]
LayoutBlockFlow {DIV} at (0,0) size 784x20 [color=#008000]
LayoutText {#text} at (0,0) size 267x19
text run at (0,0) width 267: "This text should be green (and underlined)"
LayoutBlockFlow (anonymous) at (0,40) size 784x0
LayoutInline {A} at (0,0) size 0x0 [color=#FF0000]
LayoutText {#text} at (0,0) size 0x0
LayoutBlockFlow {DIV} at (0,40) size 784x20 [color=#008000]
LayoutText {#text} at (0,0) size 159x19
text run at (0,0) width 159: "This text should be green"
......@@ -8,7 +8,7 @@ layer at (0,0) size 800x600
text run at (0,0) width 367: "This tests that a child style can override the :visited style."
LayoutInline {A} at (0,0) size 0x0 [color=#FF0000]
LayoutText {#text} at (0,0) size 0x0
LayoutBlockFlow (anonymous) at (0,18) size 784x18
LayoutBlockFlow (anonymous) at (0,18) size 784x18 [color=#FF0000]
LayoutBlockFlow {DIV} at (0,0) size 784x18 [color=#008000]
LayoutText {#text} at (0,0) size 272x18
text run at (0,0) width 272: "This text should be green (and underlined)"
......
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x600
LayoutBlockFlow {HTML} at (0,0) size 800x600
LayoutBlockFlow {BODY} at (8,8) size 784x584
LayoutBlockFlow (anonymous) at (0,0) size 784x18
LayoutText {#text} at (0,0) size 367x18
text run at (0,0) width 367: "This tests that a child style can override the :visited style."
LayoutInline {A} at (0,0) size 0x0 [color=#FF0000]
LayoutText {#text} at (0,0) size 0x0
LayoutBlockFlow (anonymous) at (0,18) size 784x18 [color=#FF0000]
LayoutBlockFlow {DIV} at (0,0) size 784x18 [color=#008000]
LayoutText {#text} at (0,0) size 272x18
text run at (0,0) width 272: "This text should be green (and underlined)"
LayoutBlockFlow (anonymous) at (0,36) size 784x0
LayoutInline {A} at (0,0) size 0x0 [color=#FF0000]
LayoutText {#text} at (0,0) size 0x0
LayoutBlockFlow {DIV} at (0,36) size 784x18 [color=#008000]
LayoutText {#text} at (0,0) size 162x18
text run at (0,0) width 162: "This text should be green"
......@@ -8,7 +8,7 @@ layer at (0,0) size 800x600
text run at (0,0) width 337: "This tests that a child style can override the :visited style."
LayoutInline {A} at (0,0) size 0x0 [color=#FF0000]
LayoutText {#text} at (0,0) size 0x0
LayoutBlockFlow (anonymous) at (0,20) size 784x20
LayoutBlockFlow (anonymous) at (0,20) size 784x20 [color=#FF0000]
LayoutBlockFlow {DIV} at (0,0) size 784x20 [color=#008000]
LayoutText {#text} at (0,0) size 252x19
text run at (0,0) width 252: "This text should be green (and underlined)"
......
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x600
LayoutBlockFlow {HTML} at (0,0) size 800x600
LayoutBlockFlow {BODY} at (8,8) size 784x584
LayoutBlockFlow (anonymous) at (0,0) size 784x20
LayoutText {#text} at (0,0) size 337x19
text run at (0,0) width 337: "This tests that a child style can override the :visited style."
LayoutInline {A} at (0,0) size 0x0 [color=#FF0000]
LayoutText {#text} at (0,0) size 0x0
LayoutBlockFlow (anonymous) at (0,20) size 784x20 [color=#FF0000]
LayoutBlockFlow {DIV} at (0,0) size 784x20 [color=#008000]
LayoutText {#text} at (0,0) size 252x19
text run at (0,0) width 252: "This text should be green (and underlined)"
LayoutBlockFlow (anonymous) at (0,40) size 784x0
LayoutInline {A} at (0,0) size 0x0 [color=#FF0000]
LayoutText {#text} at (0,0) size 0x0
LayoutBlockFlow {DIV} at (0,40) size 784x20 [color=#008000]
LayoutText {#text} at (0,0) size 150x19
text run at (0,0) width 150: "This text should be green"
......@@ -343,8 +343,18 @@ void LayoutInline::AddChildIgnoringContinuation(LayoutObject* new_child,
// of this inline. We take all of the children after |beforeChild| and put
// them in a clone of this object.
RefPtr<ComputedStyle> new_style =
ComputedStyle::CreateAnonymousStyleWithDisplay(
ContainingBlock()->StyleRef(), EDisplay::kBlock);
ComputedStyle::CreateAnonymousStyleWithDisplay(StyleRef(),
EDisplay::kBlock);
// The anon block we create here doesn't exist in the CSS spec, so
// we need to ensure that any blocks it contains inherit properly
// from its true parent. This means they must use the direction set by the
// anon block's containing block, so we need to prevent the anon block
// from inheriting direction from the inline. If there are any other
// inheritable properties that apply to block and inline elements
// but only affect the layout of children we will want to special-case
// them here too. Writing-mode would be one if it didn't create a
// formatting context of its own, removing the need for continuations.
new_style->SetDirection(ContainingBlock()->StyleRef().Direction());
// If inside an inline affected by in-flow positioning the block needs to be
// affected by it too. Giving the block a layer like this allows it to
......
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