Changeset 163319 in webkit
- Timestamp:
- Feb 3, 2014 12:26:09 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r163318 r163319 1 2014-02-03 Andreas Kling <akling@apple.com> 2 3 CTTE: RenderSVGGradientStop always has a SVGStopElement. 4 <https://webkit.org/b/128107> 5 6 RenderSVGGradientStop is never anonymous and always has a 7 corresponding SVGStopElement. Codify this by adding an element() 8 overload that returns an SVGStopElement&. 9 10 Also added missing overrides and made most functions private. 11 12 Reviewed by Darin Adler. 13 14 * rendering/svg/RenderSVGGradientStop.cpp: 15 (WebCore::RenderSVGGradientStop::styleDidChange): 16 (WebCore::RenderSVGGradientStop::gradientElement): 17 * rendering/svg/RenderSVGGradientStop.h: 18 * rendering/svg/SVGRenderTreeAsText.cpp: 19 (WebCore::writeSVGGradientStop): 20 1 21 2014-02-03 David Kilzer <ddkilzer@apple.com> 2 22 -
trunk/Source/WebCore/rendering/svg/RenderSVGGradientStop.cpp
r163283 r163319 51 51 // <stop> elements should only be allowed to make renderers under gradient elements 52 52 // but I can imagine a few cases we might not be catching, so let's not crash if our parent isn't a gradient. 53 SVGGradientElement* gradient = gradientElement();53 const auto* gradient = gradientElement(); 54 54 if (!gradient) 55 55 return; … … 68 68 } 69 69 70 SVGGradientElement* RenderSVGGradientStop::gradientElement() const70 SVGGradientElement* RenderSVGGradientStop::gradientElement() 71 71 { 72 ContainerNode* parentNode = element()->parentNode(); 73 if (parentNode->hasTagName(linearGradientTag) || parentNode->hasTagName(radialGradientTag)) 74 return toSVGGradientElement(parentNode); 75 return 0; 72 if (element().parentElement() && isSVGGradientElement(*element().parentElement())) 73 return &toSVGGradientElement(*element().parentElement()); 74 return nullptr; 76 75 } 77 76 -
trunk/Source/WebCore/rendering/svg/RenderSVGGradientStop.h
r162158 r163319 2 2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 3 3 * Copyright (C) 2009 Google, Inc. 4 * Copyright (C) 2014 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 24 25 #if ENABLE(SVG) 25 26 #include "RenderElement.h" 27 #include "SVGStopElement.h" 26 28 27 29 namespace WebCore { 28 30 29 31 class SVGGradientElement; 30 class SVGStopElement;31 32 32 33 // This class exists mostly so we can hear about gradient stop style changes … … 36 37 virtual ~RenderSVGGradientStop(); 37 38 38 virtual bool isSVGGradientStop() const { return true; } 39 virtual const char* renderName() const { return "RenderSVGGradientStop"; } 39 SVGStopElement& element() const { return toSVGStopElement(RenderObject::nodeForNonAnonymous()); } 40 40 41 virtual void layout(); 41 private: 42 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override; 42 43 43 // This overrides are needed to prevent ASSERTs on <svg><stop /></svg> 44 virtual void layout() override; 45 46 // These overrides are needed to prevent ASSERTs on <svg><stop /></svg> 44 47 // RenderObject's default implementations ASSERT_NOT_REACHED() 45 48 // https://bugs.webkit.org/show_bug.cgi?id=20400 46 49 virtual LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject*) const override { return LayoutRect(); } 47 virtual FloatRect objectBoundingBox() const { return FloatRect(); }48 virtual FloatRect strokeBoundingBox() const { return FloatRect(); }49 virtual FloatRect repaintRectInLocalCoordinates() const { return FloatRect(); }50 virtual FloatRect objectBoundingBox() const override { return FloatRect(); } 51 virtual FloatRect strokeBoundingBox() const override { return FloatRect(); } 52 virtual FloatRect repaintRectInLocalCoordinates() const override { return FloatRect(); } 50 53 virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint&, HitTestAction) override { return false; } 51 54 52 protected: 53 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);55 virtual bool isSVGGradientStop() const override { return true; } 56 virtual const char* renderName() const override { return "RenderSVGGradientStop"; } 54 57 55 private:56 58 virtual bool canHaveChildren() const override { return false; } 57 virtual void paint(PaintInfo&, const LayoutPoint&) override final{ }59 virtual void paint(PaintInfo&, const LayoutPoint&) override { } 58 60 59 SVGGradientElement* gradientElement() const;61 SVGGradientElement* gradientElement(); 60 62 }; 61 63 -
trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp
r163316 r163319 609 609 writeStandardPrefix(ts, stop, indent); 610 610 611 SVGStopElement* stopElement = toSVGStopElement(toSVGElement(stop.element())); 612 ASSERT(stopElement); 613 614 ts << " [offset=" << stopElement->offset() << "] [color=" << stopElement->stopColorIncludingOpacity() << "]\n"; 611 ts << " [offset=" << stop.element().offset() << "] [color=" << stop.element().stopColorIncludingOpacity() << "]\n"; 615 612 } 616 613
Note: See TracChangeset
for help on using the changeset viewer.