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

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

Issue 2700613002: Reland recording box shadow as main thread scrolling reason with conflict fixed (Closed)
Patch Set: update test from TEST_F to TEST_P Created 3 years, 10 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 8f1d9acac3f1f866fcc2001cdff6ba03eaa1ad17..33358d38065cf8e77fde4b3eb3845938438017c6 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -1752,13 +1752,15 @@ 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() & BackgroundPaintInScrollingContents &&
+ layer->backgroundPaintLocation(&mainThreadScrollingReasons) &
+ BackgroundPaintInScrollingContents &&
layer->backgroundIsKnownToBeOpaqueInRect(
toLayoutBox(layer->layoutObject())->paddingBoxRect()) &&
!layer->compositesWithTransform() && !layer->compositesWithOpacity();
@@ -1767,18 +1769,19 @@ bool PaintLayerScrollableArea::computeNeedsCompositedScrolling(
!layer->compositor()->preferCompositingToLCDTextEnabled() &&
!backgroundSupportsLCDText) {
if (layer->compositesWithOpacity()) {
- addStyleRelatedMainThreadScrollingReasons(
- MainThreadScrollingReason::kHasOpacityAndLCDText);
+ mainThreadScrollingReasons |=
+ MainThreadScrollingReason::kHasOpacityAndLCDText;
}
if (layer->compositesWithTransform()) {
- addStyleRelatedMainThreadScrollingReasons(
- MainThreadScrollingReason::kHasTransformAndLCDText);
+ mainThreadScrollingReasons |=
+ MainThreadScrollingReason::kHasTransformAndLCDText;
}
if (!layer->backgroundIsKnownToBeOpaqueInRect(
toLayoutBox(layer->layoutObject())->paddingBoxRect())) {
- addStyleRelatedMainThreadScrollingReasons(
- MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText);
+ mainThreadScrollingReasons |=
+ MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText;
}
+
needsCompositedScrolling = false;
}
@@ -1787,21 +1790,25 @@ bool PaintLayerScrollableArea::computeNeedsCompositedScrolling(
// behind dashed borders). Resolve this case, or not, and update this check
// with the results.
if (layer->layoutObject()->style()->hasBorderRadius()) {
- addStyleRelatedMainThreadScrollingReasons(
- MainThreadScrollingReason::kHasBorderRadius);
+ mainThreadScrollingReasons |= MainThreadScrollingReason::kHasBorderRadius;
needsCompositedScrolling = false;
}
if (layer->layoutObject()->hasClip() || layer->hasDescendantWithClipPath() ||
layer->hasAncestorWithClipPath()) {
- addStyleRelatedMainThreadScrollingReasons(
- MainThreadScrollingReason::kHasClipRelatedProperty);
+ mainThreadScrollingReasons |=
+ MainThreadScrollingReason::kHasClipRelatedProperty;
needsCompositedScrolling = false;
}
+
+ if (mainThreadScrollingReasons) {
+ addStyleRelatedMainThreadScrollingReasons(mainThreadScrollingReasons);
+ }
+
return needsCompositedScrolling;
}
void PaintLayerScrollableArea::addStyleRelatedMainThreadScrollingReasons(
- const uint32_t reason) {
+ const uint32_t reasons) {
LocalFrame* frame = box().frame();
if (!frame)
return;
@@ -1809,8 +1816,14 @@ void PaintLayerScrollableArea::addStyleRelatedMainThreadScrollingReasons(
if (!frameView)
return;
- frameView->adjustStyleRelatedMainThreadScrollingReasons(reason, true);
- m_reasons |= reason;
+ for (uint32_t reason = 1;
+ reason < 1 << MainThreadScrollingReason::kMainThreadScrollingReasonCount;
+ reason <<= 1) {
+ if (reasons & reason) {
+ frameView->adjustStyleRelatedMainThreadScrollingReasons(reason, true);
+ m_reasons |= reason;
+ }
+ }
}
void PaintLayerScrollableArea::removeStyleRelatedMainThreadScrollingReasons() {
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.cpp ('k') | third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698