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

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

Issue 2638013002: Record box shadow as main thread scrolling reasons (Closed)
Patch Set: Record box shadow from where it gets detected && remove translucent border Created 3 years, 11 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 58f4ef34c8fafea1ed661c7ab4a9986c04be3bba..869ac38ec914728c5fab0d2e3f4efee664f6f11e 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -1756,6 +1756,9 @@ bool PaintLayerScrollableArea::computeNeedsCompositedScrolling(
return false;
bool needsCompositedScrolling = true;
+ uint32_t mainThreadScrollingReasons = 0;
+ uint32_t* mainThreadScrollingReasonsDueToBackgroundPaintLocation =
bokan 2017/01/23 19:55:51 Why keep this separate variable? Just pass mainThr
yigu 2017/01/23 20:21:23 Done.
+ &mainThreadScrollingReasons;
// TODO(flackr): Allow integer transforms as long as all of the ancestor
// transforms are also integer.
@@ -1771,18 +1774,23 @@ 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;
}
+ if (layer->backgroundPaintLocation() & BackgroundPaintInGraphicsLayer) {
+ layer->layoutObject()->backgroundPaintLocation(
+ mainThreadScrollingReasonsDueToBackgroundPaintLocation);
+ }
+
needsCompositedScrolling = false;
}
@@ -1791,16 +1799,27 @@ 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) {
+ for (uint32_t reason = 1;
bokan 2017/01/23 19:55:51 Just fold this loop into addStyleRelatedMainThread
yigu 2017/01/23 20:21:23 Done.
+ reason <
+ 1 << MainThreadScrollingReason::kMainThreadScrollingReasonCount;
+ reason <<= 1) {
+ if (mainThreadScrollingReasons & reason) {
+ addStyleRelatedMainThreadScrollingReasons(reason);
+ }
+ }
+ }
+
return needsCompositedScrolling;
}

Powered by Google App Engine
This is Rietveld 408576698