Title: [152440] trunk/Source/WebCore
Revision
152440
Author
[email protected]
Date
2013-07-07 23:52:41 -0700 (Sun, 07 Jul 2013)

Log Message

Adopt is/toHTMLTableElement for code cleanup
https://bugs.webkit.org/show_bug.cgi?id=118393

Reviewed by Andreas Kling.

To enhance readability, this patch adopts is/toHTMLTableElement.
This also helps out to reduce duplicated use of static_cast.

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::determineAccessibilityRole):
* accessibility/AccessibilityTable.cpp:
(WebCore::AccessibilityTable::isDataTable):
(WebCore::AccessibilityTable::isTableExposableThroughAccessibility):
(WebCore::AccessibilityTable::title):
* accessibility/atk/WebKitAccessibleInterfaceTable.cpp:
(webkitAccessibleTableGetCaption):
* accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
(webkitAccessibleGetDescription):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::adjustRenderStyle):
* dom/Position.cpp:
(WebCore::endsOfNodeAreVisuallyDistinctPositions):
* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::handleGeneralDelete):
* editing/InsertLineBreakCommand.cpp:
(WebCore::InsertLineBreakCommand::doApply):
* editing/htmlediting.cpp:
(WebCore::isNonTableCellHTMLBlockElement):
* editing/markup.cpp:
(WebCore::ancestorToRetainStructureAndAppearanceForBlock):
* html/FTPDirectoryDocument.cpp:
(WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate):
(WebCore::FTPDirectoryDocumentParser::createBasicDocument):
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::rendererIsNeeded):
* html/HTMLTableElement.h:
(WebCore::isHTMLTableElement):
(WebCore::toHTMLTableElement):
* html/HTMLTablePartElement.cpp:
(WebCore::HTMLTablePartElement::findParentTable):
* html/HTMLTableRowElement.cpp:
(WebCore::HTMLTableRowElement::rowIndex):
* html/HTMLTableRowsCollection.cpp:
(WebCore::HTMLTableRowsCollection::HTMLTableRowsCollection):
(WebCore::HTMLTableRowsCollection::virtualItemAfter):
* html/parser/HTMLElementStack.cpp:
(WebCore::HTMLNames::isScopeMarker):
(WebCore::HTMLNames::isTableScopeMarker):
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::resetInsertionModeAppropriately):
(WebCore::HTMLTreeBuilder::processCharacterBuffer):
* platform/mac/HTMLConverter.mm:
(-[WebHTMLConverter _computedStringForNode:property:]):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::offsetParent):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::convertStyleLogicalWidthToComputedWidth):
(WebCore::RenderTable::convertStyleLogicalHeightToComputedHeight):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (152439 => 152440)


--- trunk/Source/WebCore/ChangeLog	2013-07-08 04:40:52 UTC (rev 152439)
+++ trunk/Source/WebCore/ChangeLog	2013-07-08 06:52:41 UTC (rev 152440)
@@ -1,3 +1,64 @@
+2013-07-07  Kangil Han  <[email protected]>
+
+        Adopt is/toHTMLTableElement for code cleanup
+        https://bugs.webkit.org/show_bug.cgi?id=118393
+
+        Reviewed by Andreas Kling.
+
+        To enhance readability, this patch adopts is/toHTMLTableElement.
+        This also helps out to reduce duplicated use of static_cast.
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
+        * accessibility/AccessibilityTable.cpp:
+        (WebCore::AccessibilityTable::isDataTable):
+        (WebCore::AccessibilityTable::isTableExposableThroughAccessibility):
+        (WebCore::AccessibilityTable::title):
+        * accessibility/atk/WebKitAccessibleInterfaceTable.cpp:
+        (webkitAccessibleTableGetCaption):
+        * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
+        (webkitAccessibleGetDescription):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::adjustRenderStyle):
+        * dom/Position.cpp:
+        (WebCore::endsOfNodeAreVisuallyDistinctPositions):
+        * editing/DeleteSelectionCommand.cpp:
+        (WebCore::DeleteSelectionCommand::handleGeneralDelete):
+        * editing/InsertLineBreakCommand.cpp:
+        (WebCore::InsertLineBreakCommand::doApply):
+        * editing/htmlediting.cpp:
+        (WebCore::isNonTableCellHTMLBlockElement):
+        * editing/markup.cpp:
+        (WebCore::ancestorToRetainStructureAndAppearanceForBlock):
+        * html/FTPDirectoryDocument.cpp:
+        (WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate):
+        (WebCore::FTPDirectoryDocumentParser::createBasicDocument):
+        * html/HTMLFormElement.cpp:
+        (WebCore::HTMLFormElement::rendererIsNeeded):
+        * html/HTMLTableElement.h:
+        (WebCore::isHTMLTableElement):
+        (WebCore::toHTMLTableElement):
+        * html/HTMLTablePartElement.cpp:
+        (WebCore::HTMLTablePartElement::findParentTable):
+        * html/HTMLTableRowElement.cpp:
+        (WebCore::HTMLTableRowElement::rowIndex):
+        * html/HTMLTableRowsCollection.cpp:
+        (WebCore::HTMLTableRowsCollection::HTMLTableRowsCollection):
+        (WebCore::HTMLTableRowsCollection::virtualItemAfter):
+        * html/parser/HTMLElementStack.cpp:
+        (WebCore::HTMLNames::isScopeMarker):
+        (WebCore::HTMLNames::isTableScopeMarker):
+        * html/parser/HTMLTreeBuilder.cpp:
+        (WebCore::HTMLTreeBuilder::resetInsertionModeAppropriately):
+        (WebCore::HTMLTreeBuilder::processCharacterBuffer):
+        * platform/mac/HTMLConverter.mm:
+        (-[WebHTMLConverter _computedStringForNode:property:]):
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::offsetParent):
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::convertStyleLogicalWidthToComputedWidth):
+        (WebCore::RenderTable::convertStyleLogicalHeightToComputedHeight):
+
 2013-07-06  Rob Buis  <[email protected]>
 
         createElement("image") creates an HTMLImageElement, although this hack should exist in parser only

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (152439 => 152440)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2013-07-08 04:40:52 UTC (rev 152439)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2013-07-08 06:52:41 UTC (rev 152440)
@@ -54,6 +54,7 @@
 #include "HTMLOptionElement.h"
 #include "HTMLOptionsCollection.h"
 #include "HTMLSelectElement.h"
+#include "HTMLTableElement.h"
 #include "HTMLTextAreaElement.h"
 #include "HitTestRequest.h"
 #include "HitTestResult.h"
@@ -2535,7 +2536,7 @@
     if (node && node->hasTagName(trTag))
         return RowRole;
 
-    if (node && node->hasTagName(tableTag))
+    if (node && isHTMLTableElement(node))
         return TableRole;
 #endif
 

Modified: trunk/Source/WebCore/accessibility/AccessibilityTable.cpp (152439 => 152440)


--- trunk/Source/WebCore/accessibility/AccessibilityTable.cpp	2013-07-08 04:40:52 UTC (rev 152439)
+++ trunk/Source/WebCore/accessibility/AccessibilityTable.cpp	2013-07-08 06:52:41 UTC (rev 152440)
@@ -111,11 +111,11 @@
     
     RenderTable* table = toRenderTable(m_renderer);
     Node* tableNode = table->node();
-    if (!tableNode || !tableNode->hasTagName(tableTag))
+    if (!tableNode || !isHTMLTableElement(tableNode))
         return false;
 
     // if there is a caption element, summary, THEAD, or TFOOT section, it's most certainly a data table
-    HTMLTableElement* tableElement = static_cast<HTMLTableElement*>(tableNode);
+    HTMLTableElement* tableElement = toHTMLTableElement(tableNode);
     if (!tableElement->summary().isEmpty() || tableElement->tHead() || tableElement->tFoot() || tableElement->caption())
         return true;
     
@@ -310,7 +310,7 @@
     // Gtk+ ATs expect all tables to be exposed as tables.
 #if PLATFORM(GTK)
     Node* tableNode = toRenderTable(m_renderer)->node();
-    return tableNode && tableNode->hasTagName(tableTag);
+    return tableNode && isHTMLTableElement(tableNode);
 #endif
 
     return isDataTable();
@@ -562,8 +562,8 @@
     
     // see if there is a caption
     Node* tableElement = m_renderer->node();
-    if (tableElement && tableElement->hasTagName(tableTag)) {
-        HTMLTableCaptionElement* caption = static_cast<HTMLTableElement*>(tableElement)->caption();
+    if (tableElement && isHTMLTableElement(tableElement)) {
+        HTMLTableCaptionElement* caption = toHTMLTableElement(tableElement)->caption();
         if (caption)
             title = caption->innerText();
     }

Modified: trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp (152439 => 152440)


--- trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp	2013-07-08 04:40:52 UTC (rev 152439)
+++ trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp	2013-07-08 06:52:41 UTC (rev 152440)
@@ -212,8 +212,8 @@
     AccessibilityObject* accTable = core(table);
     if (accTable->isAccessibilityRenderObject()) {
         Node* node = accTable->node();
-        if (node && node->hasTagName(HTMLNames::tableTag)) {
-            HTMLTableCaptionElement* caption = static_cast<HTMLTableElement*>(node)->caption();
+        if (node && isHTMLTableElement(node)) {
+            HTMLTableCaptionElement* caption = toHTMLTableElement(node)->caption();
             if (caption)
                 return AccessibilityObject::firstAccessibleObjectFromNode(caption->renderer()->node())->wrapper();
         }

Modified: trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp (152439 => 152440)


--- trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp	2013-07-08 04:40:52 UTC (rev 152439)
+++ trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp	2013-07-08 06:52:41 UTC (rev 152440)
@@ -185,7 +185,7 @@
 
     // atk_table_get_summary returns an AtkObject. We have no summary object, so expose summary here.
     if (coreObject->roleValue() == TableRole) {
-        String summary = static_cast<HTMLTableElement*>(node)->summary();
+        String summary = toHTMLTableElement(node)->summary();
         if (!summary.isEmpty())
             return cacheAndReturnAtkProperty(object, AtkCachedAccessibleDescription, summary);
     }

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (152439 => 152440)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2013-07-08 04:40:52 UTC (rev 152439)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2013-07-08 06:52:41 UTC (rev 152440)
@@ -72,6 +72,7 @@
 #include "HTMLOptionElement.h"
 #include "HTMLProgressElement.h"
 #include "HTMLStyleElement.h"
+#include "HTMLTableElement.h"
 #include "HTMLTextAreaElement.h"
 #include "InsertionPoint.h"
 #include "InspectorInstrumentation.h"
@@ -1375,7 +1376,7 @@
             if (e->hasTagName(tdTag)) {
                 style->setDisplay(TABLE_CELL);
                 style->setFloating(NoFloat);
-            } else if (e->hasTagName(tableTag))
+            } else if (isHTMLTableElement(e))
                 style->setDisplay(style->isDisplayInlineType() ? INLINE_TABLE : TABLE);
         }
 
@@ -1392,7 +1393,7 @@
         }
 
         // Tables never support the -webkit-* values for text-align and will reset back to the default.
-        if (e && e->hasTagName(tableTag) && (style->textAlign() == WEBKIT_LEFT || style->textAlign() == WEBKIT_CENTER || style->textAlign() == WEBKIT_RIGHT))
+        if (e && isHTMLTableElement(e) && (style->textAlign() == WEBKIT_LEFT || style->textAlign() == WEBKIT_CENTER || style->textAlign() == WEBKIT_RIGHT))
             style->setTextAlign(TASTART);
 
         // Frames and framesets never honor position:relative or position:absolute. This is necessary to

Modified: trunk/Source/WebCore/dom/Position.cpp (152439 => 152440)


--- trunk/Source/WebCore/dom/Position.cpp	2013-07-08 04:40:52 UTC (rev 152439)
+++ trunk/Source/WebCore/dom/Position.cpp	2013-07-08 06:52:41 UTC (rev 152440)
@@ -28,6 +28,7 @@
 
 #include "CSSComputedStyleDeclaration.h"
 #include "HTMLNames.h"
+#include "HTMLTableElement.h"
 #include "InlineIterator.h"
 #include "InlineTextBox.h"
 #include "Logging.h"
@@ -561,7 +562,7 @@
         return true;
         
     // Don't include inline tables.
-    if (node->hasTagName(tableTag))
+    if (isHTMLTableElement(node))
         return false;
     
     // There is a VisiblePosition inside an empty inline-block container.

Modified: trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp (152439 => 152440)


--- trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp	2013-07-08 04:40:52 UTC (rev 152439)
+++ trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp	2013-07-08 06:52:41 UTC (rev 152440)
@@ -36,6 +36,7 @@
 #include "htmlediting.h"
 #include "HTMLInputElement.h"
 #include "HTMLNames.h"
+#include "HTMLTableElement.h"
 #include "NodeTraversal.h"
 #include "RenderTableCell.h"
 #include "Text.h"
@@ -445,7 +446,7 @@
     makeStylingElementsDirectChildrenOfEditableRootToPreventStyleLoss();
 
     // Never remove the start block unless it's a table, in which case we won't merge content in.
-    if (startNode == m_startBlock && startOffset == 0 && canHaveChildrenForEditing(startNode) && !startNode->hasTagName(tableTag)) {
+    if (startNode == m_startBlock && startOffset == 0 && canHaveChildrenForEditing(startNode) && !isHTMLTableElement(startNode)) {
         startOffset = 0;
         startNode = NodeTraversal::next(startNode);
         if (!startNode)

Modified: trunk/Source/WebCore/editing/InsertLineBreakCommand.cpp (152439 => 152440)


--- trunk/Source/WebCore/editing/InsertLineBreakCommand.cpp	2013-07-08 04:40:52 UTC (rev 152439)
+++ trunk/Source/WebCore/editing/InsertLineBreakCommand.cpp	2013-07-08 06:52:41 UTC (rev 152440)
@@ -32,6 +32,7 @@
 #include "FrameSelection.h"
 #include "HTMLElement.h"
 #include "HTMLNames.h"
+#include "HTMLTableElement.h"
 #include "Range.h"
 #include "RenderObject.h"
 #include "Text.h"
@@ -115,7 +116,7 @@
     // FIXME: Need to merge text nodes when inserting just after or before text.
     
     if (isEndOfParagraph(caret) && !lineBreakExistsAtVisiblePosition(caret)) {
-        bool needExtraLineBreak = !pos.deprecatedNode()->hasTagName(hrTag) && !pos.deprecatedNode()->hasTagName(tableTag);
+        bool needExtraLineBreak = !pos.deprecatedNode()->hasTagName(hrTag) && !isHTMLTableElement(pos.deprecatedNode());
         
         insertNodeAt(nodeToInsert.get(), pos);
         

Modified: trunk/Source/WebCore/editing/htmlediting.cpp (152439 => 152440)


--- trunk/Source/WebCore/editing/htmlediting.cpp	2013-07-08 04:40:52 UTC (rev 152439)
+++ trunk/Source/WebCore/editing/htmlediting.cpp	2013-07-08 06:52:41 UTC (rev 152440)
@@ -40,6 +40,7 @@
 #include "HTMLOListElement.h"
 #include "HTMLObjectElement.h"
 #include "HTMLParagraphElement.h"
+#include "HTMLTableElement.h"
 #include "HTMLTextFormControlElement.h"
 #include "HTMLUListElement.h"
 #include "NodeTraversal.h"
@@ -1219,19 +1220,23 @@
 
 bool isNonTableCellHTMLBlockElement(const Node* node)
 {
-    return node->hasTagName(listingTag)
-        || node->hasTagName(olTag)
-        || node->hasTagName(preTag)
-        || node->hasTagName(tableTag)
-        || node->hasTagName(ulTag)
-        || node->hasTagName(xmpTag)
-        || node->hasTagName(h1Tag)
-        || node->hasTagName(h2Tag)
-        || node->hasTagName(h3Tag)
-        || node->hasTagName(h4Tag)
-        || node->hasTagName(h5Tag);
+    if (!node->isElementNode())
+        return false;
+
+    const Element* element = toElement(node);
+    return element->hasTagName(listingTag)
+        || element->hasTagName(olTag)
+        || element->hasTagName(preTag)
+        || isHTMLTableElement(element)
+        || element->hasTagName(ulTag)
+        || element->hasTagName(xmpTag)
+        || element->hasTagName(h1Tag)
+        || element->hasTagName(h2Tag)
+        || element->hasTagName(h3Tag)
+        || element->hasTagName(h4Tag)
+        || element->hasTagName(h5Tag);
 }
-    
+
 Position adjustedSelectionStartForStyleComputation(const VisibleSelection& selection)
 {
     // This function is used by range style computations to avoid bugs like:

Modified: trunk/Source/WebCore/editing/markup.cpp (152439 => 152440)


--- trunk/Source/WebCore/editing/markup.cpp	2013-07-08 04:40:52 UTC (rev 152439)
+++ trunk/Source/WebCore/editing/markup.cpp	2013-07-08 06:52:41 UTC (rev 152440)
@@ -47,6 +47,7 @@
 #include "HTMLBodyElement.h"
 #include "HTMLElement.h"
 #include "HTMLNames.h"
+#include "HTMLTableElement.h"
 #include "HTMLTextAreaElement.h"
 #include "HTMLTextFormControlElement.h"
 #include "KURL.h"
@@ -433,7 +434,7 @@
 
     if (commonAncestorBlock->hasTagName(tbodyTag) || commonAncestorBlock->hasTagName(trTag)) {
         ContainerNode* table = commonAncestorBlock->parentNode();
-        while (table && !table->hasTagName(tableTag))
+        while (table && !isHTMLTableElement(table))
             table = table->parentNode();
 
         return table;

Modified: trunk/Source/WebCore/html/FTPDirectoryDocument.cpp (152439 => 152440)


--- trunk/Source/WebCore/html/FTPDirectoryDocument.cpp	2013-07-08 04:40:52 UTC (rev 152439)
+++ trunk/Source/WebCore/html/FTPDirectoryDocument.cpp	2013-07-08 06:52:41 UTC (rev 152440)
@@ -304,10 +304,10 @@
     RefPtr<Element> tableElement = document()->getElementById("ftpDirectoryTable");
     if (!tableElement)
         LOG_ERROR("Unable to find element by id \"ftpDirectoryTable\" in the template document.");
-    else if (!tableElement->hasTagName(tableTag))
+    else if (!isHTMLTableElement(tableElement.get()))
         LOG_ERROR("Element of id \"ftpDirectoryTable\" is not a table element");
     else 
-        m_tableElement = static_cast<HTMLTableElement*>(tableElement.get());
+        m_tableElement = toHTMLTableElement(tableElement.get());
 
     // Bail if we found the table element
     if (m_tableElement)
@@ -315,7 +315,7 @@
 
     // Otherwise create one manually
     tableElement = document()->createElement(tableTag, false);
-    m_tableElement = static_cast<HTMLTableElement*>(tableElement.get());
+    m_tableElement = toHTMLTableElement(tableElement.get());
     m_tableElement->setAttribute("id", "ftpDirectoryTable", IGNORE_EXCEPTION);
 
     // If we didn't find the table element, lets try to append our own to the body
@@ -340,7 +340,7 @@
     document()->appendChild(bodyElement, IGNORE_EXCEPTION);
 
     RefPtr<Element> tableElement = document()->createElement(tableTag, false);
-    m_tableElement = static_cast<HTMLTableElement*>(tableElement.get());
+    m_tableElement = toHTMLTableElement(tableElement.get());
     m_tableElement->setAttribute("id", "ftpDirectoryTable", IGNORE_EXCEPTION);
 
     bodyElement->appendChild(m_tableElement, IGNORE_EXCEPTION);

Modified: trunk/Source/WebCore/html/HTMLFormElement.cpp (152439 => 152440)


--- trunk/Source/WebCore/html/HTMLFormElement.cpp	2013-07-08 04:40:52 UTC (rev 152439)
+++ trunk/Source/WebCore/html/HTMLFormElement.cpp	2013-07-08 06:52:41 UTC (rev 152440)
@@ -39,6 +39,7 @@
 #include "HTMLImageElement.h"
 #include "HTMLInputElement.h"
 #include "HTMLNames.h"
+#include "HTMLTableElement.h"
 #include "NodeRenderingContext.h"
 #include "NodeTraversal.h"
 #include "Page.h"
@@ -102,7 +103,7 @@
     ContainerNode* node = parentNode();
     RenderObject* parentRenderer = node->renderer();
     // FIXME: Shouldn't we also check for table caption (see |formIsTablePart| below).
-    bool parentIsTableElementPart = (parentRenderer->isTable() && node->hasTagName(tableTag))
+    bool parentIsTableElementPart = (parentRenderer->isTable() && isHTMLTableElement(node))
         || (parentRenderer->isTableRow() && node->hasTagName(trTag))
         || (parentRenderer->isTableSection() && node->hasTagName(tbodyTag))
         || (parentRenderer->isRenderTableCol() && node->hasTagName(colTag))

Modified: trunk/Source/WebCore/html/HTMLTableElement.h (152439 => 152440)


--- trunk/Source/WebCore/html/HTMLTableElement.h	2013-07-08 04:40:52 UTC (rev 152439)
+++ trunk/Source/WebCore/html/HTMLTableElement.h	2013-07-08 06:52:41 UTC (rev 152440)
@@ -100,6 +100,22 @@
     RefPtr<StylePropertySet> m_sharedCellStyle;
 };
 
+inline bool isHTMLTableElement(const Node* node)
+{
+    return node->hasTagName(HTMLNames::tableTag);
+}
+
+inline bool isHTMLTableElement(const Element* element)
+{
+    return element->hasTagName(HTMLNames::tableTag);
+}
+
+inline HTMLTableElement* toHTMLTableElement(Node* node)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLTableElement(node));
+    return static_cast<HTMLTableElement*>(node);
+}
+
 } //namespace
 
 #endif

Modified: trunk/Source/WebCore/html/HTMLTablePartElement.cpp (152439 => 152440)


--- trunk/Source/WebCore/html/HTMLTablePartElement.cpp	2013-07-08 04:40:52 UTC (rev 152439)
+++ trunk/Source/WebCore/html/HTMLTablePartElement.cpp	2013-07-08 06:52:41 UTC (rev 152440)
@@ -86,9 +86,9 @@
 HTMLTableElement* HTMLTablePartElement::findParentTable() const
 {
     ContainerNode* parent = parentNode();
-    while (parent && !parent->hasTagName(tableTag))
+    while (parent && !isHTMLTableElement(parent))
         parent = parent->parentNode();
-    return static_cast<HTMLTableElement*>(parent);
+    return toHTMLTableElement(parent);
 }
 
 }

Modified: trunk/Source/WebCore/html/HTMLTableRowElement.cpp (152439 => 152440)


--- trunk/Source/WebCore/html/HTMLTableRowElement.cpp	2013-07-08 04:40:52 UTC (rev 152439)
+++ trunk/Source/WebCore/html/HTMLTableRowElement.cpp	2013-07-08 06:52:41 UTC (rev 152440)
@@ -60,7 +60,7 @@
     if (!table)
         return -1;
     table = table->parentNode();
-    if (!table || !table->hasTagName(tableTag))
+    if (!table || !isHTMLTableElement(table))
         return -1;
 
     // To match Firefox, the row indices work like this:
@@ -70,7 +70,7 @@
 
     int rIndex = 0;
 
-    if (HTMLTableSectionElement* head = static_cast<HTMLTableElement*>(table)->tHead()) {
+    if (HTMLTableSectionElement* head = toHTMLTableElement(table)->tHead()) {
         for (Node *row = head->firstChild(); row; row = row->nextSibling()) {
             if (row == this)
                 return rIndex;
@@ -91,7 +91,7 @@
         }
     }
 
-    if (HTMLTableSectionElement* foot = static_cast<HTMLTableElement*>(table)->tFoot()) {
+    if (HTMLTableSectionElement* foot = toHTMLTableElement(table)->tFoot()) {
         for (Node *row = foot->firstChild(); row; row = row->nextSibling()) {
             if (row == this)
                 return rIndex;

Modified: trunk/Source/WebCore/html/HTMLTableRowsCollection.cpp (152439 => 152440)


--- trunk/Source/WebCore/html/HTMLTableRowsCollection.cpp	2013-07-08 04:40:52 UTC (rev 152439)
+++ trunk/Source/WebCore/html/HTMLTableRowsCollection.cpp	2013-07-08 06:52:41 UTC (rev 152440)
@@ -154,7 +154,7 @@
 HTMLTableRowsCollection::HTMLTableRowsCollection(Node* table)
     : HTMLCollection(table, TableRows, OverridesItemAfter)
 {
-    ASSERT(table->hasTagName(tableTag));
+    ASSERT(isHTMLTableElement(table));
 }
 
 PassRefPtr<HTMLTableRowsCollection> HTMLTableRowsCollection::create(Node* table, CollectionType)
@@ -166,7 +166,7 @@
 {
     ASSERT_UNUSED(offsetInArray, !offsetInArray);
     ASSERT(!previous || (previous->isHTMLElement() && toHTMLElement(previous)->hasLocalName(trTag)));
-    return rowAfter(static_cast<HTMLTableElement*>(ownerNode()), static_cast<HTMLTableRowElement*>(previous));
+    return rowAfter(toHTMLTableElement(ownerNode()), static_cast<HTMLTableRowElement*>(previous));
 }
 
 }

Modified: trunk/Source/WebCore/html/parser/HTMLElementStack.cpp (152439 => 152440)


--- trunk/Source/WebCore/html/parser/HTMLElementStack.cpp	2013-07-08 04:40:52 UTC (rev 152439)
+++ trunk/Source/WebCore/html/parser/HTMLElementStack.cpp	2013-07-08 06:52:41 UTC (rev 152440)
@@ -32,6 +32,7 @@
 #include "HTMLNames.h"
 #include "HTMLOptGroupElement.h"
 #include "HTMLOptionElement.h"
+#include "HTMLTableElement.h"
 #include "MathMLNames.h"
 #include "SVGNames.h"
 #include <wtf/PassOwnPtr.h>
@@ -55,7 +56,7 @@
         || item->hasTagName(captionTag)
         || item->hasTagName(marqueeTag)
         || item->hasTagName(objectTag)
-        || item->hasTagName(tableTag)
+        || isHTMLTableElement(item->node())
         || item->hasTagName(tdTag)
         || item->hasTagName(thTag)
         || item->hasTagName(MathMLNames::miTag)
@@ -82,7 +83,7 @@
 
 inline bool isTableScopeMarker(HTMLStackItem* item)
 {
-    return item->hasTagName(tableTag)
+    return isHTMLTableElement(item->node())
 #if ENABLE(TEMPLATE_ELEMENT)
         || item->hasTagName(templateTag)
 #endif

Modified: trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp (152439 => 152440)


--- trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp	2013-07-08 04:40:52 UTC (rev 152439)
+++ trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp	2013-07-08 06:52:41 UTC (rev 152440)
@@ -37,6 +37,7 @@
 #include "HTMLOptionElement.h"
 #include "HTMLParserIdioms.h"
 #include "HTMLStackItem.h"
+#include "HTMLTableElement.h"
 #include "HTMLTemplateElement.h"
 #include "HTMLToken.h"
 #include "HTMLTokenizer.h"
@@ -1678,7 +1679,7 @@
         if (item->hasTagName(colgroupTag)) {
             return setInsertionMode(InColumnGroupMode);
         }
-        if (item->hasTagName(tableTag))
+        if (isHTMLTableElement(item->node()))
             return setInsertionMode(InTableMode);
         if (item->hasTagName(headTag)) {
 #if ENABLE(TEMPLATE_ELEMENT)
@@ -2419,7 +2420,7 @@
         ASSERT(insertionMode() == InTableMode || insertionMode() == InTableBodyMode || insertionMode() == InRowMode);
         ASSERT(m_pendingTableCharacters.isEmpty());
         if (m_tree.currentStackItem()->isElementNode()
-            && (m_tree.currentStackItem()->hasTagName(HTMLNames::tableTag)
+            && (isHTMLTableElement(m_tree.currentStackItem()->node())
                 || m_tree.currentStackItem()->hasTagName(HTMLNames::tbodyTag)
                 || m_tree.currentStackItem()->hasTagName(HTMLNames::tfootTag)
                 || m_tree.currentStackItem()->hasTagName(HTMLNames::theadTag)

Modified: trunk/Source/WebCore/platform/mac/HTMLConverter.mm (152439 => 152440)


--- trunk/Source/WebCore/platform/mac/HTMLConverter.mm	2013-07-08 04:40:52 UTC (rev 152439)
+++ trunk/Source/WebCore/platform/mac/HTMLConverter.mm	2013-07-08 06:52:41 UTC (rev 152440)
@@ -43,6 +43,7 @@
 #import "HTMLImageElement.h"
 #import "HTMLNames.h"
 #import "HTMLParserIdioms.h"
+#import "HTMLTableElement.h"
 #import "LoaderNSURLExtras.h"
 #import "RenderImage.h"
 #import "TextIterator.h"
@@ -261,7 +262,7 @@
                     result = @"block";
                 else if (coreElement->hasTagName(liTag))
                     result = @"list-item";
-                else if (coreElement->hasTagName(tableTag))
+                else if (isHTMLTableElement(coreElement))
                     result = @"table";
                 else if (coreElement->hasTagName(trTag))
                     result = @"table-row";

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (152439 => 152440)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2013-07-08 04:40:52 UTC (rev 152439)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2013-07-08 06:52:41 UTC (rev 152440)
@@ -42,6 +42,7 @@
 #include "HTMLElement.h"
 #include "HTMLImageElement.h"
 #include "HTMLNames.h"
+#include "HTMLTableElement.h"
 #include "HitTestResult.h"
 #include "LogicalSelectionOffsetCaches.h"
 #include "Page.h"
@@ -3095,7 +3096,7 @@
     RenderObject* curr = parent();
     while (curr && (!curr->node() || (!curr->isPositioned() && !curr->isBody())) && !curr->isRenderNamedFlowThread()) {
         Node* element = curr->node();
-        if (!skipTables && element && (element->hasTagName(tableTag) || element->hasTagName(tdTag) || element->hasTagName(thTag)))
+        if (!skipTables && element && (isHTMLTableElement(element) || element->hasTagName(tdTag) || element->hasTagName(thTag)))
             break;
  
         float newZoom = curr->style()->effectiveZoom();

Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (152439 => 152440)


--- trunk/Source/WebCore/rendering/RenderTable.cpp	2013-07-08 04:40:52 UTC (rev 152439)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp	2013-07-08 06:52:41 UTC (rev 152440)
@@ -33,6 +33,7 @@
 #include "FrameView.h"
 #include "HitTestResult.h"
 #include "HTMLNames.h"
+#include "HTMLTableElement.h"
 #include "LayoutRepainter.h"
 #include "RenderLayer.h"
 #include "RenderTableCaption.h"
@@ -319,7 +320,7 @@
 
     // HTML tables' width styles already include borders and paddings, but CSS tables' width styles do not.
     LayoutUnit borders = 0;
-    bool isCSSTable = !node() || !node()->hasTagName(tableTag);
+    bool isCSSTable = !node() || !isHTMLTableElement(node());
     if (isCSSTable && styleLogicalWidth.isSpecified() && styleLogicalWidth.isPositive() && style()->boxSizing() == CONTENT_BOX)
         borders = borderStart() + borderEnd() + (collapseBorders() ? LayoutUnit() : paddingStart() + paddingEnd());
 
@@ -333,7 +334,7 @@
         // HTML tables size as though CSS height includes border/padding, CSS tables do not.
         LayoutUnit borders = LayoutUnit();
         // FIXME: We cannot apply box-sizing: content-box on <table> which other browsers allow.
-        if ((node() && node()->hasTagName(tableTag)) || style()->boxSizing() == BORDER_BOX) {
+        if ((node() && isHTMLTableElement(node())) || style()->boxSizing() == BORDER_BOX) {
             LayoutUnit borderAndPaddingBefore = borderBefore() + (collapseBorders() ? LayoutUnit() : paddingBefore());
             LayoutUnit borderAndPaddingAfter = borderAfter() + (collapseBorders() ? LayoutUnit() : paddingAfter());
             borders = borderAndPaddingBefore + borderAndPaddingAfter;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to