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

Side by Side Diff: Source/core/layout/svg/LayoutSVGShape.h

Issue 1231363003: Fix virtual/override/final usage in Source/core/layout/. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/svg/LayoutSVGRoot.h ('k') | Source/core/layout/svg/LayoutSVGTSpan.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2006 Apple Computer, Inc 5 * Copyright (C) 2006 Apple Computer, Inc
6 * Copyright (C) 2009 Google, Inc. 6 * Copyright (C) 2009 Google, Inc.
7 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org> 7 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org>
8 * Copyright (C) 2011 University of Szeged 8 * Copyright (C) 2011 University of Szeged
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 30 matching lines...) Expand all
41 41
42 enum ShapeGeometryCodePath { 42 enum ShapeGeometryCodePath {
43 PathGeometry, 43 PathGeometry,
44 RectGeometryFastPath, 44 RectGeometryFastPath,
45 EllipseGeometryFastPath 45 EllipseGeometryFastPath
46 }; 46 };
47 47
48 class LayoutSVGShape : public LayoutSVGModelObject { 48 class LayoutSVGShape : public LayoutSVGModelObject {
49 public: 49 public:
50 explicit LayoutSVGShape(SVGGeometryElement*); 50 explicit LayoutSVGShape(SVGGeometryElement*);
51 virtual ~LayoutSVGShape(); 51 ~LayoutSVGShape() override;
52 52
53 void setNeedsShapeUpdate() { m_needsShapeUpdate = true; } 53 void setNeedsShapeUpdate() { m_needsShapeUpdate = true; }
54 virtual void setNeedsBoundariesUpdate() override final { m_needsBoundariesUp date = true; } 54 void setNeedsBoundariesUpdate() final { m_needsBoundariesUpdate = true; }
55 virtual void setNeedsTransformUpdate() override final { m_needsTransformUpda te = true; } 55 void setNeedsTransformUpdate() final { m_needsTransformUpdate = true; }
56 56
57 bool nodeAtFloatPointInternal(const HitTestRequest&, const FloatPoint&, Poin terEventsHitRules); 57 bool nodeAtFloatPointInternal(const HitTestRequest&, const FloatPoint&, Poin terEventsHitRules);
58 58
59 Path& path() const 59 Path& path() const
60 { 60 {
61 ASSERT(m_path); 61 ASSERT(m_path);
62 return *m_path; 62 return *m_path;
63 } 63 }
64 64
65 virtual bool isShapeEmpty() const { return path().isEmpty(); } 65 virtual bool isShapeEmpty() const { return path().isEmpty(); }
66 66
67 bool hasNonScalingStroke() const { return style()->svgStyle().vectorEffect() == VE_NON_SCALING_STROKE; } 67 bool hasNonScalingStroke() const { return style()->svgStyle().vectorEffect() == VE_NON_SCALING_STROKE; }
68 Path* nonScalingStrokePath(const Path*, const AffineTransform&) const; 68 Path* nonScalingStrokePath(const Path*, const AffineTransform&) const;
69 AffineTransform nonScalingStrokeTransform() const; 69 AffineTransform nonScalingStrokeTransform() const;
70 virtual AffineTransform localTransform() const override final { return m_loc alTransform ? *m_localTransform : LayoutSVGModelObject::localTransform(); } 70 AffineTransform localTransform() const final { return m_localTransform ? *m_ localTransform : LayoutSVGModelObject::localTransform(); }
71 71
72 virtual const Vector<MarkerPosition>* markerPositions() const { return nullp tr; } 72 virtual const Vector<MarkerPosition>* markerPositions() const { return nullp tr; }
73 73
74 float strokeWidth() const; 74 float strokeWidth() const;
75 75
76 virtual ShapeGeometryCodePath geometryCodePath() const { return PathGeometry ; } 76 virtual ShapeGeometryCodePath geometryCodePath() const { return PathGeometry ; }
77 virtual const Vector<FloatPoint>* zeroLengthLineCaps() const { return nullpt r; } 77 virtual const Vector<FloatPoint>* zeroLengthLineCaps() const { return nullpt r; }
78 78
79 virtual FloatRect objectBoundingBox() const override final { return m_fillBo undingBox; } 79 FloatRect objectBoundingBox() const final { return m_fillBoundingBox; }
80 80
81 virtual const char* name() const override { return "LayoutSVGShape"; } 81 const char* name() const override { return "LayoutSVGShape"; }
82 82
83 protected: 83 protected:
84 void clearPath() { m_path.clear(); } 84 void clearPath() { m_path.clear(); }
85 85
86 // Reconstruct the Path. Subclasses may use geometry knowledge to avoid crea ting a Path. 86 // Reconstruct the Path. Subclasses may use geometry knowledge to avoid crea ting a Path.
87 virtual void updateShapeFromElement(); 87 virtual void updateShapeFromElement();
88 88
89 virtual void updateStrokeAndFillBoundingBoxes(); 89 virtual void updateStrokeAndFillBoundingBoxes();
90 90
91 // Calculates an inclusive bounding box of this shape as if this shape has 91 // Calculates an inclusive bounding box of this shape as if this shape has
92 // a stroke. If this shape has a stroke, then m_strokeBoundingBox is returne d; 92 // a stroke. If this shape has a stroke, then m_strokeBoundingBox is returne d;
93 // otherwise, estimates a bounding box (not necessarily tight) that would 93 // otherwise, estimates a bounding box (not necessarily tight) that would
94 // include this shape's stroke bounding box if it had a stroke. 94 // include this shape's stroke bounding box if it had a stroke.
95 virtual FloatRect hitTestStrokeBoundingBox() const; 95 virtual FloatRect hitTestStrokeBoundingBox() const;
96 virtual bool shapeDependentStrokeContains(const FloatPoint&); 96 virtual bool shapeDependentStrokeContains(const FloatPoint&);
97 virtual bool shapeDependentFillContains(const FloatPoint&, const WindRule) c onst; 97 virtual bool shapeDependentFillContains(const FloatPoint&, const WindRule) c onst;
98 98
99 FloatRect m_fillBoundingBox; 99 FloatRect m_fillBoundingBox;
100 FloatRect m_strokeBoundingBox; 100 FloatRect m_strokeBoundingBox;
101 101
102 private: 102 private:
103 // Hit-detection separated for the fill and the stroke 103 // Hit-detection separated for the fill and the stroke
104 bool fillContains(const FloatPoint&, bool requiresFill = true, const WindRul e fillRule = RULE_NONZERO); 104 bool fillContains(const FloatPoint&, bool requiresFill = true, const WindRul e fillRule = RULE_NONZERO);
105 bool strokeContains(const FloatPoint&, bool requiresStroke = true); 105 bool strokeContains(const FloatPoint&, bool requiresStroke = true);
106 106
107 virtual const AffineTransform& localToParentTransform() const override final { return m_localTransform ? *m_localTransform : LayoutSVGModelObject::localToPa rentTransform(); } 107 const AffineTransform& localToParentTransform() const final { return m_local Transform ? *m_localTransform : LayoutSVGModelObject::localToParentTransform(); }
108 108
109 virtual bool isOfType(LayoutObjectType type) const override { return type == LayoutObjectSVGShape || LayoutSVGModelObject::isOfType(type); } 109 bool isOfType(LayoutObjectType type) const override { return type == LayoutO bjectSVGShape || LayoutSVGModelObject::isOfType(type); }
110 virtual void layout() override final; 110 void layout() final;
111 virtual void paint(const PaintInfo&, const LayoutPoint&) override final; 111 void paint(const PaintInfo&, const LayoutPoint&) final;
112 virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& addit ionalOffset) const override final; 112 void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& additionalOff set) const final;
113 113
114 virtual bool nodeAtFloatPoint(HitTestResult&, const FloatPoint& pointInParen t, HitTestAction) override final; 114 bool nodeAtFloatPoint(HitTestResult&, const FloatPoint& pointInParent, HitTe stAction) final;
115 115
116 virtual FloatRect strokeBoundingBox() const override final { return m_stroke BoundingBox; } 116 FloatRect strokeBoundingBox() const final { return m_strokeBoundingBox; }
117 117
118 void updatePaintInvalidationBoundingBox(); 118 void updatePaintInvalidationBoundingBox();
119 void updateLocalTransform(); 119 void updateLocalTransform();
120 120
121 private: 121 private:
122 OwnPtr<AffineTransform> m_localTransform; 122 OwnPtr<AffineTransform> m_localTransform;
123 OwnPtr<Path> m_path; 123 OwnPtr<Path> m_path;
124 124
125 bool m_needsBoundariesUpdate : 1; 125 bool m_needsBoundariesUpdate : 1;
126 bool m_needsShapeUpdate : 1; 126 bool m_needsShapeUpdate : 1;
127 bool m_needsTransformUpdate : 1; 127 bool m_needsTransformUpdate : 1;
128 }; 128 };
129 129
130 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutSVGShape, isSVGShape()); 130 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutSVGShape, isSVGShape());
131 131
132 } 132 }
133 133
134 #endif 134 #endif
OLDNEW
« no previous file with comments | « Source/core/layout/svg/LayoutSVGRoot.h ('k') | Source/core/layout/svg/LayoutSVGTSpan.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698