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

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

Issue 2652513002: Use control clip rather than overflow clip when present for PaintLayers. (Closed)
Patch Set: 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/PaintLayerClipper.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
index 72d1876fe07a8c2bb93ed83fda2e0e9faffd4880..4bde08ab6809127a19b3509443258ea8e219974a 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
@@ -70,6 +70,15 @@ static void adjustClipRectsForChildren(const LayoutBoxModelObject& layoutObject,
}
}
+// TODO(chrishtr): move this to LayoutBox.
+static LayoutRect overflowOrControlClip(const LayoutBox& box,
+ const LayoutPoint& location,
+ OverlayScrollbarClipBehavior behavior) {
+ if (box.hasControlClip())
+ return box.controlClipRect(location);
+ return box.overflowClipRect(location, behavior);
+}
+
static void applyClipRects(const ClipRectsContext& context,
const LayoutBoxModelObject& layoutObject,
LayoutPoint offset,
@@ -87,8 +96,8 @@ static void applyClipRects(const ClipRectsContext& context,
if (box.hasOverflowClip() ||
(box.isSVGRoot() && toLayoutSVGRoot(&box)->shouldApplyViewportClip()) ||
box.styleRef().containsPaint() || box.hasControlClip()) {
- ClipRect newOverflowClip =
- box.overflowClipRect(offset, context.overlayScrollbarClipBehavior);
+ ClipRect newOverflowClip = overflowOrControlClip(
+ box, offset, context.overlayScrollbarClipBehavior);
newOverflowClip.setHasRadius(box.styleRef().hasBorderRadius());
clipRects.setOverflowClipRect(
intersection(newOverflowClip, clipRects.overflowClipRect()));
@@ -352,9 +361,10 @@ void PaintLayerClipper::calculateRects(
// Update the clip rects that will be passed to child layers.
if (shouldClipOverflow(context)) {
- foregroundRect.intersect(
- toLayoutBox(layoutObject)
- .overflowClipRect(offset, context.overlayScrollbarClipBehavior));
+ LayoutRect overflowOrControlClipRect =
+ overflowOrControlClip(toLayoutBox(layoutObject), offset,
+ context.overlayScrollbarClipBehavior);
+ foregroundRect.intersect(overflowOrControlClipRect);
if (layoutObject.styleRef().hasBorderRadius())
foregroundRect.setHasRadius(true);
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698