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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 WhitespaceUnknown, | 89 WhitespaceUnknown, |
90 NotAllWhitespace, | 90 NotAllWhitespace, |
91 AllWhitespace, | 91 AllWhitespace, |
92 }; | 92 }; |
93 | 93 |
94 class AtomicHTMLToken; | 94 class AtomicHTMLToken; |
95 class Document; | 95 class Document; |
96 class Element; | 96 class Element; |
97 class HTMLFormElement; | 97 class HTMLFormElement; |
98 | 98 |
99 class HTMLConstructionSite { | 99 class HTMLConstructionSite FINAL { |
100 WTF_MAKE_NONCOPYABLE(HTMLConstructionSite); | 100 WTF_MAKE_NONCOPYABLE(HTMLConstructionSite); |
101 DISALLOW_ALLOCATION(); | 101 DISALLOW_ALLOCATION(); |
102 public: | 102 public: |
103 HTMLConstructionSite(Document*, ParserContentPolicy); | 103 HTMLConstructionSite(Document*, ParserContentPolicy); |
104 HTMLConstructionSite(DocumentFragment*, ParserContentPolicy); | 104 HTMLConstructionSite(DocumentFragment*, ParserContentPolicy); |
105 ~HTMLConstructionSite(); | 105 ~HTMLConstructionSite(); |
106 void trace(Visitor*); | 106 void trace(Visitor*); |
107 | 107 |
108 void detach(); | 108 void detach(); |
109 | 109 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 // and a Document in all other cases. | 240 // and a Document in all other cases. |
241 RawPtrWillBeMember<ContainerNode> m_attachmentRoot; | 241 RawPtrWillBeMember<ContainerNode> m_attachmentRoot; |
242 | 242 |
243 RefPtrWillBeMember<HTMLStackItem> m_head; | 243 RefPtrWillBeMember<HTMLStackItem> m_head; |
244 RefPtrWillBeMember<HTMLFormElement> m_form; | 244 RefPtrWillBeMember<HTMLFormElement> m_form; |
245 mutable HTMLElementStack m_openElements; | 245 mutable HTMLElementStack m_openElements; |
246 mutable HTMLFormattingElementList m_activeFormattingElements; | 246 mutable HTMLFormattingElementList m_activeFormattingElements; |
247 | 247 |
248 TaskQueue m_taskQueue; | 248 TaskQueue m_taskQueue; |
249 | 249 |
250 struct PendingText { | 250 class PendingText FINAL { |
| 251 DISALLOW_ALLOCATION(); |
| 252 public: |
251 PendingText() | 253 PendingText() |
252 : whitespaceMode(WhitespaceUnknown) | 254 : whitespaceMode(WhitespaceUnknown) |
253 { | 255 { |
254 } | 256 } |
255 | 257 |
256 void append(PassRefPtr<ContainerNode> newParent, PassRefPtr<Node> newNex
tChild, const String& newString, WhitespaceMode newWhitespaceMode) | 258 void append(PassRefPtrWillBeRawPtr<ContainerNode> newParent, PassRefPtrW
illBeRawPtr<Node> newNextChild, const String& newString, WhitespaceMode newWhite
spaceMode) |
257 { | 259 { |
258 ASSERT(!parent || parent == newParent); | 260 ASSERT(!parent || parent == newParent); |
259 parent = newParent; | 261 parent = newParent; |
260 ASSERT(!nextChild || nextChild == newNextChild); | 262 ASSERT(!nextChild || nextChild == newNextChild); |
261 nextChild = newNextChild; | 263 nextChild = newNextChild; |
262 stringBuilder.append(newString); | 264 stringBuilder.append(newString); |
263 whitespaceMode = std::min(whitespaceMode, newWhitespaceMode); | 265 whitespaceMode = std::min(whitespaceMode, newWhitespaceMode); |
264 } | 266 } |
265 | 267 |
266 void swap(PendingText& other) | 268 void swap(PendingText& other) |
(...skipping 12 matching lines...) Expand all Loading... |
279 | 281 |
280 bool isEmpty() | 282 bool isEmpty() |
281 { | 283 { |
282 // When the stringbuilder is empty, the parent and whitespace should
also be "empty". | 284 // When the stringbuilder is empty, the parent and whitespace should
also be "empty". |
283 ASSERT(stringBuilder.isEmpty() == !parent); | 285 ASSERT(stringBuilder.isEmpty() == !parent); |
284 ASSERT(!stringBuilder.isEmpty() || !nextChild); | 286 ASSERT(!stringBuilder.isEmpty() || !nextChild); |
285 ASSERT(!stringBuilder.isEmpty() || (whitespaceMode == WhitespaceUnkn
own)); | 287 ASSERT(!stringBuilder.isEmpty() || (whitespaceMode == WhitespaceUnkn
own)); |
286 return stringBuilder.isEmpty(); | 288 return stringBuilder.isEmpty(); |
287 } | 289 } |
288 | 290 |
289 RefPtr<ContainerNode> parent; | 291 void trace(Visitor*); |
290 RefPtr<Node> nextChild; | 292 |
| 293 RefPtrWillBeMember<ContainerNode> parent; |
| 294 RefPtrWillBeMember<Node> nextChild; |
291 StringBuilder stringBuilder; | 295 StringBuilder stringBuilder; |
292 WhitespaceMode whitespaceMode; | 296 WhitespaceMode whitespaceMode; |
293 }; | 297 }; |
294 | 298 |
295 PendingText m_pendingText; | 299 PendingText m_pendingText; |
296 | 300 |
297 ParserContentPolicy m_parserContentPolicy; | 301 ParserContentPolicy m_parserContentPolicy; |
298 bool m_isParsingFragment; | 302 bool m_isParsingFragment; |
299 | 303 |
300 // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.
html#parsing-main-intable | 304 // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.
html#parsing-main-intable |
301 // In the "in table" insertion mode, we sometimes get into a state where | 305 // In the "in table" insertion mode, we sometimes get into a state where |
302 // "whenever a node would be inserted into the current node, it must instead | 306 // "whenever a node would be inserted into the current node, it must instead |
303 // be foster parented." This flag tracks whether we're in that state. | 307 // be foster parented." This flag tracks whether we're in that state. |
304 bool m_redirectAttachToFosterParent; | 308 bool m_redirectAttachToFosterParent; |
305 | 309 |
306 bool m_inQuirksMode; | 310 bool m_inQuirksMode; |
307 }; | 311 }; |
308 | 312 |
309 } // namespace WebCore | 313 } // namespace WebCore |
310 | 314 |
311 #endif | 315 #endif |
OLD | NEW |