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

Unified Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2845583002: Remove FrameViewBase as base class of RemoteFrameView. (Closed)
Patch Set: fix scrollbar inactive Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/frame/FrameView.cpp
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
index 2e7894507170d4f8e49a596d869de221b4e3a933..b4ee25e96b709105d75d0f783a15b94ae7f0e00d 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -243,7 +243,6 @@ DEFINE_TRACE(FrameView) {
visitor->Trace(animating_scrollable_areas_);
visitor->Trace(auto_size_info_);
visitor->Trace(children_);
- visitor->Trace(plugins_);
visitor->Trace(scrollbars_);
visitor->Trace(viewport_scrollable_area_);
visitor->Trace(visibility_observer_);
@@ -251,7 +250,6 @@ DEFINE_TRACE(FrameView) {
visitor->Trace(anchoring_adjustment_queue_);
visitor->Trace(scrollbar_manager_);
visitor->Trace(print_context_);
- FrameViewBase::Trace(visitor);
ScrollableArea::Trace(visitor);
}
@@ -380,10 +378,10 @@ void FrameView::Dispose() {
// FIXME: Do we need to do something here for OOPI?
HTMLFrameOwnerElement* owner_element = frame_->DeprecatedLocalOwner();
// TODO(dcheng): It seems buggy that we can have an owner element that points
- // to another FrameViewBase. This can happen when a plugin element loads a
- // frame (FrameViewBase A of type FrameView) and then loads a plugin
- // (FrameViewBase B of type WebPluginContainerImpl). In this case, the frame's
- // view is A and the frame element's owned FrameViewBase is B. See
+ // to another FrameOrPlugin. This can happen when a plugin element loads a
+ // frame (FrameOrPlugin A of type FrameView) and then loads a plugin
+ // (FrameOrPlugin B of type WebPluginContainerImpl). In this case, the frame's
+ // view is A and the frame element's OwnedWidget is B. See
// https://crbug.com/673170 for an example.
if (owner_element && owner_element->OwnedWidget() == this)
owner_element->SetWidget(nullptr);
@@ -504,16 +502,12 @@ void FrameView::InvalidateAllCustomScrollbarsOnActiveChanged() {
bool uses_window_inactive_selector =
frame_->GetDocument()->GetStyleEngine().UsesWindowInactiveSelector();
- const ChildrenSet* view_children = Children();
- for (const Member<FrameViewBase>& child : *view_children) {
- FrameViewBase* frame_view_base = child.Get();
- if (frame_view_base->IsFrameView()) {
- ToFrameView(frame_view_base)
- ->InvalidateAllCustomScrollbarsOnActiveChanged();
- }
+ for (const auto& child : children_) {
+ if (child->IsFrameView())
+ ToFrameView(child)->InvalidateAllCustomScrollbarsOnActiveChanged();
}
- for (const Member<Scrollbar>& scrollbar : *Scrollbars()) {
+ for (const auto& scrollbar : scrollbars_) {
if (uses_window_inactive_selector && scrollbar->IsCustomScrollbar())
scrollbar->StyleChanged();
}
@@ -1167,7 +1161,7 @@ void FrameView::ScheduleOrPerformPostLayoutTasks() {
if (!post_layout_tasks_timer_.IsActive() &&
(NeedsLayout() || in_synchronous_post_layout_)) {
// If we need layout or are already in a synchronous call to
- // postLayoutTasks(), defer FrameViewBase updates and event dispatch until
+ // postLayoutTasks(), defer FrameView updates and event dispatch until
// after we return. postLayoutTasks() can make us need to update again, and
// we can get stuck in a nasty cycle unless we call it through the timer
// here.
@@ -1524,7 +1518,7 @@ void FrameView::UpdateGeometries() {
void FrameView::AddPartToUpdate(LayoutEmbeddedObject& object) {
ASSERT(IsInPerformLayout());
- // Tell the DOM element that it needs a FrameViewBase update.
+ // Tell the DOM element that it needs a FrameView update.
Node* node = object.GetNode();
ASSERT(node);
if (isHTMLObjectElement(*node) || isHTMLEmbedElement(*node))
@@ -2048,7 +2042,7 @@ void FrameView::UpdateLayersAndCompositingAfterScrollIfNeeded() {
}
// If there fixed position elements, scrolling may cause compositing layers to
- // change. Update FrameViewBase and layer positions after scrolling, but only
+ // change. Update FrameView and layer positions after scrolling, but only
// if we're not inside of layout.
if (!nested_layout_count_) {
UpdateGeometries();
@@ -2476,8 +2470,8 @@ void FrameView::ScrollToFragmentAnchor() {
}
bool FrameView::UpdatePlugins() {
- // This is always called from updatePluginsTimerFired.
- // m_updatePluginsTimer should only be scheduled if we have FrameViewBases to
+ // This is always called from UpdatePluginsTimerFired.
+ // update_plugins_timer should only be scheduled if we have FrameViews to
// update. Thus I believe we can stop checking isEmpty here, and just ASSERT
// isEmpty:
// FIXME: This assert has been temporarily removed due to
@@ -3395,8 +3389,9 @@ void FrameView::UpdateStyleAndLayoutIfNeededRecursiveInternal() {
// TODO(leviw): This currently runs the entire lifecycle on plugin WebViews.
// We should have a way to only run these other Documents to the same
// lifecycle stage as this frame.
- for (const Member<PluginView>& plugin : *Plugins()) {
- plugin->UpdateAllLifecyclePhases();
+ for (const auto& child : children_) {
+ if (child->IsPluginView())
+ ToPluginView(child)->UpdateAllLifecyclePhases();
}
CheckDoesNotNeedLayout();
@@ -3648,15 +3643,15 @@ IntPoint FrameView::ConvertToLayoutItem(const LayoutItem& layout_item,
return RoundedIntPoint(layout_item.AbsoluteToLocal(point, kUseTransforms));
}
-IntPoint FrameView::ConvertSelfToChild(const FrameViewBase* child,
+IntPoint FrameView::ConvertSelfToChild(const IntPoint& child_location,
const IntPoint& point) const {
IntPoint new_point = point;
new_point = FrameToContents(point);
- new_point.MoveBy(-child->Location());
+ new_point.MoveBy(-child_location);
return new_point;
}
-IntRect FrameView::ConvertToContainingFrameViewBase(
+IntRect FrameView::ConvertToContainingFrameView(
const IntRect& local_rect) const {
if (parent_) {
// Get our layoutObject in the parent view
@@ -3674,19 +3669,19 @@ IntRect FrameView::ConvertToContainingFrameViewBase(
return local_rect;
}
-IntRect FrameView::ConvertFromContainingFrameViewBase(
+IntRect FrameView::ConvertFromContainingFrameView(
const IntRect& parent_rect) const {
if (parent_) {
IntRect local_rect = parent_rect;
local_rect.SetLocation(
- parent_->ConvertSelfToChild(this, local_rect.Location()));
+ parent_->ConvertSelfToChild(Location(), local_rect.Location()));
return local_rect;
}
return parent_rect;
}
-IntPoint FrameView::ConvertToContainingFrameViewBase(
+IntPoint FrameView::ConvertToContainingFrameView(
const IntPoint& local_point) const {
if (parent_) {
// Get our layoutObject in the parent view
@@ -3705,7 +3700,7 @@ IntPoint FrameView::ConvertToContainingFrameViewBase(
return local_point;
}
-IntPoint FrameView::ConvertFromContainingFrameViewBase(
+IntPoint FrameView::ConvertFromContainingFrameView(
const IntPoint& parent_point) const {
if (parent_) {
// Get our layoutObject in the parent view
@@ -3846,12 +3841,11 @@ void FrameView::RemoveAnimatingScrollableArea(ScrollableArea* scrollable_area) {
FrameView* FrameView::Root() const {
const FrameView* top = this;
while (top->Parent())
- top = ToFrameView(top->Parent());
+ top = top->Parent();
return const_cast<FrameView*>(top);
}
-void FrameView::SetParent(FrameViewBase* parent_frame_view_base) {
- FrameView* parent = ToFrameView(parent_frame_view_base);
+void FrameView::SetParent(FrameView* parent) {
if (parent == parent_)
return;
@@ -3869,7 +3863,13 @@ void FrameView::SetParent(FrameViewBase* parent_frame_view_base) {
subtree_throttled_ = ParentFrameView()->CanThrottleRendering();
}
-void FrameView::RemoveChild(FrameViewBase* child) {
+void FrameView::AddChild(FrameOrPlugin* child) {
+ DCHECK(child != this && !child->Parent());
+ child->SetParent(this);
+ children_.insert(child);
+}
+
+void FrameView::RemoveChild(FrameOrPlugin* child) {
DCHECK(child->Parent() == this);
if (child->IsFrameView() &&
@@ -3880,20 +3880,6 @@ void FrameView::RemoveChild(FrameViewBase* child) {
children_.erase(child);
}
-void FrameView::RemovePlugin(PluginView* plugin) {
- DCHECK(plugin->Parent() == this);
- DCHECK(plugins_.Contains(plugin));
- plugin->SetParent(nullptr);
- plugins_.erase(plugin);
-}
-
-void FrameView::AddPlugin(PluginView* plugin) {
- DCHECK(!plugin->Parent());
- DCHECK(!plugins_.Contains(plugin));
- plugin->SetParent(this);
- plugins_.insert(plugin);
-}
-
void FrameView::RemoveScrollbar(Scrollbar* scrollbar) {
DCHECK(scrollbars_.Contains(scrollbar));
scrollbar->SetParent(nullptr);
@@ -3942,9 +3928,6 @@ void FrameView::FrameRectsChanged() {
for (const auto& child : children_)
child->FrameRectsChanged();
-
- for (const auto& plugin : plugins_)
- plugin->FrameRectsChanged();
}
void FrameView::SetLayoutSizeInternal(const IntSize& size) {
@@ -3994,12 +3977,6 @@ IntSize FrameView::MaximumScrollOffsetInt() const {
return maximum_offset.ExpandedTo(MinimumScrollOffsetInt());
}
-void FrameView::AddChild(FrameViewBase* child) {
- DCHECK(child != this && !child->Parent());
- child->SetParent(this);
- children_.insert(child);
-}
-
void FrameView::SetScrollbarModes(ScrollbarMode horizontal_mode,
ScrollbarMode vertical_mode,
bool horizontal_lock,
@@ -4448,7 +4425,7 @@ void FrameView::ScrollContents(const IntSize& scroll_delta) {
SetNeedsPaintPropertyUpdate();
}
- // This call will move children with native FrameViewBases (plugins) and
+ // This call will move children with native FrameViews (plugins) and
// invalidate them as well.
FrameRectsChanged();
}
@@ -4750,7 +4727,7 @@ bool FrameView::ScrollbarCornerPresent() const {
IntRect FrameView::ConvertToRootFrame(const IntRect& local_rect) const {
if (parent_) {
- IntRect parent_rect = ConvertToContainingFrameViewBase(local_rect);
+ IntRect parent_rect = ConvertToContainingFrameView(local_rect);
return parent_->ConvertToRootFrame(parent_rect);
}
return local_rect;
@@ -4758,13 +4735,13 @@ IntRect FrameView::ConvertToRootFrame(const IntRect& local_rect) const {
IntPoint FrameView::ConvertToRootFrame(const IntPoint& local_point) const {
if (parent_) {
- IntPoint parent_point = ConvertToContainingFrameViewBase(local_point);
+ IntPoint parent_point = ConvertToContainingFrameView(local_point);
return parent_->ConvertToRootFrame(parent_point);
}
return local_point;
}
-IntPoint FrameView::ConvertFromContainingFrameViewBaseToScrollbar(
+IntPoint FrameView::ConvertFromContainingFrameViewToScrollbar(
const Scrollbar& scrollbar,
const IntPoint& parent_point) const {
IntPoint new_point = parent_point;
@@ -4795,9 +4772,6 @@ void FrameView::SetParentVisible(bool visible) {
for (const auto& child : children_)
child->SetParentVisible(visible);
-
- for (const auto& plugin : plugins_)
- plugin->SetParentVisible(visible);
}
void FrameView::Show() {
@@ -4818,9 +4792,6 @@ void FrameView::Show() {
if (IsParentVisible()) {
for (const auto& child : children_)
child->SetParentVisible(true);
-
- for (const auto& plugin : plugins_)
- plugin->SetParentVisible(true);
}
}
}
@@ -4830,9 +4801,6 @@ void FrameView::Hide() {
if (IsParentVisible()) {
for (const auto& child : children_)
child->SetParentVisible(false);
-
- for (const auto& plugin : plugins_)
- plugin->SetParentVisible(false);
}
SetSelfVisible(false);
if (ScrollingCoordinator* scrolling_coordinator =
@@ -4899,11 +4867,11 @@ void FrameView::CollectAnnotatedRegions(
void FrameView::UpdateViewportIntersectionsForSubtree(
DocumentLifecycle::LifecycleState target_state) {
- // TODO(dcheng): Since FrameViewBase tree updates are deferred, FrameViews
- // might still be in the FrameViewBase hierarchy even though the associated
+ // TODO(dcheng): Since FrameView tree updates are deferred, FrameViews
+ // might still be in the FrameView hierarchy even though the associated
// Document is already detached. Investigate if this check and a similar check
// in lifecycle updates are still needed when there are no more deferred
- // FrameViewBase updates: https://crbug.com/561683
+ // FrameView updates: https://crbug.com/561683
if (!GetFrame().GetDocument()->IsActive())
return;
@@ -4979,11 +4947,10 @@ void FrameView::UpdateRenderThrottlingStatus(
(was_throttled != is_throttled ||
force_throttling_invalidation_behavior ==
kForceThrottlingInvalidation)) {
- for (const Member<FrameViewBase>& child : *Children()) {
+ for (const auto& child : children_) {
if (child->IsFrameView()) {
- FrameView* child_view = ToFrameView(child);
- child_view->UpdateRenderThrottlingStatus(
- child_view->hidden_for_throttling_, is_throttled);
+ ToFrameView(child)->UpdateRenderThrottlingStatus(
+ ToFrameView(child)->hidden_for_throttling_, is_throttled);
}
}
}

Powered by Google App Engine
This is Rietveld 408576698