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

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

Issue 2943983003: chrome/blink: Add functionality for in-product help for media elements. (Closed)
Patch Set: Created 3 years, 6 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, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 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) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 #include "core/dom/Element.h" 76 #include "core/dom/Element.h"
77 #include "core/dom/ElementCreationOptions.h" 77 #include "core/dom/ElementCreationOptions.h"
78 #include "core/dom/ElementDataCache.h" 78 #include "core/dom/ElementDataCache.h"
79 #include "core/dom/ElementRegistrationOptions.h" 79 #include "core/dom/ElementRegistrationOptions.h"
80 #include "core/dom/ElementTraversal.h" 80 #include "core/dom/ElementTraversal.h"
81 #include "core/dom/ExceptionCode.h" 81 #include "core/dom/ExceptionCode.h"
82 #include "core/dom/FrameRequestCallback.h" 82 #include "core/dom/FrameRequestCallback.h"
83 #include "core/dom/IntersectionObserverController.h" 83 #include "core/dom/IntersectionObserverController.h"
84 #include "core/dom/LayoutTreeBuilderTraversal.h" 84 #include "core/dom/LayoutTreeBuilderTraversal.h"
85 #include "core/dom/LiveNodeList.h" 85 #include "core/dom/LiveNodeList.h"
86 #include "core/dom/MediaIPHManager.h"
86 #include "core/dom/MutationObserver.h" 87 #include "core/dom/MutationObserver.h"
87 #include "core/dom/NodeChildRemovalTracker.h" 88 #include "core/dom/NodeChildRemovalTracker.h"
88 #include "core/dom/NodeComputedStyle.h" 89 #include "core/dom/NodeComputedStyle.h"
89 #include "core/dom/NodeFilter.h" 90 #include "core/dom/NodeFilter.h"
90 #include "core/dom/NodeIterator.h" 91 #include "core/dom/NodeIterator.h"
91 #include "core/dom/NodeRareData.h" 92 #include "core/dom/NodeRareData.h"
92 #include "core/dom/NodeTraversal.h" 93 #include "core/dom/NodeTraversal.h"
93 #include "core/dom/NodeWithIndex.h" 94 #include "core/dom/NodeWithIndex.h"
94 #include "core/dom/NthIndexCache.h" 95 #include "core/dom/NthIndexCache.h"
95 #include "core/dom/ProcessingInstruction.h" 96 #include "core/dom/ProcessingInstruction.h"
(...skipping 2201 matching lines...) Expand 10 before | Expand all | Expand 10 after
2297 // beginFrame? This will catch the first layout in a page that does lots 2298 // beginFrame? This will catch the first layout in a page that does lots
2298 // of layout thrashing even though that layout might not be followed by 2299 // of layout thrashing even though that layout might not be followed by
2299 // a paint for many seconds. 2300 // a paint for many seconds.
2300 if (IsRenderingReady() && body() && 2301 if (IsRenderingReady() && body() &&
2301 !GetStyleEngine().HasPendingScriptBlockingSheets()) { 2302 !GetStyleEngine().HasPendingScriptBlockingSheets()) {
2302 if (!document_timing_.FirstLayout()) 2303 if (!document_timing_.FirstLayout())
2303 document_timing_.MarkFirstLayout(); 2304 document_timing_.MarkFirstLayout();
2304 } 2305 }
2305 2306
2306 root_scroller_controller_->DidUpdateLayout(); 2307 root_scroller_controller_->DidUpdateLayout();
2308 if (media_iph_manager_)
2309 media_iph_manager_->LayoutUpdated();
2307 } 2310 }
2308 2311
2309 void Document::ClearFocusedElementSoon() { 2312 void Document::ClearFocusedElementSoon() {
2310 if (!clear_focused_element_timer_.IsActive()) 2313 if (!clear_focused_element_timer_.IsActive())
2311 clear_focused_element_timer_.StartOneShot(0, BLINK_FROM_HERE); 2314 clear_focused_element_timer_.StartOneShot(0, BLINK_FROM_HERE);
2312 } 2315 }
2313 2316
2314 void Document::ClearFocusedElementTimerFired(TimerBase*) { 2317 void Document::ClearFocusedElementTimerFired(TimerBase*) {
2315 UpdateStyleAndLayoutTree(); 2318 UpdateStyleAndLayoutTree();
2316 2319
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
2670 // a contextDestroyed() notification. This can happen for a document 2673 // a contextDestroyed() notification. This can happen for a document
2671 // created by DOMImplementation::createDocument(). 2674 // created by DOMImplementation::createDocument().
2672 ExecutionContext::NotifyContextDestroyed(); 2675 ExecutionContext::NotifyContextDestroyed();
2673 2676
2674 // This is required, as our LocalFrame might delete itself as soon as it 2677 // This is required, as our LocalFrame might delete itself as soon as it
2675 // detaches us. However, this violates Node::detachLayoutTree() semantics, as 2678 // detaches us. However, this violates Node::detachLayoutTree() semantics, as
2676 // it's never possible to re-attach. Eventually Document::detachLayoutTree() 2679 // it's never possible to re-attach. Eventually Document::detachLayoutTree()
2677 // should be renamed, or this setting of the frame to 0 could be made 2680 // should be renamed, or this setting of the frame to 0 could be made
2678 // explicit in each of the callers of Document::detachLayoutTree(). 2681 // explicit in each of the callers of Document::detachLayoutTree().
2679 frame_ = nullptr; 2682 frame_ = nullptr;
2683
2684 media_iph_manager_ = nullptr;
2680 } 2685 }
2681 2686
2682 void Document::RemoveAllEventListeners() { 2687 void Document::RemoveAllEventListeners() {
2683 ContainerNode::RemoveAllEventListeners(); 2688 ContainerNode::RemoveAllEventListeners();
2684 2689
2685 if (LocalDOMWindow* dom_window = this->domWindow()) 2690 if (LocalDOMWindow* dom_window = this->domWindow())
2686 dom_window->RemoveAllEventListeners(); 2691 dom_window->RemoveAllEventListeners();
2687 } 2692 }
2688 2693
2689 Document& Document::AxObjectCacheOwner() const { 2694 Document& Document::AxObjectCacheOwner() const {
(...skipping 4097 matching lines...) Expand 10 before | Expand all | Expand 10 after
6787 SendSensitiveInputVisibility(); 6792 SendSensitiveInputVisibility();
6788 } 6793 }
6789 6794
6790 CoreProbeSink* Document::GetProbeSink() { 6795 CoreProbeSink* Document::GetProbeSink() {
6791 LocalFrame* frame = GetFrame(); 6796 LocalFrame* frame = GetFrame();
6792 if (!frame && TemplateDocumentHost()) 6797 if (!frame && TemplateDocumentHost())
6793 frame = TemplateDocumentHost()->GetFrame(); 6798 frame = TemplateDocumentHost()->GetFrame();
6794 return probe::ToCoreProbeSink(frame); 6799 return probe::ToCoreProbeSink(frame);
6795 } 6800 }
6796 6801
6802 MediaIPHManager* Document::GetMediaIPHManager() {
6803 if (!media_iph_manager_ && GetFrame()) {
6804 std::unique_ptr<WebMediaIPH> media_iph(
6805 GetFrame()->GetPage()->GetChromeClient().CreateWebMediaIPH(GetFrame()));
6806 if (media_iph)
6807 media_iph_manager_ = MediaIPHManager::Create(std::move(media_iph));
6808 }
6809
6810 return media_iph_manager_;
6811 }
6812
6797 DEFINE_TRACE(Document) { 6813 DEFINE_TRACE(Document) {
6798 visitor->Trace(imports_controller_); 6814 visitor->Trace(imports_controller_);
6799 visitor->Trace(doc_type_); 6815 visitor->Trace(doc_type_);
6800 visitor->Trace(implementation_); 6816 visitor->Trace(implementation_);
6801 visitor->Trace(autofocus_element_); 6817 visitor->Trace(autofocus_element_);
6802 visitor->Trace(focused_element_); 6818 visitor->Trace(focused_element_);
6803 visitor->Trace(sequential_focus_navigation_starting_point_); 6819 visitor->Trace(sequential_focus_navigation_starting_point_);
6804 visitor->Trace(hover_element_); 6820 visitor->Trace(hover_element_);
6805 visitor->Trace(active_hover_element_); 6821 visitor->Trace(active_hover_element_);
6806 visitor->Trace(document_element_); 6822 visitor->Trace(document_element_);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
6843 visitor->Trace(svg_extensions_); 6859 visitor->Trace(svg_extensions_);
6844 visitor->Trace(timeline_); 6860 visitor->Trace(timeline_);
6845 visitor->Trace(compositor_pending_animations_); 6861 visitor->Trace(compositor_pending_animations_);
6846 visitor->Trace(context_document_); 6862 visitor->Trace(context_document_);
6847 visitor->Trace(canvas_font_cache_); 6863 visitor->Trace(canvas_font_cache_);
6848 visitor->Trace(intersection_observer_controller_); 6864 visitor->Trace(intersection_observer_controller_);
6849 visitor->Trace(snap_coordinator_); 6865 visitor->Trace(snap_coordinator_);
6850 visitor->Trace(resize_observer_controller_); 6866 visitor->Trace(resize_observer_controller_);
6851 visitor->Trace(property_registry_); 6867 visitor->Trace(property_registry_);
6852 visitor->Trace(network_state_observer_); 6868 visitor->Trace(network_state_observer_);
6869 visitor->Trace(media_iph_manager_);
6853 Supplementable<Document>::Trace(visitor); 6870 Supplementable<Document>::Trace(visitor);
6854 TreeScope::Trace(visitor); 6871 TreeScope::Trace(visitor);
6855 ContainerNode::Trace(visitor); 6872 ContainerNode::Trace(visitor);
6856 ExecutionContext::Trace(visitor); 6873 ExecutionContext::Trace(visitor);
6857 SecurityContext::Trace(visitor); 6874 SecurityContext::Trace(visitor);
6858 SynchronousMutationNotifier::Trace(visitor); 6875 SynchronousMutationNotifier::Trace(visitor);
6859 } 6876 }
6860 6877
6861 void Document::RecordDeferredLoadReason(WouldLoadReason reason) { 6878 void Document::RecordDeferredLoadReason(WouldLoadReason reason) {
6862 DCHECK(would_load_reason_ == WouldLoadReason::kInvalid || 6879 DCHECK(would_load_reason_ == WouldLoadReason::kInvalid ||
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
6900 } 6917 }
6901 6918
6902 void showLiveDocumentInstances() { 6919 void showLiveDocumentInstances() {
6903 WeakDocumentSet& set = liveDocumentSet(); 6920 WeakDocumentSet& set = liveDocumentSet();
6904 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6921 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6905 for (blink::Document* document : set) 6922 for (blink::Document* document : set)
6906 fprintf(stderr, "- Document %p URL: %s\n", document, 6923 fprintf(stderr, "- Document %p URL: %s\n", document,
6907 document->Url().GetString().Utf8().data()); 6924 document->Url().GetString().Utf8().data());
6908 } 6925 }
6909 #endif 6926 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698