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

Side by Side 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, 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) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 236 }
237 237
238 DEFINE_TRACE(FrameView) { 238 DEFINE_TRACE(FrameView) {
239 visitor->Trace(frame_); 239 visitor->Trace(frame_);
240 visitor->Trace(parent_); 240 visitor->Trace(parent_);
241 visitor->Trace(fragment_anchor_); 241 visitor->Trace(fragment_anchor_);
242 visitor->Trace(scrollable_areas_); 242 visitor->Trace(scrollable_areas_);
243 visitor->Trace(animating_scrollable_areas_); 243 visitor->Trace(animating_scrollable_areas_);
244 visitor->Trace(auto_size_info_); 244 visitor->Trace(auto_size_info_);
245 visitor->Trace(children_); 245 visitor->Trace(children_);
246 visitor->Trace(plugins_);
247 visitor->Trace(scrollbars_); 246 visitor->Trace(scrollbars_);
248 visitor->Trace(viewport_scrollable_area_); 247 visitor->Trace(viewport_scrollable_area_);
249 visitor->Trace(visibility_observer_); 248 visitor->Trace(visibility_observer_);
250 visitor->Trace(scroll_anchor_); 249 visitor->Trace(scroll_anchor_);
251 visitor->Trace(anchoring_adjustment_queue_); 250 visitor->Trace(anchoring_adjustment_queue_);
252 visitor->Trace(scrollbar_manager_); 251 visitor->Trace(scrollbar_manager_);
253 visitor->Trace(print_context_); 252 visitor->Trace(print_context_);
254 FrameViewBase::Trace(visitor);
255 ScrollableArea::Trace(visitor); 253 ScrollableArea::Trace(visitor);
256 } 254 }
257 255
258 void FrameView::Reset() { 256 void FrameView::Reset() {
259 // The compositor throttles the main frame using deferred commits, we can't 257 // The compositor throttles the main frame using deferred commits, we can't
260 // throttle it here or it seems the root compositor doesn't get setup 258 // throttle it here or it seems the root compositor doesn't get setup
261 // properly. 259 // properly.
262 if (RuntimeEnabledFeatures:: 260 if (RuntimeEnabledFeatures::
263 renderingPipelineThrottlingLoadingIframesEnabled()) 261 renderingPipelineThrottlingLoadingIframesEnabled())
264 lifecycle_updates_throttled_ = !GetFrame().IsMainFrame(); 262 lifecycle_updates_throttled_ = !GetFrame().IsMainFrame();
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 // Destroy |m_autoSizeInfo| as early as possible, to avoid dereferencing 371 // Destroy |m_autoSizeInfo| as early as possible, to avoid dereferencing
374 // partially destroyed |this| via |m_autoSizeInfo->m_frameView|. 372 // partially destroyed |this| via |m_autoSizeInfo->m_frameView|.
375 auto_size_info_.Clear(); 373 auto_size_info_.Clear();
376 374
377 post_layout_tasks_timer_.Stop(); 375 post_layout_tasks_timer_.Stop();
378 did_scroll_timer_.Stop(); 376 did_scroll_timer_.Stop();
379 377
380 // FIXME: Do we need to do something here for OOPI? 378 // FIXME: Do we need to do something here for OOPI?
381 HTMLFrameOwnerElement* owner_element = frame_->DeprecatedLocalOwner(); 379 HTMLFrameOwnerElement* owner_element = frame_->DeprecatedLocalOwner();
382 // TODO(dcheng): It seems buggy that we can have an owner element that points 380 // TODO(dcheng): It seems buggy that we can have an owner element that points
383 // to another FrameViewBase. This can happen when a plugin element loads a 381 // to another FrameOrPlugin. This can happen when a plugin element loads a
384 // frame (FrameViewBase A of type FrameView) and then loads a plugin 382 // frame (FrameOrPlugin A of type FrameView) and then loads a plugin
385 // (FrameViewBase B of type WebPluginContainerImpl). In this case, the frame's 383 // (FrameOrPlugin B of type WebPluginContainerImpl). In this case, the frame's
386 // view is A and the frame element's owned FrameViewBase is B. See 384 // view is A and the frame element's OwnedWidget is B. See
387 // https://crbug.com/673170 for an example. 385 // https://crbug.com/673170 for an example.
388 if (owner_element && owner_element->OwnedWidget() == this) 386 if (owner_element && owner_element->OwnedWidget() == this)
389 owner_element->SetWidget(nullptr); 387 owner_element->SetWidget(nullptr);
390 388
391 ClearPrintContext(); 389 ClearPrintContext();
392 390
393 #if DCHECK_IS_ON() 391 #if DCHECK_IS_ON()
394 has_been_disposed_ = true; 392 has_been_disposed_ = true;
395 #endif 393 #endif
396 } 394 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 UpdateScrollbarGeometry(); 495 UpdateScrollbarGeometry();
498 UpdateScrollCorner(); 496 UpdateScrollCorner();
499 PositionScrollbarLayers(); 497 PositionScrollbarLayers();
500 } 498 }
501 } 499 }
502 500
503 void FrameView::InvalidateAllCustomScrollbarsOnActiveChanged() { 501 void FrameView::InvalidateAllCustomScrollbarsOnActiveChanged() {
504 bool uses_window_inactive_selector = 502 bool uses_window_inactive_selector =
505 frame_->GetDocument()->GetStyleEngine().UsesWindowInactiveSelector(); 503 frame_->GetDocument()->GetStyleEngine().UsesWindowInactiveSelector();
506 504
507 const ChildrenSet* view_children = Children(); 505 for (const auto& child : children_) {
508 for (const Member<FrameViewBase>& child : *view_children) { 506 if (child->IsFrameView())
509 FrameViewBase* frame_view_base = child.Get(); 507 ToFrameView(child)->InvalidateAllCustomScrollbarsOnActiveChanged();
510 if (frame_view_base->IsFrameView()) {
511 ToFrameView(frame_view_base)
512 ->InvalidateAllCustomScrollbarsOnActiveChanged();
513 }
514 } 508 }
515 509
516 for (const Member<Scrollbar>& scrollbar : *Scrollbars()) { 510 for (const auto& scrollbar : scrollbars_) {
517 if (uses_window_inactive_selector && scrollbar->IsCustomScrollbar()) 511 if (uses_window_inactive_selector && scrollbar->IsCustomScrollbar())
518 scrollbar->StyleChanged(); 512 scrollbar->StyleChanged();
519 } 513 }
520 514
521 if (uses_window_inactive_selector) 515 if (uses_window_inactive_selector)
522 RecalculateCustomScrollbarStyle(); 516 RecalculateCustomScrollbarStyle();
523 } 517 }
524 518
525 void FrameView::Clear() { 519 void FrameView::Clear() {
526 Reset(); 520 Reset();
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 if (!in_synchronous_post_layout_) { 1154 if (!in_synchronous_post_layout_) {
1161 in_synchronous_post_layout_ = true; 1155 in_synchronous_post_layout_ = true;
1162 // Calls resumeScheduledEvents() 1156 // Calls resumeScheduledEvents()
1163 PerformPostLayoutTasks(); 1157 PerformPostLayoutTasks();
1164 in_synchronous_post_layout_ = false; 1158 in_synchronous_post_layout_ = false;
1165 } 1159 }
1166 1160
1167 if (!post_layout_tasks_timer_.IsActive() && 1161 if (!post_layout_tasks_timer_.IsActive() &&
1168 (NeedsLayout() || in_synchronous_post_layout_)) { 1162 (NeedsLayout() || in_synchronous_post_layout_)) {
1169 // If we need layout or are already in a synchronous call to 1163 // If we need layout or are already in a synchronous call to
1170 // postLayoutTasks(), defer FrameViewBase updates and event dispatch until 1164 // postLayoutTasks(), defer FrameView updates and event dispatch until
1171 // after we return. postLayoutTasks() can make us need to update again, and 1165 // after we return. postLayoutTasks() can make us need to update again, and
1172 // we can get stuck in a nasty cycle unless we call it through the timer 1166 // we can get stuck in a nasty cycle unless we call it through the timer
1173 // here. 1167 // here.
1174 post_layout_tasks_timer_.StartOneShot(0, BLINK_FROM_HERE); 1168 post_layout_tasks_timer_.StartOneShot(0, BLINK_FROM_HERE);
1175 if (NeedsLayout()) 1169 if (NeedsLayout())
1176 UpdateLayout(); 1170 UpdateLayout();
1177 } 1171 }
1178 } 1172 }
1179 1173
1180 void FrameView::UpdateLayout() { 1174 void FrameView::UpdateLayout() {
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 frame_view->CheckDoesNotNeedLayout(); 1511 frame_view->CheckDoesNotNeedLayout();
1518 } else { 1512 } else {
1519 part->UpdateGeometry(); 1513 part->UpdateGeometry();
1520 } 1514 }
1521 } 1515 }
1522 } 1516 }
1523 } 1517 }
1524 1518
1525 void FrameView::AddPartToUpdate(LayoutEmbeddedObject& object) { 1519 void FrameView::AddPartToUpdate(LayoutEmbeddedObject& object) {
1526 ASSERT(IsInPerformLayout()); 1520 ASSERT(IsInPerformLayout());
1527 // Tell the DOM element that it needs a FrameViewBase update. 1521 // Tell the DOM element that it needs a FrameView update.
1528 Node* node = object.GetNode(); 1522 Node* node = object.GetNode();
1529 ASSERT(node); 1523 ASSERT(node);
1530 if (isHTMLObjectElement(*node) || isHTMLEmbedElement(*node)) 1524 if (isHTMLObjectElement(*node) || isHTMLEmbedElement(*node))
1531 ToHTMLPlugInElement(node)->SetNeedsPluginUpdate(true); 1525 ToHTMLPlugInElement(node)->SetNeedsPluginUpdate(true);
1532 1526
1533 part_update_set_.insert(&object); 1527 part_update_set_.insert(&object);
1534 } 1528 }
1535 1529
1536 void FrameView::SetDisplayMode(WebDisplayMode mode) { 1530 void FrameView::SetDisplayMode(WebDisplayMode mode) {
1537 if (mode == display_mode_) 1531 if (mode == display_mode_)
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
2041 !constraints_map.at(layer).HasAncestorStickyElement()) { 2035 !constraints_map.at(layer).HasAncestorStickyElement()) {
2042 // TODO(skobes): Resolve circular dependency between scroll offset and 2036 // TODO(skobes): Resolve circular dependency between scroll offset and
2043 // compositing state, and remove this disabler. https://crbug.com/420741 2037 // compositing state, and remove this disabler. https://crbug.com/420741
2044 DisableCompositingQueryAsserts disabler; 2038 DisableCompositingQueryAsserts disabler;
2045 layer->UpdateLayerPositionsAfterOverflowScroll(); 2039 layer->UpdateLayerPositionsAfterOverflowScroll();
2046 layout_object->SetMayNeedPaintInvalidationSubtree(); 2040 layout_object->SetMayNeedPaintInvalidationSubtree();
2047 } 2041 }
2048 } 2042 }
2049 2043
2050 // If there fixed position elements, scrolling may cause compositing layers to 2044 // If there fixed position elements, scrolling may cause compositing layers to
2051 // change. Update FrameViewBase and layer positions after scrolling, but only 2045 // change. Update FrameView and layer positions after scrolling, but only
2052 // if we're not inside of layout. 2046 // if we're not inside of layout.
2053 if (!nested_layout_count_) { 2047 if (!nested_layout_count_) {
2054 UpdateGeometries(); 2048 UpdateGeometries();
2055 LayoutViewItem layout_view_item = this->GetLayoutViewItem(); 2049 LayoutViewItem layout_view_item = this->GetLayoutViewItem();
2056 if (!layout_view_item.IsNull()) 2050 if (!layout_view_item.IsNull())
2057 layout_view_item.Layer()->SetNeedsCompositingInputsUpdate(); 2051 layout_view_item.Layer()->SetNeedsCompositingInputsUpdate();
2058 } 2052 }
2059 } 2053 }
2060 2054
2061 bool FrameView::ComputeCompositedSelection(LocalFrame& frame, 2055 bool FrameView::ComputeCompositedSelection(LocalFrame& frame,
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
2469 } 2463 }
2470 2464
2471 // The fragment anchor should only be maintained while the frame is still 2465 // The fragment anchor should only be maintained while the frame is still
2472 // loading. If the frame is done loading, clear the anchor now. Otherwise, 2466 // loading. If the frame is done loading, clear the anchor now. Otherwise,
2473 // restore it since it may have been cleared during scrollRectToVisible. 2467 // restore it since it may have been cleared during scrollRectToVisible.
2474 fragment_anchor_ = 2468 fragment_anchor_ =
2475 frame_->GetDocument()->IsLoadCompleted() ? nullptr : anchor_node; 2469 frame_->GetDocument()->IsLoadCompleted() ? nullptr : anchor_node;
2476 } 2470 }
2477 2471
2478 bool FrameView::UpdatePlugins() { 2472 bool FrameView::UpdatePlugins() {
2479 // This is always called from updatePluginsTimerFired. 2473 // This is always called from UpdatePluginsTimerFired.
2480 // m_updatePluginsTimer should only be scheduled if we have FrameViewBases to 2474 // update_plugins_timer should only be scheduled if we have FrameViews to
2481 // update. Thus I believe we can stop checking isEmpty here, and just ASSERT 2475 // update. Thus I believe we can stop checking isEmpty here, and just ASSERT
2482 // isEmpty: 2476 // isEmpty:
2483 // FIXME: This assert has been temporarily removed due to 2477 // FIXME: This assert has been temporarily removed due to
2484 // https://crbug.com/430344 2478 // https://crbug.com/430344
2485 if (nested_layout_count_ > 1 || part_update_set_.IsEmpty()) 2479 if (nested_layout_count_ > 1 || part_update_set_.IsEmpty())
2486 return true; 2480 return true;
2487 2481
2488 // Need to swap because script will run inside the below loop and invalidate 2482 // Need to swap because script will run inside the below loop and invalidate
2489 // the iterator. 2483 // the iterator.
2490 EmbeddedObjectSet objects; 2484 EmbeddedObjectSet objects;
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
3388 if (NeedsLayout()) 3382 if (NeedsLayout())
3389 UpdateLayout(); 3383 UpdateLayout();
3390 3384
3391 CheckDoesNotNeedLayout(); 3385 CheckDoesNotNeedLayout();
3392 3386
3393 // WebView plugins need to update regardless of whether the 3387 // WebView plugins need to update regardless of whether the
3394 // LayoutEmbeddedObject that owns them needed layout. 3388 // LayoutEmbeddedObject that owns them needed layout.
3395 // TODO(leviw): This currently runs the entire lifecycle on plugin WebViews. 3389 // TODO(leviw): This currently runs the entire lifecycle on plugin WebViews.
3396 // We should have a way to only run these other Documents to the same 3390 // We should have a way to only run these other Documents to the same
3397 // lifecycle stage as this frame. 3391 // lifecycle stage as this frame.
3398 for (const Member<PluginView>& plugin : *Plugins()) { 3392 for (const auto& child : children_) {
3399 plugin->UpdateAllLifecyclePhases(); 3393 if (child->IsPluginView())
3394 ToPluginView(child)->UpdateAllLifecyclePhases();
3400 } 3395 }
3401 CheckDoesNotNeedLayout(); 3396 CheckDoesNotNeedLayout();
3402 3397
3403 // FIXME: Calling layout() shouldn't trigger script execution or have any 3398 // FIXME: Calling layout() shouldn't trigger script execution or have any
3404 // observable effects on the frame tree but we're not quite there yet. 3399 // observable effects on the frame tree but we're not quite there yet.
3405 HeapVector<Member<FrameView>> frame_views; 3400 HeapVector<Member<FrameView>> frame_views;
3406 for (Frame* child = frame_->Tree().FirstChild(); child; 3401 for (Frame* child = frame_->Tree().FirstChild(); child;
3407 child = child->Tree().NextSibling()) { 3402 child = child->Tree().NextSibling()) {
3408 if (!child->IsLocalFrame()) 3403 if (!child->IsLocalFrame())
3409 continue; 3404 continue;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
3641 IntPoint FrameView::ConvertToLayoutItem(const LayoutItem& layout_item, 3636 IntPoint FrameView::ConvertToLayoutItem(const LayoutItem& layout_item,
3642 const IntPoint& frame_point) const { 3637 const IntPoint& frame_point) const {
3643 IntPoint point = frame_point; 3638 IntPoint point = frame_point;
3644 3639
3645 // Convert from FrameView coords into page ("absolute") coordinates. 3640 // Convert from FrameView coords into page ("absolute") coordinates.
3646 point += IntSize(ScrollX(), ScrollY()); 3641 point += IntSize(ScrollX(), ScrollY());
3647 3642
3648 return RoundedIntPoint(layout_item.AbsoluteToLocal(point, kUseTransforms)); 3643 return RoundedIntPoint(layout_item.AbsoluteToLocal(point, kUseTransforms));
3649 } 3644 }
3650 3645
3651 IntPoint FrameView::ConvertSelfToChild(const FrameViewBase* child, 3646 IntPoint FrameView::ConvertSelfToChild(const IntPoint& child_location,
3652 const IntPoint& point) const { 3647 const IntPoint& point) const {
3653 IntPoint new_point = point; 3648 IntPoint new_point = point;
3654 new_point = FrameToContents(point); 3649 new_point = FrameToContents(point);
3655 new_point.MoveBy(-child->Location()); 3650 new_point.MoveBy(-child_location);
3656 return new_point; 3651 return new_point;
3657 } 3652 }
3658 3653
3659 IntRect FrameView::ConvertToContainingFrameViewBase( 3654 IntRect FrameView::ConvertToContainingFrameView(
3660 const IntRect& local_rect) const { 3655 const IntRect& local_rect) const {
3661 if (parent_) { 3656 if (parent_) {
3662 // Get our layoutObject in the parent view 3657 // Get our layoutObject in the parent view
3663 LayoutPartItem layout_item = frame_->OwnerLayoutItem(); 3658 LayoutPartItem layout_item = frame_->OwnerLayoutItem();
3664 if (layout_item.IsNull()) 3659 if (layout_item.IsNull())
3665 return local_rect; 3660 return local_rect;
3666 3661
3667 IntRect rect(local_rect); 3662 IntRect rect(local_rect);
3668 // Add borders and padding?? 3663 // Add borders and padding??
3669 rect.Move((layout_item.BorderLeft() + layout_item.PaddingLeft()).ToInt(), 3664 rect.Move((layout_item.BorderLeft() + layout_item.PaddingLeft()).ToInt(),
3670 (layout_item.BorderTop() + layout_item.PaddingTop()).ToInt()); 3665 (layout_item.BorderTop() + layout_item.PaddingTop()).ToInt());
3671 return parent_->ConvertFromLayoutItem(layout_item, rect); 3666 return parent_->ConvertFromLayoutItem(layout_item, rect);
3672 } 3667 }
3673 3668
3674 return local_rect; 3669 return local_rect;
3675 } 3670 }
3676 3671
3677 IntRect FrameView::ConvertFromContainingFrameViewBase( 3672 IntRect FrameView::ConvertFromContainingFrameView(
3678 const IntRect& parent_rect) const { 3673 const IntRect& parent_rect) const {
3679 if (parent_) { 3674 if (parent_) {
3680 IntRect local_rect = parent_rect; 3675 IntRect local_rect = parent_rect;
3681 local_rect.SetLocation( 3676 local_rect.SetLocation(
3682 parent_->ConvertSelfToChild(this, local_rect.Location())); 3677 parent_->ConvertSelfToChild(Location(), local_rect.Location()));
3683 return local_rect; 3678 return local_rect;
3684 } 3679 }
3685 3680
3686 return parent_rect; 3681 return parent_rect;
3687 } 3682 }
3688 3683
3689 IntPoint FrameView::ConvertToContainingFrameViewBase( 3684 IntPoint FrameView::ConvertToContainingFrameView(
3690 const IntPoint& local_point) const { 3685 const IntPoint& local_point) const {
3691 if (parent_) { 3686 if (parent_) {
3692 // Get our layoutObject in the parent view 3687 // Get our layoutObject in the parent view
3693 LayoutPartItem layout_item = frame_->OwnerLayoutItem(); 3688 LayoutPartItem layout_item = frame_->OwnerLayoutItem();
3694 if (layout_item.IsNull()) 3689 if (layout_item.IsNull())
3695 return local_point; 3690 return local_point;
3696 3691
3697 IntPoint point(local_point); 3692 IntPoint point(local_point);
3698 3693
3699 // Add borders and padding 3694 // Add borders and padding
3700 point.Move((layout_item.BorderLeft() + layout_item.PaddingLeft()).ToInt(), 3695 point.Move((layout_item.BorderLeft() + layout_item.PaddingLeft()).ToInt(),
3701 (layout_item.BorderTop() + layout_item.PaddingTop()).ToInt()); 3696 (layout_item.BorderTop() + layout_item.PaddingTop()).ToInt());
3702 return parent_->ConvertFromLayoutItem(layout_item, point); 3697 return parent_->ConvertFromLayoutItem(layout_item, point);
3703 } 3698 }
3704 3699
3705 return local_point; 3700 return local_point;
3706 } 3701 }
3707 3702
3708 IntPoint FrameView::ConvertFromContainingFrameViewBase( 3703 IntPoint FrameView::ConvertFromContainingFrameView(
3709 const IntPoint& parent_point) const { 3704 const IntPoint& parent_point) const {
3710 if (parent_) { 3705 if (parent_) {
3711 // Get our layoutObject in the parent view 3706 // Get our layoutObject in the parent view
3712 LayoutPartItem layout_item = frame_->OwnerLayoutItem(); 3707 LayoutPartItem layout_item = frame_->OwnerLayoutItem();
3713 if (layout_item.IsNull()) 3708 if (layout_item.IsNull())
3714 return parent_point; 3709 return parent_point;
3715 3710
3716 IntPoint point = parent_->ConvertToLayoutItem(layout_item, parent_point); 3711 IntPoint point = parent_->ConvertToLayoutItem(layout_item, parent_point);
3717 // Subtract borders and padding 3712 // Subtract borders and padding
3718 point.Move((-layout_item.BorderLeft() - layout_item.PaddingLeft()).ToInt(), 3713 point.Move((-layout_item.BorderLeft() - layout_item.PaddingLeft()).ToInt(),
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
3839 3834
3840 void FrameView::RemoveAnimatingScrollableArea(ScrollableArea* scrollable_area) { 3835 void FrameView::RemoveAnimatingScrollableArea(ScrollableArea* scrollable_area) {
3841 if (!animating_scrollable_areas_) 3836 if (!animating_scrollable_areas_)
3842 return; 3837 return;
3843 animating_scrollable_areas_->erase(scrollable_area); 3838 animating_scrollable_areas_->erase(scrollable_area);
3844 } 3839 }
3845 3840
3846 FrameView* FrameView::Root() const { 3841 FrameView* FrameView::Root() const {
3847 const FrameView* top = this; 3842 const FrameView* top = this;
3848 while (top->Parent()) 3843 while (top->Parent())
3849 top = ToFrameView(top->Parent()); 3844 top = top->Parent();
3850 return const_cast<FrameView*>(top); 3845 return const_cast<FrameView*>(top);
3851 } 3846 }
3852 3847
3853 void FrameView::SetParent(FrameViewBase* parent_frame_view_base) { 3848 void FrameView::SetParent(FrameView* parent) {
3854 FrameView* parent = ToFrameView(parent_frame_view_base);
3855 if (parent == parent_) 3849 if (parent == parent_)
3856 return; 3850 return;
3857 3851
3858 DCHECK(!parent || !parent_); 3852 DCHECK(!parent || !parent_);
3859 if (!parent || !parent->IsVisible()) 3853 if (!parent || !parent->IsVisible())
3860 SetParentVisible(false); 3854 SetParentVisible(false);
3861 parent_ = parent; 3855 parent_ = parent;
3862 if (parent && parent->IsVisible()) 3856 if (parent && parent->IsVisible())
3863 SetParentVisible(true); 3857 SetParentVisible(true);
3864 3858
3865 UpdateParentScrollableAreaSet(); 3859 UpdateParentScrollableAreaSet();
3866 SetupRenderThrottling(); 3860 SetupRenderThrottling();
3867 3861
3868 if (ParentFrameView()) 3862 if (ParentFrameView())
3869 subtree_throttled_ = ParentFrameView()->CanThrottleRendering(); 3863 subtree_throttled_ = ParentFrameView()->CanThrottleRendering();
3870 } 3864 }
3871 3865
3872 void FrameView::RemoveChild(FrameViewBase* child) { 3866 void FrameView::AddChild(FrameOrPlugin* child) {
3867 DCHECK(child != this && !child->Parent());
3868 child->SetParent(this);
3869 children_.insert(child);
3870 }
3871
3872 void FrameView::RemoveChild(FrameOrPlugin* child) {
3873 DCHECK(child->Parent() == this); 3873 DCHECK(child->Parent() == this);
3874 3874
3875 if (child->IsFrameView() && 3875 if (child->IsFrameView() &&
3876 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) 3876 !RuntimeEnabledFeatures::rootLayerScrollingEnabled())
3877 RemoveScrollableArea(ToFrameView(child)); 3877 RemoveScrollableArea(ToFrameView(child));
3878 3878
3879 child->SetParent(nullptr); 3879 child->SetParent(nullptr);
3880 children_.erase(child); 3880 children_.erase(child);
3881 } 3881 }
3882 3882
3883 void FrameView::RemovePlugin(PluginView* plugin) {
3884 DCHECK(plugin->Parent() == this);
3885 DCHECK(plugins_.Contains(plugin));
3886 plugin->SetParent(nullptr);
3887 plugins_.erase(plugin);
3888 }
3889
3890 void FrameView::AddPlugin(PluginView* plugin) {
3891 DCHECK(!plugin->Parent());
3892 DCHECK(!plugins_.Contains(plugin));
3893 plugin->SetParent(this);
3894 plugins_.insert(plugin);
3895 }
3896
3897 void FrameView::RemoveScrollbar(Scrollbar* scrollbar) { 3883 void FrameView::RemoveScrollbar(Scrollbar* scrollbar) {
3898 DCHECK(scrollbars_.Contains(scrollbar)); 3884 DCHECK(scrollbars_.Contains(scrollbar));
3899 scrollbar->SetParent(nullptr); 3885 scrollbar->SetParent(nullptr);
3900 scrollbars_.erase(scrollbar); 3886 scrollbars_.erase(scrollbar);
3901 } 3887 }
3902 3888
3903 void FrameView::AddScrollbar(Scrollbar* scrollbar) { 3889 void FrameView::AddScrollbar(Scrollbar* scrollbar) {
3904 DCHECK(!scrollbars_.Contains(scrollbar)); 3890 DCHECK(!scrollbars_.Contains(scrollbar));
3905 scrollbar->SetParent(this); 3891 scrollbar->SetParent(this);
3906 scrollbars_.insert(scrollbar); 3892 scrollbars_.insert(scrollbar);
(...skipping 28 matching lines...) Expand all
3935 page->GetChromeClient().SetCursor(cursor, frame_); 3921 page->GetChromeClient().SetCursor(cursor, frame_);
3936 } 3922 }
3937 3923
3938 void FrameView::FrameRectsChanged() { 3924 void FrameView::FrameRectsChanged() {
3939 TRACE_EVENT0("blink", "FrameView::frameRectsChanged"); 3925 TRACE_EVENT0("blink", "FrameView::frameRectsChanged");
3940 if (LayoutSizeFixedToFrameSize()) 3926 if (LayoutSizeFixedToFrameSize())
3941 SetLayoutSizeInternal(FrameRect().Size()); 3927 SetLayoutSizeInternal(FrameRect().Size());
3942 3928
3943 for (const auto& child : children_) 3929 for (const auto& child : children_)
3944 child->FrameRectsChanged(); 3930 child->FrameRectsChanged();
3945
3946 for (const auto& plugin : plugins_)
3947 plugin->FrameRectsChanged();
3948 } 3931 }
3949 3932
3950 void FrameView::SetLayoutSizeInternal(const IntSize& size) { 3933 void FrameView::SetLayoutSizeInternal(const IntSize& size) {
3951 if (layout_size_ == size) 3934 if (layout_size_ == size)
3952 return; 3935 return;
3953 3936
3954 layout_size_ = size; 3937 layout_size_ = size;
3955 ContentsResized(); 3938 ContentsResized();
3956 } 3939 }
3957 3940
(...skipping 29 matching lines...) Expand all
3987 TopDocumentRootScrollerController& controller = 3970 TopDocumentRootScrollerController& controller =
3988 page->GlobalRootScrollerController(); 3971 page->GlobalRootScrollerController();
3989 if (layout_viewport == controller.RootScrollerArea()) 3972 if (layout_viewport == controller.RootScrollerArea())
3990 visible_size = controller.RootScrollerVisibleArea(); 3973 visible_size = controller.RootScrollerVisibleArea();
3991 3974
3992 IntSize maximum_offset = 3975 IntSize maximum_offset =
3993 ToIntSize(-ScrollOrigin() + (content_bounds - visible_size)); 3976 ToIntSize(-ScrollOrigin() + (content_bounds - visible_size));
3994 return maximum_offset.ExpandedTo(MinimumScrollOffsetInt()); 3977 return maximum_offset.ExpandedTo(MinimumScrollOffsetInt());
3995 } 3978 }
3996 3979
3997 void FrameView::AddChild(FrameViewBase* child) {
3998 DCHECK(child != this && !child->Parent());
3999 child->SetParent(this);
4000 children_.insert(child);
4001 }
4002
4003 void FrameView::SetScrollbarModes(ScrollbarMode horizontal_mode, 3980 void FrameView::SetScrollbarModes(ScrollbarMode horizontal_mode,
4004 ScrollbarMode vertical_mode, 3981 ScrollbarMode vertical_mode,
4005 bool horizontal_lock, 3982 bool horizontal_lock,
4006 bool vertical_lock) { 3983 bool vertical_lock) {
4007 bool needs_update = false; 3984 bool needs_update = false;
4008 3985
4009 // If the page's overflow setting has disabled scrolling, do not allow 3986 // If the page's overflow setting has disabled scrolling, do not allow
4010 // anything to override that setting, http://crbug.com/426447 3987 // anything to override that setting, http://crbug.com/426447
4011 LayoutObject* viewport = ViewportLayoutObject(); 3988 LayoutObject* viewport = ViewportLayoutObject();
4012 if (viewport && !ShouldIgnoreOverflowHidden()) { 3989 if (viewport && !ShouldIgnoreOverflowHidden()) {
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
4441 4418
4442 if (!ScrollContentsFastPath(-scroll_delta)) 4419 if (!ScrollContentsFastPath(-scroll_delta))
4443 ScrollContentsSlowPath(); 4420 ScrollContentsSlowPath();
4444 4421
4445 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && 4422 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() &&
4446 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { 4423 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
4447 // Need to update scroll translation property. 4424 // Need to update scroll translation property.
4448 SetNeedsPaintPropertyUpdate(); 4425 SetNeedsPaintPropertyUpdate();
4449 } 4426 }
4450 4427
4451 // This call will move children with native FrameViewBases (plugins) and 4428 // This call will move children with native FrameViews (plugins) and
4452 // invalidate them as well. 4429 // invalidate them as well.
4453 FrameRectsChanged(); 4430 FrameRectsChanged();
4454 } 4431 }
4455 4432
4456 IntPoint FrameView::ContentsToFrame( 4433 IntPoint FrameView::ContentsToFrame(
4457 const IntPoint& point_in_content_space) const { 4434 const IntPoint& point_in_content_space) const {
4458 return point_in_content_space - ScrollOffsetInt(); 4435 return point_in_content_space - ScrollOffsetInt();
4459 } 4436 }
4460 4437
4461 IntRect FrameView::ContentsToFrame(const IntRect& rect_in_content_space) const { 4438 IntRect FrameView::ContentsToFrame(const IntRect& rect_in_content_space) const {
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
4743 } 4720 }
4744 4721
4745 bool FrameView::ScrollbarCornerPresent() const { 4722 bool FrameView::ScrollbarCornerPresent() const {
4746 return (HorizontalScrollbar() && 4723 return (HorizontalScrollbar() &&
4747 Width() - HorizontalScrollbar()->Width() > 0) || 4724 Width() - HorizontalScrollbar()->Width() > 0) ||
4748 (VerticalScrollbar() && Height() - VerticalScrollbar()->Height() > 0); 4725 (VerticalScrollbar() && Height() - VerticalScrollbar()->Height() > 0);
4749 } 4726 }
4750 4727
4751 IntRect FrameView::ConvertToRootFrame(const IntRect& local_rect) const { 4728 IntRect FrameView::ConvertToRootFrame(const IntRect& local_rect) const {
4752 if (parent_) { 4729 if (parent_) {
4753 IntRect parent_rect = ConvertToContainingFrameViewBase(local_rect); 4730 IntRect parent_rect = ConvertToContainingFrameView(local_rect);
4754 return parent_->ConvertToRootFrame(parent_rect); 4731 return parent_->ConvertToRootFrame(parent_rect);
4755 } 4732 }
4756 return local_rect; 4733 return local_rect;
4757 } 4734 }
4758 4735
4759 IntPoint FrameView::ConvertToRootFrame(const IntPoint& local_point) const { 4736 IntPoint FrameView::ConvertToRootFrame(const IntPoint& local_point) const {
4760 if (parent_) { 4737 if (parent_) {
4761 IntPoint parent_point = ConvertToContainingFrameViewBase(local_point); 4738 IntPoint parent_point = ConvertToContainingFrameView(local_point);
4762 return parent_->ConvertToRootFrame(parent_point); 4739 return parent_->ConvertToRootFrame(parent_point);
4763 } 4740 }
4764 return local_point; 4741 return local_point;
4765 } 4742 }
4766 4743
4767 IntPoint FrameView::ConvertFromContainingFrameViewBaseToScrollbar( 4744 IntPoint FrameView::ConvertFromContainingFrameViewToScrollbar(
4768 const Scrollbar& scrollbar, 4745 const Scrollbar& scrollbar,
4769 const IntPoint& parent_point) const { 4746 const IntPoint& parent_point) const {
4770 IntPoint new_point = parent_point; 4747 IntPoint new_point = parent_point;
4771 // Scrollbars won't be transformed within us 4748 // Scrollbars won't be transformed within us
4772 new_point.MoveBy(-scrollbar.Location()); 4749 new_point.MoveBy(-scrollbar.Location());
4773 return new_point; 4750 return new_point;
4774 } 4751 }
4775 4752
4776 static void SetNeedsCompositingUpdate(LayoutViewItem layout_view_item, 4753 static void SetNeedsCompositingUpdate(LayoutViewItem layout_view_item,
4777 CompositingUpdateType update_type) { 4754 CompositingUpdateType update_type) {
(...skipping 10 matching lines...) Expand all
4788 // and potentially child frame views. 4765 // and potentially child frame views.
4789 SetNeedsCompositingUpdate(GetLayoutViewItem(), kCompositingUpdateRebuildTree); 4766 SetNeedsCompositingUpdate(GetLayoutViewItem(), kCompositingUpdateRebuildTree);
4790 4767
4791 parent_visible_ = visible; 4768 parent_visible_ = visible;
4792 4769
4793 if (!IsSelfVisible()) 4770 if (!IsSelfVisible())
4794 return; 4771 return;
4795 4772
4796 for (const auto& child : children_) 4773 for (const auto& child : children_)
4797 child->SetParentVisible(visible); 4774 child->SetParentVisible(visible);
4798
4799 for (const auto& plugin : plugins_)
4800 plugin->SetParentVisible(visible);
4801 } 4775 }
4802 4776
4803 void FrameView::Show() { 4777 void FrameView::Show() {
4804 if (!IsSelfVisible()) { 4778 if (!IsSelfVisible()) {
4805 SetSelfVisible(true); 4779 SetSelfVisible(true);
4806 if (ScrollingCoordinator* scrolling_coordinator = 4780 if (ScrollingCoordinator* scrolling_coordinator =
4807 this->GetScrollingCoordinator()) 4781 this->GetScrollingCoordinator())
4808 scrolling_coordinator->FrameViewVisibilityDidChange(); 4782 scrolling_coordinator->FrameViewVisibilityDidChange();
4809 SetNeedsCompositingUpdate(GetLayoutViewItem(), 4783 SetNeedsCompositingUpdate(GetLayoutViewItem(),
4810 kCompositingUpdateRebuildTree); 4784 kCompositingUpdateRebuildTree);
4811 UpdateParentScrollableAreaSet(); 4785 UpdateParentScrollableAreaSet();
4812 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && 4786 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() &&
4813 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { 4787 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
4814 // The existance of scrolling properties depends on visibility through 4788 // The existance of scrolling properties depends on visibility through
4815 // isScrollable() so ensure properties are updated if visibility changes. 4789 // isScrollable() so ensure properties are updated if visibility changes.
4816 SetNeedsPaintPropertyUpdate(); 4790 SetNeedsPaintPropertyUpdate();
4817 } 4791 }
4818 if (IsParentVisible()) { 4792 if (IsParentVisible()) {
4819 for (const auto& child : children_) 4793 for (const auto& child : children_)
4820 child->SetParentVisible(true); 4794 child->SetParentVisible(true);
4821
4822 for (const auto& plugin : plugins_)
4823 plugin->SetParentVisible(true);
4824 } 4795 }
4825 } 4796 }
4826 } 4797 }
4827 4798
4828 void FrameView::Hide() { 4799 void FrameView::Hide() {
4829 if (IsSelfVisible()) { 4800 if (IsSelfVisible()) {
4830 if (IsParentVisible()) { 4801 if (IsParentVisible()) {
4831 for (const auto& child : children_) 4802 for (const auto& child : children_)
4832 child->SetParentVisible(false); 4803 child->SetParentVisible(false);
4833
4834 for (const auto& plugin : plugins_)
4835 plugin->SetParentVisible(false);
4836 } 4804 }
4837 SetSelfVisible(false); 4805 SetSelfVisible(false);
4838 if (ScrollingCoordinator* scrolling_coordinator = 4806 if (ScrollingCoordinator* scrolling_coordinator =
4839 this->GetScrollingCoordinator()) 4807 this->GetScrollingCoordinator())
4840 scrolling_coordinator->FrameViewVisibilityDidChange(); 4808 scrolling_coordinator->FrameViewVisibilityDidChange();
4841 SetNeedsCompositingUpdate(GetLayoutViewItem(), 4809 SetNeedsCompositingUpdate(GetLayoutViewItem(),
4842 kCompositingUpdateRebuildTree); 4810 kCompositingUpdateRebuildTree);
4843 UpdateParentScrollableAreaSet(); 4811 UpdateParentScrollableAreaSet();
4844 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && 4812 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() &&
4845 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { 4813 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
4892 return; 4860 return;
4893 4861
4894 layout_object.AddAnnotatedRegions(regions); 4862 layout_object.AddAnnotatedRegions(regions);
4895 for (LayoutObject* curr = layout_object.SlowFirstChild(); curr; 4863 for (LayoutObject* curr = layout_object.SlowFirstChild(); curr;
4896 curr = curr->NextSibling()) 4864 curr = curr->NextSibling())
4897 CollectAnnotatedRegions(*curr, regions); 4865 CollectAnnotatedRegions(*curr, regions);
4898 } 4866 }
4899 4867
4900 void FrameView::UpdateViewportIntersectionsForSubtree( 4868 void FrameView::UpdateViewportIntersectionsForSubtree(
4901 DocumentLifecycle::LifecycleState target_state) { 4869 DocumentLifecycle::LifecycleState target_state) {
4902 // TODO(dcheng): Since FrameViewBase tree updates are deferred, FrameViews 4870 // TODO(dcheng): Since FrameView tree updates are deferred, FrameViews
4903 // might still be in the FrameViewBase hierarchy even though the associated 4871 // might still be in the FrameView hierarchy even though the associated
4904 // Document is already detached. Investigate if this check and a similar check 4872 // Document is already detached. Investigate if this check and a similar check
4905 // in lifecycle updates are still needed when there are no more deferred 4873 // in lifecycle updates are still needed when there are no more deferred
4906 // FrameViewBase updates: https://crbug.com/561683 4874 // FrameView updates: https://crbug.com/561683
4907 if (!GetFrame().GetDocument()->IsActive()) 4875 if (!GetFrame().GetDocument()->IsActive())
4908 return; 4876 return;
4909 4877
4910 if (target_state == DocumentLifecycle::kPaintClean) { 4878 if (target_state == DocumentLifecycle::kPaintClean) {
4911 RecordDeferredLoadingStats(); 4879 RecordDeferredLoadingStats();
4912 // Notify javascript IntersectionObservers 4880 // Notify javascript IntersectionObservers
4913 if (GetFrame().GetDocument()->GetIntersectionObserverController()) { 4881 if (GetFrame().GetDocument()->GetIntersectionObserverController()) {
4914 GetFrame() 4882 GetFrame()
4915 .GetDocument() 4883 .GetDocument()
4916 ->GetIntersectionObserverController() 4884 ->GetIntersectionObserverController()
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
4972 4940
4973 // If this FrameView became unthrottled or throttled, we must make sure all 4941 // If this FrameView became unthrottled or throttled, we must make sure all
4974 // its children are notified synchronously. Otherwise we 1) might attempt to 4942 // its children are notified synchronously. Otherwise we 1) might attempt to
4975 // paint one of the children with an out-of-date layout before 4943 // paint one of the children with an out-of-date layout before
4976 // |updateRenderThrottlingStatus| has made it throttled or 2) fail to 4944 // |updateRenderThrottlingStatus| has made it throttled or 2) fail to
4977 // unthrottle a child whose parent is unthrottled by a later notification. 4945 // unthrottle a child whose parent is unthrottled by a later notification.
4978 if (notify_children_behavior == kNotifyChildren && 4946 if (notify_children_behavior == kNotifyChildren &&
4979 (was_throttled != is_throttled || 4947 (was_throttled != is_throttled ||
4980 force_throttling_invalidation_behavior == 4948 force_throttling_invalidation_behavior ==
4981 kForceThrottlingInvalidation)) { 4949 kForceThrottlingInvalidation)) {
4982 for (const Member<FrameViewBase>& child : *Children()) { 4950 for (const auto& child : children_) {
4983 if (child->IsFrameView()) { 4951 if (child->IsFrameView()) {
4984 FrameView* child_view = ToFrameView(child); 4952 ToFrameView(child)->UpdateRenderThrottlingStatus(
4985 child_view->UpdateRenderThrottlingStatus( 4953 ToFrameView(child)->hidden_for_throttling_, is_throttled);
4986 child_view->hidden_for_throttling_, is_throttled);
4987 } 4954 }
4988 } 4955 }
4989 } 4956 }
4990 4957
4991 ScrollingCoordinator* scrolling_coordinator = this->GetScrollingCoordinator(); 4958 ScrollingCoordinator* scrolling_coordinator = this->GetScrollingCoordinator();
4992 if (became_unthrottled || 4959 if (became_unthrottled ||
4993 force_throttling_invalidation_behavior == kForceThrottlingInvalidation) { 4960 force_throttling_invalidation_behavior == kForceThrottlingInvalidation) {
4994 // ScrollingCoordinator needs to update according to the new throttling 4961 // ScrollingCoordinator needs to update according to the new throttling
4995 // status. 4962 // status.
4996 if (scrolling_coordinator) 4963 if (scrolling_coordinator)
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
5388 void FrameView::SetAnimationHost( 5355 void FrameView::SetAnimationHost(
5389 std::unique_ptr<CompositorAnimationHost> host) { 5356 std::unique_ptr<CompositorAnimationHost> host) {
5390 animation_host_ = std::move(host); 5357 animation_host_ = std::move(host);
5391 } 5358 }
5392 5359
5393 LayoutUnit FrameView::CaretWidth() const { 5360 LayoutUnit FrameView::CaretWidth() const {
5394 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1)); 5361 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1));
5395 } 5362 }
5396 5363
5397 } // namespace blink 5364 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698