Changeset 28559 in webkit
- Timestamp:
- Dec 8, 2007 12:53:33 AM (16 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r28558 r28559 1 2007-12-08 Rob Buis <buis@kde.org> 2 3 Reviewed by Darin. 4 5 http://bugs.webkit.org/show_bug.cgi?id=15528 6 svg_dynamic_cast should be removed 7 8 Replace svg_dynamic_cast with a combination of 9 isSVGElement and static_cast. 10 11 * rendering/SVGRootInlineBox.cpp: 12 (WebCore::SVGRootInlineBox::buildLayoutInformation): 13 (WebCore::SVGRootInlineBox::buildTextChunks): 14 * svg/SVGAnimationElement.cpp: 15 (WebCore::SVGAnimationElement::targetElement): 16 * svg/SVGElement.h: 17 * svg/SVGElementInstance.cpp: 18 (WebCore::SVGElementInstance::updateInstance): 19 * svg/SVGFilterElement.cpp: 20 (WebCore::SVGFilterElement::canvasResource): 21 * svg/SVGGradientElement.cpp: 22 (WebCore::SVGGradientElement::buildStops): 23 * svg/SVGLocatable.cpp: 24 (WebCore::SVGLocatable::getTransformToElement): 25 * svg/SVGMaskElement.cpp: 26 (WebCore::SVGMaskElement::drawMaskerContent): 27 * svg/SVGSwitchElement.cpp: 28 (WebCore::SVGSwitchElement::childShouldCreateRenderer): 29 * svg/SVGUseElement.cpp: 30 (WebCore::SVGUseElement::insertedIntoDocument): 31 (WebCore::SVGUseElement::buildPendingResource): 32 (WebCore::SVGUseElement::buildInstanceTree): 33 (WebCore::SVGUseElement::handleDeepUseReferencing): 34 (WebCore::SVGUseElement::buildShadowTree): 35 (WebCore::SVGUseElement::expandUseElementsInShadowTree): 36 (WebCore::SVGUseElement::associateInstancesWithShadowTreeElements): 37 * svg/graphics/SVGResource.cpp: 38 (WebCore::getResourceById): 39 1 40 2007-12-07 Antti Koivisto <antti@apple.com> 2 41 -
trunk/WebCore/rendering/SVGRootInlineBox.cpp
r28298 r28559 914 914 915 915 // Handle text-anchor/textLength on path, which is special. 916 SVG Element* textElement = svg_dynamic_cast(flowBox->object()->element());917 ASSERT(textElement);918 919 SVGTextContentElement* textContent = static_cast<SVGTextContentElement*>(textElement);916 SVGTextContentElement* textContent = 0; 917 Node* node = flowBox->object()->element(); 918 if (node && node->isSVGElement()) 919 textContent = static_cast<SVGTextContentElement*>(node); 920 920 ASSERT(textContent); 921 921 … … 1329 1329 RenderText* text = textBox->textObject(); 1330 1330 ASSERT(text); 1331 1332 SVGElement* textElement = svg_dynamic_cast(text->element()->parent());1333 1331 ASSERT(text->element()); 1334 1332 1335 SVGTextContentElement* textContent = static_cast<SVGTextContentElement*>(textElement); 1333 SVGTextContentElement* textContent = 0; 1334 Node* node = text->element()->parent(); 1335 if (node && node->isSVGElement()) 1336 textContent = static_cast<SVGTextContentElement*>(node); 1336 1337 ASSERT(textContent); 1337 1338 1338 1339 // Start new character range for the first chunk 1339 1340 bool isFirstCharacter = info.svgTextChunks.isEmpty() && info.chunk.start == info.it && info.chunk.start == info.chunk.end; -
trunk/WebCore/svg/SVGAnimationElement.cpp
r26543 r28559 79 79 { 80 80 if (!m_targetElement) { 81 Node *target = 0; 81 82 if (!m_href.isEmpty()) { 82 Element* element = ownerDocument()->getElementById(SVGURIReference::getTarget(m_href)); 83 m_targetElement = svg_dynamic_cast(element); 83 target = document()->getElementById(SVGURIReference::getTarget(m_href)); 84 84 } else if (parentNode()) { 85 Node* target = parentNode(); 85 // TODO : do we really need to skip non element nodes? Can that happen at all? 86 target = parentNode(); 86 87 while (target) { 87 88 if (target->nodeType() != ELEMENT_NODE) … … 90 91 break; 91 92 } 92 m_targetElement = svg_dynamic_cast(target);93 93 } 94 } 95 94 if (target && target->isSVGElement()) 95 m_targetElement = static_cast<SVGElement*>(target); 96 } 97 96 98 return m_targetElement; 97 99 } -
trunk/WebCore/svg/SVGElement.h
r26538 r28559 245 245 }; 246 246 247 static inline SVGElement* svg_dynamic_cast(Node* node)248 {249 SVGElement* svgElement = 0;250 if (node && node->isSVGElement())251 svgElement = static_cast<SVGElement*>(node);252 return svgElement;253 }254 255 247 } // namespace WebCore 256 248 -
trunk/WebCore/svg/SVGElementInstance.cpp
r26497 r28559 163 163 // For all other nodes this logic is sufficient. 164 164 RefPtr<Node> clone = m_element->cloneNode(true); 165 SVGElement* svgClone = svg_dynamic_cast(clone.get()); 165 SVGElement* svgClone = 0; 166 if (clone && clone->isSVGElement()) 167 svgClone = static_cast<SVGElement*>(clone.get()); 166 168 ASSERT(svgClone); 167 169 -
trunk/WebCore/svg/SVGFilterElement.cpp
r26442 r28559 142 142 m_filter->clearEffects(); 143 143 for (Node* n = firstChild(); n != 0; n = n->nextSibling()) { 144 SVGElement* element = svg_dynamic_cast(n); 144 SVGElement* element = 0; 145 if (n->isSVGElement()) 146 element = static_cast<SVGElement*>(n); 145 147 if (element && element->isFilterEffect()) { 146 148 SVGFilterPrimitiveStandardAttributes* filterAttributes = static_cast<SVGFilterPrimitiveStandardAttributes*>(element); -
trunk/WebCore/svg/SVGGradientElement.cpp
r26549 r28559 120 120 RenderStyle* gradientStyle = 0; 121 121 for (Node* n = firstChild(); n; n = n->nextSibling()) { 122 SVGElement* element = svg_dynamic_cast(n); 122 SVGElement* element = 0; 123 if (n->isSVGElement()) 124 element = static_cast<SVGElement*>(n); 123 125 if (element && element->isGradientStop()) { 124 126 SVGStopElement* stop = static_cast<SVGStopElement*>(element); -
trunk/WebCore/svg/SVGLocatable.cpp
r26534 r28559 132 132 AffineTransform ctm = getCTM(); 133 133 134 SVGElement* targetElement = svg_dynamic_cast(target); 135 if (targetElement && targetElement->isStyledLocatable()) { 136 AffineTransform targetCTM = static_cast<SVGStyledLocatableElement*>(targetElement)->getCTM(); 134 if (target && target->isStyledLocatable()) { 135 AffineTransform targetCTM = static_cast<SVGStyledLocatableElement*>(target)->getCTM(); 137 136 if (!targetCTM.isInvertible()) { 138 137 ec = SVG_MATRIX_NOT_INVERTABLE; -
trunk/WebCore/svg/SVGMaskElement.cpp
r26745 r28559 160 160 // Render subtree into ImageBuffer 161 161 for (Node* n = firstChild(); n; n = n->nextSibling()) { 162 SVGElement* elem = svg_dynamic_cast(n); 162 SVGElement* elem = 0; 163 if (n->isSVGElement()) 164 elem = static_cast<SVGElement*>(n); 163 165 if (!elem || !elem->isStyled()) 164 166 continue; -
trunk/WebCore/svg/SVGSwitchElement.cpp
r26534 r28559 45 45 { 46 46 for (Node* n = firstChild(); n != 0; n = n->nextSibling()) { 47 SVGElement* element = svg_dynamic_cast(n); 48 if (element && element->isValid()) 49 return (n == child); // Only allow this child if it's the first valid child 47 if (n->isSVGElement()) { 48 SVGElement* element = static_cast<SVGElement*>(n); 49 if (element && element->isValid()) 50 return (n == child); // Only allow this child if it's the first valid child 51 } 50 52 } 51 53 -
trunk/WebCore/svg/SVGUseElement.cpp
r26534 r28559 117 117 118 118 String id = SVGURIReference::getTarget(href()); 119 Element* targetElement = ownerDocument()->getElementById(id);119 Element* targetElement = document()->getElementById(id); 120 120 if (!targetElement) { 121 121 document()->accessSVGExtensions()->addPendingResource(id, this); … … 259 259 260 260 String id = SVGURIReference::getTarget(href()); 261 Element* targetElement = ownerDocument()->getElementById(id); 262 SVGElement* target = svg_dynamic_cast(targetElement); 261 Element* targetElement = document()->getElementById(id); 262 SVGElement* target = 0; 263 if (targetElement && targetElement->isSVGElement()) 264 target = static_cast<SVGElement*>(targetElement); 263 265 264 266 // Do not allow self-referencing. … … 389 391 390 392 for (Node* node = target->firstChild(); node; node = node->nextSibling()) { 391 SVGElement* element = svg_dynamic_cast(node); 393 SVGElement* element = 0; 394 if (node->isSVGElement()) 395 element = static_cast<SVGElement*>(node); 392 396 393 397 // Skip any non-svg nodes or any disallowed element. … … 420 424 { 421 425 String id = SVGURIReference::getTarget(use->href()); 422 Element* targetElement = ownerDocument()->getElementById(id); 423 SVGElement* target = svg_dynamic_cast(targetElement); 426 Element* targetElement = document()->getElementById(id); 427 SVGElement* target = 0; 428 if (targetElement && targetElement->isSVGElement()) 429 target = static_cast<SVGElement*>(targetElement); 424 430 425 431 if (!target) … … 499 505 removeDisallowedElementsFromSubtree(newChild.get()); 500 506 501 SVGElement* newChildPtr = svg_dynamic_cast(newChild.get()); 507 SVGElement* newChildPtr = 0; 508 if (newChild->isSVGElement()) 509 newChildPtr = static_cast<SVGElement*>(newChild.get()); 502 510 ASSERT(newChildPtr); 503 511 … … 525 533 526 534 String id = SVGURIReference::getTarget(use->href()); 527 Element* targetElement = ownerDocument()->getElementById(id); 528 SVGElement* target = svg_dynamic_cast(targetElement); 535 Element* targetElement = document()->getElementById(id); 536 SVGElement* target = 0; 537 if (targetElement && targetElement->isSVGElement()) 538 target = static_cast<SVGElement*>(targetElement); 529 539 530 540 // Don't ASSERT(target) here, it may be "pending", too. … … 574 584 removeDisallowedElementsFromSubtree(newChild.get()); 575 585 576 SVGElement* newChildPtr = svg_dynamic_cast(newChild.get()); 586 SVGElement* newChildPtr = 0; 587 if (newChild->isSVGElement()) 588 newChildPtr = static_cast<SVGElement*>(newChild.get()); 577 589 ASSERT(newChildPtr); 578 590 … … 699 711 ASSERT(target->nodeName() == originalElement->nodeName()); 700 712 701 SVGElement* element = svg_dynamic_cast(target); 713 SVGElement* element = 0; 714 if (target->isSVGElement()) 715 element = static_cast<SVGElement*>(target); 702 716 703 717 ASSERT(!targetInstance->shadowTreeElement()); -
trunk/WebCore/svg/graphics/SVGResource.cpp
r28319 r28559 159 159 160 160 Element* element = document->getElementById(id); 161 SVGElement* svgElement = svg_dynamic_cast(element); 161 SVGElement* svgElement = 0; 162 if (element && element->isSVGElement()) 163 svgElement = static_cast<SVGElement*>(element); 162 164 163 165 if (svgElement && svgElement->isStyled())
Note: See TracChangeset
for help on using the changeset viewer.