OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
9 * Copyright (C) 2011 Google Inc. All rights reserved. | 9 * Copyright (C) 2011 Google Inc. All rights reserved. |
10 * | 10 * |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 InvalidateOnForAttrChange, | 184 InvalidateOnForAttrChange, |
185 InvalidateForFormControls, | 185 InvalidateForFormControls, |
186 InvalidateOnHRefAttrChange, | 186 InvalidateOnHRefAttrChange, |
187 InvalidateOnItemAttrChange, | 187 InvalidateOnItemAttrChange, |
188 InvalidateOnAnyAttrChange, | 188 InvalidateOnAnyAttrChange, |
189 }; | 189 }; |
190 const int numNodeListInvalidationTypes = InvalidateOnAnyAttrChange + 1; | 190 const int numNodeListInvalidationTypes = InvalidateOnAnyAttrChange + 1; |
191 | 191 |
192 typedef HashCountedSet<Node*> TouchEventTargetSet; | 192 typedef HashCountedSet<Node*> TouchEventTargetSet; |
193 | 193 |
| 194 enum DocumentClass { |
| 195 DefaultDocumentClass = 0, |
| 196 HTMLDocumentClass = 1, |
| 197 XHTMLDocumentClass = 1 << 1, |
| 198 ImageDocumentClass = 1 << 2, |
| 199 PluginDocumentClass = 1 << 3, |
| 200 MediaDocumentClass = 1 << 4, |
| 201 SVGDocumentClass = 1 << 5, |
| 202 }; |
| 203 |
194 class Document : public ContainerNode, public TreeScope, public ScriptExecutionC
ontext { | 204 class Document : public ContainerNode, public TreeScope, public ScriptExecutionC
ontext { |
195 public: | 205 public: |
196 static PassRefPtr<Document> create(Frame* frame, const KURL& url) | 206 static PassRefPtr<Document> create(Frame* frame, const KURL& url) |
197 { | 207 { |
198 return adoptRef(new Document(frame, url, false, false)); | 208 return adoptRef(new Document(frame, url)); |
199 } | 209 } |
200 static PassRefPtr<Document> createXHTML(Frame* frame, const KURL& url) | 210 static PassRefPtr<Document> createXHTML(Frame* frame, const KURL& url) |
201 { | 211 { |
202 return adoptRef(new Document(frame, url, true, false)); | 212 return adoptRef(new Document(frame, url, XHTMLDocumentClass)); |
203 } | 213 } |
204 virtual ~Document(); | 214 virtual ~Document(); |
205 | 215 |
206 MediaQueryMatcher* mediaQueryMatcher(); | 216 MediaQueryMatcher* mediaQueryMatcher(); |
207 | 217 |
208 using ContainerNode::ref; | 218 using ContainerNode::ref; |
209 using ContainerNode::deref; | 219 using ContainerNode::deref; |
210 | 220 |
211 Element* getElementById(const AtomicString& id) const; | 221 Element* getElementById(const AtomicString& id) const; |
212 | 222 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 PassRefPtr<HTMLCollection> applets(); | 394 PassRefPtr<HTMLCollection> applets(); |
385 PassRefPtr<HTMLCollection> links(); | 395 PassRefPtr<HTMLCollection> links(); |
386 PassRefPtr<HTMLCollection> forms(); | 396 PassRefPtr<HTMLCollection> forms(); |
387 PassRefPtr<HTMLCollection> anchors(); | 397 PassRefPtr<HTMLCollection> anchors(); |
388 PassRefPtr<HTMLCollection> scripts(); | 398 PassRefPtr<HTMLCollection> scripts(); |
389 PassRefPtr<HTMLCollection> all(); | 399 PassRefPtr<HTMLCollection> all(); |
390 | 400 |
391 PassRefPtr<HTMLCollection> windowNamedItems(const AtomicString& name); | 401 PassRefPtr<HTMLCollection> windowNamedItems(const AtomicString& name); |
392 PassRefPtr<HTMLCollection> documentNamedItems(const AtomicString& name); | 402 PassRefPtr<HTMLCollection> documentNamedItems(const AtomicString& name); |
393 | 403 |
394 // Other methods (not part of DOM) | 404 bool isHTMLDocument() const { return m_documentClass & HTMLDocumentClass; } |
395 bool isHTMLDocument() const { return m_isHTML; } | 405 bool isXHTMLDocument() const { return m_documentClass & XHTMLDocumentClass;
} |
396 bool isXHTMLDocument() const { return m_isXHTML; } | 406 bool isImageDocument() const { return m_documentClass & ImageDocumentClass;
} |
397 virtual bool isImageDocument() const { return false; } | 407 bool isSVGDocument() const { return m_documentClass & SVGDocumentClass; } |
| 408 bool isPluginDocument() const { return m_documentClass & PluginDocumentClass
; } |
| 409 bool isMediaDocument() const { return m_documentClass & MediaDocumentClass;
} |
| 410 |
398 #if ENABLE(SVG) | 411 #if ENABLE(SVG) |
399 virtual bool isSVGDocument() const { return false; } | |
400 bool hasSVGRootNode() const; | 412 bool hasSVGRootNode() const; |
401 #else | 413 #else |
402 static bool isSVGDocument() { return false; } | |
403 static bool hasSVGRootNode() { return false; } | 414 static bool hasSVGRootNode() { return false; } |
404 #endif | 415 #endif |
405 virtual bool isPluginDocument() const { return false; } | 416 |
406 virtual bool isMediaDocument() const { return false; } | |
407 virtual bool isFrameSet() const { return false; } | 417 virtual bool isFrameSet() const { return false; } |
408 | 418 |
409 bool isSrcdocDocument() const { return m_isSrcdocDocument; } | 419 bool isSrcdocDocument() const { return m_isSrcdocDocument; } |
410 | 420 |
411 StyleResolver* styleResolverIfExists() const { return m_styleResolver.get();
} | 421 StyleResolver* styleResolverIfExists() const { return m_styleResolver.get();
} |
412 | 422 |
413 bool isViewSource() const { return m_isViewSource; } | 423 bool isViewSource() const { return m_isViewSource; } |
414 void setIsViewSource(bool); | 424 void setIsViewSource(bool); |
415 | 425 |
416 bool sawElementsInKnownNamespaces() const { return m_sawElementsInKnownNames
paces; } | 426 bool sawElementsInKnownNamespaces() const { return m_sawElementsInKnownNames
paces; } |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 | 1111 |
1102 void didAssociateFormControl(Element*); | 1112 void didAssociateFormControl(Element*); |
1103 | 1113 |
1104 virtual void addConsoleMessage(MessageSource, MessageLevel, const String& me
ssage, unsigned long requestIdentifier = 0); | 1114 virtual void addConsoleMessage(MessageSource, MessageLevel, const String& me
ssage, unsigned long requestIdentifier = 0); |
1105 | 1115 |
1106 virtual const SecurityOrigin* topOrigin() const OVERRIDE; | 1116 virtual const SecurityOrigin* topOrigin() const OVERRIDE; |
1107 | 1117 |
1108 PassRefPtr<FontLoader> fontloader(); | 1118 PassRefPtr<FontLoader> fontloader(); |
1109 | 1119 |
1110 protected: | 1120 protected: |
1111 Document(Frame*, const KURL&, bool isXHTML, bool isHTML); | 1121 Document(Frame*, const KURL&, unsigned documentClass = DefaultDocumentClass)
; |
1112 | 1122 |
1113 virtual void didUpdateSecurityOrigin() OVERRIDE; | 1123 virtual void didUpdateSecurityOrigin() OVERRIDE; |
1114 | 1124 |
1115 void clearXMLVersion() { m_xmlVersion = String(); } | 1125 void clearXMLVersion() { m_xmlVersion = String(); } |
1116 | 1126 |
1117 private: | 1127 private: |
1118 friend class Node; | 1128 friend class Node; |
1119 friend class IgnoreDestructiveWriteCountIncrementer; | 1129 friend class IgnoreDestructiveWriteCountIncrementer; |
1120 | 1130 |
1121 virtual void dispose() OVERRIDE; | 1131 virtual void dispose() OVERRIDE; |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1348 | 1358 |
1349 HashSet<Element*> m_captionPreferencesChangedElements; | 1359 HashSet<Element*> m_captionPreferencesChangedElements; |
1350 | 1360 |
1351 HashMap<StringImpl*, Element*, CaseFoldingHash> m_elementsByAccessKey; | 1361 HashMap<StringImpl*, Element*, CaseFoldingHash> m_elementsByAccessKey; |
1352 bool m_accessKeyMapValid; | 1362 bool m_accessKeyMapValid; |
1353 | 1363 |
1354 OwnPtr<SelectorQueryCache> m_selectorQueryCache; | 1364 OwnPtr<SelectorQueryCache> m_selectorQueryCache; |
1355 | 1365 |
1356 bool m_useSecureKeyboardEntryWhenActive; | 1366 bool m_useSecureKeyboardEntryWhenActive; |
1357 | 1367 |
1358 bool m_isXHTML; | 1368 unsigned m_documentClass; |
1359 bool m_isHTML; | |
1360 | 1369 |
1361 bool m_isViewSource; | 1370 bool m_isViewSource; |
1362 bool m_sawElementsInKnownNamespaces; | 1371 bool m_sawElementsInKnownNamespaces; |
1363 bool m_isSrcdocDocument; | 1372 bool m_isSrcdocDocument; |
1364 | 1373 |
1365 RenderObject* m_renderer; | 1374 RenderObject* m_renderer; |
1366 RefPtr<DocumentEventQueue> m_eventQueue; | 1375 RefPtr<DocumentEventQueue> m_eventQueue; |
1367 | 1376 |
1368 WeakPtrFactory<Document> m_weakFactory; | 1377 WeakPtrFactory<Document> m_weakFactory; |
1369 | 1378 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1506 trackForDebugging(); | 1515 trackForDebugging(); |
1507 #endif | 1516 #endif |
1508 InspectorCounters::incrementCounter(InspectorCounters::NodeCounter); | 1517 InspectorCounters::incrementCounter(InspectorCounters::NodeCounter); |
1509 } | 1518 } |
1510 | 1519 |
1511 Node* eventTargetNodeForDocument(Document*); | 1520 Node* eventTargetNodeForDocument(Document*); |
1512 | 1521 |
1513 } // namespace WebCore | 1522 } // namespace WebCore |
1514 | 1523 |
1515 #endif // Document_h | 1524 #endif // Document_h |
OLD | NEW |