Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp

Issue 1904403002: Recurse the inner elements only if behavior is DescendToInnerBlocks Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make menuitem non-void Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved.
3 * Copyright (C) 2011, 2014 Apple Inc. All rights reserved. 3 * Copyright (C) 2011, 2014 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 if (!m_framesetOk) 641 if (!m_framesetOk)
642 return; 642 return;
643 m_tree.openElements()->bodyElement()->remove(ASSERT_NO_EXCEPTION); 643 m_tree.openElements()->bodyElement()->remove(ASSERT_NO_EXCEPTION);
644 m_tree.openElements()->popUntil(m_tree.openElements()->bodyElement()); 644 m_tree.openElements()->popUntil(m_tree.openElements()->bodyElement());
645 m_tree.openElements()->popHTMLBodyElement(); 645 m_tree.openElements()->popHTMLBodyElement();
646 ASSERT(m_tree.openElements()->top() == m_tree.openElements()->htmlElemen t()); 646 ASSERT(m_tree.openElements()->top() == m_tree.openElements()->htmlElemen t());
647 m_tree.insertHTMLElement(token); 647 m_tree.insertHTMLElement(token);
648 setInsertionMode(InFramesetMode); 648 setInsertionMode(InFramesetMode);
649 return; 649 return;
650 } 650 }
651 if (RuntimeEnabledFeatures::contextMenuEnabled() && (token->name() == menuit emTag || token->name() == menuTag || token->name() == hrTag)) {
652 if (m_tree.currentStackItem()->hasTagName(menuitemTag)) {
653 AtomicHTMLToken endOption(HTMLToken::EndTag, menuitemTag.localName() );
654 processEndTag(&endOption);
655 }
656 if (token->name() == hrTag) {
657 processFakePEndTagIfPInButtonScope();
658 m_tree.insertSelfClosingHTMLElementDestroyingToken(token);
659 m_framesetOk = false;
660 return;
661 }
662 if (token->name() == menuTag)
663 processFakePEndTagIfPInButtonScope();
664 m_tree.insertHTMLElement(token);
665 return;
666 }
651 if (token->name() == addressTag 667 if (token->name() == addressTag
652 || token->name() == articleTag 668 || token->name() == articleTag
653 || token->name() == asideTag 669 || token->name() == asideTag
654 || token->name() == blockquoteTag 670 || token->name() == blockquoteTag
655 || token->name() == centerTag 671 || token->name() == centerTag
656 || token->name() == detailsTag 672 || token->name() == detailsTag
657 || token->name() == dirTag 673 || token->name() == dirTag
658 || token->name() == divTag 674 || token->name() == divTag
659 || token->name() == dlTag 675 || token->name() == dlTag
660 || token->name() == fieldsetTag 676 || token->name() == fieldsetTag
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 Attribute* typeAttribute = token->getAttributeItem(typeAttr); 818 Attribute* typeAttribute = token->getAttributeItem(typeAttr);
803 bool disableFrameset = !typeAttribute || !equalIgnoringCase(typeAttribut e->value(), "hidden"); 819 bool disableFrameset = !typeAttribute || !equalIgnoringCase(typeAttribut e->value(), "hidden");
804 820
805 m_tree.reconstructTheActiveFormattingElements(); 821 m_tree.reconstructTheActiveFormattingElements();
806 m_tree.insertSelfClosingHTMLElementDestroyingToken(token); 822 m_tree.insertSelfClosingHTMLElementDestroyingToken(token);
807 823
808 if (disableFrameset) 824 if (disableFrameset)
809 m_framesetOk = false; 825 m_framesetOk = false;
810 return; 826 return;
811 } 827 }
812 if ((RuntimeEnabledFeatures::contextMenuEnabled() && token->name() == menuit emTag) 828 if (token->name() == paramTag
813 || token->name() == paramTag
814 || token->name() == sourceTag 829 || token->name() == sourceTag
815 || token->name() == trackTag) { 830 || token->name() == trackTag) {
816 m_tree.insertSelfClosingHTMLElementDestroyingToken(token); 831 m_tree.insertSelfClosingHTMLElementDestroyingToken(token);
817 return; 832 return;
818 } 833 }
819 if (token->name() == hrTag) { 834 if (token->name() == hrTag) {
820 processFakePEndTagIfPInButtonScope(); 835 processFakePEndTagIfPInButtonScope();
821 m_tree.insertSelfClosingHTMLElementDestroyingToken(token); 836 m_tree.insertSelfClosingHTMLElementDestroyingToken(token);
822 m_framesetOk = false; 837 m_framesetOk = false;
823 return; 838 return;
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after
1887 } 1902 }
1888 if (token->name() == brTag) { 1903 if (token->name() == brTag) {
1889 parseError(token); 1904 parseError(token);
1890 processFakeStartTag(brTag); 1905 processFakeStartTag(brTag);
1891 return; 1906 return;
1892 } 1907 }
1893 if (token->name() == templateTag) { 1908 if (token->name() == templateTag) {
1894 processTemplateEndTag(token); 1909 processTemplateEndTag(token);
1895 return; 1910 return;
1896 } 1911 }
1912 if (RuntimeEnabledFeatures::contextMenuEnabled() && token->name() == menuite mTag) {
1913 if (m_tree.currentStackItem()->hasTagName(menuitemTag)) {
1914 m_tree.openElements()->pop();
1915 return;
1916 }
1917 parseError(token);
1918 return;
1919 }
1897 processAnyOtherEndTagForInBody(token); 1920 processAnyOtherEndTagForInBody(token);
1898 } 1921 }
1899 1922
1900 bool HTMLTreeBuilder::processCaptionEndTagForInCaption() 1923 bool HTMLTreeBuilder::processCaptionEndTagForInCaption()
1901 { 1924 {
1902 if (!m_tree.openElements()->inTableScope(captionTag.localName())) { 1925 if (!m_tree.openElements()->inTableScope(captionTag.localName())) {
1903 ASSERT(isParsingFragment()); 1926 ASSERT(isParsingFragment());
1904 // FIXME: parse error 1927 // FIXME: parse error
1905 return false; 1928 return false;
1906 } 1929 }
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
2819 ASSERT(m_isAttached); 2842 ASSERT(m_isAttached);
2820 // Warning, this may detach the parser. Do not do anything else after this. 2843 // Warning, this may detach the parser. Do not do anything else after this.
2821 m_tree.finishedParsing(); 2844 m_tree.finishedParsing();
2822 } 2845 }
2823 2846
2824 void HTMLTreeBuilder::parseError(AtomicHTMLToken*) 2847 void HTMLTreeBuilder::parseError(AtomicHTMLToken*)
2825 { 2848 {
2826 } 2849 }
2827 2850
2828 } // namespace blink 2851 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLElement.cpp ('k') | third_party/WebKit/Source/core/layout/TextAutosizer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698