Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 | 161 |
| 162 using namespace HTMLNames; | 162 using namespace HTMLNames; |
| 163 | 163 |
| 164 // The maximum number of updatePlugins iterations that should be done before | 164 // The maximum number of updatePlugins iterations that should be done before |
| 165 // returning. | 165 // returning. |
| 166 static const unsigned kMaxUpdatePluginsIterations = 2; | 166 static const unsigned kMaxUpdatePluginsIterations = 2; |
| 167 static const double kResourcePriorityUpdateDelayAfterScroll = 0.250; | 167 static const double kResourcePriorityUpdateDelayAfterScroll = 0.250; |
| 168 | 168 |
| 169 static bool g_initial_track_all_paint_invalidations = false; | 169 static bool g_initial_track_all_paint_invalidations = false; |
| 170 | 170 |
| 171 FrameView::FrameView(LocalFrame& frame) | 171 FrameView::FrameView(LocalFrame& frame, IntRect frame_rect) |
|
dcheng
2017/04/26 08:42:59
Btw, this should be passed by const ref (followup
joelhockey
2017/04/26 10:37:57
OK, I'll follow up with this
| |
| 172 : frame_(frame), | 172 : frame_(frame), |
| 173 frame_rect_(frame_rect), | |
| 174 parent_(nullptr), | |
| 173 display_mode_(kWebDisplayModeBrowser), | 175 display_mode_(kWebDisplayModeBrowser), |
| 174 can_have_scrollbars_(true), | 176 can_have_scrollbars_(true), |
| 175 has_pending_layout_(false), | 177 has_pending_layout_(false), |
| 176 in_synchronous_post_layout_(false), | 178 in_synchronous_post_layout_(false), |
| 177 post_layout_tasks_timer_( | 179 post_layout_tasks_timer_( |
| 178 TaskRunnerHelper::Get(TaskType::kUnspecedTimer, &frame), | 180 TaskRunnerHelper::Get(TaskType::kUnspecedTimer, &frame), |
| 179 this, | 181 this, |
| 180 &FrameView::PostLayoutTimerFired), | 182 &FrameView::PostLayoutTimerFired), |
| 181 update_plugins_timer_( | 183 update_plugins_timer_( |
| 182 TaskRunnerHelper::Get(TaskType::kUnspecedTimer, &frame), | 184 TaskRunnerHelper::Get(TaskType::kUnspecedTimer, &frame), |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 209 scroll_anchor_(this), | 211 scroll_anchor_(this), |
| 210 scrollbar_manager_(*this), | 212 scrollbar_manager_(*this), |
| 211 needs_scrollbars_update_(false), | 213 needs_scrollbars_update_(false), |
| 212 suppress_adjust_view_size_(false), | 214 suppress_adjust_view_size_(false), |
| 213 allows_layout_invalidation_after_layout_clean_(true), | 215 allows_layout_invalidation_after_layout_clean_(true), |
| 214 main_thread_scrolling_reasons_(0) { | 216 main_thread_scrolling_reasons_(0) { |
| 215 Init(); | 217 Init(); |
| 216 } | 218 } |
| 217 | 219 |
| 218 FrameView* FrameView::Create(LocalFrame& frame) { | 220 FrameView* FrameView::Create(LocalFrame& frame) { |
| 219 FrameView* view = new FrameView(frame); | 221 FrameView* view = new FrameView(frame, IntRect()); |
| 220 view->Show(); | 222 view->Show(); |
| 221 return view; | 223 return view; |
| 222 } | 224 } |
| 223 | 225 |
| 224 FrameView* FrameView::Create(LocalFrame& frame, const IntSize& initial_size) { | 226 FrameView* FrameView::Create(LocalFrame& frame, const IntSize& initial_size) { |
| 225 FrameView* view = new FrameView(frame); | 227 FrameView* view = new FrameView(frame, IntRect(IntPoint(), initial_size)); |
| 226 view->FrameViewBase::SetFrameRect(IntRect(view->Location(), initial_size)); | |
| 227 view->SetLayoutSizeInternal(initial_size); | 228 view->SetLayoutSizeInternal(initial_size); |
| 228 | 229 |
| 229 view->Show(); | 230 view->Show(); |
| 230 return view; | 231 return view; |
| 231 } | 232 } |
| 232 | 233 |
| 233 FrameView::~FrameView() { | 234 FrameView::~FrameView() { |
| 234 ASSERT(has_been_disposed_); | 235 ASSERT(has_been_disposed_); |
| 235 } | 236 } |
| 236 | 237 |
| 237 DEFINE_TRACE(FrameView) { | 238 DEFINE_TRACE(FrameView) { |
| 238 visitor->Trace(frame_); | 239 visitor->Trace(frame_); |
| 240 visitor->Trace(parent_); | |
| 239 visitor->Trace(fragment_anchor_); | 241 visitor->Trace(fragment_anchor_); |
| 240 visitor->Trace(scrollable_areas_); | 242 visitor->Trace(scrollable_areas_); |
| 241 visitor->Trace(animating_scrollable_areas_); | 243 visitor->Trace(animating_scrollable_areas_); |
| 242 visitor->Trace(auto_size_info_); | 244 visitor->Trace(auto_size_info_); |
| 243 visitor->Trace(children_); | 245 visitor->Trace(children_); |
| 244 visitor->Trace(plugins_); | 246 visitor->Trace(plugins_); |
| 245 visitor->Trace(scrollbars_); | 247 visitor->Trace(scrollbars_); |
| 246 visitor->Trace(viewport_scrollable_area_); | 248 visitor->Trace(viewport_scrollable_area_); |
| 247 visitor->Trace(visibility_observer_); | 249 visitor->Trace(visibility_observer_); |
| 248 visitor->Trace(scroll_anchor_); | 250 visitor->Trace(scroll_anchor_); |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 537 IntRect paint_invalidation_rect = rect; | 539 IntRect paint_invalidation_rect = rect; |
| 538 paint_invalidation_rect.Move( | 540 paint_invalidation_rect.Move( |
| 539 (layout_item.BorderLeft() + layout_item.PaddingLeft()).ToInt(), | 541 (layout_item.BorderLeft() + layout_item.PaddingLeft()).ToInt(), |
| 540 (layout_item.BorderTop() + layout_item.PaddingTop()).ToInt()); | 542 (layout_item.BorderTop() + layout_item.PaddingTop()).ToInt()); |
| 541 // FIXME: We should not allow paint invalidation out of paint invalidation | 543 // FIXME: We should not allow paint invalidation out of paint invalidation |
| 542 // state. crbug.com/457415 | 544 // state. crbug.com/457415 |
| 543 DisablePaintInvalidationStateAsserts paint_invalidation_assert_disabler; | 545 DisablePaintInvalidationStateAsserts paint_invalidation_assert_disabler; |
| 544 layout_item.InvalidatePaintRectangle(LayoutRect(paint_invalidation_rect)); | 546 layout_item.InvalidatePaintRectangle(LayoutRect(paint_invalidation_rect)); |
| 545 } | 547 } |
| 546 | 548 |
| 547 void FrameView::SetFrameRect(const IntRect& new_rect) { | 549 void FrameView::SetFrameRect(const IntRect& frame_rect) { |
| 548 IntRect old_rect = FrameRect(); | 550 if (frame_rect == frame_rect_) |
| 549 if (new_rect == old_rect) | |
| 550 return; | 551 return; |
| 551 | 552 |
| 552 FrameViewBase::SetFrameRect(new_rect); | 553 const bool width_changed = frame_rect_.Width() != frame_rect.Width(); |
| 554 const bool height_changed = frame_rect_.Height() != frame_rect.Height(); | |
| 555 frame_rect_ = frame_rect; | |
| 553 | 556 |
| 554 const bool frame_size_changed = old_rect.Size() != new_rect.Size(); | 557 needs_scrollbars_update_ = width_changed || height_changed; |
| 555 | |
| 556 needs_scrollbars_update_ = frame_size_changed; | |
| 557 // TODO(wjmaclean): find out why scrollbars fail to resize for complex | 558 // TODO(wjmaclean): find out why scrollbars fail to resize for complex |
| 558 // subframes after changing the zoom level. For now always calling | 559 // subframes after changing the zoom level. For now always calling |
| 559 // updateScrollbarsIfNeeded() here fixes the issue, but it would be good to | 560 // updateScrollbarsIfNeeded() here fixes the issue, but it would be good to |
| 560 // discover the deeper cause of this. http://crbug.com/607987. | 561 // discover the deeper cause of this. http://crbug.com/607987. |
| 561 UpdateScrollbarsIfNeeded(); | 562 UpdateScrollbarsIfNeeded(); |
| 562 | 563 |
| 563 FrameRectsChanged(); | 564 FrameRectsChanged(); |
| 564 | 565 |
| 565 UpdateParentScrollableAreaSet(); | 566 UpdateParentScrollableAreaSet(); |
| 566 | 567 |
| 567 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && | 568 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && |
| 568 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 569 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 569 // The overflow clip property depends on the frame size and the pre | 570 // The overflow clip property depends on the frame size and the pre |
| 570 // translation property depends on the frame location. | 571 // translation property depends on the frame location. |
| 571 SetNeedsPaintPropertyUpdate(); | 572 SetNeedsPaintPropertyUpdate(); |
| 572 } | 573 } |
| 573 | 574 |
| 574 if (auto layout_view_item = this->GetLayoutViewItem()) | 575 if (auto layout_view_item = this->GetLayoutViewItem()) |
| 575 layout_view_item.SetMayNeedPaintInvalidation(); | 576 layout_view_item.SetMayNeedPaintInvalidation(); |
| 576 | 577 |
| 577 if (frame_size_changed) { | 578 if (width_changed || height_changed) { |
| 578 ViewportSizeChanged(new_rect.Width() != old_rect.Width(), | 579 ViewportSizeChanged(width_changed, height_changed); |
| 579 new_rect.Height() != old_rect.Height()); | |
| 580 | 580 |
| 581 if (frame_->IsMainFrame()) | 581 if (frame_->IsMainFrame()) |
| 582 frame_->GetPage()->GetVisualViewport().MainFrameDidChangeSize(); | 582 frame_->GetPage()->GetVisualViewport().MainFrameDidChangeSize(); |
| 583 | 583 |
| 584 GetFrame().Loader().RestoreScrollPositionAndViewState(); | 584 GetFrame().Loader().RestoreScrollPositionAndViewState(); |
| 585 } | 585 } |
| 586 } | 586 } |
| 587 | 587 |
| 588 Page* FrameView::GetPage() const { | 588 Page* FrameView::GetPage() const { |
| 589 return GetFrame().GetPage(); | 589 return GetFrame().GetPage(); |
| (...skipping 3059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3649 IntPoint FrameView::ConvertSelfToChild(const FrameViewBase* child, | 3649 IntPoint FrameView::ConvertSelfToChild(const FrameViewBase* child, |
| 3650 const IntPoint& point) const { | 3650 const IntPoint& point) const { |
| 3651 IntPoint new_point = point; | 3651 IntPoint new_point = point; |
| 3652 new_point = FrameToContents(point); | 3652 new_point = FrameToContents(point); |
| 3653 new_point.MoveBy(-child->Location()); | 3653 new_point.MoveBy(-child->Location()); |
| 3654 return new_point; | 3654 return new_point; |
| 3655 } | 3655 } |
| 3656 | 3656 |
| 3657 IntRect FrameView::ConvertToContainingFrameViewBase( | 3657 IntRect FrameView::ConvertToContainingFrameViewBase( |
| 3658 const IntRect& local_rect) const { | 3658 const IntRect& local_rect) const { |
| 3659 if (const FrameView* parent = ToFrameView(Parent())) { | 3659 if (parent_) { |
| 3660 // Get our layoutObject in the parent view | 3660 // Get our layoutObject in the parent view |
| 3661 LayoutPartItem layout_item = frame_->OwnerLayoutItem(); | 3661 LayoutPartItem layout_item = frame_->OwnerLayoutItem(); |
| 3662 if (layout_item.IsNull()) | 3662 if (layout_item.IsNull()) |
| 3663 return local_rect; | 3663 return local_rect; |
| 3664 | 3664 |
| 3665 IntRect rect(local_rect); | 3665 IntRect rect(local_rect); |
| 3666 // Add borders and padding?? | 3666 // Add borders and padding?? |
| 3667 rect.Move((layout_item.BorderLeft() + layout_item.PaddingLeft()).ToInt(), | 3667 rect.Move((layout_item.BorderLeft() + layout_item.PaddingLeft()).ToInt(), |
| 3668 (layout_item.BorderTop() + layout_item.PaddingTop()).ToInt()); | 3668 (layout_item.BorderTop() + layout_item.PaddingTop()).ToInt()); |
| 3669 return parent->ConvertFromLayoutItem(layout_item, rect); | 3669 return parent_->ConvertFromLayoutItem(layout_item, rect); |
| 3670 } | 3670 } |
| 3671 | 3671 |
| 3672 return local_rect; | 3672 return local_rect; |
| 3673 } | 3673 } |
| 3674 | 3674 |
| 3675 IntRect FrameView::ConvertFromContainingFrameViewBase( | 3675 IntRect FrameView::ConvertFromContainingFrameViewBase( |
| 3676 const IntRect& parent_rect) const { | 3676 const IntRect& parent_rect) const { |
| 3677 if (const FrameView* parent = ToFrameView(Parent())) { | 3677 if (parent_) { |
| 3678 IntRect local_rect = parent_rect; | 3678 IntRect local_rect = parent_rect; |
| 3679 local_rect.SetLocation( | 3679 local_rect.SetLocation( |
| 3680 parent->ConvertSelfToChild(this, local_rect.Location())); | 3680 parent_->ConvertSelfToChild(this, local_rect.Location())); |
| 3681 return local_rect; | 3681 return local_rect; |
| 3682 } | 3682 } |
| 3683 | 3683 |
| 3684 return parent_rect; | 3684 return parent_rect; |
| 3685 } | 3685 } |
| 3686 | 3686 |
| 3687 IntPoint FrameView::ConvertToContainingFrameViewBase( | 3687 IntPoint FrameView::ConvertToContainingFrameViewBase( |
| 3688 const IntPoint& local_point) const { | 3688 const IntPoint& local_point) const { |
| 3689 if (const FrameView* parent = ToFrameView(Parent())) { | 3689 if (parent_) { |
| 3690 // Get our layoutObject in the parent view | 3690 // Get our layoutObject in the parent view |
| 3691 LayoutPartItem layout_item = frame_->OwnerLayoutItem(); | 3691 LayoutPartItem layout_item = frame_->OwnerLayoutItem(); |
| 3692 if (layout_item.IsNull()) | 3692 if (layout_item.IsNull()) |
| 3693 return local_point; | 3693 return local_point; |
| 3694 | 3694 |
| 3695 IntPoint point(local_point); | 3695 IntPoint point(local_point); |
| 3696 | 3696 |
| 3697 // Add borders and padding | 3697 // Add borders and padding |
| 3698 point.Move((layout_item.BorderLeft() + layout_item.PaddingLeft()).ToInt(), | 3698 point.Move((layout_item.BorderLeft() + layout_item.PaddingLeft()).ToInt(), |
| 3699 (layout_item.BorderTop() + layout_item.PaddingTop()).ToInt()); | 3699 (layout_item.BorderTop() + layout_item.PaddingTop()).ToInt()); |
| 3700 return parent->ConvertFromLayoutItem(layout_item, point); | 3700 return parent_->ConvertFromLayoutItem(layout_item, point); |
| 3701 } | 3701 } |
| 3702 | 3702 |
| 3703 return local_point; | 3703 return local_point; |
| 3704 } | 3704 } |
| 3705 | 3705 |
| 3706 IntPoint FrameView::ConvertFromContainingFrameViewBase( | 3706 IntPoint FrameView::ConvertFromContainingFrameViewBase( |
| 3707 const IntPoint& parent_point) const { | 3707 const IntPoint& parent_point) const { |
| 3708 if (const FrameView* parent = ToFrameView(Parent())) { | 3708 if (parent_) { |
| 3709 // Get our layoutObject in the parent view | 3709 // Get our layoutObject in the parent view |
| 3710 LayoutPartItem layout_item = frame_->OwnerLayoutItem(); | 3710 LayoutPartItem layout_item = frame_->OwnerLayoutItem(); |
| 3711 if (layout_item.IsNull()) | 3711 if (layout_item.IsNull()) |
| 3712 return parent_point; | 3712 return parent_point; |
| 3713 | 3713 |
| 3714 IntPoint point = parent->ConvertToLayoutItem(layout_item, parent_point); | 3714 IntPoint point = parent_->ConvertToLayoutItem(layout_item, parent_point); |
| 3715 // Subtract borders and padding | 3715 // Subtract borders and padding |
| 3716 point.Move((-layout_item.BorderLeft() - layout_item.PaddingLeft()).ToInt(), | 3716 point.Move((-layout_item.BorderLeft() - layout_item.PaddingLeft()).ToInt(), |
| 3717 (-layout_item.BorderTop() - layout_item.PaddingTop()).ToInt()); | 3717 (-layout_item.BorderTop() - layout_item.PaddingTop()).ToInt()); |
| 3718 return point; | 3718 return point; |
| 3719 } | 3719 } |
| 3720 | 3720 |
| 3721 return parent_point; | 3721 return parent_point; |
| 3722 } | 3722 } |
| 3723 | 3723 |
| 3724 void FrameView::SetInitialTracksPaintInvalidationsForTesting( | 3724 void FrameView::SetInitialTracksPaintInvalidationsForTesting( |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3834 animating_scrollable_areas_ = new ScrollableAreaSet; | 3834 animating_scrollable_areas_ = new ScrollableAreaSet; |
| 3835 animating_scrollable_areas_->insert(scrollable_area); | 3835 animating_scrollable_areas_->insert(scrollable_area); |
| 3836 } | 3836 } |
| 3837 | 3837 |
| 3838 void FrameView::RemoveAnimatingScrollableArea(ScrollableArea* scrollable_area) { | 3838 void FrameView::RemoveAnimatingScrollableArea(ScrollableArea* scrollable_area) { |
| 3839 if (!animating_scrollable_areas_) | 3839 if (!animating_scrollable_areas_) |
| 3840 return; | 3840 return; |
| 3841 animating_scrollable_areas_->erase(scrollable_area); | 3841 animating_scrollable_areas_->erase(scrollable_area); |
| 3842 } | 3842 } |
| 3843 | 3843 |
| 3844 void FrameView::SetParent(FrameViewBase* parent) { | 3844 FrameView* FrameView::Root() const { |
| 3845 if (parent == Parent()) | 3845 const FrameView* top = this; |
| 3846 while (top->Parent()) | |
| 3847 top = ToFrameView(top->Parent()); | |
| 3848 return const_cast<FrameView*>(top); | |
| 3849 } | |
| 3850 | |
| 3851 void FrameView::SetParent(FrameViewBase* parent_frame_view_base) { | |
| 3852 FrameView* parent = ToFrameView(parent_frame_view_base); | |
| 3853 if (parent == parent_) | |
| 3846 return; | 3854 return; |
| 3847 | 3855 |
| 3848 FrameViewBase::SetParent(parent); | 3856 DCHECK(!parent || !parent_); |
| 3857 if (!parent || !parent->IsVisible()) | |
| 3858 SetParentVisible(false); | |
| 3859 parent_ = parent; | |
| 3860 if (parent && parent->IsVisible()) | |
| 3861 SetParentVisible(true); | |
| 3849 | 3862 |
| 3850 UpdateParentScrollableAreaSet(); | 3863 UpdateParentScrollableAreaSet(); |
| 3851 SetupRenderThrottling(); | 3864 SetupRenderThrottling(); |
| 3852 | 3865 |
| 3853 if (ParentFrameView()) | 3866 if (ParentFrameView()) |
| 3854 subtree_throttled_ = ParentFrameView()->CanThrottleRendering(); | 3867 subtree_throttled_ = ParentFrameView()->CanThrottleRendering(); |
| 3855 } | 3868 } |
| 3856 | 3869 |
| 3857 void FrameView::RemoveChild(FrameViewBase* child) { | 3870 void FrameView::RemoveChild(FrameViewBase* child) { |
| 3858 DCHECK(child->Parent() == this); | 3871 DCHECK(child->Parent() == this); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3974 if (layout_viewport == controller.RootScrollerArea()) | 3987 if (layout_viewport == controller.RootScrollerArea()) |
| 3975 visible_size = controller.RootScrollerVisibleArea(); | 3988 visible_size = controller.RootScrollerVisibleArea(); |
| 3976 | 3989 |
| 3977 IntSize maximum_offset = | 3990 IntSize maximum_offset = |
| 3978 ToIntSize(-ScrollOrigin() + (content_bounds - visible_size)); | 3991 ToIntSize(-ScrollOrigin() + (content_bounds - visible_size)); |
| 3979 return maximum_offset.ExpandedTo(MinimumScrollOffsetInt()); | 3992 return maximum_offset.ExpandedTo(MinimumScrollOffsetInt()); |
| 3980 } | 3993 } |
| 3981 | 3994 |
| 3982 void FrameView::AddChild(FrameViewBase* child) { | 3995 void FrameView::AddChild(FrameViewBase* child) { |
| 3983 DCHECK(child != this && !child->Parent()); | 3996 DCHECK(child != this && !child->Parent()); |
| 3984 DCHECK(!child->IsPluginView()); | |
| 3985 child->SetParent(this); | 3997 child->SetParent(this); |
| 3986 children_.insert(child); | 3998 children_.insert(child); |
| 3987 } | 3999 } |
| 3988 | 4000 |
| 3989 void FrameView::SetScrollbarModes(ScrollbarMode horizontal_mode, | 4001 void FrameView::SetScrollbarModes(ScrollbarMode horizontal_mode, |
| 3990 ScrollbarMode vertical_mode, | 4002 ScrollbarMode vertical_mode, |
| 3991 bool horizontal_lock, | 4003 bool horizontal_lock, |
| 3992 bool vertical_lock) { | 4004 bool vertical_lock) { |
| 3993 bool needs_update = false; | 4005 bool needs_update = false; |
| 3994 | 4006 |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4728 frame_point.Y() > vertical_scrollbar_y_min; | 4740 frame_point.Y() > vertical_scrollbar_y_min; |
| 4729 } | 4741 } |
| 4730 | 4742 |
| 4731 bool FrameView::ScrollbarCornerPresent() const { | 4743 bool FrameView::ScrollbarCornerPresent() const { |
| 4732 return (HorizontalScrollbar() && | 4744 return (HorizontalScrollbar() && |
| 4733 Width() - HorizontalScrollbar()->Width() > 0) || | 4745 Width() - HorizontalScrollbar()->Width() > 0) || |
| 4734 (VerticalScrollbar() && Height() - VerticalScrollbar()->Height() > 0); | 4746 (VerticalScrollbar() && Height() - VerticalScrollbar()->Height() > 0); |
| 4735 } | 4747 } |
| 4736 | 4748 |
| 4737 IntRect FrameView::ConvertToRootFrame(const IntRect& local_rect) const { | 4749 IntRect FrameView::ConvertToRootFrame(const IntRect& local_rect) const { |
| 4738 if (const FrameView* parent = ToFrameView(Parent())) { | 4750 if (parent_) { |
| 4739 IntRect parent_rect = ConvertToContainingFrameViewBase(local_rect); | 4751 IntRect parent_rect = ConvertToContainingFrameViewBase(local_rect); |
| 4740 return parent->ConvertToRootFrame(parent_rect); | 4752 return parent_->ConvertToRootFrame(parent_rect); |
| 4741 } | 4753 } |
| 4742 return local_rect; | 4754 return local_rect; |
| 4743 } | 4755 } |
| 4744 | 4756 |
| 4745 IntPoint FrameView::ConvertToRootFrame(const IntPoint& local_point) const { | 4757 IntPoint FrameView::ConvertToRootFrame(const IntPoint& local_point) const { |
| 4746 if (const FrameView* parent = ToFrameView(Parent())) { | 4758 if (parent_) { |
| 4747 IntPoint parent_point = ConvertToContainingFrameViewBase(local_point); | 4759 IntPoint parent_point = ConvertToContainingFrameViewBase(local_point); |
| 4748 return parent->ConvertToRootFrame(parent_point); | 4760 return parent_->ConvertToRootFrame(parent_point); |
| 4749 } | 4761 } |
| 4750 return local_point; | 4762 return local_point; |
| 4751 } | 4763 } |
| 4752 | 4764 |
| 4753 IntPoint FrameView::ConvertFromContainingFrameViewBaseToScrollbar( | 4765 IntPoint FrameView::ConvertFromContainingFrameViewBaseToScrollbar( |
| 4754 const Scrollbar& scrollbar, | 4766 const Scrollbar& scrollbar, |
| 4755 const IntPoint& parent_point) const { | 4767 const IntPoint& parent_point) const { |
| 4756 IntPoint new_point = parent_point; | 4768 IntPoint new_point = parent_point; |
| 4757 // Scrollbars won't be transformed within us | 4769 // Scrollbars won't be transformed within us |
| 4758 new_point.MoveBy(-scrollbar.Location()); | 4770 new_point.MoveBy(-scrollbar.Location()); |
| 4759 return new_point; | 4771 return new_point; |
| 4760 } | 4772 } |
| 4761 | 4773 |
| 4762 static void SetNeedsCompositingUpdate(LayoutViewItem layout_view_item, | 4774 static void SetNeedsCompositingUpdate(LayoutViewItem layout_view_item, |
| 4763 CompositingUpdateType update_type) { | 4775 CompositingUpdateType update_type) { |
| 4764 if (PaintLayerCompositor* compositor = | 4776 if (PaintLayerCompositor* compositor = |
| 4765 !layout_view_item.IsNull() ? layout_view_item.Compositor() : nullptr) | 4777 !layout_view_item.IsNull() ? layout_view_item.Compositor() : nullptr) |
| 4766 compositor->SetNeedsCompositingUpdate(update_type); | 4778 compositor->SetNeedsCompositingUpdate(update_type); |
| 4767 } | 4779 } |
| 4768 | 4780 |
| 4769 void FrameView::SetParentVisible(bool visible) { | 4781 void FrameView::SetParentVisible(bool visible) { |
| 4770 if (IsParentVisible() == visible) | 4782 if (IsParentVisible() == visible) |
| 4771 return; | 4783 return; |
| 4772 | 4784 |
| 4773 // As parent visibility changes, we may need to recomposite this frame view | 4785 // As parent visibility changes, we may need to recomposite this frame view |
| 4774 // and potentially child frame views. | 4786 // and potentially child frame views. |
| 4775 SetNeedsCompositingUpdate(GetLayoutViewItem(), kCompositingUpdateRebuildTree); | 4787 SetNeedsCompositingUpdate(GetLayoutViewItem(), kCompositingUpdateRebuildTree); |
| 4776 | 4788 |
| 4777 FrameViewBase::SetParentVisible(visible); | 4789 parent_visible_ = visible; |
| 4778 | 4790 |
| 4779 if (!IsSelfVisible()) | 4791 if (!IsSelfVisible()) |
| 4780 return; | 4792 return; |
| 4781 | 4793 |
| 4782 for (const auto& child : children_) | 4794 for (const auto& child : children_) |
| 4783 child->SetParentVisible(visible); | 4795 child->SetParentVisible(visible); |
| 4784 | 4796 |
| 4785 for (const auto& plugin : plugins_) | 4797 for (const auto& plugin : plugins_) |
| 4786 plugin->SetParentVisible(visible); | 4798 plugin->SetParentVisible(visible); |
| 4787 } | 4799 } |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5374 void FrameView::SetAnimationHost( | 5386 void FrameView::SetAnimationHost( |
| 5375 std::unique_ptr<CompositorAnimationHost> host) { | 5387 std::unique_ptr<CompositorAnimationHost> host) { |
| 5376 animation_host_ = std::move(host); | 5388 animation_host_ = std::move(host); |
| 5377 } | 5389 } |
| 5378 | 5390 |
| 5379 LayoutUnit FrameView::CaretWidth() const { | 5391 LayoutUnit FrameView::CaretWidth() const { |
| 5380 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1)); | 5392 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1)); |
| 5381 } | 5393 } |
| 5382 | 5394 |
| 5383 } // namespace blink | 5395 } // namespace blink |
| OLD | NEW |