| 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 #ifndef BoxPainter_h | 5 #ifndef BoxPainter_h |
| 6 #define BoxPainter_h | 6 #define BoxPainter_h |
| 7 | 7 |
| 8 #include "core/paint/ObjectPainter.h" | 8 #include "core/paint/ObjectPainter.h" |
| 9 #include "core/rendering/RenderBoxModelObject.h" | 9 #include "core/rendering/RenderBoxModelObject.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class BackgroundImageGeometry; | 13 class BackgroundImageGeometry; |
| 14 class FloatRoundedRect; |
| 14 class LayoutPoint; | 15 class LayoutPoint; |
| 15 struct PaintInfo; | 16 struct PaintInfo; |
| 16 class RenderBox; | 17 class RenderBox; |
| 17 class RenderObject; | 18 class RenderObject; |
| 18 | 19 |
| 19 class BoxPainter { | 20 class BoxPainter { |
| 20 public: | 21 public: |
| 21 BoxPainter(RenderBox& renderBox) : m_renderBox(renderBox) { } | 22 BoxPainter(RenderBox& renderBox) : m_renderBox(renderBox) { } |
| 22 void paint(const PaintInfo&, const LayoutPoint&); | 23 void paint(const PaintInfo&, const LayoutPoint&); |
| 23 | 24 |
| 24 void paintBoxDecorationBackground(const PaintInfo&, const LayoutPoint&); | 25 void paintBoxDecorationBackground(const PaintInfo&, const LayoutPoint&); |
| 25 void paintMask(const PaintInfo&, const LayoutPoint&); | 26 void paintMask(const PaintInfo&, const LayoutPoint&); |
| 26 void paintClippingMask(const PaintInfo&, const LayoutPoint&); | 27 void paintClippingMask(const PaintInfo&, const LayoutPoint&); |
| 27 void paintFillLayers(const PaintInfo&, const Color&, const FillLayer&, const
LayoutRect&, BackgroundBleedAvoidance = BackgroundBleedNone, CompositeOperator
= CompositeSourceOver, RenderObject* backgroundObject = 0); | 28 void paintFillLayers(const PaintInfo&, const Color&, const FillLayer&, const
LayoutRect&, BackgroundBleedAvoidance = BackgroundBleedNone, CompositeOperator
= CompositeSourceOver, RenderObject* backgroundObject = 0); |
| 28 void paintMaskImages(const PaintInfo&, const LayoutRect&); | 29 void paintMaskImages(const PaintInfo&, const LayoutRect&); |
| 29 void paintBoxDecorationBackgroundWithRect(const PaintInfo&, const LayoutPoin
t&, const LayoutRect&); | 30 void paintBoxDecorationBackgroundWithRect(const PaintInfo&, const LayoutPoin
t&, const LayoutRect&); |
| 30 static void paintFillLayerExtended(RenderBoxModelObject&, const PaintInfo&,
const Color&, const FillLayer&, const LayoutRect&, BackgroundBleedAvoidance, Inl
ineFlowBox* = 0, const LayoutSize& = LayoutSize(), CompositeOperator = Composite
SourceOver, RenderObject* backgroundObject = 0, bool skipBaseColor = false); | 31 static void paintFillLayerExtended(RenderBoxModelObject&, const PaintInfo&,
const Color&, const FillLayer&, const LayoutRect&, BackgroundBleedAvoidance, Inl
ineFlowBox* = 0, const LayoutSize& = LayoutSize(), CompositeOperator = Composite
SourceOver, RenderObject* backgroundObject = 0, bool skipBaseColor = false); |
| 31 static void calculateBackgroundImageGeometry(RenderBoxModelObject&, const Re
nderLayerModelObject* paintContainer, const FillLayer&, const LayoutRect& paintR
ect, BackgroundImageGeometry&, RenderObject* = 0); | 32 static void calculateBackgroundImageGeometry(RenderBoxModelObject&, const Re
nderLayerModelObject* paintContainer, const FillLayer&, const LayoutRect& paintR
ect, BackgroundImageGeometry&, RenderObject* = 0); |
| 32 static InterpolationQuality chooseInterpolationQuality(RenderBoxModelObject&
, GraphicsContext*, Image*, const void*, const LayoutSize&); | 33 static InterpolationQuality chooseInterpolationQuality(RenderBoxModelObject&
, GraphicsContext*, Image*, const void*, const LayoutSize&); |
| 33 static void clipRoundedInnerRect(GraphicsContext*, const LayoutRect&, const
RoundedRect& clipRect); | 34 static void clipRoundedInnerRect(GraphicsContext*, const LayoutRect&, const
FloatRoundedRect& clipRect); |
| 34 static bool paintNinePieceImage(RenderBoxModelObject&, GraphicsContext*, con
st LayoutRect&, const RenderStyle*, const NinePieceImage&, CompositeOperator = C
ompositeSourceOver); | 35 static bool paintNinePieceImage(RenderBoxModelObject&, GraphicsContext*, con
st LayoutRect&, const RenderStyle*, const NinePieceImage&, CompositeOperator = C
ompositeSourceOver); |
| 35 static void paintBorder(RenderBoxModelObject&, const PaintInfo&, const Layou
tRect&, const RenderStyle*, BackgroundBleedAvoidance = BackgroundBleedNone, bool
includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true); | 36 static void paintBorder(RenderBoxModelObject&, const PaintInfo&, const Layou
tRect&, const RenderStyle*, BackgroundBleedAvoidance = BackgroundBleedNone, bool
includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true); |
| 36 static void paintBoxShadow(const PaintInfo&, const LayoutRect&, const Render
Style*, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRigh
tEdge = true); | 37 static void paintBoxShadow(const PaintInfo&, const LayoutRect&, const Render
Style*, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRigh
tEdge = true); |
| 37 static bool shouldAntialiasLines(GraphicsContext*); | 38 static bool shouldAntialiasLines(GraphicsContext*); |
| 38 | 39 |
| 39 private: | 40 private: |
| 40 void paintBackground(const PaintInfo&, const LayoutRect&, const Color& backg
roundColor, BackgroundBleedAvoidance = BackgroundBleedNone); | 41 void paintBackground(const PaintInfo&, const LayoutRect&, const Color& backg
roundColor, BackgroundBleedAvoidance = BackgroundBleedNone); |
| 41 void paintRootBoxFillLayers(const PaintInfo&); | 42 void paintRootBoxFillLayers(const PaintInfo&); |
| 42 void paintFillLayer(const PaintInfo&, const Color&, const FillLayer&, const
LayoutRect&, BackgroundBleedAvoidance, CompositeOperator, RenderObject* backgrou
ndObject, bool skipBaseColor = false); | 43 void paintFillLayer(const PaintInfo&, const Color&, const FillLayer&, const
LayoutRect&, BackgroundBleedAvoidance, CompositeOperator, RenderObject* backgrou
ndObject, bool skipBaseColor = false); |
| 43 static void paintRootBackgroundColor(RenderObject&, const PaintInfo&, const
LayoutRect&, const Color&); | 44 static void paintRootBackgroundColor(RenderObject&, const PaintInfo&, const
LayoutRect&, const Color&); |
| 44 static RoundedRect backgroundRoundedRectAdjustedForBleedAvoidance(RenderObje
ct&, GraphicsContext*, const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBo
x*, const LayoutSize&, bool includeLogicalLeftEdge, bool includeLogicalRightEdge
); | 45 static FloatRoundedRect backgroundRoundedRectAdjustedForBleedAvoidance(Rende
rObject&, GraphicsContext*, const LayoutRect&, BackgroundBleedAvoidance, InlineF
lowBox*, const LayoutSize&, bool includeLogicalLeftEdge, bool includeLogicalRigh
tEdge); |
| 45 static RoundedRect getBackgroundRoundedRect(RenderObject&, const LayoutRect&
, InlineFlowBox*, LayoutUnit inlineBoxWidth, LayoutUnit inlineBoxHeight, | 46 static FloatRoundedRect getBackgroundRoundedRect(RenderObject&, const Layout
Rect&, InlineFlowBox*, LayoutUnit inlineBoxWidth, LayoutUnit inlineBoxHeight, |
| 46 bool includeLogicalLeftEdge, bool includeLogicalRightEdge); | 47 bool includeLogicalLeftEdge, bool includeLogicalRightEdge); |
| 47 static bool isDocumentElementWithOpaqueBackground(RenderObject&); | 48 static bool isDocumentElementWithOpaqueBackground(RenderObject&); |
| 48 static void applyBoxShadowForBackground(GraphicsContext*, RenderObject&); | 49 static void applyBoxShadowForBackground(GraphicsContext*, RenderObject&); |
| 49 static bool fixedBackgroundPaintsInLocalCoordinates(const RenderObject&); | 50 static bool fixedBackgroundPaintsInLocalCoordinates(const RenderObject&); |
| 50 static IntSize calculateFillTileSize(const RenderBoxModelObject&, const Fill
Layer&, const IntSize& scaledPositioningAreaSize); | 51 static IntSize calculateFillTileSize(const RenderBoxModelObject&, const Fill
Layer&, const IntSize& scaledPositioningAreaSize); |
| 51 static void paintTranslucentBorderSides(RenderObject&, GraphicsContext*, con
st RenderStyle*, const RoundedRect& outerBorder, const RoundedRect& innerBorder,
const IntPoint& innerBorderAdjustment, | 52 static void paintTranslucentBorderSides(RenderObject&, GraphicsContext*, con
st RenderStyle*, const FloatRoundedRect& outerBorder, const FloatRoundedRect& in
nerBorder, const IntPoint& innerBorderAdjustment, |
| 52 const BorderEdge[], BorderEdgeFlags, BackgroundBleedAvoidance, bool incl
udeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias = false); | 53 const BorderEdge[], BorderEdgeFlags, BackgroundBleedAvoidance, bool incl
udeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias = false); |
| 53 static LayoutRect borderInnerRectAdjustedForBleedAvoidance(GraphicsContext*,
const LayoutRect&, BackgroundBleedAvoidance); | 54 static LayoutRect borderInnerRectAdjustedForBleedAvoidance(GraphicsContext*,
const LayoutRect&, BackgroundBleedAvoidance); |
| 54 static void paintOneBorderSide(RenderObject&, GraphicsContext*, const Render
Style*, const RoundedRect& outerBorder, const RoundedRect& innerBorder, | 55 static void paintOneBorderSide(RenderObject&, GraphicsContext*, const Render
Style*, const FloatRoundedRect& outerBorder, const FloatRoundedRect& innerBorder
, |
| 55 const IntRect& sideRect, BoxSide, BoxSide adjacentSide1, BoxSide adjacen
tSide2, const BorderEdge[], | 56 const FloatRect& sideRect, BoxSide, BoxSide adjacentSide1, BoxSide adjac
entSide2, const BorderEdge[], |
| 56 const Path*, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool
includeLogicalRightEdge, bool antialias, const Color* overrideColor = 0); | 57 const Path*, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool
includeLogicalRightEdge, bool antialias, const Color* overrideColor = 0); |
| 57 static void paintBorderSides(RenderObject&, GraphicsContext*, const RenderSt
yle*, const RoundedRect& outerBorder, const RoundedRect& innerBorder, | 58 static void paintBorderSides(RenderObject&, GraphicsContext*, const RenderSt
yle*, const FloatRoundedRect& outerBorder, const FloatRoundedRect& innerBorder, |
| 58 const IntPoint& innerBorderAdjustment, const BorderEdge[], BorderEdgeFla
gs, BackgroundBleedAvoidance, | 59 const IntPoint& innerBorderAdjustment, const BorderEdge[], BorderEdgeFla
gs, BackgroundBleedAvoidance, |
| 59 bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialia
s = false, const Color* overrideColor = 0); | 60 bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialia
s = false, const Color* overrideColor = 0); |
| 60 static void drawBoxSideFromPath(GraphicsContext*, const LayoutRect&, const P
ath&, const BorderEdge[], | 61 static void drawBoxSideFromPath(GraphicsContext*, const LayoutRect&, const P
ath&, const BorderEdge[], |
| 61 float thickness, float drawThickness, BoxSide, const RenderStyle*, | 62 float thickness, float drawThickness, BoxSide, const RenderStyle*, |
| 62 Color, EBorderStyle, BackgroundBleedAvoidance, bool includeLogicalLeftEd
ge, bool includeLogicalRightEdge); | 63 Color, EBorderStyle, BackgroundBleedAvoidance, bool includeLogicalLeftEd
ge, bool includeLogicalRightEdge); |
| 63 static void clipBorderSidePolygon(GraphicsContext*, const RoundedRect& outer
Border, const RoundedRect& innerBorder, | 64 static void clipBorderSidePolygon(GraphicsContext*, const FloatRoundedRect&
outerBorder, const FloatRoundedRect& innerBorder, |
| 64 BoxSide, bool firstEdgeMatches, bool secondEdgeMatches); | 65 BoxSide, bool firstEdgeMatches, bool secondEdgeMatches); |
| 65 static void clipBorderSideForComplexInnerPath(GraphicsContext*, const Rounde
dRect&, const RoundedRect&, BoxSide, const BorderEdge[]); | 66 static void clipBorderSideForComplexInnerPath(GraphicsContext*, const FloatR
oundedRect&, const FloatRoundedRect&, BoxSide, const BorderEdge[]); |
| 66 | 67 |
| 67 LayoutRect boundsForDrawingRecorder(const LayoutPoint& paintOffset); | 68 LayoutRect boundsForDrawingRecorder(const LayoutPoint& paintOffset); |
| 68 | 69 |
| 69 // FIXME: this should be const. | 70 // FIXME: this should be const. |
| 70 RenderBox& m_renderBox; | 71 RenderBox& m_renderBox; |
| 71 }; | 72 }; |
| 72 | 73 |
| 73 } // namespace blink | 74 } // namespace blink |
| 74 | 75 |
| 75 #endif | 76 #endif |
| OLD | NEW |