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

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

Issue 2280963002: Fix clip-path reference box/coordinate space setup for hit-testing (Closed)
Patch Set: DCHECK rootLayer; rename computeReferenceBox to boxForClipPath 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/Source/core/paint/PaintLayer.cpp ('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/LayoutInline.h"
9 #include "core/layout/LayoutView.h" 9 #include "core/layout/LayoutView.h"
10 #include "core/paint/ClipPathClipper.h" 10 #include "core/paint/ClipPathClipper.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 paintLayer.setPreviousPaintDirtyRect(paintingInfo.paintDirtyRect); 174 paintLayer.setPreviousPaintDirtyRect(paintingInfo.paintDirtyRect);
175 175
176 // Repaint if scroll offset accumulation changes. 176 // Repaint if scroll offset accumulation changes.
177 if (!needsRepaint && paintingInfo.scrollOffsetAccumulation != paintLayer.pre viousScrollOffsetAccumulationForPainting()) 177 if (!needsRepaint && paintingInfo.scrollOffsetAccumulation != paintLayer.pre viousScrollOffsetAccumulationForPainting())
178 needsRepaint = true; 178 needsRepaint = true;
179 paintLayer.setPreviousScrollOffsetAccumulationForPainting(paintingInfo.scrol lOffsetAccumulation); 179 paintLayer.setPreviousScrollOffsetAccumulationForPainting(paintingInfo.scrol lOffsetAccumulation);
180 180
181 return needsRepaint; 181 return needsRepaint;
182 } 182 }
183 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
192 PaintLayerPainter::PaintResult PaintLayerPainter::paintLayerContents(GraphicsCon text& context, const PaintLayerPaintingInfo& paintingInfoArg, PaintLayerFlags pa intFlags, FragmentPolicy fragmentPolicy) 184 PaintLayerPainter::PaintResult PaintLayerPainter::paintLayerContents(GraphicsCon text& context, const PaintLayerPaintingInfo& paintingInfoArg, PaintLayerFlags pa intFlags, FragmentPolicy fragmentPolicy)
193 { 185 {
194 ASSERT(m_paintLayer.isSelfPaintingLayer() || m_paintLayer.hasSelfPaintingLay erDescendant()); 186 ASSERT(m_paintLayer.isSelfPaintingLayer() || m_paintLayer.hasSelfPaintingLay erDescendant());
195 ASSERT(!(paintFlags & PaintLayerAppliedTransform)); 187 ASSERT(!(paintFlags & PaintLayerAppliedTransform));
196 188
197 bool isSelfPaintingLayer = m_paintLayer.isSelfPaintingLayer(); 189 bool isSelfPaintingLayer = m_paintLayer.isSelfPaintingLayer();
198 bool isPaintingOverlayScrollbars = paintFlags & PaintLayerPaintingOverlayScr ollbars; 190 bool isPaintingOverlayScrollbars = paintFlags & PaintLayerPaintingOverlayScr ollbars;
199 bool isPaintingScrollingContent = paintFlags & PaintLayerPaintingCompositing ScrollingPhase; 191 bool isPaintingScrollingContent = paintFlags & PaintLayerPaintingCompositing ScrollingPhase;
200 bool isPaintingCompositedForeground = paintFlags & PaintLayerPaintingComposi tingForegroundPhase; 192 bool isPaintingCompositedForeground = paintFlags & PaintLayerPaintingComposi tingForegroundPhase;
201 bool isPaintingCompositedBackground = paintFlags & PaintLayerPaintingComposi tingBackgroundPhase; 193 bool isPaintingCompositedBackground = paintFlags & PaintLayerPaintingComposi tingBackgroundPhase;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 Optional<ClipPathClipper> clipPathClipper; 247 Optional<ClipPathClipper> clipPathClipper;
256 // Clip-path, like border radius, must not be applied to the contents of a c omposited-scrolling container. 248 // Clip-path, like border radius, must not be applied to the contents of a c omposited-scrolling container.
257 // It must, however, still be applied to the mask layer, so that the composi tor can properly mask the 249 // It must, however, still be applied to the mask layer, so that the composi tor can properly mask the
258 // scrolling contents and scrollbars. 250 // scrolling contents and scrollbars.
259 if (m_paintLayer.layoutObject()->hasClipPath() && (!m_paintLayer.needsCompos itedScrolling() || (paintFlags & PaintLayerPaintingChildClippingMaskPhase))) { 251 if (m_paintLayer.layoutObject()->hasClipPath() && (!m_paintLayer.needsCompos itedScrolling() || (paintFlags & PaintLayerPaintingChildClippingMaskPhase))) {
260 if (!rootRelativeBoundsComputed) { 252 if (!rootRelativeBoundsComputed) {
261 rootRelativeBounds = m_paintLayer.physicalBoundingBoxIncludingReflec tionAndStackingChildren(offsetFromRoot); 253 rootRelativeBounds = m_paintLayer.physicalBoundingBoxIncludingReflec tionAndStackingChildren(offsetFromRoot);
262 rootRelativeBoundsComputed = true; 254 rootRelativeBoundsComputed = true;
263 } 255 }
264 paintingInfo.ancestorHasClipPathClipping = true; 256 paintingInfo.ancestorHasClipPathClipping = true;
265 LayoutRect referenceBox(computeReferenceBox(*m_paintLayer.layoutObject() )); 257
258 LayoutRect referenceBox(m_paintLayer.boxForClipPath());
266 referenceBox.moveBy(offsetFromRoot); 259 referenceBox.moveBy(offsetFromRoot);
267 clipPathClipper.emplace( 260 clipPathClipper.emplace(
268 context, *m_paintLayer.layoutObject(), FloatRect(referenceBox), Floa tRect(rootRelativeBounds), FloatPoint(offsetFromRoot)); 261 context, *m_paintLayer.layoutObject(), FloatRect(referenceBox), Floa tRect(rootRelativeBounds), FloatPoint(offsetFromRoot));
269 } 262 }
270 263
271 Optional<CompositingRecorder> compositingRecorder; 264 Optional<CompositingRecorder> compositingRecorder;
272 // Blending operations must be performed only with the nearest ancestor stac king context. 265 // Blending operations must be performed only with the nearest ancestor stac king context.
273 // Note that there is no need to composite if we're painting the root. 266 // Note that there is no need to composite if we're painting the root.
274 // FIXME: this should be unified further into PaintLayer::paintsWithTranspar ency(). 267 // FIXME: this should be unified further into PaintLayer::paintsWithTranspar ency().
275 bool shouldCompositeForBlendMode = (!m_paintLayer.layoutObject()->isDocument Element() || m_paintLayer.layoutObject()->isSVGRoot()) && m_paintLayer.stackingN ode()->isStackingContext() && m_paintLayer.hasNonIsolatedDescendantWithBlendMode (); 268 bool shouldCompositeForBlendMode = (!m_paintLayer.layoutObject()->isDocument Element() || m_paintLayer.layoutObject()->isSVGRoot()) && m_paintLayer.stackingN ode()->isStackingContext() && m_paintLayer.hasNonIsolatedDescendantWithBlendMode ();
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 if (!m_paintLayer.containsDirtyOverlayScrollbars()) 758 if (!m_paintLayer.containsDirtyOverlayScrollbars())
766 return; 759 return;
767 760
768 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe ct(damageRect)), paintFlags, LayoutSize()); 761 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe ct(damageRect)), paintFlags, LayoutSize());
769 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); 762 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars);
770 763
771 m_paintLayer.setContainsDirtyOverlayScrollbars(false); 764 m_paintLayer.setContainsDirtyOverlayScrollbars(false);
772 } 765 }
773 766
774 } // namespace blink 767 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698