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

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

Issue 1584903002: Improvement handling of background and outline paint phases (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@PaintPhaseRename
Patch Set: Created 4 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/paint/PaintInfo.h" 8 #include "core/paint/PaintInfo.h"
9 #include "core/paint/PaintLayer.h" 9 #include "core/paint/PaintLayer.h"
10 #include "platform/RuntimeEnabledFeatures.h" 10 #include "platform/RuntimeEnabledFeatures.h"
11 #include "platform/graphics/GraphicsLayer.h" 11 #include "platform/graphics/GraphicsLayer.h"
12 #include "platform/graphics/paint/ClipDisplayItem.h" 12 #include "platform/graphics/paint/ClipDisplayItem.h"
13 #include "platform/graphics/paint/PaintController.h" 13 #include "platform/graphics/paint/PaintController.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 BoxClipper::BoxClipper(const LayoutBox& box, const PaintInfo& paintInfo, const L ayoutPoint& accumulatedOffset, ContentsClipBehavior contentsClipBehavior) 17 BoxClipper::BoxClipper(const LayoutBox& box, const PaintInfo& paintInfo, const L ayoutPoint& accumulatedOffset, ContentsClipBehavior contentsClipBehavior)
18 : m_box(box) 18 : m_box(box)
19 , m_paintInfo(paintInfo) 19 , m_paintInfo(paintInfo)
20 , m_clipType(DisplayItem::UninitializedType) 20 , m_clipType(DisplayItem::UninitializedType)
21 { 21 {
22 if (m_paintInfo.phase == PaintPhaseSelfBlockBackground || m_paintInfo.phase == PaintPhaseSelfOutline || m_paintInfo.phase == PaintPhaseMask) 22 ASSERT(m_paintInfo.phase != PaintPhaseSelfBlockBackgroundOnly && m_paintInfo .phase != PaintPhaseSelfOutlineOnly);
23
24 if (m_paintInfo.phase == PaintPhaseMask)
23 return; 25 return;
24 26
25 bool isControlClip = m_box.hasControlClip(); 27 bool isControlClip = m_box.hasControlClip();
26 bool isOverflowOrContainmentClip = (m_box.hasOverflowClip() && !m_box.layer( )->isSelfPaintingLayer()) 28 bool isOverflowOrContainmentClip = (m_box.hasOverflowClip() && !m_box.layer( )->isSelfPaintingLayer())
27 || m_box.style()->containsPaint(); 29 || m_box.style()->containsPaint();
28 30
29 if (!isControlClip && !isOverflowOrContainmentClip) 31 if (!isControlClip && !isOverflowOrContainmentClip)
30 return; 32 return;
31 33
32 LayoutRect clipRect = isControlClip ? m_box.controlClipRect(accumulatedOffse t) : m_box.overflowClipRect(accumulatedOffset); 34 LayoutRect clipRect = isControlClip ? m_box.controlClipRect(accumulatedOffse t) : m_box.overflowClipRect(accumulatedOffset);
(...skipping 29 matching lines...) Expand all
62 BoxClipper::~BoxClipper() 64 BoxClipper::~BoxClipper()
63 { 65 {
64 if (m_clipType == DisplayItem::UninitializedType) 66 if (m_clipType == DisplayItem::UninitializedType)
65 return; 67 return;
66 68
67 ASSERT(m_box.hasControlClip() || (m_box.hasOverflowClip() && !m_box.layer()- >isSelfPaintingLayer()) || m_box.style()->containsPaint()); 69 ASSERT(m_box.hasControlClip() || (m_box.hasOverflowClip() && !m_box.layer()- >isSelfPaintingLayer()) || m_box.style()->containsPaint());
68 m_paintInfo.context.paintController().endItem<EndClipDisplayItem>(m_box, Dis playItem::clipTypeToEndClipType(m_clipType)); 70 m_paintInfo.context.paintController().endItem<EndClipDisplayItem>(m_box, Dis playItem::clipTypeToEndClipType(m_clipType));
69 } 71 }
70 72
71 } // namespace blink 73 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698