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

Unified Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp

Issue 2819923003: [SPInvalidation, SPv2] Compute paint offset for paginated content (Closed)
Patch Set: none Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
index 09c25f88501dfaaccb70aa53b710247eaaa7ce0a..7bfe9f4ed16faf04f624ae730491d1669f77cd96 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
@@ -204,6 +204,7 @@ void PaintPropertyTreeBuilder::UpdateProperties(
auto* fixed_scroll_node = context.current.scroll;
DCHECK(frame_view.PreTranslation());
context.current.transform = frame_view.PreTranslation();
+ context.current.transform_paint_layer = frame_view.GetLayoutView()->Layer();
DCHECK(frame_view.ContentClip());
context.current.clip = frame_view.ContentClip();
if (const auto* scroll_translation = frame_view.ScrollTranslation()) {
@@ -266,11 +267,15 @@ void PaintPropertyTreeBuilder::UpdatePaintOffsetTranslation(
context.current.rendering_context_id);
context.current.transform = properties.PaintOffsetTranslation();
+ context.current.transform_paint_layer = object.Layer();
+
context.current.paint_offset = fractional_paint_offset;
if (RuntimeEnabledFeatures::rootLayerScrollingEnabled() &&
object.IsLayoutView()) {
context.absolute_position.transform = properties.PaintOffsetTranslation();
+ context.absolute_position.transform_paint_layer = object.Layer();
context.fixed_position.transform = properties.PaintOffsetTranslation();
+ context.fixed_position.transform_paint_layer = object.Layer();
context.absolute_position.paint_offset = LayoutPoint();
context.fixed_position.paint_offset = LayoutPoint();
}
@@ -307,6 +312,7 @@ void PaintPropertyTreeBuilder::UpdateTransformForNonRootSVG(
if (object.PaintProperties() && object.PaintProperties()->Transform()) {
context.current.transform = object.PaintProperties()->Transform();
+ context.current.transform_paint_layer = nullptr;
context.current.should_flatten_inherited_transform = false;
context.current.rendering_context_id = 0;
}
@@ -408,6 +414,10 @@ void PaintPropertyTreeBuilder::UpdateTransform(
const auto* properties = object.PaintProperties();
if (properties && properties->Transform()) {
context.current.transform = properties->Transform();
+ if (object.IsBoxModelObject()) {
+ context.current.transform_paint_layer =
+ ToLayoutBoxModelObject(object).Layer();
+ }
if (object.StyleRef().Preserves3D()) {
context.current.rendering_context_id =
properties->Transform()->RenderingContextId();
@@ -818,6 +828,10 @@ void PaintPropertyTreeBuilder::UpdatePerspective(
const auto* properties = object.PaintProperties();
if (properties && properties->Perspective()) {
context.current.transform = properties->Perspective();
+ if (object.IsBoxModelObject()) {
+ context.current.transform_paint_layer =
+ ToLayoutBoxModelObject(object).Layer();
+ }
context.current.should_flatten_inherited_transform = false;
}
}
@@ -849,6 +863,10 @@ void PaintPropertyTreeBuilder::UpdateSvgLocalToBorderBoxTransform(
const auto* properties = object.PaintProperties();
if (properties && properties->SvgLocalToBorderBoxTransform()) {
context.current.transform = properties->SvgLocalToBorderBoxTransform();
+ if (object.IsBoxModelObject()) {
+ context.current.transform_paint_layer =
+ ToLayoutBoxModelObject(object).Layer();
+ }
context.current.should_flatten_inherited_transform = false;
context.current.rendering_context_id = 0;
}
@@ -932,6 +950,10 @@ void PaintPropertyTreeBuilder::UpdateScrollAndScrollTranslation(
if (object.PaintProperties() &&
object.PaintProperties()->ScrollTranslation()) {
context.current.transform = object.PaintProperties()->ScrollTranslation();
+ if (object.IsBoxModelObject()) {
+ context.current.transform_paint_layer =
+ ToLayoutBoxModelObject(object).Layer();
+ }
context.current.scroll = context.current.transform->ScrollNode();
context.current.should_flatten_inherited_transform = false;
}
@@ -951,12 +973,16 @@ void PaintPropertyTreeBuilder::UpdateOutOfFlowContext(
if (object.IsLayoutView()) {
if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
const auto* initial_fixed_transform = context.fixed_position.transform;
+ const auto* initial_fixed_transform_paint_layer =
+ context.fixed_position.transform_paint_layer;
const auto* initial_fixed_scroll = context.fixed_position.scroll;
context.fixed_position = context.current;
// Fixed position transform and scroll nodes should not be affected.
context.fixed_position.transform = initial_fixed_transform;
+ context.fixed_position.transform_paint_layer =
+ initial_fixed_transform_paint_layer;
context.fixed_position.scroll = initial_fixed_scroll;
}
} else if (object.CanContainFixedPositionObjects()) {
@@ -1058,6 +1084,20 @@ void PaintPropertyTreeBuilder::UpdatePaintOffset(
-ToLayoutBox(parent_row)->PhysicalLocation());
}
}
+
+ // In the presence of pagination, recompute from scratch the paint offset.
+ // The paint offset for a fragmented LayoutObject is the top-left of its
+ // position in the first fragment in which it participates. See
+ // crbug.com/648274.
+ if (PaintLayer* paint_layer = object.PaintingLayer()) {
+ if (paint_layer->EnclosingPaginationLayer()) {
+ LayoutPoint local_offset = ToLayoutPoint(
+ object.OffsetFromAncestorContainer(&paint_layer->GetLayoutObject()));
+ DCHECK(context.current.transform_paint_layer);
+ context.current.paint_offset = paint_layer->VisualOffsetFromAncestor(
+ context.current.transform_paint_layer, local_offset);
+ }
+ }
}
void PaintPropertyTreeBuilder::UpdateForObjectLocationAndSize(

Powered by Google App Engine
This is Rietveld 408576698