Replace static_cast with to* helper functions.
authorinferno@chromium.org <inferno@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Mar 2013 00:50:46 +0000 (00:50 +0000)
committerinferno@chromium.org <inferno@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Mar 2013 00:50:46 +0000 (00:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=112045

Reviewed by Eric Seidel.

Source/WebCore:

* bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp:
(WebCore::V8HTMLOptionsCollection::removeMethodCustom):
(WebCore::V8HTMLOptionsCollection::indexedPropertySetter):
* bindings/v8/custom/V8NamedNodesCollection.cpp:
(WebCore::V8NamedNodesCollection::namedItem):
* bindings/v8/custom/V8NodeCustom.cpp:
(WebCore::wrap):
* editing/BreakBlockquoteCommand.cpp:
(WebCore::BreakBlockquoteCommand::doApply):
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::insertNodeAt):
(WebCore::CompositeEditCommand::pushAnchorElementDown):
(WebCore::CompositeEditCommand::breakOutOfEmptyListItem):
(WebCore::CompositeEditCommand::splitTreeToNode):
* editing/InsertParagraphSeparatorCommand.cpp:
(WebCore::InsertParagraphSeparatorCommand::doApply):
* loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::create):
* platform/chromium/PasteboardChromium.cpp:
(WebCore::Pasteboard::writeImage):
* platform/mac/HTMLConverter.mm:
(+[WebHTMLConverter editingAttributedStringFromRange:]):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGraphicsLayerConfiguration):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::frameContentsCompositor):
(WebCore::RenderLayerCompositor::requiresCompositingForVideo):
* rendering/RenderSnapshottedPlugIn.cpp:
(WebCore::RenderSnapshottedPlugIn::plugInImageElement):
* rendering/mathml/RenderMathMLOperator.cpp:
(WebCore::RenderMathMLOperator::updateFromElement):
* rendering/svg/RenderSVGResourceContainer.cpp:
(WebCore::RenderSVGResourceContainer::idChanged):

Source/WebKit/chromium:

* src/WebFrameImpl.cpp:
(WebKit::WebFrameImpl::findChildByExpression):
(WebKit::WebFrameImpl::fromFrameOwnerElement):
* src/WebHelperPluginImpl.cpp:
(WebKit::WebHelperPluginImpl::getPlugin):
* src/WebMediaPlayerClientImpl.cpp:
(WebKit::WebMediaPlayerClientImpl::loadInternal):
(WebKit::WebMediaPlayerClientImpl::create):
* src/WebPageSerializerImpl.cpp:
(WebKit::WebPageSerializerImpl::preActionBeforeSerializeOpenTag):
(WebKit::WebPageSerializerImpl::endTagToString):
(WebKit::WebPageSerializerImpl::buildContentForNode):
(WebKit::WebPageSerializerImpl::collectTargetFrames):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::autocompleteHandleKeyEvent):
(WebKit::WebViewImpl::enterFullScreenForElement):

Source/WebKit/mac:

* WebView/WebRenderLayer.mm:
(+[WebRenderLayer nameForLayer:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@145444 268f45cc-cd09-0410-ab3c-d52691b4dbfc

22 files changed:
Source/WebCore/ChangeLog
Source/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
Source/WebCore/bindings/v8/custom/V8NamedNodesCollection.cpp
Source/WebCore/bindings/v8/custom/V8NodeCustom.cpp
Source/WebCore/editing/BreakBlockquoteCommand.cpp
Source/WebCore/editing/CompositeEditCommand.cpp
Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp
Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp
Source/WebCore/platform/chromium/PasteboardChromium.cpp
Source/WebCore/platform/mac/HTMLConverter.mm
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp
Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp
Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebFrameImpl.cpp
Source/WebKit/chromium/src/WebHelperPluginImpl.cpp
Source/WebKit/chromium/src/WebPageSerializerImpl.cpp
Source/WebKit/chromium/src/WebViewImpl.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebRenderLayer.mm

index 44cfcdc..af874ae 100644 (file)
@@ -1,3 +1,44 @@
+2013-03-11  Abhishek Arya  <inferno@chromium.org>
+
+        Replace static_cast with to* helper functions.
+        https://bugs.webkit.org/show_bug.cgi?id=112045
+
+        Reviewed by Eric Seidel.
+
+        * bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp:
+        (WebCore::V8HTMLOptionsCollection::removeMethodCustom):
+        (WebCore::V8HTMLOptionsCollection::indexedPropertySetter):
+        * bindings/v8/custom/V8NamedNodesCollection.cpp:
+        (WebCore::V8NamedNodesCollection::namedItem):
+        * bindings/v8/custom/V8NodeCustom.cpp:
+        (WebCore::wrap):
+        * editing/BreakBlockquoteCommand.cpp:
+        (WebCore::BreakBlockquoteCommand::doApply):
+        * editing/CompositeEditCommand.cpp:
+        (WebCore::CompositeEditCommand::insertNodeAt):
+        (WebCore::CompositeEditCommand::pushAnchorElementDown):
+        (WebCore::CompositeEditCommand::breakOutOfEmptyListItem):
+        (WebCore::CompositeEditCommand::splitTreeToNode):
+        * editing/InsertParagraphSeparatorCommand.cpp:
+        (WebCore::InsertParagraphSeparatorCommand::doApply):
+        * loader/archive/cf/LegacyWebArchive.cpp:
+        (WebCore::LegacyWebArchive::create):
+        * platform/chromium/PasteboardChromium.cpp:
+        (WebCore::Pasteboard::writeImage):
+        * platform/mac/HTMLConverter.mm:
+        (+[WebHTMLConverter editingAttributedStringFromRange:]):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateGraphicsLayerConfiguration):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::frameContentsCompositor):
+        (WebCore::RenderLayerCompositor::requiresCompositingForVideo):
+        * rendering/RenderSnapshottedPlugIn.cpp:
+        (WebCore::RenderSnapshottedPlugIn::plugInImageElement):
+        * rendering/mathml/RenderMathMLOperator.cpp:
+        (WebCore::RenderMathMLOperator::updateFromElement):
+        * rendering/svg/RenderSVGResourceContainer.cpp:
+        (WebCore::RenderSVGResourceContainer::idChanged):
+
 2013-03-11  James Robinson  <jamesr@chromium.org>
 
         [chromium] Use SkMatrix44 instead of WebTransformationMatrix in animation APIs
index 3f7cdd5..56b7065 100644 (file)
@@ -85,7 +85,7 @@ v8::Handle<v8::Value> V8HTMLOptionsCollection::namedItemMethodCustom(const v8::A
 v8::Handle<v8::Value> V8HTMLOptionsCollection::removeMethodCustom(const v8::Arguments& args)
 {
     HTMLOptionsCollection* imp = V8HTMLOptionsCollection::toNative(args.Holder());
-    HTMLSelectElement* base = static_cast<HTMLSelectElement*>(imp->ownerNode());
+    HTMLSelectElement* base = toHTMLSelectElement(imp->ownerNode());
     return removeElement(base, args);
 }
 
@@ -148,7 +148,7 @@ v8::Handle<v8::Value> V8HTMLOptionsCollection::indexedPropertyGetter(uint32_t in
 v8::Handle<v8::Value> V8HTMLOptionsCollection::indexedPropertySetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
 {
     HTMLOptionsCollection* collection = V8HTMLOptionsCollection::toNative(info.Holder());
-    HTMLSelectElement* base = static_cast<HTMLSelectElement*>(collection->ownerNode());
+    HTMLSelectElement* base = toHTMLSelectElement(collection->ownerNode());
     return toOptionsCollectionSetter(index, value, base, info.GetIsolate());
 }
 
index 3c50dba..ce99d05 100644 (file)
@@ -46,7 +46,7 @@ Node* V8NamedNodesCollection::namedItem(const AtomicString& id) const
 {
     for (unsigned i = 0; i < m_nodes.size(); ++i) {
         Node* node = m_nodes[i].get();
-        if (node->hasID() && static_cast<Element*>(node)->getIdAttribute() == id)
+        if (node->hasID() && toElement(node)->getIdAttribute() == id)
             return node;
     }
     return 0;
index 1c50080..7c2ff9d 100644 (file)
@@ -133,7 +133,7 @@ v8::Handle<v8::Object> wrap(Node* impl, v8::Handle<v8::Object> creationContext,
         if (impl->isSVGElement())
             return wrap(static_cast<SVGElement*>(impl), creationContext, isolate);
 #endif
-        return V8Element::createWrapper(static_cast<Element*>(impl), creationContext, isolate);
+        return V8Element::createWrapper(toElement(impl), creationContext, isolate);
     case Node::ATTRIBUTE_NODE:
         return wrap(static_cast<Attr*>(impl), creationContext, isolate);
     case Node::TEXT_NODE:
index df5eefe..e4ee4c3 100644 (file)
@@ -132,7 +132,7 @@ void BreakBlockquoteCommand::doApply()
         ancestors.append(node);
     
     // Insert a clone of the top blockquote after the break.
-    RefPtr<Element> clonedBlockquote = static_cast<Element*>(topBlockquote)->cloneElementWithoutChildren();
+    RefPtr<Element> clonedBlockquote = toElement(topBlockquote)->cloneElementWithoutChildren();
     insertNodeAfter(clonedBlockquote.get(), breakNode.get());
     
     // Clone startNode's ancestors into the cloned blockquote.
@@ -150,7 +150,7 @@ void BreakBlockquoteCommand::doApply()
             while (listChildNode && !listChildNode->hasTagName(liTag))
                 listChildNode = listChildNode->nextSibling();
             if (listChildNode && listChildNode->renderer() && listChildNode->renderer()->isListItem())
-                setNodeAttribute(static_cast<Element*>(clonedChild.get()), startAttr, String::number(toRenderListItem(listChildNode->renderer())->value()));
+                setNodeAttribute(clonedChild, startAttr, String::number(toRenderListItem(listChildNode->renderer())->value()));
         }
             
         appendNode(clonedChild.get(), clonedAncestor.get());
index 5b5af93..25e3da9 100644 (file)
@@ -364,7 +364,7 @@ void CompositeEditCommand::insertNodeAt(PassRefPtr<Node> insertChild, const Posi
         if (child)
             insertNodeBefore(insertChild, child);
         else
-            appendNode(insertChild, static_cast<Element*>(refChild));
+            appendNode(insertChild, toElement(refChild));
     } else if (caretMinOffset(refChild) >= offset)
         insertNodeBefore(insertChild, refChild);
     else if (refChild->isTextNode() && caretMaxOffset(refChild) > offset) {
@@ -979,7 +979,7 @@ void CompositeEditCommand::pushAnchorElementDown(Node* anchorNode)
     ASSERT(anchorNode->isLink());
     
     setEndingSelection(VisibleSelection::selectionFromContentsOfNode(anchorNode));
-    applyStyledElement(static_cast<Element*>(anchorNode));
+    applyStyledElement(toElement(anchorNode));
     // Clones of anchorNode have been pushed down, now remove it.
     if (anchorNode->inDocument())
         removeNodePreservingChildren(anchorNode);
@@ -1293,7 +1293,7 @@ bool CompositeEditCommand::breakOutOfEmptyListItem()
                 // e.g. <ul><li>hello <ul><li><br></li></ul> </li></ul> should become <ul><li>hello</li> <ul><li><br></li></ul> </ul> after this section
                 // If listNode does NOT appear at the end, then we should consider it as a regular paragraph.
                 // e.g. <ul><li> <ul><li><br></li></ul> hello</li></ul> should become <ul><li> <div><br></div> hello</li></ul> at the end
-                splitElement(static_cast<Element*>(blockEnclosingList), listNode);
+                splitElement(toElement(blockEnclosingList), listNode);
                 removeNodePreservingChildren(listNode->parentNode());
                 newBlock = createListItemElement(document());
             }
@@ -1309,7 +1309,7 @@ bool CompositeEditCommand::breakOutOfEmptyListItem()
     if (isListItem(nextListNode.get()) || isListElement(nextListNode.get())) {
         // If emptyListItem follows another list item or nested list, split the list node.
         if (isListItem(previousListNode.get()) || isListElement(previousListNode.get()))
-            splitElement(static_cast<Element*>(listNode.get()), emptyListItem);
+            splitElement(toElement(listNode.get()), emptyListItem);
 
         // If emptyListItem is followed by other list item or nested list, then insert newBlock before the list node.
         // Because we have splitted the element, emptyListItem is the first element in the list node.
@@ -1468,7 +1468,7 @@ PassRefPtr<Node> CompositeEditCommand::splitTreeToNode(Node* start, Node* end, b
         VisiblePosition positionInParent = firstPositionInNode(node->parentNode());
         VisiblePosition positionInNode = firstPositionInOrBeforeNode(node.get());
         if (positionInParent != positionInNode)
-            splitElement(static_cast<Element*>(node->parentNode()), node);
+            splitElement(toElement(node->parentNode()), node);
     }
 
     return node.release();
index 609b5a0..828f114 100644 (file)
@@ -227,7 +227,7 @@ void InsertParagraphSeparatorCommand::doApply()
             // into an unquoted area. We then don't want the newline within the blockquote or else it will also be quoted.
             if (m_pasteBlockqutoeIntoUnquotedArea) {
                 if (Node* highestBlockquote = highestEnclosingNodeOfType(canonicalPos, &isMailBlockquote))
-                    startBlock = static_cast<Element*>(highestBlockquote);
+                    startBlock = toElement(highestBlockquote);
             }
 
             // Most of the time we want to stay at the nesting level of the startBlock (e.g., when nesting within lists).  However,
index d622aca..7b37860 100644 (file)
@@ -524,7 +524,7 @@ PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(const String& markupString
         Node* node = nodes[i];
         Frame* childFrame;
         if ((node->hasTagName(HTMLNames::frameTag) || node->hasTagName(HTMLNames::iframeTag) || node->hasTagName(HTMLNames::objectTag)) &&
-             (childFrame = static_cast<HTMLFrameOwnerElement*>(node)->contentFrame())) {
+            (childFrame = toFrameOwnerElement(node)->contentFrame())) {
             if (frameFilter && !frameFilter->shouldIncludeSubframe(childFrame))
                 continue;
                 
index 7609663..3d5a6b6 100644 (file)
@@ -146,13 +146,13 @@ void Pasteboard::writeImage(Node* node, const KURL&, const String& title)
     // link.  This isn't useful to us, so get the actual image URL.
     AtomicString urlString;
     if (node->hasTagName(HTMLNames::imgTag) || node->hasTagName(HTMLNames::inputTag))
-        urlString = static_cast<Element*>(node)->getAttribute(HTMLNames::srcAttr);
+        urlString = toElement(node)->getAttribute(HTMLNames::srcAttr);
 #if ENABLE(SVG)
     else if (node->hasTagName(SVGNames::imageTag))
-        urlString = static_cast<Element*>(node)->getAttribute(XLinkNames::hrefAttr);
+        urlString = toElement(node)->getAttribute(XLinkNames::hrefAttr);
 #endif
     else if (node->hasTagName(HTMLNames::embedTag) || node->hasTagName(HTMLNames::objectTag)) {
-        Element* element = static_cast<Element*>(node);
+        Element* element = toElement(node);
         urlString = element->getAttribute(element->imageSourceAttributeName());
     }
     KURL url = urlString.isEmpty() ? KURL() : node->document()->completeURL(stripLeadingAndTrailingHTMLSpaces(urlString));
index 76481f5..b29099e 100644 (file)
@@ -1684,8 +1684,8 @@ static NSInteger _colCompare(id block1, id block2, void *)
         if (startContainer == endContainer && (startOffset == endOffset - 1)) {
             Node* node = startContainer->childNode(startOffset);
             if (node && node->hasTagName(imgTag)) {
-                NSFileWrapper *fileWrapper = fileWrapperForElement(static_cast<Element*>(node));
-                NSTextAttachment *attachment = [[NSTextAttachment alloc] initWithFileWrapper:fileWrapper];
+                NSFileWrapper* fileWrapper = fileWrapperForElement(toElement(node));
+                NSTextAttachmentattachment = [[NSTextAttachment alloc] initWithFileWrapper:fileWrapper];
                 [string appendAttributedString:[NSAttributedString attributedStringWithAttachment:attachment]];
                 [attachment release];
             }
index edede67..b7d471a 100644 (file)
@@ -539,7 +539,7 @@ bool RenderLayerBacking::updateGraphicsLayerConfiguration()
     }
 #if ENABLE(VIDEO)
     else if (renderer->isVideo()) {
-        HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(renderer->node());
+        HTMLMediaElement* mediaElement = toMediaElement(renderer->node());
         m_graphicsLayer->setContentsToMedia(mediaElement->platformLayer());
     }
 #endif
index a95c18a..ad668af 100644 (file)
@@ -1304,7 +1304,7 @@ RenderLayerCompositor* RenderLayerCompositor::frameContentsCompositor(RenderPart
     if (!renderer->node()->isFrameOwnerElement())
         return 0;
         
-    HTMLFrameOwnerElement* element = static_cast<HTMLFrameOwnerElement*>(renderer->node());
+    HTMLFrameOwnerElement* element = toFrameOwnerElement(renderer->node());
     if (Document* contentDocument = element->contentDocument()) {
         if (RenderView* view = contentDocument->renderView())
             return view->compositor();
@@ -1993,7 +1993,7 @@ bool RenderLayerCompositor::requiresCompositingForVideo(RenderObject* renderer)
         if (!node || (!node->hasTagName(HTMLNames::videoTag) && !node->hasTagName(HTMLNames::audioTag)))
             return false;
 
-        HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(node);
+        HTMLMediaElement* mediaElement = toMediaElement(node);
         return mediaElement->player() ? mediaElement->player()->supportsAcceleratedRendering() : false;
     }
 #endif // ENABLE(PLUGIN_PROXY_FOR_VIDEO)
index f41e199..c361bb0 100644 (file)
@@ -58,7 +58,7 @@ RenderSnapshottedPlugIn::~RenderSnapshottedPlugIn()
 
 HTMLPlugInImageElement* RenderSnapshottedPlugIn::plugInImageElement() const
 {
-    return static_cast<HTMLPlugInImageElement*>(node());
+    return toHTMLPlugInImageElement(node());
 }
 
 void RenderSnapshottedPlugIn::layout()
index 246f4b1..0db6455 100644 (file)
@@ -152,7 +152,7 @@ void RenderMathMLOperator::updateFromElement()
     
     // We may need the element later if we can't stretch.
     if (node()->isElementNode()) {
-        if (Element* mo = static_cast<Element*>(node())) {
+        if (Element* mo = toElement(node())) {
             AtomicString stretchyAttr = mo->getAttribute(MathMLNames::stretchyAttr);
             stretchDisabled = equalIgnoringCase(stretchyAttr, "false");
             
@@ -233,7 +233,7 @@ void RenderMathMLOperator::updateFromElement()
         if (m_operator) 
             text = new (renderArena()) RenderText(node(), StringImpl::create(&m_operator, 1));
         else if (node()->isElementNode())
-            if (Element* mo = static_cast<Element*>(node()))
+            if (Element* mo = toElement(node()))
                 text = new (renderArena()) RenderText(node(), mo->textContent().replace(hyphenMinus, minusSign).impl());
         // If we can't figure out the text, leave it blank.
         if (text) {
index 77d5e6a..c52b5da 100644 (file)
@@ -86,7 +86,7 @@ void RenderSVGResourceContainer::idChanged()
     // Remove old id, that is guaranteed to be present in cache.
     SVGDocumentExtensions* extensions = svgExtensionsFromNode(node());
     extensions->removeResource(m_id);
-    m_id = static_cast<Element*>(node())->getIdAttribute();
+    m_id = toElement(node())->getIdAttribute();
 
     registerResource();
 }
index c85408a..019653a 100644 (file)
@@ -1,3 +1,27 @@
+2013-03-11  Abhishek Arya  <inferno@chromium.org>
+
+        Replace static_cast with to* helper functions.
+        https://bugs.webkit.org/show_bug.cgi?id=112045
+
+        Reviewed by Eric Seidel.
+
+        * src/WebFrameImpl.cpp:
+        (WebKit::WebFrameImpl::findChildByExpression):
+        (WebKit::WebFrameImpl::fromFrameOwnerElement):
+        * src/WebHelperPluginImpl.cpp:
+        (WebKit::WebHelperPluginImpl::getPlugin):
+        * src/WebMediaPlayerClientImpl.cpp:
+        (WebKit::WebMediaPlayerClientImpl::loadInternal):
+        (WebKit::WebMediaPlayerClientImpl::create):
+        * src/WebPageSerializerImpl.cpp:
+        (WebKit::WebPageSerializerImpl::preActionBeforeSerializeOpenTag):
+        (WebKit::WebPageSerializerImpl::endTagToString):
+        (WebKit::WebPageSerializerImpl::buildContentForNode):
+        (WebKit::WebPageSerializerImpl::collectTargetFrames):
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::autocompleteHandleKeyEvent):
+        (WebKit::WebViewImpl::enterFullScreenForElement):
+
 2013-03-11  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r145435.
index 22aeefc..6787d8c 100644 (file)
@@ -749,7 +749,7 @@ WebFrame* WebFrameImpl::findChildByExpression(const WebString& xpath) const
     Node* node = xpathResult->iterateNext(ec);
     if (!node || !node->isFrameOwnerElement())
         return 0;
-    HTMLFrameOwnerElement* frameElement = static_cast<HTMLFrameOwnerElement*>(node);
+    HTMLFrameOwnerElement* frameElement = toFrameOwnerElement(node);
     return fromFrame(frameElement->contentFrame());
 }
 
@@ -2272,7 +2272,7 @@ WebFrameImpl* WebFrameImpl::fromFrameOwnerElement(Element* element)
     // FIXME: Why do we check specifically for <iframe> and <frame> here? Why can't we get the WebFrameImpl from an <object> element, for example.
     if (!element || !element->isFrameOwnerElement() || (!element->hasTagName(HTMLNames::iframeTag) && !element->hasTagName(HTMLNames::frameTag)))
         return 0;
-    HTMLFrameOwnerElement* frameElement = static_cast<HTMLFrameOwnerElement*>(element);
+    HTMLFrameOwnerElement* frameElement = toFrameOwnerElement(element);
     return fromFrame(frameElement->contentFrame());
 }
 
index 5d43087..a1db0a5 100644 (file)
@@ -166,7 +166,7 @@ WebPlugin* WebHelperPluginImpl::getPlugin()
         return 0;
     Node* node = objectElements->item(0);
     ASSERT(node->hasTagName(WebCore::HTMLNames::objectTag));
-    WebCore::Widget* widget = static_cast<HTMLPlugInElement*>(node)->pluginWidget();
+    WebCore::Widget* widget = toHTMLPlugInElement(node)->pluginWidget();
     if (!widget)
         return 0;
     WebPlugin* plugin = static_cast<WebPluginContainerImpl*>(widget)->plugin();
index b03fbfc..0885630 100644 (file)
@@ -383,7 +383,7 @@ void WebPageSerializerImpl::endTagToString(Element* element,
         if (param->isHTMLDocument) {
             result.append('>');
             // FIXME: This code is horribly wrong.  WebPageSerializerImpl must die.
-            if (!static_cast<const HTMLElement*>(element)->ieForbidsInsertHTML()) {
+            if (!toHTMLElement(element)->ieForbidsInsertHTML()) {
                 // We need to write end tag when it is required.
                 result.appendLiteral("</");
                 result.append(element->nodeName().lower());
@@ -406,12 +406,12 @@ void WebPageSerializerImpl::buildContentForNode(Node* node,
     switch (node->nodeType()) {
     case Node::ELEMENT_NODE:
         // Process open tag of element.
-        openTagToString(static_cast<Element*>(node), param);
+        openTagToString(toElement(node), param);
         // Walk through the children nodes and process it.
         for (Node *child = node->firstChild(); child; child = child->nextSibling())
             buildContentForNode(child, param);
         // Process end tag of element.
-        endTagToString(static_cast<Element*>(node), param);
+        endTagToString(toElement(node), param);
         break;
     case Node::TEXT_NODE:
         saveHTMLContentToBuffer(createMarkup(node), param);
@@ -483,7 +483,7 @@ void WebPageSerializerImpl::collectTargetFrames()
         for (unsigned i = 0; Node* node = all->item(i); i++) {
             if (!node->isHTMLElement())
                 continue;
-            Element* element = static_cast<Element*>(node);
+            Element* element = toElement(node);
             WebFrameImpl* webFrame =
                 WebFrameImpl::fromFrameOwnerElement(element);
             if (webFrame)
index b85577a..4861f0a 100644 (file)
@@ -1028,7 +1028,7 @@ bool WebViewImpl::autocompleteHandleKeyEvent(const WebKeyboardEvent& event)
             ASSERT_NOT_REACHED();
             return false;
         }
-        Element* element = static_cast<Element*>(node);
+        Element* element = toElement(node);
         if (!element->hasLocalName(HTMLNames::inputTag)) {
             ASSERT_NOT_REACHED();
             return false;
@@ -1039,7 +1039,7 @@ bool WebViewImpl::autocompleteHandleKeyEvent(const WebKeyboardEvent& event)
         if (!m_autofillPopupClient->canRemoveSuggestionAtIndex(selectedIndex))
             return false;
 
-        WebString name = WebInputElement(static_cast<HTMLInputElement*>(element)).nameForAutofill();
+        WebString name = WebInputElement(toHTMLInputElement(element)).nameForAutofill();
         WebString value = m_autofillPopupClient->itemText(selectedIndex);
         m_autofillClient->removeAutocompleteSuggestion(name, value);
         // Update the entries in the currently showing popup to reflect the
@@ -1974,7 +1974,7 @@ void WebViewImpl::enterFullScreenForElement(WebCore::Element* element)
 
 #if USE(NATIVE_FULLSCREEN_VIDEO)
     if (element && element->isMediaElement()) {
-        HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(element);
+        HTMLMediaElement* mediaElement = toMediaElement(element);
         if (mediaElement->player() && mediaElement->player()->canEnterFullscreen()) {
             mediaElement->player()->enterFullscreen();
             m_provisionalFullScreenElement = element;
index bf63938..310b5f8 100644 (file)
@@ -1,3 +1,13 @@
+2013-03-11  Abhishek Arya  <inferno@chromium.org>
+
+        Replace static_cast with to* helper functions.
+        https://bugs.webkit.org/show_bug.cgi?id=112045
+
+        Reviewed by Eric Seidel.
+
+        * WebView/WebRenderLayer.mm:
+        (+[WebRenderLayer nameForLayer:]):
+
 2013-03-11  Jer Noble  <jer.noble@apple.com>
 
         Unreviewed build fix.  Remove stray brace which crept into r145409.
index ebf3877..e1b127a 100644 (file)
@@ -53,9 +53,9 @@ using namespace WebCore;
 
     if (Node* node = renderer->node()) {
         if (node->isElementNode())
-            name = [name stringByAppendingFormat:@" %@", (NSString *)static_cast<Element*>(node)->tagName()];
+            name = [name stringByAppendingFormat:@" %@", (NSString *)toElement(node)->tagName()];
         if (node->hasID())
-            name = [name stringByAppendingFormat:@" id=\"%@\"", (NSString *)static_cast<Element*>(node)->getIdAttribute()];
+            name = [name stringByAppendingFormat:@" id=\"%@\"", (NSString *)toElement(node)->getIdAttribute()];
 
         if (node->hasClass()) {
             StyledElement* styledElement = static_cast<StyledElement*>(node);