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

Side by Side Diff: third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp

Issue 2387053003: reflow comments in platform/{mediastream,scroll} (Closed)
Patch Set: blah Created 4 years, 2 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) 2010, Google Inc. All rights reserved. 2 * Copyright (c) 2010, Google Inc. All rights reserved.
3 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved. 3 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 ScrollbarOrientation orientation, 210 ScrollbarOrientation orientation,
211 double position, 211 double position,
212 ScrollType scrollType, 212 ScrollType scrollType,
213 ScrollBehavior behavior) { 213 ScrollBehavior behavior) {
214 DoublePoint newPosition; 214 DoublePoint newPosition;
215 if (orientation == HorizontalScrollbar) 215 if (orientation == HorizontalScrollbar)
216 newPosition = DoublePoint(position, scrollAnimator().currentPosition().y()); 216 newPosition = DoublePoint(position, scrollAnimator().currentPosition().y());
217 else 217 else
218 newPosition = DoublePoint(scrollAnimator().currentPosition().x(), position); 218 newPosition = DoublePoint(scrollAnimator().currentPosition().x(), position);
219 219
220 // TODO(bokan): Note, this doesn't use the derived class versions since this m ethod is currently used 220 // TODO(bokan): Note, this doesn't use the derived class versions since this
221 // exclusively by code that adjusts the position by the scroll origin and the derived class versions 221 // method is currently used exclusively by code that adjusts the position by
222 // differ on whether they take that into account or not. 222 // the scroll origin and the derived class versions differ on whether they
223 // take that into account or not.
223 ScrollableArea::setScrollPosition(newPosition, scrollType, behavior); 224 ScrollableArea::setScrollPosition(newPosition, scrollType, behavior);
224 } 225 }
225 226
226 void ScrollableArea::programmaticScrollHelper(const DoublePoint& position, 227 void ScrollableArea::programmaticScrollHelper(const DoublePoint& position,
227 ScrollBehavior scrollBehavior) { 228 ScrollBehavior scrollBehavior) {
228 cancelScrollAnimation(); 229 cancelScrollAnimation();
229 230
230 if (scrollBehavior == ScrollBehaviorSmooth) 231 if (scrollBehavior == ScrollBehaviorSmooth)
231 programmaticScrollAnimator().animateToOffset(toFloatPoint(position)); 232 programmaticScrollAnimator().animateToOffset(toFloatPoint(position));
232 else 233 else
233 programmaticScrollAnimator().scrollToOffsetWithoutAnimation( 234 programmaticScrollAnimator().scrollToOffsetWithoutAnimation(
234 toFloatPoint(position)); 235 toFloatPoint(position));
235 } 236 }
236 237
237 void ScrollableArea::userScrollHelper(const DoublePoint& position, 238 void ScrollableArea::userScrollHelper(const DoublePoint& position,
238 ScrollBehavior scrollBehavior) { 239 ScrollBehavior scrollBehavior) {
239 cancelProgrammaticScrollAnimation(); 240 cancelProgrammaticScrollAnimation();
240 241
241 double x = userInputScrollable(HorizontalScrollbar) 242 double x = userInputScrollable(HorizontalScrollbar)
242 ? position.x() 243 ? position.x()
243 : scrollAnimator().currentPosition().x(); 244 : scrollAnimator().currentPosition().x();
244 double y = userInputScrollable(VerticalScrollbar) 245 double y = userInputScrollable(VerticalScrollbar)
245 ? position.y() 246 ? position.y()
246 : scrollAnimator().currentPosition().y(); 247 : scrollAnimator().currentPosition().y();
247 248
248 // Smooth user scrolls (keyboard, wheel clicks) are handled via the userScroll method. 249 // Smooth user scrolls (keyboard, wheel clicks) are handled via the userScroll
249 // TODO(bokan): The userScroll method should probably be modified to call this method 250 // method.
250 // and ScrollAnimatorBase to have a simpler animateToOffset metho d like the 251 // TODO(bokan): The userScroll method should probably be modified to call this
251 // ProgrammaticScrollAnimator. 252 // method and ScrollAnimatorBase to have a simpler
253 // animateToOffset method like the ProgrammaticScrollAnimator.
252 ASSERT(scrollBehavior == ScrollBehaviorInstant); 254 ASSERT(scrollBehavior == ScrollBehaviorInstant);
253 scrollAnimator().scrollToOffsetWithoutAnimation(FloatPoint(x, y)); 255 scrollAnimator().scrollToOffsetWithoutAnimation(FloatPoint(x, y));
254 } 256 }
255 257
256 LayoutRect ScrollableArea::scrollIntoView(const LayoutRect& rectInContent, 258 LayoutRect ScrollableArea::scrollIntoView(const LayoutRect& rectInContent,
257 const ScrollAlignment& alignX, 259 const ScrollAlignment& alignX,
258 const ScrollAlignment& alignY, 260 const ScrollAlignment& alignY,
259 ScrollType) { 261 ScrollType) {
260 // TODO(bokan): This should really be implemented here but ScrollAlignment is in Core which is a dependency violation. 262 // TODO(bokan): This should really be implemented here but ScrollAlignment is
263 // in Core which is a dependency violation.
261 ASSERT_NOT_REACHED(); 264 ASSERT_NOT_REACHED();
262 return LayoutRect(); 265 return LayoutRect();
263 } 266 }
264 267
265 void ScrollableArea::scrollPositionChanged(const DoublePoint& position, 268 void ScrollableArea::scrollPositionChanged(const DoublePoint& position,
266 ScrollType scrollType) { 269 ScrollType scrollType) {
267 TRACE_EVENT0("blink", "ScrollableArea::scrollPositionChanged"); 270 TRACE_EVENT0("blink", "ScrollableArea::scrollPositionChanged");
268 271
269 DoublePoint oldPosition = scrollPositionDouble(); 272 DoublePoint oldPosition = scrollPositionDouble();
270 DoublePoint truncatedPosition = 273 DoublePoint truncatedPosition =
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 scrollAnimator->finishCurrentScrollAnimations(); 356 scrollAnimator->finishCurrentScrollAnimations();
354 } 357 }
355 358
356 void ScrollableArea::didAddScrollbar(Scrollbar& scrollbar, 359 void ScrollableArea::didAddScrollbar(Scrollbar& scrollbar,
357 ScrollbarOrientation orientation) { 360 ScrollbarOrientation orientation) {
358 if (orientation == VerticalScrollbar) 361 if (orientation == VerticalScrollbar)
359 scrollAnimator().didAddVerticalScrollbar(scrollbar); 362 scrollAnimator().didAddVerticalScrollbar(scrollbar);
360 else 363 else
361 scrollAnimator().didAddHorizontalScrollbar(scrollbar); 364 scrollAnimator().didAddHorizontalScrollbar(scrollbar);
362 365
363 // <rdar://problem/9797253> AppKit resets the scrollbar's style when you attac h a scrollbar 366 // <rdar://problem/9797253> AppKit resets the scrollbar's style when you
367 // attach a scrollbar
364 setScrollbarOverlayStyle(getScrollbarOverlayStyle()); 368 setScrollbarOverlayStyle(getScrollbarOverlayStyle());
365 } 369 }
366 370
367 void ScrollableArea::willRemoveScrollbar(Scrollbar& scrollbar, 371 void ScrollableArea::willRemoveScrollbar(Scrollbar& scrollbar,
368 ScrollbarOrientation orientation) { 372 ScrollbarOrientation orientation) {
369 if (ScrollAnimatorBase* scrollAnimator = existingScrollAnimator()) { 373 if (ScrollAnimatorBase* scrollAnimator = existingScrollAnimator()) {
370 if (orientation == VerticalScrollbar) 374 if (orientation == VerticalScrollbar)
371 scrollAnimator->willRemoveVerticalScrollbar(scrollbar); 375 scrollAnimator->willRemoveVerticalScrollbar(scrollbar);
372 else 376 else
373 scrollAnimator->willRemoveHorizontalScrollbar(scrollbar); 377 scrollAnimator->willRemoveHorizontalScrollbar(scrollbar);
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 return IntSize(std::max(0, size.width() - verticalScrollbarWidth()), 598 return IntSize(std::max(0, size.width() - verticalScrollbarWidth()),
595 std::max(0, size.height() - horizontalScrollbarHeight())); 599 std::max(0, size.height() - horizontalScrollbarHeight()));
596 } 600 }
597 601
598 DEFINE_TRACE(ScrollableArea) { 602 DEFINE_TRACE(ScrollableArea) {
599 visitor->trace(m_scrollAnimator); 603 visitor->trace(m_scrollAnimator);
600 visitor->trace(m_programmaticScrollAnimator); 604 visitor->trace(m_programmaticScrollAnimator);
601 } 605 }
602 606
603 } // namespace blink 607 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698