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

Unified Diff: Source/core/rendering/RenderObject.h

Issue 112633004: Use a bitmask for SVG render object types (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Minor cleanups Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/rendering/svg/RenderSVGContainer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderObject.h
diff --git a/Source/core/rendering/RenderObject.h b/Source/core/rendering/RenderObject.h
index 37044c4e86d4d75cf6aaf806978ec085e94876d0..c26d17233a4444338e227ca25f5ea9fafdf3a2eb 100644
--- a/Source/core/rendering/RenderObject.h
+++ b/Source/core/rendering/RenderObject.h
@@ -427,25 +427,48 @@ public:
FlowThreadState flowThreadState() const { return m_bitfields.flowThreadState(); }
void setFlowThreadState(FlowThreadState state) { m_bitfields.setFlowThreadState(state); }
- // FIXME: Until all SVG renders can be subclasses of RenderSVGModelObject we have
- // to add SVG renderer methods to RenderObject with an ASSERT_NOT_REACHED() default implementation.
- virtual bool isSVGRoot() const { return false; }
- virtual bool isSVGContainer() const { return false; }
- virtual bool isSVGTransformableContainer() const { return false; }
- virtual bool isSVGViewportContainer() const { return false; }
- virtual bool isSVGGradientStop() const { return false; }
- virtual bool isSVGHiddenContainer() const { return false; }
- virtual bool isSVGPath() const { return false; }
- virtual bool isSVGShape() const { return false; }
- virtual bool isSVGText() const { return false; }
- virtual bool isSVGTextPath() const { return false; }
- virtual bool isSVGInline() const { return false; }
- virtual bool isSVGInlineText() const { return false; }
- virtual bool isSVGImage() const { return false; }
- virtual bool isSVGForeignObject() const { return false; }
- virtual bool isSVGResourceContainer() const { return false; }
- virtual bool isSVGResourceFilter() const { return false; }
- virtual bool isSVGResourceFilterPrimitive() const { return false; }
+ // FIXME: Until all SVG renderers are subclasses of RenderSVGModelObject, we have to
+ // maintain this parallel type system in RenderObject.
+ // Note: All updates to the SVG renderer hierarchy must update the enum below.
+ enum SVGType {
+ IsNotSVG = 0,
+ IsSVGRoot = 1,
+ IsSVGContainer = 1 << 1,
+ IsSVGTransformableContainer = 1 << 2 | IsSVGContainer,
+ IsSVGViewportContainer = 1 << 3 | IsSVGContainer,
+ IsSVGGradientStop = 1 << 4,
+ IsSVGHiddenContainer = 1 << 5 | IsSVGContainer,
+ IsSVGShape = 1 << 6,
+ IsSVGPath = 1 << 7 | IsSVGShape,
+ IsSVGText = 1 << 8,
+ IsSVGInline = 1 << 9,
+ IsSVGTextPath = 1 << 10 | IsSVGInline,
+ IsSVGInlineText = 1 << 11,
+ IsSVGImage = 1 << 12,
+ IsSVGForeignObject = 1 << 13,
+ IsSVGResourceContainer = 1 << 14 | IsSVGHiddenContainer,
+ IsSVGResourceFilter = 1 << 15 | IsSVGResourceContainer,
+ IsSVGResourceFilterPrimitive = 1 << 16 | IsSVGHiddenContainer
+ };
+ bool hasSVGType(SVGType mask) const { return mask == (mask & getSVGType()); }
+ bool isSVG() const { return getSVGType(); }
+ bool isSVGRoot() const { return hasSVGType(IsSVGRoot); }
+ bool isSVGContainer() const { return hasSVGType(IsSVGContainer); }
+ bool isSVGTransformableContainer() const { return hasSVGType(IsSVGTransformableContainer); }
+ bool isSVGViewportContainer() const { return hasSVGType(IsSVGViewportContainer); }
+ bool isSVGGradientStop() const { return hasSVGType(IsSVGGradientStop); }
+ bool isSVGHiddenContainer() const { return hasSVGType(IsSVGHiddenContainer); }
+ bool isSVGPath() const { return hasSVGType(IsSVGPath); }
+ bool isSVGShape() const { return hasSVGType(IsSVGShape); }
+ bool isSVGText() const { return hasSVGType(IsSVGText); }
+ bool isSVGTextPath() const { return hasSVGType(IsSVGTextPath); }
+ bool isSVGInline() const { return hasSVGType(IsSVGInline); }
+ bool isSVGInlineText() const { return hasSVGType(IsSVGInlineText); }
+ bool isSVGImage() const { return hasSVGType(IsSVGImage); }
+ bool isSVGForeignObject() const { return hasSVGType(IsSVGForeignObject); }
+ bool isSVGResourceContainer() const { return hasSVGType(IsSVGResourceContainer); }
+ bool isSVGResourceFilter() const { return hasSVGType(IsSVGResourceFilter); }
+ bool isSVGResourceFilterPrimitive() const { return hasSVGType(IsSVGResourceFilterPrimitive); }
// FIXME: Those belong into a SVG specific base-class for all renderers (see above)
// Unfortunately we don't have such a class yet, because it's not possible for all renderers
@@ -1056,6 +1079,8 @@ protected:
// of this renderer within the current layer that should be used for each result.
virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOffset) const { };
+ virtual SVGType getSVGType() const { return IsNotSVG; }
+
private:
RenderBlock* containerForFixedPosition(const RenderLayerModelObject* repaintContainer = 0, bool* repaintContainerSkipped = 0) const;
« no previous file with comments | « no previous file | Source/core/rendering/svg/RenderSVGContainer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698