Title: [124537] trunk/Source/WebCore
- Revision
- 124537
- Author
- [email protected]
- Date
- 2012-08-02 17:16:33 -0700 (Thu, 02 Aug 2012)
Log Message
Move causesFosterParenting() to HTMLStackItem
https://bugs.webkit.org/show_bug.cgi?id=93048
Reviewed by Adam Barth.
Changed to share causesFosterParenting() between HTMLTreeBuilder and HTMLConstructionSite
by moving this function to HTMLStackItem.
No functional change, so no new tests.
* html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::shouldFosterParent):
* html/parser/HTMLStackItem.h:
(WebCore::HTMLStackItem::causesFosterParenting):
(HTMLStackItem):
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::callTheAdoptionAgency):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (124536 => 124537)
--- trunk/Source/WebCore/ChangeLog 2012-08-03 00:15:18 UTC (rev 124536)
+++ trunk/Source/WebCore/ChangeLog 2012-08-03 00:16:33 UTC (rev 124537)
@@ -1,5 +1,25 @@
2012-08-02 Kwang Yul Seo <[email protected]>
+ Move causesFosterParenting() to HTMLStackItem
+ https://bugs.webkit.org/show_bug.cgi?id=93048
+
+ Reviewed by Adam Barth.
+
+ Changed to share causesFosterParenting() between HTMLTreeBuilder and HTMLConstructionSite
+ by moving this function to HTMLStackItem.
+
+ No functional change, so no new tests.
+
+ * html/parser/HTMLConstructionSite.cpp:
+ (WebCore::HTMLConstructionSite::shouldFosterParent):
+ * html/parser/HTMLStackItem.h:
+ (WebCore::HTMLStackItem::causesFosterParenting):
+ (HTMLStackItem):
+ * html/parser/HTMLTreeBuilder.cpp:
+ (WebCore::HTMLTreeBuilder::callTheAdoptionAgency):
+
+2012-08-02 Kwang Yul Seo <[email protected]>
+
Read tag names and attributes from the saved tokens in HTMLTreeBuilder::callTheAdoptionAgency(AtomicHTMLToken*)
https://bugs.webkit.org/show_bug.cgi?id=93047
Modified: trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp (124536 => 124537)
--- trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp 2012-08-03 00:15:18 UTC (rev 124536)
+++ trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp 2012-08-03 00:16:33 UTC (rev 124537)
@@ -70,15 +70,6 @@
|| item->hasTagName(rtTag);
}
-static bool causesFosterParenting(const HTMLStackItem* item)
-{
- return item->hasTagName(tableTag)
- || item->hasTagName(tbodyTag)
- || item->hasTagName(tfootTag)
- || item->hasTagName(theadTag)
- || item->hasTagName(trTag);
-}
-
static inline bool isAllWhitespace(const String& string)
{
return string.isAllSpecialCharacters<isHTMLSpace>();
@@ -495,7 +486,7 @@
{
return m_redirectAttachToFosterParent
&& currentStackItem()->isElementNode()
- && causesFosterParenting(currentStackItem());
+ && currentStackItem()->causesFosterParenting();
}
void HTMLConstructionSite::fosterParent(PassRefPtr<Node> node)
Modified: trunk/Source/WebCore/html/parser/HTMLStackItem.h (124536 => 124537)
--- trunk/Source/WebCore/html/parser/HTMLStackItem.h 2012-08-03 00:15:18 UTC (rev 124536)
+++ trunk/Source/WebCore/html/parser/HTMLStackItem.h 2012-08-03 00:16:33 UTC (rev 124537)
@@ -70,6 +70,15 @@
bool hasLocalName(const AtomicString& name) const { return m_token->name() == name; }
bool hasTagName(const QualifiedName& name) const { return m_token->name() == name.localName() && m_namespaceURI == name.namespaceURI(); }
+ bool causesFosterParenting()
+ {
+ return hasTagName(HTMLNames::tableTag)
+ || hasTagName(HTMLNames::tbodyTag)
+ || hasTagName(HTMLNames::tfootTag)
+ || hasTagName(HTMLNames::theadTag)
+ || hasTagName(HTMLNames::trTag);
+ }
+
private:
HTMLStackItem(PassRefPtr<ContainerNode> node, ItemType type)
: m_node(node)
Modified: trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp (124536 => 124537)
--- trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp 2012-08-03 00:15:18 UTC (rev 124536)
+++ trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp 2012-08-03 00:16:33 UTC (rev 124537)
@@ -1585,14 +1585,9 @@
lastNode = node;
}
// 7
- const AtomicString& commonAncestorTag = commonAncestor->localName();
if (ContainerNode* parent = lastNode->element()->parentNode())
parent->parserRemoveChild(lastNode->element());
- // FIXME: If this moves to HTMLConstructionSite, this check should use
- // causesFosterParenting(tagName) instead.
- if (commonAncestorTag == tableTag
- || commonAncestorTag == trTag
- || isTableBodyContextTag(commonAncestorTag))
+ if (commonAncestor->causesFosterParenting())
m_tree.fosterParent(lastNode->element());
else {
commonAncestor->element()->parserAddChild(lastNode->element());
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes