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

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

Issue 225303014: [Pinch-to-zoom] Moved scale factor into PinchViewport (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed layout test breakage Created 6 years, 8 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/FrameHost.cpp ('k') | Source/core/frame/PinchViewport.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 19 matching lines...) Expand all
30 #include "HTMLNames.h" 30 #include "HTMLNames.h"
31 #include "RuntimeEnabledFeatures.h" 31 #include "RuntimeEnabledFeatures.h"
32 #include "core/accessibility/AXObjectCache.h" 32 #include "core/accessibility/AXObjectCache.h"
33 #include "core/css/FontFaceSet.h" 33 #include "core/css/FontFaceSet.h"
34 #include "core/css/resolver/StyleResolver.h" 34 #include "core/css/resolver/StyleResolver.h"
35 #include "core/dom/DocumentMarkerController.h" 35 #include "core/dom/DocumentMarkerController.h"
36 #include "core/editing/FrameSelection.h" 36 #include "core/editing/FrameSelection.h"
37 #include "core/events/OverflowEvent.h" 37 #include "core/events/OverflowEvent.h"
38 #include "core/fetch/ResourceFetcher.h" 38 #include "core/fetch/ResourceFetcher.h"
39 #include "core/fetch/ResourceLoadPriorityOptimizer.h" 39 #include "core/fetch/ResourceLoadPriorityOptimizer.h"
40 #include "core/frame/FrameHost.h"
40 #include "core/frame/LocalFrame.h" 41 #include "core/frame/LocalFrame.h"
41 #include "core/frame/Settings.h" 42 #include "core/frame/Settings.h"
42 #include "core/html/HTMLFrameElement.h" 43 #include "core/html/HTMLFrameElement.h"
43 #include "core/html/HTMLPlugInElement.h" 44 #include "core/html/HTMLPlugInElement.h"
44 #include "core/html/parser/TextResourceDecoder.h" 45 #include "core/html/parser/TextResourceDecoder.h"
45 #include "core/inspector/InspectorInstrumentation.h" 46 #include "core/inspector/InspectorInstrumentation.h"
46 #include "core/loader/FrameLoader.h" 47 #include "core/loader/FrameLoader.h"
47 #include "core/loader/FrameLoaderClient.h" 48 #include "core/loader/FrameLoaderClient.h"
48 #include "core/page/Chrome.h" 49 #include "core/page/Chrome.h"
49 #include "core/page/ChromeClient.h" 50 #include "core/page/ChromeClient.h"
(...skipping 2302 matching lines...) Expand 10 before | Expand all | Expand 10 after
2352 m_inputEventsScaleFactorForEmulation = contentScaleFactor; 2353 m_inputEventsScaleFactorForEmulation = contentScaleFactor;
2353 } 2354 }
2354 2355
2355 IntSize FrameView::inputEventsOffsetForEmulation() const 2356 IntSize FrameView::inputEventsOffsetForEmulation() const
2356 { 2357 {
2357 return m_inputEventsOffsetForEmulation; 2358 return m_inputEventsOffsetForEmulation;
2358 } 2359 }
2359 2360
2360 float FrameView::inputEventsScaleFactor() const 2361 float FrameView::inputEventsScaleFactor() const
2361 { 2362 {
2362 return visibleContentScaleFactor() * m_inputEventsScaleFactorForEmulation; 2363 float pageScale = m_frame->settings()->pinchVirtualViewportEnabled()
2364 ? m_frame->page()->frameHost().pinchViewport().scale()
2365 : visibleContentScaleFactor();
2366 return pageScale * m_inputEventsScaleFactorForEmulation;
2363 } 2367 }
2364 2368
2365 bool FrameView::scrollbarsCanBeActive() const 2369 bool FrameView::scrollbarsCanBeActive() const
2366 { 2370 {
2367 if (m_frame->view() != this) 2371 if (m_frame->view() != this)
2368 return false; 2372 return false;
2369 2373
2370 return !!m_frame->document(); 2374 return !!m_frame->document();
2371 } 2375 }
2372 2376
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
3122 void FrameView::removeChild(Widget* widget) 3126 void FrameView::removeChild(Widget* widget)
3123 { 3127 {
3124 if (widget->isFrameView()) 3128 if (widget->isFrameView())
3125 removeScrollableArea(toFrameView(widget)); 3129 removeScrollableArea(toFrameView(widget));
3126 3130
3127 ScrollView::removeChild(widget); 3131 ScrollView::removeChild(widget);
3128 } 3132 }
3129 3133
3130 bool FrameView::wheelEvent(const PlatformWheelEvent& wheelEvent) 3134 bool FrameView::wheelEvent(const PlatformWheelEvent& wheelEvent)
3131 { 3135 {
3136 bool allowScrolling = userInputScrollable(HorizontalScrollbar) || userInputS crollable(VerticalScrollbar);
3137
3132 // Note that to allow for rubber-band over-scroll behavior, even non-scrolla ble views 3138 // Note that to allow for rubber-band over-scroll behavior, even non-scrolla ble views
3133 // should handle wheel events. 3139 // should handle wheel events.
3134 #if !USE(RUBBER_BANDING) 3140 #if !USE(RUBBER_BANDING)
3135 if (!isScrollable()) 3141 if (!isScrollable())
3136 return false; 3142 allowScrolling = false;
3137 #endif 3143 #endif
3138 3144
3139 // We don't allow mouse wheeling to happen in a ScrollView that has had its scrollbars explicitly disabled. 3145 if (allowScrolling && ScrollableArea::handleWheelEvent(wheelEvent))
3140 if (!canHaveScrollbars()) 3146 return true;
3141 return false;
3142 3147
3143 return ScrollableArea::handleWheelEvent(wheelEvent); 3148 // If the frame didn't handle the event, give the pinch-zoom viewport a chan ce to
3149 // process the scroll event.
3150 if (m_frame->settings()->pinchVirtualViewportEnabled() && m_frame->isMainFra me())
3151 return page()->frameHost().pinchViewport().handleWheelEvent(wheelEvent);
3152
3153 return false;
3144 } 3154 }
3145 3155
3146 bool FrameView::isVerticalDocument() const 3156 bool FrameView::isVerticalDocument() const
3147 { 3157 {
3148 RenderView* renderView = this->renderView(); 3158 RenderView* renderView = this->renderView();
3149 if (!renderView) 3159 if (!renderView)
3150 return true; 3160 return true;
3151 3161
3152 return renderView->style()->isHorizontalWritingMode(); 3162 return renderView->style()->isHorizontalWritingMode();
3153 } 3163 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
3203 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3213 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3204 { 3214 {
3205 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3215 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3206 if (AXObjectCache* cache = axObjectCache()) { 3216 if (AXObjectCache* cache = axObjectCache()) {
3207 cache->remove(scrollbar); 3217 cache->remove(scrollbar);
3208 cache->handleScrollbarUpdate(this); 3218 cache->handleScrollbarUpdate(this);
3209 } 3219 }
3210 } 3220 }
3211 3221
3212 } // namespace WebCore 3222 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/frame/FrameHost.cpp ('k') | Source/core/frame/PinchViewport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698