| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, IntRect frame_rect) | 171 FrameView::FrameView(LocalFrame& frame, IntRect frame_rect) |
| 172 : frame_(frame), | 172 : frame_(frame), |
| 173 frame_rect_(frame_rect), | 173 frame_rect_(frame_rect), |
| 174 parent_(nullptr), | 174 parent_(nullptr), |
| 175 frame_view_state_(kNotAttached), |
| 175 display_mode_(kWebDisplayModeBrowser), | 176 display_mode_(kWebDisplayModeBrowser), |
| 176 can_have_scrollbars_(true), | 177 can_have_scrollbars_(true), |
| 177 has_pending_layout_(false), | 178 has_pending_layout_(false), |
| 178 in_synchronous_post_layout_(false), | 179 in_synchronous_post_layout_(false), |
| 179 post_layout_tasks_timer_( | 180 post_layout_tasks_timer_( |
| 180 TaskRunnerHelper::Get(TaskType::kUnspecedTimer, &frame), | 181 TaskRunnerHelper::Get(TaskType::kUnspecedTimer, &frame), |
| 181 this, | 182 this, |
| 182 &FrameView::PostLayoutTimerFired), | 183 &FrameView::PostLayoutTimerFired), |
| 183 update_plugins_timer_( | 184 update_plugins_timer_( |
| 184 TaskRunnerHelper::Get(TaskType::kUnspecedTimer, &frame), | 185 TaskRunnerHelper::Get(TaskType::kUnspecedTimer, &frame), |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 if (!frame_view) | 370 if (!frame_view) |
| 370 return; | 371 return; |
| 371 frame_view->UpdateRenderThrottlingStatus( | 372 frame_view->UpdateRenderThrottlingStatus( |
| 372 !is_visible, frame_view->subtree_throttled_); | 373 !is_visible, frame_view->subtree_throttled_); |
| 373 }, | 374 }, |
| 374 WrapWeakPersistent(this))); | 375 WrapWeakPersistent(this))); |
| 375 visibility_observer_->Start(); | 376 visibility_observer_->Start(); |
| 376 } | 377 } |
| 377 | 378 |
| 378 void FrameView::Dispose() { | 379 void FrameView::Dispose() { |
| 380 SetFrameOrPluginState(kDisposed); |
| 379 CHECK(!IsInPerformLayout()); | 381 CHECK(!IsInPerformLayout()); |
| 380 | 382 |
| 381 if (ScrollAnimatorBase* scroll_animator = ExistingScrollAnimator()) | 383 if (ScrollAnimatorBase* scroll_animator = ExistingScrollAnimator()) |
| 382 scroll_animator->CancelAnimation(); | 384 scroll_animator->CancelAnimation(); |
| 383 CancelProgrammaticScrollAnimation(); | 385 CancelProgrammaticScrollAnimation(); |
| 384 | 386 |
| 385 DetachScrollbars(); | 387 DetachScrollbars(); |
| 386 | 388 |
| 387 if (ScrollingCoordinator* scrolling_coordinator = | 389 if (ScrollingCoordinator* scrolling_coordinator = |
| 388 this->GetScrollingCoordinator()) | 390 this->GetScrollingCoordinator()) |
| (...skipping 2531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2920 // background color of the FrameView. This should match the color drawn by | 2922 // background color of the FrameView. This should match the color drawn by |
| 2921 // ViewPainter::paintBoxDecorationBackground. | 2923 // ViewPainter::paintBoxDecorationBackground. |
| 2922 Color result = BaseBackgroundColor(); | 2924 Color result = BaseBackgroundColor(); |
| 2923 LayoutItem document_layout_object = GetLayoutViewItem(); | 2925 LayoutItem document_layout_object = GetLayoutViewItem(); |
| 2924 if (!document_layout_object.IsNull()) | 2926 if (!document_layout_object.IsNull()) |
| 2925 result = result.Blend( | 2927 result = result.Blend( |
| 2926 document_layout_object.ResolveColor(CSSPropertyBackgroundColor)); | 2928 document_layout_object.ResolveColor(CSSPropertyBackgroundColor)); |
| 2927 return result; | 2929 return result; |
| 2928 } | 2930 } |
| 2929 | 2931 |
| 2930 FrameView* FrameView::ParentFrameView() const { | |
| 2931 if (!Parent()) | |
| 2932 return nullptr; | |
| 2933 | |
| 2934 Frame* parent_frame = frame_->Tree().Parent(); | |
| 2935 if (parent_frame && parent_frame->IsLocalFrame()) | |
| 2936 return ToLocalFrame(parent_frame)->View(); | |
| 2937 | |
| 2938 return nullptr; | |
| 2939 } | |
| 2940 | |
| 2941 void FrameView::DidChangeGlobalRootScroller() { | 2932 void FrameView::DidChangeGlobalRootScroller() { |
| 2942 if (!frame_->GetSettings() || !frame_->GetSettings()->GetViewportEnabled()) | 2933 if (!frame_->GetSettings() || !frame_->GetSettings()->GetViewportEnabled()) |
| 2943 return; | 2934 return; |
| 2944 | 2935 |
| 2945 // Avoid drawing two sets of scrollbars when visual viewport is enabled. | 2936 // Avoid drawing two sets of scrollbars when visual viewport is enabled. |
| 2946 VisualViewportScrollbarsChanged(); | 2937 VisualViewportScrollbarsChanged(); |
| 2947 } | 2938 } |
| 2948 | 2939 |
| 2949 // TODO(pdr): This logic is similar to adjustScrollbarExistence and the common | 2940 // TODO(pdr): This logic is similar to adjustScrollbarExistence and the common |
| 2950 // logic should be factored into a helper. | 2941 // logic should be factored into a helper. |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3670 IntPoint FrameView::ConvertSelfToChild(const FrameOrPlugin& child, | 3661 IntPoint FrameView::ConvertSelfToChild(const FrameOrPlugin& child, |
| 3671 const IntPoint& point) const { | 3662 const IntPoint& point) const { |
| 3672 IntPoint new_point = point; | 3663 IntPoint new_point = point; |
| 3673 new_point = FrameToContents(point); | 3664 new_point = FrameToContents(point); |
| 3674 new_point.MoveBy(-child.FrameRect().Location()); | 3665 new_point.MoveBy(-child.FrameRect().Location()); |
| 3675 return new_point; | 3666 return new_point; |
| 3676 } | 3667 } |
| 3677 | 3668 |
| 3678 IntRect FrameView::ConvertToContainingFrameViewBase( | 3669 IntRect FrameView::ConvertToContainingFrameViewBase( |
| 3679 const IntRect& local_rect) const { | 3670 const IntRect& local_rect) const { |
| 3680 if (parent_) { | 3671 DCHECK(frame_view_state_ == kAttached); |
| 3672 if (FrameView* parent = ParentFrameView()) { |
| 3681 // Get our layoutObject in the parent view | 3673 // Get our layoutObject in the parent view |
| 3682 LayoutPartItem layout_item = frame_->OwnerLayoutItem(); | 3674 LayoutPartItem layout_item = frame_->OwnerLayoutItem(); |
| 3683 if (layout_item.IsNull()) | 3675 if (layout_item.IsNull()) |
| 3684 return local_rect; | 3676 return local_rect; |
| 3685 | 3677 |
| 3686 IntRect rect(local_rect); | 3678 IntRect rect(local_rect); |
| 3687 // Add borders and padding?? | 3679 // Add borders and padding?? |
| 3688 rect.Move((layout_item.BorderLeft() + layout_item.PaddingLeft()).ToInt(), | 3680 rect.Move((layout_item.BorderLeft() + layout_item.PaddingLeft()).ToInt(), |
| 3689 (layout_item.BorderTop() + layout_item.PaddingTop()).ToInt()); | 3681 (layout_item.BorderTop() + layout_item.PaddingTop()).ToInt()); |
| 3690 return parent_->ConvertFromLayoutItem(layout_item, rect); | 3682 return parent->ConvertFromLayoutItem(layout_item, rect); |
| 3691 } | 3683 } |
| 3692 | 3684 |
| 3693 return local_rect; | 3685 return local_rect; |
| 3694 } | 3686 } |
| 3695 | 3687 |
| 3696 IntRect FrameView::ConvertFromContainingFrameViewBase( | 3688 IntRect FrameView::ConvertFromContainingFrameViewBase( |
| 3697 const IntRect& parent_rect) const { | 3689 const IntRect& parent_rect) const { |
| 3698 if (parent_) { | 3690 DCHECK(frame_view_state_ == kAttached); |
| 3691 if (FrameView* parent = ParentFrameView()) { |
| 3699 IntRect local_rect = parent_rect; | 3692 IntRect local_rect = parent_rect; |
| 3700 local_rect.SetLocation( | 3693 local_rect.SetLocation( |
| 3701 parent_->ConvertSelfToChild(*this, local_rect.Location())); | 3694 parent->ConvertSelfToChild(*this, local_rect.Location())); |
| 3702 return local_rect; | 3695 return local_rect; |
| 3703 } | 3696 } |
| 3704 | 3697 |
| 3705 return parent_rect; | 3698 return parent_rect; |
| 3706 } | 3699 } |
| 3707 | 3700 |
| 3708 IntPoint FrameView::ConvertToContainingFrameViewBase( | 3701 IntPoint FrameView::ConvertToContainingFrameViewBase( |
| 3709 const IntPoint& local_point) const { | 3702 const IntPoint& local_point) const { |
| 3710 if (parent_) { | 3703 DCHECK(frame_->IsLocalRoot() || frame_view_state_ == kAttached); |
| 3704 if (FrameView* parent = ParentFrameView()) { |
| 3711 // Get our layoutObject in the parent view | 3705 // Get our layoutObject in the parent view |
| 3712 LayoutPartItem layout_item = frame_->OwnerLayoutItem(); | 3706 LayoutPartItem layout_item = frame_->OwnerLayoutItem(); |
| 3713 if (layout_item.IsNull()) | 3707 if (layout_item.IsNull()) |
| 3714 return local_point; | 3708 return local_point; |
| 3715 | 3709 |
| 3716 IntPoint point(local_point); | 3710 IntPoint point(local_point); |
| 3717 | 3711 |
| 3718 // Add borders and padding | 3712 // Add borders and padding |
| 3719 point.Move((layout_item.BorderLeft() + layout_item.PaddingLeft()).ToInt(), | 3713 point.Move((layout_item.BorderLeft() + layout_item.PaddingLeft()).ToInt(), |
| 3720 (layout_item.BorderTop() + layout_item.PaddingTop()).ToInt()); | 3714 (layout_item.BorderTop() + layout_item.PaddingTop()).ToInt()); |
| 3721 return parent_->ConvertFromLayoutItem(layout_item, point); | 3715 return parent->ConvertFromLayoutItem(layout_item, point); |
| 3722 } | 3716 } |
| 3723 | 3717 |
| 3724 return local_point; | 3718 return local_point; |
| 3725 } | 3719 } |
| 3726 | 3720 |
| 3727 IntPoint FrameView::ConvertFromContainingFrameViewBase( | 3721 IntPoint FrameView::ConvertFromContainingFrameViewBase( |
| 3728 const IntPoint& parent_point) const { | 3722 const IntPoint& parent_point) const { |
| 3729 if (parent_) { | 3723 DCHECK(frame_->IsLocalRoot() || frame_view_state_ == kAttached); |
| 3724 if (FrameView* parent = ParentFrameView()) { |
| 3730 // Get our layoutObject in the parent view | 3725 // Get our layoutObject in the parent view |
| 3731 LayoutPartItem layout_item = frame_->OwnerLayoutItem(); | 3726 LayoutPartItem layout_item = frame_->OwnerLayoutItem(); |
| 3732 if (layout_item.IsNull()) | 3727 if (layout_item.IsNull()) |
| 3733 return parent_point; | 3728 return parent_point; |
| 3734 | 3729 |
| 3735 IntPoint point = parent_->ConvertToLayoutItem(layout_item, parent_point); | 3730 IntPoint point = parent->ConvertToLayoutItem(layout_item, parent_point); |
| 3736 // Subtract borders and padding | 3731 // Subtract borders and padding |
| 3737 point.Move((-layout_item.BorderLeft() - layout_item.PaddingLeft()).ToInt(), | 3732 point.Move((-layout_item.BorderLeft() - layout_item.PaddingLeft()).ToInt(), |
| 3738 (-layout_item.BorderTop() - layout_item.PaddingTop()).ToInt()); | 3733 (-layout_item.BorderTop() - layout_item.PaddingTop()).ToInt()); |
| 3739 return point; | 3734 return point; |
| 3740 } | 3735 } |
| 3741 | 3736 |
| 3742 return parent_point; | 3737 return parent_point; |
| 3743 } | 3738 } |
| 3744 | 3739 |
| 3745 void FrameView::SetInitialTracksPaintInvalidationsForTesting( | 3740 void FrameView::SetInitialTracksPaintInvalidationsForTesting( |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3861 animating_scrollable_areas_->insert(scrollable_area); | 3856 animating_scrollable_areas_->insert(scrollable_area); |
| 3862 } | 3857 } |
| 3863 | 3858 |
| 3864 void FrameView::RemoveAnimatingScrollableArea(ScrollableArea* scrollable_area) { | 3859 void FrameView::RemoveAnimatingScrollableArea(ScrollableArea* scrollable_area) { |
| 3865 if (!animating_scrollable_areas_) | 3860 if (!animating_scrollable_areas_) |
| 3866 return; | 3861 return; |
| 3867 animating_scrollable_areas_->erase(scrollable_area); | 3862 animating_scrollable_areas_->erase(scrollable_area); |
| 3868 } | 3863 } |
| 3869 | 3864 |
| 3870 void FrameView::SetParent(FrameView* parent) { | 3865 void FrameView::SetParent(FrameView* parent) { |
| 3866 if (parent) { |
| 3867 SetFrameOrPluginState(kAttached); |
| 3868 } |
| 3869 if (!parent) { |
| 3870 DCHECK(frame_view_state_ == kAttached || |
| 3871 (frame_view_state_ == kDisposed && parent_)); |
| 3872 SetFrameOrPluginState(kNotAttached); |
| 3873 } |
| 3874 |
| 3871 if (parent == parent_) | 3875 if (parent == parent_) |
| 3872 return; | 3876 return; |
| 3873 | 3877 |
| 3874 DCHECK(!parent || !parent_); | 3878 DCHECK(!parent || !parent_); |
| 3875 if (!parent || !parent->IsVisible()) | 3879 if (!parent || !parent->IsVisible()) |
| 3876 SetParentVisible(false); | 3880 SetParentVisible(false); |
| 3877 parent_ = parent; | 3881 parent_ = parent; |
| 3878 if (parent && parent->IsVisible()) | 3882 if (parent && parent->IsVisible()) |
| 3879 SetParentVisible(true); | 3883 SetParentVisible(true); |
| 3880 | 3884 |
| 3885 DCHECK(parent == ParentFrameView()); |
| 3886 |
| 3881 UpdateParentScrollableAreaSet(); | 3887 UpdateParentScrollableAreaSet(); |
| 3882 SetupRenderThrottling(); | 3888 SetupRenderThrottling(); |
| 3883 | 3889 |
| 3884 if (ParentFrameView()) | 3890 if (ParentFrameView()) |
| 3885 subtree_throttled_ = ParentFrameView()->CanThrottleRendering(); | 3891 subtree_throttled_ = ParentFrameView()->CanThrottleRendering(); |
| 3886 } | 3892 } |
| 3887 | 3893 |
| 3894 FrameView* FrameView::Parent() const { |
| 3895 if (frame_view_state_ == kNotAttached || frame_view_state_ == kAttached) |
| 3896 DCHECK(ParentFrameView() == parent_); |
| 3897 |
| 3898 return parent_; |
| 3899 } |
| 3900 |
| 3901 FrameView* FrameView::ParentFrameView() const { |
| 3902 if (frame_view_state_ != kAttached) |
| 3903 return nullptr; |
| 3904 |
| 3905 Frame* parent_frame = frame_->Tree().Parent(); |
| 3906 if (parent_frame && parent_frame->IsLocalFrame()) |
| 3907 return ToLocalFrame(parent_frame)->View(); |
| 3908 |
| 3909 return nullptr; |
| 3910 } |
| 3911 |
| 3912 void FrameView::SetFrameOrPluginState(FrameOrPluginState state) { |
| 3913 VLOG(1) << "SetFrameOrPluginState " << this << " " << frame_view_state_ |
| 3914 << "->" << state; |
| 3915 if (VLOG_IS_ON(2)) |
| 3916 base::debug::StackTrace(10).Print(); |
| 3917 switch (state) { |
| 3918 case kNotAttached: |
| 3919 DCHECK(frame_view_state_ == kAttached || frame_view_state_ == kDisposed); |
| 3920 break; |
| 3921 case kAttached: |
| 3922 DCHECK(frame_view_state_ == kNotAttached || |
| 3923 frame_view_state_ == kDisposed); |
| 3924 break; |
| 3925 case kDeferred: |
| 3926 DCHECK(frame_view_state_ == kNotAttached || |
| 3927 frame_view_state_ == kAttached || frame_view_state_ == kDeferred || |
| 3928 frame_view_state_ == kDisposed); |
| 3929 break; |
| 3930 case kDisposed: |
| 3931 DCHECK(frame_view_state_ == kNotAttached || |
| 3932 frame_view_state_ == kAttached || frame_view_state_ == kDeferred || |
| 3933 frame_view_state_ == kDisposed); |
| 3934 break; |
| 3935 default: |
| 3936 NOTREACHED(); |
| 3937 } |
| 3938 frame_view_state_ = state; |
| 3939 } |
| 3940 |
| 3888 void FrameView::RemoveChild(FrameOrPlugin* child) { | 3941 void FrameView::RemoveChild(FrameOrPlugin* child) { |
| 3889 DCHECK(child->Parent() == this); | 3942 DCHECK(child->Parent() == this); |
| 3890 | 3943 |
| 3891 if (child->IsFrameView()) { | 3944 if (child->IsFrameView()) { |
| 3892 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | 3945 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
| 3893 RemoveScrollableArea(ToFrameView(child)); | 3946 RemoveScrollableArea(ToFrameView(child)); |
| 3894 } else if (child->IsPluginView()) { | 3947 } else if (child->IsPluginView()) { |
| 3895 PluginView* plugin = ToPluginView(child); | 3948 PluginView* plugin = ToPluginView(child); |
| 3896 DCHECK(plugins_.Contains(plugin)); | 3949 DCHECK(plugins_.Contains(plugin)); |
| 3897 plugins_.erase(plugin); | 3950 plugins_.erase(plugin); |
| (...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4743 frame_point.Y() > vertical_scrollbar_y_min; | 4796 frame_point.Y() > vertical_scrollbar_y_min; |
| 4744 } | 4797 } |
| 4745 | 4798 |
| 4746 bool FrameView::ScrollbarCornerPresent() const { | 4799 bool FrameView::ScrollbarCornerPresent() const { |
| 4747 return (HorizontalScrollbar() && | 4800 return (HorizontalScrollbar() && |
| 4748 Width() - HorizontalScrollbar()->Width() > 0) || | 4801 Width() - HorizontalScrollbar()->Width() > 0) || |
| 4749 (VerticalScrollbar() && Height() - VerticalScrollbar()->Height() > 0); | 4802 (VerticalScrollbar() && Height() - VerticalScrollbar()->Height() > 0); |
| 4750 } | 4803 } |
| 4751 | 4804 |
| 4752 IntRect FrameView::ConvertToRootFrame(const IntRect& local_rect) const { | 4805 IntRect FrameView::ConvertToRootFrame(const IntRect& local_rect) const { |
| 4753 if (parent_) { | 4806 // TODO(joelhockey): I expect that this should only be called in state |
| 4807 // kAttached However, this is called in state |
| 4808 // kNotAttached: browser_tests |
| 4809 // --gtest_filter=DevToolsExtensionTest.HttpIframeInDevToolsExtensionDevtools |
| 4810 // kDeferred: interactive_ui_tests |
| 4811 // --gtest_filter=SitePerProcessInteractiveBrowserTest.FullscreenElementInMult
ipleSubframes |
| 4812 // kDisposed: run-webkit-tests -t Default |
| 4813 // third_party/WebKit/LayoutTests/virtual/disable-spinvalidation/compositing/i
frames/invisible-nested-iframe-hide.html |
| 4814 DCHECK(frame_->IsLocalRoot() || frame_view_state_ == kNotAttached || |
| 4815 frame_view_state_ == kAttached || frame_view_state_ == kDeferred || |
| 4816 frame_view_state_ == kDisposed); |
| 4817 if (FrameView* parent = ParentFrameView()) { |
| 4754 IntRect parent_rect = ConvertToContainingFrameViewBase(local_rect); | 4818 IntRect parent_rect = ConvertToContainingFrameViewBase(local_rect); |
| 4755 return parent_->ConvertToRootFrame(parent_rect); | 4819 return parent->ConvertToRootFrame(parent_rect); |
| 4756 } | 4820 } |
| 4757 return local_rect; | 4821 return local_rect; |
| 4758 } | 4822 } |
| 4759 | 4823 |
| 4760 IntPoint FrameView::ConvertToRootFrame(const IntPoint& local_point) const { | 4824 IntPoint FrameView::ConvertToRootFrame(const IntPoint& local_point) const { |
| 4761 if (parent_) { | 4825 DCHECK(frame_->IsLocalRoot() || frame_view_state_ == kAttached); |
| 4826 if (FrameView* parent = ParentFrameView()) { |
| 4762 IntPoint parent_point = ConvertToContainingFrameViewBase(local_point); | 4827 IntPoint parent_point = ConvertToContainingFrameViewBase(local_point); |
| 4763 return parent_->ConvertToRootFrame(parent_point); | 4828 return parent->ConvertToRootFrame(parent_point); |
| 4764 } | 4829 } |
| 4765 return local_point; | 4830 return local_point; |
| 4766 } | 4831 } |
| 4767 | 4832 |
| 4768 IntRect FrameView::ConvertFromRootFrame( | 4833 IntRect FrameView::ConvertFromRootFrame( |
| 4769 const IntRect& rect_in_root_frame) const { | 4834 const IntRect& rect_in_root_frame) const { |
| 4770 if (parent_) { | 4835 // TODO(joelhockey): I expect that this should only be called in state |
| 4771 IntRect parent_rect = parent_->ConvertFromRootFrame(rect_in_root_frame); | 4836 // kAttached However, this is called in state kDeferred in |
| 4837 // interactive_ui_tests |
| 4838 // --gtest_filter=SitePerProcessInteractiveBrowserTest.FullscreenElementInMult
ipleSubframes |
| 4839 DCHECK(frame_->IsLocalRoot() || frame_view_state_ == kAttached || |
| 4840 frame_view_state_ == kDeferred); |
| 4841 if (FrameView* parent = ParentFrameView()) { |
| 4842 IntRect parent_rect = parent->ConvertFromRootFrame(rect_in_root_frame); |
| 4772 return ConvertFromContainingFrameViewBase(parent_rect); | 4843 return ConvertFromContainingFrameViewBase(parent_rect); |
| 4773 } | 4844 } |
| 4774 return rect_in_root_frame; | 4845 return rect_in_root_frame; |
| 4775 } | 4846 } |
| 4776 | 4847 |
| 4777 IntPoint FrameView::ConvertFromRootFrame( | 4848 IntPoint FrameView::ConvertFromRootFrame( |
| 4778 const IntPoint& point_in_root_frame) const { | 4849 const IntPoint& point_in_root_frame) const { |
| 4779 if (parent_) { | 4850 // TODO(joelhockey): Usually parent should only be called when in state |
| 4780 IntPoint parent_point = parent_->ConvertFromRootFrame(point_in_root_frame); | 4851 // kAtached, but this is also called in state: |
| 4852 // kDisposed: content_shell --run-layout-test |
| 4853 // fast/events/frame-detached-in-mousedown.html kDeferred: content_shell |
| 4854 // --run-layout-test |
| 4855 // external/wpt/fullscreen/api/document-exit-fullscreen-nested-in-iframe-manua
l.html |
| 4856 DCHECK(frame_->IsLocalRoot() || frame_view_state_ == kAttached || |
| 4857 frame_view_state_ == kDeferred || frame_view_state_ == kDisposed); |
| 4858 if (FrameView* parent = ParentFrameView()) { |
| 4859 IntPoint parent_point = parent->ConvertFromRootFrame(point_in_root_frame); |
| 4781 return ConvertFromContainingFrameViewBase(parent_point); | 4860 return ConvertFromContainingFrameViewBase(parent_point); |
| 4782 } | 4861 } |
| 4783 return point_in_root_frame; | 4862 return point_in_root_frame; |
| 4784 } | 4863 } |
| 4785 | 4864 |
| 4786 FloatPoint FrameView::ConvertFromRootFrame( | 4865 FloatPoint FrameView::ConvertFromRootFrame( |
| 4787 const FloatPoint& point_in_root_frame) const { | 4866 const FloatPoint& point_in_root_frame) const { |
| 4788 // FrameViews / windows are required to be IntPoint aligned, but we may | 4867 // FrameViews / windows are required to be IntPoint aligned, but we may |
| 4789 // need to convert FloatPoint values within them (eg. for event | 4868 // need to convert FloatPoint values within them (eg. for event |
| 4790 // co-ordinates). | 4869 // co-ordinates). |
| (...skipping 29 matching lines...) Expand all Loading... |
| 4820 !layout_view_item.IsNull() ? layout_view_item.Compositor() : nullptr) | 4899 !layout_view_item.IsNull() ? layout_view_item.Compositor() : nullptr) |
| 4821 compositor->SetNeedsCompositingUpdate(update_type); | 4900 compositor->SetNeedsCompositingUpdate(update_type); |
| 4822 } | 4901 } |
| 4823 | 4902 |
| 4824 void FrameView::SetParentVisible(bool visible) { | 4903 void FrameView::SetParentVisible(bool visible) { |
| 4825 if (IsParentVisible() == visible) | 4904 if (IsParentVisible() == visible) |
| 4826 return; | 4905 return; |
| 4827 | 4906 |
| 4828 // As parent visibility changes, we may need to recomposite this frame view | 4907 // As parent visibility changes, we may need to recomposite this frame view |
| 4829 // and potentially child frame views. | 4908 // and potentially child frame views. |
| 4830 SetNeedsCompositingUpdate(GetLayoutViewItem(), kCompositingUpdateRebuildTree); | 4909 // TODO(joelhockey): This call doesn't seem to be needed, and it |
| 4910 // causes errors during dispose when checking document lifecycle state. |
| 4911 // SetNeedsCompositingUpdate(GetLayoutViewItem(), |
| 4912 // kCompositingUpdateRebuildTree); |
| 4831 | 4913 |
| 4832 parent_visible_ = visible; | 4914 parent_visible_ = visible; |
| 4833 | 4915 |
| 4834 if (!IsSelfVisible()) | 4916 if (!IsSelfVisible()) |
| 4835 return; | 4917 return; |
| 4836 | 4918 |
| 4837 ForAllChildViewsAndPlugins([visible](FrameOrPlugin& frame_or_plugin) { | 4919 ForAllChildViewsAndPlugins([visible](FrameOrPlugin& frame_or_plugin) { |
| 4838 frame_or_plugin.SetParentVisible(visible); | 4920 frame_or_plugin.SetParentVisible(visible); |
| 4839 }); | 4921 }); |
| 4840 } | 4922 } |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5425 void FrameView::SetAnimationHost( | 5507 void FrameView::SetAnimationHost( |
| 5426 std::unique_ptr<CompositorAnimationHost> host) { | 5508 std::unique_ptr<CompositorAnimationHost> host) { |
| 5427 animation_host_ = std::move(host); | 5509 animation_host_ = std::move(host); |
| 5428 } | 5510 } |
| 5429 | 5511 |
| 5430 LayoutUnit FrameView::CaretWidth() const { | 5512 LayoutUnit FrameView::CaretWidth() const { |
| 5431 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1)); | 5513 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1)); |
| 5432 } | 5514 } |
| 5433 | 5515 |
| 5434 } // namespace blink | 5516 } // namespace blink |
| OLD | NEW |