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

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

Issue 2888203006: Move the logic to retrieve the WebPluginContainer to LocalFrame and Node. (Closed)
Patch Set: Address code review comments. Created 3 years, 7 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 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 * rights reserved. 6 * rights reserved.
7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * 10 *
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 #include "core/frame/EventHandlerRegistry.h" 83 #include "core/frame/EventHandlerRegistry.h"
84 #include "core/frame/FrameView.h" 84 #include "core/frame/FrameView.h"
85 #include "core/frame/LocalDOMWindow.h" 85 #include "core/frame/LocalDOMWindow.h"
86 #include "core/frame/LocalFrame.h" 86 #include "core/frame/LocalFrame.h"
87 #include "core/frame/UseCounter.h" 87 #include "core/frame/UseCounter.h"
88 #include "core/html/HTMLDialogElement.h" 88 #include "core/html/HTMLDialogElement.h"
89 #include "core/html/HTMLFrameOwnerElement.h" 89 #include "core/html/HTMLFrameOwnerElement.h"
90 #include "core/html/HTMLSlotElement.h" 90 #include "core/html/HTMLSlotElement.h"
91 #include "core/input/EventHandler.h" 91 #include "core/input/EventHandler.h"
92 #include "core/layout/LayoutBox.h" 92 #include "core/layout/LayoutBox.h"
93 #include "core/layout/LayoutPart.h"
93 #include "core/page/ContextMenuController.h" 94 #include "core/page/ContextMenuController.h"
94 #include "core/page/Page.h" 95 #include "core/page/Page.h"
96 #include "core/plugins/PluginView.h"
95 #include "core/svg/SVGElement.h" 97 #include "core/svg/SVGElement.h"
96 #include "core/svg/graphics/SVGImage.h" 98 #include "core/svg/graphics/SVGImage.h"
97 #include "platform/EventDispatchForbiddenScope.h" 99 #include "platform/EventDispatchForbiddenScope.h"
98 #include "platform/InstanceCounters.h" 100 #include "platform/InstanceCounters.h"
99 #include "platform/RuntimeEnabledFeatures.h" 101 #include "platform/RuntimeEnabledFeatures.h"
100 #include "platform/bindings/DOMDataStore.h" 102 #include "platform/bindings/DOMDataStore.h"
101 #include "platform/bindings/Microtask.h" 103 #include "platform/bindings/Microtask.h"
102 #include "platform/bindings/ScriptWrappableVisitor.h" 104 #include "platform/bindings/ScriptWrappableVisitor.h"
103 #include "platform/bindings/V8DOMWrapper.h" 105 #include "platform/bindings/V8DOMWrapper.h"
104 #include "platform/instrumentation/tracing/TraceEvent.h" 106 #include "platform/instrumentation/tracing/TraceEvent.h"
(...skipping 2467 matching lines...) Expand 10 before | Expand all | Expand 10 after
2572 HTMLSlotElement& parent_slot = toHTMLSlotElement(*parent); 2574 HTMLSlotElement& parent_slot = toHTMLSlotElement(*parent);
2573 // TODO(hayato): Support slotchange for slots in non-shadow trees. 2575 // TODO(hayato): Support slotchange for slots in non-shadow trees.
2574 if (ShadowRoot* root = ContainingShadowRoot()) { 2576 if (ShadowRoot* root = ContainingShadowRoot()) {
2575 if (root && root->IsV1() && !parent_slot.HasAssignedNodesSlow()) 2577 if (root && root->IsV1() && !parent_slot.HasAssignedNodesSlow())
2576 parent_slot.DidSlotChange(slot_change_type); 2578 parent_slot.DidSlotChange(slot_change_type);
2577 } 2579 }
2578 } 2580 }
2579 } 2581 }
2580 } 2582 }
2581 2583
2584 WebPluginContainerBase* Node::GetWebPluginContainerBase() const {
2585 if (!isHTMLObjectElement(this) && !isHTMLEmbedElement(this)) {
haraken 2017/05/22 04:51:44 Can we probably use isHTMLPluginElement()?
slangley 2017/05/22 23:53:25 If possible, i'd rather this change be purely mech
2586 return nullptr;
2587 }
2588
2589 LayoutObject* object = GetLayoutObject();
2590 if (object && object->IsLayoutPart()) {
2591 PluginView* plugin = ToLayoutPart(object)->Plugin();
2592 if (plugin) {
2593 return plugin->GetWebPluginContainerBase();
2594 }
2595 }
2596
2597 return nullptr;
2598 }
2599
2582 DEFINE_TRACE(Node) { 2600 DEFINE_TRACE(Node) {
2583 visitor->Trace(parent_or_shadow_host_node_); 2601 visitor->Trace(parent_or_shadow_host_node_);
2584 visitor->Trace(previous_); 2602 visitor->Trace(previous_);
2585 visitor->Trace(next_); 2603 visitor->Trace(next_);
2586 // rareData() and m_data.m_layoutObject share their storage. We have to trace 2604 // rareData() and m_data.m_layoutObject share their storage. We have to trace
2587 // only one of them. 2605 // only one of them.
2588 if (HasRareData()) 2606 if (HasRareData())
2589 visitor->Trace(RareData()); 2607 visitor->Trace(RareData());
2590 2608
2591 visitor->Trace(tree_scope_); 2609 visitor->Trace(tree_scope_);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2623 if (node) { 2641 if (node) {
2624 std::stringstream stream; 2642 std::stringstream stream;
2625 node->PrintNodePathTo(stream); 2643 node->PrintNodePathTo(stream);
2626 LOG(INFO) << stream.str(); 2644 LOG(INFO) << stream.str();
2627 } else { 2645 } else {
2628 LOG(INFO) << "Cannot showNodePath for <null>"; 2646 LOG(INFO) << "Cannot showNodePath for <null>";
2629 } 2647 }
2630 } 2648 }
2631 2649
2632 #endif 2650 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698