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

Side by Side Diff: Source/core/frame/PinchViewport.h

Issue 640063002: Hide scrollbars when their dimensions are not scrollable. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | Source/core/frame/PinchViewport.cpp » ('j') | Source/core/frame/PinchViewport.cpp » ('J')
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 // Scroll the main frame and pinch viewport so that the given rect in the 112 // Scroll the main frame and pinch viewport so that the given rect in the
113 // top-level document is centered in the viewport. This method will avoid 113 // top-level document is centered in the viewport. This method will avoid
114 // scrolling the pinch viewport unless necessary. 114 // scrolling the pinch viewport unless necessary.
115 void scrollIntoView(const FloatRect&); 115 void scrollIntoView(const FloatRect&);
116 116
117 // Clamp the given point, in document coordinates, to the maximum/minimum 117 // Clamp the given point, in document coordinates, to the maximum/minimum
118 // scroll extents of the viewport within the document. 118 // scroll extents of the viewport within the document.
119 IntPoint clampDocumentOffsetAtScale(const IntPoint& offset, float scale); 119 IntPoint clampDocumentOffsetAtScale(const IntPoint& offset, float scale);
120 120
121 void adjustScrollbarExistence();
122
123 // Used in tests
124 virtual GraphicsLayer* layerForHorizontalScrollbar() const override;
125 virtual GraphicsLayer* layerForVerticalScrollbar() const override;
126
121 private: 127 private:
122 // ScrollableArea implementation 128 // ScrollableArea implementation
123 virtual bool isActive() const override { return false; } 129 virtual bool isActive() const override { return false; }
124 virtual int scrollSize(ScrollbarOrientation) const override; 130 virtual int scrollSize(ScrollbarOrientation) const override;
125 virtual bool isScrollCornerVisible() const override { return false; } 131 virtual bool isScrollCornerVisible() const override { return false; }
126 virtual IntRect scrollCornerRect() const override { return IntRect(); } 132 virtual IntRect scrollCornerRect() const override { return IntRect(); }
127 virtual IntPoint scrollPosition() const override { return flooredIntPoint(m_ offset); } 133 virtual IntPoint scrollPosition() const override { return flooredIntPoint(m_ offset); }
128 virtual IntPoint minimumScrollPosition() const override; 134 virtual IntPoint minimumScrollPosition() const override;
129 virtual IntPoint maximumScrollPosition() const override; 135 virtual IntPoint maximumScrollPosition() const override;
130 virtual int visibleHeight() const override { return visibleRect().height(); }; 136 virtual int visibleHeight() const override { return visibleRect().height(); };
131 virtual int visibleWidth() const override { return visibleRect().width(); }; 137 virtual int visibleWidth() const override { return visibleRect().width(); };
132 virtual IntSize contentsSize() const override; 138 virtual IntSize contentsSize() const override;
133 virtual bool scrollbarsCanBeActive() const override { return false; } 139 virtual bool scrollbarsCanBeActive() const override { return false; }
134 virtual IntRect scrollableAreaBoundingBox() const override; 140 virtual IntRect scrollableAreaBoundingBox() const override;
135 virtual bool userInputScrollable(ScrollbarOrientation) const override { retu rn true; } 141 virtual bool userInputScrollable(ScrollbarOrientation) const override { retu rn true; }
136 virtual bool shouldPlaceVerticalScrollbarOnLeft() const override { return fa lse; } 142 virtual bool shouldPlaceVerticalScrollbarOnLeft() const override { return fa lse; }
137 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) override; 143 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) override;
138 virtual void invalidateScrollCornerRect(const IntRect&) override { } 144 virtual void invalidateScrollCornerRect(const IntRect&) override { }
139 virtual void setScrollOffset(const IntPoint&) override; 145 virtual void setScrollOffset(const IntPoint&) override;
140 virtual GraphicsLayer* layerForContainer() const override; 146 virtual GraphicsLayer* layerForContainer() const override;
141 virtual GraphicsLayer* layerForScrolling() const override; 147 virtual GraphicsLayer* layerForScrolling() const override;
142 virtual GraphicsLayer* layerForHorizontalScrollbar() const override;
143 virtual GraphicsLayer* layerForVerticalScrollbar() const override;
144 148
145 // GraphicsLayerClient implementation. 149 // GraphicsLayerClient implementation.
146 virtual void notifyAnimationStarted(const GraphicsLayer*, double monotonicTi me) override; 150 virtual void notifyAnimationStarted(const GraphicsLayer*, double monotonicTi me) override;
147 virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsL ayerPaintingPhase, const IntRect& inClip) override; 151 virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsL ayerPaintingPhase, const IntRect& inClip) override;
148 virtual String debugName(const GraphicsLayer*) override; 152 virtual String debugName(const GraphicsLayer*) override;
149 153
150 void setupScrollbar(blink::WebScrollbar::Orientation); 154 void setupScrollbar(blink::WebScrollbar::Orientation);
151 FloatPoint clampOffsetToBoundaries(const FloatPoint&); 155 FloatPoint clampOffsetToBoundaries(const FloatPoint&);
152 void clampToBoundaries(); 156 void clampToBoundaries();
153 157
154 LocalFrame* mainFrame() const; 158 LocalFrame* mainFrame() const;
155 159
156 FrameHost& m_frameHost; 160 FrameHost& m_frameHost;
157 OwnPtr<GraphicsLayer> m_rootTransformLayer; 161 OwnPtr<GraphicsLayer> m_rootTransformLayer;
158 OwnPtr<GraphicsLayer> m_innerViewportContainerLayer; 162 OwnPtr<GraphicsLayer> m_innerViewportContainerLayer;
159 OwnPtr<GraphicsLayer> m_pageScaleLayer; 163 OwnPtr<GraphicsLayer> m_pageScaleLayer;
160 OwnPtr<GraphicsLayer> m_innerViewportScrollLayer; 164 OwnPtr<GraphicsLayer> m_innerViewportScrollLayer;
161 OwnPtr<GraphicsLayer> m_overlayScrollbarHorizontal; 165 OwnPtr<GraphicsLayer> m_overlayScrollbarHorizontal;
162 OwnPtr<GraphicsLayer> m_overlayScrollbarVertical; 166 OwnPtr<GraphicsLayer> m_overlayScrollbarVertical;
163 OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarHorizontal; 167 OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarHorizontal;
164 OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarVertical; 168 OwnPtr<blink::WebScrollbarLayer> m_webOverlayScrollbarVertical;
165 169
166 // Offset of the pinch viewport from the main frame's origin, in CSS pixels. 170 // Offset of the pinch viewport from the main frame's origin, in CSS pixels.
167 FloatPoint m_offset; 171 FloatPoint m_offset;
168 float m_scale; 172 float m_scale;
169 IntSize m_size; 173 IntSize m_size;
174
175 bool m_hasHorizontalScrollbar;
176 bool m_hasVerticalScrollbar;
170 }; 177 };
171 178
172 } // namespace blink 179 } // namespace blink
173 180
174 #endif // PinchViewport_h 181 #endif // PinchViewport_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/frame/PinchViewport.cpp » ('j') | Source/core/frame/PinchViewport.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698