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

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 unit tests 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 m_subtreeThrottled(false), 196 m_subtreeThrottled(false),
197 m_lifecycleUpdatesThrottled(false), 197 m_lifecycleUpdatesThrottled(false),
198 m_needsPaintPropertyUpdate(true), 198 m_needsPaintPropertyUpdate(true),
199 m_currentUpdateLifecyclePhasesTargetState( 199 m_currentUpdateLifecyclePhasesTargetState(
200 DocumentLifecycle::Uninitialized), 200 DocumentLifecycle::Uninitialized),
201 m_scrollAnchor(this), 201 m_scrollAnchor(this),
202 m_scrollbarManager(*this), 202 m_scrollbarManager(*this),
203 m_needsScrollbarsUpdate(false), 203 m_needsScrollbarsUpdate(false),
204 m_suppressAdjustViewSize(false), 204 m_suppressAdjustViewSize(false),
205 m_allowsLayoutInvalidationAfterLayoutClean(true), 205 m_allowsLayoutInvalidationAfterLayoutClean(true),
206 m_mainThreadScrollingReasons(0), 206 m_mainThreadScrollingReasons(0) {
207 m_mainThreadScrollingReasonsCounter(
208 MainThreadScrollingReason::kMainThreadScrollingReasonCount,
209 0) {
210 init(); 207 init();
211 } 208 }
212 209
213 FrameView* FrameView::create(LocalFrame& frame) { 210 FrameView* FrameView::create(LocalFrame& frame) {
214 FrameView* view = new FrameView(frame); 211 FrameView* view = new FrameView(frame);
215 view->show(); 212 view->show();
216 return view; 213 return view;
217 } 214 }
218 215
219 FrameView* FrameView::create(LocalFrame& frame, const IntSize& initialSize) { 216 FrameView* FrameView::create(LocalFrame& frame, const IntSize& initialSize) {
(...skipping 4953 matching lines...) Expand 10 before | Expand all | Expand 10 after
5173 .c_str()); 5170 .c_str());
5174 return result; 5171 return result;
5175 } 5172 }
5176 5173
5177 String result(MainThreadScrollingReason::mainThreadScrollingReasonsAsText( 5174 String result(MainThreadScrollingReason::mainThreadScrollingReasonsAsText(
5178 m_mainThreadScrollingReasons) 5175 m_mainThreadScrollingReasons)
5179 .c_str()); 5176 .c_str());
5180 return result; 5177 return result;
5181 } 5178 }
5182 5179
5183 void FrameView::adjustStyleRelatedMainThreadScrollingReasons(
5184 const uint32_t reason,
5185 bool increase) {
5186 int index = MainThreadScrollingReason::getReasonIndex(reason);
5187 DCHECK_GE(index, 0);
5188 m_mainThreadScrollingReasonsCounter[index] += increase ? 1 : -1;
5189 DCHECK_GE(m_mainThreadScrollingReasonsCounter[index], 0);
5190 }
5191
5192 MainThreadScrollingReasons
5193 FrameView::getStyleRelatedMainThreadScrollingReasons() const {
5194 MainThreadScrollingReasons reasons =
5195 static_cast<MainThreadScrollingReasons>(0);
5196 for (uint32_t reason = 0;
5197 reason < MainThreadScrollingReason::kMainThreadScrollingReasonCount;
5198 ++reason) {
5199 if (m_mainThreadScrollingReasonsCounter[reason] > 0) {
5200 reasons |= 1 << reason;
5201 }
5202 }
5203 return reasons;
5204 }
5205
5206 void FrameView::setViewportIntersectionFromParent( 5180 void FrameView::setViewportIntersectionFromParent(
5207 const IntRect& viewportIntersection) { 5181 const IntRect& viewportIntersection) {
5208 if (m_remoteViewportIntersection != viewportIntersection) { 5182 if (m_remoteViewportIntersection != viewportIntersection) {
5209 m_remoteViewportIntersection = viewportIntersection; 5183 m_remoteViewportIntersection = viewportIntersection;
5210 scheduleAnimation(); 5184 scheduleAnimation();
5211 } 5185 }
5212 } 5186 }
5213 5187
5214 IntRect FrameView::remoteViewportIntersection() { 5188 IntRect FrameView::remoteViewportIntersection() {
5215 IntRect intersection(m_remoteViewportIntersection); 5189 IntRect intersection(m_remoteViewportIntersection);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
5269 void FrameView::setAnimationHost( 5243 void FrameView::setAnimationHost(
5270 std::unique_ptr<CompositorAnimationHost> host) { 5244 std::unique_ptr<CompositorAnimationHost> host) {
5271 m_animationHost = std::move(host); 5245 m_animationHost = std::move(host);
5272 } 5246 }
5273 5247
5274 LayoutUnit FrameView::caretWidth() const { 5248 LayoutUnit FrameView::caretWidth() const {
5275 return LayoutUnit(getHostWindow()->windowToViewportScalar(1)); 5249 return LayoutUnit(getHostWindow()->windowToViewportScalar(1));
5276 } 5250 }
5277 5251
5278 } // namespace blink 5252 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698