Commit dd40dd13 authored by Aleks Totic's avatar Aleks Totic Committed by Commit Bot

[LayoutNG] Fix AtomicInline+HasLayer painting

Main fix is to fix painting of self-painting AtomicInlines.
self-painting AtomicInlines must paint their background
in background phase.

This also fixed several other tests. Rebaselined their
txt expectations.

Bug: 714962
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng;luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ibaff3c6a681fec81101cb4b8d67877302d74ddff
Reviewed-on: https://chromium-review.googlesource.com/1112673Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Commit-Queue: Aleks Totic <atotic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570128}
parent cf21788e
...@@ -58,15 +58,8 @@ crbug.com/591099 fast/dom/inner-text-first-letter.html [ Pass ] ...@@ -58,15 +58,8 @@ crbug.com/591099 fast/dom/inner-text-first-letter.html [ Pass ]
crbug.com/591099 animations/cross-fade-list-style-image.html [ Failure ] crbug.com/591099 animations/cross-fade-list-style-image.html [ Failure ]
crbug.com/591099 animations/rotate-transform-equivalent.html [ Failure ] crbug.com/591099 animations/rotate-transform-equivalent.html [ Failure ]
crbug.com/714962 compositing/background-color/view-blending-base-background.html [ Failure ] crbug.com/714962 compositing/background-color/view-blending-base-background.html [ Failure ]
crbug.com/591099 compositing/draws-content/canvas-background-layer.html [ Failure ]
crbug.com/591099 compositing/draws-content/webgl-background-layer.html [ Failure ]
crbug.com/591099 compositing/geometry/bounds-ignores-hidden.html [ Failure ] crbug.com/591099 compositing/geometry/bounds-ignores-hidden.html [ Failure ]
crbug.com/591099 compositing/geometry/clipping-foreground.html [ Failure ]
crbug.com/591099 compositing/geometry/foreground-layer.html [ Failure ]
crbug.com/591099 compositing/geometry/repaint-foreground-layer.html [ Failure ]
crbug.com/591099 compositing/iframes/floating-self-painting-frame.html [ Failure ] crbug.com/591099 compositing/iframes/floating-self-painting-frame.html [ Failure ]
crbug.com/591099 compositing/layer-creation/rotate3d-overlap.html [ Failure ]
crbug.com/591099 compositing/overflow/scroll-ancestor-update.html [ Failure ]
crbug.com/591099 compositing/self-painting-layers.html [ Failure ] crbug.com/591099 compositing/self-painting-layers.html [ Failure ]
crbug.com/591099 compositing/squashing/add-remove-squashed-layers.html [ Failure ] crbug.com/591099 compositing/squashing/add-remove-squashed-layers.html [ Failure ]
crbug.com/591099 css1/box_properties/float_on_text_elements.html [ Failure ] crbug.com/591099 css1/box_properties/float_on_text_elements.html [ Failure ]
......
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"drawsContent": false,
"backgroundColor": "#FFFFFF"
},
{
"name": "Scrolling Layer",
"bounds": [800, 600],
"drawsContent": false
},
{
"name": "Scrolling Contents Layer",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF"
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-simple'",
"position": [13, 8],
"bounds": [50, 50],
"contentsOpaque": true,
"backgroundColor": "#008000"
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-transparent-background'",
"position": [13, 73],
"bounds": [50, 50],
"backgroundColor": "#00FF0080"
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-padding'",
"position": [13, 138],
"bounds": [60, 60],
"backgroundColor": "#008000"
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-border'",
"position": [13, 203],
"bounds": [60, 60],
"backgroundColor": "#008000"
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-image'",
"position": [13, 268],
"bounds": [50, 50],
"backgroundColor": "#008000"
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-opaque'",
"position": [13, 333],
"bounds": [50, 50],
"contentsOpaque": true,
"backgroundColor": "#008000"
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-opaque-border'",
"position": [13, 398],
"bounds": [60, 60],
"backgroundColor": "#008000"
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-opaque-box-shadow'",
"position": [13, 463],
"bounds": [60, 60],
"backgroundColor": "#008000"
}
]
}
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"drawsContent": false,
"backgroundColor": "#FFFFFF"
},
{
"name": "Scrolling Layer",
"bounds": [800, 600],
"drawsContent": false
},
{
"name": "Scrolling Contents Layer",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF"
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-simple'",
"position": [13, 8],
"bounds": [50, 50],
"contentsOpaque": true,
"backgroundColor": "#008000"
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-padding'",
"position": [13, 73],
"bounds": [60, 60],
"backgroundColor": "#008000"
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-border'",
"position": [13, 138],
"bounds": [60, 60],
"backgroundColor": "#008000"
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-image'",
"position": [13, 203],
"bounds": [50, 50],
"backgroundColor": "#008000"
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-transparent-background'",
"position": [13, 268],
"bounds": [50, 50],
"backgroundColor": "#00FF0080"
}
]
}
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"drawsContent": false,
"backgroundColor": "#FFFFFF"
},
{
"name": "Scrolling Layer",
"bounds": [800, 600],
"drawsContent": false
},
{
"name": "Scrolling Contents Layer",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF"
},
{
"name": "LayoutNGBlockFlow (relative positioned) DIV class='main box'",
"bounds": [318, 318],
"backgroundColor": "#FF0000",
"transform": 1
},
{
"name": "LayoutNGBlockFlow (positioned) DIV class='negative child'",
"bounds": [50, 50],
"drawsContent": false,
"transform": 3
},
{
"name": "LayoutNGBlockFlow (relative positioned) DIV class='main box' (foreground) Layer",
"bounds": [318, 318],
"transform": 1
},
{
"name": "LayoutNGBlockFlow (relative positioned) DIV class='main box'",
"bounds": [318, 318],
"backgroundColor": "#FF0000",
"transform": 4
},
{
"name": "Child Containment Layer",
"position": [59, 59],
"bounds": [200, 200],
"drawsContent": false,
"transform": 4
},
{
"name": "LayoutNGBlockFlow (positioned) DIV class='negative child'",
"bounds": [50, 50],
"drawsContent": false,
"transform": 6
},
{
"name": "LayoutNGBlockFlow (relative positioned) DIV class='main box' (foreground) Layer",
"position": [59, 59],
"bounds": [200, 200],
"transform": 4
}
],
"transforms": [
{
"id": 1,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[19, 89, 0, 1]
]
},
{
"id": 2,
"parent": 1,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[59, 59, 0, 1]
]
},
{
"id": 3,
"parent": 2,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[0, 0, 1, 1]
]
},
{
"id": 4,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[363, 19, 0, 1]
]
},
{
"id": 5,
"parent": 4,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[59, 59, 0, 1]
]
},
{
"id": 6,
"parent": 5,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[0, 0, 1, 1]
]
}
]
}
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"drawsContent": false,
"backgroundColor": "#FFFFFF"
},
{
"name": "Scrolling Layer",
"bounds": [800, 600],
"drawsContent": false
},
{
"name": "Scrolling Contents Layer",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF"
},
{
"name": "LayoutNGBlockFlow (relative positioned) DIV class='box translateZ'",
"bounds": [110, 110],
"backgroundColor": "#0000FF",
"transform": 1
},
{
"name": "Squashing Containment Layer",
"drawsContent": false
},
{
"name": "LayoutNGBlockFlow (relative positioned) DIV class='composited box rotate15'",
"bounds": [110, 110],
"backgroundColor": "#0000FF",
"transform": 3
},
{
"name": "Squashing Layer (first squashed layer: LayoutNGBlockFlow (relative positioned) DIV class='box')",
"position": [167, 143],
"bounds": [110, 110]
},
{
"name": "Squashing Containment Layer",
"drawsContent": false
},
{
"name": "LayoutNGBlockFlow (relative positioned) DIV class='composited box rotate45'",
"bounds": [110, 110],
"backgroundColor": "#0000FF",
"transform": 5
},
{
"name": "Squashing Layer (first squashed layer: LayoutNGBlockFlow (relative positioned) DIV class='box')",
"position": [311, 143],
"bounds": [110, 110]
}
],
"transforms": [
{
"id": 1,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[23, 23, 0, 1]
]
},
{
"id": 2,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[167, 23, 0, 1]
],
"flattenInheritedTransform": false
},
{
"id": 3,
"parent": 2,
"transform": [
[0.965925826289068, 0.258819045102521, 0, 0],
[-0.258819045102521, 0.965925826289068, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]
],
"origin": [55, 55],
"flattenInheritedTransform": false
},
{
"id": 4,
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[311, 23, 0, 1]
],
"flattenInheritedTransform": false
},
{
"id": 5,
"parent": 4,
"transform": [
[0.707106781186548, 0.707106781186548, 0, 0],
[-0.707106781186548, 0.707106781186548, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]
],
"origin": [55, 55],
"flattenInheritedTransform": false
}
]
}
...@@ -23,5 +23,6 @@ layer at (51,51) size 100x100 ...@@ -23,5 +23,6 @@ layer at (51,51) size 100x100
LayoutNGBlockFlow (relative positioned) {DIV} at (0,0) size 100x100 [bgcolor=#008000] LayoutNGBlockFlow (relative positioned) {DIV} at (0,0) size 100x100 [bgcolor=#008000]
layer at (0,0) size 100x100 layer at (0,0) size 100x100
LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 100x100 LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 100x100
LayoutNGBlockFlow {DIV} at (50,0) size 0x0
LayoutFlexibleBox {DIV} at (0,0) size 100x100 LayoutFlexibleBox {DIV} at (0,0) size 100x100
layer at (0,0) size 100x100
LayoutNGBlockFlow (positioned) {DIV} at (0,0) size 100x100
...@@ -151,7 +151,11 @@ void NGBoxFragmentPainter::PaintWithAdjustedOffset( ...@@ -151,7 +151,11 @@ void NGBoxFragmentPainter::PaintWithAdjustedOffset(
if (original_phase != PaintPhase::kSelfBlockBackgroundOnly && if (original_phase != PaintPhase::kSelfBlockBackgroundOnly &&
original_phase != PaintPhase::kSelfOutlineOnly) { original_phase != PaintPhase::kSelfOutlineOnly) {
NGBoxClipper box_clipper(box_fragment_, info); base::Optional<NGBoxClipper> box_clipper;
if (original_phase == PaintPhase::kForeground ||
original_phase == PaintPhase::kFloat ||
original_phase == PaintPhase::kDescendantOutlinesOnly)
box_clipper.emplace(box_fragment_, info);
PaintObject(info, paint_offset); PaintObject(info, paint_offset);
} }
...@@ -247,13 +251,14 @@ void NGBoxFragmentPainter::PaintObject( ...@@ -247,13 +251,14 @@ void NGBoxFragmentPainter::PaintObject(
} else { } else {
PaintBlockChildren(contents_paint_info, paint_offset); PaintBlockChildren(contents_paint_info, paint_offset);
} }
if (ShouldPaintDescendantOutlines(paint_phase)) {
NGFragmentPainter(box_fragment_)
.PaintDescendantOutlines(paint_info, paint_offset);
}
} }
if (ShouldPaintSelfOutline(paint_phase)) if (ShouldPaintSelfOutline(paint_phase))
NGFragmentPainter(box_fragment_).PaintOutline(paint_info, paint_offset); NGFragmentPainter(box_fragment_).PaintOutline(paint_info, paint_offset);
if (ShouldPaintDescendantOutlines(paint_phase))
NGFragmentPainter(box_fragment_)
.PaintDescendantOutlines(paint_info, paint_offset);
// TODO(layout-dev): Implement once we have selections in LayoutNG. // TODO(layout-dev): Implement once we have selections in LayoutNG.
// If the caret's node's layout object's containing block is this block, and // If the caret's node's layout object's containing block is this block, and
// the paint action is PaintPhaseForeground, then paint the caret. // the paint action is PaintPhaseForeground, then paint the caret.
...@@ -525,7 +530,8 @@ void NGBoxFragmentPainter::PaintInlineChildBoxUsingLegacyFallback( ...@@ -525,7 +530,8 @@ void NGBoxFragmentPainter::PaintInlineChildBoxUsingLegacyFallback(
void NGBoxFragmentPainter::PaintAllPhasesAtomically( void NGBoxFragmentPainter::PaintAllPhasesAtomically(
const PaintInfo& paint_info, const PaintInfo& paint_info,
const LayoutPoint& paint_offset) { const LayoutPoint& paint_offset,
bool is_self_painting) {
// Pass PaintPhaseSelection and PaintPhaseTextClip is handled by the regular // Pass PaintPhaseSelection and PaintPhaseTextClip is handled by the regular
// foreground paint implementation. We don't need complete painting for these // foreground paint implementation. We don't need complete painting for these
// phases. // phases.
...@@ -533,15 +539,19 @@ void NGBoxFragmentPainter::PaintAllPhasesAtomically( ...@@ -533,15 +539,19 @@ void NGBoxFragmentPainter::PaintAllPhasesAtomically(
if (phase == PaintPhase::kSelection || phase == PaintPhase::kTextClip) if (phase == PaintPhase::kSelection || phase == PaintPhase::kTextClip)
return PaintObject(paint_info, paint_offset); return PaintObject(paint_info, paint_offset);
if (paint_info.phase == PaintPhase::kSelfBlockBackgroundOnly &&
is_self_painting)
return PaintObject(paint_info, paint_offset);
if (phase != PaintPhase::kForeground) if (phase != PaintPhase::kForeground)
return; return;
PaintInfo info(paint_info); PaintInfo info(paint_info);
if (!is_self_painting) {
info.phase = PaintPhase::kBlockBackground; info.phase = PaintPhase::kBlockBackground;
PaintObject(info, paint_offset); PaintObject(info, paint_offset);
}
info.phase = PaintPhase::kFloat; info.phase = PaintPhase::kFloat;
PaintObject(info, paint_offset); PaintObject(info, paint_offset);
{ {
...@@ -651,7 +661,7 @@ void NGBoxFragmentPainter::PaintAtomicInlineChild( ...@@ -651,7 +661,7 @@ void NGBoxFragmentPainter::PaintAtomicInlineChild(
legacy_paint_offset); legacy_paint_offset);
} else { } else {
NGBoxFragmentPainter(child).PaintAllPhasesAtomically( NGBoxFragmentPainter(child).PaintAllPhasesAtomically(
paint_info, paint_offset + fragment.Offset().ToLayoutPoint()); paint_info, paint_offset + fragment.Offset().ToLayoutPoint(), false);
} }
} }
...@@ -699,17 +709,21 @@ void NGBoxFragmentPainter::PaintSymbol(const NGPaintFragment& fragment, ...@@ -699,17 +709,21 @@ void NGBoxFragmentPainter::PaintSymbol(const NGPaintFragment& fragment,
rect); rect);
} }
// Follows BlockPainter::PaintInlineBox
void NGBoxFragmentPainter::PaintAtomicInline(const PaintInfo& paint_info, void NGBoxFragmentPainter::PaintAtomicInline(const PaintInfo& paint_info,
const LayoutPoint& paint_offset) { const LayoutPoint& paint_offset) {
if (paint_info.phase != PaintPhase::kForeground && if (paint_info.phase != PaintPhase::kForeground &&
paint_info.phase != PaintPhase::kSelection) paint_info.phase != PaintPhase::kSelection &&
paint_info.phase != PaintPhase::kSelfBlockBackgroundOnly)
return; return;
// Text clips are painted only for the direct inline children of the object // Text clips are painted only for the direct inline children of the object
// that has a text clip style on it, not block children. // that has a text clip style on it, not block children.
DCHECK(paint_info.phase != PaintPhase::kTextClip); DCHECK(paint_info.phase != PaintPhase::kTextClip);
PaintAllPhasesAtomically(paint_info, paint_offset); bool is_self_painting = PhysicalFragment().Layer() &&
PhysicalFragment().Layer()->IsSelfPaintingLayer();
PaintAllPhasesAtomically(paint_info, paint_offset, is_self_painting);
} }
bool NGBoxFragmentPainter:: bool NGBoxFragmentPainter::
......
...@@ -64,7 +64,9 @@ class NGBoxFragmentPainter : public BoxPainterBase { ...@@ -64,7 +64,9 @@ class NGBoxFragmentPainter : public BoxPainterBase {
void PaintWithAdjustedOffset(PaintInfo&, const LayoutPoint&); void PaintWithAdjustedOffset(PaintInfo&, const LayoutPoint&);
void PaintBoxDecorationBackground(const PaintInfo&, const LayoutPoint&); void PaintBoxDecorationBackground(const PaintInfo&, const LayoutPoint&);
void PaintAllPhasesAtomically(const PaintInfo&, const LayoutPoint&); void PaintAllPhasesAtomically(const PaintInfo&,
const LayoutPoint&,
bool is_self_painting);
void PaintBlockChildren(const PaintInfo&, const LayoutPoint&); void PaintBlockChildren(const PaintInfo&, const LayoutPoint&);
void PaintLineBoxChildren(const Vector<std::unique_ptr<NGPaintFragment>>&, void PaintLineBoxChildren(const Vector<std::unique_ptr<NGPaintFragment>>&,
const PaintInfo&, const PaintInfo&,
......
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