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 | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All |
7 * rights reserved. | 7 * rights reserved. |
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
10 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 10 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 // Aliases by callers. | 229 // Aliases by callers. |
230 // Clone a node: https://dom.spec.whatwg.org/#concept-node-clone | 230 // Clone a node: https://dom.spec.whatwg.org/#concept-node-clone |
231 CreatedByCloneNode = AsynchronousCustomElements, | 231 CreatedByCloneNode = AsynchronousCustomElements, |
232 CreatedByImportNode = CreatedByCloneNode, | 232 CreatedByImportNode = CreatedByCloneNode, |
233 // https://dom.spec.whatwg.org/#dom-document-createelement | 233 // https://dom.spec.whatwg.org/#dom-document-createelement |
234 CreatedByCreateElement = SynchronousCustomElements, | 234 CreatedByCreateElement = SynchronousCustomElements, |
235 // https://html.spec.whatwg.org/#create-an-element-for-the-token | 235 // https://html.spec.whatwg.org/#create-an-element-for-the-token |
236 CreatedByFragmentParser = CreatedByParser | AsynchronousCustomElements, | 236 CreatedByFragmentParser = CreatedByParser | AsynchronousCustomElements, |
237 }; | 237 }; |
238 | 238 |
239 // Collect data about deferred loading of offscreen cross-origin documents. All | |
240 // cross-origin documents log Created. Only those that would load log a reason. | |
241 // We can then see the % of cross-origin documents that never have to load. | |
242 // See https://crbug.com/635105. | |
243 // Logged to UMA, don't re-arrange entries without creating a new histogram. | |
244 enum WouldLoadReason { | |
245 Created, | |
246 // If outer and inner frames aren't in the same process we can't determine | |
247 // if the inner frame is visible, so just load it. | |
248 // TODO(dgrogan): Revisit after https://crbug.com/650433 is fixed. | |
249 WouldLoadOutOfProcess, | |
250 // The next four indicate frames that are probably used for cross-origin | |
251 // communication. | |
252 WouldLoadDisplayNone, | |
253 WouldLoadZeroByZero, | |
254 WouldLoadAbove, | |
255 WouldLoadLeft, | |
256 // We have to load documents in visible frames. | |
257 WouldLoadVisible, | |
258 | |
259 WouldLoadReasonEnd | |
260 }; | |
261 | |
262 using DocumentClassFlags = unsigned char; | 239 using DocumentClassFlags = unsigned char; |
263 | 240 |
264 class CORE_EXPORT Document : public ContainerNode, | 241 class CORE_EXPORT Document : public ContainerNode, |
265 public TreeScope, | 242 public TreeScope, |
266 public SecurityContext, | 243 public SecurityContext, |
267 public ExecutionContext, | 244 public ExecutionContext, |
268 public Supplementable<Document> { | 245 public Supplementable<Document> { |
269 DEFINE_WRAPPERTYPEINFO(); | 246 DEFINE_WRAPPERTYPEINFO(); |
270 USING_GARBAGE_COLLECTED_MIXIN(Document); | 247 USING_GARBAGE_COLLECTED_MIXIN(Document); |
271 | 248 |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1302 } | 1279 } |
1303 | 1280 |
1304 Element* rootScroller() const; | 1281 Element* rootScroller() const; |
1305 void setRootScroller(Element*, ExceptionState&); | 1282 void setRootScroller(Element*, ExceptionState&); |
1306 RootScrollerController* rootScrollerController() const { | 1283 RootScrollerController* rootScrollerController() const { |
1307 return m_rootScrollerController.get(); | 1284 return m_rootScrollerController.get(); |
1308 } | 1285 } |
1309 | 1286 |
1310 bool isInMainFrame() const; | 1287 bool isInMainFrame() const; |
1311 | 1288 |
1312 void maybeRecordLoadReason(WouldLoadReason); | 1289 void onVisibilityMaybeChanged(bool visible); |
1313 WouldLoadReason wouldLoadReason() { return m_wouldLoadReason; } | |
1314 | 1290 |
1315 PropertyRegistry* propertyRegistry(); | 1291 PropertyRegistry* propertyRegistry(); |
1316 | 1292 |
1317 protected: | 1293 protected: |
1318 Document(const DocumentInit&, DocumentClassFlags = DefaultDocumentClass); | 1294 Document(const DocumentInit&, DocumentClassFlags = DefaultDocumentClass); |
1319 | 1295 |
1320 void didUpdateSecurityOrigin() final; | 1296 void didUpdateSecurityOrigin() final; |
1321 | 1297 |
1322 void clearXMLVersion() { m_xmlVersion = String(); } | 1298 void clearXMLVersion() { m_xmlVersion = String(); } |
1323 | 1299 |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1658 Member<IntersectionObserverController> m_intersectionObserverController; | 1634 Member<IntersectionObserverController> m_intersectionObserverController; |
1659 Member<NodeIntersectionObserverData> m_intersectionObserverData; | 1635 Member<NodeIntersectionObserverData> m_intersectionObserverData; |
1660 Member<ResizeObserverController> m_resizeObserverController; | 1636 Member<ResizeObserverController> m_resizeObserverController; |
1661 | 1637 |
1662 int m_nodeCount; | 1638 int m_nodeCount; |
1663 | 1639 |
1664 bool m_mayContainV0Shadow = false; | 1640 bool m_mayContainV0Shadow = false; |
1665 | 1641 |
1666 Member<SnapCoordinator> m_snapCoordinator; | 1642 Member<SnapCoordinator> m_snapCoordinator; |
1667 | 1643 |
1668 WouldLoadReason m_wouldLoadReason; | 1644 bool m_visibilityWasLogged; |
1669 | 1645 |
1670 Member<PropertyRegistry> m_propertyRegistry; | 1646 Member<PropertyRegistry> m_propertyRegistry; |
1671 }; | 1647 }; |
1672 | 1648 |
1673 extern template class CORE_EXTERN_TEMPLATE_EXPORT Supplement<Document>; | 1649 extern template class CORE_EXTERN_TEMPLATE_EXPORT Supplement<Document>; |
1674 | 1650 |
1675 inline bool Document::shouldOverrideLegacyDescription( | 1651 inline bool Document::shouldOverrideLegacyDescription( |
1676 ViewportDescription::Type origin) const { | 1652 ViewportDescription::Type origin) const { |
1677 // The different (legacy) meta tags have different priorities based on the | 1653 // The different (legacy) meta tags have different priorities based on the |
1678 // type regardless of which order they appear in the DOM. The priority is | 1654 // type regardless of which order they appear in the DOM. The priority is |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1715 DEFINE_TYPE_CASTS(TreeScope, Document, document, true, true); | 1691 DEFINE_TYPE_CASTS(TreeScope, Document, document, true, true); |
1716 | 1692 |
1717 } // namespace blink | 1693 } // namespace blink |
1718 | 1694 |
1719 #ifndef NDEBUG | 1695 #ifndef NDEBUG |
1720 // Outside the WebCore namespace for ease of invocation from gdb. | 1696 // Outside the WebCore namespace for ease of invocation from gdb. |
1721 CORE_EXPORT void showLiveDocumentInstances(); | 1697 CORE_EXPORT void showLiveDocumentInstances(); |
1722 #endif | 1698 #endif |
1723 | 1699 |
1724 #endif // Document_h | 1700 #endif // Document_h |
OLD | NEW |