| OLD | NEW |
| 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 Loading... |
| 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 ThemePainter& themePainter = LayoutTheme::theme().painter(); |
| 118 bool themePainted = boxDecorationData.hasAppearance && !themePainter.paint(&
m_layoutBox, paintInfo, snappedPaintRect); |
| 117 if (!themePainted) { | 119 if (!themePainted) { |
| 118 if (boxDecorationData.bleedAvoidance == BackgroundBleedBackgroundOverBor
der) | 120 if (boxDecorationData.bleedAvoidance == BackgroundBleedBackgroundOverBor
der) |
| 119 paintBorder(m_layoutBox, paintInfo, paintRect, style, boxDecorationD
ata.bleedAvoidance); | 121 paintBorder(m_layoutBox, paintInfo, paintRect, style, boxDecorationD
ata.bleedAvoidance); |
| 120 | 122 |
| 121 paintBackground(paintInfo, paintRect, boxDecorationData.backgroundColor,
boxDecorationData.bleedAvoidance); | 123 paintBackground(paintInfo, paintRect, boxDecorationData.backgroundColor,
boxDecorationData.bleedAvoidance); |
| 122 | 124 |
| 123 if (boxDecorationData.hasAppearance) | 125 if (boxDecorationData.hasAppearance) |
| 124 LayoutTheme::theme().paintDecorations(&m_layoutBox, paintInfo, snapp
edPaintRect); | 126 themePainter.paintDecorations(&m_layoutBox, paintInfo, snappedPaintR
ect); |
| 125 } | 127 } |
| 126 paintBoxShadow(paintInfo, paintRect, style, Inset); | 128 paintBoxShadow(paintInfo, paintRect, style, Inset); |
| 127 | 129 |
| 128 // The theme will tell us whether or not we should also paint the CSS border
. | 130 // The theme will tell us whether or not we should also paint the CSS border
. |
| 129 if (boxDecorationData.hasBorder && boxDecorationData.bleedAvoidance != Backg
roundBleedBackgroundOverBorder | 131 if (boxDecorationData.hasBorder && boxDecorationData.bleedAvoidance != Backg
roundBleedBackgroundOverBorder |
| 130 && (!boxDecorationData.hasAppearance || (!themePainted && LayoutTheme::t
heme().paintBorderOnly(&m_layoutBox, paintInfo, snappedPaintRect))) | 132 && (!boxDecorationData.hasAppearance || (!themePainted && LayoutTheme::t
heme().painter().paintBorderOnly(&m_layoutBox, paintInfo, snappedPaintRect))) |
| 131 && !(m_layoutBox.isTable() && toLayoutTable(&m_layoutBox)->collapseBorde
rs())) | 133 && !(m_layoutBox.isTable() && toLayoutTable(&m_layoutBox)->collapseBorde
rs())) |
| 132 paintBorder(m_layoutBox, paintInfo, paintRect, style, boxDecorationData.
bleedAvoidance); | 134 paintBorder(m_layoutBox, paintInfo, paintRect, style, boxDecorationData.
bleedAvoidance); |
| 133 | 135 |
| 134 if (boxDecorationData.bleedAvoidance == BackgroundBleedClipLayer) | 136 if (boxDecorationData.bleedAvoidance == BackgroundBleedClipLayer) |
| 135 paintInfo.context->endLayer(); | 137 paintInfo.context->endLayer(); |
| 136 } | 138 } |
| 137 | 139 |
| 138 static bool skipBodyBackground(const LayoutBox* bodyElementRenderer) | 140 static bool skipBodyBackground(const LayoutBox* bodyElementRenderer) |
| 139 { | 141 { |
| 140 ASSERT(bodyElementRenderer->isBody()); | 142 ASSERT(bodyElementRenderer->isBody()); |
| (...skipping 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2285 | 2287 |
| 2286 FloatPoint secondQuad[4]; | 2288 FloatPoint secondQuad[4]; |
| 2287 secondQuad[0] = quad[0]; | 2289 secondQuad[0] = quad[0]; |
| 2288 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy); | 2290 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy); |
| 2289 secondQuad[2] = quad[2]; | 2291 secondQuad[2] = quad[2]; |
| 2290 secondQuad[3] = quad[3]; | 2292 secondQuad[3] = quad[3]; |
| 2291 graphicsContext->clipPolygon(4, secondQuad, !secondEdgeMatches); | 2293 graphicsContext->clipPolygon(4, secondQuad, !secondEdgeMatches); |
| 2292 } | 2294 } |
| 2293 | 2295 |
| 2294 } // namespace blink | 2296 } // namespace blink |
| OLD | NEW |