Chromium Code Reviews| 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 23 matching lines...) Expand all Loading... | |
| 34 #include <wtf/Noncopyable.h> | 34 #include <wtf/Noncopyable.h> |
| 35 #include <wtf/PassRefPtr.h> | 35 #include <wtf/PassRefPtr.h> |
| 36 #include <wtf/RefPtr.h> | 36 #include <wtf/RefPtr.h> |
| 37 #include <wtf/Vector.h> | 37 #include <wtf/Vector.h> |
| 38 | 38 |
| 39 namespace WebCore { | 39 namespace WebCore { |
| 40 | 40 |
| 41 struct HTMLConstructionSiteTask { | 41 struct HTMLConstructionSiteTask { |
| 42 enum Operation { | 42 enum Operation { |
| 43 Insert, | 43 Insert, |
| 44 InsertAlreadyParsedChild, | |
| 44 Reparent, | 45 Reparent, |
| 46 TakeAllChildren, | |
| 45 }; | 47 }; |
| 46 | 48 |
| 47 explicit HTMLConstructionSiteTask(Operation op) | 49 explicit HTMLConstructionSiteTask(Operation op) |
| 48 : operation(op) | 50 : operation(op) |
| 49 , selfClosing(false) | 51 , selfClosing(false) |
| 50 { | 52 { |
| 51 } | 53 } |
| 52 | 54 |
| 55 ContainerNode* oldParent() | |
| 56 { | |
| 57 // It's sort of ugly, but we store the |oldParent| in the |child| field | |
| 58 // of the task so that we don't bloat the HTMLConstructionSiteTask | |
| 59 // object in the common case of the Insert operation. | |
| 60 ASSERT(child->isContainerNode()); | |
| 61 return static_cast<ContainerNode*>(child.get()); | |
|
eseidel
2013/05/07 00:49:40
I believe there is a toContainerNode() which does
| |
| 62 } | |
| 63 | |
| 53 Operation operation; | 64 Operation operation; |
| 54 RefPtr<ContainerNode> parent; | 65 RefPtr<ContainerNode> parent; |
| 55 RefPtr<Node> nextChild; | 66 RefPtr<Node> nextChild; |
| 56 RefPtr<Node> child; | 67 RefPtr<Node> child; |
| 57 bool selfClosing; | 68 bool selfClosing; |
| 58 }; | 69 }; |
| 59 | 70 |
| 60 } // namespace WebCore | 71 } // namespace WebCore |
| 61 | 72 |
| 62 namespace WTF { | 73 namespace WTF { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 void insertHTMLFormElement(AtomicHTMLToken*, bool isDemoted = false); | 112 void insertHTMLFormElement(AtomicHTMLToken*, bool isDemoted = false); |
| 102 void insertScriptElement(AtomicHTMLToken*); | 113 void insertScriptElement(AtomicHTMLToken*); |
| 103 void insertTextNode(const String&, WhitespaceMode = WhitespaceUnknown); | 114 void insertTextNode(const String&, WhitespaceMode = WhitespaceUnknown); |
| 104 void insertForeignElement(AtomicHTMLToken*, const AtomicString& namespaceURI ); | 115 void insertForeignElement(AtomicHTMLToken*, const AtomicString& namespaceURI ); |
| 105 | 116 |
| 106 void insertHTMLHtmlStartTagBeforeHTML(AtomicHTMLToken*); | 117 void insertHTMLHtmlStartTagBeforeHTML(AtomicHTMLToken*); |
| 107 void insertHTMLHtmlStartTagInBody(AtomicHTMLToken*); | 118 void insertHTMLHtmlStartTagInBody(AtomicHTMLToken*); |
| 108 void insertHTMLBodyStartTagInBody(AtomicHTMLToken*); | 119 void insertHTMLBodyStartTagInBody(AtomicHTMLToken*); |
| 109 | 120 |
| 110 void reparent(HTMLElementStack::ElementRecord* newParent, HTMLElementStack:: ElementRecord* child); | 121 void reparent(HTMLElementStack::ElementRecord* newParent, HTMLElementStack:: ElementRecord* child); |
| 122 void reparent(HTMLElementStack::ElementRecord* newParent, HTMLStackItem* chi ld); | |
| 123 // insertAlreadyParsedChild assumes that |child| has already been parsed (i. e., we're just | |
| 124 // moving it around in the tree rather than parsing it for the first time). That means | |
| 125 // this function doesn't call beginParsingChildren / finishParsingChildren. | |
| 126 void insertAlreadyParsedChild(HTMLStackItem* newParent, HTMLElementStack::El ementRecord* child); | |
| 127 void takeAllChildren(HTMLStackItem* newParent, HTMLElementStack::ElementReco rd* oldParent); | |
| 111 | 128 |
| 112 PassRefPtr<HTMLStackItem> createElementFromSavedToken(HTMLStackItem*); | 129 PassRefPtr<HTMLStackItem> createElementFromSavedToken(HTMLStackItem*); |
| 113 | 130 |
| 114 bool shouldFosterParent() const; | 131 bool shouldFosterParent() const; |
| 115 void fosterParent(PassRefPtr<Node>); | 132 void fosterParent(PassRefPtr<Node>); |
| 116 | 133 |
| 117 bool indexOfFirstUnopenFormattingElement(unsigned& firstUnopenElementIndex) const; | 134 bool indexOfFirstUnopenFormattingElement(unsigned& firstUnopenElementIndex) const; |
| 118 void reconstructTheActiveFormattingElements(); | 135 void reconstructTheActiveFormattingElements(); |
| 119 | 136 |
| 120 void generateImpliedEndTags(); | 137 void generateImpliedEndTags(); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 // "whenever a node would be inserted into the current node, it must instead | 219 // "whenever a node would be inserted into the current node, it must instead |
| 203 // be foster parented." This flag tracks whether we're in that state. | 220 // be foster parented." This flag tracks whether we're in that state. |
| 204 bool m_redirectAttachToFosterParent; | 221 bool m_redirectAttachToFosterParent; |
| 205 | 222 |
| 206 bool m_inQuirksMode; | 223 bool m_inQuirksMode; |
| 207 }; | 224 }; |
| 208 | 225 |
| 209 } // namespace WebCore | 226 } // namespace WebCore |
| 210 | 227 |
| 211 #endif | 228 #endif |
| OLD | NEW |