Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.h

Issue 2657623005: WIP: Give developers an opt-in mechanism to block some parser-inserted scripts.
Patch Set: Refactor. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // Aliases by callers. 217 // Aliases by callers.
218 // Clone a node: https://dom.spec.whatwg.org/#concept-node-clone 218 // Clone a node: https://dom.spec.whatwg.org/#concept-node-clone
219 CreatedByCloneNode = AsynchronousCustomElements, 219 CreatedByCloneNode = AsynchronousCustomElements,
220 CreatedByImportNode = CreatedByCloneNode, 220 CreatedByImportNode = CreatedByCloneNode,
221 // https://dom.spec.whatwg.org/#dom-document-createelement 221 // https://dom.spec.whatwg.org/#dom-document-createelement
222 CreatedByCreateElement = SynchronousCustomElements, 222 CreatedByCreateElement = SynchronousCustomElements,
223 // https://html.spec.whatwg.org/#create-an-element-for-the-token 223 // https://html.spec.whatwg.org/#create-an-element-for-the-token
224 CreatedByFragmentParser = CreatedByParser | AsynchronousCustomElements, 224 CreatedByFragmentParser = CreatedByParser | AsynchronousCustomElements,
225 }; 225 };
226 226
227 enum SrcdocType {
jochen (gone - plz use gerrit) 2017/01/27 15:14:19 nit. enum class. enum constants should start with
228 NotSrcdoc,
229 Srcdoc,
230 FragmentParserCreatedSrcdoc,
231 DocumentWriteCreatedSrcdoc
232 };
233
227 // Collect data about deferred loading of offscreen cross-origin documents. All 234 // Collect data about deferred loading of offscreen cross-origin documents. All
228 // cross-origin documents log Created. Only those that would load log a reason. 235 // cross-origin documents log Created. Only those that would load log a reason.
229 // We can then see the % of cross-origin documents that never have to load. 236 // We can then see the % of cross-origin documents that never have to load.
230 // See https://crbug.com/635105. 237 // See https://crbug.com/635105.
231 // Logged to UMA, don't re-arrange entries without creating a new histogram. 238 // Logged to UMA, don't re-arrange entries without creating a new histogram.
232 enum WouldLoadReason { 239 enum WouldLoadReason {
233 Created, 240 Created,
234 // If outer and inner frames aren't in the same process we can't determine 241 // If outer and inner frames aren't in the same process we can't determine
235 // if the inner frame is visible, so just load it. 242 // if the inner frame is visible, so just load it.
236 // TODO(dgrogan): Revisit after https://crbug.com/650433 is fixed. 243 // TODO(dgrogan): Revisit after https://crbug.com/650433 is fixed.
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 return m_documentClasses & PluginDocumentClass; 434 return m_documentClasses & PluginDocumentClass;
428 } 435 }
429 bool isMediaDocument() const { 436 bool isMediaDocument() const {
430 return m_documentClasses & MediaDocumentClass; 437 return m_documentClasses & MediaDocumentClass;
431 } 438 }
432 439
433 bool hasSVGRootNode() const; 440 bool hasSVGRootNode() const;
434 441
435 bool isFrameSet() const; 442 bool isFrameSet() const;
436 443
437 bool isSrcdocDocument() const { return m_isSrcdocDocument; } 444 bool isSrcdocDocument() const { return m_srcdocType != NotSrcdoc; }
438 bool isMobileDocument() const { return m_isMobileDocument; } 445 bool isMobileDocument() const { return m_isMobileDocument; }
439 446
440 // True if this document is an IFrame srcdoc document, and the frame in which 447 // True if this document is an IFrame srcdoc document, and the frame in which
441 // it lives was created by a fragment parser (e.g. 'innerHTML'). 448 // it lives was created by a fragment parser (e.g. 'innerHTML') or
449 // 'document.write', respectively.
442 bool isFragmentParserCreatedSrcdoc() const { 450 bool isFragmentParserCreatedSrcdoc() const {
443 return m_isFragmentParserCreatedSrcdoc; 451 return m_srcdocType == FragmentParserCreatedSrcdoc;
452 }
453 bool isDocumentWriteCreatedSrcdoc() const {
454 return m_srcdocType == DocumentWriteCreatedSrcdoc;
444 } 455 }
445 456
446 StyleResolver* styleResolver() const; 457 StyleResolver* styleResolver() const;
447 StyleResolver& ensureStyleResolver() const; 458 StyleResolver& ensureStyleResolver() const;
448 459
449 bool isViewSource() const { return m_isViewSource; } 460 bool isViewSource() const { return m_isViewSource; }
450 void setIsViewSource(bool); 461 void setIsViewSource(bool);
451 462
452 bool sawElementsInKnownNamespaces() const { 463 bool sawElementsInKnownNamespaces() const {
453 return m_sawElementsInKnownNamespaces; 464 return m_sawElementsInKnownNamespaces;
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1591 // the stack and cleared upon leaving its allocated scope. Hence it 1602 // the stack and cleared upon leaving its allocated scope. Hence it
1592 // is acceptable not to trace it -- should a conservative GC occur, 1603 // is acceptable not to trace it -- should a conservative GC occur,
1593 // the cache object's references will be traced by a stack walk. 1604 // the cache object's references will be traced by a stack walk.
1594 GC_PLUGIN_IGNORE("461878") 1605 GC_PLUGIN_IGNORE("461878")
1595 NthIndexCache* m_nthIndexCache = nullptr; 1606 NthIndexCache* m_nthIndexCache = nullptr;
1596 1607
1597 DocumentClassFlags m_documentClasses; 1608 DocumentClassFlags m_documentClasses;
1598 1609
1599 bool m_isViewSource; 1610 bool m_isViewSource;
1600 bool m_sawElementsInKnownNamespaces; 1611 bool m_sawElementsInKnownNamespaces;
1601 bool m_isSrcdocDocument; 1612 SrcdocType m_srcdocType;
1602 bool m_isMobileDocument; 1613 bool m_isMobileDocument;
1603 bool m_isFragmentParserCreatedSrcdoc; 1614 bool m_isFragmentParserCreatedSrcdoc;
1615 bool m_isDocumentWriteCreatedSrcdoc;
1604 1616
1605 LayoutView* m_layoutView; 1617 LayoutView* m_layoutView;
1606 1618
1607 WeakMember<Document> m_contextDocument; 1619 WeakMember<Document> m_contextDocument;
1608 1620
1609 // For early return in Fullscreen::fromIfExists() 1621 // For early return in Fullscreen::fromIfExists()
1610 bool m_hasFullscreenSupplement; 1622 bool m_hasFullscreenSupplement;
1611 1623
1612 HeapVector<Member<Element>> m_topLayerElements; 1624 HeapVector<Member<Element>> m_topLayerElements;
1613 1625
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1729 DEFINE_TYPE_CASTS(TreeScope, Document, document, true, true); 1741 DEFINE_TYPE_CASTS(TreeScope, Document, document, true, true);
1730 1742
1731 } // namespace blink 1743 } // namespace blink
1732 1744
1733 #ifndef NDEBUG 1745 #ifndef NDEBUG
1734 // Outside the WebCore namespace for ease of invocation from gdb. 1746 // Outside the WebCore namespace for ease of invocation from gdb.
1735 CORE_EXPORT void showLiveDocumentInstances(); 1747 CORE_EXPORT void showLiveDocumentInstances();
1736 #endif 1748 #endif
1737 1749
1738 #endif // Document_h 1750 #endif // Document_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698