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

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

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: Fix README.md 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/FrameView.h
diff --git a/third_party/WebKit/Source/core/frame/FrameView.h b/third_party/WebKit/Source/core/frame/FrameView.h
index 49ce5857ca1d1397e3ead195a12567ff6d41394c..ac120152a9c1790056f0018e46ceeff42d3d9426 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.h
+++ b/third_party/WebKit/Source/core/frame/FrameView.h
@@ -199,11 +199,7 @@ class CORE_EXPORT FrameView final
IntSize inputEventsOffsetForEmulation() const;
void setInputEventsTransformForEmulation(const IntSize&, float);
- void setScrollPosition(const DoublePoint&,
- ScrollType,
- ScrollBehavior = ScrollBehaviorInstant) override;
void didChangeScrollOffset();
-
void didUpdateElasticOverscroll();
void viewportSizeChanged(bool widthChanged, bool heightChanged);
@@ -302,7 +298,7 @@ class CORE_EXPORT FrameView final
// Updates the fragment anchor element based on URL's fragment identifier.
// Updates corresponding ':target' CSS pseudo class on the anchor element.
// If |UrlFragmentScroll| is passed in then makes the anchor element
- // focused and also visible by scrolling to it. The scroll position is
+ // focused and also visible by scrolling to it. The scroll offset is
// maintained during the frame loading process.
void processUrlFragment(const KURL&, UrlFragmentBehavior = UrlFragmentScroll);
void clearFragmentAnchor();
@@ -413,7 +409,7 @@ class CORE_EXPORT FrameView final
return IntSize(0, ceilf(m_topControlsViewportAdjustment));
}
- IntPoint maximumScrollPosition() const override;
+ IntSize maximumScrollOffsetInt() const override;
// ScrollableArea interface
void getTickmarks(Vector<IntRect>&) const override;
@@ -527,30 +523,21 @@ class CORE_EXPORT FrameView final
int contentsWidth() const { return contentsSize().width(); }
int contentsHeight() const { return contentsSize().height(); }
- // Functions for querying the current scrolled position (both as a point, a
- // size, or as individual X and Y values). Be careful in using the Double
- // version scrollPositionDouble() and scrollOffsetDouble(). They are meant to
- // be used to communicate the fractional scroll position/offset with chromium
- // compositor which can do sub-pixel positioning. Do not call these if the
- // scroll position/offset is used in Blink for positioning. Use the Int
- // version instead.
- IntPoint scrollPosition() const override {
- return visibleContentRect().location();
- }
- DoublePoint scrollPositionDouble() const override { return m_scrollPosition; }
- // Gets the scrolled position as an IntSize. Convenient for adding to other
- // sizes.
- IntSize scrollOffset() const {
+ // Functions for querying the current scrolled offset (both as a point, a
+ // size, or as individual X and Y values). Be careful in using the Float
+ // version scrollOffset() and scrollOffset(). They are meant to be used to
+ // communicate the fractional scroll offset with chromium compositor which can
+ // do sub-pixel positioning. Do not call these if the scroll offset is used
+ // in Blink for positioning. Use the Int version instead.
+ IntSize scrollOffsetInt() const override {
return toIntSize(visibleContentRect().location());
}
- DoubleSize scrollOffsetDouble() const {
- return DoubleSize(m_scrollPosition.x(), m_scrollPosition.y());
- }
- DoubleSize pendingScrollDelta() const { return m_pendingScrollDelta; }
- // The minimum position we can be scrolled to.
- IntPoint minimumScrollPosition() const override;
- int scrollX() const { return scrollPosition().x(); }
- int scrollY() const { return scrollPosition().y(); }
+ ScrollOffset scrollOffset() const override { return m_scrollOffset; }
+ ScrollOffset pendingScrollDelta() const { return m_pendingScrollDelta; }
+ IntSize minimumScrollOffsetInt()
+ const override; // The minimum offset we can be scrolled to.
+ int scrollX() const { return scrollOffsetInt().width(); }
+ int scrollY() const { return scrollOffsetInt().height(); }
// Scroll the actual contents of the view (either blitting or invalidating as
// needed).
@@ -796,7 +783,7 @@ class CORE_EXPORT FrameView final
private:
explicit FrameView(LocalFrame*);
- void setScrollOffset(const DoublePoint&, ScrollType) override;
+ void updateScrollOffset(const ScrollOffset&, ScrollType) override;
void updateLifecyclePhasesInternal(
DocumentLifecycle::LifecycleState targetState);
@@ -818,7 +805,7 @@ class CORE_EXPORT FrameView final
void clearLayoutSubtreeRootsAndMarkContainingBlocks();
- // Called when our frame rect changes (or the rect/scroll position of an
+ // Called when our frame rect changes (or the rect/scroll offset of an
// ancestor changes).
void frameRectsChanged() override;
@@ -864,7 +851,7 @@ class CORE_EXPORT FrameView final
void didScrollTimerFired(TimerBase*);
void updateLayersAndCompositingAfterScrollIfNeeded(
- const DoubleSize& scrollDelta);
+ const ScrollOffset& scrollDelta);
static bool computeCompositedSelection(LocalFrame&, CompositedSelection&);
void updateCompositedSelectionIfNeeded();
@@ -893,7 +880,7 @@ class CORE_EXPORT FrameView final
bool adjustScrollbarExistence(ComputeScrollbarExistenceOption = FirstPass);
void adjustScrollbarOpacity();
- void adjustScrollPositionFromUpdateScrollbars();
+ void adjustScrollOffsetFromUpdateScrollbars();
bool visualViewportSuppliesScrollbars() const;
bool isFrameViewScrollbar(const Widget* child) const {
@@ -1025,8 +1012,8 @@ class CORE_EXPORT FrameView final
ChildrenWidgetSet m_children;
- DoubleSize m_pendingScrollDelta;
- DoublePoint m_scrollPosition;
+ ScrollOffset m_pendingScrollDelta;
+ ScrollOffset m_scrollOffset;
IntSize m_contentsSize;
int m_scrollbarsAvoidingResizer;
« no previous file with comments | « third_party/WebKit/Source/core/frame/DOMVisualViewport.cpp ('k') | third_party/WebKit/Source/core/frame/FrameView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698