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

Unified Diff: third_party/WebKit/Source/core/frame/VisualViewport.h

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/frame/VisualViewport.h
diff --git a/third_party/WebKit/Source/core/frame/VisualViewport.h b/third_party/WebKit/Source/core/frame/VisualViewport.h
index b0966f3b4eafa28acfe7c14432de38f34410c282..3546e15222d605e6decca5df6f3f3860b33c20b8 100644
--- a/third_party/WebKit/Source/core/frame/VisualViewport.h
+++ b/third_party/WebKit/Source/core/frame/VisualViewport.h
@@ -33,8 +33,8 @@
#include "core/CoreExport.h"
#include "core/events/Event.h"
-#include "platform/geometry/FloatPoint.h"
#include "platform/geometry/FloatRect.h"
+#include "platform/geometry/FloatSize.h"
#include "platform/geometry/IntSize.h"
#include "platform/graphics/GraphicsLayerClient.h"
#include "platform/scroll/ScrollableArea.h"
@@ -93,9 +93,8 @@ class CORE_EXPORT VisualViewport final
// coordinates are in partial CSS pixels.
void setLocation(const FloatPoint&);
// FIXME: This should be called moveBy
- void move(const FloatPoint&);
- void move(const FloatSize&);
- FloatPoint location() const { return m_offset; }
+ void move(const ScrollOffset&);
+ FloatPoint location() const { return FloatPoint(m_offset); }
bokan 2016/10/02 19:47:51 This should return a ScrollOffset but if you want
szager1 2016/10/05 07:43:36 No time like the present! I got rid of this metho
// Sets the size of the inner viewport when unscaled in CSS pixels.
void setSize(const IntSize&);
@@ -128,7 +127,6 @@ class CORE_EXPORT VisualViewport final
FloatRect visibleRect() const;
// The viewport rect relative to the document origin, in partial CSS pixels.
- // FIXME: This should be a DoubleRect since scroll offsets are now doubles.
FloatRect visibleRectInDocument() const;
// Convert the given rect in the main FrameView's coordinates into a rect
@@ -166,14 +164,10 @@ class CORE_EXPORT VisualViewport final
// ScrollableArea implementation
HostWindow* getHostWindow() const override;
- DoubleRect visibleContentRectDouble(
- IncludeScrollbarsInRect = ExcludeScrollbars) const override;
- IntRect visibleContentRect(
- IncludeScrollbarsInRect = ExcludeScrollbars) const override;
bool shouldUseIntegerScrollOffset() const override;
- void setScrollPosition(const DoublePoint&,
- ScrollType,
- ScrollBehavior = ScrollBehaviorInstant) override;
+ void setScrollOffset(const ScrollOffset&,
+ ScrollType,
+ ScrollBehavior = ScrollBehaviorInstant) override;
LayoutRect visualRectForScrollbarParts() const override {
ASSERT_NOT_REACHED();
return LayoutRect();
@@ -182,11 +176,11 @@ class CORE_EXPORT VisualViewport final
int scrollSize(ScrollbarOrientation) const override;
bool isScrollCornerVisible() const override { return false; }
IntRect scrollCornerRect() const override { return IntRect(); }
- IntPoint scrollPosition() const override { return flooredIntPoint(m_offset); }
- DoublePoint scrollPositionDouble() const override { return m_offset; }
- IntPoint minimumScrollPosition() const override;
- IntPoint maximumScrollPosition() const override;
- DoublePoint maximumScrollPositionDouble() const override;
+ IntSize scrollOffsetInt() const override { return flooredIntSize(m_offset); }
+ ScrollOffset scrollOffset() const override { return m_offset; }
+ IntSize minimumScrollOffsetInt() const override;
+ IntSize maximumScrollOffsetInt() const override;
+ ScrollOffset maximumScrollOffset() const override;
int visibleHeight() const override { return visibleRect().height(); }
int visibleWidth() const override { return visibleRect().width(); }
IntSize contentsSize() const override;
@@ -196,7 +190,7 @@ class CORE_EXPORT VisualViewport final
bool shouldPlaceVerticalScrollbarOnLeft() const override { return false; }
bool scrollAnimatorEnabled() const override;
void scrollControlWasSetNeedsPaintInvalidation() override {}
- void updateScrollPosition(const DoublePoint&, ScrollType) override;
+ void updateScrollOffset(const ScrollOffset&, ScrollType) override;
GraphicsLayer* layerForContainer() const override;
GraphicsLayer* layerForScrolling() const override;
GraphicsLayer* layerForHorizontalScrollbar() const override;
@@ -205,10 +199,10 @@ class CORE_EXPORT VisualViewport final
CompositorAnimationTimeline* compositorAnimationTimeline() const override;
// Visual Viewport API implementation.
- double scrollLeft();
- double scrollTop();
- double clientWidth();
- double clientHeight();
+ float scrollLeft();
bokan 2016/10/02 19:47:51 these should stay double since they're Web exposed
szager1 2016/10/05 07:43:36 Done.
+ float scrollTop();
+ float clientWidth();
+ float clientHeight();
double pageScale();
// Used for gathering data on user pinch-zoom statistics.
@@ -245,7 +239,6 @@ class CORE_EXPORT VisualViewport final
String debugName(const GraphicsLayer*) const override;
void setupScrollbar(WebScrollbar::Orientation);
- FloatPoint clampOffsetToBoundaries(const FloatPoint&);
void notifyRootFrameViewport() const;
@@ -268,7 +261,7 @@ class CORE_EXPORT VisualViewport final
std::unique_ptr<WebScrollbarLayer> m_webOverlayScrollbarVertical;
// Offset of the visual viewport from the main frame's origin, in CSS pixels.
- FloatPoint m_offset;
+ ScrollOffset m_offset;
float m_scale;
IntSize m_size;
float m_topControlsAdjustment;

Powered by Google App Engine
This is Rietveld 408576698