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

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

Issue 2624383002: Apply SVG viewport clips in PaintLayer; paint background of replaced like boxes. (Closed)
Patch Set: none 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 unified diff | Download patch
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/BoxClipper.h" 5 #include "core/paint/BoxClipper.h"
6 6
7 #include "core/layout/LayoutBox.h" 7 #include "core/layout/LayoutBox.h"
8 #include "core/layout/svg/LayoutSVGRoot.h" 8 #include "core/layout/svg/LayoutSVGRoot.h"
9 #include "core/paint/ObjectPaintProperties.h" 9 #include "core/paint/ObjectPaintProperties.h"
10 #include "core/paint/PaintInfo.h" 10 #include "core/paint/PaintInfo.h"
11 #include "core/paint/PaintLayer.h" 11 #include "core/paint/PaintLayer.h"
12 #include "platform/RuntimeEnabledFeatures.h" 12 #include "platform/RuntimeEnabledFeatures.h"
13 #include "platform/graphics/GraphicsLayer.h" 13 #include "platform/graphics/GraphicsLayer.h"
14 #include "platform/graphics/paint/ClipDisplayItem.h" 14 #include "platform/graphics/paint/ClipDisplayItem.h"
15 #include "platform/graphics/paint/PaintController.h" 15 #include "platform/graphics/paint/PaintController.h"
16 16
17 namespace blink { 17 namespace blink {
18 18
19 // Clips for boxes are applied by the box's PaintLayerClipper, if the box has
20 // a self-painting PaintLayer. Otherwise the box clips itself.
21 // Note that this method is very similar to
22 // PaintLayerClipper::shouldClipOverflow for that reason.
23 //
24 // An exception is control clip, which is currently never applied by
25 // PaintLayerClipper.
19 static bool boxNeedsClip(const LayoutBox& box) { 26 static bool boxNeedsClip(const LayoutBox& box) {
20 if (box.hasControlClip()) 27 if (box.hasControlClip())
21 return true; 28 return true;
29 if (box.hasLayer() && box.layer()->isSelfPaintingLayer())
30 return false;
22 if (box.isSVGRoot() && toLayoutSVGRoot(box).shouldApplyViewportClip()) 31 if (box.isSVGRoot() && toLayoutSVGRoot(box).shouldApplyViewportClip())
23 return true; 32 return true;
24 if (box.hasLayer() && box.layer()->isSelfPaintingLayer())
25 return false;
26 return box.hasOverflowClip() || box.styleRef().containsPaint(); 33 return box.hasOverflowClip() || box.styleRef().containsPaint();
27 } 34 }
28 35
29 DISABLE_CFI_PERF 36 DISABLE_CFI_PERF
30 BoxClipper::BoxClipper(const LayoutBox& box, 37 BoxClipper::BoxClipper(const LayoutBox& box,
31 const PaintInfo& paintInfo, 38 const PaintInfo& paintInfo,
32 const LayoutPoint& accumulatedOffset, 39 const LayoutPoint& accumulatedOffset,
33 ContentsClipBehavior contentsClipBehavior) 40 ContentsClipBehavior contentsClipBehavior)
34 : m_box(box), 41 : m_box(box),
35 m_paintInfo(paintInfo), 42 m_paintInfo(paintInfo),
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 BoxClipper::~BoxClipper() { 105 BoxClipper::~BoxClipper() {
99 if (m_clipType == DisplayItem::kUninitializedType) 106 if (m_clipType == DisplayItem::kUninitializedType)
100 return; 107 return;
101 108
102 DCHECK(boxNeedsClip(m_box)); 109 DCHECK(boxNeedsClip(m_box));
103 m_paintInfo.context.getPaintController().endItem<EndClipDisplayItem>( 110 m_paintInfo.context.getPaintController().endItem<EndClipDisplayItem>(
104 m_box, DisplayItem::clipTypeToEndClipType(m_clipType)); 111 m_box, DisplayItem::clipTypeToEndClipType(m_clipType));
105 } 112 }
106 113
107 } // namespace blink 114 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698