Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/LayoutPart.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/LayoutPart.cpp b/third_party/WebKit/Source/core/layout/LayoutPart.cpp |
| index 5caf85440e2ac78adf0ca76f59fb5f6da0475105..f47a71fa2583d3ee092cfe1c46b0ad39fc658e06 100644 |
| --- a/third_party/WebKit/Source/core/layout/LayoutPart.cpp |
| +++ b/third_party/WebKit/Source/core/layout/LayoutPart.cpp |
| @@ -65,9 +65,9 @@ void LayoutPart::WillBeDestroyed() { |
| cache->Remove(this); |
| } |
| - Element* element = ToElement(GetNode()); |
| - if (element && element->IsFrameOwnerElement()) |
| - ToHTMLFrameOwnerElement(element)->SetWidget(nullptr); |
| + Node* node = GetNode(); |
|
dcheng
2017/05/09 07:50:51
A separate cleanup for this would be nice in the f
joelhockey
2017/05/10 02:35:43
Do you mean fixing the attach / detach / dispose f
dcheng
2017/05/10 07:08:28
I just meant that the changes on lines 68-70 are a
joelhockey
2017/05/10 09:40:46
ack
|
| + if (node && node->IsFrameOwnerElement()) |
| + ToHTMLFrameOwnerElement(node)->SetWidget(nullptr); |
| LayoutReplaced::WillBeDestroyed(); |
| } |
| @@ -92,39 +92,24 @@ LayoutPart::~LayoutPart() { |
| } |
| FrameView* LayoutPart::ChildFrameView() const { |
| - // FrameViews are stored in HTMLFrameOwnerElement node. |
| - Node* node = GetNode(); |
| - if (node && node->IsFrameOwnerElement()) { |
| - FrameViewBase* frame_view_base = |
| - ToHTMLFrameOwnerElement(node)->OwnedWidget(); |
| - if (frame_view_base && frame_view_base->IsFrameView()) |
| - return ToFrameView(frame_view_base); |
| - } |
| + FrameOrPlugin* frame_or_plugin = GetFrameOrPlugin(); |
| + if (frame_or_plugin && frame_or_plugin->IsFrameView()) |
| + return ToFrameView(frame_or_plugin); |
| return nullptr; |
| } |
| PluginView* LayoutPart::Plugin() const { |
| - // Plugins are stored in HTMLPlugInElement node. |
| - Node* node = GetNode(); |
| - return node && IsHTMLPlugInElement(node) ? ToHTMLPlugInElement(node)->Plugin() |
| - : nullptr; |
| + FrameOrPlugin* frame_or_plugin = GetFrameOrPlugin(); |
| + if (frame_or_plugin && frame_or_plugin->IsPluginView()) |
| + return ToPluginView(frame_or_plugin); |
| + return nullptr; |
| } |
| FrameOrPlugin* LayoutPart::GetFrameOrPlugin() const { |
| Node* node = GetNode(); |
| - if (node && node->IsFrameOwnerElement()) { |
| - FrameViewBase* frame_view_base = |
| - ToHTMLFrameOwnerElement(node)->OwnedWidget(); |
| - if (frame_view_base) { |
| - if (frame_view_base->IsFrameView()) |
| - return ToFrameView(frame_view_base); |
| - if (frame_view_base->IsRemoteFrameView()) |
| - return ToRemoteFrameView(frame_view_base); |
| - // Must be either FrameView or RemoteFrameView. |
| - NOTREACHED(); |
| - } |
| - } |
| - return Plugin(); |
| + if (node && node->IsFrameOwnerElement()) |
| + return ToHTMLFrameOwnerElement(node)->OwnedWidget(); |
| + return nullptr; |
| } |
| PaintLayerType LayoutPart::LayerTypeRequired() const { |