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

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

Issue 1308053003: Replace pinch scrollbars with regular scrollbars. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix comment Created 5 years, 4 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 | « Source/core/frame/FrameView.h ('k') | Source/core/frame/VisualViewport.h » ('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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 bool FrameView::usesCompositedScrolling() const 669 bool FrameView::usesCompositedScrolling() const
670 { 670 {
671 LayoutView* layoutView = this->layoutView(); 671 LayoutView* layoutView = this->layoutView();
672 if (!layoutView) 672 if (!layoutView)
673 return false; 673 return false;
674 if (m_frame->settings() && m_frame->settings()->preferCompositingToLCDTextEn abled()) 674 if (m_frame->settings() && m_frame->settings()->preferCompositingToLCDTextEn abled())
675 return layoutView->compositor()->inCompositingMode(); 675 return layoutView->compositor()->inCompositingMode();
676 return false; 676 return false;
677 } 677 }
678 678
679 GraphicsLayer* FrameView::layerForScrollbarContainer() const
skobes 2015/08/25 00:19:01 Do we need a similar override in DeprecatedPaintLa
aelias_OOO_until_Jul13 2015/08/25 02:50:27 Done, and I also fixed the layer attachment with t
680 {
681 if (m_frame->isMainFrame())
682 return page()->frameHost().visualViewport().layerForScrollbarContainer() ;
683 return layerForContainer();
684 }
685
679 GraphicsLayer* FrameView::layerForScrolling() const 686 GraphicsLayer* FrameView::layerForScrolling() const
680 { 687 {
681 LayoutView* layoutView = this->layoutView(); 688 LayoutView* layoutView = this->layoutView();
682 if (!layoutView) 689 if (!layoutView)
683 return nullptr; 690 return nullptr;
684 return layoutView->compositor()->frameScrollLayer(); 691 return layoutView->compositor()->frameScrollLayer();
685 } 692 }
686 693
687 GraphicsLayer* FrameView::layerForHorizontalScrollbar() const 694 GraphicsLayer* FrameView::layerForHorizontalScrollbar() const
688 { 695 {
(...skipping 2261 matching lines...) Expand 10 before | Expand all | Expand 10 after
2950 2957
2951 bool FrameView::isFlippedDocument() const 2958 bool FrameView::isFlippedDocument() const
2952 { 2959 {
2953 LayoutView* layoutView = this->layoutView(); 2960 LayoutView* layoutView = this->layoutView();
2954 if (!layoutView) 2961 if (!layoutView)
2955 return false; 2962 return false;
2956 2963
2957 return layoutView->hasFlippedBlocksWritingMode(); 2964 return layoutView->hasFlippedBlocksWritingMode();
2958 } 2965 }
2959 2966
2960 bool FrameView::visualViewportSuppliesScrollbars() const
2961 {
2962 return m_frame->isMainFrame() && m_frame->settings() && m_frame->settings()- >viewportMetaEnabled();
2963 }
2964
2965 AXObjectCache* FrameView::axObjectCache() const 2967 AXObjectCache* FrameView::axObjectCache() const
2966 { 2968 {
2967 if (frame().document()) 2969 if (frame().document())
2968 return frame().document()->existingAXObjectCache(); 2970 return frame().document()->existingAXObjectCache();
2969 return nullptr; 2971 return nullptr;
2970 } 2972 }
2971 2973
2972 void FrameView::setCursor(const Cursor& cursor) 2974 void FrameView::setCursor(const Cursor& cursor)
2973 { 2975 {
2974 Page* page = frame().page(); 2976 Page* page = frame().page();
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
3202 scrollTo(clampScrollPosition(offset)); 3204 scrollTo(clampScrollPosition(offset));
3203 } 3205 }
3204 3206
3205 void FrameView::windowResizerRectChanged() 3207 void FrameView::windowResizerRectChanged()
3206 { 3208 {
3207 updateScrollbars(scrollOffsetDouble()); 3209 updateScrollbars(scrollOffsetDouble());
3208 } 3210 }
3209 3211
3210 bool FrameView::hasOverlayScrollbars() const 3212 bool FrameView::hasOverlayScrollbars() const
3211 { 3213 {
3212
3213 return (m_horizontalScrollbar && m_horizontalScrollbar->isOverlayScrollbar() ) 3214 return (m_horizontalScrollbar && m_horizontalScrollbar->isOverlayScrollbar() )
3214 || (m_verticalScrollbar && m_verticalScrollbar->isOverlayScrollbar()); 3215 || (m_verticalScrollbar && m_verticalScrollbar->isOverlayScrollbar());
3215 } 3216 }
3216 3217
3217 void FrameView::computeScrollbarExistence(bool& newHasHorizontalScrollbar, bool& newHasVerticalScrollbar, const IntSize& docSize, ComputeScrollbarExistenceOptio n option) const 3218 void FrameView::computeScrollbarExistence(bool& newHasHorizontalScrollbar, bool& newHasVerticalScrollbar, const IntSize& docSize, ComputeScrollbarExistenceOptio n option) const
3218 { 3219 {
3219 bool hasHorizontalScrollbar = m_horizontalScrollbar; 3220 bool hasHorizontalScrollbar = m_horizontalScrollbar;
3220 bool hasVerticalScrollbar = m_verticalScrollbar; 3221 bool hasVerticalScrollbar = m_verticalScrollbar;
3221 3222
3222 newHasHorizontalScrollbar = hasHorizontalScrollbar; 3223 newHasHorizontalScrollbar = hasHorizontalScrollbar;
(...skipping 11 matching lines...) Expand all
3234 newHasVerticalScrollbar = (vScroll == ScrollbarAlwaysOn); 3235 newHasVerticalScrollbar = (vScroll == ScrollbarAlwaysOn);
3235 3236
3236 if (m_scrollbarsSuppressed || (hScroll != ScrollbarAuto && vScroll != Scroll barAuto)) 3237 if (m_scrollbarsSuppressed || (hScroll != ScrollbarAuto && vScroll != Scroll barAuto))
3237 return; 3238 return;
3238 3239
3239 if (hScroll == ScrollbarAuto) 3240 if (hScroll == ScrollbarAuto)
3240 newHasHorizontalScrollbar = docSize.width() > visibleWidth(); 3241 newHasHorizontalScrollbar = docSize.width() > visibleWidth();
3241 if (vScroll == ScrollbarAuto) 3242 if (vScroll == ScrollbarAuto)
3242 newHasVerticalScrollbar = docSize.height() > visibleHeight(); 3243 newHasVerticalScrollbar = docSize.height() > visibleHeight();
3243 3244
3244 if (hasOverlayScrollbars()) 3245 if (hasOverlayScrollbars()) {
3246 if (m_frame->isMainFrame())
3247 newHasHorizontalScrollbar = newHasVerticalScrollbar = true;
skobes 2015/08/25 00:19:01 Why is this needed?
aelias_OOO_until_Jul13 2015/08/25 02:50:27 So that scrollbars are shown when zooming in (part
aelias_OOO_until_Jul13 2015/08/26 04:47:48 Unfortunately, this approach turned out to be flak
3245 return; 3248 return;
3249 }
3246 3250
3247 IntSize fullVisibleSize = visibleContentRect(IncludeScrollbars).size(); 3251 IntSize fullVisibleSize = visibleContentRect(IncludeScrollbars).size();
3248 3252
3249 bool attemptToRemoveScrollbars = (option == FirstPass 3253 bool attemptToRemoveScrollbars = (option == FirstPass
3250 && docSize.width() <= fullVisibleSize.width() && docSize.height() <= ful lVisibleSize.height()); 3254 && docSize.width() <= fullVisibleSize.width() && docSize.height() <= ful lVisibleSize.height());
3251 if (attemptToRemoveScrollbars) { 3255 if (attemptToRemoveScrollbars) {
3252 if (hScroll == ScrollbarAuto) 3256 if (hScroll == ScrollbarAuto)
3253 newHasHorizontalScrollbar = false; 3257 newHasHorizontalScrollbar = false;
3254 if (vScroll == ScrollbarAuto) 3258 if (vScroll == ScrollbarAuto)
3255 newHasVerticalScrollbar = false; 3259 newHasVerticalScrollbar = false;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
3376 return hasAnyScrollbar && (shouldUseCustom != hasCustom); 3380 return hasAnyScrollbar && (shouldUseCustom != hasCustom);
3377 } 3381 }
3378 3382
3379 bool FrameView::shouldIgnoreOverflowHidden() const 3383 bool FrameView::shouldIgnoreOverflowHidden() const
3380 { 3384 {
3381 return m_frame->settings()->ignoreMainFrameOverflowHiddenQuirk() && m_frame- >isMainFrame(); 3385 return m_frame->settings()->ignoreMainFrameOverflowHiddenQuirk() && m_frame- >isMainFrame();
3382 } 3386 }
3383 3387
3384 void FrameView::updateScrollbars(const DoubleSize& desiredOffset) 3388 void FrameView::updateScrollbars(const DoubleSize& desiredOffset)
3385 { 3389 {
3386 // Avoid drawing two sets of scrollbars when visual viewport is enabled.
3387 if (visualViewportSuppliesScrollbars()) {
3388 setHasHorizontalScrollbar(false);
3389 setHasVerticalScrollbar(false);
3390 setScrollOffsetFromUpdateScrollbars(desiredOffset);
3391 return;
3392 }
3393
3394 if (m_inUpdateScrollbars) 3390 if (m_inUpdateScrollbars)
3395 return; 3391 return;
3396 InUpdateScrollbarsScope inUpdateScrollbarsScope(this); 3392 InUpdateScrollbarsScope inUpdateScrollbarsScope(this);
3397 3393
3398 IntSize oldVisibleSize = visibleContentSize(); 3394 IntSize oldVisibleSize = visibleContentSize();
3399 3395
3400 bool scrollbarExistenceChanged = false; 3396 bool scrollbarExistenceChanged = false;
3401 3397
3402 if (needsScrollbarReconstruction()) { 3398 if (needsScrollbarReconstruction()) {
3403 setHasHorizontalScrollbar(false); 3399 setHasHorizontalScrollbar(false);
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
3969 3965
3970 if (!graphicsLayer) 3966 if (!graphicsLayer)
3971 return; 3967 return;
3972 3968
3973 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL ayoutObject(), paintInvalidationContainer, viewRect); 3969 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL ayoutObject(), paintInvalidationContainer, viewRect);
3974 3970
3975 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing IntRect(viewRect))); 3971 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing IntRect(viewRect)));
3976 } 3972 }
3977 3973
3978 } // namespace blink 3974 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/core/frame/VisualViewport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698