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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 160 |
161 using namespace HTMLNames; | 161 using namespace HTMLNames; |
162 | 162 |
163 // The maximum number of updatePlugins iterations that should be done before | 163 // The maximum number of updatePlugins iterations that should be done before |
164 // returning. | 164 // returning. |
165 static const unsigned kMaxUpdatePluginsIterations = 2; | 165 static const unsigned kMaxUpdatePluginsIterations = 2; |
166 static const double kResourcePriorityUpdateDelayAfterScroll = 0.250; | 166 static const double kResourcePriorityUpdateDelayAfterScroll = 0.250; |
167 | 167 |
168 static bool g_initial_track_all_paint_invalidations = false; | 168 static bool g_initial_track_all_paint_invalidations = false; |
169 | 169 |
170 FrameView::FrameView(LocalFrame& frame) | 170 FrameView::FrameView(LocalFrame& frame, IntRect frame_rect) |
171 : frame_(frame), | 171 : frame_(frame), |
| 172 frame_rect_(frame_rect), |
| 173 parent_(nullptr), |
172 display_mode_(kWebDisplayModeBrowser), | 174 display_mode_(kWebDisplayModeBrowser), |
173 can_have_scrollbars_(true), | 175 can_have_scrollbars_(true), |
174 has_pending_layout_(false), | 176 has_pending_layout_(false), |
175 in_synchronous_post_layout_(false), | 177 in_synchronous_post_layout_(false), |
176 post_layout_tasks_timer_( | 178 post_layout_tasks_timer_( |
177 TaskRunnerHelper::Get(TaskType::kUnspecedTimer, &frame), | 179 TaskRunnerHelper::Get(TaskType::kUnspecedTimer, &frame), |
178 this, | 180 this, |
179 &FrameView::PostLayoutTimerFired), | 181 &FrameView::PostLayoutTimerFired), |
180 update_plugins_timer_( | 182 update_plugins_timer_( |
181 TaskRunnerHelper::Get(TaskType::kUnspecedTimer, &frame), | 183 TaskRunnerHelper::Get(TaskType::kUnspecedTimer, &frame), |
(...skipping 26 matching lines...) Expand all Loading... |
208 scroll_anchor_(this), | 210 scroll_anchor_(this), |
209 scrollbar_manager_(*this), | 211 scrollbar_manager_(*this), |
210 needs_scrollbars_update_(false), | 212 needs_scrollbars_update_(false), |
211 suppress_adjust_view_size_(false), | 213 suppress_adjust_view_size_(false), |
212 allows_layout_invalidation_after_layout_clean_(true), | 214 allows_layout_invalidation_after_layout_clean_(true), |
213 main_thread_scrolling_reasons_(0) { | 215 main_thread_scrolling_reasons_(0) { |
214 Init(); | 216 Init(); |
215 } | 217 } |
216 | 218 |
217 FrameView* FrameView::Create(LocalFrame& frame) { | 219 FrameView* FrameView::Create(LocalFrame& frame) { |
218 FrameView* view = new FrameView(frame); | 220 FrameView* view = new FrameView(frame, IntRect()); |
219 view->Show(); | 221 view->Show(); |
220 return view; | 222 return view; |
221 } | 223 } |
222 | 224 |
223 FrameView* FrameView::Create(LocalFrame& frame, const IntSize& initial_size) { | 225 FrameView* FrameView::Create(LocalFrame& frame, const IntSize& initial_size) { |
224 FrameView* view = new FrameView(frame); | 226 FrameView* view = new FrameView(frame, IntRect(IntPoint(), initial_size)); |
225 view->FrameViewBase::SetFrameRect(IntRect(view->Location(), initial_size)); | |
226 view->SetLayoutSizeInternal(initial_size); | 227 view->SetLayoutSizeInternal(initial_size); |
227 | 228 |
228 view->Show(); | 229 view->Show(); |
229 return view; | 230 return view; |
230 } | 231 } |
231 | 232 |
232 FrameView::~FrameView() { | 233 FrameView::~FrameView() { |
233 ASSERT(has_been_disposed_); | 234 ASSERT(has_been_disposed_); |
234 } | 235 } |
235 | 236 |
236 DEFINE_TRACE(FrameView) { | 237 DEFINE_TRACE(FrameView) { |
237 visitor->Trace(frame_); | 238 visitor->Trace(frame_); |
| 239 visitor->Trace(parent_); |
238 visitor->Trace(fragment_anchor_); | 240 visitor->Trace(fragment_anchor_); |
239 visitor->Trace(scrollable_areas_); | 241 visitor->Trace(scrollable_areas_); |
240 visitor->Trace(animating_scrollable_areas_); | 242 visitor->Trace(animating_scrollable_areas_); |
241 visitor->Trace(auto_size_info_); | 243 visitor->Trace(auto_size_info_); |
242 visitor->Trace(children_); | 244 visitor->Trace(children_); |
243 visitor->Trace(plugins_); | 245 visitor->Trace(plugins_); |
244 visitor->Trace(scrollbars_); | 246 visitor->Trace(scrollbars_); |
245 visitor->Trace(viewport_scrollable_area_); | 247 visitor->Trace(viewport_scrollable_area_); |
246 visitor->Trace(visibility_observer_); | 248 visitor->Trace(visibility_observer_); |
247 visitor->Trace(scroll_anchor_); | 249 visitor->Trace(scroll_anchor_); |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 IntRect paint_invalidation_rect = rect; | 538 IntRect paint_invalidation_rect = rect; |
537 paint_invalidation_rect.Move( | 539 paint_invalidation_rect.Move( |
538 (layout_item.BorderLeft() + layout_item.PaddingLeft()).ToInt(), | 540 (layout_item.BorderLeft() + layout_item.PaddingLeft()).ToInt(), |
539 (layout_item.BorderTop() + layout_item.PaddingTop()).ToInt()); | 541 (layout_item.BorderTop() + layout_item.PaddingTop()).ToInt()); |
540 // FIXME: We should not allow paint invalidation out of paint invalidation | 542 // FIXME: We should not allow paint invalidation out of paint invalidation |
541 // state. crbug.com/457415 | 543 // state. crbug.com/457415 |
542 DisablePaintInvalidationStateAsserts paint_invalidation_assert_disabler; | 544 DisablePaintInvalidationStateAsserts paint_invalidation_assert_disabler; |
543 layout_item.InvalidatePaintRectangle(LayoutRect(paint_invalidation_rect)); | 545 layout_item.InvalidatePaintRectangle(LayoutRect(paint_invalidation_rect)); |
544 } | 546 } |
545 | 547 |
546 void FrameView::SetFrameRect(const IntRect& new_rect) { | 548 void FrameView::SetFrameRect(const IntRect& frame_rect) { |
547 IntRect old_rect = FrameRect(); | 549 if (frame_rect == frame_rect_) |
548 if (new_rect == old_rect) | |
549 return; | 550 return; |
550 | 551 |
551 FrameViewBase::SetFrameRect(new_rect); | 552 const bool width_changed = frame_rect_.Width() != frame_rect.Width(); |
| 553 const bool height_changed = frame_rect_.Height() != frame_rect.Height(); |
| 554 frame_rect_ = frame_rect; |
552 | 555 |
553 const bool frame_size_changed = old_rect.Size() != new_rect.Size(); | 556 needs_scrollbars_update_ = width_changed || height_changed; |
554 | |
555 needs_scrollbars_update_ = frame_size_changed; | |
556 // TODO(wjmaclean): find out why scrollbars fail to resize for complex | 557 // TODO(wjmaclean): find out why scrollbars fail to resize for complex |
557 // subframes after changing the zoom level. For now always calling | 558 // subframes after changing the zoom level. For now always calling |
558 // updateScrollbarsIfNeeded() here fixes the issue, but it would be good to | 559 // updateScrollbarsIfNeeded() here fixes the issue, but it would be good to |
559 // discover the deeper cause of this. http://crbug.com/607987. | 560 // discover the deeper cause of this. http://crbug.com/607987. |
560 UpdateScrollbarsIfNeeded(); | 561 UpdateScrollbarsIfNeeded(); |
561 | 562 |
562 FrameRectsChanged(); | 563 FrameRectsChanged(); |
563 | 564 |
564 UpdateParentScrollableAreaSet(); | 565 UpdateParentScrollableAreaSet(); |
565 | 566 |
566 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && | 567 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && |
567 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 568 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
568 // The overflow clip property depends on the frame size and the pre | 569 // The overflow clip property depends on the frame size and the pre |
569 // translation property depends on the frame location. | 570 // translation property depends on the frame location. |
570 SetNeedsPaintPropertyUpdate(); | 571 SetNeedsPaintPropertyUpdate(); |
571 } | 572 } |
572 | 573 |
573 if (auto layout_view_item = this->GetLayoutViewItem()) | 574 if (auto layout_view_item = this->GetLayoutViewItem()) |
574 layout_view_item.SetMayNeedPaintInvalidation(); | 575 layout_view_item.SetMayNeedPaintInvalidation(); |
575 | 576 |
576 if (frame_size_changed) { | 577 if (width_changed || height_changed) { |
577 ViewportSizeChanged(new_rect.Width() != old_rect.Width(), | 578 ViewportSizeChanged(width_changed, height_changed); |
578 new_rect.Height() != old_rect.Height()); | |
579 | 579 |
580 if (frame_->IsMainFrame()) | 580 if (frame_->IsMainFrame()) |
581 frame_->GetPage()->GetVisualViewport().MainFrameDidChangeSize(); | 581 frame_->GetPage()->GetVisualViewport().MainFrameDidChangeSize(); |
582 | 582 |
583 GetFrame().Loader().RestoreScrollPositionAndViewState(); | 583 GetFrame().Loader().RestoreScrollPositionAndViewState(); |
584 } | 584 } |
585 } | 585 } |
586 | 586 |
587 Page* FrameView::GetPage() const { | 587 Page* FrameView::GetPage() const { |
588 return GetFrame().GetPage(); | 588 return GetFrame().GetPage(); |
(...skipping 3040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3629 IntPoint FrameView::ConvertSelfToChild(const FrameViewBase* child, | 3629 IntPoint FrameView::ConvertSelfToChild(const FrameViewBase* child, |
3630 const IntPoint& point) const { | 3630 const IntPoint& point) const { |
3631 IntPoint new_point = point; | 3631 IntPoint new_point = point; |
3632 new_point = FrameToContents(point); | 3632 new_point = FrameToContents(point); |
3633 new_point.MoveBy(-child->Location()); | 3633 new_point.MoveBy(-child->Location()); |
3634 return new_point; | 3634 return new_point; |
3635 } | 3635 } |
3636 | 3636 |
3637 IntRect FrameView::ConvertToContainingFrameViewBase( | 3637 IntRect FrameView::ConvertToContainingFrameViewBase( |
3638 const IntRect& local_rect) const { | 3638 const IntRect& local_rect) const { |
3639 if (const FrameView* parent = ToFrameView(Parent())) { | 3639 if (parent_) { |
3640 // Get our layoutObject in the parent view | 3640 // Get our layoutObject in the parent view |
3641 LayoutPartItem layout_item = frame_->OwnerLayoutItem(); | 3641 LayoutPartItem layout_item = frame_->OwnerLayoutItem(); |
3642 if (layout_item.IsNull()) | 3642 if (layout_item.IsNull()) |
3643 return local_rect; | 3643 return local_rect; |
3644 | 3644 |
3645 IntRect rect(local_rect); | 3645 IntRect rect(local_rect); |
3646 // Add borders and padding?? | 3646 // Add borders and padding?? |
3647 rect.Move((layout_item.BorderLeft() + layout_item.PaddingLeft()).ToInt(), | 3647 rect.Move((layout_item.BorderLeft() + layout_item.PaddingLeft()).ToInt(), |
3648 (layout_item.BorderTop() + layout_item.PaddingTop()).ToInt()); | 3648 (layout_item.BorderTop() + layout_item.PaddingTop()).ToInt()); |
3649 return parent->ConvertFromLayoutItem(layout_item, rect); | 3649 return parent_->ConvertFromLayoutItem(layout_item, rect); |
3650 } | 3650 } |
3651 | 3651 |
3652 return local_rect; | 3652 return local_rect; |
3653 } | 3653 } |
3654 | 3654 |
3655 IntRect FrameView::ConvertFromContainingFrameViewBase( | 3655 IntRect FrameView::ConvertFromContainingFrameViewBase( |
3656 const IntRect& parent_rect) const { | 3656 const IntRect& parent_rect) const { |
3657 if (const FrameView* parent = ToFrameView(Parent())) { | 3657 if (parent_) { |
3658 IntRect local_rect = parent_rect; | 3658 IntRect local_rect = parent_rect; |
3659 local_rect.SetLocation( | 3659 local_rect.SetLocation( |
3660 parent->ConvertSelfToChild(this, local_rect.Location())); | 3660 parent_->ConvertSelfToChild(this, local_rect.Location())); |
3661 return local_rect; | 3661 return local_rect; |
3662 } | 3662 } |
3663 | 3663 |
3664 return parent_rect; | 3664 return parent_rect; |
3665 } | 3665 } |
3666 | 3666 |
3667 IntPoint FrameView::ConvertToContainingFrameViewBase( | 3667 IntPoint FrameView::ConvertToContainingFrameViewBase( |
3668 const IntPoint& local_point) const { | 3668 const IntPoint& local_point) const { |
3669 if (const FrameView* parent = ToFrameView(Parent())) { | 3669 if (parent_) { |
3670 // Get our layoutObject in the parent view | 3670 // Get our layoutObject in the parent view |
3671 LayoutPartItem layout_item = frame_->OwnerLayoutItem(); | 3671 LayoutPartItem layout_item = frame_->OwnerLayoutItem(); |
3672 if (layout_item.IsNull()) | 3672 if (layout_item.IsNull()) |
3673 return local_point; | 3673 return local_point; |
3674 | 3674 |
3675 IntPoint point(local_point); | 3675 IntPoint point(local_point); |
3676 | 3676 |
3677 // Add borders and padding | 3677 // Add borders and padding |
3678 point.Move((layout_item.BorderLeft() + layout_item.PaddingLeft()).ToInt(), | 3678 point.Move((layout_item.BorderLeft() + layout_item.PaddingLeft()).ToInt(), |
3679 (layout_item.BorderTop() + layout_item.PaddingTop()).ToInt()); | 3679 (layout_item.BorderTop() + layout_item.PaddingTop()).ToInt()); |
3680 return parent->ConvertFromLayoutItem(layout_item, point); | 3680 return parent_->ConvertFromLayoutItem(layout_item, point); |
3681 } | 3681 } |
3682 | 3682 |
3683 return local_point; | 3683 return local_point; |
3684 } | 3684 } |
3685 | 3685 |
3686 IntPoint FrameView::ConvertFromContainingFrameViewBase( | 3686 IntPoint FrameView::ConvertFromContainingFrameViewBase( |
3687 const IntPoint& parent_point) const { | 3687 const IntPoint& parent_point) const { |
3688 if (const FrameView* parent = ToFrameView(Parent())) { | 3688 if (parent_) { |
3689 // Get our layoutObject in the parent view | 3689 // Get our layoutObject in the parent view |
3690 LayoutPartItem layout_item = frame_->OwnerLayoutItem(); | 3690 LayoutPartItem layout_item = frame_->OwnerLayoutItem(); |
3691 if (layout_item.IsNull()) | 3691 if (layout_item.IsNull()) |
3692 return parent_point; | 3692 return parent_point; |
3693 | 3693 |
3694 IntPoint point = parent->ConvertToLayoutItem(layout_item, parent_point); | 3694 IntPoint point = parent_->ConvertToLayoutItem(layout_item, parent_point); |
3695 // Subtract borders and padding | 3695 // Subtract borders and padding |
3696 point.Move((-layout_item.BorderLeft() - layout_item.PaddingLeft()).ToInt(), | 3696 point.Move((-layout_item.BorderLeft() - layout_item.PaddingLeft()).ToInt(), |
3697 (-layout_item.BorderTop() - layout_item.PaddingTop()).ToInt()); | 3697 (-layout_item.BorderTop() - layout_item.PaddingTop()).ToInt()); |
3698 return point; | 3698 return point; |
3699 } | 3699 } |
3700 | 3700 |
3701 return parent_point; | 3701 return parent_point; |
3702 } | 3702 } |
3703 | 3703 |
3704 void FrameView::SetInitialTracksPaintInvalidationsForTesting( | 3704 void FrameView::SetInitialTracksPaintInvalidationsForTesting( |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3814 animating_scrollable_areas_ = new ScrollableAreaSet; | 3814 animating_scrollable_areas_ = new ScrollableAreaSet; |
3815 animating_scrollable_areas_->insert(scrollable_area); | 3815 animating_scrollable_areas_->insert(scrollable_area); |
3816 } | 3816 } |
3817 | 3817 |
3818 void FrameView::RemoveAnimatingScrollableArea(ScrollableArea* scrollable_area) { | 3818 void FrameView::RemoveAnimatingScrollableArea(ScrollableArea* scrollable_area) { |
3819 if (!animating_scrollable_areas_) | 3819 if (!animating_scrollable_areas_) |
3820 return; | 3820 return; |
3821 animating_scrollable_areas_->erase(scrollable_area); | 3821 animating_scrollable_areas_->erase(scrollable_area); |
3822 } | 3822 } |
3823 | 3823 |
3824 void FrameView::SetParent(FrameViewBase* parent) { | 3824 FrameView* FrameView::Root() const { |
3825 if (parent == Parent()) | 3825 const FrameView* top = this; |
| 3826 while (top->Parent()) |
| 3827 top = ToFrameView(top->Parent()); |
| 3828 return const_cast<FrameView*>(top); |
| 3829 } |
| 3830 |
| 3831 void FrameView::SetParent(FrameViewBase* parent_frame_view_base) { |
| 3832 FrameView* parent = ToFrameView(parent_frame_view_base); |
| 3833 if (parent == parent_) |
3826 return; | 3834 return; |
3827 | 3835 |
3828 FrameViewBase::SetParent(parent); | 3836 DCHECK(!parent || !parent_); |
| 3837 if (!parent || !parent->IsVisible()) |
| 3838 SetParentVisible(false); |
| 3839 parent_ = parent; |
| 3840 if (parent && parent->IsVisible()) |
| 3841 SetParentVisible(true); |
3829 | 3842 |
3830 UpdateParentScrollableAreaSet(); | 3843 UpdateParentScrollableAreaSet(); |
3831 SetupRenderThrottling(); | 3844 SetupRenderThrottling(); |
3832 | 3845 |
3833 if (ParentFrameView()) | 3846 if (ParentFrameView()) |
3834 subtree_throttled_ = ParentFrameView()->CanThrottleRendering(); | 3847 subtree_throttled_ = ParentFrameView()->CanThrottleRendering(); |
3835 } | 3848 } |
3836 | 3849 |
3837 void FrameView::RemoveChild(FrameViewBase* child) { | 3850 void FrameView::RemoveChild(FrameViewBase* child) { |
3838 DCHECK(child->Parent() == this); | 3851 DCHECK(child->Parent() == this); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3954 if (layout_viewport == controller.RootScrollerArea()) | 3967 if (layout_viewport == controller.RootScrollerArea()) |
3955 visible_size = controller.RootScrollerVisibleArea(); | 3968 visible_size = controller.RootScrollerVisibleArea(); |
3956 | 3969 |
3957 IntSize maximum_offset = | 3970 IntSize maximum_offset = |
3958 ToIntSize(-ScrollOrigin() + (content_bounds - visible_size)); | 3971 ToIntSize(-ScrollOrigin() + (content_bounds - visible_size)); |
3959 return maximum_offset.ExpandedTo(MinimumScrollOffsetInt()); | 3972 return maximum_offset.ExpandedTo(MinimumScrollOffsetInt()); |
3960 } | 3973 } |
3961 | 3974 |
3962 void FrameView::AddChild(FrameViewBase* child) { | 3975 void FrameView::AddChild(FrameViewBase* child) { |
3963 DCHECK(child != this && !child->Parent()); | 3976 DCHECK(child != this && !child->Parent()); |
3964 DCHECK(!child->IsPluginView()); | |
3965 child->SetParent(this); | 3977 child->SetParent(this); |
3966 children_.insert(child); | 3978 children_.insert(child); |
3967 } | 3979 } |
3968 | 3980 |
3969 void FrameView::SetScrollbarModes(ScrollbarMode horizontal_mode, | 3981 void FrameView::SetScrollbarModes(ScrollbarMode horizontal_mode, |
3970 ScrollbarMode vertical_mode, | 3982 ScrollbarMode vertical_mode, |
3971 bool horizontal_lock, | 3983 bool horizontal_lock, |
3972 bool vertical_lock) { | 3984 bool vertical_lock) { |
3973 bool needs_update = false; | 3985 bool needs_update = false; |
3974 | 3986 |
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4708 frame_point.Y() > vertical_scrollbar_y_min; | 4720 frame_point.Y() > vertical_scrollbar_y_min; |
4709 } | 4721 } |
4710 | 4722 |
4711 bool FrameView::ScrollbarCornerPresent() const { | 4723 bool FrameView::ScrollbarCornerPresent() const { |
4712 return (HorizontalScrollbar() && | 4724 return (HorizontalScrollbar() && |
4713 Width() - HorizontalScrollbar()->Width() > 0) || | 4725 Width() - HorizontalScrollbar()->Width() > 0) || |
4714 (VerticalScrollbar() && Height() - VerticalScrollbar()->Height() > 0); | 4726 (VerticalScrollbar() && Height() - VerticalScrollbar()->Height() > 0); |
4715 } | 4727 } |
4716 | 4728 |
4717 IntRect FrameView::ConvertToRootFrame(const IntRect& local_rect) const { | 4729 IntRect FrameView::ConvertToRootFrame(const IntRect& local_rect) const { |
4718 if (const FrameView* parent = ToFrameView(Parent())) { | 4730 if (parent_) { |
4719 IntRect parent_rect = ConvertToContainingFrameViewBase(local_rect); | 4731 IntRect parent_rect = ConvertToContainingFrameViewBase(local_rect); |
4720 return parent->ConvertToRootFrame(parent_rect); | 4732 return parent_->ConvertToRootFrame(parent_rect); |
4721 } | 4733 } |
4722 return local_rect; | 4734 return local_rect; |
4723 } | 4735 } |
4724 | 4736 |
4725 IntPoint FrameView::ConvertToRootFrame(const IntPoint& local_point) const { | 4737 IntPoint FrameView::ConvertToRootFrame(const IntPoint& local_point) const { |
4726 if (const FrameView* parent = ToFrameView(Parent())) { | 4738 if (parent_) { |
4727 IntPoint parent_point = ConvertToContainingFrameViewBase(local_point); | 4739 IntPoint parent_point = ConvertToContainingFrameViewBase(local_point); |
4728 return parent->ConvertToRootFrame(parent_point); | 4740 return parent_->ConvertToRootFrame(parent_point); |
4729 } | 4741 } |
4730 return local_point; | 4742 return local_point; |
4731 } | 4743 } |
4732 | 4744 |
4733 IntPoint FrameView::ConvertFromContainingFrameViewBaseToScrollbar( | 4745 IntPoint FrameView::ConvertFromContainingFrameViewBaseToScrollbar( |
4734 const Scrollbar& scrollbar, | 4746 const Scrollbar& scrollbar, |
4735 const IntPoint& parent_point) const { | 4747 const IntPoint& parent_point) const { |
4736 IntPoint new_point = parent_point; | 4748 IntPoint new_point = parent_point; |
4737 // Scrollbars won't be transformed within us | 4749 // Scrollbars won't be transformed within us |
4738 new_point.MoveBy(-scrollbar.Location()); | 4750 new_point.MoveBy(-scrollbar.Location()); |
4739 return new_point; | 4751 return new_point; |
4740 } | 4752 } |
4741 | 4753 |
4742 static void SetNeedsCompositingUpdate(LayoutViewItem layout_view_item, | 4754 static void SetNeedsCompositingUpdate(LayoutViewItem layout_view_item, |
4743 CompositingUpdateType update_type) { | 4755 CompositingUpdateType update_type) { |
4744 if (PaintLayerCompositor* compositor = | 4756 if (PaintLayerCompositor* compositor = |
4745 !layout_view_item.IsNull() ? layout_view_item.Compositor() : nullptr) | 4757 !layout_view_item.IsNull() ? layout_view_item.Compositor() : nullptr) |
4746 compositor->SetNeedsCompositingUpdate(update_type); | 4758 compositor->SetNeedsCompositingUpdate(update_type); |
4747 } | 4759 } |
4748 | 4760 |
4749 void FrameView::SetParentVisible(bool visible) { | 4761 void FrameView::SetParentVisible(bool visible) { |
4750 if (IsParentVisible() == visible) | 4762 if (IsParentVisible() == visible) |
4751 return; | 4763 return; |
4752 | 4764 |
4753 // As parent visibility changes, we may need to recomposite this frame view | 4765 // As parent visibility changes, we may need to recomposite this frame view |
4754 // and potentially child frame views. | 4766 // and potentially child frame views. |
4755 SetNeedsCompositingUpdate(GetLayoutViewItem(), kCompositingUpdateRebuildTree); | 4767 SetNeedsCompositingUpdate(GetLayoutViewItem(), kCompositingUpdateRebuildTree); |
4756 | 4768 |
4757 FrameViewBase::SetParentVisible(visible); | 4769 parent_visible_ = visible; |
4758 | 4770 |
4759 if (!IsSelfVisible()) | 4771 if (!IsSelfVisible()) |
4760 return; | 4772 return; |
4761 | 4773 |
4762 for (const auto& child : children_) | 4774 for (const auto& child : children_) |
4763 child->SetParentVisible(visible); | 4775 child->SetParentVisible(visible); |
4764 | 4776 |
4765 for (const auto& plugin : plugins_) | 4777 for (const auto& plugin : plugins_) |
4766 plugin->SetParentVisible(visible); | 4778 plugin->SetParentVisible(visible); |
4767 } | 4779 } |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5354 void FrameView::SetAnimationHost( | 5366 void FrameView::SetAnimationHost( |
5355 std::unique_ptr<CompositorAnimationHost> host) { | 5367 std::unique_ptr<CompositorAnimationHost> host) { |
5356 animation_host_ = std::move(host); | 5368 animation_host_ = std::move(host); |
5357 } | 5369 } |
5358 | 5370 |
5359 LayoutUnit FrameView::CaretWidth() const { | 5371 LayoutUnit FrameView::CaretWidth() const { |
5360 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1)); | 5372 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1)); |
5361 } | 5373 } |
5362 | 5374 |
5363 } // namespace blink | 5375 } // namespace blink |
OLD | NEW |