Changeset 152290 in webkit
- Timestamp:
- Jul 2, 2013 6:48:16 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r152286 r152290 1 2013-07-02 Kangil Han <kangil.han@samsung.com> 2 3 is/toHTMLStyleElement should use Element* for its argument 4 https://bugs.webkit.org/show_bug.cgi?id=118286 5 6 Reviewed by Andreas Kling. 7 8 To reduce unnecessary call of isElementNode(), this patch replaces argument 9 of is/toHTMLStyleElement from Node* to Element*. Plus, use Element::hasTagName 10 in collectActiveStyleSheets function for minor code refactoring since 11 its cost is cheaper than Node::hasTagName. 12 13 * css/CSSStyleSheet.cpp: 14 (WebCore::isAcceptableCSSStyleSheetParent): 15 * css/StyleScopeResolver.cpp: 16 (WebCore::StyleScopeResolver::scopeFor): 17 * dom/DocumentStyleSheetCollection.cpp: 18 (WebCore::DocumentStyleSheetCollection::collectActiveStyleSheets): 19 * dom/Node.cpp: 20 (WebCore::Node::numberOfScopedHTMLStyleChildren): 21 * html/HTMLStyleElement.h: 22 (WebCore::isHTMLStyleElement): 23 (WebCore::toHTMLStyleElement): 24 1 25 2013-07-02 Ryosuke Niwa <rniwa@webkit.org> 2 26 -
trunk/Source/WebCore/css/CSSStyleSheet.cpp
r151911 r152290 66 66 || parentNode->isDocumentNode() 67 67 || parentNode->hasTagName(HTMLNames::linkTag) 68 || isHTMLStyleElement(parentNode)68 || (parentNode->isElementNode() && isHTMLStyleElement(toElement(parentNode))) 69 69 #if ENABLE(SVG) 70 70 || parentNode->hasTagName(SVGNames::styleTag) -
trunk/Source/WebCore/css/StyleScopeResolver.cpp
r151911 r152290 61 61 return 0; 62 62 Node* ownerNode = sheet->ownerNode(); 63 if (!ownerNode || !ownerNode->isHTMLElement() || !isHTMLStyleElement( ownerNode))64 return 0; 65 66 HTMLStyleElement* styleElement = toHTMLStyleElement( ownerNode);63 if (!ownerNode || !ownerNode->isHTMLElement() || !isHTMLStyleElement(toElement(ownerNode))) 64 return 0; 65 66 HTMLStyleElement* styleElement = toHTMLStyleElement(toElement(ownerNode)); 67 67 if (!styleElement->scoped()) 68 68 return styleElement->isInShadowTree() ? styleElement->containingShadowRoot() : 0; -
trunk/Source/WebCore/dom/DocumentStyleSheetCollection.cpp
r151911 r152290 300 300 AtomicString title = e->getAttribute(titleAttr); 301 301 bool enabledViaScript = false; 302 if (e->has LocalName(linkTag)) {302 if (e->hasTagName(linkTag)) { 303 303 // <LINK> element 304 304 HTMLLinkElement* linkElement = static_cast<HTMLLinkElement*>(n); … … 323 323 // set of sheets that will be enabled. 324 324 #if ENABLE(SVG) 325 if ( n->isSVGElement() && n->hasTagName(SVGNames::styleTag))325 if (e->hasTagName(SVGNames::styleTag)) 326 326 sheet = static_cast<SVGStyleElement*>(n)->sheet(); 327 327 else 328 328 #endif 329 if (e->hasLocalName(linkTag)) 330 sheet = static_cast<HTMLLinkElement*>(n)->sheet(); 331 else 332 // <STYLE> element 333 sheet = toHTMLStyleElement(n)->sheet(); 329 { 330 if (e->hasTagName(linkTag)) 331 sheet = static_cast<HTMLLinkElement*>(n)->sheet(); 332 else 333 // <STYLE> element 334 sheet = toHTMLStyleElement(e)->sheet(); 335 } 334 336 // Check to see if this sheet belongs to a styleset 335 337 // (thus making it PREFERRED or ALTERNATE rather than … … 343 345 // us as the preferred set. Otherwise, just ignore 344 346 // this sheet. 345 if (e->has LocalName(styleTag) || !rel.contains("alternate"))347 if (e->hasTagName(styleTag) || !rel.contains("alternate")) 346 348 m_preferredStylesheetSetName = m_selectedStylesheetSetName = title; 347 349 } -
trunk/Source/WebCore/dom/Node.cpp
r152203 r152290 2531 2531 { 2532 2532 size_t count = 0; 2533 for ( Node* child = firstChild(); child; child = child->nextSibling()) {2534 if (isHTMLStyleElement( child) && toHTMLStyleElement(child)->isRegisteredAsScoped())2533 for (Element* element = ElementTraversal::firstWithin(this); element; element = ElementTraversal::next(element, this)) { 2534 if (isHTMLStyleElement(element) && toHTMLStyleElement(element)->isRegisteredAsScoped()) 2535 2535 count++; 2536 2536 } -
trunk/Source/WebCore/html/HTMLStyleElement.h
r151911 r152290 98 98 }; 99 99 100 inline bool isHTMLStyleElement( Node* node)100 inline bool isHTMLStyleElement(Element* element) 101 101 { 102 return node->hasTagName(HTMLNames::styleTag);102 return element->hasTagName(HTMLNames::styleTag); 103 103 } 104 104 105 inline HTMLStyleElement* toHTMLStyleElement( Node* node)105 inline HTMLStyleElement* toHTMLStyleElement(Element* element) 106 106 { 107 ASSERT_WITH_SECURITY_IMPLICATION(! node || isHTMLStyleElement(node));108 return static_cast<HTMLStyleElement*>( node);107 ASSERT_WITH_SECURITY_IMPLICATION(!element || isHTMLStyleElement(element)); 108 return static_cast<HTMLStyleElement*>(element); 109 109 } 110 110
Note: See TracChangeset
for help on using the changeset viewer.