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 4923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5150 } | 5147 } |
5151 | 5148 |
5152 Frame* child = frame.Tree().FirstChild(); | 5149 Frame* child = frame.Tree().FirstChild(); |
5153 while (child) { | 5150 while (child) { |
5154 UpdateSubFrameScrollOnMainReason(*child, reasons); | 5151 UpdateSubFrameScrollOnMainReason(*child, reasons); |
5155 child = child->Tree().NextSibling(); | 5152 child = child->Tree().NextSibling(); |
5156 } | 5153 } |
5157 | 5154 |
5158 if (frame.IsMainFrame()) | 5155 if (frame.IsMainFrame()) |
5159 main_thread_scrolling_reasons_ = reasons; | 5156 main_thread_scrolling_reasons_ = reasons; |
| 5157 DCHECK(!MainThreadScrollingReason::HasNonCompositedScrollReasons( |
| 5158 main_thread_scrolling_reasons_)); |
5160 } | 5159 } |
5161 | 5160 |
5162 MainThreadScrollingReasons FrameView::MainThreadScrollingReasonsPerFrame() | 5161 MainThreadScrollingReasons FrameView::MainThreadScrollingReasonsPerFrame() |
5163 const { | 5162 const { |
5164 MainThreadScrollingReasons reasons = | 5163 MainThreadScrollingReasons reasons = |
5165 static_cast<MainThreadScrollingReasons>(0); | 5164 static_cast<MainThreadScrollingReasons>(0); |
5166 | 5165 |
5167 if (ShouldThrottleRendering()) | 5166 if (ShouldThrottleRendering()) |
5168 return reasons; | 5167 return reasons; |
5169 | 5168 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5208 // Walk the tree to the root. Use the gathered reasons to determine | 5207 // Walk the tree to the root. Use the gathered reasons to determine |
5209 // whether the target frame should be scrolled on main thread regardless | 5208 // whether the target frame should be scrolled on main thread regardless |
5210 // other subframes on the same page. | 5209 // other subframes on the same page. |
5211 for (Frame* frame = frame_; frame; frame = frame->Tree().Parent()) { | 5210 for (Frame* frame = frame_; frame; frame = frame->Tree().Parent()) { |
5212 if (!frame->IsLocalFrame()) | 5211 if (!frame->IsLocalFrame()) |
5213 continue; | 5212 continue; |
5214 reasons |= | 5213 reasons |= |
5215 ToLocalFrame(frame)->View()->MainThreadScrollingReasonsPerFrame(); | 5214 ToLocalFrame(frame)->View()->MainThreadScrollingReasonsPerFrame(); |
5216 } | 5215 } |
5217 | 5216 |
| 5217 DCHECK(!MainThreadScrollingReason::HasNonCompositedScrollReasons(reasons)); |
5218 return reasons; | 5218 return reasons; |
5219 } | 5219 } |
5220 | 5220 |
5221 String FrameView::MainThreadScrollingReasonsAsText() const { | 5221 String FrameView::MainThreadScrollingReasonsAsText() const { |
5222 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 5222 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
5223 DCHECK(Lifecycle().GetState() >= DocumentLifecycle::kPrePaintClean); | 5223 DCHECK(Lifecycle().GetState() >= DocumentLifecycle::kPrePaintClean); |
5224 | 5224 |
5225 // Slimming paint v2 stores main thread scrolling reasons on property | 5225 // Slimming paint v2 stores main thread scrolling reasons on property |
5226 // trees instead of in |m_mainThreadScrollingReasons|. | 5226 // trees instead of in |m_mainThreadScrollingReasons|. |
5227 MainThreadScrollingReasons reasons = 0; | 5227 MainThreadScrollingReasons reasons = 0; |
(...skipping 13 matching lines...) Expand all Loading... |
5241 .c_str()); | 5241 .c_str()); |
5242 return result; | 5242 return result; |
5243 } | 5243 } |
5244 | 5244 |
5245 String result(MainThreadScrollingReason::mainThreadScrollingReasonsAsText( | 5245 String result(MainThreadScrollingReason::mainThreadScrollingReasonsAsText( |
5246 main_thread_scrolling_reasons_) | 5246 main_thread_scrolling_reasons_) |
5247 .c_str()); | 5247 .c_str()); |
5248 return result; | 5248 return result; |
5249 } | 5249 } |
5250 | 5250 |
5251 void FrameView::AdjustStyleRelatedMainThreadScrollingReasons( | |
5252 const uint32_t reason, | |
5253 bool increase) { | |
5254 int index = MainThreadScrollingReason::getReasonIndex(reason); | |
5255 DCHECK_GE(index, 0); | |
5256 main_thread_scrolling_reasons_counter_[index] += increase ? 1 : -1; | |
5257 DCHECK_GE(main_thread_scrolling_reasons_counter_[index], 0); | |
5258 } | |
5259 | |
5260 MainThreadScrollingReasons | |
5261 FrameView::GetStyleRelatedMainThreadScrollingReasons() const { | |
5262 MainThreadScrollingReasons reasons = | |
5263 static_cast<MainThreadScrollingReasons>(0); | |
5264 for (uint32_t reason = 0; | |
5265 reason < MainThreadScrollingReason::kMainThreadScrollingReasonCount; | |
5266 ++reason) { | |
5267 if (main_thread_scrolling_reasons_counter_[reason] > 0) { | |
5268 reasons |= 1 << reason; | |
5269 } | |
5270 } | |
5271 return reasons; | |
5272 } | |
5273 | |
5274 void FrameView::SetViewportIntersectionFromParent( | 5251 void FrameView::SetViewportIntersectionFromParent( |
5275 const IntRect& viewport_intersection) { | 5252 const IntRect& viewport_intersection) { |
5276 if (remote_viewport_intersection_ != viewport_intersection) { | 5253 if (remote_viewport_intersection_ != viewport_intersection) { |
5277 remote_viewport_intersection_ = viewport_intersection; | 5254 remote_viewport_intersection_ = viewport_intersection; |
5278 ScheduleAnimation(); | 5255 ScheduleAnimation(); |
5279 } | 5256 } |
5280 } | 5257 } |
5281 | 5258 |
5282 IntRect FrameView::RemoteViewportIntersection() { | 5259 IntRect FrameView::RemoteViewportIntersection() { |
5283 IntRect intersection(remote_viewport_intersection_); | 5260 IntRect intersection(remote_viewport_intersection_); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5338 void FrameView::SetAnimationHost( | 5315 void FrameView::SetAnimationHost( |
5339 std::unique_ptr<CompositorAnimationHost> host) { | 5316 std::unique_ptr<CompositorAnimationHost> host) { |
5340 animation_host_ = std::move(host); | 5317 animation_host_ = std::move(host); |
5341 } | 5318 } |
5342 | 5319 |
5343 LayoutUnit FrameView::CaretWidth() const { | 5320 LayoutUnit FrameView::CaretWidth() const { |
5344 return LayoutUnit(GetHostWindow()->WindowToViewportScalar(1)); | 5321 return LayoutUnit(GetHostWindow()->WindowToViewportScalar(1)); |
5345 } | 5322 } |
5346 | 5323 |
5347 } // namespace blink | 5324 } // namespace blink |
OLD | NEW |