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

Unified Diff: Source/core/rendering/svg/RenderSVGResourceClipper.cpp

Issue 171663005: Consistently use ElementTraversal API when looking for an Element (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/svg/RenderSVGResourceClipper.cpp
diff --git a/Source/core/rendering/svg/RenderSVGResourceClipper.cpp b/Source/core/rendering/svg/RenderSVGResourceClipper.cpp
index 104230d92f1c3e203dab37bc3551dc238e97dabc..3a3b2bf0abc9ca6ba4c75205bdf2a23d8cc723ca 100644
--- a/Source/core/rendering/svg/RenderSVGResourceClipper.cpp
+++ b/Source/core/rendering/svg/RenderSVGResourceClipper.cpp
@@ -89,16 +89,16 @@ bool RenderSVGResourceClipper::tryPathOnlyClipping(GraphicsContext* context,
WindRule clipRule = RULE_NONZERO;
Path clipPath = Path();
- for (Node* childNode = element()->firstChild(); childNode; childNode = childNode->nextSibling()) {
- RenderObject* renderer = childNode->renderer();
+ for (Element* childElement = ElementTraversal::firstWithin(*element()); childElement; childElement = ElementTraversal::nextSibling(*childElement)) {
+ RenderObject* renderer = childElement->renderer();
if (!renderer)
continue;
// Only shapes or paths are supported for direct clipping. We need to fallback to masking for texts.
if (renderer->isSVGText())
return false;
- if (!childNode->isSVGElement() || !toSVGElement(childNode)->isSVGGraphicsElement())
+ if (!childElement->isSVGElement() || !toSVGElement(childElement)->isSVGGraphicsElement())
continue;
- SVGGraphicsElement* styled = toSVGGraphicsElement(childNode);
+ SVGGraphicsElement* styled = toSVGGraphicsElement(childElement);
RenderStyle* style = renderer->style();
if (!style || style->display() == NONE || style->visibility() != VISIBLE)
continue;
@@ -271,9 +271,9 @@ PassRefPtr<DisplayList> RenderSVGResourceClipper::asDisplayList(GraphicsContext*
PaintBehavior oldBehavior = frame()->view()->paintBehavior();
frame()->view()->setPaintBehavior(oldBehavior | PaintBehaviorRenderingSVGMask);
- for (Node* childNode = element()->firstChild(); childNode; childNode = childNode->nextSibling()) {
- RenderObject* renderer = childNode->renderer();
- if (!childNode->isSVGElement() || !renderer)
+ for (Element* childElement = ElementTraversal::firstWithin(*element()); childElement; childElement = ElementTraversal::nextSibling(*childElement)) {
+ RenderObject* renderer = childElement->renderer();
+ if (!childElement->isSVGElement() || !renderer)
continue;
RenderStyle* style = renderer->style();
@@ -281,9 +281,9 @@ PassRefPtr<DisplayList> RenderSVGResourceClipper::asDisplayList(GraphicsContext*
continue;
WindRule newClipRule = style->svgStyle()->clipRule();
- bool isUseElement = childNode->hasTagName(SVGNames::useTag);
+ bool isUseElement = childElement->hasTagName(SVGNames::useTag);
if (isUseElement) {
- SVGUseElement* useElement = toSVGUseElement(childNode);
+ SVGUseElement* useElement = toSVGUseElement(childElement);
renderer = useElement->rendererClipChild();
if (!renderer)
continue;
@@ -298,7 +298,7 @@ PassRefPtr<DisplayList> RenderSVGResourceClipper::asDisplayList(GraphicsContext*
context->setFillRule(newClipRule);
if (isUseElement)
- renderer = childNode->renderer();
+ renderer = childElement->renderer();
SVGRenderingContext::renderSubtree(context, renderer, contentTransformation);
}
@@ -311,11 +311,11 @@ PassRefPtr<DisplayList> RenderSVGResourceClipper::asDisplayList(GraphicsContext*
void RenderSVGResourceClipper::calculateClipContentRepaintRect()
{
// This is a rough heuristic to appraise the clip size and doesn't consider clip on clip.
- for (Node* childNode = element()->firstChild(); childNode; childNode = childNode->nextSibling()) {
- RenderObject* renderer = childNode->renderer();
- if (!childNode->isSVGElement() || !renderer)
+ for (Element* childElement = ElementTraversal::firstWithin(*element()); childElement; childElement = ElementTraversal::nextSibling(*childElement)) {
+ RenderObject* renderer = childElement->renderer();
+ if (!childElement->isSVGElement() || !renderer)
continue;
- if (!renderer->isSVGShape() && !renderer->isSVGText() && !childNode->hasTagName(SVGNames::useTag))
+ if (!renderer->isSVGShape() && !renderer->isSVGText() && !childElement->hasTagName(SVGNames::useTag))
continue;
RenderStyle* style = renderer->style();
if (!style || style->display() == NONE || style->visibility() != VISIBLE)
@@ -341,11 +341,11 @@ bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin
point = clipPathElement->animatedLocalTransform().inverse().mapPoint(point);
- for (Node* childNode = element()->firstChild(); childNode; childNode = childNode->nextSibling()) {
- RenderObject* renderer = childNode->renderer();
- if (!childNode->isSVGElement() || !renderer)
+ for (Element* childElement = ElementTraversal::firstWithin(*element()); childElement; childElement = ElementTraversal::nextSibling(*childElement)) {
+ RenderObject* renderer = childElement->renderer();
+ if (!childElement->isSVGElement() || !renderer)
continue;
- if (!renderer->isSVGShape() && !renderer->isSVGText() && !childNode->hasTagName(SVGNames::useTag))
+ if (!renderer->isSVGShape() && !renderer->isSVGText() && !childElement->hasTagName(SVGNames::useTag))
continue;
IntPoint hitPoint;
HitTestResult result(hitPoint);
« no previous file with comments | « Source/core/rendering/svg/ReferenceFilterBuilder.cpp ('k') | Source/core/rendering/svg/RenderSVGResourceFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698