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

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

Issue 2553093003: Create scroll properties for main thread scrolling even w/o scrolling (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a74a9cfe47f342619f3ad508defa9d46070900ec..8794b9f888d6e890ee13c714dc8fc5eb1d361005 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
@@ -640,15 +640,34 @@ void PaintPropertyTreeBuilder::updateSvgLocalToBorderBoxTransform(
context.current.paintOffset = LayoutPoint();
}
+MainThreadScrollingReasons mainScrollingReasons(const LayoutObject& object) {
+ MainThreadScrollingReasons reasons = 0;
+ if (!object.document().settings()->threadedScrollingEnabled())
+ reasons |= MainThreadScrollingReason::kThreadedScrollingDisabled;
+ // Checking for descendants in the layout tree has two downsides:
+ // 1) There can be more descendants in layout order than in paint order (e.g.,
+ // fixed position objects).
+ // 2) Iterating overall all background attachment fixed objects for every
+ // scroll node can be slow, though there will be none in the common case.
+ const FrameView& frameView = *object.frameView();
+ if (frameView.hasBackgroundAttachmentFixedDescendants(object))
+ reasons |= MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects;
+ return reasons;
+}
+
void PaintPropertyTreeBuilder::updateScrollAndScrollTranslation(
const LayoutObject& object,
PaintPropertyTreeBuilderContext& context) {
if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) {
+ bool needsScrollProperties = false;
if (object.hasOverflowClip()) {
+ auto mainThreadScrollingReasons = mainScrollingReasons(object);
const LayoutBox& box = toLayoutBox(object);
- const PaintLayerScrollableArea* scrollableArea = box.getScrollableArea();
+ const auto* scrollableArea = box.getScrollableArea();
IntSize scrollOffset = box.scrolledContentOffset();
- if (!scrollOffset.isZero() || scrollableArea->scrollsOverflow()) {
+ if (mainThreadScrollingReasons || !scrollOffset.isZero() ||
+ scrollableArea->scrollsOverflow()) {
+ needsScrollProperties = true;
auto& properties =
object.getMutableForPainting().ensurePaintProperties();
TransformationMatrix matrix = TransformationMatrix().translate(
@@ -664,32 +683,18 @@ void PaintPropertyTreeBuilder::updateScrollAndScrollTranslation(
scrollableArea->userInputScrollable(HorizontalScrollbar);
bool userScrollableVertical =
scrollableArea->userInputScrollable(VerticalScrollbar);
- MainThreadScrollingReasons reasons = 0;
- if (!object.document().settings()->threadedScrollingEnabled())
- reasons |= MainThreadScrollingReason::kThreadedScrollingDisabled;
- // Checking for descendants in the layout tree has two downsides:
- // 1) There can be more descendants in layout order than in paint
- // order (e.g., fixed position objects).
- // 2) Iterating overall all background attachment fixed objects for
- // every scroll node can be slow, though there will be no objects
- // in the common case.
- const FrameView& frameView = *object.frameView();
- if (frameView.hasBackgroundAttachmentFixedDescendants(object)) {
- reasons |=
- MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects;
- }
context.forceSubtreeUpdate |= properties.updateScroll(
context.current.scroll, properties.scrollTranslation(), scrollClip,
scrollBounds, userScrollableHorizontal, userScrollableVertical,
- reasons);
- } else {
- // Ensure pre-existing properties are cleared when there is no
- // scrolling.
- auto* properties = object.getMutableForPainting().paintProperties();
- if (properties) {
- context.forceSubtreeUpdate |= properties->clearScrollTranslation();
- context.forceSubtreeUpdate |= properties->clearScroll();
- }
+ mainThreadScrollingReasons);
+ }
+ }
+
+ if (!needsScrollProperties) {
+ // Ensure pre-existing properties are cleared.
+ if (auto* properties = object.getMutableForPainting().paintProperties()) {
+ context.forceSubtreeUpdate |= properties->clearScrollTranslation();
+ context.forceSubtreeUpdate |= properties->clearScroll();
}
}
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698