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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 XHTMLDocumentClass = 1 << 1, | 204 XHTMLDocumentClass = 1 << 1, |
205 ImageDocumentClass = 1 << 2, | 205 ImageDocumentClass = 1 << 2, |
206 PluginDocumentClass = 1 << 3, | 206 PluginDocumentClass = 1 << 3, |
207 MediaDocumentClass = 1 << 4, | 207 MediaDocumentClass = 1 << 4, |
208 SVGDocumentClass = 1 << 5, | 208 SVGDocumentClass = 1 << 5, |
209 XMLDocumentClass = 1 << 6, | 209 XMLDocumentClass = 1 << 6, |
210 }; | 210 }; |
211 | 211 |
212 typedef unsigned char DocumentClassFlags; | 212 typedef unsigned char DocumentClassFlags; |
213 | 213 |
| 214 class Document; |
| 215 |
| 216 class DocumentVisibilityObserver { |
| 217 public: |
| 218 DocumentVisibilityObserver(Document&); |
| 219 virtual ~DocumentVisibilityObserver(); |
| 220 |
| 221 virtual void didChangeVisibilityState(PageVisibilityState) = 0; |
| 222 |
| 223 // Classes that inherit Node and DocumentVisibilityObserver must have a |
| 224 // virtual override of Node::didMoveToNewDocument that calls |
| 225 // DocumentVisibilityObserver::setDocument |
| 226 void setObservedDocument(Document&); |
| 227 |
| 228 private: |
| 229 void registerObserver(Document&); |
| 230 void unregisterObserver(); |
| 231 Document* m_document; |
| 232 }; |
| 233 |
214 class Document : public ContainerNode, public TreeScope, public SecurityContext,
public ExecutionContext, public ExecutionContextClient | 234 class Document : public ContainerNode, public TreeScope, public SecurityContext,
public ExecutionContext, public ExecutionContextClient |
215 , public DocumentSupplementable, public LifecycleContext<Document> { | 235 , public DocumentSupplementable, public LifecycleContext<Document> { |
216 public: | 236 public: |
217 static PassRefPtr<Document> create(const DocumentInit& initializer = Documen
tInit()) | 237 static PassRefPtr<Document> create(const DocumentInit& initializer = Documen
tInit()) |
218 { | 238 { |
219 return adoptRef(new Document(initializer)); | 239 return adoptRef(new Document(initializer)); |
220 } | 240 } |
221 virtual ~Document(); | 241 virtual ~Document(); |
222 | 242 |
223 MediaQueryMatcher& mediaQueryMatcher(); | 243 MediaQueryMatcher& mediaQueryMatcher(); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 374 |
355 void setXMLEncoding(const String& encoding) { m_xmlEncoding = encoding; } //
read-only property, only to be set from XMLDocumentParser | 375 void setXMLEncoding(const String& encoding) { m_xmlEncoding = encoding; } //
read-only property, only to be set from XMLDocumentParser |
356 void setXMLVersion(const String&, ExceptionState&); | 376 void setXMLVersion(const String&, ExceptionState&); |
357 void setXMLStandalone(bool, ExceptionState&); | 377 void setXMLStandalone(bool, ExceptionState&); |
358 void setHasXMLDeclaration(bool hasXMLDeclaration) { m_hasXMLDeclaration = ha
sXMLDeclaration ? 1 : 0; } | 378 void setHasXMLDeclaration(bool hasXMLDeclaration) { m_hasXMLDeclaration = ha
sXMLDeclaration ? 1 : 0; } |
359 | 379 |
360 virtual KURL baseURI() const OVERRIDE FINAL; | 380 virtual KURL baseURI() const OVERRIDE FINAL; |
361 | 381 |
362 String visibilityState() const; | 382 String visibilityState() const; |
363 bool hidden() const; | 383 bool hidden() const; |
364 void dispatchVisibilityStateChangeEvent(); | 384 void didChangeVisibilityState(); |
365 | 385 |
366 PassRefPtr<Node> adoptNode(PassRefPtr<Node> source, ExceptionState&); | 386 PassRefPtr<Node> adoptNode(PassRefPtr<Node> source, ExceptionState&); |
367 | 387 |
368 PassRefPtr<HTMLCollection> images(); | 388 PassRefPtr<HTMLCollection> images(); |
369 PassRefPtr<HTMLCollection> embeds(); | 389 PassRefPtr<HTMLCollection> embeds(); |
370 PassRefPtr<HTMLCollection> applets(); | 390 PassRefPtr<HTMLCollection> applets(); |
371 PassRefPtr<HTMLCollection> links(); | 391 PassRefPtr<HTMLCollection> links(); |
372 PassRefPtr<HTMLCollection> forms(); | 392 PassRefPtr<HTMLCollection> forms(); |
373 PassRefPtr<HTMLCollection> anchors(); | 393 PassRefPtr<HTMLCollection> anchors(); |
374 PassRefPtr<HTMLCollection> scripts(); | 394 PassRefPtr<HTMLCollection> scripts(); |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 }; | 1032 }; |
1013 void maybeHandleHttpRefresh(const String&, HttpRefreshType); | 1033 void maybeHandleHttpRefresh(const String&, HttpRefreshType); |
1014 | 1034 |
1015 void updateSecurityOrigin(PassRefPtr<SecurityOrigin>); | 1035 void updateSecurityOrigin(PassRefPtr<SecurityOrigin>); |
1016 PassOwnPtr<LifecycleNotifier<Document> > createLifecycleNotifier(); | 1036 PassOwnPtr<LifecycleNotifier<Document> > createLifecycleNotifier(); |
1017 | 1037 |
1018 void setHasViewportUnits() { m_hasViewportUnits = true; } | 1038 void setHasViewportUnits() { m_hasViewportUnits = true; } |
1019 bool hasViewportUnits() const { return m_hasViewportUnits; } | 1039 bool hasViewportUnits() const { return m_hasViewportUnits; } |
1020 void notifyResizeForViewportUnits(); | 1040 void notifyResizeForViewportUnits(); |
1021 | 1041 |
| 1042 void registerVisibilityObserver(DocumentVisibilityObserver*); |
| 1043 void unregisterVisibilityObserver(DocumentVisibilityObserver*); |
| 1044 |
1022 protected: | 1045 protected: |
1023 Document(const DocumentInit&, DocumentClassFlags = DefaultDocumentClass); | 1046 Document(const DocumentInit&, DocumentClassFlags = DefaultDocumentClass); |
1024 | 1047 |
1025 virtual void didUpdateSecurityOrigin() OVERRIDE FINAL; | 1048 virtual void didUpdateSecurityOrigin() OVERRIDE FINAL; |
1026 | 1049 |
1027 void clearXMLVersion() { m_xmlVersion = String(); } | 1050 void clearXMLVersion() { m_xmlVersion = String(); } |
1028 | 1051 |
1029 virtual void dispose() OVERRIDE; | 1052 virtual void dispose() OVERRIDE; |
1030 | 1053 |
1031 virtual PassRefPtr<Document> cloneDocumentWithoutChildren(); | 1054 virtual PassRefPtr<Document> cloneDocumentWithoutChildren(); |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 | 1329 |
1307 RefPtr<Document> m_templateDocument; | 1330 RefPtr<Document> m_templateDocument; |
1308 Document* m_templateDocumentHost; // Manually managed weakref (backpointer f
rom m_templateDocument). | 1331 Document* m_templateDocumentHost; // Manually managed weakref (backpointer f
rom m_templateDocument). |
1309 | 1332 |
1310 Timer<Document> m_didAssociateFormControlsTimer; | 1333 Timer<Document> m_didAssociateFormControlsTimer; |
1311 HashSet<RefPtr<Element> > m_associatedFormControls; | 1334 HashSet<RefPtr<Element> > m_associatedFormControls; |
1312 | 1335 |
1313 HashSet<SVGUseElement*> m_useElementsNeedingUpdate; | 1336 HashSet<SVGUseElement*> m_useElementsNeedingUpdate; |
1314 | 1337 |
1315 bool m_hasViewportUnits; | 1338 bool m_hasViewportUnits; |
| 1339 |
| 1340 HashSet<DocumentVisibilityObserver*> m_visibilityObservers; |
1316 }; | 1341 }; |
1317 | 1342 |
1318 inline void Document::notifyRemovePendingSheetIfNeeded() | 1343 inline void Document::notifyRemovePendingSheetIfNeeded() |
1319 { | 1344 { |
1320 if (m_needsNotifyRemoveAllPendingStylesheet) | 1345 if (m_needsNotifyRemoveAllPendingStylesheet) |
1321 didRemoveAllPendingStylesheet(); | 1346 didRemoveAllPendingStylesheet(); |
1322 } | 1347 } |
1323 | 1348 |
1324 inline const Document* Document::templateDocument() const | 1349 inline const Document* Document::templateDocument() const |
1325 { | 1350 { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1357 inline bool Node::isDocumentNode() const | 1382 inline bool Node::isDocumentNode() const |
1358 { | 1383 { |
1359 return this == document(); | 1384 return this == document(); |
1360 } | 1385 } |
1361 | 1386 |
1362 Node* eventTargetNodeForDocument(Document*); | 1387 Node* eventTargetNodeForDocument(Document*); |
1363 | 1388 |
1364 } // namespace WebCore | 1389 } // namespace WebCore |
1365 | 1390 |
1366 #endif // Document_h | 1391 #endif // Document_h |
OLD | NEW |