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

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

Issue 23819019: Refactor fixed layout mode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Holger Hans Peter Freyther 3 * Copyright (C) 2009 Holger Hans Peter Freyther
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 virtual IntRect visibleContentRect(VisibleContentRectIncludesScrollbars = Ex cludeScrollbars) const OVERRIDE; 122 virtual IntRect visibleContentRect(VisibleContentRectIncludesScrollbars = Ex cludeScrollbars) const OVERRIDE;
123 IntSize visibleSize() const { return visibleContentRect().size(); } 123 IntSize visibleSize() const { return visibleContentRect().size(); }
124 virtual int visibleWidth() const OVERRIDE { return visibleContentRect().widt h(); } 124 virtual int visibleWidth() const OVERRIDE { return visibleContentRect().widt h(); }
125 virtual int visibleHeight() const OVERRIDE { return visibleContentRect().hei ght(); } 125 virtual int visibleHeight() const OVERRIDE { return visibleContentRect().hei ght(); }
126 126
127 // visibleContentRect().size() is computed from unscaledVisibleContentSize() divided by the value of visibleContentScaleFactor. 127 // visibleContentRect().size() is computed from unscaledVisibleContentSize() divided by the value of visibleContentScaleFactor.
128 // For the main frame, visibleContentScaleFactor is equal to the page's page ScaleFactor; it's 1 otherwise. 128 // For the main frame, visibleContentScaleFactor is equal to the page's page ScaleFactor; it's 1 otherwise.
129 IntSize unscaledVisibleContentSize(VisibleContentRectIncludesScrollbars = Ex cludeScrollbars) const; 129 IntSize unscaledVisibleContentSize(VisibleContentRectIncludesScrollbars = Ex cludeScrollbars) const;
130 virtual float visibleContentScaleFactor() const { return 1; } 130 virtual float visibleContentScaleFactor() const { return 1; }
131 131
132 // Functions for getting/setting the size webkit should use to layout the co ntents. By default this is the same as the visible
133 // content size. Explicitly setting a layout size value will cause webkit to layout the contents using this size instead.
134 IntSize layoutSize(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const;
135 int layoutWidth(VisibleContentRectIncludesScrollbars scrollbarInclusion = Ex cludeScrollbars) const { return layoutSize(scrollbarInclusion).width(); }
136 int layoutHeight(VisibleContentRectIncludesScrollbars scrollbarInclusion = E xcludeScrollbars) const { return layoutSize(scrollbarInclusion).height(); }
137 IntSize fixedLayoutSize() const;
138 void setFixedLayoutSize(const IntSize&);
139 bool useFixedLayout() const;
140 void setUseFixedLayout(bool enable);
141
142 // Functions for getting/setting the size of the document contained inside t he ScrollView (as an IntSize or as individual width and height 132 // Functions for getting/setting the size of the document contained inside t he ScrollView (as an IntSize or as individual width and height
143 // values). 133 // values).
144 virtual IntSize contentsSize() const OVERRIDE; // Always at least as big as the visibleWidth()/visibleHeight(). 134 virtual IntSize contentsSize() const OVERRIDE; // Always at least as big as the visibleWidth()/visibleHeight().
145 int contentsWidth() const { return contentsSize().width(); } 135 int contentsWidth() const { return contentsSize().width(); }
146 int contentsHeight() const { return contentsSize().height(); } 136 int contentsHeight() const { return contentsSize().height(); }
147 virtual void setContentsSize(const IntSize&); 137 virtual void setContentsSize(const IntSize&);
148 138
149 // Functions for querying the current scrolled position (both as a point, a size, or as individual X and Y values). 139 // Functions for querying the current scrolled position (both as a point, a size, or as individual X and Y values).
150 virtual IntPoint scrollPosition() const OVERRIDE { return visibleContentRect ().location(); } 140 virtual IntPoint scrollPosition() const OVERRIDE { return visibleContentRect ().location(); }
151 IntSize scrollOffset() const { return toIntSize(visibleContentRect().locatio n()); } // Gets the scrolled position as an IntSize. Convenient for adding to ot her sizes. 141 IntSize scrollOffset() const { return toIntSize(visibleContentRect().locatio n()); } // Gets the scrolled position as an IntSize. Convenient for adding to ot her sizes.
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 279
290 void setScrollOrigin(const IntPoint&, bool updatePositionAtAll, bool updateP ositionSynchronously); 280 void setScrollOrigin(const IntPoint&, bool updatePositionAtAll, bool updateP ositionSynchronously);
291 281
292 // Subclassed by FrameView to check the writing-mode of the document. 282 // Subclassed by FrameView to check the writing-mode of the document.
293 virtual bool isVerticalDocument() const { return true; } 283 virtual bool isVerticalDocument() const { return true; }
294 virtual bool isFlippedDocument() const { return false; } 284 virtual bool isFlippedDocument() const { return false; }
295 285
296 // Called to update the scrollbars to accurately reflect the state of the vi ew. 286 // Called to update the scrollbars to accurately reflect the state of the vi ew.
297 void updateScrollbars(const IntSize& desiredOffset); 287 void updateScrollbars(const IntSize& desiredOffset);
298 288
289 IntSize excludeScrollbars(const IntSize&) const;
290
299 private: 291 private:
300 RefPtr<Scrollbar> m_horizontalScrollbar; 292 RefPtr<Scrollbar> m_horizontalScrollbar;
301 RefPtr<Scrollbar> m_verticalScrollbar; 293 RefPtr<Scrollbar> m_verticalScrollbar;
302 ScrollbarMode m_horizontalScrollbarMode; 294 ScrollbarMode m_horizontalScrollbarMode;
303 ScrollbarMode m_verticalScrollbarMode; 295 ScrollbarMode m_verticalScrollbarMode;
304 296
305 bool m_horizontalScrollbarLock; 297 bool m_horizontalScrollbarLock;
306 bool m_verticalScrollbarLock; 298 bool m_verticalScrollbarLock;
307 299
308 HashSet<RefPtr<Widget> > m_children; 300 HashSet<RefPtr<Widget> > m_children;
309 301
310 // This bool is unused on Mac OS because we directly ask the platform widget 302 // This bool is unused on Mac OS because we directly ask the platform widget
311 // whether it is safe to blit on scroll. 303 // whether it is safe to blit on scroll.
312 bool m_canBlitOnScroll; 304 bool m_canBlitOnScroll;
313 305
314 IntSize m_scrollOffset; // FIXME: Would rather store this as a position, but we will wait to make this change until more code is shared. 306 IntSize m_scrollOffset; // FIXME: Would rather store this as a position, but we will wait to make this change until more code is shared.
315 IntPoint m_cachedScrollPosition; 307 IntPoint m_cachedScrollPosition;
316 IntSize m_fixedLayoutSize;
317 IntSize m_contentsSize; 308 IntSize m_contentsSize;
318 309
319 int m_scrollbarsAvoidingResizer; 310 int m_scrollbarsAvoidingResizer;
320 bool m_scrollbarsSuppressed; 311 bool m_scrollbarsSuppressed;
321 312
322 bool m_inUpdateScrollbars; 313 bool m_inUpdateScrollbars;
323 unsigned m_updateScrollbarsPass; 314 unsigned m_updateScrollbarsPass;
324 315
325 IntPoint m_panScrollIconPoint; 316 IntPoint m_panScrollIconPoint;
326 bool m_drawPanScrollIcon; 317 bool m_drawPanScrollIcon;
327 bool m_useFixedLayout;
328 318
329 bool m_paintsEntireContents; 319 bool m_paintsEntireContents;
330 bool m_clipsRepaints; 320 bool m_clipsRepaints;
331 321
332 void init(); 322 void init();
333 void destroy(); 323 void destroy();
334 324
335 IntRect rectToCopyOnScroll() const; 325 IntRect rectToCopyOnScroll() const;
336 326
337 // Called when the scroll position within this view changes. FrameView over rides this to generate repaint invalidations. 327 // Called when the scroll position within this view changes. FrameView over rides this to generate repaint invalidations.
(...skipping 17 matching lines...) Expand all
355 ASSERT(!widget || widget->isScrollView()); 345 ASSERT(!widget || widget->isScrollView());
356 return static_cast<const ScrollView*>(widget); 346 return static_cast<const ScrollView*>(widget);
357 } 347 }
358 348
359 // This will catch anyone doing an unnecessary cast. 349 // This will catch anyone doing an unnecessary cast.
360 void toScrollView(const ScrollView*); 350 void toScrollView(const ScrollView*);
361 351
362 } // namespace WebCore 352 } // namespace WebCore
363 353
364 #endif // ScrollView_h 354 #endif // ScrollView_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698