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

Side by Side Diff: Source/core/rendering/svg/RenderSVGRect.cpp

Issue 19781008: Introduce toSVGRectElement(), use it (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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
« no previous file with comments | « no previous file | Source/core/rendering/svg/SVGPathData.cpp » ('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) 2011 University of Szeged 2 * Copyright (C) 2011 University of Szeged
3 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org> 3 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org>
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 { 43 {
44 } 44 }
45 45
46 void RenderSVGRect::updateShapeFromElement() 46 void RenderSVGRect::updateShapeFromElement()
47 { 47 {
48 // Before creating a new object we need to clear the cached bounding box 48 // Before creating a new object we need to clear the cached bounding box
49 // to avoid using garbage. 49 // to avoid using garbage.
50 m_fillBoundingBox = FloatRect(); 50 m_fillBoundingBox = FloatRect();
51 m_innerStrokeRect = FloatRect(); 51 m_innerStrokeRect = FloatRect();
52 m_outerStrokeRect = FloatRect(); 52 m_outerStrokeRect = FloatRect();
53 SVGRectElement* rect = static_cast<SVGRectElement*>(node()); 53 SVGRectElement* rect = toSVGRectElement(node());
54 ASSERT(rect);
tkent 2013/07/24 10:16:06 Why do you remove the ASSERT?
55 54
56 SVGLengthContext lengthContext(rect); 55 SVGLengthContext lengthContext(rect);
57 // Fallback to RenderSVGShape if rect has rounded corners or a non-scaling s troke. 56 // Fallback to RenderSVGShape if rect has rounded corners or a non-scaling s troke.
58 if (rect->rxCurrentValue().value(lengthContext) > 0 || rect->ryCurrentValue( ).value(lengthContext) > 0 || hasNonScalingStroke()) { 57 if (rect->rxCurrentValue().value(lengthContext) > 0 || rect->ryCurrentValue( ).value(lengthContext) > 0 || hasNonScalingStroke()) {
59 RenderSVGShape::updateShapeFromElement(); 58 RenderSVGShape::updateShapeFromElement();
60 m_usePathFallback = true; 59 m_usePathFallback = true;
61 return; 60 return;
62 } 61 }
63 62
64 m_usePathFallback = false; 63 m_usePathFallback = false;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 118 }
120 119
121 bool RenderSVGRect::shapeDependentFillContains(const FloatPoint& point, const Wi ndRule fillRule) const 120 bool RenderSVGRect::shapeDependentFillContains(const FloatPoint& point, const Wi ndRule fillRule) const
122 { 121 {
123 if (m_usePathFallback) 122 if (m_usePathFallback)
124 return RenderSVGShape::shapeDependentFillContains(point, fillRule); 123 return RenderSVGShape::shapeDependentFillContains(point, fillRule);
125 return m_fillBoundingBox.contains(point.x(), point.y()); 124 return m_fillBoundingBox.contains(point.x(), point.y());
126 } 125 }
127 126
128 } 127 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/rendering/svg/SVGPathData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698