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

Side by Side Diff: Source/core/paint/BoxPainter.cpp

Issue 1102353008: Split ThemePainter out of LayoutTheme (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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 | Annotate | Revision Log
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 "config.h" 5 #include "config.h"
6 #include "core/paint/BoxPainter.h" 6 #include "core/paint/BoxPainter.h"
7 7
8 #include "core/HTMLNames.h" 8 #include "core/HTMLNames.h"
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/html/HTMLFrameOwnerElement.h" 10 #include "core/html/HTMLFrameOwnerElement.h"
11 #include "core/layout/ImageQualityController.h" 11 #include "core/layout/ImageQualityController.h"
12 #include "core/layout/LayoutBox.h" 12 #include "core/layout/LayoutBox.h"
13 #include "core/layout/LayoutBoxModelObject.h" 13 #include "core/layout/LayoutBoxModelObject.h"
14 #include "core/layout/LayoutObject.h" 14 #include "core/layout/LayoutObject.h"
15 #include "core/layout/LayoutTable.h" 15 #include "core/layout/LayoutTable.h"
16 #include "core/layout/LayoutTheme.h" 16 #include "core/layout/LayoutTheme.h"
17 #include "core/layout/LayoutView.h" 17 #include "core/layout/LayoutView.h"
18 #include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h" 18 #include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h"
19 #include "core/style/BorderEdge.h" 19 #include "core/style/BorderEdge.h"
20 #include "core/style/ShadowList.h" 20 #include "core/style/ShadowList.h"
21 #include "core/paint/BackgroundImageGeometry.h" 21 #include "core/paint/BackgroundImageGeometry.h"
22 #include "core/paint/BoxDecorationData.h" 22 #include "core/paint/BoxDecorationData.h"
23 #include "core/paint/DeprecatedPaintLayer.h" 23 #include "core/paint/DeprecatedPaintLayer.h"
24 #include "core/paint/LayoutObjectDrawingRecorder.h" 24 #include "core/paint/LayoutObjectDrawingRecorder.h"
25 #include "core/paint/PaintInfo.h" 25 #include "core/paint/PaintInfo.h"
26 #include "core/paint/RoundedInnerRectClipper.h" 26 #include "core/paint/RoundedInnerRectClipper.h"
27 #include "core/paint/ThemePainter.h"
27 #include "platform/LengthFunctions.h" 28 #include "platform/LengthFunctions.h"
28 #include "platform/geometry/LayoutPoint.h" 29 #include "platform/geometry/LayoutPoint.h"
29 #include "platform/geometry/LayoutRectOutsets.h" 30 #include "platform/geometry/LayoutRectOutsets.h"
30 #include "platform/graphics/GraphicsContextStateSaver.h" 31 #include "platform/graphics/GraphicsContextStateSaver.h"
31 #include "platform/graphics/paint/CompositingDisplayItem.h" 32 #include "platform/graphics/paint/CompositingDisplayItem.h"
32 33
33 namespace blink { 34 namespace blink {
34 35
35 void BoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffse t) 36 void BoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffse t)
36 { 37 {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 FloatRoundedRect border = style.getRoundedBorderFor(paintRect); 107 FloatRoundedRect border = style.getRoundedBorderFor(paintRect);
107 paintInfo.context->clipRoundedRect(border); 108 paintInfo.context->clipRoundedRect(border);
108 109
109 if (boxDecorationData.bleedAvoidance == BackgroundBleedClipLayer) 110 if (boxDecorationData.bleedAvoidance == BackgroundBleedClipLayer)
110 paintInfo.context->beginLayer(); 111 paintInfo.context->beginLayer();
111 } 112 }
112 113
113 // If we have a native theme appearance, paint that before painting our back ground. 114 // If we have a native theme appearance, paint that before painting our back ground.
114 // The theme will tell us whether or not we should also paint the CSS backgr ound. 115 // The theme will tell us whether or not we should also paint the CSS backgr ound.
115 IntRect snappedPaintRect(pixelSnappedIntRect(paintRect)); 116 IntRect snappedPaintRect(pixelSnappedIntRect(paintRect));
116 bool themePainted = boxDecorationData.hasAppearance && !LayoutTheme::theme() .paint(&m_layoutBox, paintInfo, snappedPaintRect); 117 bool themePainted = boxDecorationData.hasAppearance && !LayoutTheme::themePa inter().paint(&m_layoutBox, paintInfo, snappedPaintRect);
117 if (!themePainted) { 118 if (!themePainted) {
118 if (boxDecorationData.bleedAvoidance == BackgroundBleedBackgroundOverBor der) 119 if (boxDecorationData.bleedAvoidance == BackgroundBleedBackgroundOverBor der)
119 paintBorder(m_layoutBox, paintInfo, paintRect, style, boxDecorationD ata.bleedAvoidance); 120 paintBorder(m_layoutBox, paintInfo, paintRect, style, boxDecorationD ata.bleedAvoidance);
120 121
121 paintBackground(paintInfo, paintRect, boxDecorationData.backgroundColor, boxDecorationData.bleedAvoidance); 122 paintBackground(paintInfo, paintRect, boxDecorationData.backgroundColor, boxDecorationData.bleedAvoidance);
122 123
123 if (boxDecorationData.hasAppearance) 124 if (boxDecorationData.hasAppearance)
124 LayoutTheme::theme().paintDecorations(&m_layoutBox, paintInfo, snapp edPaintRect); 125 LayoutTheme::themePainter().paintDecorations(&m_layoutBox, paintInfo , snappedPaintRect);
125 } 126 }
126 paintBoxShadow(paintInfo, paintRect, style, Inset); 127 paintBoxShadow(paintInfo, paintRect, style, Inset);
127 128
128 // The theme will tell us whether or not we should also paint the CSS border . 129 // The theme will tell us whether or not we should also paint the CSS border .
129 if (boxDecorationData.hasBorder && boxDecorationData.bleedAvoidance != Backg roundBleedBackgroundOverBorder 130 if (boxDecorationData.hasBorder && boxDecorationData.bleedAvoidance != Backg roundBleedBackgroundOverBorder
130 && (!boxDecorationData.hasAppearance || (!themePainted && LayoutTheme::t heme().paintBorderOnly(&m_layoutBox, paintInfo, snappedPaintRect))) 131 && (!boxDecorationData.hasAppearance || (!themePainted && LayoutTheme::t hemePainter().paintBorderOnly(&m_layoutBox, paintInfo, snappedPaintRect)))
131 && !(m_layoutBox.isTable() && toLayoutTable(&m_layoutBox)->collapseBorde rs())) 132 && !(m_layoutBox.isTable() && toLayoutTable(&m_layoutBox)->collapseBorde rs()))
132 paintBorder(m_layoutBox, paintInfo, paintRect, style, boxDecorationData. bleedAvoidance); 133 paintBorder(m_layoutBox, paintInfo, paintRect, style, boxDecorationData. bleedAvoidance);
133 134
134 if (boxDecorationData.bleedAvoidance == BackgroundBleedClipLayer) 135 if (boxDecorationData.bleedAvoidance == BackgroundBleedClipLayer)
135 paintInfo.context->endLayer(); 136 paintInfo.context->endLayer();
136 } 137 }
137 138
138 static bool skipBodyBackground(const LayoutBox* bodyElementRenderer) 139 static bool skipBodyBackground(const LayoutBox* bodyElementRenderer)
139 { 140 {
140 ASSERT(bodyElementRenderer->isBody()); 141 ASSERT(bodyElementRenderer->isBody());
(...skipping 2142 matching lines...) Expand 10 before | Expand all | Expand 10 after
2283 2284
2284 FloatPoint secondQuad[4]; 2285 FloatPoint secondQuad[4];
2285 secondQuad[0] = quad[0]; 2286 secondQuad[0] = quad[0];
2286 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy); 2287 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy);
2287 secondQuad[2] = quad[2]; 2288 secondQuad[2] = quad[2];
2288 secondQuad[3] = quad[3]; 2289 secondQuad[3] = quad[3];
2289 graphicsContext->clipPolygon(4, secondQuad, !secondEdgeMatches); 2290 graphicsContext->clipPolygon(4, secondQuad, !secondEdgeMatches);
2290 } 2291 }
2291 2292
2292 } // namespace blink 2293 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698