Changeset 152387 in webkit
- Timestamp:
- Jul 3, 2013 9:31:30 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r152386 r152387 1 2013-07-03 Kangil Han <kangil.han@samsung.com> 2 3 Adopt is/toHTMLMapElement for code cleanup 4 https://bugs.webkit.org/show_bug.cgi?id=118235 5 6 Reviewed by Andreas Kling. 7 8 To enhance readability, this patch adopts is/toHTMLMapElement. 9 This also helps out to reduce duplicated use of static_cast. 10 11 * accessibility/AccessibilityRenderObject.cpp: 12 (WebCore::AccessibilityRenderObject::getDocumentLinks): 13 (WebCore::AccessibilityRenderObject::accessibilityImageMapHitTest): 14 * dom/DocumentOrderedMap.cpp: 15 (WebCore::keyMatchesMapName): 16 (WebCore::keyMatchesLowercasedMapName): 17 * dom/TreeScope.cpp: 18 (WebCore::TreeScope::getImageMap): 19 * html/HTMLAreaElement.cpp: 20 (WebCore::HTMLAreaElement::imageElement): 21 * html/HTMLMapElement.h: 22 (WebCore::isHTMLMapElement): 23 (WebCore::toHTMLMapElement): 24 1 25 2013-07-03 Brent Fulgham <bfulgham@apple.com> 2 26 -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
r152218 r152387 1736 1736 } else { 1737 1737 Node* parent = curr->parentNode(); 1738 if (parent && isHTMLAreaElement(curr) && parent->hasTagName(mapTag)) {1738 if (parent && isHTMLAreaElement(curr) && isHTMLMapElement(parent)) { 1739 1739 AccessibilityImageMapLink* areaObject = static_cast<AccessibilityImageMapLink*>(axObjectCache()->getOrCreate(ImageMapLinkRole)); 1740 HTMLMapElement* map = toHTMLMapElement(parent); 1740 1741 areaObject->setHTMLAreaElement(toHTMLAreaElement(curr)); 1741 areaObject->setHTMLMapElement( static_cast<HTMLMapElement*>(parent));1742 areaObject->setParent(accessibilityParentForImageMap( static_cast<HTMLMapElement*>(parent)));1742 areaObject->setHTMLMapElement(map); 1743 areaObject->setParent(accessibilityParentForImageMap(map)); 1743 1744 1744 1745 result.append(areaObject); … … 2155 2156 AccessibilityObject* parent = 0; 2156 2157 for (Element* mapParent = area->parentElement(); mapParent; mapParent = mapParent->parentElement()) { 2157 if ( mapParent->hasTagName(mapTag)) {2158 parent = accessibilityParentForImageMap( static_cast<HTMLMapElement*>(mapParent));2158 if (isHTMLMapElement(mapParent)) { 2159 parent = accessibilityParentForImageMap(toHTMLMapElement(mapParent)); 2159 2160 break; 2160 2161 } -
trunk/Source/WebCore/dom/DocumentOrderedMap.cpp
r152088 r152387 56 56 inline bool keyMatchesMapName(AtomicStringImpl* key, Element* element) 57 57 { 58 return element->hasTagName(mapTag) && static_cast<HTMLMapElement*>(element)->getName().impl() == key;58 return isHTMLMapElement(element) && toHTMLMapElement(element)->getName().impl() == key; 59 59 } 60 60 61 61 inline bool keyMatchesLowercasedMapName(AtomicStringImpl* key, Element* element) 62 62 { 63 return element->hasTagName(mapTag) && static_cast<HTMLMapElement*>(element)->getName().lower().impl() == key;63 return isHTMLMapElement(element) && toHTMLMapElement(element)->getName().lower().impl() == key; 64 64 } 65 65 -
trunk/Source/WebCore/dom/TreeScope.cpp
r152088 r152387 239 239 String name = (hashPos == notFound ? url : url.substring(hashPos + 1)).impl(); 240 240 if (rootNode()->document()->isHTMLDocument()) 241 return static_cast<HTMLMapElement*>(m_imageMapsByName->getElementByLowercasedMapName(AtomicString(name.lower()).impl(), this));242 return static_cast<HTMLMapElement*>(m_imageMapsByName->getElementByMapName(AtomicString(name).impl(), this));241 return toHTMLMapElement(m_imageMapsByName->getElementByLowercasedMapName(AtomicString(name.lower()).impl(), this)); 242 return toHTMLMapElement(m_imageMapsByName->getElementByMapName(AtomicString(name).impl(), this)); 243 243 } 244 244 -
trunk/Source/WebCore/html/HTMLAreaElement.cpp
r139037 r152387 185 185 { 186 186 Node* mapElement = parentNode(); 187 if (!mapElement || ! mapElement->hasTagName(mapTag))187 if (!mapElement || !isHTMLMapElement(mapElement)) 188 188 return 0; 189 189 190 return static_cast<HTMLMapElement*>(mapElement)->imageElement();190 return toHTMLMapElement(mapElement)->imageElement(); 191 191 } 192 192 -
trunk/Source/WebCore/html/HTMLMapElement.h
r149960 r152387 55 55 }; 56 56 57 inline bool isHTMLMapElement(Node* node) 58 { 59 return node->hasTagName(HTMLNames::mapTag); 60 } 61 62 inline bool isHTMLMapElement(Element* element) 63 { 64 return element->hasTagName(HTMLNames::mapTag); 65 } 66 67 inline HTMLMapElement* toHTMLMapElement(Node* node) 68 { 69 ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLMapElement(node)); 70 return static_cast<HTMLMapElement*>(node); 71 } 72 57 73 } //namespace 58 74
Note: See TracChangeset
for help on using the changeset viewer.