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

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

Issue 2181953004: Changed ComputedStyle's EVisibility to be an enum class and fixed naming (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_move_computedstyle_around
Patch Set: Rebase Created 4 years, 4 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/ReplacedPainter.h" 5 #include "core/paint/ReplacedPainter.h"
6 6
7 #include "core/layout/LayoutReplaced.h" 7 #include "core/layout/LayoutReplaced.h"
8 #include "core/layout/api/SelectionState.h" 8 #include "core/layout/api/SelectionState.h"
9 #include "core/layout/svg/LayoutSVGRoot.h" 9 #include "core/layout/svg/LayoutSVGRoot.h"
10 #include "core/paint/BoxPainter.h" 10 #include "core/paint/BoxPainter.h"
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 24
25 void ReplacedPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paint Offset) 25 void ReplacedPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paint Offset)
26 { 26 {
27 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutReplaced.location(); 27 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutReplaced.location();
28 if (!shouldPaint(paintInfo, adjustedPaintOffset)) 28 if (!shouldPaint(paintInfo, adjustedPaintOffset))
29 return; 29 return;
30 30
31 LayoutRect borderRect(adjustedPaintOffset, m_layoutReplaced.size()); 31 LayoutRect borderRect(adjustedPaintOffset, m_layoutReplaced.size());
32 32
33 if (m_layoutReplaced.style()->visibility() == VISIBLE && m_layoutReplaced.ha sBoxDecorationBackground() && (paintInfo.phase == PaintPhaseForeground || paintI nfo.phase == PaintPhaseSelection)) 33 if (m_layoutReplaced.style()->visibility() == EVisibility::Visible && m_layo utReplaced.hasBoxDecorationBackground() && (paintInfo.phase == PaintPhaseForegro und || paintInfo.phase == PaintPhaseSelection))
34 m_layoutReplaced.paintBoxDecorationBackground(paintInfo, adjustedPaintOf fset); 34 m_layoutReplaced.paintBoxDecorationBackground(paintInfo, adjustedPaintOf fset);
35 35
36 if (paintInfo.phase == PaintPhaseMask) { 36 if (paintInfo.phase == PaintPhaseMask) {
37 m_layoutReplaced.paintMask(paintInfo, adjustedPaintOffset); 37 m_layoutReplaced.paintMask(paintInfo, adjustedPaintOffset);
38 return; 38 return;
39 } 39 }
40 40
41 if (paintInfo.phase == PaintPhaseClippingMask && (!m_layoutReplaced.hasLayer () || !m_layoutReplaced.layer()->hasCompositedClippingMask())) 41 if (paintInfo.phase == PaintPhaseClippingMask && (!m_layoutReplaced.hasLayer () || !m_layoutReplaced.layer()->hasCompositedClippingMask()))
42 return; 42 return;
43 43
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 96 }
97 97
98 bool ReplacedPainter::shouldPaint(const PaintInfo& paintInfo, const LayoutPoint& adjustedPaintOffset) const 98 bool ReplacedPainter::shouldPaint(const PaintInfo& paintInfo, const LayoutPoint& adjustedPaintOffset) const
99 { 99 {
100 if (paintInfo.phase != PaintPhaseForeground && !shouldPaintSelfOutline(paint Info.phase) 100 if (paintInfo.phase != PaintPhaseForeground && !shouldPaintSelfOutline(paint Info.phase)
101 && paintInfo.phase != PaintPhaseSelection && paintInfo.phase != PaintPha seMask && paintInfo.phase != PaintPhaseClippingMask) 101 && paintInfo.phase != PaintPhaseSelection && paintInfo.phase != PaintPha seMask && paintInfo.phase != PaintPhaseClippingMask)
102 return false; 102 return false;
103 103
104 // If we're invisible or haven't received a layout yet, just bail. 104 // If we're invisible or haven't received a layout yet, just bail.
105 // But if it's an SVG root, there can be children, so we'll check visibility later. 105 // But if it's an SVG root, there can be children, so we'll check visibility later.
106 if (!m_layoutReplaced.isSVGRoot() && m_layoutReplaced.style()->visibility() != VISIBLE) 106 if (!m_layoutReplaced.isSVGRoot() && m_layoutReplaced.style()->visibility() != EVisibility::Visible)
107 return false; 107 return false;
108 108
109 LayoutRect paintRect(m_layoutReplaced.visualOverflowRect()); 109 LayoutRect paintRect(m_layoutReplaced.visualOverflowRect());
110 paintRect.unite(m_layoutReplaced.localSelectionRect()); 110 paintRect.unite(m_layoutReplaced.localSelectionRect());
111 paintRect.moveBy(adjustedPaintOffset); 111 paintRect.moveBy(adjustedPaintOffset);
112 112
113 if (!paintInfo.cullRect().intersectsCullRect(paintRect)) 113 if (!paintInfo.cullRect().intersectsCullRect(paintRect))
114 return false; 114 return false;
115 115
116 return true; 116 return true;
117 } 117 }
118 118
119 } // namespace blink 119 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698