Changeset 145462 in webkit
- Timestamp:
- Mar 11, 2013 6:59:09 PM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r145459 r145462 1 2013-03-11 Abhishek Arya <inferno@chromium.org> 2 3 Replace static_casts with to* functions. 4 https://bugs.webkit.org/show_bug.cgi?id=112072 5 6 Reviewed by Philip Rogers. 7 8 to* functions are preferred over static_cast calls since they 9 help to catch bad casts easily on the testing infrastructure. 10 11 * accessibility/AccessibilityMenuList.cpp: 12 (WebCore::AccessibilityMenuList::canSetFocusAttribute): 13 * bindings/objc/DOM.mm: 14 (kitClass): 15 * bindings/v8/V8LazyEventListener.cpp: 16 (WebCore::V8LazyEventListener::prepareListenerObject): 17 * css/SelectorChecker.cpp: 18 (WebCore::SelectorChecker::checkOne): 19 * editing/ApplyStyleCommand.cpp: 20 (WebCore::isLegacyAppleStyleSpan): 21 (WebCore::isEmptyFontTag): 22 (WebCore::ApplyStyleCommand::applyBlockStyle): 23 * editing/FormatBlockCommand.cpp: 24 (WebCore::isElementForFormatBlock): 25 * editing/ReplaceSelectionCommand.cpp: 26 (WebCore::isMailPasteAsQuotationNode): 27 (WebCore::haveSameTagName): 28 (WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline): 29 (WebCore::ReplaceSelectionCommand::makeInsertedContentRoundTrippableWithHTMLTreeBuilder): 30 * history/CachedPage.cpp: 31 (WebCore::CachedPage::restore): 32 * html/ColorInputType.cpp: 33 (WebCore::ColorInputType::suggestions): 34 * html/HTMLTableRowsCollection.cpp: 35 (WebCore::isInHead): 36 (WebCore::isInBody): 37 (WebCore::isInFoot): 38 * inspector/DOMPatchSupport.cpp: 39 (WebCore::DOMPatchSupport::innerPatchNode): 40 * page/PageSerializer.cpp: 41 (WebCore::SerializerMarkupAccumulator::appendCustomAttributes): 42 * plugins/PluginView.cpp: 43 (WebCore::PluginView::getValue): 44 * rendering/RenderEmbeddedObject.cpp: 45 (WebCore::RenderEmbeddedObject::paintContents): 46 (WebCore::RenderEmbeddedObject::handleUnavailablePluginIndicatorEvent): 47 * rendering/RenderLayer.cpp: 48 (WebCore::RenderLayer::name): 49 * rendering/RenderMedia.cpp: 50 (WebCore::RenderMedia::mediaElement): 51 * rendering/RenderSearchField.cpp: 52 (WebCore::RenderSearchField::autosaveName): 53 * rendering/RenderTextControl.cpp: 54 (WebCore::RenderTextControl::textFormControlElement): 55 (WebCore::updateUserModifyProperty): 56 * rendering/mathml/RenderMathMLFenced.cpp: 57 (WebCore::RenderMathMLFenced::updateFromElement): 58 * rendering/mathml/RenderMathMLFraction.cpp: 59 (WebCore::RenderMathMLFraction::updateFromElement): 60 * xml/parser/XMLDocumentParserLibxml2.cpp: 61 (WebCore::XMLDocumentParser::XMLDocumentParser): 62 (WebCore::XMLDocumentParser::endElementNs): 63 1 64 2013-03-11 Philip Rogers <pdr@google.com> 2 65 -
trunk/Source/WebCore/accessibility/AccessibilityMenuList.cpp
r140658 r145462 93 93 return false; 94 94 95 return static_cast<Element*>(node())->isEnabledFormControl();95 return toElement(node())->isEnabledFormControl(); 96 96 } 97 97 -
trunk/Source/WebCore/bindings/objc/DOM.mm
r144568 r145462 296 296 case WebCore::Node::ELEMENT_NODE: 297 297 if (impl->isHTMLElement()) 298 return WebCore::elementClass( static_cast<WebCore::HTMLElement*>(impl)->tagQName(), [DOMHTMLElement class]);298 return WebCore::elementClass(toHTMLElement(impl)->tagQName(), [DOMHTMLElement class]); 299 299 #if ENABLE(SVG_DOM_OBJC_BINDINGS) 300 300 if (impl->isSVGElement()) -
trunk/Source/WebCore/bindings/v8/V8LazyEventListener.cpp
r142250 r145462 178 178 HTMLFormElement* formElement = 0; 179 179 if (m_node && m_node->isHTMLElement()) 180 formElement = static_cast<HTMLElement*>(m_node)->form();180 formElement = toHTMLElement(m_node)->form(); 181 181 182 182 v8::Handle<v8::Object> nodeWrapper = toObjectWrapper<Node>(m_node, isolate); -
trunk/Source/WebCore/css/SelectorChecker.cpp
r143858 r145462 657 657 #if ENABLE(PROGRESS_ELEMENT) 658 658 if (element->hasTagName(progressTag)) { 659 HTMLProgressElement* progress = static_cast<HTMLProgressElement*>(element);659 HTMLProgressElement* progress = toHTMLProgressElement(element); 660 660 if (progress && !progress->isDeterminate()) 661 661 return true; -
trunk/Source/WebCore/editing/ApplyStyleCommand.cpp
r144911 r145462 68 68 return false; 69 69 70 const HTMLElement* elem = static_cast<const HTMLElement*>(node);70 const HTMLElement* elem = toHTMLElement(node); 71 71 return elem->hasLocalName(spanAttr) && elem->getAttribute(classAttr) == styleSpanClassString(); 72 72 } … … 107 107 return false; 108 108 109 return hasNoAttributeOrOnlyStyleAttribute( static_cast<const HTMLElement*>(element), shouldStyleAttributeBeEmpty);109 return hasNoAttributeOrOnlyStyleAttribute(toHTMLElement(element), shouldStyleAttributeBeEmpty); 110 110 } 111 111 … … 291 291 } 292 292 293 startRange = TextIterator::rangeFromLocationAndLength( static_cast<Element*>(scope), startIndex, 0, true);294 endRange = TextIterator::rangeFromLocationAndLength( static_cast<Element*>(scope), endIndex, 0, true);293 startRange = TextIterator::rangeFromLocationAndLength(toElement(scope), startIndex, 0, true); 294 endRange = TextIterator::rangeFromLocationAndLength(toElement(scope), endIndex, 0, true); 295 295 if (startRange && endRange) 296 296 updateStartEnd(startRange->startPosition(), endRange->startPosition()); -
trunk/Source/WebCore/editing/FormatBlockCommand.cpp
r144911 r145462 43 43 static inline bool isElementForFormatBlock(Node* node) 44 44 { 45 return node->isElementNode() && isElementForFormatBlock( static_cast<Element*>(node)->tagQName());45 return node->isElementNode() && isElementForFormatBlock(toElement(node)->tagQName()); 46 46 } 47 47 -
trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp
r145253 r145462 427 427 static bool isMailPasteAsQuotationNode(const Node* node) 428 428 { 429 return node && node->hasTagName(blockquoteTag) && node->isElementNode() && static_cast<const Element*>(node)->getAttribute(classAttr) == ApplePasteAsQuotation;429 return node && node->hasTagName(blockquoteTag) && node->isElementNode() && toElement(node)->getAttribute(classAttr) == ApplePasteAsQuotation; 430 430 } 431 431 … … 445 445 static bool haveSameTagName(Node* a, Node* b) 446 446 { 447 return a && b && a->isElementNode() && b->isElementNode() && static_cast<Element*>(a)->tagName() == static_cast<Element*>(b)->tagName();447 return a && b && a->isElementNode() && b->isElementNode() && toElement(a)->tagName() == static_cast<Element*>(b)->tagName(); 448 448 } 449 449 … … 487 487 if (element->isHTMLElement()) { 488 488 Vector<QualifiedName> attributes; 489 HTMLElement* htmlElement = static_cast<HTMLElement*>(element);489 HTMLElement* htmlElement = toHTMLElement(element); 490 490 491 491 if (newInlineStyle->conflictsWithImplicitStyleOfElement(htmlElement)) { … … 626 626 continue; 627 627 628 if (isProhibitedParagraphChild( static_cast<const HTMLElement*>(node.get())->localName())) {629 if (HTMLElement* paragraphElement = static_cast<HTMLElement*>(enclosingNodeWithTag(positionInParentBeforeNode(node.get()), pTag)))628 if (isProhibitedParagraphChild(toHTMLElement(node.get())->localName())) { 629 if (HTMLElement* paragraphElement = toHTMLElement(enclosingNodeWithTag(positionInParentBeforeNode(node.get()), pTag))) 630 630 moveNodeOutOfAncestor(node, paragraphElement); 631 631 } -
trunk/Source/WebCore/history/CachedPage.cpp
r138515 r145462 84 84 if (Node* node = focusedDocument->focusedNode()) { 85 85 if (node->isElementNode()) 86 static_cast<Element*>(node)->updateFocusAppearance(true);86 toElement(node)->updateFocusAppearance(true); 87 87 } 88 88 -
trunk/Source/WebCore/html/ColorInputType.cpp
r142248 r145462 234 234 if (dataList) { 235 235 RefPtr<HTMLCollection> options = dataList->options(); 236 for (unsigned i = 0; HTMLOptionElement* option = static_cast<HTMLOptionElement*>(options->item(i)); i++) {236 for (unsigned i = 0; HTMLOptionElement* option = toHTMLOptionElement(options->item(i)); i++) { 237 237 if (!element()->isValidValue(option->value())) 238 238 continue; -
trunk/Source/WebCore/html/HTMLTableRowsCollection.cpp
r136850 r145462 40 40 static bool isInHead(Element* row) 41 41 { 42 return row->parentNode() && static_cast<Element*>(row->parentNode())->hasLocalName(theadTag);42 return row->parentNode() && toElement(row->parentNode())->hasLocalName(theadTag); 43 43 } 44 44 45 45 static bool isInBody(Element* row) 46 46 { 47 return row->parentNode() && static_cast<Element*>(row->parentNode())->hasLocalName(tbodyTag);47 return row->parentNode() && toElement(row->parentNode())->hasLocalName(tbodyTag); 48 48 } 49 49 50 50 static bool isInFoot(Element* row) 51 51 { 52 return row->parentNode() && static_cast<Element*>(row->parentNode())->hasLocalName(tfootTag);52 return row->parentNode() && toElement(row->parentNode())->hasLocalName(tfootTag); 53 53 } 54 54 -
trunk/Source/WebCore/inspector/DOMPatchSupport.cpp
r142375 r145462 171 171 172 172 // Patch attributes 173 Element* oldElement = static_cast<Element*>(oldNode);174 Element* newElement = static_cast<Element*>(newNode);173 Element* oldElement = toElement(oldNode); 174 Element* newElement = toElement(newNode); 175 175 if (oldDigest->m_attrsSHA1 != newDigest->m_attrsSHA1) { 176 176 // FIXME: Create a function in Element for removing all properties. Take in account whether did/willModifyAttribute are important. -
trunk/Source/WebCore/page/PageSerializer.cpp
r143926 r145462 151 151 return; 152 152 153 HTMLFrameOwnerElement* frameOwner = static_cast<HTMLFrameOwnerElement*>(element);153 HTMLFrameOwnerElement* frameOwner = toFrameOwnerElement(element); 154 154 Frame* frame = frameOwner->contentFrame(); 155 155 if (!frame) -
trunk/Source/WebCore/plugins/PluginView.cpp
r144568 r145462 1375 1375 1376 1376 if (m_element->hasTagName(appletTag) || m_element->hasTagName(embedTag) || m_element->hasTagName(objectTag)) 1377 pluginScriptObject = static_cast<HTMLPlugInElement*>(m_element)->getNPObject();1377 pluginScriptObject = toHTMLPlugInElement(m_element)->getNPObject(); 1378 1378 1379 1379 // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html> -
trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp
r144565 r145462 172 172 void RenderEmbeddedObject::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOffset) 173 173 { 174 Element* element = static_cast<Element*>(node());174 Element* element = toElement(node()); 175 175 if (!element || !element->isPluginElement()) 176 176 return; 177 177 178 HTMLPlugInElement* plugInElement = static_cast<HTMLPlugInElement*>(element);178 HTMLPlugInElement* plugInElement = toHTMLPlugInElement(element); 179 179 if (plugInElement->displayState() > HTMLPlugInElement::DisplayingSnapshot) { 180 180 RenderPart::paintContents(paintInfo, paintOffset); … … 185 185 return; 186 186 187 Image* snapshot = static_cast<HTMLPlugInImageElement*>(plugInElement)->snapshotImage();187 Image* snapshot = toHTMLPlugInImageElement(plugInElement)->snapshotImage(); 188 188 if (snapshot) 189 189 paintSnapshotImage(paintInfo, paintOffset, snapshot); … … 418 418 419 419 MouseEvent* mouseEvent = static_cast<MouseEvent*>(event); 420 HTMLPlugInElement* element = static_cast<HTMLPlugInElement*>(node());420 HTMLPlugInElement* element = toHTMLPlugInElement(node()); 421 421 if (event->type() == eventNames().mousedownEvent && static_cast<MouseEvent*>(event)->button() == LeftButton) { 422 422 m_mouseDownWasInUnavailablePluginIndicator = isInUnavailablePluginIndicator(mouseEvent); -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r145422 r145462 277 277 if (node->isElementNode()) { 278 278 name.append(' '); 279 name.append( static_cast<Element*>(node)->tagName());279 name.append(toElement(node)->tagName()); 280 280 } 281 281 if (node->hasID()) { 282 282 name.appendLiteral(" id=\'"); 283 name.append( static_cast<Element*>(node)->getIdAttribute());283 name.append(toElement(node)->getIdAttribute()); 284 284 name.append('\''); 285 285 } -
trunk/Source/WebCore/rendering/RenderMedia.cpp
r144497 r145462 54 54 HTMLMediaElement* RenderMedia::mediaElement() const 55 55 { 56 return static_cast<HTMLMediaElement*>(node());56 return toMediaElement(node()); 57 57 } 58 58 -
trunk/Source/WebCore/rendering/RenderSearchField.cpp
r145406 r145462 200 200 const AtomicString& RenderSearchField::autosaveName() const 201 201 { 202 return static_cast<Element*>(node())->getAttribute(autosaveAttr);202 return toElement(node())->getAttribute(autosaveAttr); 203 203 } 204 204 -
trunk/Source/WebCore/rendering/RenderTextControl.cpp
r145391 r145462 49 49 HTMLTextFormControlElement* RenderTextControl::textFormControlElement() const 50 50 { 51 return static_cast<HTMLTextFormControlElement*>(node());51 return toHTMLTextFormControlElement(node()); 52 52 } 53 53 … … 81 81 82 82 if (node->isElementNode()) { 83 Element* element = static_cast<Element*>(node);83 Element* element = toElement(node); 84 84 isEnabled = element->isEnabledFormControl(); 85 isReadOnlyControl = element->isTextFormControl() && static_cast<HTMLTextFormControlElement*>(element)->readOnly();85 isReadOnlyControl = element->isTextFormControl() && toHTMLTextFormControlElement(element)->readOnly(); 86 86 } 87 87 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp
r140923 r145462 56 56 void RenderMathMLFenced::updateFromElement() 57 57 { 58 Element* fenced = static_cast<Element*>(node());58 Element* fenced = toElement(node()); 59 59 60 60 // FIXME: Handle open/close values with more than one character (they should be treated like text). -
trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp
r132735 r145462 64 64 return; 65 65 66 Element* fraction = static_cast<Element*>(node());66 Element* fraction = toElement(node()); 67 67 68 68 RenderObject* numeratorWrapper = firstChild(); -
trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp
r144565 r145462 600 600 if (!n || !n->isElementNode()) 601 601 break; 602 parentElement = static_cast<Element*>(n);602 parentElement = toElement(n); 603 603 } 604 604 … … 864 864 setDepthTriggeringEntityExpansion(-1); 865 865 866 if (!scriptingContentIsAllowed(m_scriptingPermission) && n->isElementNode() && toScriptElement( static_cast<Element*>(n.get()))) {866 if (!scriptingContentIsAllowed(m_scriptingPermission) && n->isElementNode() && toScriptElement(toElement(n.get()))) { 867 867 popCurrentNode(); 868 868 n->remove(IGNORE_EXCEPTION); … … 875 875 } 876 876 877 Element* element = static_cast<Element*>(n.get());877 Element* element = toElement(n.get()); 878 878 879 879 // The element's parent may have already been removed from document. -
trunk/Source/WebKit/chromium/ChangeLog
r145461 r145462 1 2013-03-11 Abhishek Arya <inferno@chromium.org> 2 3 Replace static_casts with to* functions. 4 https://bugs.webkit.org/show_bug.cgi?id=112072 5 6 Reviewed by Philip Rogers. 7 8 to* functions are preferred over static_cast calls since they 9 help to catch bad casts easily on the testing infrastructure. 10 11 * src/ChromeClientImpl.cpp: 12 (WebKit::ChromeClientImpl::focusedNodeChanged): 13 * src/ContextMenuClientImpl.cpp: 14 (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): 15 * src/DOMUtilitiesPrivate.cpp: 16 (WebCore::toHTMLElement): 17 * src/WebSearchableFormData.cpp: 18 (HTMLNames::IsSelectInDefaultState): 19 1 20 2013-03-11 Sheriff Bot <webkit.review.bot@gmail.com> 2 21 -
trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp
r143803 r145462 232 232 HitTestResult hitTest(IntPoint(0, 0)); 233 233 // This cast must be valid because of the isLink() check. 234 hitTest.setURLElement( static_cast<Element*>(node));234 hitTest.setURLElement(toElement(node)); 235 235 if (hitTest.isLiveLink()) 236 236 focusURL = hitTest.absoluteLinkURL(); -
trunk/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp
r143470 r145462 227 227 // is a media element. 228 228 HTMLMediaElement* mediaElement = 229 static_cast<HTMLMediaElement*>(r.innerNonSharedNode());229 toMediaElement(r.innerNonSharedNode()); 230 230 if (mediaElement->hasTagName(HTMLNames::videoTag)) 231 231 data.mediaType = WebContextMenuData::MediaTypeVideo; … … 267 267 data.mediaFlags |= WebContextMenuData::MediaCanPrint; 268 268 269 HTMLPlugInImageElement* pluginElement = static_cast<HTMLPlugInImageElement*>(r.innerNonSharedNode());269 HTMLPlugInImageElement* pluginElement = toHTMLPlugInImageElement(r.innerNonSharedNode()); 270 270 data.srcURL = pluginElement->document()->completeURL(pluginElement->url()); 271 271 data.mediaFlags |= WebContextMenuData::MediaCanSave; -
trunk/Source/WebKit/chromium/src/DOMUtilitiesPrivate.cpp
r95901 r145462 48 48 { 49 49 if (node->isHTMLElement() 50 && static_cast<HTMLElement*>(node)->hasTagName(name)) {50 && toHTMLElement(node)->hasTagName(name)) { 51 51 return static_cast<HTMLNodeType*>(node); 52 52 } -
trunk/Source/WebKit/chromium/src/WebSearchableFormData.cpp
r98053 r145462 107 107 if (!(*i)->hasLocalName(HTMLNames::optionTag)) 108 108 continue; 109 HTMLOptionElement* optionElement = static_cast<HTMLOptionElement*>(*i);109 HTMLOptionElement* optionElement = toHTMLOptionElement(*i); 110 110 if (optionElement->selected() != optionElement->hasAttribute(selectedAttr)) 111 111 return false; … … 120 120 if (!(*i)->hasLocalName(HTMLNames::optionTag)) 121 121 continue; 122 HTMLOptionElement* optionElement = static_cast<HTMLOptionElement*>(*i);122 HTMLOptionElement* optionElement = toHTMLOptionElement(*i); 123 123 if (optionElement->hasAttribute(selectedAttr)) { 124 124 // The page specified the option to select. -
trunk/Source/WebKit/mac/ChangeLog
r145453 r145462 1 2013-03-11 Abhishek Arya <inferno@chromium.org> 2 3 Replace static_casts with to* functions. 4 https://bugs.webkit.org/show_bug.cgi?id=112072 5 6 Reviewed by Philip Rogers. 7 8 to* functions are preferred over static_cast calls since they 9 help to catch bad casts easily on the testing infrastructure. 10 11 * WebView/WebView.mm: 12 (-[WebView _enterFullscreenForNode:WebCore::]): 13 1 14 2013-03-11 Jochen Eisinger <jochen@chromium.org> 2 15 -
trunk/Source/WebKit/mac/WebView/WebView.mm
r144953 r145462 6467 6467 { 6468 6468 ASSERT(node->hasTagName(WebCore::HTMLNames::videoTag)); 6469 HTMLMediaElement* videoElement = static_cast<HTMLMediaElement*>(node);6469 HTMLMediaElement* videoElement = toMediaElement(node); 6470 6470 6471 6471 if (_private->fullscreenController) {
Note: See TracChangeset
for help on using the changeset viewer.