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

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

Issue 2464823003: Refactor LayoutView paint offset updates out of FrameView update code (Closed)
Patch Set: Remove unnecessary forward decl Created 4 years, 1 month 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 67837699cc16e9e0f1c8b8dc50b902ffb5d6c427..4b9e71fa492d953a7734a983408d7f6da5c16d51 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
@@ -102,33 +102,19 @@ void updateFrameViewScroll(
}
}
-void PaintPropertyTreeBuilder::updatePropertiesAndContext(
+void PaintPropertyTreeBuilder::updateFramePropertiesAndContext(
FrameView& frameView,
PaintPropertyTreeBuilderContext& context) {
if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
- LayoutView* layoutView = frameView.layoutView();
- if (!layoutView)
- return;
-
- TransformationMatrix frameTranslate;
- frameTranslate.translate(frameView.x() + layoutView->location().x() +
- context.current.paintOffset.x(),
- frameView.y() + layoutView->location().y() +
- context.current.paintOffset.y());
- layoutView->getMutableForPainting()
- .ensurePaintProperties()
- .updatePaintOffsetTranslation(context.current.transform, frameTranslate,
- FloatPoint3D());
-
- const auto* properties = layoutView->paintProperties();
- DCHECK(properties && properties->paintOffsetTranslation());
- context.current.transform = properties->paintOffsetTranslation();
- context.current.paintOffset = LayoutPoint();
+ // With root layer scrolling, the LayoutView (a LayoutObject) properties are
+ // updated like other objects (see updatePropertiesAndContextForSelf and
+ // updatePropertiesAndContextForChildren) instead of needing LayoutView-
+ // specific property updates here.
+ context.current.paintOffset.moveBy(frameView.location());
context.current.renderingContextID = 0;
context.current.shouldFlattenInheritedTransform = true;
context.absolutePosition = context.current;
- context.containerForAbsolutePosition =
- nullptr; // This will get set in updateOutOfFlowContext().
+ context.containerForAbsolutePosition = nullptr;
context.fixedPosition = context.current;
return;
}
@@ -200,15 +186,14 @@ void PaintPropertyTreeBuilder::updatePropertiesAndContext(
void PaintPropertyTreeBuilder::updatePaintOffsetTranslation(
const LayoutObject& object,
PaintPropertyTreeBuilderContext& context) {
- // LayoutView's paint offset is updated in the FrameView property update.
- if (object.isLayoutView()) {
- DCHECK(context.current.paintOffset == LayoutPoint());
- return;
- }
-
bool usesPaintOffsetTranslation = false;
- if (object.isBoxModelObject() &&
- context.current.paintOffset != LayoutPoint()) {
+ if (RuntimeEnabledFeatures::rootLayerScrollingEnabled() &&
+ object.isLayoutView()) {
+ // Root layer scrolling always creates a translation node for LayoutView to
+ // ensure fixed and absolute contexts use the correct transform space.
+ usesPaintOffsetTranslation = true;
+ } else if (object.isBoxModelObject() &&
+ context.current.paintOffset != LayoutPoint()) {
// TODO(trchen): Eliminate PaintLayer dependency.
PaintLayer* layer = toLayoutBoxModelObject(object).layer();
if (layer && layer->paintsWithTransform(GlobalPaintNormalPhase))
@@ -244,6 +229,13 @@ void PaintPropertyTreeBuilder::updatePaintOffsetTranslation(
if (properties && properties->paintOffsetTranslation()) {
context.current.transform = properties->paintOffsetTranslation();
context.current.paintOffset = fractionalPaintOffset;
+ if (RuntimeEnabledFeatures::rootLayerScrollingEnabled() &&
+ object.isLayoutView()) {
+ context.absolutePosition.transform = properties->paintOffsetTranslation();
+ context.fixedPosition.transform = properties->paintOffsetTranslation();
+ context.absolutePosition.paintOffset = LayoutPoint();
+ context.fixedPosition.paintOffset = LayoutPoint();
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698