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

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2849403002: Use const ref for LocalFrame::LocalFrameRoot and FrameTree::Top (Closed)
Patch Set: 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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 ScrollingCoordinator* FrameView::GetScrollingCoordinator() const { 600 ScrollingCoordinator* FrameView::GetScrollingCoordinator() const {
601 Page* p = GetPage(); 601 Page* p = GetPage();
602 return p ? p->GetScrollingCoordinator() : 0; 602 return p ? p->GetScrollingCoordinator() : 0;
603 } 603 }
604 604
605 CompositorAnimationHost* FrameView::GetCompositorAnimationHost() const { 605 CompositorAnimationHost* FrameView::GetCompositorAnimationHost() const {
606 // When m_animationHost is not nullptr, this is the FrameView for an OOPIF. 606 // When m_animationHost is not nullptr, this is the FrameView for an OOPIF.
607 if (animation_host_) 607 if (animation_host_)
608 return animation_host_.get(); 608 return animation_host_.get();
609 609
610 if (frame_->LocalFrameRoot() != frame_) 610 if (&frame_->LocalFrameRoot() != frame_)
611 return frame_->LocalFrameRoot()->View()->GetCompositorAnimationHost(); 611 return frame_->LocalFrameRoot().View()->GetCompositorAnimationHost();
612 612
613 if (!frame_->IsMainFrame()) 613 if (!frame_->IsMainFrame())
614 return nullptr; 614 return nullptr;
615 615
616 ScrollingCoordinator* c = GetScrollingCoordinator(); 616 ScrollingCoordinator* c = GetScrollingCoordinator();
617 return c ? c->GetCompositorAnimationHost() : nullptr; 617 return c ? c->GetCompositorAnimationHost() : nullptr;
618 } 618 }
619 619
620 CompositorAnimationTimeline* FrameView::GetCompositorAnimationTimeline() const { 620 CompositorAnimationTimeline* FrameView::GetCompositorAnimationTimeline() const {
621 if (animation_timeline_) 621 if (animation_timeline_)
622 return animation_timeline_.get(); 622 return animation_timeline_.get();
623 623
624 if (frame_->LocalFrameRoot() != frame_) 624 if (&frame_->LocalFrameRoot() != frame_)
625 return frame_->LocalFrameRoot()->View()->GetCompositorAnimationTimeline(); 625 return frame_->LocalFrameRoot().View()->GetCompositorAnimationTimeline();
626 626
627 if (!frame_->IsMainFrame()) 627 if (!frame_->IsMainFrame())
628 return nullptr; 628 return nullptr;
629 629
630 ScrollingCoordinator* c = GetScrollingCoordinator(); 630 ScrollingCoordinator* c = GetScrollingCoordinator();
631 return c ? c->GetCompositorAnimationTimeline() : nullptr; 631 return c ? c->GetCompositorAnimationTimeline() : nullptr;
632 } 632 }
633 633
634 LayoutBox* FrameView::GetLayoutBox() const { 634 LayoutBox* FrameView::GetLayoutBox() const {
635 return GetLayoutView(); 635 return GetLayoutView();
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 if (local_frame && ComputeCompositedSelection(*local_frame, selection)) { 2122 if (local_frame && ComputeCompositedSelection(*local_frame, selection)) {
2123 page->GetChromeClient().UpdateCompositedSelection(local_frame, selection); 2123 page->GetChromeClient().UpdateCompositedSelection(local_frame, selection);
2124 } else { 2124 } else {
2125 if (!local_frame) { 2125 if (!local_frame) {
2126 // Clearing the mainframe when there is no focused frame (and hence 2126 // Clearing the mainframe when there is no focused frame (and hence
2127 // no localFrame) is legacy behaviour, and implemented here to 2127 // no localFrame) is legacy behaviour, and implemented here to
2128 // satisfy ParameterizedWebFrameTest.CompositedSelectionBoundsCleared's 2128 // satisfy ParameterizedWebFrameTest.CompositedSelectionBoundsCleared's
2129 // first check that the composited selection has been cleared even 2129 // first check that the composited selection has been cleared even
2130 // though no frame has focus yet. If this is not desired, then the 2130 // though no frame has focus yet. If this is not desired, then the
2131 // expectation needs to be removed from the test. 2131 // expectation needs to be removed from the test.
2132 local_frame = frame_->LocalFrameRoot(); 2132 local_frame = &frame_->LocalFrameRoot();
2133 } 2133 }
2134 2134
2135 if (local_frame) 2135 if (local_frame)
2136 page->GetChromeClient().ClearCompositedSelection(local_frame); 2136 page->GetChromeClient().ClearCompositedSelection(local_frame);
2137 } 2137 }
2138 } 2138 }
2139 2139
2140 PlatformChromeClient* FrameView::GetChromeClient() const { 2140 PlatformChromeClient* FrameView::GetChromeClient() const {
2141 Page* page = GetFrame().GetPage(); 2141 Page* page = GetFrame().GetPage();
2142 if (!page) 2142 if (!page)
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
2561 2561
2562 frame_->Selection().DidLayout(); 2562 frame_->Selection().DidLayout();
2563 2563
2564 ASSERT(frame_->GetDocument()); 2564 ASSERT(frame_->GetDocument());
2565 2565
2566 FontFaceSet::DidLayout(*frame_->GetDocument()); 2566 FontFaceSet::DidLayout(*frame_->GetDocument());
2567 // Cursor update scheduling is done by the local root, which is the main frame 2567 // Cursor update scheduling is done by the local root, which is the main frame
2568 // if there are no RemoteFrame ancestors in the frame tree. Use of 2568 // if there are no RemoteFrame ancestors in the frame tree. Use of
2569 // localFrameRoot() is discouraged but will change when cursor update 2569 // localFrameRoot() is discouraged but will change when cursor update
2570 // scheduling is moved from EventHandler to PageEventHandler. 2570 // scheduling is moved from EventHandler to PageEventHandler.
2571 GetFrame().LocalFrameRoot()->GetEventHandler().ScheduleCursorUpdate(); 2571 GetFrame().LocalFrameRoot().GetEventHandler().ScheduleCursorUpdate();
2572 2572
2573 UpdateGeometries(); 2573 UpdateGeometries();
2574 2574
2575 // Plugins could have torn down the page inside updateGeometries(). 2575 // Plugins could have torn down the page inside updateGeometries().
2576 if (GetLayoutViewItem().IsNull()) 2576 if (GetLayoutViewItem().IsNull())
2577 return; 2577 return;
2578 2578
2579 ScheduleUpdatePluginsIfNecessary(); 2579 ScheduleUpdatePluginsIfNecessary();
2580 2580
2581 if (ScrollingCoordinator* scrolling_coordinator = 2581 if (ScrollingCoordinator* scrolling_coordinator =
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
2944 void FrameView::UpdateGeometriesIfNeeded() { 2944 void FrameView::UpdateGeometriesIfNeeded() {
2945 if (!needs_update_geometries_) 2945 if (!needs_update_geometries_)
2946 return; 2946 return;
2947 2947
2948 needs_update_geometries_ = false; 2948 needs_update_geometries_ = false;
2949 2949
2950 UpdateGeometries(); 2950 UpdateGeometries();
2951 } 2951 }
2952 2952
2953 void FrameView::UpdateAllLifecyclePhases() { 2953 void FrameView::UpdateAllLifecyclePhases() {
2954 GetFrame().LocalFrameRoot()->View()->UpdateLifecyclePhasesInternal( 2954 GetFrame().LocalFrameRoot().View()->UpdateLifecyclePhasesInternal(
2955 DocumentLifecycle::kPaintClean); 2955 DocumentLifecycle::kPaintClean);
2956 } 2956 }
2957 2957
2958 // TODO(chrishtr): add a scrolling update lifecycle phase. 2958 // TODO(chrishtr): add a scrolling update lifecycle phase.
2959 void FrameView::UpdateLifecycleToCompositingCleanPlusScrolling() { 2959 void FrameView::UpdateLifecycleToCompositingCleanPlusScrolling() {
2960 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 2960 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
2961 UpdateAllLifecyclePhasesExceptPaint(); 2961 UpdateAllLifecyclePhasesExceptPaint();
2962 } else { 2962 } else {
2963 GetFrame().LocalFrameRoot()->View()->UpdateLifecyclePhasesInternal( 2963 GetFrame().LocalFrameRoot().View()->UpdateLifecyclePhasesInternal(
2964 DocumentLifecycle::kCompositingClean); 2964 DocumentLifecycle::kCompositingClean);
2965 } 2965 }
2966 } 2966 }
2967 2967
2968 void FrameView::UpdateLifecycleToCompositingInputsClean() { 2968 void FrameView::UpdateLifecycleToCompositingInputsClean() {
2969 // When SPv2 is enabled, the standard compositing lifecycle steps do not 2969 // When SPv2 is enabled, the standard compositing lifecycle steps do not
2970 // exist; compositing is done after paint instead. 2970 // exist; compositing is done after paint instead.
2971 DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); 2971 DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled());
2972 GetFrame().LocalFrameRoot()->View()->UpdateLifecyclePhasesInternal( 2972 GetFrame().LocalFrameRoot().View()->UpdateLifecyclePhasesInternal(
2973 DocumentLifecycle::kCompositingInputsClean); 2973 DocumentLifecycle::kCompositingInputsClean);
2974 } 2974 }
2975 2975
2976 void FrameView::UpdateAllLifecyclePhasesExceptPaint() { 2976 void FrameView::UpdateAllLifecyclePhasesExceptPaint() {
2977 GetFrame().LocalFrameRoot()->View()->UpdateLifecyclePhasesInternal( 2977 GetFrame().LocalFrameRoot().View()->UpdateLifecyclePhasesInternal(
2978 DocumentLifecycle::kPrePaintClean); 2978 DocumentLifecycle::kPrePaintClean);
2979 } 2979 }
2980 2980
2981 void FrameView::UpdateLifecycleToLayoutClean() { 2981 void FrameView::UpdateLifecycleToLayoutClean() {
2982 GetFrame().LocalFrameRoot()->View()->UpdateLifecyclePhasesInternal( 2982 GetFrame().LocalFrameRoot().View()->UpdateLifecyclePhasesInternal(
2983 DocumentLifecycle::kLayoutClean); 2983 DocumentLifecycle::kLayoutClean);
2984 } 2984 }
2985 2985
2986 void FrameView::ScheduleVisualUpdateForPaintInvalidationIfNeeded() { 2986 void FrameView::ScheduleVisualUpdateForPaintInvalidationIfNeeded() {
2987 LocalFrame* local_frame_root = GetFrame().LocalFrameRoot(); 2987 LocalFrame& local_frame_root = GetFrame().LocalFrameRoot();
2988 if (local_frame_root->View()->current_update_lifecycle_phases_target_state_ < 2988 if (local_frame_root.View()->current_update_lifecycle_phases_target_state_ <
2989 DocumentLifecycle::kPaintInvalidationClean || 2989 DocumentLifecycle::kPaintInvalidationClean ||
2990 Lifecycle().GetState() >= DocumentLifecycle::kPrePaintClean) { 2990 Lifecycle().GetState() >= DocumentLifecycle::kPrePaintClean) {
2991 // Schedule visual update to process the paint invalidation in the next 2991 // Schedule visual update to process the paint invalidation in the next
2992 // cycle. 2992 // cycle.
2993 local_frame_root->ScheduleVisualUpdateUnlessThrottled(); 2993 local_frame_root.ScheduleVisualUpdateUnlessThrottled();
2994 } 2994 }
2995 // Otherwise the paint invalidation will be handled in paint invalidation 2995 // Otherwise the paint invalidation will be handled in paint invalidation
2996 // phase of this cycle. 2996 // phase of this cycle.
2997 } 2997 }
2998 2998
2999 void FrameView::NotifyResizeObservers() { 2999 void FrameView::NotifyResizeObservers() {
3000 // Controller exists only if ResizeObserver was created. 3000 // Controller exists only if ResizeObserver was created.
3001 if (!GetFrame().GetDocument()->GetResizeObserverController()) 3001 if (!GetFrame().GetDocument()->GetResizeObserverController())
3002 return; 3002 return;
3003 3003
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
3149 3149
3150 if (target_state >= DocumentLifecycle::kPrePaintClean) { 3150 if (target_state >= DocumentLifecycle::kPrePaintClean) {
3151 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) 3151 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
3152 InvalidateTreeIfNeededRecursive(); 3152 InvalidateTreeIfNeededRecursive();
3153 3153
3154 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 3154 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
3155 if (view.Compositor()->InCompositingMode()) 3155 if (view.Compositor()->InCompositingMode())
3156 GetScrollingCoordinator()->UpdateAfterCompositingChangeIfNeeded(); 3156 GetScrollingCoordinator()->UpdateAfterCompositingChangeIfNeeded();
3157 } 3157 }
3158 3158
3159 if (LocalFrame* local_frame = frame_->LocalFrameRoot()) { 3159 // This is needed since, at present, the ScrollingCoordinator doesn't
3160 // This is needed since, at present, the ScrollingCoordinator doesn't 3160 // send rects for oopif sub-frames.
3161 // send rects for oopif sub-frames. 3161 // TODO(wjmaclean): Remove this pathway when ScrollingCoordinator
3162 // TODO(wjmaclean): Remove this pathway when ScrollingCoordinator 3162 // operates on a per-frame basis. https://crbug.com/680606
3163 // operates on a per-frame basis. https://crbug.com/680606 3163 GetFrame()
3164 GetFrame() 3164 .GetPage()
3165 .GetPage() 3165 ->GetChromeClient()
3166 ->GetChromeClient() 3166 .UpdateEventRectsForSubframeIfNecessary(&frame_->LocalFrameRoot());
3167 .UpdateEventRectsForSubframeIfNecessary(local_frame);
3168 }
3169 UpdateCompositedSelectionIfNeeded(); 3167 UpdateCompositedSelectionIfNeeded();
3170 } 3168 }
3171 3169
3172 // TODO(pdr): prePaint should be under the "Paint" devtools timeline step 3170 // TODO(pdr): prePaint should be under the "Paint" devtools timeline step
3173 // for slimming paint v2. 3171 // for slimming paint v2.
3174 if (target_state >= DocumentLifecycle::kPrePaintClean) 3172 if (target_state >= DocumentLifecycle::kPrePaintClean)
3175 PrePaint(); 3173 PrePaint();
3176 } 3174 }
3177 3175
3178 if (target_state == DocumentLifecycle::kPaintClean) { 3176 if (target_state == DocumentLifecycle::kPaintClean) {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
3352 paint_artifact_compositor_->Update( 3350 paint_artifact_compositor_->Update(
3353 paint_controller_->GetPaintArtifact(), 3351 paint_controller_->GetPaintArtifact(),
3354 paint_controller_->PaintChunksRasterInvalidationTrackingMap(), 3352 paint_controller_->PaintChunksRasterInvalidationTrackingMap(),
3355 is_storing_composited_layer_debug_info_, composited_element_ids); 3353 is_storing_composited_layer_debug_info_, composited_element_ids);
3356 } 3354 }
3357 3355
3358 std::unique_ptr<JSONObject> FrameView::CompositedLayersAsJSON( 3356 std::unique_ptr<JSONObject> FrameView::CompositedLayersAsJSON(
3359 LayerTreeFlags flags) { 3357 LayerTreeFlags flags) {
3360 return GetFrame() 3358 return GetFrame()
3361 .LocalFrameRoot() 3359 .LocalFrameRoot()
3362 ->View() 3360 .View()
3363 ->paint_artifact_compositor_->LayersAsJSON(flags); 3361 ->paint_artifact_compositor_->LayersAsJSON(flags);
3364 } 3362 }
3365 3363
3366 void FrameView::UpdateStyleAndLayoutIfNeededRecursive() { 3364 void FrameView::UpdateStyleAndLayoutIfNeededRecursive() {
3367 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.StyleAndLayout.UpdateTime"); 3365 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.StyleAndLayout.UpdateTime");
3368 UpdateStyleAndLayoutIfNeededRecursiveInternal(); 3366 UpdateStyleAndLayoutIfNeededRecursiveInternal();
3369 } 3367 }
3370 3368
3371 void FrameView::UpdateStyleAndLayoutIfNeededRecursiveInternal() { 3369 void FrameView::UpdateStyleAndLayoutIfNeededRecursiveInternal() {
3372 if (ShouldThrottleRendering() || !frame_->GetDocument()->IsActive()) 3370 if (ShouldThrottleRendering() || !frame_->GetDocument()->IsActive())
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
3731 3729
3732 void FrameView::SetInitialTracksPaintInvalidationsForTesting( 3730 void FrameView::SetInitialTracksPaintInvalidationsForTesting(
3733 bool track_paint_invalidations) { 3731 bool track_paint_invalidations) {
3734 g_initial_track_all_paint_invalidations = track_paint_invalidations; 3732 g_initial_track_all_paint_invalidations = track_paint_invalidations;
3735 } 3733 }
3736 3734
3737 void FrameView::SetTracksPaintInvalidations(bool track_paint_invalidations) { 3735 void FrameView::SetTracksPaintInvalidations(bool track_paint_invalidations) {
3738 if (track_paint_invalidations == IsTrackingPaintInvalidations()) 3736 if (track_paint_invalidations == IsTrackingPaintInvalidations())
3739 return; 3737 return;
3740 3738
3741 for (Frame* frame = frame_->Tree().Top(); frame; 3739 for (Frame* frame = &frame_->Tree().Top(); frame;
3742 frame = frame->Tree().TraverseNext()) { 3740 frame = frame->Tree().TraverseNext()) {
3743 if (!frame->IsLocalFrame()) 3741 if (!frame->IsLocalFrame())
3744 continue; 3742 continue;
3745 if (LayoutViewItem layout_view = ToLocalFrame(frame)->ContentLayoutItem()) { 3743 if (LayoutViewItem layout_view = ToLocalFrame(frame)->ContentLayoutItem()) {
3746 layout_view.GetFrameView()->tracked_object_paint_invalidations_ = 3744 layout_view.GetFrameView()->tracked_object_paint_invalidations_ =
3747 WTF::WrapUnique(track_paint_invalidations 3745 WTF::WrapUnique(track_paint_invalidations
3748 ? new Vector<ObjectPaintInvalidation> 3746 ? new Vector<ObjectPaintInvalidation>
3749 : nullptr); 3747 : nullptr);
3750 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 3748 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
3751 paint_controller_->SetTracksRasterInvalidations( 3749 paint_controller_->SetTracksRasterInvalidations(
(...skipping 21 matching lines...) Expand all
3773 ObjectPaintInvalidation invalidation = {client.DebugName(), reason}; 3771 ObjectPaintInvalidation invalidation = {client.DebugName(), reason};
3774 tracked_object_paint_invalidations_->push_back(invalidation); 3772 tracked_object_paint_invalidations_->push_back(invalidation);
3775 } 3773 }
3776 3774
3777 std::unique_ptr<JSONArray> FrameView::TrackedObjectPaintInvalidationsAsJSON() 3775 std::unique_ptr<JSONArray> FrameView::TrackedObjectPaintInvalidationsAsJSON()
3778 const { 3776 const {
3779 if (!tracked_object_paint_invalidations_) 3777 if (!tracked_object_paint_invalidations_)
3780 return nullptr; 3778 return nullptr;
3781 3779
3782 std::unique_ptr<JSONArray> result = JSONArray::Create(); 3780 std::unique_ptr<JSONArray> result = JSONArray::Create();
3783 for (Frame* frame = frame_->Tree().Top(); frame; 3781 for (Frame* frame = &frame_->Tree().Top(); frame;
3784 frame = frame->Tree().TraverseNext()) { 3782 frame = frame->Tree().TraverseNext()) {
3785 if (!frame->IsLocalFrame()) 3783 if (!frame->IsLocalFrame())
3786 continue; 3784 continue;
3787 if (LayoutViewItem layout_view = ToLocalFrame(frame)->ContentLayoutItem()) { 3785 if (LayoutViewItem layout_view = ToLocalFrame(frame)->ContentLayoutItem()) {
3788 if (!layout_view.GetFrameView()->tracked_object_paint_invalidations_) 3786 if (!layout_view.GetFrameView()->tracked_object_paint_invalidations_)
3789 continue; 3787 continue;
3790 for (const auto& item : 3788 for (const auto& item :
3791 *layout_view.GetFrameView()->tracked_object_paint_invalidations_) { 3789 *layout_view.GetFrameView()->tracked_object_paint_invalidations_) {
3792 std::unique_ptr<JSONObject> item_json = JSONObject::Create(); 3790 std::unique_ptr<JSONObject> item_json = JSONObject::Create();
3793 item_json->SetString("object", item.name); 3791 item_json->SetString("object", item.name);
(...skipping 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after
5273 if (!GetPage()->GetSettings().GetThreadedScrollingEnabled()) 5271 if (!GetPage()->GetSettings().GetThreadedScrollingEnabled())
5274 reasons |= MainThreadScrollingReason::kThreadedScrollingDisabled; 5272 reasons |= MainThreadScrollingReason::kThreadedScrollingDisabled;
5275 5273
5276 if (!GetPage()->MainFrame()->IsLocalFrame()) 5274 if (!GetPage()->MainFrame()->IsLocalFrame())
5277 return reasons; 5275 return reasons;
5278 5276
5279 // TODO(alexmos,kenrb): For OOPIF, local roots that are different from 5277 // TODO(alexmos,kenrb): For OOPIF, local roots that are different from
5280 // the main frame can't be used in the calculation, since they use 5278 // the main frame can't be used in the calculation, since they use
5281 // different compositors with unrelated state, which breaks some of the 5279 // different compositors with unrelated state, which breaks some of the
5282 // calculations below. 5280 // calculations below.
5283 if (frame_->LocalFrameRoot() != GetPage()->MainFrame()) 5281 if (&frame_->LocalFrameRoot() != GetPage()->MainFrame())
5284 return reasons; 5282 return reasons;
5285 5283
5286 // Walk the tree to the root. Use the gathered reasons to determine 5284 // Walk the tree to the root. Use the gathered reasons to determine
5287 // whether the target frame should be scrolled on main thread regardless 5285 // whether the target frame should be scrolled on main thread regardless
5288 // other subframes on the same page. 5286 // other subframes on the same page.
5289 for (Frame* frame = frame_; frame; frame = frame->Tree().Parent()) { 5287 for (Frame* frame = frame_; frame; frame = frame->Tree().Parent()) {
5290 if (!frame->IsLocalFrame()) 5288 if (!frame->IsLocalFrame())
5291 continue; 5289 continue;
5292 reasons |= 5290 reasons |=
5293 ToLocalFrame(frame)->View()->MainThreadScrollingReasonsPerFrame(); 5291 ToLocalFrame(frame)->View()->MainThreadScrollingReasonsPerFrame();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
5350 FloatQuad(FloatRect(rect)), ancestor, mode); 5348 FloatQuad(FloatRect(rect)), ancestor, mode);
5351 rect = LayoutRect(mapped_quad.BoundingBox()); 5349 rect = LayoutRect(mapped_quad.BoundingBox());
5352 5350
5353 // localToAncestorQuad accounts for scroll offset if it encounters a remote 5351 // localToAncestorQuad accounts for scroll offset if it encounters a remote
5354 // frame in the ancestor chain, otherwise it needs to be added explicitly. 5352 // frame in the ancestor chain, otherwise it needs to be added explicitly.
5355 if (GetFrame().LocalFrameRoot() == GetFrame().Tree().Top() || 5353 if (GetFrame().LocalFrameRoot() == GetFrame().Tree().Top() ||
5356 (ancestor && 5354 (ancestor &&
5357 ancestor->GetFrame()->LocalFrameRoot() == GetFrame().LocalFrameRoot())) { 5355 ancestor->GetFrame()->LocalFrameRoot() == GetFrame().LocalFrameRoot())) {
5358 FrameView* ancestor_view = 5356 FrameView* ancestor_view =
5359 (ancestor ? ancestor->GetFrameView() 5357 (ancestor ? ancestor->GetFrameView()
5360 : ToLocalFrame(GetFrame().Tree().Top())->View()); 5358 : ToLocalFrame(GetFrame().Tree().Top()).View());
5361 LayoutSize scroll_position = LayoutSize(ancestor_view->GetScrollOffset()); 5359 LayoutSize scroll_position = LayoutSize(ancestor_view->GetScrollOffset());
5362 rect.Move(-scroll_position); 5360 rect.Move(-scroll_position);
5363 } 5361 }
5364 } 5362 }
5365 5363
5366 bool FrameView::MapToVisualRectInTopFrameSpace(LayoutRect& rect) { 5364 bool FrameView::MapToVisualRectInTopFrameSpace(LayoutRect& rect) {
5367 // This is the top-level frame, so no mapping necessary. 5365 // This is the top-level frame, so no mapping necessary.
5368 if (frame_->IsMainFrame()) 5366 if (frame_->IsMainFrame())
5369 return true; 5367 return true;
5370 5368
(...skipping 23 matching lines...) Expand all
5394 void FrameView::SetAnimationHost( 5392 void FrameView::SetAnimationHost(
5395 std::unique_ptr<CompositorAnimationHost> host) { 5393 std::unique_ptr<CompositorAnimationHost> host) {
5396 animation_host_ = std::move(host); 5394 animation_host_ = std::move(host);
5397 } 5395 }
5398 5396
5399 LayoutUnit FrameView::CaretWidth() const { 5397 LayoutUnit FrameView::CaretWidth() const {
5400 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1)); 5398 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1));
5401 } 5399 }
5402 5400
5403 } // namespace blink 5401 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698