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

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

Issue 1490063002: Implement Paint Containment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix merge Created 5 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
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 0ff40ac98a76e1f0088eed1ff66a42638ab3a422..3b11423168c8b208cb3e6cdaf1c058ea797077af 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
@@ -69,12 +69,12 @@ static void adjustClipRectsForChildren(const LayoutObject& layoutObject, ClipRec
static void applyClipRects(const ClipRectsContext& context, const LayoutObject& layoutObject, LayoutPoint offset, ClipRects& clipRects)
{
- ASSERT(layoutObject.hasOverflowClip() || layoutObject.hasClip());
+ ASSERT(layoutObject.hasOverflowClip() || layoutObject.hasClip() || layoutObject.style()->containsPaint());
LayoutView* view = layoutObject.view();
ASSERT(view);
if (clipRects.fixed() && context.rootLayer->layoutObject() == view)
offset -= toIntSize(view->frameView()->scrollPosition());
- if (layoutObject.hasOverflowClip()) {
+ if (layoutObject.hasOverflowClip() || layoutObject.style()->containsPaint()) {
ClipRect newOverflowClip = toLayoutBox(layoutObject).overflowClipRect(offset, context.scrollbarRelevancy);
newOverflowClip.setHasRadius(layoutObject.style()->hasBorderRadius());
clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.overflowClipRect()));
@@ -82,6 +82,10 @@ static void applyClipRects(const ClipRectsContext& context, const LayoutObject&
clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.posClipRect()));
if (layoutObject.isLayoutView())
clipRects.setFixedClipRect(intersection(newOverflowClip, clipRects.fixedClipRect()));
+ if (layoutObject.style()->containsPaint()) {
+ clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.posClipRect()));
+ clipRects.setFixedClipRect(intersection(newOverflowClip, clipRects.fixedClipRect()));
+ }
}
if (layoutObject.hasClip()) {
LayoutRect newClip = toLayoutBox(layoutObject).clipRect(offset);
@@ -213,7 +217,7 @@ void PaintLayerClipper::calculateRects(const ClipRectsContext& context, const La
layerBounds = LayoutRect(offset, LayoutSize(m_layoutObject.layer()->size()));
// Update the clip rects that will be passed to child layers.
- if (m_layoutObject.hasOverflowClip() && shouldRespectOverflowClip(context)) {
+ if ((m_layoutObject.hasOverflowClip() && shouldRespectOverflowClip(context)) || m_layoutObject.style()->containsPaint()) {
foregroundRect.intersect(toLayoutBox(m_layoutObject).overflowClipRect(offset, context.scrollbarRelevancy));
if (m_layoutObject.style()->hasBorderRadius())
foregroundRect.setHasRadius(true);
@@ -267,7 +271,7 @@ void PaintLayerClipper::calculateClipRects(const ClipRectsContext& context, Clip
adjustClipRectsForChildren(m_layoutObject, clipRects);
- if ((m_layoutObject.hasOverflowClip() && shouldRespectOverflowClip(context)) || m_layoutObject.hasClip()) {
+ if ((m_layoutObject.hasOverflowClip() && shouldRespectOverflowClip(context)) || m_layoutObject.hasClip() || m_layoutObject.style()->containsPaint()) {
// This offset cannot use convertToLayerCoords, because sometimes our rootLayer may be across
// some transformed layer boundary, for example, in the PaintLayerCompositor overlapMap, where
// clipRects are needed in view space.
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.cpp ('k') | third_party/WebKit/Source/core/style/ComputedStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698