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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp

Issue 2273733002: Use border-box as the reference box for (-webkit-)clip-path (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: New baselines Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/css3/masking/clip-path-reference-box-inline-expected.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/paint/PaintLayerPainter.h" 5 #include "core/paint/PaintLayerPainter.h"
6 6
7 #include "core/frame/LocalFrame.h" 7 #include "core/frame/LocalFrame.h"
8 #include "core/layout/LayoutInline.h"
8 #include "core/layout/LayoutView.h" 9 #include "core/layout/LayoutView.h"
9 #include "core/paint/ClipPathClipper.h" 10 #include "core/paint/ClipPathClipper.h"
10 #include "core/paint/FilterPainter.h" 11 #include "core/paint/FilterPainter.h"
11 #include "core/paint/LayerClipRecorder.h" 12 #include "core/paint/LayerClipRecorder.h"
12 #include "core/paint/ObjectPaintProperties.h" 13 #include "core/paint/ObjectPaintProperties.h"
13 #include "core/paint/PaintInfo.h" 14 #include "core/paint/PaintInfo.h"
14 #include "core/paint/PaintLayer.h" 15 #include "core/paint/PaintLayer.h"
15 #include "core/paint/ScrollRecorder.h" 16 #include "core/paint/ScrollRecorder.h"
16 #include "core/paint/ScrollableAreaPainter.h" 17 #include "core/paint/ScrollableAreaPainter.h"
17 #include "core/paint/Transform3DRecorder.h" 18 #include "core/paint/Transform3DRecorder.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 paintLayer.setPreviousPaintDirtyRect(paintingInfo.paintDirtyRect); 174 paintLayer.setPreviousPaintDirtyRect(paintingInfo.paintDirtyRect);
174 175
175 // Repaint if scroll offset accumulation changes. 176 // Repaint if scroll offset accumulation changes.
176 if (!needsRepaint && paintingInfo.scrollOffsetAccumulation != paintLayer.pre viousScrollOffsetAccumulationForPainting()) 177 if (!needsRepaint && paintingInfo.scrollOffsetAccumulation != paintLayer.pre viousScrollOffsetAccumulationForPainting())
177 needsRepaint = true; 178 needsRepaint = true;
178 paintLayer.setPreviousScrollOffsetAccumulationForPainting(paintingInfo.scrol lOffsetAccumulation); 179 paintLayer.setPreviousScrollOffsetAccumulationForPainting(paintingInfo.scrol lOffsetAccumulation);
179 180
180 return needsRepaint; 181 return needsRepaint;
181 } 182 }
182 183
184 static LayoutRect computeReferenceBox(const LayoutBoxModelObject& boxModelObject )
185 {
186 if (boxModelObject.isLayoutInline())
187 return toLayoutInline(boxModelObject).linesBoundingBox();
188 SECURITY_DCHECK(boxModelObject.isBox());
189 return toLayoutBox(boxModelObject).borderBoxRect();
190 }
191
183 PaintLayerPainter::PaintResult PaintLayerPainter::paintLayerContents(GraphicsCon text& context, const PaintLayerPaintingInfo& paintingInfoArg, PaintLayerFlags pa intFlags, FragmentPolicy fragmentPolicy) 192 PaintLayerPainter::PaintResult PaintLayerPainter::paintLayerContents(GraphicsCon text& context, const PaintLayerPaintingInfo& paintingInfoArg, PaintLayerFlags pa intFlags, FragmentPolicy fragmentPolicy)
184 { 193 {
185 ASSERT(m_paintLayer.isSelfPaintingLayer() || m_paintLayer.hasSelfPaintingLay erDescendant()); 194 ASSERT(m_paintLayer.isSelfPaintingLayer() || m_paintLayer.hasSelfPaintingLay erDescendant());
186 ASSERT(!(paintFlags & PaintLayerAppliedTransform)); 195 ASSERT(!(paintFlags & PaintLayerAppliedTransform));
187 196
188 bool isSelfPaintingLayer = m_paintLayer.isSelfPaintingLayer(); 197 bool isSelfPaintingLayer = m_paintLayer.isSelfPaintingLayer();
189 bool isPaintingOverlayScrollbars = paintFlags & PaintLayerPaintingOverlayScr ollbars; 198 bool isPaintingOverlayScrollbars = paintFlags & PaintLayerPaintingOverlayScr ollbars;
190 bool isPaintingScrollingContent = paintFlags & PaintLayerPaintingCompositing ScrollingPhase; 199 bool isPaintingScrollingContent = paintFlags & PaintLayerPaintingCompositing ScrollingPhase;
191 bool isPaintingCompositedForeground = paintFlags & PaintLayerPaintingComposi tingForegroundPhase; 200 bool isPaintingCompositedForeground = paintFlags & PaintLayerPaintingComposi tingForegroundPhase;
192 bool isPaintingCompositedBackground = paintFlags & PaintLayerPaintingComposi tingBackgroundPhase; 201 bool isPaintingCompositedBackground = paintFlags & PaintLayerPaintingComposi tingBackgroundPhase;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 Optional<ClipPathClipper> clipPathClipper; 255 Optional<ClipPathClipper> clipPathClipper;
247 // Clip-path, like border radius, must not be applied to the contents of a c omposited-scrolling container. 256 // Clip-path, like border radius, must not be applied to the contents of a c omposited-scrolling container.
248 // It must, however, still be applied to the mask layer, so that the composi tor can properly mask the 257 // It must, however, still be applied to the mask layer, so that the composi tor can properly mask the
249 // scrolling contents and scrollbars. 258 // scrolling contents and scrollbars.
250 if (m_paintLayer.layoutObject()->hasClipPath() && (!m_paintLayer.needsCompos itedScrolling() || (paintFlags & PaintLayerPaintingChildClippingMaskPhase))) { 259 if (m_paintLayer.layoutObject()->hasClipPath() && (!m_paintLayer.needsCompos itedScrolling() || (paintFlags & PaintLayerPaintingChildClippingMaskPhase))) {
251 if (!rootRelativeBoundsComputed) { 260 if (!rootRelativeBoundsComputed) {
252 rootRelativeBounds = m_paintLayer.physicalBoundingBoxIncludingReflec tionAndStackingChildren(offsetFromRoot); 261 rootRelativeBounds = m_paintLayer.physicalBoundingBoxIncludingReflec tionAndStackingChildren(offsetFromRoot);
253 rootRelativeBoundsComputed = true; 262 rootRelativeBoundsComputed = true;
254 } 263 }
255 paintingInfo.ancestorHasClipPathClipping = true; 264 paintingInfo.ancestorHasClipPathClipping = true;
256 FloatRect floatRootRelativeBounds(rootRelativeBounds); 265 LayoutRect referenceBox(computeReferenceBox(*m_paintLayer.layoutObject() ));
266 referenceBox.moveBy(offsetFromRoot);
257 clipPathClipper.emplace( 267 clipPathClipper.emplace(
258 context, *m_paintLayer.layoutObject(), floatRootRelativeBounds, floa tRootRelativeBounds, FloatPoint(offsetFromRoot)); 268 context, *m_paintLayer.layoutObject(), FloatRect(referenceBox), Floa tRect(rootRelativeBounds), FloatPoint(offsetFromRoot));
259 } 269 }
260 270
261 Optional<CompositingRecorder> compositingRecorder; 271 Optional<CompositingRecorder> compositingRecorder;
262 // Blending operations must be performed only with the nearest ancestor stac king context. 272 // Blending operations must be performed only with the nearest ancestor stac king context.
263 // Note that there is no need to composite if we're painting the root. 273 // Note that there is no need to composite if we're painting the root.
264 // FIXME: this should be unified further into PaintLayer::paintsWithTranspar ency(). 274 // FIXME: this should be unified further into PaintLayer::paintsWithTranspar ency().
265 bool shouldCompositeForBlendMode = (!m_paintLayer.layoutObject()->isDocument Element() || m_paintLayer.layoutObject()->isSVGRoot()) && m_paintLayer.stackingN ode()->isStackingContext() && m_paintLayer.hasNonIsolatedDescendantWithBlendMode (); 275 bool shouldCompositeForBlendMode = (!m_paintLayer.layoutObject()->isDocument Element() || m_paintLayer.layoutObject()->isSVGRoot()) && m_paintLayer.stackingN ode()->isStackingContext() && m_paintLayer.hasNonIsolatedDescendantWithBlendMode ();
266 if (shouldCompositeForBlendMode || m_paintLayer.paintsWithTransparency(paint ingInfo.getGlobalPaintFlags())) { 276 if (shouldCompositeForBlendMode || m_paintLayer.paintsWithTransparency(paint ingInfo.getGlobalPaintFlags())) {
267 FloatRect compositingBounds = FloatRect(m_paintLayer.paintingExtent(pain tingInfo.rootLayer, paintingInfo.subPixelAccumulation, paintingInfo.getGlobalPai ntFlags())); 277 FloatRect compositingBounds = FloatRect(m_paintLayer.paintingExtent(pain tingInfo.rootLayer, paintingInfo.subPixelAccumulation, paintingInfo.getGlobalPai ntFlags()));
268 compositingRecorder.emplace(context, *m_paintLayer.layoutObject(), 278 compositingRecorder.emplace(context, *m_paintLayer.layoutObject(),
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 if (!m_paintLayer.containsDirtyOverlayScrollbars()) 766 if (!m_paintLayer.containsDirtyOverlayScrollbars())
757 return; 767 return;
758 768
759 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe ct(damageRect)), paintFlags, LayoutSize()); 769 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe ct(damageRect)), paintFlags, LayoutSize());
760 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); 770 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars);
761 771
762 m_paintLayer.setContainsDirtyOverlayScrollbars(false); 772 m_paintLayer.setContainsDirtyOverlayScrollbars(false);
763 } 773 }
764 774
765 } // namespace blink 775 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/css3/masking/clip-path-reference-box-inline-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698