Title: [145467] branches/chromium/1410/Source/WebCore/html/parser
- Revision
- 145467
- Author
- [email protected]
- Date
- 2013-03-11 19:31:13 -0700 (Mon, 11 Mar 2013)
Log Message
Merge 144128
BUG=178003
Review URL: https://codereview.chromium.org/12518024
Modified Paths
Diff
Modified: branches/chromium/1410/Source/WebCore/html/parser/HTMLElementStack.cpp (145466 => 145467)
--- branches/chromium/1410/Source/WebCore/html/parser/HTMLElementStack.cpp 2013-03-12 02:24:17 UTC (rev 145466)
+++ branches/chromium/1410/Source/WebCore/html/parser/HTMLElementStack.cpp 2013-03-12 02:31:13 UTC (rev 145467)
@@ -459,6 +459,20 @@
return false;
}
+template <bool isMarker(HTMLStackItem*)>
+bool inScopeCommon(HTMLElementStack::ElementRecord* top, const QualifiedName& targetTag)
+{
+ for (HTMLElementStack::ElementRecord* pos = top; pos; pos = pos->next()) {
+ HTMLStackItem* item = pos->stackItem().get();
+ if (item->hasTagName(targetTag))
+ return true;
+ if (isMarker(item))
+ return false;
+ }
+ ASSERT_NOT_REACHED(); // <html> is always on the stack and is a scope marker.
+ return false;
+}
+
bool HTMLElementStack::hasNumberedHeaderElementInScope() const
{
for (ElementRecord* record = m_top.get(); record; record = record->next()) {
@@ -514,8 +528,7 @@
bool HTMLElementStack::inTableScope(const QualifiedName& tagName) const
{
- // FIXME: Is localName() right for non-html elements?
- return inTableScope(tagName.localName());
+ return inScopeCommon<isTableScopeMarker>(m_top.get(), tagName);
}
bool HTMLElementStack::inButtonScope(const AtomicString& targetTag) const
Modified: branches/chromium/1410/Source/WebCore/html/parser/HTMLTreeBuilder.cpp (145466 => 145467)
--- branches/chromium/1410/Source/WebCore/html/parser/HTMLTreeBuilder.cpp 2013-03-12 02:24:17 UTC (rev 145466)
+++ branches/chromium/1410/Source/WebCore/html/parser/HTMLTreeBuilder.cpp 2013-03-12 02:31:13 UTC (rev 145467)
@@ -1233,7 +1233,7 @@
}
if (isCaptionColOrColgroupTag(token->name()) || isTableBodyContextTag(token->name())) {
// FIXME: This is slow.
- if (!m_tree.openElements()->inTableScope(tbodyTag.localName()) && !m_tree.openElements()->inTableScope(theadTag.localName()) && !m_tree.openElements()->inTableScope(tfootTag.localName())) {
+ if (!m_tree.openElements()->inTableScope(tbodyTag) && !m_tree.openElements()->inTableScope(theadTag) && !m_tree.openElements()->inTableScope(tfootTag)) {
ASSERT(isParsingFragmentOrTemplateContents());
parseError(token);
return;
@@ -1722,7 +1722,7 @@
}
if (token->name() == tableTag) {
// FIXME: This is slow.
- if (!m_tree.openElements()->inTableScope(tbodyTag.localName()) && !m_tree.openElements()->inTableScope(theadTag.localName()) && !m_tree.openElements()->inTableScope(tfootTag.localName())) {
+ if (!m_tree.openElements()->inTableScope(tbodyTag) && !m_tree.openElements()->inTableScope(theadTag) && !m_tree.openElements()->inTableScope(tfootTag)) {
ASSERT(isParsingFragmentOrTemplateContents());
parseError(token);
return;
@@ -1977,7 +1977,7 @@
bool HTMLTreeBuilder::processTrEndTagForInRow()
{
- if (!m_tree.openElements()->inTableScope(trTag.localName())) {
+ if (!m_tree.openElements()->inTableScope(trTag)) {
ASSERT(isParsingFragmentOrTemplateContents());
// FIXME: parse error
return false;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes