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

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

Issue 2138823002: Clamp in VisualViewport::setScrollPosition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « third_party/WebKit/Source/core/frame/VisualViewport.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 535
536 bool VisualViewport::shouldUseIntegerScrollOffset() const 536 bool VisualViewport::shouldUseIntegerScrollOffset() const
537 { 537 {
538 LocalFrame* frame = mainFrame(); 538 LocalFrame* frame = mainFrame();
539 if (frame && frame->settings() && !frame->settings()->preferCompositingToLCD TextEnabled()) 539 if (frame && frame->settings() && !frame->settings()->preferCompositingToLCD TextEnabled())
540 return true; 540 return true;
541 541
542 return ScrollableArea::shouldUseIntegerScrollOffset(); 542 return ScrollableArea::shouldUseIntegerScrollOffset();
543 } 543 }
544 544
545 void VisualViewport::setScrollPosition(const DoublePoint& scrollPoint, ScrollTyp e scrollType, ScrollBehavior scrollBehavior)
546 {
547 // We clamp the position here, because the ScrollAnimator may otherwise be
548 // set to a non-clamped position by ScrollableArea::setScrollPosition,
549 // which may lead to incorrect scrolling behavior in RootFrameViewport down
550 // the line.
551 // TODO(eseckler): Solve this instead by ensuring that ScrollableArea and
552 // ScrollAnimator are kept in sync. This requires that ScrollableArea always
553 // stores fractional offsets and that truncation happens elsewhere, see
554 // crbug.com/626315.
555 DoublePoint newScrollPosition = clampScrollPosition(scrollPoint);
556 ScrollableArea::setScrollPosition(newScrollPosition, scrollType, scrollBehav ior);
557 }
558
545 int VisualViewport::scrollSize(ScrollbarOrientation orientation) const 559 int VisualViewport::scrollSize(ScrollbarOrientation orientation) const
546 { 560 {
547 IntSize scrollDimensions = maximumScrollPosition() - minimumScrollPosition() ; 561 IntSize scrollDimensions = maximumScrollPosition() - minimumScrollPosition() ;
548 return (orientation == HorizontalScrollbar) ? scrollDimensions.width() : scr ollDimensions.height(); 562 return (orientation == HorizontalScrollbar) ? scrollDimensions.width() : scr ollDimensions.height();
549 } 563 }
550 564
551 IntPoint VisualViewport::minimumScrollPosition() const 565 IntPoint VisualViewport::minimumScrollPosition() const
552 { 566 {
553 return IntPoint(); 567 return IntPoint();
554 } 568 }
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 } else if (graphicsLayer == m_rootTransformLayer.get()) { 846 } else if (graphicsLayer == m_rootTransformLayer.get()) {
833 name = "Root Transform Layer"; 847 name = "Root Transform Layer";
834 } else { 848 } else {
835 ASSERT_NOT_REACHED(); 849 ASSERT_NOT_REACHED();
836 } 850 }
837 851
838 return name; 852 return name;
839 } 853 }
840 854
841 } // namespace blink 855 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/VisualViewport.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698