Commit 2243f482 authored by Chris Harrelson's avatar Chris Harrelson Committed by Commit Bot

Match root layer fragment to descendant when both root and descendant are fragmented.

Otherwise, when computing a clip between an descendant and the root layer, the fragment
clip of the root layer from its local border box properties will be wrong, and clip
out the painted output.

Bug:860682

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I04653f18441becc4557ceca5a68bf513a9908283
Reviewed-on: https://chromium-review.googlesource.com/1149517Reviewed-by: default avatarvmpstr <vmpstr@chromium.org>
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578551}
parent f7edd5af
......@@ -1244,7 +1244,7 @@ Bug(none) compositing/rendering-contexts.html [ Failure ]
Bug(none) compositing/overflow-trumps-transform-style.html [ Failure ]
crbug.com/796768 fast/css/getComputedStyle/getComputedStyle-zoom-and-background-size.html [ Crash ]
crbug.com/796768 fast/multicol/composited-layer-will-change.html [ Crash ]
crbug.com/796768 fast/multicol/composited-layer-will-change.html [ Failure ]
crbug.com/796768 fast/multicol/hit-test-gap-between-pages-flipped.html [ Crash ]
crbug.com/796768 fast/multicol/hit-test-gap-between-pages.html [ Crash ]
crbug.com/796768 fast/multicol/multicol-becomes-paged-fixed-height.html [ Crash ]
......@@ -1277,13 +1277,13 @@ crbug.com/796768 fast/pagination/div-y-vertical-lr-rtl.html [ Crash ]
crbug.com/796768 fast/pagination/div-y-vertical-rl-ltr.html [ Crash ]
crbug.com/796768 fast/pagination/div-y-vertical-rl-rtl.html [ Crash ]
crbug.com/796768 fast/pagination/multicol.html [ Crash ]
crbug.com/796768 fast/pagination/repeating-thead-tfoot-paged-x.html [ Crash ]
crbug.com/796768 fast/pagination/repeating-thead-tfoot-paged-y.html [ Crash ]
crbug.com/796768 fast/pagination/repeating-thead-tfoot-paged-x.html [ Failure ]
crbug.com/796768 fast/pagination/repeating-thead-tfoot-paged-y.html [ Failure ]
crbug.com/796768 fast/pagination/short-pages-tall-content.html [ Crash ]
crbug.com/796768 fast/text-autosizing/constrained-and-overflow-paged-x-ancestor.html [ Crash ]
crbug.com/796768 paint/clipath/change-mask-clip-path-multicol-crash.html [ Crash ]
crbug.com/796768 paint/invalidation/overflow/paged-with-overflowing-block-rl.html [ Crash ]
crbug.com/796768 paint/pagination/composited-paginated-outlined-box.html [ Crash ]
crbug.com/796768 paint/invalidation/overflow/paged-with-overflowing-block-rl.html [ Failure ]
crbug.com/796768 paint/pagination/composited-paginated-outlined-box.html [ Failure ]
Bug(none) css3/blending/mix-blend-mode-simple.html [ Pass Timeout ]
Bug(none) css3/blending/mix-blend-mode-simple-text.html [ Pass Timeout ]
......
layer at (0,0) size 800x600 clip at (0,0) size 785x600 scrollHeight 3116
LayoutView at (0,0) size 800x600
layer at (0,0) size 785x3116 backgroundClip at (0,0) size 785x600 clip at (0,0) size 785x600
LayoutBlockFlow {HTML} at (0,0) size 785x3116
LayoutBlockFlow {BODY} at (8,8) size 769x3100
LayoutBlockFlow {DIV} at (0,100) size 10x3000
layer at (8,8) size 250x100
LayoutBlockFlow {DIV} at (0,0) size 250x100
LayoutMultiColumnSet (anonymous) at (0,0) size 250x71
layer at (8,8) size 117x142 backgroundClip at (0,0) size 133x79 clip at (0,0) size 133x79
LayoutMultiColumnFlowThread (anonymous) at (0,0) size 117x142
LayoutBlockFlow {DIV} at (0,0) size 30x30
LayoutBlockFlow (anonymous) at (0,71) size 117x71
LayoutText {#text} at (0,0) size 0x0
layer at (8,79) size 43x70 backgroundClip at (3,74) size 53x5 clip at (0,0) size 0x0 scrollHeight 85
LayoutListBox {SELECT} at (0,0) size 43x70 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)]
LayoutBlockFlow {OPTION} at (1,1) size 26x17
LayoutText {#text} at (2,0) size 22x16
text run at (2,0) width 22: "test"
LayoutBlockFlow {OPTION} at (1,18) size 26x17
LayoutText {#text} at (2,0) size 22x16
text run at (2,0) width 22: "test"
LayoutBlockFlow {OPTION} at (1,35) size 26x17
LayoutText {#text} at (2,0) size 22x16
text run at (2,0) width 22: "test"
LayoutBlockFlow {OPTION} at (1,52) size 26x17
LayoutText {#text} at (2,0) size 22x16
text run at (2,0) width 22: "test"
LayoutBlockFlow {OPTION} at (1,69) size 26x17
LayoutText {#text} at (2,0) size 22x16
text run at (2,0) width 22: "test"
<!DOCTYPE html>
<div style="columns: 2; width: 250px; height: 100px">
<div style="width: 30px; height: 30px"></div>
<select multiple style="outline: 5px solid green">
<option>test</option>
<option>test</option>
<option>test</option>
<option>test</option>
<option>test</option>
</select>
</div>
<div style="width: 10px; height: 3000px"></div>
layer at (0,0) size 800x600 clip at (0,0) size 785x600 scrollHeight 3116
LayoutView at (0,0) size 800x600
layer at (0,0) size 785x3116 backgroundClip at (0,0) size 785x600 clip at (0,0) size 785x600
LayoutBlockFlow {HTML} at (0,0) size 785x3116
LayoutBlockFlow {BODY} at (8,8) size 769x3100
LayoutBlockFlow {DIV} at (0,100) size 10x3000
layer at (8,8) size 250x100
LayoutBlockFlow {DIV} at (0,0) size 250x100
LayoutMultiColumnSet (anonymous) at (0,0) size 250x58.75
layer at (8,8) size 117x118 backgroundClip at (0,0) size 133x67 clip at (0,0) size 133x67
LayoutMultiColumnFlowThread (anonymous) at (0,0) size 117x117.50
LayoutBlockFlow {DIV} at (0,0) size 30x30
LayoutBlockFlow (anonymous) at (0,58.75) size 117x58.75
LayoutText {#text} at (0,0) size 0x0
layer at (8,67) size 36x59 backgroundClip at (3,62) size 46x5 clip at (0,0) size 0x0 scrollHeight 71
LayoutListBox {SELECT} at (0,0) size 35.64x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
LayoutBlockFlow {OPTION} at (1,1) size 22.64x14.19
LayoutText {#text} at (2,0) size 19x13
text run at (2,0) width 19: "test"
LayoutBlockFlow {OPTION} at (1,15.19) size 22.64x14.19
LayoutText {#text} at (2,0) size 19x13
text run at (2,0) width 19: "test"
LayoutBlockFlow {OPTION} at (1,29.38) size 22.64x14.19
LayoutText {#text} at (2,0) size 19x13
text run at (2,0) width 19: "test"
LayoutBlockFlow {OPTION} at (1,43.56) size 22.64x14.19
LayoutText {#text} at (2,0) size 19x13
text run at (2,0) width 19: "test"
LayoutBlockFlow {OPTION} at (1,57.75) size 22.64x14.19
LayoutText {#text} at (2,0) size 19x13
text run at (2,0) width 19: "test"
layer at (0,0) size 800x600 clip at (0,0) size 785x600 scrollHeight 3116
LayoutView at (0,0) size 800x600
layer at (0,0) size 785x3116 backgroundClip at (0,0) size 785x600 clip at (0,0) size 785x600
LayoutNGBlockFlow {HTML} at (0,0) size 785x3116
LayoutNGBlockFlow {BODY} at (8,8) size 769x3100
LayoutNGBlockFlow {DIV} at (0,100) size 10x3000
layer at (8,8) size 250x100
LayoutNGBlockFlow {DIV} at (0,0) size 250x100
LayoutMultiColumnSet (anonymous) at (0,0) size 250x58.75
layer at (8,8) size 117x118 backgroundClip at (0,0) size 133x67 clip at (0,0) size 133x67
LayoutMultiColumnFlowThread (anonymous) at (0,0) size 117x117.50
LayoutNGBlockFlow {DIV} at (0,0) size 30x30
LayoutNGBlockFlow (anonymous) at (0,58.75) size 117x58.75
LayoutText {#text} at (0,0) size 0x0
layer at (8,67) size 36x59 backgroundClip at (3,62) size 46x5 clip at (0,0) size 0x0 scrollHeight 71
LayoutListBox {SELECT} at (0,0) size 35.64x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
LayoutBlockFlow {OPTION} at (1,1) size 22.64x14.19
LayoutText {#text} at (2,0) size 19x13
text run at (2,0) width 19: "test"
LayoutBlockFlow {OPTION} at (1,15.19) size 22.64x14.19
LayoutText {#text} at (2,0) size 19x13
text run at (2,0) width 19: "test"
LayoutBlockFlow {OPTION} at (1,29.38) size 22.64x14.19
LayoutText {#text} at (2,0) size 19x13
text run at (2,0) width 19: "test"
LayoutBlockFlow {OPTION} at (1,43.56) size 22.64x14.19
LayoutText {#text} at (2,0) size 19x13
text run at (2,0) width 19: "test"
LayoutBlockFlow {OPTION} at (1,57.75) size 22.64x14.19
LayoutText {#text} at (2,0) size 19x13
text run at (2,0) width 19: "test"
layer at (0,0) size 800x600 clip at (0,0) size 785x600 scrollHeight 3116
LayoutView at (0,0) size 800x600
layer at (0,0) size 785x3116 backgroundClip at (0,0) size 785x600 clip at (0,0) size 785x600
LayoutBlockFlow {HTML} at (0,0) size 785x3116
LayoutBlockFlow {BODY} at (8,8) size 769x3100
LayoutBlockFlow {DIV} at (0,100) size 10x3000
layer at (8,8) size 250x100
LayoutBlockFlow {DIV} at (0,0) size 250x100
LayoutMultiColumnSet (anonymous) at (0,0) size 250x58.75
layer at (8,8) size 117x118 backgroundClip at (0,0) size 133x67 clip at (0,0) size 133x67
LayoutMultiColumnFlowThread (anonymous) at (0,0) size 117x117.50
LayoutBlockFlow {DIV} at (0,0) size 30x30
LayoutBlockFlow (anonymous) at (0,58.75) size 117x58.75
LayoutText {#text} at (0,0) size 0x0
layer at (8,67) size 37x59 backgroundClip at (3,62) size 47x5 clip at (0,0) size 0x0 scrollHeight 71
LayoutListBox {SELECT} at (0,0) size 36.91x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
LayoutBlockFlow {OPTION} at (1,1) size 23.91x14.19
LayoutText {#text} at (2,0) size 20x13
text run at (2,0) width 20: "test"
LayoutBlockFlow {OPTION} at (1,15.19) size 23.91x14.19
LayoutText {#text} at (2,0) size 20x13
text run at (2,0) width 20: "test"
LayoutBlockFlow {OPTION} at (1,29.38) size 23.91x14.19
LayoutText {#text} at (2,0) size 20x13
text run at (2,0) width 20: "test"
LayoutBlockFlow {OPTION} at (1,43.56) size 23.91x14.19
LayoutText {#text} at (2,0) size 20x13
text run at (2,0) width 20: "test"
LayoutBlockFlow {OPTION} at (1,57.75) size 23.91x14.19
LayoutText {#text} at (2,0) size 20x13
text run at (2,0) width 20: "test"
layer at (0,0) size 800x600 clip at (0,0) size 785x600 scrollHeight 3116
LayoutView at (0,0) size 800x600
layer at (0,0) size 785x3116 backgroundClip at (0,0) size 785x600 clip at (0,0) size 785x600
LayoutNGBlockFlow {HTML} at (0,0) size 785x3116
LayoutNGBlockFlow {BODY} at (8,8) size 769x3100
LayoutNGBlockFlow {DIV} at (0,100) size 10x3000
layer at (8,8) size 250x100
LayoutNGBlockFlow {DIV} at (0,0) size 250x100
LayoutMultiColumnSet (anonymous) at (0,0) size 250x58.75
layer at (8,8) size 117x118 backgroundClip at (0,0) size 133x67 clip at (0,0) size 133x67
LayoutMultiColumnFlowThread (anonymous) at (0,0) size 117x117.50
LayoutNGBlockFlow {DIV} at (0,0) size 30x30
LayoutNGBlockFlow (anonymous) at (0,58.75) size 117x58.75
LayoutText {#text} at (0,0) size 0x0
layer at (8,67) size 37x59 backgroundClip at (3,62) size 47x5 clip at (0,0) size 0x0 scrollHeight 71
LayoutListBox {SELECT} at (0,0) size 36.91x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
LayoutBlockFlow {OPTION} at (1,1) size 23.91x14.19
LayoutText {#text} at (2,0) size 20x13
text run at (2,0) width 20: "test"
LayoutBlockFlow {OPTION} at (1,15.19) size 23.91x14.19
LayoutText {#text} at (2,0) size 20x13
text run at (2,0) width 20: "test"
LayoutBlockFlow {OPTION} at (1,29.38) size 23.91x14.19
LayoutText {#text} at (2,0) size 20x13
text run at (2,0) width 20: "test"
LayoutBlockFlow {OPTION} at (1,43.56) size 23.91x14.19
LayoutText {#text} at (2,0) size 20x13
text run at (2,0) width 20: "test"
LayoutBlockFlow {OPTION} at (1,57.75) size 23.91x14.19
LayoutText {#text} at (2,0) size 20x13
text run at (2,0) width 20: "test"
layer at (0,0) size 800x600 clip at (0,0) size 785x600 scrollHeight 3116
LayoutView at (0,0) size 800x600
layer at (0,0) size 785x3116 backgroundClip at (0,0) size 785x600 clip at (0,0) size 785x600
LayoutBlockFlow {HTML} at (0,0) size 785x3116
LayoutBlockFlow {BODY} at (8,8) size 769x3100
LayoutBlockFlow {DIV} at (0,100) size 10x3000
layer at (8,8) size 250x100
LayoutBlockFlow {DIV} at (0,0) size 250x100
LayoutMultiColumnSet (anonymous) at (0,0) size 250x58.75
layer at (8,8) size 117x118 backgroundClip at (0,0) size 133x67 clip at (0,0) size 133x67
LayoutMultiColumnFlowThread (anonymous) at (0,0) size 117x117.50
LayoutBlockFlow {DIV} at (0,0) size 30x30
LayoutBlockFlow (anonymous) at (0,58.75) size 117x58.75
LayoutText {#text} at (0,0) size 0x0
layer at (8,67) size 37x59 backgroundClip at (3,62) size 47x5 clip at (0,0) size 0x0 scrollHeight 71
LayoutListBox {SELECT} at (0,0) size 37.17x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
LayoutBlockFlow {OPTION} at (1,1) size 24.17x14.19
LayoutText {#text} at (2,0) size 21x13
text run at (2,0) width 21: "test"
LayoutBlockFlow {OPTION} at (1,15.19) size 24.17x14.19
LayoutText {#text} at (2,0) size 21x13
text run at (2,0) width 21: "test"
LayoutBlockFlow {OPTION} at (1,29.38) size 24.17x14.19
LayoutText {#text} at (2,0) size 21x13
text run at (2,0) width 21: "test"
LayoutBlockFlow {OPTION} at (1,43.56) size 24.17x14.19
LayoutText {#text} at (2,0) size 21x13
text run at (2,0) width 21: "test"
LayoutBlockFlow {OPTION} at (1,57.75) size 24.17x14.19
LayoutText {#text} at (2,0) size 21x13
text run at (2,0) width 21: "test"
layer at (0,0) size 800x600 clip at (0,0) size 785x600 scrollHeight 3116
LayoutView at (0,0) size 800x600
layer at (0,0) size 785x3116 backgroundClip at (0,0) size 785x600 clip at (0,0) size 785x600
LayoutNGBlockFlow {HTML} at (0,0) size 785x3116
LayoutNGBlockFlow {BODY} at (8,8) size 769x3100
LayoutNGBlockFlow {DIV} at (0,100) size 10x3000
layer at (8,8) size 250x100
LayoutNGBlockFlow {DIV} at (0,0) size 250x100
LayoutMultiColumnSet (anonymous) at (0,0) size 250x58.75
layer at (8,8) size 117x118 backgroundClip at (0,0) size 133x67 clip at (0,0) size 133x67
LayoutMultiColumnFlowThread (anonymous) at (0,0) size 117x117.50
LayoutNGBlockFlow {DIV} at (0,0) size 30x30
LayoutNGBlockFlow (anonymous) at (0,58.75) size 117x58.75
LayoutText {#text} at (0,0) size 0x0
layer at (8,67) size 37x59 backgroundClip at (3,62) size 47x5 clip at (0,0) size 0x0 scrollHeight 71
LayoutListBox {SELECT} at (0,0) size 37.17x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
LayoutBlockFlow {OPTION} at (1,1) size 24.17x14.19
LayoutText {#text} at (2,0) size 21x13
text run at (2,0) width 21: "test"
LayoutBlockFlow {OPTION} at (1,15.19) size 24.17x14.19
LayoutText {#text} at (2,0) size 21x13
text run at (2,0) width 21: "test"
LayoutBlockFlow {OPTION} at (1,29.38) size 24.17x14.19
LayoutText {#text} at (2,0) size 21x13
text run at (2,0) width 21: "test"
LayoutBlockFlow {OPTION} at (1,43.56) size 24.17x14.19
LayoutText {#text} at (2,0) size 21x13
text run at (2,0) width 21: "test"
LayoutBlockFlow {OPTION} at (1,57.75) size 24.17x14.19
LayoutText {#text} at (2,0) size 21x13
text run at (2,0) width 21: "test"
......@@ -703,9 +703,12 @@ void LayoutTreeAsText::WriteLayers(WTF::TextStream& ts,
LayoutRect layer_bounds;
ClipRect damage_rect, clip_rect_to_apply;
layer->Clipper(PaintLayer::kUseGeometryMapper)
.CalculateRects(ClipRectsContext(root_layer, kUncachedClipRects),
&layer->GetLayoutObject().FirstFragment(), &paint_rect,
layer_bounds, damage_rect, clip_rect_to_apply);
.CalculateRects(
ClipRectsContext(root_layer,
&root_layer->GetLayoutObject().FirstFragment(),
kUncachedClipRects),
&layer->GetLayoutObject().FirstFragment(), &paint_rect, layer_bounds,
damage_rect, clip_rect_to_apply);
LayoutPoint offset_from_root;
layer->ConvertToLayerCoords(root_layer, offset_from_root);
......
......@@ -644,8 +644,10 @@ void CompositedLayerMapping::
// FIXME: this should use cached clip rects, but this sometimes give
// inaccurate results (and trips the ASSERTS in PaintLayerClipper).
ClipRectsContext clip_rects_context(
clip_inheritance_ancestor_, kUncachedClipRects,
kIgnorePlatformOverlayScrollbarSize, kIgnoreOverflowClip);
clip_inheritance_ancestor_,
&clip_inheritance_ancestor_->GetLayoutObject().FirstFragment(),
kUncachedClipRects, kIgnorePlatformOverlayScrollbarSize,
kIgnoreOverflowClip);
ClipRect clip_rect;
owning_layer_.Clipper(PaintLayer::kDoNotUseGeometryMapper)
......@@ -1356,7 +1358,9 @@ void CompositedLayerMapping::UpdateAncestorClippingLayerGeometry(
return;
ClipRectsContext clip_rects_context(
clip_inheritance_ancestor_, kPaintingClipRectsIgnoringOverflowClip,
clip_inheritance_ancestor_,
&clip_inheritance_ancestor_->GetLayoutObject().FirstFragment(),
kPaintingClipRectsIgnoringOverflowClip,
kIgnorePlatformOverlayScrollbarSize, kIgnoreOverflowClipAndScroll);
ClipRect clip_rect;
......@@ -3081,7 +3085,9 @@ void CompositedLayerMapping::LocalClipRectForSquashedLayer(
// FIXME: this is a potential performance issue. We should consider caching
// these clip rects or otherwise optimizing.
ClipRectsContext clip_rects_context(ancestor_paint_info->paint_layer,
ClipRectsContext clip_rects_context(
ancestor_paint_info->paint_layer,
&ancestor_paint_info->paint_layer->GetLayoutObject().FirstFragment(),
kUncachedClipRects);
ClipRect parent_clip_rect;
paint_info.paint_layer->Clipper(PaintLayer::kDoNotUseGeometryMapper)
......
......@@ -291,6 +291,7 @@ void CompositingInputsUpdater::UpdateAncestorDependentCompositingInputs(
layer->Clipper(PaintLayer::kDoNotUseGeometryMapper)
.CalculateBackgroundClipRect(
ClipRectsContext(root_layer_,
&root_layer_->GetLayoutObject().FirstFragment(),
kAbsoluteClipRectsIgnoringViewportClip,
kIgnorePlatformOverlayScrollbarSize,
kIgnoreOverflowClipAndScroll),
......
......@@ -1704,7 +1704,8 @@ void PaintLayer::AppendSingleFragmentIgnoringPagination(
const LayoutSize& sub_pixel_accumulation) const {
PaintLayerFragment fragment;
ClipRectsContext clip_rects_context(
root_layer, kUncachedClipRects, overlay_scrollbar_clip_behavior,
root_layer, &root_layer->GetLayoutObject().FirstFragment(),
kUncachedClipRects, overlay_scrollbar_clip_behavior,
respect_overflow_clip, sub_pixel_accumulation);
Clipper(kUseGeometryMapper)
.CalculateRects(clip_rects_context, &GetLayoutObject().FirstFragment(),
......@@ -1742,9 +1743,15 @@ void PaintLayer::CollectFragments(
const LayoutPoint* offset_from_root,
const LayoutSize& sub_pixel_accumulation) const {
PaintLayerFragment fragment;
ClipRectsContext clip_rects_context(
root_layer, kUncachedClipRects, overlay_scrollbar_clip_behavior,
respect_overflow_clip, sub_pixel_accumulation);
// If |root_layer| is inside the same pagination container as |this|, and
// there is no compositing boundary inside pagination (this is what
// ShouldFragmentCompositedBounds() checks), then try to match
// fragments from |root_layer| to |this|, so that any
// fragment clip for |root_layer|'s fragment matches |this|'s.
bool should_match_fragments = root_layer->EnclosingPaginationLayer() &&
root_layer->EnclosingPaginationLayer() == EnclosingPaginationLayer() &&
ShouldFragmentCompositedBounds();
// The inherited offset_from_root does not include any pagination offsets.
// In the presence of fragmentation, we cannot use it. Note that we may also
......@@ -1755,6 +1762,29 @@ void PaintLayer::CollectFragments(
!GetLayoutObject().FirstFragment().NextFragment();
for (auto* fragment_data = &GetLayoutObject().FirstFragment(); fragment_data;
fragment_data = fragment_data->NextFragment()) {
const FragmentData* root_fragment =
&root_layer->GetLayoutObject().FirstFragment();
if (should_match_fragments) {
for (root_fragment = &root_layer->GetLayoutObject().FirstFragment();
root_fragment; root_fragment = root_fragment->NextFragment()) {
if (root_fragment->LogicalTopInFlowThread() ==
fragment_data->LogicalTopInFlowThread())
break;
}
}
bool cant_find_fragment = !root_fragment;
if (cant_find_fragment) {
// Fall back to the first fragment, in order to have
// PaintLayerClipper at least compute |fragment.layer_bounds|.
root_fragment = &root_layer->GetLayoutObject().FirstFragment();
}
ClipRectsContext clip_rects_context(
root_layer, root_fragment, kUncachedClipRects,
overlay_scrollbar_clip_behavior, respect_overflow_clip,
sub_pixel_accumulation);
Clipper(kUseGeometryMapper)
.CalculateRects(
clip_rects_context, fragment_data, dirty_rect,
......@@ -1762,6 +1792,13 @@ void PaintLayer::CollectFragments(
fragment.foreground_rect,
offset_from_root_can_be_used ? offset_from_root : nullptr);
if (cant_find_fragment) {
// If we couldn't find a matching fragment when |should_match_fragments|
// was true, then fall back to no clip.
fragment.background_rect.Reset();
fragment.foreground_rect.Reset();
}
fragment.fragment_data = fragment_data;
fragment.pagination_offset = fragment_data->PaginationOffset();
......@@ -1988,8 +2025,9 @@ PaintLayer* PaintLayer::HitTestLayer(
ClipRect clip_rect;
Clipper(PaintLayer::kUseGeometryMapper)
.CalculateBackgroundClipRect(
ClipRectsContext(root_layer, kUncachedClipRects,
kExcludeOverlayScrollbarSizeForHitTesting,
ClipRectsContext(
root_layer, &root_layer->GetLayoutObject().FirstFragment(),
kUncachedClipRects, kExcludeOverlayScrollbarSizeForHitTesting,
clip_behavior),
clip_rect);
// Go ahead and test the enclosing clip now.
......
......@@ -214,7 +214,10 @@ void PaintLayerClipper::ClearClipRectsIncludingDescendants(
LayoutRect PaintLayerClipper::LocalClipRect(
const PaintLayer& clipping_root_layer) const {
ClipRectsContext context(&clipping_root_layer, kPaintingClipRects);
ClipRectsContext context(
&clipping_root_layer,
&clipping_root_layer.GetLayoutObject().FirstFragment(),
kPaintingClipRects);
if (use_geometry_mapper_) {
ClipRect clip_rect;
CalculateBackgroundClipRectWithGeometryMapper(
......@@ -228,14 +231,10 @@ LayoutRect PaintLayerClipper::LocalClipRect(
// The rect now needs to be transformed to the local space of this
// PaintLayer.
// TODO(chrishtr): not correct for fragmentation.
premapped_rect.MoveBy(
context.root_layer->GetLayoutObject().FirstFragment().PaintOffset());
premapped_rect.MoveBy(context.root_fragment->PaintOffset());
const auto* clip_root_layer_transform =
clipping_root_layer.GetLayoutObject()
.FirstFragment()
.LocalBorderBoxProperties()
.Transform();
context.root_fragment->LocalBorderBoxProperties().Transform();
const auto* layer_transform = layer_.GetLayoutObject()
.FirstFragment()
.LocalBorderBoxProperties()
......@@ -295,14 +294,12 @@ void PaintLayerClipper::CalculateRectsWithGeometryMapper(
} else {
const auto* current_transform =
fragment_data.PreEffectProperties().Transform();
const auto& root_fragment =
context.root_layer->GetLayoutObject().FirstFragment();
const auto* root_transform =
root_fragment.LocalBorderBoxProperties().Transform();
context.root_fragment->LocalBorderBoxProperties().Transform();
if (&layer_ == context.root_layer ||
current_transform == root_transform) {
layer_bounds.MoveBy(fragment_data.PaintOffset());
layer_bounds.MoveBy(-root_fragment.PaintOffset());
layer_bounds.MoveBy(-context.root_fragment->PaintOffset());
} else {
const TransformationMatrix& transform =
GeometryMapper::SourceToDestinationProjection(current_transform,
......@@ -314,7 +311,7 @@ void PaintLayerClipper::CalculateRectsWithGeometryMapper(
// point error.
layer_bounds.Move(
LayoutSize((float)transform.E(), (float)transform.F()));
layer_bounds.MoveBy(-root_fragment.PaintOffset());
layer_bounds.MoveBy(-context.root_fragment->PaintOffset());
} else {
// This branch can happen due to perspective transforms.
// TODO(chrishtr): investigate whether the paint code is broken
......@@ -535,8 +532,7 @@ void PaintLayerClipper::CalculateBackgroundClipRectWithGeometryMapper(
if (!output.IsInfinite()) {
// TODO(chrishtr): generalize to multiple fragments.
output.MoveBy(
-context.root_layer->GetLayoutObject().FirstFragment().PaintOffset());
output.MoveBy(-context.root_fragment->PaintOffset());
output.Move(context.sub_pixel_accumulation);
}
}
......@@ -550,20 +546,15 @@ void PaintLayerClipper::InitializeCommonClipRectState(
DCHECK(fragment_data.HasLocalBorderBoxProperties());
source_property_tree_state = fragment_data.LocalBorderBoxProperties();
DCHECK(context.root_layer->GetLayoutObject()
.FirstFragment()
.HasLocalBorderBoxProperties());
destination_property_tree_state = context.root_layer->GetLayoutObject()
.FirstFragment()
.LocalBorderBoxProperties();
DCHECK(context.root_fragment->HasLocalBorderBoxProperties());
destination_property_tree_state =
context.root_fragment->LocalBorderBoxProperties();
const auto& ancestor_fragment_data =
context.root_layer->GetLayoutObject().FirstFragment();
if (context.ShouldRespectRootLayerClip()) {
destination_property_tree_state.SetClip(ancestor_fragment_data.PreClip());
destination_property_tree_state.SetClip(context.root_fragment->PreClip());
} else {
destination_property_tree_state.SetClip(
ancestor_fragment_data.PostOverflowClip());
context.root_fragment->PostOverflowClip());
}
}
......
......@@ -70,6 +70,7 @@ class ClipRectsContext {
public:
ClipRectsContext(
const PaintLayer* root,
const FragmentData* fragment,
ClipRectsCacheSlot slot,
OverlayScrollbarClipBehavior overlay_scrollbar_clip_behavior =
kIgnorePlatformOverlayScrollbarSize,
......@@ -77,6 +78,7 @@ class ClipRectsContext {
kRespectOverflowClip,
const LayoutSize& accumulation = LayoutSize())
: root_layer(root),
root_fragment(fragment),
overlay_scrollbar_clip_behavior(overlay_scrollbar_clip_behavior),
cache_slot_(slot),
sub_pixel_accumulation(accumulation),
......@@ -89,6 +91,7 @@ class ClipRectsContext {
bool ShouldRespectRootLayerClip() const;
const PaintLayer* root_layer;
const FragmentData* root_fragment;
const OverlayScrollbarClipBehavior overlay_scrollbar_clip_behavior;
private:
......
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