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

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: 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
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 2360 matching lines...) Expand 10 before | Expand all | Expand 10 after
2410 m_inputEventsScaleFactorForEmulation = contentScaleFactor; 2411 m_inputEventsScaleFactorForEmulation = contentScaleFactor;
2411 } 2412 }
2412 2413
2413 IntSize FrameView::inputEventsOffsetForEmulation() const 2414 IntSize FrameView::inputEventsOffsetForEmulation() const
2414 { 2415 {
2415 return m_inputEventsOffsetForEmulation; 2416 return m_inputEventsOffsetForEmulation;
2416 } 2417 }
2417 2418
2418 float FrameView::inputEventsScaleFactor() const 2419 float FrameView::inputEventsScaleFactor() const
2419 { 2420 {
2420 return visibleContentScaleFactor() * m_inputEventsScaleFactorForEmulation; 2421 float pageScale = m_frame->settings()->pinchVirtualViewportEnabled()
2422 ? m_frame->page()->frameHost().pinchViewport().scale()
2423 : visibleContentScaleFactor();
2424 return pageScale * m_inputEventsScaleFactorForEmulation;
2421 } 2425 }
2422 2426
2423 bool FrameView::scrollbarsCanBeActive() const 2427 bool FrameView::scrollbarsCanBeActive() const
2424 { 2428 {
2425 if (m_frame->view() != this) 2429 if (m_frame->view() != this)
2426 return false; 2430 return false;
2427 2431
2428 return !!m_frame->document(); 2432 return !!m_frame->document();
2429 } 2433 }
2430 2434
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
3188 void FrameView::removeChild(Widget* widget) 3192 void FrameView::removeChild(Widget* widget)
3189 { 3193 {
3190 if (widget->isFrameView()) 3194 if (widget->isFrameView())
3191 removeScrollableArea(toFrameView(widget)); 3195 removeScrollableArea(toFrameView(widget));
3192 3196
3193 ScrollView::removeChild(widget); 3197 ScrollView::removeChild(widget);
3194 } 3198 }
3195 3199
3196 bool FrameView::wheelEvent(const PlatformWheelEvent& wheelEvent) 3200 bool FrameView::wheelEvent(const PlatformWheelEvent& wheelEvent)
3197 { 3201 {
3202 bool allowScrolling = userInputScrollable(HorizontalScrollbar) || userInputS crollable(VerticalScrollbar);
3203
3198 // Note that to allow for rubber-band over-scroll behavior, even non-scrolla ble views 3204 // Note that to allow for rubber-band over-scroll behavior, even non-scrolla ble views
3199 // should handle wheel events. 3205 // should handle wheel events.
3200 #if !USE(RUBBER_BANDING) 3206 #if !USE(RUBBER_BANDING)
3201 if (!isScrollable()) 3207 if (!isScrollable())
3202 return false; 3208 allowScrolling = false;
3203 #endif 3209 #endif
3204 3210
3205 // We don't allow mouse wheeling to happen in a ScrollView that has had its scrollbars explicitly disabled. 3211 if (allowScrolling && ScrollableArea::handleWheelEvent(wheelEvent))
3206 if (!canHaveScrollbars()) 3212 return true;
3207 return false;
3208 3213
3209 return ScrollableArea::handleWheelEvent(wheelEvent); 3214 // If the frame didn't handle the event, give the pinch-zoom viewport a chan ce to
3215 // process the scroll event.
3216 if (isMainFrame())
3217 return page()->frameHost().pinchViewport().handleWheelEvent(wheelEvent);
3218
3219 return false;
3210 } 3220 }
3211 3221
3212 bool FrameView::isVerticalDocument() const 3222 bool FrameView::isVerticalDocument() const
3213 { 3223 {
3214 RenderView* renderView = this->renderView(); 3224 RenderView* renderView = this->renderView();
3215 if (!renderView) 3225 if (!renderView)
3216 return true; 3226 return true;
3217 3227
3218 return renderView->style()->isHorizontalWritingMode(); 3228 return renderView->style()->isHorizontalWritingMode();
3219 } 3229 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
3274 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3284 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3275 { 3285 {
3276 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3286 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3277 if (AXObjectCache* cache = axObjectCache()) { 3287 if (AXObjectCache* cache = axObjectCache()) {
3278 cache->remove(scrollbar); 3288 cache->remove(scrollbar);
3279 cache->handleScrollbarUpdate(this); 3289 cache->handleScrollbarUpdate(this);
3280 } 3290 }
3281 } 3291 }
3282 3292
3283 } // namespace WebCore 3293 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698