2011-02-09 Yael Aharon <yael.aharon@nokia.com>
Reviewed by Darin Adler.
Replace static_cast<HTMLElement*> with toHTMLElement
https://bugs.webkit.org/show_bug.cgi?id=54117
No new tests since no new functionality was introduced.
* accessibility/AccessibilityListBox.cpp:
(WebCore::AccessibilityListBox::addChildren):
* accessibility/AccessibilityMenuListPopup.cpp:
(WebCore::AccessibilityMenuListPopup::addChildren):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::accessibleNameForNode):
(WebCore::AccessibilityRenderObject::accessibilityDescription):
* accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
(webkit_accessible_get_name):
(webkit_accessible_get_description):
* bindings/gobject/WebKitDOMBinding.cpp:
(WebKit::createWrapper):
(WebKit::kit):
* bindings/js/JSElementCustom.cpp:
(WebCore::toJSNewlyCreated):
* bindings/js/JSHTMLFrameSetElementCustom.cpp:
(WebCore::JSHTMLFrameSetElement::nameGetter):
* bindings/js/JSNodeCustom.cpp:
(WebCore::createWrapperInline):
* bindings/v8/custom/V8ElementCustom.cpp:
(WebCore::toV8):
* dom/Document.cpp:
(WebCore::Document::body):
* dom/Element.cpp:
(WebCore::Element::deprecatedCreateContextualFragment):
* dom/Range.cpp:
(WebCore::Range::createContextualFragment):
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyBlockStyle):
(WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
(WebCore::ApplyStyleCommand::splitAncestorsWithUnicodeBidi):
(WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
(WebCore::ApplyStyleCommand::removeStyleFromRunBeforeApplyingStyle):
(WebCore::ApplyStyleCommand::highestAncestorWithConflictingInlineStyle):
(WebCore::ApplyStyleCommand::applyInlineStyleToPushDown):
(WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode):
(WebCore::ApplyStyleCommand::removeInlineStyle):
(WebCore::ApplyStyleCommand::shouldSplitTextElement):
(WebCore::ApplyStyleCommand::addInlineStyleIfNeeded):
* editing/DeleteButtonController.cpp:
(WebCore::enclosingDeletableElement):
(WebCore::DeleteButtonController::show):
* editing/Editor.cpp:
(WebCore::Editor::setBaseWritingDirection):
* editing/InsertListCommand.cpp:
(WebCore::InsertListCommand::mergeWithNeighboringLists):
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::negateStyleRulesThatAffectAppearance):
(WebCore::ReplaceSelectionCommand::handleStyleSpans):
(WebCore::ReplaceSelectionCommand::copyStyleToChildren):
* editing/SelectionController.cpp:
(WebCore::scanForForm):
(WebCore::SelectionController::currentForm):
* editing/htmlediting.cpp:
(WebCore::enclosingList):
(WebCore::enclosingListChild):
(WebCore::embeddedSublist):
(WebCore::appendedSublist):
* editing/markup.cpp:
(WebCore::StyledMarkupAccumulator::appendElement):
* html/HTMLCollection.cpp:
(WebCore::HTMLCollection::checkForNameMatch):
(WebCore::HTMLCollection::updateNameCache):
* html/HTMLElement.cpp:
(WebCore::HTMLElement::setOuterHTML):
(WebCore::HTMLElement::shadowAncestorOwnerForm):
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::formElementIndex):
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::setOption):
(WebCore::HTMLSelectElement::setLength):
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::getOuterHTML):
(WebCore::InspectorDOMAgent::setOuterHTML):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMouseMoveEvent):
* rendering/RenderMeter.cpp:
(WebCore::RenderMeter::createPart):
* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::createSubtreeIfNeeded):
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::createSubtreeIfNeeded):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@78150 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 7351448..d7e169a 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,95 @@
+2011-02-09 Yael Aharon <yael.aharon@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Replace static_cast<HTMLElement*> with toHTMLElement
+ https://bugs.webkit.org/show_bug.cgi?id=54117
+
+ No new tests since no new functionality was introduced.
+
+ * accessibility/AccessibilityListBox.cpp:
+ (WebCore::AccessibilityListBox::addChildren):
+ * accessibility/AccessibilityMenuListPopup.cpp:
+ (WebCore::AccessibilityMenuListPopup::addChildren):
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::accessibleNameForNode):
+ (WebCore::AccessibilityRenderObject::accessibilityDescription):
+ * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
+ (webkit_accessible_get_name):
+ (webkit_accessible_get_description):
+ * bindings/gobject/WebKitDOMBinding.cpp:
+ (WebKit::createWrapper):
+ (WebKit::kit):
+ * bindings/js/JSElementCustom.cpp:
+ (WebCore::toJSNewlyCreated):
+ * bindings/js/JSHTMLFrameSetElementCustom.cpp:
+ (WebCore::JSHTMLFrameSetElement::nameGetter):
+ * bindings/js/JSNodeCustom.cpp:
+ (WebCore::createWrapperInline):
+ * bindings/v8/custom/V8ElementCustom.cpp:
+ (WebCore::toV8):
+ * dom/Document.cpp:
+ (WebCore::Document::body):
+ * dom/Element.cpp:
+ (WebCore::Element::deprecatedCreateContextualFragment):
+ * dom/Range.cpp:
+ (WebCore::Range::createContextualFragment):
+ * editing/ApplyStyleCommand.cpp:
+ (WebCore::ApplyStyleCommand::applyBlockStyle):
+ (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
+ (WebCore::ApplyStyleCommand::splitAncestorsWithUnicodeBidi):
+ (WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
+ (WebCore::ApplyStyleCommand::removeStyleFromRunBeforeApplyingStyle):
+ (WebCore::ApplyStyleCommand::highestAncestorWithConflictingInlineStyle):
+ (WebCore::ApplyStyleCommand::applyInlineStyleToPushDown):
+ (WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode):
+ (WebCore::ApplyStyleCommand::removeInlineStyle):
+ (WebCore::ApplyStyleCommand::shouldSplitTextElement):
+ (WebCore::ApplyStyleCommand::addInlineStyleIfNeeded):
+ * editing/DeleteButtonController.cpp:
+ (WebCore::enclosingDeletableElement):
+ (WebCore::DeleteButtonController::show):
+ * editing/Editor.cpp:
+ (WebCore::Editor::setBaseWritingDirection):
+ * editing/InsertListCommand.cpp:
+ (WebCore::InsertListCommand::mergeWithNeighboringLists):
+ * editing/ReplaceSelectionCommand.cpp:
+ (WebCore::ReplaceSelectionCommand::negateStyleRulesThatAffectAppearance):
+ (WebCore::ReplaceSelectionCommand::handleStyleSpans):
+ (WebCore::ReplaceSelectionCommand::copyStyleToChildren):
+ * editing/SelectionController.cpp:
+ (WebCore::scanForForm):
+ (WebCore::SelectionController::currentForm):
+ * editing/htmlediting.cpp:
+ (WebCore::enclosingList):
+ (WebCore::enclosingListChild):
+ (WebCore::embeddedSublist):
+ (WebCore::appendedSublist):
+ * editing/markup.cpp:
+ (WebCore::StyledMarkupAccumulator::appendElement):
+ * html/HTMLCollection.cpp:
+ (WebCore::HTMLCollection::checkForNameMatch):
+ (WebCore::HTMLCollection::updateNameCache):
+ * html/HTMLElement.cpp:
+ (WebCore::HTMLElement::setOuterHTML):
+ (WebCore::HTMLElement::shadowAncestorOwnerForm):
+ * html/HTMLFormElement.cpp:
+ (WebCore::HTMLFormElement::formElementIndex):
+ * html/HTMLSelectElement.cpp:
+ (WebCore::HTMLSelectElement::setOption):
+ (WebCore::HTMLSelectElement::setLength):
+ * inspector/InspectorDOMAgent.cpp:
+ (WebCore::InspectorDOMAgent::getOuterHTML):
+ (WebCore::InspectorDOMAgent::setOuterHTML):
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::handleMouseMoveEvent):
+ * rendering/RenderMeter.cpp:
+ (WebCore::RenderMeter::createPart):
+ * rendering/RenderTextControl.cpp:
+ (WebCore::RenderTextControl::createSubtreeIfNeeded):
+ * rendering/RenderTextControlSingleLine.cpp:
+ (WebCore::RenderTextControlSingleLine::createSubtreeIfNeeded):
+
2011-02-09 Mike Reed <reed@google.com>
Reviewed by Kenneth Russell.
diff --git a/Source/WebCore/accessibility/AccessibilityListBox.cpp b/Source/WebCore/accessibility/AccessibilityListBox.cpp
index 191a041..81ea503 100644
--- a/Source/WebCore/accessibility/AccessibilityListBox.cpp
+++ b/Source/WebCore/accessibility/AccessibilityListBox.cpp
@@ -79,7 +79,7 @@
for (unsigned i = 0; i < length; i++) {
// The cast to HTMLElement below is safe because the only other possible listItem type
// would be a WMLElement, but WML builds don't use accessibility features at all.
- AccessibilityObject* listOption = listBoxOptionAccessibilityObject(static_cast<HTMLElement*>(listItems[i]));
+ AccessibilityObject* listOption = listBoxOptionAccessibilityObject(toHTMLElement(listItems[i]));
if (listOption && !listOption->accessibilityIsIgnored())
m_children.append(listOption);
}
diff --git a/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp b/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp
index 515e02f..9e2ed6b 100644
--- a/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp
+++ b/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp
@@ -97,7 +97,7 @@
for (unsigned i = 0; i < length; i++) {
// The cast to HTMLElement below is safe because the only other possible listItem type
// would be a WMLElement, but WML builds don't use accessbility features at all.
- AccessibilityMenuListOption* option = menuListOptionAccessibilityObject(static_cast<HTMLElement*>(listItems[i]));
+ AccessibilityMenuListOption* option = menuListOptionAccessibilityObject(toHTMLElement(listItems[i]));
if (option) {
option->setParent(this);
m_children.append(option);
diff --git a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
index ea4844f..70ed839 100644
--- a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
+++ b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
@@ -1169,7 +1169,7 @@
return static_cast<HTMLInputElement*>(node)->value();
if (node->isHTMLElement()) {
- const AtomicString& alt = static_cast<HTMLElement*>(node)->getAttribute(altAttr);
+ const AtomicString& alt = toHTMLElement(node)->getAttribute(altAttr);
if (!alt.isEmpty())
return alt;
}
@@ -1357,7 +1357,7 @@
if (isImage() || isInputImage() || isNativeImage()) {
Node* node = m_renderer->node();
if (node && node->isHTMLElement()) {
- const AtomicString& alt = static_cast<HTMLElement*>(node)->getAttribute(altAttr);
+ const AtomicString& alt = toHTMLElement(node)->getAttribute(altAttr);
if (alt.isEmpty())
return String();
return alt;
@@ -1384,11 +1384,11 @@
return static_cast<HTMLFrameElementBase*>(owner)->getAttribute(nameAttr);
}
if (owner->isHTMLElement())
- return static_cast<HTMLElement*>(owner)->getAttribute(nameAttr);
+ return toHTMLElement(owner)->getAttribute(nameAttr);
}
owner = document->body();
if (owner && owner->isHTMLElement())
- return static_cast<HTMLElement*>(owner)->getAttribute(nameAttr);
+ return toHTMLElement(owner)->getAttribute(nameAttr);
}
return String();
diff --git a/Source/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp b/Source/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
index 86ee8be..8f39113 100644
--- a/Source/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
+++ b/Source/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
@@ -185,7 +185,7 @@
Node* node = renderObject->renderer()->node();
if (node && node->isHTMLElement()) {
// Get the attribute rather than altText String so as not to fall back on title.
- String alt = static_cast<HTMLElement*>(node)->getAttribute(HTMLNames::altAttr);
+ String alt = toHTMLElement(node)->getAttribute(HTMLNames::altAttr);
if (!alt.isEmpty())
return returnString(alt);
}
@@ -212,7 +212,7 @@
// The title attribute should be reliably available as the object's descripton.
// We do not want to fall back on other attributes in its absence. See bug 25524.
- String title = static_cast<HTMLElement*>(node)->title();
+ String title = toHTMLElement(node)->title();
if (!title.isEmpty())
return returnString(title);
diff --git a/Source/WebCore/bindings/gobject/WebKitDOMBinding.cpp b/Source/WebCore/bindings/gobject/WebKitDOMBinding.cpp
index a9b0897..aff3434 100644
--- a/Source/WebCore/bindings/gobject/WebKitDOMBinding.cpp
+++ b/Source/WebCore/bindings/gobject/WebKitDOMBinding.cpp
@@ -57,7 +57,7 @@
switch (node->nodeType()) {
case Node::ELEMENT_NODE:
if (node->isHTMLElement())
- wrappedNode = createHTMLElementWrapper(static_cast<HTMLElement*>(node));
+ wrappedNode = createHTMLElementWrapper(toHTMLElement(node));
else
wrappedNode = wrapElement(static_cast<Element*>(node));
break;
@@ -93,7 +93,7 @@
gpointer wrappedElement;
if (element->isHTMLElement())
- wrappedElement = createHTMLElementWrapper(static_cast<HTMLElement*>(element));
+ wrappedElement = createHTMLElementWrapper(toHTMLElement(element));
else
wrappedElement = wrapElement(element);
diff --git a/Source/WebCore/bindings/js/JSElementCustom.cpp b/Source/WebCore/bindings/js/JSElementCustom.cpp
index 3bfe110..9ed3739 100644
--- a/Source/WebCore/bindings/js/JSElementCustom.cpp
+++ b/Source/WebCore/bindings/js/JSElementCustom.cpp
@@ -75,7 +75,7 @@
JSNode* wrapper;
if (element->isHTMLElement())
- wrapper = createJSHTMLWrapper(exec, globalObject, static_cast<HTMLElement*>(element));
+ wrapper = createJSHTMLWrapper(exec, globalObject, toHTMLElement(element));
#if ENABLE(SVG)
else if (element->isSVGElement())
wrapper = createJSSVGWrapper(exec, globalObject, static_cast<SVGElement*>(element));
diff --git a/Source/WebCore/bindings/js/JSHTMLFrameSetElementCustom.cpp b/Source/WebCore/bindings/js/JSHTMLFrameSetElementCustom.cpp
index 617aaff..ea4f4c0 100644
--- a/Source/WebCore/bindings/js/JSHTMLFrameSetElementCustom.cpp
+++ b/Source/WebCore/bindings/js/JSHTMLFrameSetElementCustom.cpp
@@ -50,7 +50,7 @@
JSValue JSHTMLFrameSetElement::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
{
JSHTMLElement* thisObj = static_cast<JSHTMLElement*>(asObject(slotBase));
- HTMLElement* element = static_cast<HTMLElement*>(thisObj->impl());
+ HTMLElement* element = toHTMLElement(thisObj->impl());
Node* frame = element->children()->namedItem(identifierToAtomicString(propertyName));
if (Document* doc = static_cast<HTMLFrameElement*>(frame)->contentDocument()) {
diff --git a/Source/WebCore/bindings/js/JSNodeCustom.cpp b/Source/WebCore/bindings/js/JSNodeCustom.cpp
index a0963b8..8d00447 100644
--- a/Source/WebCore/bindings/js/JSNodeCustom.cpp
+++ b/Source/WebCore/bindings/js/JSNodeCustom.cpp
@@ -169,7 +169,7 @@
switch (node->nodeType()) {
case Node::ELEMENT_NODE:
if (node->isHTMLElement())
- wrapper = createJSHTMLWrapper(exec, globalObject, static_cast<HTMLElement*>(node));
+ wrapper = createJSHTMLWrapper(exec, globalObject, toHTMLElement(node));
#if ENABLE(SVG)
else if (node->isSVGElement())
wrapper = createJSSVGWrapper(exec, globalObject, static_cast<SVGElement*>(node));
diff --git a/Source/WebCore/bindings/v8/custom/V8ElementCustom.cpp b/Source/WebCore/bindings/v8/custom/V8ElementCustom.cpp
index 02fc457..e9b9336 100644
--- a/Source/WebCore/bindings/v8/custom/V8ElementCustom.cpp
+++ b/Source/WebCore/bindings/v8/custom/V8ElementCustom.cpp
@@ -58,7 +58,7 @@
if (!impl)
return v8::Null();
if (impl->isHTMLElement())
- return toV8(static_cast<HTMLElement*>(impl), forceNewObject);
+ return toV8(toHTMLElement(impl), forceNewObject);
#if ENABLE(SVG)
if (impl->isSVGElement())
return toV8(static_cast<SVGElement*>(impl), forceNewObject);
diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp
index 35c8f10..31b7678 100644
--- a/Source/WebCore/dom/Document.cpp
+++ b/Source/WebCore/dom/Document.cpp
@@ -1970,12 +1970,12 @@
Node* body = 0;
for (Node* i = de->firstChild(); i; i = i->nextSibling()) {
if (i->hasTagName(framesetTag))
- return static_cast<HTMLElement*>(i);
+ return toHTMLElement(i);
if (i->hasTagName(bodyTag) && !body)
body = i;
}
- return static_cast<HTMLElement*>(body);
+ return toHTMLElement(body);
}
void Document::setBody(PassRefPtr<HTMLElement> newBody, ExceptionCode& ec)
diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp
index 3026123..9b3f723 100644
--- a/Source/WebCore/dom/Element.cpp
+++ b/Source/WebCore/dom/Element.cpp
@@ -152,7 +152,7 @@
for (RefPtr<Node> node = fragment->firstChild(); node; node = nextNode) {
nextNode = node->nextSibling();
if (node->hasTagName(htmlTag) || node->hasTagName(bodyTag)) {
- HTMLElement* element = static_cast<HTMLElement*>(node.get());
+ HTMLElement* element = toHTMLElement(node.get());
Node* firstChild = element->firstChild();
if (firstChild)
nextNode = firstChild;
diff --git a/Source/WebCore/dom/Range.cpp b/Source/WebCore/dom/Range.cpp
index a41fc49..8ba23ab 100644
--- a/Source/WebCore/dom/Range.cpp
+++ b/Source/WebCore/dom/Range.cpp
@@ -1079,7 +1079,7 @@
// Logic from deprecatedCreateContextualFragment should just be moved into
// this function. Range::createContextualFragment semantics do not make
// sense for the rest of the DOM implementation to use.
- RefPtr<DocumentFragment> fragment = static_cast<HTMLElement*>(element)->deprecatedCreateContextualFragment(markup);
+ RefPtr<DocumentFragment> fragment = toHTMLElement(element)->deprecatedCreateContextualFragment(markup);
if (!fragment) {
ec = NOT_SUPPORTED_ERR;
return 0;
diff --git a/Source/WebCore/editing/ApplyStyleCommand.cpp b/Source/WebCore/editing/ApplyStyleCommand.cpp
index 7c8025f..82dfc8b 100644
--- a/Source/WebCore/editing/ApplyStyleCommand.cpp
+++ b/Source/WebCore/editing/ApplyStyleCommand.cpp
@@ -602,9 +602,9 @@
}
ASSERT(block->isHTMLElement());
if (block->isHTMLElement()) {
- removeCSSStyle(style, static_cast<HTMLElement*>(block.get()));
+ removeCSSStyle(style, toHTMLElement(block.get()));
if (!m_removeOnly)
- addBlockStyle(styleChange, static_cast<HTMLElement*>(block.get()));
+ addBlockStyle(styleChange, toHTMLElement(block.get()));
}
if (nextParagraphStart.isOrphan())
@@ -691,7 +691,7 @@
// Only work on fully selected nodes.
if (!nodeFullySelected(node, start, end))
continue;
- element = static_cast<HTMLElement*>(node);
+ element = toHTMLElement(node);
} else if (node->isTextNode() && node->renderer() && node->parentNode() != lastStyledNode) {
// Last styled node was not parent node of this text node, but we wish to style this
// text node. To make this possible, add a style span to surround this text node.
@@ -784,9 +784,9 @@
&& getIdentifierValue(computedStyle(highestAncestorWithUnicodeBidi).get(), CSSPropertyDirection) == allowedDirection
&& highestAncestorWithUnicodeBidi->isHTMLElement()) {
if (!nextHighestAncestorWithUnicodeBidi)
- return static_cast<HTMLElement*>(highestAncestorWithUnicodeBidi);
+ return toHTMLElement(highestAncestorWithUnicodeBidi);
- unsplitAncestor = static_cast<HTMLElement*>(highestAncestorWithUnicodeBidi);
+ unsplitAncestor = toHTMLElement(highestAncestorWithUnicodeBidi);
highestAncestorWithUnicodeBidi = nextHighestAncestorWithUnicodeBidi;
}
@@ -1054,7 +1054,7 @@
if (pastEndNode && pastEndNode->isDescendantOf(node))
break;
// Add to this element's inline style and skip over its contents.
- HTMLElement* element = static_cast<HTMLElement*>(node);
+ HTMLElement* element = toHTMLElement(node);
RefPtr<CSSMutableStyleDeclaration> inlineStyle = element->getInlineStyleDecl()->copy();
inlineStyle->merge(style);
setNodeAttribute(element, styleAttr, inlineStyle->cssText());
@@ -1124,7 +1124,7 @@
RefPtr<Node> previousSibling = node->previousSibling();
RefPtr<Node> nextSibling = node->nextSibling();
RefPtr<ContainerNode> parent = node->parentNode();
- removeInlineStyleFromElement(style, static_cast<HTMLElement*>(node.get()), RemoveAlways);
+ removeInlineStyleFromElement(style, toHTMLElement(node.get()), RemoveAlways);
if (!node->inDocument()) {
// FIXME: We might need to update the start and the end of current selection here but need a test.
if (runStart == node)
@@ -1350,8 +1350,8 @@
Node* unsplittableElement = unsplittableElementForPosition(firstPositionInOrBeforeNode(node));
for (Node *n = node; n; n = n->parentNode()) {
- if (n->isHTMLElement() && shouldRemoveInlineStyleFromElement(style, static_cast<HTMLElement*>(n)))
- result = static_cast<HTMLElement*>(n);
+ if (n->isHTMLElement() && shouldRemoveInlineStyleFromElement(style, toHTMLElement(n)))
+ result = toHTMLElement(n);
// Should stop at the editable root (cannot cross editing boundary) and
// also stop at the unsplittable element to be consistent with other UAs
if (n == unsplittableElement)
@@ -1370,7 +1370,7 @@
RefPtr<CSSMutableStyleDeclaration> newInlineStyle = style;
if (node->isHTMLElement()) {
- HTMLElement* element = static_cast<HTMLElement*>(node);
+ HTMLElement* element = toHTMLElement(node);
CSSMutableStyleDeclaration* existingInlineStyle = element->inlineStyleDecl();
// Avoid overriding existing styles of node
@@ -1406,7 +1406,7 @@
// Since addInlineStyleIfNeeded can't add styles to block-flow render objects, add style attribute instead.
// FIXME: applyInlineStyleToRange should be used here instead.
if ((node->renderer()->isBlockFlow() || node->childNodeCount()) && node->isHTMLElement()) {
- setNodeAttribute(static_cast<HTMLElement*>(node), styleAttr, newInlineStyle->cssText());
+ setNodeAttribute(toHTMLElement(node), styleAttr, newInlineStyle->cssText());
return;
}
@@ -1442,7 +1442,7 @@
elementsToPushDown.append(styledElement);
}
RefPtr<CSSMutableStyleDeclaration> styleToPushDown = CSSMutableStyleDeclaration::create();
- removeInlineStyleFromElement(style, static_cast<HTMLElement*>(current), RemoveIfNeeded, styleToPushDown.get());
+ removeInlineStyleFromElement(style, toHTMLElement(current), RemoveIfNeeded, styleToPushDown.get());
// The inner loop will go through children on each level
// FIXME: we should aggregate inline child elements together so that we don't wrap each child separately.
@@ -1514,7 +1514,7 @@
while (node) {
RefPtr<Node> next = node->traverseNextNode();
if (node->isHTMLElement() && nodeFullySelected(node, start, end)) {
- RefPtr<HTMLElement> elem = static_cast<HTMLElement*>(node);
+ RefPtr<HTMLElement> elem = toHTMLElement(node);
RefPtr<Node> prev = elem->traversePreviousNodePostOrder();
RefPtr<Node> next = elem->traverseNextNode();
RefPtr<CSSMutableStyleDeclaration> styleToPushDown;
@@ -1638,7 +1638,7 @@
if (!element || !element->isHTMLElement())
return false;
- return shouldRemoveInlineStyleFromElement(style, static_cast<HTMLElement*>(element));
+ return shouldRemoveInlineStyleFromElement(style, toHTMLElement(element));
}
bool ApplyStyleCommand::isValidCaretPositionInTextNode(const Position& position)
@@ -1841,10 +1841,10 @@
HTMLElement* styleContainer = 0;
for (Node* container = startNode.get(); container && startNode == endNode; container = container->firstChild()) {
if (container->isHTMLElement() && container->hasTagName(fontTag))
- fontContainer = static_cast<HTMLElement*>(container);
+ fontContainer = toHTMLElement(container);
bool styleContainerIsNotSpan = !styleContainer || !styleContainer->hasTagName(spanTag);
if (container->isHTMLElement() && (container->hasTagName(spanTag) || (styleContainerIsNotSpan && container->childNodeCount())))
- styleContainer = static_cast<HTMLElement*>(container);
+ styleContainer = toHTMLElement(container);
if (!container->firstChild())
break;
startNode = container->firstChild();
@@ -1874,7 +1874,7 @@
if (styleChange.cssStyle().length()) {
if (styleContainer) {
- CSSMutableStyleDeclaration* existingStyle = static_cast<HTMLElement*>(styleContainer)->inlineStyleDecl();
+ CSSMutableStyleDeclaration* existingStyle = toHTMLElement(styleContainer)->inlineStyleDecl();
if (existingStyle)
setNodeAttribute(styleContainer, styleAttr, existingStyle->cssText() + styleChange.cssStyle());
else
diff --git a/Source/WebCore/editing/DeleteButtonController.cpp b/Source/WebCore/editing/DeleteButtonController.cpp
index 61e3190..75b9a96 100644
--- a/Source/WebCore/editing/DeleteButtonController.cpp
+++ b/Source/WebCore/editing/DeleteButtonController.cpp
@@ -164,7 +164,7 @@
return 0;
ASSERT(element->isHTMLElement());
- return static_cast<HTMLElement*>(element);
+ return toHTMLElement(element);
}
void DeleteButtonController::respondToChangedSelection(const VisibleSelection& oldSelection)
@@ -263,7 +263,7 @@
if (!enabled() || !element || !element->inDocument() || !isDeletableElement(element))
return;
- if (!m_frame->editor()->shouldShowDeleteInterface(static_cast<HTMLElement*>(element)))
+ if (!m_frame->editor()->shouldShowDeleteInterface(toHTMLElement(element)))
return;
// we rely on the renderer having current information, so we should update the layout if needed
diff --git a/Source/WebCore/editing/Editor.cpp b/Source/WebCore/editing/Editor.cpp
index 780cb58..99624b3 100644
--- a/Source/WebCore/editing/Editor.cpp
+++ b/Source/WebCore/editing/Editor.cpp
@@ -1558,7 +1558,7 @@
if (focusedNode && (focusedNode->hasTagName(textareaTag) || (focusedNode->hasTagName(inputTag) && static_cast<HTMLInputElement*>(focusedNode)->isTextField()))) {
if (direction == NaturalWritingDirection)
return;
- static_cast<HTMLElement*>(focusedNode)->setAttribute(dirAttr, direction == LeftToRightWritingDirection ? "ltr" : "rtl");
+ toHTMLElement(focusedNode)->setAttribute(dirAttr, direction == LeftToRightWritingDirection ? "ltr" : "rtl");
frame()->document()->updateStyleIfNeeded();
return;
}
diff --git a/Source/WebCore/editing/InsertListCommand.cpp b/Source/WebCore/editing/InsertListCommand.cpp
index 9348786..c24c683 100644
--- a/Source/WebCore/editing/InsertListCommand.cpp
+++ b/Source/WebCore/editing/InsertListCommand.cpp
@@ -72,7 +72,7 @@
if (!list || !list->nextElementSibling() || !list->nextElementSibling()->isHTMLElement())
return list.release();
- RefPtr<HTMLElement> nextList = static_cast<HTMLElement*>(list->nextElementSibling());
+ RefPtr<HTMLElement> nextList = toHTMLElement(list->nextElementSibling());
if (canMergeLists(list.get(), nextList.get())) {
mergeIdenticalElements(list, nextList);
return nextList.release();
diff --git a/Source/WebCore/editing/ReplaceSelectionCommand.cpp b/Source/WebCore/editing/ReplaceSelectionCommand.cpp
index 08b047f..846b932 100644
--- a/Source/WebCore/editing/ReplaceSelectionCommand.cpp
+++ b/Source/WebCore/editing/ReplaceSelectionCommand.cpp
@@ -476,7 +476,7 @@
for (RefPtr<Node> node = m_firstNodeInserted.get(); node; node = node->traverseNextNode()) {
// FIXME: <rdar://problem/5371536> Style rules that match pasted content can change it's appearance
if (isStyleSpan(node.get())) {
- HTMLElement* e = static_cast<HTMLElement*>(node.get());
+ HTMLElement* e = toHTMLElement(node.get());
// There are other styles that style rules can give to style spans,
// but these are the two important ones because they'll prevent
// inserted content from appearing in the right paragraph.
@@ -620,7 +620,7 @@
if (!sourceDocumentStyleSpan)
return;
- RefPtr<EditingStyle> sourceDocumentStyle = EditingStyle::create(static_cast<HTMLElement*>(sourceDocumentStyleSpan)->getInlineStyleDecl());
+ RefPtr<EditingStyle> sourceDocumentStyle = EditingStyle::create(toHTMLElement(sourceDocumentStyleSpan)->getInlineStyleDecl());
ContainerNode* context = sourceDocumentStyleSpan->parentNode();
// If Mail wraps the fragment with a Paste as Quotation blockquote, or if you're pasting into a quoted region,
@@ -657,7 +657,7 @@
return;
}
- RefPtr<EditingStyle> copiedRangeStyle = EditingStyle::create(static_cast<HTMLElement*>(copiedRangeStyleSpan)->getInlineStyleDecl());
+ RefPtr<EditingStyle> copiedRangeStyle = EditingStyle::create(toHTMLElement(copiedRangeStyleSpan)->getInlineStyleDecl());
// We're going to put sourceDocumentStyleSpan's non-redundant styles onto copiedRangeStyleSpan,
// as long as they aren't overridden by ones on copiedRangeStyleSpan.
@@ -696,7 +696,7 @@
// In this case, put a span tag around the child node.
RefPtr<Node> newNode = parentNode->cloneNode(false);
ASSERT(newNode->hasTagName(spanTag));
- HTMLElement* newSpan = static_cast<HTMLElement*>(newNode.get());
+ HTMLElement* newSpan = toHTMLElement(newNode.get());
setNodeAttribute(newSpan, styleAttr, parentStyle->cssText());
insertNodeAfter(newSpan, childNode);
ExceptionCode ec = 0;
@@ -707,7 +707,7 @@
// Copy the style attribute and merge them into the child node. We don't want to override
// existing styles, so don't clobber on merge.
RefPtr<CSSMutableStyleDeclaration> newStyle = parentStyle->copy();
- HTMLElement* childElement = static_cast<HTMLElement*>(childNode);
+ HTMLElement* childElement = toHTMLElement(childNode);
RefPtr<CSSMutableStyleDeclaration> existingStyles = childElement->getInlineStyleDecl()->copy();
existingStyles->merge(newStyle.get(), false);
setNodeAttribute(childElement, styleAttr, existingStyles->cssText());
diff --git a/Source/WebCore/editing/SelectionController.cpp b/Source/WebCore/editing/SelectionController.cpp
index 82d7af2..5b527ef 100644
--- a/Source/WebCore/editing/SelectionController.cpp
+++ b/Source/WebCore/editing/SelectionController.cpp
@@ -1700,7 +1700,7 @@
for (Node* node = start; node; node = node->traverseNextNode()) {
if (node->hasTagName(formTag))
return static_cast<HTMLFormElement*>(node);
- if (node->isHTMLElement() && static_cast<HTMLElement*>(node)->isFormControlElement())
+ if (node->isHTMLElement() && toHTMLElement(node)->isFormControlElement())
return static_cast<HTMLFormControlElement*>(node)->form();
if (node->hasTagName(frameTag) || node->hasTagName(iframeTag)) {
Node* childDocument = static_cast<HTMLFrameElementBase*>(node)->contentDocument();
@@ -1724,7 +1724,7 @@
for (node = start; node; node = node->parentNode()) {
if (node->hasTagName(formTag))
return static_cast<HTMLFormElement*>(node);
- if (node->isHTMLElement() && static_cast<HTMLElement*>(node)->isFormControlElement())
+ if (node->isHTMLElement() && toHTMLElement(node)->isFormControlElement())
return static_cast<HTMLFormControlElement*>(node)->form();
}
diff --git a/Source/WebCore/editing/htmlediting.cpp b/Source/WebCore/editing/htmlediting.cpp
index 2cf4d85..cb157d2 100644
--- a/Source/WebCore/editing/htmlediting.cpp
+++ b/Source/WebCore/editing/htmlediting.cpp
@@ -662,7 +662,7 @@
for (ContainerNode* n = node->parentNode(); n; n = n->parentNode()) {
if (n->hasTagName(ulTag) || n->hasTagName(olTag))
- return static_cast<HTMLElement*>(n);
+ return toHTMLElement(n);
if (n == root)
return 0;
}
@@ -670,7 +670,7 @@
return 0;
}
-HTMLElement* enclosingListChild(Node *node)
+Node* enclosingListChild(Node *node)
{
if (!node)
return 0;
@@ -681,7 +681,7 @@
// FIXME: This function is inappropriately named if it starts with node instead of node->parentNode()
for (Node* n = node; n && n->parentNode(); n = n->parentNode()) {
if (n->hasTagName(liTag) || isListElement(n->parentNode()))
- return static_cast<HTMLElement*>(n);
+ return n;
if (n == root || isTableCell(n))
return 0;
}
@@ -694,7 +694,7 @@
// Check the DOM so that we'll find collapsed sublists without renderers.
for (Node* n = listItem->firstChild(); n; n = n->nextSibling()) {
if (isListElement(n))
- return static_cast<HTMLElement*>(n);
+ return toHTMLElement(n);
}
return 0;
@@ -705,7 +705,7 @@
// Check the DOM so that we'll find collapsed sublists without renderers.
for (Node* n = listItem->nextSibling(); n; n = n->nextSibling()) {
if (isListElement(n))
- return static_cast<HTMLElement*>(n);
+ return toHTMLElement(n);
if (isListItem(listItem))
return 0;
}
diff --git a/Source/WebCore/editing/htmlediting.h b/Source/WebCore/editing/htmlediting.h
index 81a3ae2..b71e879 100644
--- a/Source/WebCore/editing/htmlediting.h
+++ b/Source/WebCore/editing/htmlediting.h
@@ -203,7 +203,7 @@
HTMLElement* enclosingList(Node*);
HTMLElement* outermostEnclosingList(Node*, Node* rootList = 0);
-HTMLElement* enclosingListChild(Node*);
+Node* enclosingListChild(Node*);
// -------------------------------------------------------------------------
// Element
diff --git a/Source/WebCore/editing/markup.cpp b/Source/WebCore/editing/markup.cpp
index 3e2378f..34c3ec7 100644
--- a/Source/WebCore/editing/markup.cpp
+++ b/Source/WebCore/editing/markup.cpp
@@ -268,7 +268,7 @@
}
if (element->isHTMLElement() && (shouldAnnotate() || addDisplayInline)) {
- RefPtr<CSSMutableStyleDeclaration> style = static_cast<HTMLElement*>(element)->getInlineStyleDecl()->copy();
+ RefPtr<CSSMutableStyleDeclaration> style = toHTMLElement(element)->getInlineStyleDecl()->copy();
if (shouldAnnotate()) {
RefPtr<CSSMutableStyleDeclaration> styleFromMatchedRules = styleFromMatchedRulesForElement(const_cast<Element*>(element));
// Styles from the inline style declaration, held in the variable "style", take precedence
diff --git a/Source/WebCore/html/HTMLCollection.cpp b/Source/WebCore/html/HTMLCollection.cpp
index 87e1d8b..6d64f5c 100644
--- a/Source/WebCore/html/HTMLCollection.cpp
+++ b/Source/WebCore/html/HTMLCollection.cpp
@@ -264,7 +264,7 @@
if (!element->isHTMLElement())
return false;
- HTMLElement* e = static_cast<HTMLElement*>(element);
+ HTMLElement* e = toHTMLElement(element);
if (!checkName)
return e->getIdAttribute() == name;
@@ -318,7 +318,7 @@
for (Element* element = itemAfter(0); element; element = itemAfter(element)) {
if (!element->isHTMLElement())
continue;
- HTMLElement* e = static_cast<HTMLElement*>(element);
+ HTMLElement* e = toHTMLElement(element);
const AtomicString& idAttrVal = e->getIdAttribute();
const AtomicString& nameAttrVal = e->getAttribute(nameAttr);
if (!idAttrVal.isEmpty()) {
diff --git a/Source/WebCore/html/HTMLElement.cpp b/Source/WebCore/html/HTMLElement.cpp
index ab01c3d..22fc2f2 100644
--- a/Source/WebCore/html/HTMLElement.cpp
+++ b/Source/WebCore/html/HTMLElement.cpp
@@ -371,7 +371,7 @@
ec = NO_MODIFICATION_ALLOWED_ERR;
return;
}
- HTMLElement* parent = static_cast<HTMLElement*>(p);
+ HTMLElement* parent = toHTMLElement(p);
RefPtr<DocumentFragment> fragment = createFragmentFromSource(html, parent, ec);
if (fragment) {
@@ -852,7 +852,7 @@
if (!ancestorNode->isHTMLElement())
return 0;
- HTMLElement* ancestorHTML = static_cast<HTMLElement*>(ancestorNode);
+ HTMLElement* ancestorHTML = toHTMLElement(ancestorNode);
if (!ancestorHTML)
return 0;
return ancestorHTML->form();
diff --git a/Source/WebCore/html/HTMLFormElement.cpp b/Source/WebCore/html/HTMLFormElement.cpp
index f503c26..8535027 100644
--- a/Source/WebCore/html/HTMLFormElement.cpp
+++ b/Source/WebCore/html/HTMLFormElement.cpp
@@ -462,7 +462,7 @@
if (node->isHTMLElement()
&& (static_cast<Element*>(node)->isFormControlElement()
|| node->hasTagName(objectTag))
- && static_cast<HTMLElement*>(node)->form() == this)
+ && toHTMLElement(node)->form() == this)
++i;
}
}
diff --git a/Source/WebCore/html/HTMLSelectElement.cpp b/Source/WebCore/html/HTMLSelectElement.cpp
index 91f860b..d23e56a 100644
--- a/Source/WebCore/html/HTMLSelectElement.cpp
+++ b/Source/WebCore/html/HTMLSelectElement.cpp
@@ -464,7 +464,7 @@
setLength(index, ec);
// replace an existing entry ?
} else if (diff < 0) {
- before = static_cast<HTMLElement*>(options()->item(index+1));
+ before = toHTMLElement(options()->item(index+1));
remove(index);
}
// finally add the new element
@@ -486,7 +486,7 @@
do {
RefPtr<Element> option = document()->createElement(optionTag, false);
ASSERT(option);
- add(static_cast<HTMLElement*>(option.get()), 0, ec);
+ add(toHTMLElement(option.get()), 0, ec);
if (ec)
break;
} while (++diff);
diff --git a/Source/WebCore/inspector/InspectorDOMAgent.cpp b/Source/WebCore/inspector/InspectorDOMAgent.cpp
index 6e10f09..c00884c 100644
--- a/Source/WebCore/inspector/InspectorDOMAgent.cpp
+++ b/Source/WebCore/inspector/InspectorDOMAgent.cpp
@@ -537,7 +537,7 @@
if (!node || !node->isHTMLElement())
return;
- *outerHTML = static_cast<HTMLElement*>(node)->outerHTML();
+ *outerHTML = toHTMLElement(node)->outerHTML();
}
void InspectorDOMAgent::setOuterHTML(long nodeId, const String& outerHTML, long* newId)
@@ -552,7 +552,7 @@
Node* previousSibling = node->previousSibling();
ContainerNode* parentNode = node->parentNode();
- HTMLElement* htmlElement = static_cast<HTMLElement*>(node);
+ HTMLElement* htmlElement = toHTMLElement(node);
ExceptionCode ec = 0;
htmlElement->setOuterHTML(outerHTML, ec);
if (ec)
diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp
index 7e7b6ce..23869bc 100644
--- a/Source/WebCore/page/EventHandler.cpp
+++ b/Source/WebCore/page/EventHandler.cpp
@@ -1548,7 +1548,7 @@
// effect on plugins (which matches Firefox).
bool overPluginElement = false;
if (mev.targetNode() && mev.targetNode()->isHTMLElement()) {
- HTMLElement* el = static_cast<HTMLElement*>(mev.targetNode());
+ HTMLElement* el = toHTMLElement(mev.targetNode());
overPluginElement = el->hasTagName(appletTag) || el->hasTagName(objectTag) || el->hasTagName(embedTag);
}
if (!overPluginElement) {
diff --git a/Source/WebCore/rendering/RenderMeter.cpp b/Source/WebCore/rendering/RenderMeter.cpp
index 6439651..f3ada0b 100644
--- a/Source/WebCore/rendering/RenderMeter.cpp
+++ b/Source/WebCore/rendering/RenderMeter.cpp
@@ -107,7 +107,7 @@
PassRefPtr<MeterPartElement> RenderMeter::createPart(PseudoId pseudoId)
{
- RefPtr<MeterPartElement> element = MeterPartElement::createForPart(static_cast<HTMLElement*>(node()), pseudoId);
+ RefPtr<MeterPartElement> element = MeterPartElement::createForPart(toHTMLElement(node()), pseudoId);
if (element->renderer())
addChild(element->renderer());
return element;
diff --git a/Source/WebCore/rendering/RenderTextControl.cpp b/Source/WebCore/rendering/RenderTextControl.cpp
index e8be096..72b20ec 100644
--- a/Source/WebCore/rendering/RenderTextControl.cpp
+++ b/Source/WebCore/rendering/RenderTextControl.cpp
@@ -146,7 +146,7 @@
// For non-search fields, there is no intermediate innerBlock as the shadow node.
// m_innerText will be the shadow node in that case.
RenderStyle* parentStyle = innerBlock ? innerBlock->renderer()->style() : style();
- m_innerText = TextControlInnerTextElement::create(document(), innerBlock ? 0 : static_cast<HTMLElement*>(node()));
+ m_innerText = TextControlInnerTextElement::create(document(), innerBlock ? 0 : toHTMLElement(node()));
m_innerText->attachInnerElement(innerBlock ? innerBlock : node(), createInnerTextStyle(parentStyle), renderArena());
}
}
diff --git a/Source/WebCore/rendering/RenderTextControlSingleLine.cpp b/Source/WebCore/rendering/RenderTextControlSingleLine.cpp
index b23cbec..d598ca6 100644
--- a/Source/WebCore/rendering/RenderTextControlSingleLine.cpp
+++ b/Source/WebCore/rendering/RenderTextControlSingleLine.cpp
@@ -611,17 +611,17 @@
#if ENABLE(INPUT_SPEECH)
if (inputElement()->isSpeechEnabled() && !m_speechButton) {
// Create the speech button element.
- m_speechButton = InputFieldSpeechButtonElement::create(static_cast<HTMLElement*>(node()));
+ m_speechButton = InputFieldSpeechButtonElement::create(toHTMLElement(node()));
m_speechButton->attachInnerElement(node(), createSpeechButtonStyle(), renderArena());
}
#endif
bool hasSpinButton = inputElement()->hasSpinButton();
if (hasSpinButton && !m_innerSpinButton) {
- m_innerSpinButton = SpinButtonElement::create(static_cast<HTMLElement*>(node()));
+ m_innerSpinButton = SpinButtonElement::create(toHTMLElement(node()));
m_innerSpinButton->attachInnerElement(node(), createInnerSpinButtonStyle(), renderArena());
}
if (hasSpinButton && !m_outerSpinButton) {
- m_outerSpinButton = SpinButtonElement::create(static_cast<HTMLElement*>(node()));
+ m_outerSpinButton = SpinButtonElement::create(toHTMLElement(node()));
m_outerSpinButton->attachInnerElement(node(), createOuterSpinButtonStyle(), renderArena());
}
return;
@@ -629,18 +629,18 @@
if (!m_innerBlock) {
// Create the inner block element
- m_innerBlock = TextControlInnerElement::create(static_cast<HTMLElement*>(node()));
+ m_innerBlock = TextControlInnerElement::create(toHTMLElement(node()));
m_innerBlock->attachInnerElement(node(), createInnerBlockStyle(style()), renderArena());
}
#if ENABLE(INPUT_SPEECH)
if (inputElement()->isSpeechEnabled() && !m_speechButton) {
// Create the speech button element.
- m_speechButton = InputFieldSpeechButtonElement::create(static_cast<HTMLElement*>(node()));
+ m_speechButton = InputFieldSpeechButtonElement::create(toHTMLElement(node()));
m_speechButton->attachInnerElement(node(), createSpeechButtonStyle(), renderArena());
}
#endif
if (inputElement()->hasSpinButton() && !m_outerSpinButton) {
- m_outerSpinButton = SpinButtonElement::create(static_cast<HTMLElement*>(node()));
+ m_outerSpinButton = SpinButtonElement::create(toHTMLElement(node()));
m_outerSpinButton->attachInnerElement(node(), createOuterSpinButtonStyle(), renderArena());
}