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

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

Issue 2773593005: Move logic of recording main thread scrolling reasons from cc to blink::ScrollManager (Closed)
Patch Set: Add readability to unit tests && handle blink reformat Created 3 years, 8 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 subtree_throttled_(false), 203 subtree_throttled_(false),
204 lifecycle_updates_throttled_(false), 204 lifecycle_updates_throttled_(false),
205 needs_paint_property_update_(true), 205 needs_paint_property_update_(true),
206 current_update_lifecycle_phases_target_state_( 206 current_update_lifecycle_phases_target_state_(
207 DocumentLifecycle::kUninitialized), 207 DocumentLifecycle::kUninitialized),
208 scroll_anchor_(this), 208 scroll_anchor_(this),
209 scrollbar_manager_(*this), 209 scrollbar_manager_(*this),
210 needs_scrollbars_update_(false), 210 needs_scrollbars_update_(false),
211 suppress_adjust_view_size_(false), 211 suppress_adjust_view_size_(false),
212 allows_layout_invalidation_after_layout_clean_(true), 212 allows_layout_invalidation_after_layout_clean_(true),
213 main_thread_scrolling_reasons_(0), 213 main_thread_scrolling_reasons_(0) {
214 main_thread_scrolling_reasons_counter_(
215 MainThreadScrollingReason::kMainThreadScrollingReasonCount,
216 0) {
217 Init(); 214 Init();
218 } 215 }
219 216
220 FrameView* FrameView::Create(LocalFrame& frame) { 217 FrameView* FrameView::Create(LocalFrame& frame) {
221 FrameView* view = new FrameView(frame); 218 FrameView* view = new FrameView(frame);
222 view->Show(); 219 view->Show();
223 return view; 220 return view;
224 } 221 }
225 222
226 FrameView* FrameView::Create(LocalFrame& frame, const IntSize& initial_size) { 223 FrameView* FrameView::Create(LocalFrame& frame, const IntSize& initial_size) {
(...skipping 4927 matching lines...) Expand 10 before | Expand all | Expand 10 after
5154 } 5151 }
5155 5152
5156 Frame* child = frame.Tree().FirstChild(); 5153 Frame* child = frame.Tree().FirstChild();
5157 while (child) { 5154 while (child) {
5158 UpdateSubFrameScrollOnMainReason(*child, reasons); 5155 UpdateSubFrameScrollOnMainReason(*child, reasons);
5159 child = child->Tree().NextSibling(); 5156 child = child->Tree().NextSibling();
5160 } 5157 }
5161 5158
5162 if (frame.IsMainFrame()) 5159 if (frame.IsMainFrame())
5163 main_thread_scrolling_reasons_ = reasons; 5160 main_thread_scrolling_reasons_ = reasons;
5161 DCHECK(!MainThreadScrollingReason::HasNonCompositedScrollReasons(
5162 main_thread_scrolling_reasons_));
5164 } 5163 }
5165 5164
5166 MainThreadScrollingReasons FrameView::MainThreadScrollingReasonsPerFrame() 5165 MainThreadScrollingReasons FrameView::MainThreadScrollingReasonsPerFrame()
5167 const { 5166 const {
5168 MainThreadScrollingReasons reasons = 5167 MainThreadScrollingReasons reasons =
5169 static_cast<MainThreadScrollingReasons>(0); 5168 static_cast<MainThreadScrollingReasons>(0);
5170 5169
5171 if (ShouldThrottleRendering()) 5170 if (ShouldThrottleRendering())
5172 return reasons; 5171 return reasons;
5173 5172
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
5212 // Walk the tree to the root. Use the gathered reasons to determine 5211 // Walk the tree to the root. Use the gathered reasons to determine
5213 // whether the target frame should be scrolled on main thread regardless 5212 // whether the target frame should be scrolled on main thread regardless
5214 // other subframes on the same page. 5213 // other subframes on the same page.
5215 for (Frame* frame = frame_; frame; frame = frame->Tree().Parent()) { 5214 for (Frame* frame = frame_; frame; frame = frame->Tree().Parent()) {
5216 if (!frame->IsLocalFrame()) 5215 if (!frame->IsLocalFrame())
5217 continue; 5216 continue;
5218 reasons |= 5217 reasons |=
5219 ToLocalFrame(frame)->View()->MainThreadScrollingReasonsPerFrame(); 5218 ToLocalFrame(frame)->View()->MainThreadScrollingReasonsPerFrame();
5220 } 5219 }
5221 5220
5221 DCHECK(!MainThreadScrollingReason::HasNonCompositedScrollReasons(reasons));
5222 return reasons; 5222 return reasons;
5223 } 5223 }
5224 5224
5225 String FrameView::MainThreadScrollingReasonsAsText() const { 5225 String FrameView::MainThreadScrollingReasonsAsText() const {
5226 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 5226 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
5227 DCHECK(Lifecycle().GetState() >= DocumentLifecycle::kPrePaintClean); 5227 DCHECK(Lifecycle().GetState() >= DocumentLifecycle::kPrePaintClean);
5228 5228
5229 // Slimming paint v2 stores main thread scrolling reasons on property 5229 // Slimming paint v2 stores main thread scrolling reasons on property
5230 // trees instead of in |m_mainThreadScrollingReasons|. 5230 // trees instead of in |m_mainThreadScrollingReasons|.
5231 MainThreadScrollingReasons reasons = 0; 5231 MainThreadScrollingReasons reasons = 0;
(...skipping 13 matching lines...) Expand all
5245 .c_str()); 5245 .c_str());
5246 return result; 5246 return result;
5247 } 5247 }
5248 5248
5249 String result(MainThreadScrollingReason::mainThreadScrollingReasonsAsText( 5249 String result(MainThreadScrollingReason::mainThreadScrollingReasonsAsText(
5250 main_thread_scrolling_reasons_) 5250 main_thread_scrolling_reasons_)
5251 .c_str()); 5251 .c_str());
5252 return result; 5252 return result;
5253 } 5253 }
5254 5254
5255 void FrameView::AdjustStyleRelatedMainThreadScrollingReasons(
5256 const uint32_t reason,
5257 bool increase) {
5258 int index = MainThreadScrollingReason::getReasonIndex(reason);
5259 DCHECK_GE(index, 0);
5260 main_thread_scrolling_reasons_counter_[index] += increase ? 1 : -1;
5261 DCHECK_GE(main_thread_scrolling_reasons_counter_[index], 0);
5262 }
5263
5264 MainThreadScrollingReasons
5265 FrameView::GetStyleRelatedMainThreadScrollingReasons() const {
5266 MainThreadScrollingReasons reasons =
5267 static_cast<MainThreadScrollingReasons>(0);
5268 for (uint32_t reason = 0;
5269 reason < MainThreadScrollingReason::kMainThreadScrollingReasonCount;
5270 ++reason) {
5271 if (main_thread_scrolling_reasons_counter_[reason] > 0) {
5272 reasons |= 1 << reason;
5273 }
5274 }
5275 return reasons;
5276 }
5277
5278 void FrameView::SetViewportIntersectionFromParent( 5255 void FrameView::SetViewportIntersectionFromParent(
5279 const IntRect& viewport_intersection) { 5256 const IntRect& viewport_intersection) {
5280 if (remote_viewport_intersection_ != viewport_intersection) { 5257 if (remote_viewport_intersection_ != viewport_intersection) {
5281 remote_viewport_intersection_ = viewport_intersection; 5258 remote_viewport_intersection_ = viewport_intersection;
5282 ScheduleAnimation(); 5259 ScheduleAnimation();
5283 } 5260 }
5284 } 5261 }
5285 5262
5286 IntRect FrameView::RemoteViewportIntersection() { 5263 IntRect FrameView::RemoteViewportIntersection() {
5287 IntRect intersection(remote_viewport_intersection_); 5264 IntRect intersection(remote_viewport_intersection_);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
5342 void FrameView::SetAnimationHost( 5319 void FrameView::SetAnimationHost(
5343 std::unique_ptr<CompositorAnimationHost> host) { 5320 std::unique_ptr<CompositorAnimationHost> host) {
5344 animation_host_ = std::move(host); 5321 animation_host_ = std::move(host);
5345 } 5322 }
5346 5323
5347 LayoutUnit FrameView::CaretWidth() const { 5324 LayoutUnit FrameView::CaretWidth() const {
5348 return LayoutUnit(GetHostWindow()->WindowToViewportScalar(1)); 5325 return LayoutUnit(GetHostWindow()->WindowToViewportScalar(1));
5349 } 5326 }
5350 5327
5351 } // namespace blink 5328 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698