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

Unified Diff: third_party/WebKit/Source/core/frame/FrameView.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/FrameView.h
diff --git a/third_party/WebKit/Source/core/frame/FrameView.h b/third_party/WebKit/Source/core/frame/FrameView.h
index daa3e3c5951b8bf1c148ffb8ed7709b4f8e257fc..93b385cbcd00ecd85a029f8c063faed6901af34f 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.h
+++ b/third_party/WebKit/Source/core/frame/FrameView.h
@@ -194,11 +194,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);
@@ -292,7 +288,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();
@@ -401,7 +397,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;
@@ -512,25 +508,19 @@ 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; }
- 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());
- } // Gets the scrolled position as an IntSize. Convenient for adding to other sizes.
- DoubleSize scrollOffsetDouble() const {
- return DoubleSize(m_scrollPosition.x(), m_scrollPosition.y());
}
- DoubleSize pendingScrollDelta() const { return m_pendingScrollDelta; }
- IntPoint minimumScrollPosition()
- const override; // The minimum position we can be scrolled to.
- 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).
void scrollContents(const IntSize& scrollDelta);
@@ -764,7 +754,7 @@ class CORE_EXPORT FrameView final
private:
explicit FrameView(LocalFrame*);
- void updateScrollPosition(const DoublePoint&, ScrollType) override;
+ void updateScrollOffset(const ScrollOffset&, ScrollType) override;
void updateLifecyclePhasesInternal(
DocumentLifecycle::LifecycleState targetState);
@@ -786,7 +776,7 @@ class CORE_EXPORT FrameView final
void clearLayoutSubtreeRootsAndMarkContainingBlocks();
- // Called when our frame rect changes (or the rect/scroll position of an ancestor changes).
+ // Called when our frame rect changes (or the rect/scroll offset of an ancestor changes).
void frameRectsChanged() override;
bool contentsInCompositedLayer() const;
@@ -831,7 +821,7 @@ class CORE_EXPORT FrameView final
void didScrollTimerFired(TimerBase*);
void updateLayersAndCompositingAfterScrollIfNeeded(
- const DoubleSize& scrollDelta);
+ const ScrollOffset& scrollDelta);
static bool computeCompositedSelection(LocalFrame&, CompositedSelection&);
void updateCompositedSelectionIfNeeded();
@@ -858,7 +848,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 {
@@ -988,8 +978,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;

Powered by Google App Engine
This is Rietveld 408576698