| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. |
| 3 * Copyright (C) 2011 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011 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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 } | 466 } |
| 467 | 467 |
| 468 void HTMLTreeBuilder::processFakePEndTagIfPInButtonScope() | 468 void HTMLTreeBuilder::processFakePEndTagIfPInButtonScope() |
| 469 { | 469 { |
| 470 if (!m_tree.openElements()->inButtonScope(pTag.localName())) | 470 if (!m_tree.openElements()->inButtonScope(pTag.localName())) |
| 471 return; | 471 return; |
| 472 AtomicHTMLToken endP(HTMLToken::EndTag, pTag.localName()); | 472 AtomicHTMLToken endP(HTMLToken::EndTag, pTag.localName()); |
| 473 processEndTag(&endP); | 473 processEndTag(&endP); |
| 474 } | 474 } |
| 475 | 475 |
| 476 Vector<Attribute> HTMLTreeBuilder::attributesForIsindexInput(AtomicHTMLToken* to
ken) | |
| 477 { | |
| 478 Vector<Attribute> attributes = token->attributes(); | |
| 479 for (int i = attributes.size() - 1; i >= 0; --i) { | |
| 480 const QualifiedName& name = attributes.at(i).name(); | |
| 481 if (name.matches(nameAttr) || name.matches(actionAttr) || name.matches(p
romptAttr)) | |
| 482 attributes.remove(i); | |
| 483 } | |
| 484 | |
| 485 attributes.append(Attribute(nameAttr, isindexTag.localName())); | |
| 486 return attributes; | |
| 487 } | |
| 488 | |
| 489 void HTMLTreeBuilder::processIsindexStartTagForInBody(AtomicHTMLToken* token) | |
| 490 { | |
| 491 ASSERT(token->type() == HTMLToken::StartTag); | |
| 492 ASSERT(token->name() == isindexTag); | |
| 493 | |
| 494 if (m_parser->useCounter()) | |
| 495 m_parser->useCounter()->count(UseCounter::IsIndexElement); | |
| 496 | |
| 497 parseError(token); | |
| 498 if (m_tree.form()) | |
| 499 return; | |
| 500 notImplemented(); // Acknowledge self-closing flag | |
| 501 processFakeStartTag(formTag); | |
| 502 Attribute* actionAttribute = token->getAttributeItem(actionAttr); | |
| 503 if (actionAttribute) | |
| 504 m_tree.form()->setAttribute(actionAttr, actionAttribute->value()); | |
| 505 processFakeStartTag(hrTag); | |
| 506 processFakeStartTag(labelTag); | |
| 507 Attribute* promptAttribute = token->getAttributeItem(promptAttr); | |
| 508 if (promptAttribute) | |
| 509 processFakeCharacters(promptAttribute->value()); | |
| 510 else | |
| 511 processFakeCharacters(Locale::defaultLocale().queryString(blink::WebLoca
lizedString::SearchableIndexIntroduction)); | |
| 512 processFakeStartTag(inputTag, attributesForIsindexInput(token)); | |
| 513 notImplemented(); // This second set of characters may be needed by non-engl
ish locales. | |
| 514 processFakeEndTag(labelTag); | |
| 515 processFakeStartTag(hrTag); | |
| 516 processFakeEndTag(formTag); | |
| 517 } | |
| 518 | |
| 519 namespace { | 476 namespace { |
| 520 | 477 |
| 521 bool isLi(const HTMLStackItem* item) | 478 bool isLi(const HTMLStackItem* item) |
| 522 { | 479 { |
| 523 return item->hasTagName(liTag); | 480 return item->hasTagName(liTag); |
| 524 } | 481 } |
| 525 | 482 |
| 526 bool isDdOrDt(const HTMLStackItem* item) | 483 bool isDdOrDt(const HTMLStackItem* item) |
| 527 { | 484 { |
| 528 return item->hasTagName(ddTag) | 485 return item->hasTagName(ddTag) |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 || token->name() == trackTag) { | 806 || token->name() == trackTag) { |
| 850 m_tree.insertSelfClosingHTMLElement(token); | 807 m_tree.insertSelfClosingHTMLElement(token); |
| 851 return; | 808 return; |
| 852 } | 809 } |
| 853 if (token->name() == hrTag) { | 810 if (token->name() == hrTag) { |
| 854 processFakePEndTagIfPInButtonScope(); | 811 processFakePEndTagIfPInButtonScope(); |
| 855 m_tree.insertSelfClosingHTMLElement(token); | 812 m_tree.insertSelfClosingHTMLElement(token); |
| 856 m_framesetOk = false; | 813 m_framesetOk = false; |
| 857 return; | 814 return; |
| 858 } | 815 } |
| 859 if (token->name() == isindexTag) { | |
| 860 processIsindexStartTagForInBody(token); | |
| 861 return; | |
| 862 } | |
| 863 if (token->name() == textareaTag) { | 816 if (token->name() == textareaTag) { |
| 864 m_tree.insertHTMLElement(token); | 817 m_tree.insertHTMLElement(token); |
| 865 m_shouldSkipLeadingNewline = true; | 818 m_shouldSkipLeadingNewline = true; |
| 866 if (m_parser->tokenizer()) | 819 if (m_parser->tokenizer()) |
| 867 m_parser->tokenizer()->setState(HTMLTokenizer::RCDATAState); | 820 m_parser->tokenizer()->setState(HTMLTokenizer::RCDATAState); |
| 868 m_originalInsertionMode = m_insertionMode; | 821 m_originalInsertionMode = m_insertionMode; |
| 869 m_framesetOk = false; | 822 m_framesetOk = false; |
| 870 setInsertionMode(TextMode); | 823 setInsertionMode(TextMode); |
| 871 return; | 824 return; |
| 872 } | 825 } |
| (...skipping 1970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2843 ASSERT(m_isAttached); | 2796 ASSERT(m_isAttached); |
| 2844 // Warning, this may detach the parser. Do not do anything else after this. | 2797 // Warning, this may detach the parser. Do not do anything else after this. |
| 2845 m_tree.finishedParsing(); | 2798 m_tree.finishedParsing(); |
| 2846 } | 2799 } |
| 2847 | 2800 |
| 2848 void HTMLTreeBuilder::parseError(AtomicHTMLToken*) | 2801 void HTMLTreeBuilder::parseError(AtomicHTMLToken*) |
| 2849 { | 2802 { |
| 2850 } | 2803 } |
| 2851 | 2804 |
| 2852 } // namespace WebCore | 2805 } // namespace WebCore |
| OLD | NEW |