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

Side by Side Diff: Source/core/platform/ScrollView.cpp

Issue 23441020: Make it possibe to lock the fixedLayoutSize (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add one more test Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 , m_verticalScrollbarMode(ScrollbarAuto) 43 , m_verticalScrollbarMode(ScrollbarAuto)
44 , m_horizontalScrollbarLock(false) 44 , m_horizontalScrollbarLock(false)
45 , m_verticalScrollbarLock(false) 45 , m_verticalScrollbarLock(false)
46 , m_canBlitOnScroll(true) 46 , m_canBlitOnScroll(true)
47 , m_scrollbarsAvoidingResizer(0) 47 , m_scrollbarsAvoidingResizer(0)
48 , m_scrollbarsSuppressed(false) 48 , m_scrollbarsSuppressed(false)
49 , m_inUpdateScrollbars(false) 49 , m_inUpdateScrollbars(false)
50 , m_updateScrollbarsPass(0) 50 , m_updateScrollbarsPass(0)
51 , m_drawPanScrollIcon(false) 51 , m_drawPanScrollIcon(false)
52 , m_useFixedLayout(false) 52 , m_useFixedLayout(false)
53 , m_fixedLayoutSizeLock(false)
53 , m_paintsEntireContents(false) 54 , m_paintsEntireContents(false)
54 , m_clipsRepaints(true) 55 , m_clipsRepaints(true)
55 { 56 {
56 } 57 }
57 58
58 ScrollView::~ScrollView() 59 ScrollView::~ScrollView()
59 { 60 {
60 } 61 }
61 62
62 void ScrollView::addChild(PassRefPtr<Widget> prpChild) 63 void ScrollView::addChild(PassRefPtr<Widget> prpChild)
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? h orizontalBar->height() : 0; 199 horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? h orizontalBar->height() : 0;
199 } 200 }
200 201
201 return IntSize(max(0, width() - verticalScrollbarWidth), 202 return IntSize(max(0, width() - verticalScrollbarWidth),
202 max(0, height() - horizontalScrollbarHeight)); 203 max(0, height() - horizontalScrollbarHeight));
203 } 204 }
204 205
205 IntRect ScrollView::visibleContentRect(VisibleContentRectIncludesScrollbars scol lbarInclusion) const 206 IntRect ScrollView::visibleContentRect(VisibleContentRectIncludesScrollbars scol lbarInclusion) const
206 { 207 {
207 FloatSize visibleContentSize = unscaledVisibleContentSize(scollbarInclusion) ; 208 FloatSize visibleContentSize = unscaledVisibleContentSize(scollbarInclusion) ;
208 visibleContentSize.scale(1 / visibleContentScaleFactor()); 209 if (!m_fixedLayoutSizeLock)
210 visibleContentSize.scale(1 / visibleContentScaleFactor());
209 return IntRect(IntPoint(m_scrollOffset), expandedIntSize(visibleContentSize) ); 211 return IntRect(IntPoint(m_scrollOffset), expandedIntSize(visibleContentSize) );
210 } 212 }
211 213
212 IntSize ScrollView::layoutSize(VisibleContentRectIncludesScrollbars scrollbarInc lusion) const 214 IntSize ScrollView::layoutSize(VisibleContentRectIncludesScrollbars scrollbarInc lusion) const
213 { 215 {
214 return m_fixedLayoutSize.isEmpty() || !m_useFixedLayout ? unscaledVisibleCon tentSize(scrollbarInclusion) : m_fixedLayoutSize; 216 return m_fixedLayoutSize.isZero() || !m_useFixedLayout ? unscaledVisibleCont entSize(scrollbarInclusion) : m_fixedLayoutSize;
215 } 217 }
216 218
217 IntSize ScrollView::fixedLayoutSize() const 219 IntSize ScrollView::fixedLayoutSize() const
218 { 220 {
219 return m_fixedLayoutSize; 221 return m_fixedLayoutSize;
220 } 222 }
221 223
222 void ScrollView::setFixedLayoutSize(const IntSize& newSize) 224 void ScrollView::setFixedLayoutSize(const IntSize& newSize)
223 { 225 {
226 if (m_fixedLayoutSizeLock)
227 return;
224 if (fixedLayoutSize() == newSize) 228 if (fixedLayoutSize() == newSize)
225 return; 229 return;
226 m_fixedLayoutSize = newSize; 230 m_fixedLayoutSize = newSize;
227 updateScrollbars(scrollOffset()); 231 updateScrollbars(scrollOffset());
228 if (m_useFixedLayout) 232 if (m_useFixedLayout)
229 contentsResized(); 233 contentsResized();
230 } 234 }
231 235
232 bool ScrollView::useFixedLayout() const 236 bool ScrollView::useFixedLayout() const
233 { 237 {
234 return m_useFixedLayout; 238 return m_useFixedLayout;
235 } 239 }
236 240
237 void ScrollView::setUseFixedLayout(bool enable) 241 void ScrollView::setUseFixedLayout(bool enable)
238 { 242 {
239 if (useFixedLayout() == enable) 243 if (useFixedLayout() == enable)
240 return; 244 return;
241 m_useFixedLayout = enable; 245 m_useFixedLayout = enable;
242 updateScrollbars(scrollOffset()); 246 updateScrollbars(scrollOffset());
243 contentsResized(); 247 contentsResized();
244 } 248 }
245 249
250 void ScrollView::setFixedLayoutSizeLock(bool enable)
251 {
252 m_fixedLayoutSizeLock = enable;
253 }
254
255 bool ScrollView::fixedLayoutSizeLock() const
256 {
257 return m_fixedLayoutSizeLock;
258 }
259
246 IntSize ScrollView::contentsSize() const 260 IntSize ScrollView::contentsSize() const
247 { 261 {
248 return m_contentsSize; 262 return m_contentsSize;
249 } 263 }
250 264
251 void ScrollView::setContentsSize(const IntSize& newSize) 265 void ScrollView::setContentsSize(const IntSize& newSize)
252 { 266 {
253 if (contentsSize() == newSize) 267 if (contentsSize() == newSize)
254 return; 268 return;
255 m_contentsSize = newSize; 269 m_contentsSize = newSize;
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 int ScrollView::pageStep(ScrollbarOrientation orientation) const 1201 int ScrollView::pageStep(ScrollbarOrientation orientation) const
1188 { 1202 {
1189 int length = (orientation == HorizontalScrollbar) ? visibleWidth() : visible Height(); 1203 int length = (orientation == HorizontalScrollbar) ? visibleWidth() : visible Height();
1190 int minPageStep = static_cast<float>(length) * minFractionToStepWhenPaging() ; 1204 int minPageStep = static_cast<float>(length) * minFractionToStepWhenPaging() ;
1191 int pageStep = std::max(minPageStep, length - maxOverlapBetweenPages()); 1205 int pageStep = std::max(minPageStep, length - maxOverlapBetweenPages());
1192 1206
1193 return std::max(pageStep, 1); 1207 return std::max(pageStep, 1);
1194 } 1208 }
1195 1209
1196 } // namespace WebCore 1210 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698