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

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

Issue 2773593005: Move logic of recording main thread scrolling reasons from cc to blink::ScrollManager (Closed)
Patch Set: nit Created 3 years, 9 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/PaintLayerScrollableArea.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
index a6c4b4440b2bc3c701e2f9beaf71d61a293a8e20..d819b98ed158faa627929666a94774e94fd9e8ae 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -153,7 +153,7 @@ void PaintLayerScrollableArea::dispose() {
}
}
- removeStyleRelatedMainThreadScrollingReasons();
+ resetStyleRelatedMainThreadScrollingReasons();
if (ScrollingCoordinator* scrollingCoordinator = getScrollingCoordinator())
scrollingCoordinator->willDestroyScrollableArea(this);
@@ -1788,14 +1788,13 @@ bool PaintLayerScrollableArea::computeNeedsCompositedScrolling(
return false;
bool needsCompositedScrolling = true;
- uint32_t mainThreadScrollingReasons = 0;
// TODO(flackr): Allow integer transforms as long as all of the ancestor
// transforms are also integer.
bool backgroundSupportsLCDText =
RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled() &&
layer->layoutObject().style()->isStackingContext() &&
- layer->backgroundPaintLocation(&mainThreadScrollingReasons) &
+ layer->backgroundPaintLocation(&m_reasons) &
BackgroundPaintInScrollingContents &&
layer->backgroundIsKnownToBeOpaqueInRect(
toLayoutBox(layer->layoutObject()).paddingBoxRect()) &&
@@ -1805,16 +1804,14 @@ bool PaintLayerScrollableArea::computeNeedsCompositedScrolling(
!layer->compositor()->preferCompositingToLCDTextEnabled() &&
!backgroundSupportsLCDText) {
if (layer->compositesWithOpacity()) {
- mainThreadScrollingReasons |=
- MainThreadScrollingReason::kHasOpacityAndLCDText;
+ m_reasons |= MainThreadScrollingReason::kHasOpacityAndLCDText;
}
if (layer->compositesWithTransform()) {
- mainThreadScrollingReasons |=
- MainThreadScrollingReason::kHasTransformAndLCDText;
+ m_reasons |= MainThreadScrollingReason::kHasTransformAndLCDText;
}
if (!layer->backgroundIsKnownToBeOpaqueInRect(
toLayoutBox(layer->layoutObject()).paddingBoxRect())) {
- mainThreadScrollingReasons |=
+ m_reasons |=
MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText;
}
@@ -1826,67 +1823,23 @@ bool PaintLayerScrollableArea::computeNeedsCompositedScrolling(
// behind dashed borders). Resolve this case, or not, and update this check
// with the results.
if (layer->layoutObject().style()->hasBorderRadius()) {
- mainThreadScrollingReasons |= MainThreadScrollingReason::kHasBorderRadius;
+ m_reasons |= MainThreadScrollingReason::kHasBorderRadius;
needsCompositedScrolling = false;
}
if (layer->layoutObject().hasClip() || layer->hasDescendantWithClipPath() ||
layer->hasAncestorWithClipPath()) {
- mainThreadScrollingReasons |=
- MainThreadScrollingReason::kHasClipRelatedProperty;
+ m_reasons |= MainThreadScrollingReason::kHasClipRelatedProperty;
needsCompositedScrolling = false;
}
- if (mainThreadScrollingReasons) {
- addStyleRelatedMainThreadScrollingReasons(mainThreadScrollingReasons);
- }
-
return needsCompositedScrolling;
}
-void PaintLayerScrollableArea::addStyleRelatedMainThreadScrollingReasons(
- const uint32_t reasons) {
- LocalFrame* frame = box().frame();
- if (!frame)
- return;
- FrameView* frameView = frame->view();
- if (!frameView)
- return;
-
- for (uint32_t reason = 1;
- reason < 1 << MainThreadScrollingReason::kMainThreadScrollingReasonCount;
- reason <<= 1) {
- if (reasons & reason) {
- frameView->adjustStyleRelatedMainThreadScrollingReasons(reason, true);
- m_reasons |= reason;
- }
- }
-}
-
-void PaintLayerScrollableArea::removeStyleRelatedMainThreadScrollingReasons() {
- LocalFrame* frame = box().frame();
- if (!frame)
- return;
- FrameView* frameView = frame->view();
- if (!frameView)
- return;
-
- // Decrease the number of layers that have any main thread
- // scrolling reasons stored in FrameView
- for (uint32_t i = 0;
- i < MainThreadScrollingReason::kMainThreadScrollingReasonCount; ++i) {
- uint32_t reason = 1 << i;
- if (hasMainThreadScrollingReason(reason)) {
- m_reasons &= ~reason;
- frameView->adjustStyleRelatedMainThreadScrollingReasons(reason, false);
- }
- }
-}
-
void PaintLayerScrollableArea::updateNeedsCompositedScrolling(
LCDTextMode mode) {
// Clear all style related main thread scrolling reasons, if any,
// before calling computeNeedsCompositedScrolling
- removeStyleRelatedMainThreadScrollingReasons();
+ resetStyleRelatedMainThreadScrollingReasons();
bokan 2017/03/24 17:55:54 We should reset the reasons inside computeNeedsCom
yigu 2017/03/27 21:02:07 Done.
const bool needsCompositedScrolling =
computeNeedsCompositedScrolling(mode, layer());

Powered by Google App Engine
This is Rietveld 408576698