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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutPart.cpp

Issue 2845583002: Remove FrameViewBase as base class of RemoteFrameView. (Closed)
Patch Set: ConvertSelfToChild take FrameOrPlugin as arg 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) 2000 Simon Hausmann <hausmann@kde.org> 3 * (C) 2000 Simon Hausmann <hausmann@kde.org>
4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de)
5 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 59
60 void LayoutPart::WillBeDestroyed() { 60 void LayoutPart::WillBeDestroyed() {
61 GetFrameView()->RemovePart(this); 61 GetFrameView()->RemovePart(this);
62 62
63 if (AXObjectCache* cache = GetDocument().ExistingAXObjectCache()) { 63 if (AXObjectCache* cache = GetDocument().ExistingAXObjectCache()) {
64 cache->ChildrenChanged(this->Parent()); 64 cache->ChildrenChanged(this->Parent());
65 cache->Remove(this); 65 cache->Remove(this);
66 } 66 }
67 67
68 Element* element = ToElement(GetNode()); 68 Node* node = GetNode();
69 if (element && element->IsFrameOwnerElement()) 69 if (node && node->IsFrameOwnerElement())
70 ToHTMLFrameOwnerElement(element)->SetWidget(nullptr); 70 ToHTMLFrameOwnerElement(node)->SetWidget(nullptr);
71 71
72 LayoutReplaced::WillBeDestroyed(); 72 LayoutReplaced::WillBeDestroyed();
73 } 73 }
74 74
75 void LayoutPart::Destroy() { 75 void LayoutPart::Destroy() {
76 WillBeDestroyed(); 76 WillBeDestroyed();
77 // We call clearNode here because LayoutPart is ref counted. This call to 77 // We call clearNode here because LayoutPart is ref counted. This call to
78 // destroy may not actually destroy the layout object. We can keep it around 78 // destroy may not actually destroy the layout object. We can keep it around
79 // because of references from the FrameView class. (The actual destruction of 79 // because of references from the FrameView class. (The actual destruction of
80 // the class happens in postDestroy() which is called from deref()). 80 // the class happens in postDestroy() which is called from deref()).
81 // 81 //
82 // But, we've told the system we've destroyed the layoutObject, which happens 82 // But, we've told the system we've destroyed the layoutObject, which happens
83 // when the DOM node is destroyed. So there is a good change the DOM node this 83 // when the DOM node is destroyed. So there is a good change the DOM node this
84 // object points too is invalid, so we have to clear the node so we make sure 84 // object points too is invalid, so we have to clear the node so we make sure
85 // we don't access it in the future. 85 // we don't access it in the future.
86 ClearNode(); 86 ClearNode();
87 Deref(); 87 Deref();
88 } 88 }
89 89
90 LayoutPart::~LayoutPart() { 90 LayoutPart::~LayoutPart() {
91 DCHECK_LE(ref_count_, 0); 91 DCHECK_LE(ref_count_, 0);
92 } 92 }
93 93
94 FrameView* LayoutPart::ChildFrameView() const { 94 FrameView* LayoutPart::ChildFrameView() const {
95 // FrameViews are stored in HTMLFrameOwnerElement node. 95 FrameOrPlugin* frame_or_plugin = GetFrameOrPlugin();
96 Node* node = GetNode(); 96 if (frame_or_plugin && frame_or_plugin->IsFrameView())
97 if (node && node->IsFrameOwnerElement()) { 97 return ToFrameView(frame_or_plugin);
98 FrameViewBase* frame_view_base =
99 ToHTMLFrameOwnerElement(node)->OwnedWidget();
100 if (frame_view_base && frame_view_base->IsFrameView())
101 return ToFrameView(frame_view_base);
102 }
103 return nullptr; 98 return nullptr;
104 } 99 }
105 100
106 PluginView* LayoutPart::Plugin() const { 101 PluginView* LayoutPart::Plugin() const {
107 // Plugins are stored in HTMLPlugInElement node. 102 FrameOrPlugin* frame_or_plugin = GetFrameOrPlugin();
108 Node* node = GetNode(); 103 if (frame_or_plugin && frame_or_plugin->IsPluginView())
109 return node && IsHTMLPlugInElement(node) ? ToHTMLPlugInElement(node)->Plugin() 104 return ToPluginView(frame_or_plugin);
110 : nullptr; 105 return nullptr;
111 } 106 }
112 107
113 FrameOrPlugin* LayoutPart::GetFrameOrPlugin() const { 108 FrameOrPlugin* LayoutPart::GetFrameOrPlugin() const {
114 Node* node = GetNode(); 109 Node* node = GetNode();
115 if (node && node->IsFrameOwnerElement()) { 110 if (node && node->IsFrameOwnerElement())
116 FrameViewBase* frame_view_base = 111 return ToHTMLFrameOwnerElement(node)->OwnedWidget();
117 ToHTMLFrameOwnerElement(node)->OwnedWidget(); 112 return nullptr;
118 if (frame_view_base) {
119 if (frame_view_base->IsFrameView())
120 return ToFrameView(frame_view_base);
121 if (frame_view_base->IsRemoteFrameView())
122 return ToRemoteFrameView(frame_view_base);
123 // Must be either FrameView or RemoteFrameView.
124 NOTREACHED();
125 }
126 }
127 return Plugin();
128 } 113 }
129 114
130 PaintLayerType LayoutPart::LayerTypeRequired() const { 115 PaintLayerType LayoutPart::LayerTypeRequired() const {
131 PaintLayerType type = LayoutReplaced::LayerTypeRequired(); 116 PaintLayerType type = LayoutReplaced::LayerTypeRequired();
132 if (type != kNoPaintLayer) 117 if (type != kNoPaintLayer)
133 return type; 118 return type;
134 return kForcedPaintLayer; 119 return kForcedPaintLayer;
135 } 120 }
136 121
137 bool LayoutPart::RequiresAcceleratedCompositing() const { 122 bool LayoutPart::RequiresAcceleratedCompositing() const {
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 LayoutReplaced::DeprecatedInvalidatePaintOfSubtrees(paint_invalidation_state); 405 LayoutReplaced::DeprecatedInvalidatePaintOfSubtrees(paint_invalidation_state);
421 } 406 }
422 407
423 bool LayoutPart::IsThrottledFrameView() const { 408 bool LayoutPart::IsThrottledFrameView() const {
424 if (FrameView* frame_view = ChildFrameView()) 409 if (FrameView* frame_view = ChildFrameView())
425 return frame_view->ShouldThrottleRendering(); 410 return frame_view->ShouldThrottleRendering();
426 return false; 411 return false;
427 } 412 }
428 413
429 } // namespace blink 414 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698