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

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: Refactor the refactor 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..c6ff4b7aac6385b20cff5ce36e29d24d1233327d 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
@@ -102,33 +102,18 @@ 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 RootLayerScrolling, the LayoutView (a LayoutObject) properties are
+ // updated like other objects (see updatePropertiesAndContextForSelf and
+ // updatePropertiesAndContextForChildren) instead of having LayoutView-
+ // specific property updates here.
context.current.renderingContextID = 0;
trchen 2016/11/01 22:14:00 Alternative idea: Can we add context.current.paint
pdr. 2016/11/01 23:28:23 Done.
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;
}
@@ -197,12 +182,33 @@ void PaintPropertyTreeBuilder::updatePropertiesAndContext(
frameView.setTotalPropertyTreeStateForContents(std::move(contentsState));
}
+void PaintPropertyTreeBuilder::updateLayoutViewPaintOffsetTranslation(
+ const LayoutView& view,
+ PaintPropertyTreeBuilderContext& context) {
trchen 2016/11/01 22:14:00 DCHECK(RuntimeEnabledFeatures::rootLayerScrollingE
pdr. 2016/11/01 23:28:23 Done
+ const auto* frameView = view.frameView();
+ TransformationMatrix translate;
+ translate.translate(
+ frameView->x() + view.location().x() + context.current.paintOffset.x(),
+ frameView->y() + view.location().y() + context.current.paintOffset.y());
trchen 2016/11/01 22:14:00 deriveBorderBoxFromContainerContext() should have
pdr. 2016/11/01 23:28:23 Done.
+ view.getMutableForPainting()
+ .ensurePaintProperties()
+ .updatePaintOffsetTranslation(context.current.transform, translate,
+ FloatPoint3D());
+
+ const auto* properties = view.paintProperties();
+ DCHECK(properties && properties->paintOffsetTranslation());
+ context.current.transform = context.absolutePosition.transform =
+ context.fixedPosition.transform = properties->paintOffsetTranslation();
+ context.current.paintOffset = context.absolutePosition.paintOffset =
+ context.fixedPosition.paintOffset = LayoutPoint();
+}
+
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());
+ if (RuntimeEnabledFeatures::rootLayerScrollingEnabled() &&
+ object.isLayoutView()) {
+ updateLayoutViewPaintOffsetTranslation(toLayoutView(object), context);
return;
}

Powered by Google App Engine
This is Rietveld 408576698