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

Side by Side Diff: Source/core/frame/FrameView.cpp

Issue 691863003: Add a setting to do frame scrolls through the root layer. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | Source/core/frame/Settings.in » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 2160 matching lines...) Expand 10 before | Expand all | Expand 10 after
2171 return page && page->focusController().isActive(); 2171 return page && page->focusController().isActive();
2172 } 2172 }
2173 2173
2174 void FrameView::scrollTo(const DoublePoint& newPosition) 2174 void FrameView::scrollTo(const DoublePoint& newPosition)
2175 { 2175 {
2176 DoublePoint oldPosition = m_scrollPosition; 2176 DoublePoint oldPosition = m_scrollPosition;
2177 DoubleSize scrollDelta = newPosition - oldPosition; 2177 DoubleSize scrollDelta = newPosition - oldPosition;
2178 if (scrollDelta.isZero()) 2178 if (scrollDelta.isZero())
2179 return; 2179 return;
2180 2180
2181 if (m_frame->settings() && m_frame->settings()->rootLayerScrolls()) {
2182 // Don't scroll the FrameView!
2183 ASSERT_NOT_REACHED();
2184 }
2185
2181 m_scrollPosition = newPosition; 2186 m_scrollPosition = newPosition;
2182 2187
2183 if (!scrollbarsSuppressed()) 2188 if (!scrollbarsSuppressed())
2184 m_pendingScrollDelta += scrollDelta; 2189 m_pendingScrollDelta += scrollDelta;
2185 2190
2186 updateLayersAndCompositingAfterScrollIfNeeded(); 2191 updateLayersAndCompositingAfterScrollIfNeeded();
2187 scrollPositionChanged(); 2192 scrollPositionChanged();
2188 frame().loader().client()->didChangeScrollOffset(); 2193 frame().loader().client()->didChangeScrollOffset();
2189 } 2194 }
2190 2195
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
2898 { 2903 {
2899 bool allowScrolling = userInputScrollable(HorizontalScrollbar) || userInputS crollable(VerticalScrollbar); 2904 bool allowScrolling = userInputScrollable(HorizontalScrollbar) || userInputS crollable(VerticalScrollbar);
2900 2905
2901 // Note that to allow for rubber-band over-scroll behavior, even non-scrolla ble views 2906 // Note that to allow for rubber-band over-scroll behavior, even non-scrolla ble views
2902 // should handle wheel events. 2907 // should handle wheel events.
2903 #if !USE(RUBBER_BANDING) 2908 #if !USE(RUBBER_BANDING)
2904 if (!isScrollable()) 2909 if (!isScrollable())
2905 allowScrolling = false; 2910 allowScrolling = false;
2906 #endif 2911 #endif
2907 2912
2913 if (m_frame->settings()->rootLayerScrolls())
2914 allowScrolling = false;
2915
2908 if (allowScrolling && ScrollableArea::handleWheelEvent(wheelEvent)) 2916 if (allowScrolling && ScrollableArea::handleWheelEvent(wheelEvent))
2909 return true; 2917 return true;
2910 2918
2911 // If the frame didn't handle the event, give the pinch-zoom viewport a chan ce to 2919 // If the frame didn't handle the event, give the pinch-zoom viewport a chan ce to
2912 // process the scroll event. 2920 // process the scroll event.
2913 if (m_frame->settings()->pinchVirtualViewportEnabled() && m_frame->isMainFra me()) 2921 if (m_frame->settings()->pinchVirtualViewportEnabled() && m_frame->isMainFra me())
2914 return page()->frameHost().pinchViewport().handleWheelEvent(wheelEvent); 2922 return page()->frameHost().pinchViewport().handleWheelEvent(wheelEvent);
2915 2923
2916 return false; 2924 return false;
2917 } 2925 }
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
3241 } 3249 }
3242 3250
3243 void FrameView::computeScrollbarExistence(bool& newHasHorizontalScrollbar, bool& newHasVerticalScrollbar, const IntSize& docSize, ComputeScrollbarExistenceOptio n option) const 3251 void FrameView::computeScrollbarExistence(bool& newHasHorizontalScrollbar, bool& newHasVerticalScrollbar, const IntSize& docSize, ComputeScrollbarExistenceOptio n option) const
3244 { 3252 {
3245 bool hasHorizontalScrollbar = m_horizontalScrollbar; 3253 bool hasHorizontalScrollbar = m_horizontalScrollbar;
3246 bool hasVerticalScrollbar = m_verticalScrollbar; 3254 bool hasVerticalScrollbar = m_verticalScrollbar;
3247 3255
3248 newHasHorizontalScrollbar = hasHorizontalScrollbar; 3256 newHasHorizontalScrollbar = hasHorizontalScrollbar;
3249 newHasVerticalScrollbar = hasVerticalScrollbar; 3257 newHasVerticalScrollbar = hasVerticalScrollbar;
3250 3258
3259 if (m_frame->settings() && m_frame->settings()->rootLayerScrolls())
3260 return;
3261
3251 ScrollbarMode hScroll = m_horizontalScrollbarMode; 3262 ScrollbarMode hScroll = m_horizontalScrollbarMode;
3252 ScrollbarMode vScroll = m_verticalScrollbarMode; 3263 ScrollbarMode vScroll = m_verticalScrollbarMode;
3253 3264
3254 if (hScroll != ScrollbarAuto) 3265 if (hScroll != ScrollbarAuto)
3255 newHasHorizontalScrollbar = (hScroll == ScrollbarAlwaysOn); 3266 newHasHorizontalScrollbar = (hScroll == ScrollbarAlwaysOn);
3256 if (vScroll != ScrollbarAuto) 3267 if (vScroll != ScrollbarAuto)
3257 newHasVerticalScrollbar = (vScroll == ScrollbarAlwaysOn); 3268 newHasVerticalScrollbar = (vScroll == ScrollbarAlwaysOn);
3258 3269
3259 if (m_scrollbarsSuppressed || (hScroll != ScrollbarAuto && vScroll != Scroll barAuto)) 3270 if (m_scrollbarsSuppressed || (hScroll != ScrollbarAuto && vScroll != Scroll barAuto))
3260 return; 3271 return;
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
3741 int verticalScrollbarWidth = (verticalScrollbar() && !verticalScrollbar()->i sOverlayScrollbar()) 3752 int verticalScrollbarWidth = (verticalScrollbar() && !verticalScrollbar()->i sOverlayScrollbar())
3742 ? verticalScrollbar()->width() : 0; 3753 ? verticalScrollbar()->width() : 0;
3743 int horizontalScrollbarHeight = (horizontalScrollbar() && !horizontalScrollb ar()->isOverlayScrollbar()) 3754 int horizontalScrollbarHeight = (horizontalScrollbar() && !horizontalScrollb ar()->isOverlayScrollbar())
3744 ? horizontalScrollbar()->height() : 0; 3755 ? horizontalScrollbar()->height() : 0;
3745 3756
3746 int physicalScrollY = scrollPosition().y() + scrollOrigin().y(); 3757 int physicalScrollY = scrollPosition().y() + scrollOrigin().y();
3747 if (physicalScrollY < 0) { 3758 if (physicalScrollY < 0) {
3748 horizontalOverhangRect = frameRect(); 3759 horizontalOverhangRect = frameRect();
3749 horizontalOverhangRect.setHeight(-physicalScrollY); 3760 horizontalOverhangRect.setHeight(-physicalScrollY);
3750 horizontalOverhangRect.setWidth(horizontalOverhangRect.width() - vertica lScrollbarWidth); 3761 horizontalOverhangRect.setWidth(horizontalOverhangRect.width() - vertica lScrollbarWidth);
3751 } else if (contentsHeight() && physicalScrollY > contentsHeight() - visibleH eight()) { 3762 } else if (physicalScrollY > 0 && contentsHeight() && physicalScrollY > cont entsHeight() - visibleHeight()) {
3752 int height = physicalScrollY - (contentsHeight() - visibleHeight()); 3763 int height = physicalScrollY - (contentsHeight() - visibleHeight());
3753 horizontalOverhangRect = frameRect(); 3764 horizontalOverhangRect = frameRect();
3754 horizontalOverhangRect.setY(frameRect().maxY() - height - horizontalScro llbarHeight); 3765 horizontalOverhangRect.setY(frameRect().maxY() - height - horizontalScro llbarHeight);
3755 horizontalOverhangRect.setHeight(height); 3766 horizontalOverhangRect.setHeight(height);
3756 horizontalOverhangRect.setWidth(horizontalOverhangRect.width() - vertica lScrollbarWidth); 3767 horizontalOverhangRect.setWidth(horizontalOverhangRect.width() - vertica lScrollbarWidth);
3757 } 3768 }
3758 3769
3759 int physicalScrollX = scrollPosition().x() + scrollOrigin().x(); 3770 int physicalScrollX = scrollPosition().x() + scrollOrigin().x();
3760 if (physicalScrollX < 0) { 3771 if (physicalScrollX < 0) {
3761 verticalOverhangRect.setWidth(-physicalScrollX); 3772 verticalOverhangRect.setWidth(-physicalScrollX);
3762 verticalOverhangRect.setHeight(frameRect().height() - horizontalOverhang Rect.height() - horizontalScrollbarHeight); 3773 verticalOverhangRect.setHeight(frameRect().height() - horizontalOverhang Rect.height() - horizontalScrollbarHeight);
3763 verticalOverhangRect.setX(frameRect().x()); 3774 verticalOverhangRect.setX(frameRect().x());
3764 if (horizontalOverhangRect.y() == frameRect().y()) 3775 if (horizontalOverhangRect.y() == frameRect().y())
3765 verticalOverhangRect.setY(frameRect().y() + horizontalOverhangRect.h eight()); 3776 verticalOverhangRect.setY(frameRect().y() + horizontalOverhangRect.h eight());
3766 else 3777 else
3767 verticalOverhangRect.setY(frameRect().y()); 3778 verticalOverhangRect.setY(frameRect().y());
3768 } else if (contentsWidth() && physicalScrollX > contentsWidth() - visibleWid th()) { 3779 } else if (physicalScrollX > 0 && contentsWidth() && physicalScrollX > conte ntsWidth() - visibleWidth()) {
3769 int width = physicalScrollX - (contentsWidth() - visibleWidth()); 3780 int width = physicalScrollX - (contentsWidth() - visibleWidth());
3770 verticalOverhangRect.setWidth(width); 3781 verticalOverhangRect.setWidth(width);
3771 verticalOverhangRect.setHeight(frameRect().height() - horizontalOverhang Rect.height() - horizontalScrollbarHeight); 3782 verticalOverhangRect.setHeight(frameRect().height() - horizontalOverhang Rect.height() - horizontalScrollbarHeight);
3772 verticalOverhangRect.setX(frameRect().maxX() - width - verticalScrollbar Width); 3783 verticalOverhangRect.setX(frameRect().maxX() - width - verticalScrollbar Width);
3773 if (horizontalOverhangRect.y() == frameRect().y()) 3784 if (horizontalOverhangRect.y() == frameRect().y())
3774 verticalOverhangRect.setY(frameRect().y() + horizontalOverhangRect.h eight()); 3785 verticalOverhangRect.setY(frameRect().y() + horizontalOverhangRect.h eight());
3775 else 3786 else
3776 verticalOverhangRect.setY(frameRect().y()); 3787 verticalOverhangRect.setY(frameRect().y());
3777 } 3788 }
3778 } 3789 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
3918 return; 3929 return;
3919 3930
3920 ScrollableArea::setScrollOrigin(origin); 3931 ScrollableArea::setScrollOrigin(origin);
3921 3932
3922 // Update if the scroll origin changes, since our position will be different if the content size did not change. 3933 // Update if the scroll origin changes, since our position will be different if the content size did not change.
3923 if (updatePositionAtAll && updatePositionSynchronously) 3934 if (updatePositionAtAll && updatePositionSynchronously)
3924 updateScrollbars(scrollOffsetDouble()); 3935 updateScrollbars(scrollOffsetDouble());
3925 } 3936 }
3926 3937
3927 } // namespace blink 3938 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/frame/Settings.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698