diff options
Diffstat (limited to 'Source/WebCore/rendering/PaintInfo.h')
-rw-r--r-- | Source/WebCore/rendering/PaintInfo.h | 62 |
1 files changed, 35 insertions, 27 deletions
diff --git a/Source/WebCore/rendering/PaintInfo.h b/Source/WebCore/rendering/PaintInfo.h index ec5551b92..5a6748edd 100644 --- a/Source/WebCore/rendering/PaintInfo.h +++ b/Source/WebCore/rendering/PaintInfo.h @@ -23,13 +23,9 @@ * */ -#ifndef PaintInfo_h -#define PaintInfo_h +#pragma once -#if ENABLE(SVG) #include "AffineTransform.h" -#endif - #include "GraphicsContext.h" #include "IntRect.h" #include "LayoutRect.h" @@ -44,7 +40,6 @@ class OverlapTestRequestClient; class RenderInline; class RenderLayerModelObject; class RenderObject; -class RenderRegion; typedef HashMap<OverlapTestRequestClient*, IntRect> OverlapTestRequestMap; @@ -53,21 +48,33 @@ typedef HashMap<OverlapTestRequestClient*, IntRect> OverlapTestRequestMap; * (tx|ty) is the calculated position of the parent */ struct PaintInfo { - PaintInfo(GraphicsContext* newContext, const LayoutRect& newRect, PaintPhase newPhase, PaintBehavior newPaintBehavior, - RenderObject* newSubtreePaintRoot = nullptr, RenderRegion* region = nullptr, ListHashSet<RenderInline*>* newOutlineObjects = nullptr, - OverlapTestRequestMap* overlapTestRequests = nullptr, const RenderLayerModelObject* newPaintContainer = nullptr) - : context(newContext) - , rect(newRect) - , phase(newPhase) - , paintBehavior(newPaintBehavior) - , subtreePaintRoot(newSubtreePaintRoot) - , renderRegion(region) - , outlineObjects(newOutlineObjects) - , overlapTestRequests(overlapTestRequests) - , paintContainer(newPaintContainer) + PaintInfo(GraphicsContext& newContext, const LayoutRect& newRect, PaintPhase newPhase, PaintBehavior newPaintBehavior, + RenderObject* newSubtreePaintRoot = nullptr, ListHashSet<RenderInline*>* newOutlineObjects = nullptr, + OverlapTestRequestMap* overlapTestRequests = nullptr, const RenderLayerModelObject* newPaintContainer = nullptr, + bool newRequireSecurityOriginAccessForWidgets = false) + : rect(newRect) + , phase(newPhase) + , paintBehavior(newPaintBehavior) + , subtreePaintRoot(newSubtreePaintRoot) + , outlineObjects(newOutlineObjects) + , overlapTestRequests(overlapTestRequests) + , paintContainer(newPaintContainer) + , requireSecurityOriginAccessForWidgets(newRequireSecurityOriginAccessForWidgets) + , m_context(&newContext) { } + GraphicsContext& context() const + { + ASSERT(m_context); + return *m_context; + } + + void setContext(GraphicsContext& context) + { + m_context = &context; + } + void updateSubtreePaintRootForChildren(const RenderObject* renderer) { if (!subtreePaintRoot) @@ -85,39 +92,40 @@ struct PaintInfo { return !subtreePaintRoot || subtreePaintRoot == &renderer; } + bool forceTextColor() const { return forceBlackText() || forceWhiteText(); } bool forceBlackText() const { return paintBehavior & PaintBehaviorForceBlackText; } + bool forceWhiteText() const { return paintBehavior & PaintBehaviorForceWhiteText; } + Color forcedTextColor() const { return (forceBlackText()) ? Color::black : Color::white; } bool skipRootBackground() const { return paintBehavior & PaintBehaviorSkipRootBackground; } bool paintRootBackgroundOnly() const { return paintBehavior & PaintBehaviorRootBackgroundOnly; } -#if ENABLE(SVG) void applyTransform(const AffineTransform& localToAncestorTransform) { if (localToAncestorTransform.isIdentity()) return; - context->concatCTM(localToAncestorTransform); + context().concatCTM(localToAncestorTransform); - if (rect == LayoutRect::infiniteRect()) + if (rect.isInfinite()) return; - FloatRect tranformedRect(localToAncestorTransform.inverse().mapRect(rect)); + FloatRect tranformedRect(localToAncestorTransform.inverse().value_or(AffineTransform()).mapRect(rect)); rect.setLocation(LayoutPoint(tranformedRect.location())); rect.setSize(LayoutSize(tranformedRect.size())); } -#endif - GraphicsContext* context; LayoutRect rect; PaintPhase phase; PaintBehavior paintBehavior; RenderObject* subtreePaintRoot; // used to draw just one element and its visual children - RenderRegion* renderRegion; ListHashSet<RenderInline*>* outlineObjects; // used to list outlines that should be painted by a block with inline children OverlapTestRequestMap* overlapTestRequests; const RenderLayerModelObject* paintContainer; // the layer object that originates the current painting + bool requireSecurityOriginAccessForWidgets { false }; + +private: + GraphicsContext* m_context; }; } // namespace WebCore - -#endif // PaintInfo_h |