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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 4942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5169 } | 5166 } |
5170 | 5167 |
5171 Frame* child = frame.Tree().FirstChild(); | 5168 Frame* child = frame.Tree().FirstChild(); |
5172 while (child) { | 5169 while (child) { |
5173 UpdateSubFrameScrollOnMainReason(*child, reasons); | 5170 UpdateSubFrameScrollOnMainReason(*child, reasons); |
5174 child = child->Tree().NextSibling(); | 5171 child = child->Tree().NextSibling(); |
5175 } | 5172 } |
5176 | 5173 |
5177 if (frame.IsMainFrame()) | 5174 if (frame.IsMainFrame()) |
5178 main_thread_scrolling_reasons_ = reasons; | 5175 main_thread_scrolling_reasons_ = reasons; |
| 5176 DCHECK(!MainThreadScrollingReason::HasNonCompositedScrollReasons( |
| 5177 main_thread_scrolling_reasons_)); |
5179 } | 5178 } |
5180 | 5179 |
5181 MainThreadScrollingReasons FrameView::MainThreadScrollingReasonsPerFrame() | 5180 MainThreadScrollingReasons FrameView::MainThreadScrollingReasonsPerFrame() |
5182 const { | 5181 const { |
5183 MainThreadScrollingReasons reasons = | 5182 MainThreadScrollingReasons reasons = |
5184 static_cast<MainThreadScrollingReasons>(0); | 5183 static_cast<MainThreadScrollingReasons>(0); |
5185 | 5184 |
5186 if (ShouldThrottleRendering()) | 5185 if (ShouldThrottleRendering()) |
5187 return reasons; | 5186 return reasons; |
5188 | 5187 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5227 // Walk the tree to the root. Use the gathered reasons to determine | 5226 // Walk the tree to the root. Use the gathered reasons to determine |
5228 // whether the target frame should be scrolled on main thread regardless | 5227 // whether the target frame should be scrolled on main thread regardless |
5229 // other subframes on the same page. | 5228 // other subframes on the same page. |
5230 for (Frame* frame = frame_; frame; frame = frame->Tree().Parent()) { | 5229 for (Frame* frame = frame_; frame; frame = frame->Tree().Parent()) { |
5231 if (!frame->IsLocalFrame()) | 5230 if (!frame->IsLocalFrame()) |
5232 continue; | 5231 continue; |
5233 reasons |= | 5232 reasons |= |
5234 ToLocalFrame(frame)->View()->MainThreadScrollingReasonsPerFrame(); | 5233 ToLocalFrame(frame)->View()->MainThreadScrollingReasonsPerFrame(); |
5235 } | 5234 } |
5236 | 5235 |
| 5236 DCHECK(!MainThreadScrollingReason::HasNonCompositedScrollReasons(reasons)); |
5237 return reasons; | 5237 return reasons; |
5238 } | 5238 } |
5239 | 5239 |
5240 String FrameView::MainThreadScrollingReasonsAsText() const { | 5240 String FrameView::MainThreadScrollingReasonsAsText() const { |
5241 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 5241 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
5242 DCHECK(Lifecycle().GetState() >= DocumentLifecycle::kPrePaintClean); | 5242 DCHECK(Lifecycle().GetState() >= DocumentLifecycle::kPrePaintClean); |
5243 | 5243 |
5244 // Slimming paint v2 stores main thread scrolling reasons on property | 5244 // Slimming paint v2 stores main thread scrolling reasons on property |
5245 // trees instead of in |m_mainThreadScrollingReasons|. | 5245 // trees instead of in |m_mainThreadScrollingReasons|. |
5246 MainThreadScrollingReasons reasons = 0; | 5246 MainThreadScrollingReasons reasons = 0; |
(...skipping 13 matching lines...) Expand all Loading... |
5260 .c_str()); | 5260 .c_str()); |
5261 return result; | 5261 return result; |
5262 } | 5262 } |
5263 | 5263 |
5264 String result(MainThreadScrollingReason::mainThreadScrollingReasonsAsText( | 5264 String result(MainThreadScrollingReason::mainThreadScrollingReasonsAsText( |
5265 main_thread_scrolling_reasons_) | 5265 main_thread_scrolling_reasons_) |
5266 .c_str()); | 5266 .c_str()); |
5267 return result; | 5267 return result; |
5268 } | 5268 } |
5269 | 5269 |
5270 void FrameView::AdjustStyleRelatedMainThreadScrollingReasons( | |
5271 const uint32_t reason, | |
5272 bool increase) { | |
5273 int index = MainThreadScrollingReason::getReasonIndex(reason); | |
5274 DCHECK_GE(index, 0); | |
5275 main_thread_scrolling_reasons_counter_[index] += increase ? 1 : -1; | |
5276 DCHECK_GE(main_thread_scrolling_reasons_counter_[index], 0); | |
5277 } | |
5278 | |
5279 MainThreadScrollingReasons | |
5280 FrameView::GetStyleRelatedMainThreadScrollingReasons() const { | |
5281 MainThreadScrollingReasons reasons = | |
5282 static_cast<MainThreadScrollingReasons>(0); | |
5283 for (uint32_t reason = 0; | |
5284 reason < MainThreadScrollingReason::kMainThreadScrollingReasonCount; | |
5285 ++reason) { | |
5286 if (main_thread_scrolling_reasons_counter_[reason] > 0) { | |
5287 reasons |= 1 << reason; | |
5288 } | |
5289 } | |
5290 return reasons; | |
5291 } | |
5292 | |
5293 void FrameView::SetViewportIntersectionFromParent( | 5270 void FrameView::SetViewportIntersectionFromParent( |
5294 const IntRect& viewport_intersection) { | 5271 const IntRect& viewport_intersection) { |
5295 if (remote_viewport_intersection_ != viewport_intersection) { | 5272 if (remote_viewport_intersection_ != viewport_intersection) { |
5296 remote_viewport_intersection_ = viewport_intersection; | 5273 remote_viewport_intersection_ = viewport_intersection; |
5297 ScheduleAnimation(); | 5274 ScheduleAnimation(); |
5298 } | 5275 } |
5299 } | 5276 } |
5300 | 5277 |
5301 IntRect FrameView::RemoteViewportIntersection() { | 5278 IntRect FrameView::RemoteViewportIntersection() { |
5302 IntRect intersection(remote_viewport_intersection_); | 5279 IntRect intersection(remote_viewport_intersection_); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5357 void FrameView::SetAnimationHost( | 5334 void FrameView::SetAnimationHost( |
5358 std::unique_ptr<CompositorAnimationHost> host) { | 5335 std::unique_ptr<CompositorAnimationHost> host) { |
5359 animation_host_ = std::move(host); | 5336 animation_host_ = std::move(host); |
5360 } | 5337 } |
5361 | 5338 |
5362 LayoutUnit FrameView::CaretWidth() const { | 5339 LayoutUnit FrameView::CaretWidth() const { |
5363 return LayoutUnit(GetHostWindow()->WindowToViewportScalar(1)); | 5340 return LayoutUnit(GetHostWindow()->WindowToViewportScalar(1)); |
5364 } | 5341 } |
5365 | 5342 |
5366 } // namespace blink | 5343 } // namespace blink |
OLD | NEW |