| 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/layout/LayoutBoxModelObject.h" | 8 #include "core/layout/LayoutBoxModelObject.h" |
| 9 #include "core/paint/ObjectPainter.h" | 9 #include "core/paint/ObjectPainter.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class BackgroundImageGeometry; | 13 class BackgroundImageGeometry; |
| 14 class FloatRoundedRect; | 14 class FloatRoundedRect; |
| 15 class LayoutPoint; | 15 class LayoutPoint; |
| 16 struct PaintInfo; | 16 struct PaintInfo; |
| 17 class LayoutBox; | 17 class LayoutBox; |
| 18 class LayoutObject; | 18 class LayoutObject; |
| 19 | 19 |
| 20 class BoxPainter { | 20 class BoxPainter { |
| 21 public: | 21 public: |
| 22 BoxPainter(LayoutBox& layoutBox) : m_layoutBox(layoutBox) { } | 22 BoxPainter(LayoutBox& layoutBox) : m_layoutBox(layoutBox) { } |
| 23 void paint(const PaintInfo&, const LayoutPoint&); | 23 void paint(const PaintInfo&, const LayoutPoint&); |
| 24 | 24 |
| 25 void paintBoxDecorationBackground(const PaintInfo&, const LayoutPoint&); | 25 void paintBoxDecorationBackground(const PaintInfo&, const LayoutPoint&); |
| 26 void paintMask(const PaintInfo&, const LayoutPoint&); | 26 void paintMask(const PaintInfo&, const LayoutPoint&); |
| 27 void paintClippingMask(const PaintInfo&, const LayoutPoint&); | 27 void paintClippingMask(const PaintInfo&, const LayoutPoint&); |
| 28 void paintFillLayers(const PaintInfo&, const Color&, const FillLayer&, const
LayoutRect&, BackgroundBleedAvoidance = BackgroundBleedNone, SkXfermode::Mode =
SkXfermode::kSrcOver_Mode, LayoutObject* backgroundObject = 0); | 28 |
| 29 typedef Vector<const FillLayer*, 8> FillLayerOcclusionOutputList; |
| 30 // Returns true if the result fill layers have non-associative blending or c
ompositing mode. |
| 31 // (i.e. The rendering will be different without creating isolation group by
context.saveLayer().) |
| 32 // Note that the output list will be in top-bottom order. |
| 33 bool calculateFillLayerOcclusionCulling(FillLayerOcclusionOutputList &revers
edPaintList, const FillLayer&); |
| 34 |
| 35 void paintFillLayers(const PaintInfo&, const Color&, const FillLayer&, const
LayoutRect&, BackgroundBleedAvoidance = BackgroundBleedNone, SkXfermode::Mode =
SkXfermode::kSrcOver_Mode, LayoutObject* backgroundObject = nullptr); |
| 29 void paintMaskImages(const PaintInfo&, const LayoutRect&); | 36 void paintMaskImages(const PaintInfo&, const LayoutRect&); |
| 30 void paintBoxDecorationBackgroundWithRect(const PaintInfo&, const LayoutPoin
t&, const LayoutRect&); | 37 void paintBoxDecorationBackgroundWithRect(const PaintInfo&, const LayoutPoin
t&, const LayoutRect&); |
| 31 static void paintFillLayerExtended(LayoutBoxModelObject&, const PaintInfo&,
const Color&, const FillLayer&, const LayoutRect&, BackgroundBleedAvoidance, Inl
ineFlowBox* = 0, const LayoutSize& = LayoutSize(), SkXfermode::Mode = SkXfermode
::kSrcOver_Mode, LayoutObject* backgroundObject = 0, bool skipBaseColor = false)
; | 38 static void paintFillLayerExtended(LayoutBoxModelObject&, const PaintInfo&,
const Color&, const FillLayer&, const LayoutRect&, BackgroundBleedAvoidance, Inl
ineFlowBox* = nullptr, const LayoutSize& = LayoutSize(), SkXfermode::Mode = SkXf
ermode::kSrcOver_Mode, LayoutObject* backgroundObject = nullptr); |
| 32 static void calculateBackgroundImageGeometry(LayoutBoxModelObject&, const La
youtBoxModelObject* paintContainer, const FillLayer&, const LayoutRect& paintRec
t, BackgroundImageGeometry&, LayoutObject* = 0); | 39 static void calculateBackgroundImageGeometry(LayoutBoxModelObject&, const La
youtBoxModelObject* paintContainer, const FillLayer&, const LayoutRect& paintRec
t, BackgroundImageGeometry&, LayoutObject* backgroundObject = nullptr); |
| 33 static InterpolationQuality chooseInterpolationQuality(LayoutObject&, Graphi
csContext*, Image*, const void*, const LayoutSize&); | 40 static InterpolationQuality chooseInterpolationQuality(LayoutObject&, Graphi
csContext*, Image*, const void*, const LayoutSize&); |
| 34 static bool paintNinePieceImage(LayoutBoxModelObject&, GraphicsContext*, con
st LayoutRect&, const ComputedStyle&, const NinePieceImage&, SkXfermode::Mode =
SkXfermode::kSrcOver_Mode); | 41 static bool paintNinePieceImage(LayoutBoxModelObject&, GraphicsContext*, con
st LayoutRect&, const ComputedStyle&, const NinePieceImage&, SkXfermode::Mode =
SkXfermode::kSrcOver_Mode); |
| 35 static void paintBorder(LayoutBoxModelObject&, const PaintInfo&, const Layou
tRect&, const ComputedStyle&, BackgroundBleedAvoidance = BackgroundBleedNone, bo
ol includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true); | 42 static void paintBorder(LayoutBoxModelObject&, const PaintInfo&, const Layou
tRect&, const ComputedStyle&, BackgroundBleedAvoidance = BackgroundBleedNone, bo
ol includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true); |
| 36 static void paintBoxShadow(const PaintInfo&, const LayoutRect&, const Comput
edStyle&, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRi
ghtEdge = true); | 43 static void paintBoxShadow(const PaintInfo&, const LayoutRect&, const Comput
edStyle&, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRi
ghtEdge = true); |
| 37 static bool shouldAntialiasLines(GraphicsContext*); | 44 static bool shouldAntialiasLines(GraphicsContext*); |
| 38 static bool allCornersClippedOut(const FloatRoundedRect& border, const IntRe
ct& clipRect); | 45 static bool allCornersClippedOut(const FloatRoundedRect& border, const IntRe
ct& clipRect); |
| 39 | 46 |
| 40 private: | 47 private: |
| 41 void paintBackground(const PaintInfo&, const LayoutRect&, const Color& backg
roundColor, BackgroundBleedAvoidance = BackgroundBleedNone); | 48 void paintBackground(const PaintInfo&, const LayoutRect&, const Color& backg
roundColor, BackgroundBleedAvoidance = BackgroundBleedNone); |
| 42 void paintRootBoxFillLayers(const PaintInfo&); | 49 void paintFillLayer(const PaintInfo&, const Color&, const FillLayer&, const
LayoutRect&, BackgroundBleedAvoidance, SkXfermode::Mode, LayoutObject* backgroun
dObject = nullptr); |
| 43 void paintFillLayer(const PaintInfo&, const Color&, const FillLayer&, const
LayoutRect&, BackgroundBleedAvoidance, SkXfermode::Mode, LayoutObject* backgroun
dObject, bool skipBaseColor = false); | |
| 44 static void paintRootBackgroundColor(LayoutObject&, const PaintInfo&, const
LayoutRect&, const Color&); | |
| 45 static FloatRoundedRect backgroundRoundedRectAdjustedForBleedAvoidance(Layou
tObject&, const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox*, const Lay
outSize&, bool includeLogicalLeftEdge, bool includeLogicalRightEdge); | 50 static FloatRoundedRect backgroundRoundedRectAdjustedForBleedAvoidance(Layou
tObject&, const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox*, const Lay
outSize&, bool includeLogicalLeftEdge, bool includeLogicalRightEdge); |
| 46 static FloatRoundedRect getBackgroundRoundedRect(LayoutObject&, const Layout
Rect&, InlineFlowBox*, LayoutUnit inlineBoxWidth, LayoutUnit inlineBoxHeight, | 51 static FloatRoundedRect getBackgroundRoundedRect(LayoutObject&, const Layout
Rect&, InlineFlowBox*, LayoutUnit inlineBoxWidth, LayoutUnit inlineBoxHeight, |
| 47 bool includeLogicalLeftEdge, bool includeLogicalRightEdge); | 52 bool includeLogicalLeftEdge, bool includeLogicalRightEdge); |
| 48 static bool isDocumentElementWithOpaqueBackground(LayoutObject&); | |
| 49 static void applyBoxShadowForBackground(GraphicsContext*, LayoutObject&); | 53 static void applyBoxShadowForBackground(GraphicsContext*, LayoutObject&); |
| 50 static bool fixedBackgroundPaintsInLocalCoordinates(const LayoutObject&); | 54 static bool fixedBackgroundPaintsInLocalCoordinates(const LayoutObject&); |
| 51 static IntSize calculateFillTileSize(const LayoutBoxModelObject&, const Fill
Layer&, const IntSize& scaledPositioningAreaSize); | 55 static IntSize calculateFillTileSize(const LayoutBoxModelObject&, const Fill
Layer&, const IntSize& scaledPositioningAreaSize); |
| 52 | 56 |
| 53 LayoutRect boundsForDrawingRecorder(const LayoutPoint& paintOffset); | 57 LayoutRect boundsForDrawingRecorder(const LayoutPoint& paintOffset); |
| 54 LayoutRect rootBackgroundRect(); | |
| 55 | 58 |
| 56 // FIXME: this should be const. | 59 // FIXME: this should be const. |
| 57 LayoutBox& m_layoutBox; | 60 LayoutBox& m_layoutBox; |
| 58 }; | 61 }; |
| 59 | 62 |
| 60 } // namespace blink | 63 } // namespace blink |
| 61 | 64 |
| 62 #endif | 65 #endif |
| OLD | NEW |