| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 #include "platform/Cursor.h" | 102 #include "platform/Cursor.h" |
| 103 #include "platform/Histogram.h" | 103 #include "platform/Histogram.h" |
| 104 #include "platform/KeyboardCodes.h" | 104 #include "platform/KeyboardCodes.h" |
| 105 #include "platform/PlatformGestureEvent.h" | 105 #include "platform/PlatformGestureEvent.h" |
| 106 #include "platform/PlatformMouseEvent.h" | 106 #include "platform/PlatformMouseEvent.h" |
| 107 #include "platform/RuntimeEnabledFeatures.h" | 107 #include "platform/RuntimeEnabledFeatures.h" |
| 108 #include "platform/TraceEvent.h" | 108 #include "platform/TraceEvent.h" |
| 109 #include "platform/UserGestureIndicator.h" | 109 #include "platform/UserGestureIndicator.h" |
| 110 #include "platform/exported/WebActiveGestureAnimation.h" | 110 #include "platform/exported/WebActiveGestureAnimation.h" |
| 111 #include "platform/fonts/FontCache.h" | 111 #include "platform/fonts/FontCache.h" |
| 112 #include "platform/geometry/FloatRect.h" |
| 112 #include "platform/graphics/Color.h" | 113 #include "platform/graphics/Color.h" |
| 113 #include "platform/graphics/CompositorMutatorClient.h" | 114 #include "platform/graphics/CompositorMutatorClient.h" |
| 114 #include "platform/graphics/FirstPaintInvalidationTracking.h" | 115 #include "platform/graphics/FirstPaintInvalidationTracking.h" |
| 115 #include "platform/graphics/GraphicsContext.h" | 116 #include "platform/graphics/GraphicsContext.h" |
| 116 #include "platform/graphics/Image.h" | 117 #include "platform/graphics/Image.h" |
| 117 #include "platform/graphics/ImageBuffer.h" | 118 #include "platform/graphics/ImageBuffer.h" |
| 118 #include "platform/graphics/gpu/DrawingBuffer.h" | 119 #include "platform/graphics/gpu/DrawingBuffer.h" |
| 119 #include "platform/graphics/paint/DrawingRecorder.h" | 120 #include "platform/graphics/paint/DrawingRecorder.h" |
| 120 #include "platform/image-decoders/ImageDecoder.h" | 121 #include "platform/image-decoders/ImageDecoder.h" |
| 121 #include "platform/scroll/ScrollbarTheme.h" | 122 #include "platform/scroll/ScrollbarTheme.h" |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 , m_zoomFactorForDeviceScaleFactor(0.f) | 413 , m_zoomFactorForDeviceScaleFactor(0.f) |
| 413 , m_maximumLegibleScale(1) | 414 , m_maximumLegibleScale(1) |
| 414 , m_doubleTapZoomPageScaleFactor(0) | 415 , m_doubleTapZoomPageScaleFactor(0) |
| 415 , m_doubleTapZoomPending(false) | 416 , m_doubleTapZoomPending(false) |
| 416 , m_enableFakePageScaleAnimationForTesting(false) | 417 , m_enableFakePageScaleAnimationForTesting(false) |
| 417 , m_fakePageScaleAnimationPageScaleFactor(0) | 418 , m_fakePageScaleAnimationPageScaleFactor(0) |
| 418 , m_fakePageScaleAnimationUseAnchor(false) | 419 , m_fakePageScaleAnimationUseAnchor(false) |
| 419 , m_doingDragAndDrop(false) | 420 , m_doingDragAndDrop(false) |
| 420 , m_ignoreInputEvents(false) | 421 , m_ignoreInputEvents(false) |
| 421 , m_compositorDeviceScaleFactorOverride(0) | 422 , m_compositorDeviceScaleFactorOverride(0) |
| 422 , m_rootLayerScale(1) | |
| 423 , m_suppressNextKeypressEvent(false) | 423 , m_suppressNextKeypressEvent(false) |
| 424 , m_imeAcceptEvents(true) | 424 , m_imeAcceptEvents(true) |
| 425 , m_operationsAllowed(WebDragOperationNone) | 425 , m_operationsAllowed(WebDragOperationNone) |
| 426 , m_dragOperation(WebDragOperationNone) | 426 , m_dragOperation(WebDragOperationNone) |
| 427 , m_devToolsEmulator(nullptr) | 427 , m_devToolsEmulator(nullptr) |
| 428 , m_isTransparent(false) | 428 , m_isTransparent(false) |
| 429 , m_tabsToLinks(false) | 429 , m_tabsToLinks(false) |
| 430 , m_layerTreeView(nullptr) | 430 , m_layerTreeView(nullptr) |
| 431 , m_rootLayer(nullptr) | 431 , m_rootLayer(nullptr) |
| 432 , m_rootGraphicsLayer(nullptr) | 432 , m_rootGraphicsLayer(nullptr) |
| (...skipping 3399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3832 return; | 3832 return; |
| 3833 m_compositorDeviceScaleFactorOverride = deviceScaleFactor; | 3833 m_compositorDeviceScaleFactorOverride = deviceScaleFactor; |
| 3834 if (m_zoomFactorForDeviceScaleFactor) { | 3834 if (m_zoomFactorForDeviceScaleFactor) { |
| 3835 setZoomLevel(zoomLevel()); | 3835 setZoomLevel(zoomLevel()); |
| 3836 return; | 3836 return; |
| 3837 } | 3837 } |
| 3838 if (page() && m_layerTreeView) | 3838 if (page() && m_layerTreeView) |
| 3839 updateLayerTreeDeviceScaleFactor(); | 3839 updateLayerTreeDeviceScaleFactor(); |
| 3840 } | 3840 } |
| 3841 | 3841 |
| 3842 void WebViewImpl::setRootLayerTransform(const WebSize& rootLayerOffset, float ro
otLayerScale) | 3842 void WebViewImpl::setRootLayerTransform(const TransformationMatrix& transform) |
| 3843 { | 3843 { |
| 3844 if (m_rootLayerScale == rootLayerScale && m_rootLayerOffset == rootLayerOffs
et) | 3844 if (transform == m_rootLayerTransform) |
| 3845 return; | 3845 return; |
| 3846 m_rootLayerScale = rootLayerScale; | 3846 m_rootLayerTransform = transform; |
| 3847 m_rootLayerOffset = rootLayerOffset; | |
| 3848 if (mainFrameImpl()) | |
| 3849 mainFrameImpl()->setInputEventsTransformForEmulation(m_rootLayerOffset,
m_rootLayerScale); | |
| 3850 updateRootLayerTransform(); | 3847 updateRootLayerTransform(); |
| 3851 } | 3848 } |
| 3852 | 3849 |
| 3850 TransformationMatrix WebViewImpl::getRootLayerTransformForTesting() const |
| 3851 { |
| 3852 return m_rootLayerTransform; |
| 3853 } |
| 3854 |
| 3853 void WebViewImpl::enableDeviceEmulation(const WebDeviceEmulationParams& params) | 3855 void WebViewImpl::enableDeviceEmulation(const WebDeviceEmulationParams& params) |
| 3854 { | 3856 { |
| 3855 m_devToolsEmulator->enableDeviceEmulation(params); | 3857 m_devToolsEmulator->enableDeviceEmulation(params); |
| 3856 } | 3858 } |
| 3857 | 3859 |
| 3858 void WebViewImpl::disableDeviceEmulation() | 3860 void WebViewImpl::disableDeviceEmulation() |
| 3859 { | 3861 { |
| 3860 m_devToolsEmulator->disableDeviceEmulation(); | 3862 m_devToolsEmulator->disableDeviceEmulation(); |
| 3861 } | 3863 } |
| 3862 | 3864 |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4078 void WebViewImpl::didChangeContentsSize() | 4080 void WebViewImpl::didChangeContentsSize() |
| 4079 { | 4081 { |
| 4080 pageScaleConstraintsSet().didChangeContentsSize(contentsSize(), pageScaleFac
tor()); | 4082 pageScaleConstraintsSet().didChangeContentsSize(contentsSize(), pageScaleFac
tor()); |
| 4081 } | 4083 } |
| 4082 | 4084 |
| 4083 void WebViewImpl::pageScaleFactorChanged() | 4085 void WebViewImpl::pageScaleFactorChanged() |
| 4084 { | 4086 { |
| 4085 pageScaleConstraintsSet().setNeedsReset(false); | 4087 pageScaleConstraintsSet().setNeedsReset(false); |
| 4086 updateLayerTreeViewport(); | 4088 updateLayerTreeViewport(); |
| 4087 m_client->pageScaleFactorChanged(); | 4089 m_client->pageScaleFactorChanged(); |
| 4090 m_devToolsEmulator->mainFrameScrollOrScaleChanged(); |
| 4091 } |
| 4092 |
| 4093 void WebViewImpl::mainFrameScrollOffsetChanged() |
| 4094 { |
| 4095 m_devToolsEmulator->mainFrameScrollOrScaleChanged(); |
| 4088 } | 4096 } |
| 4089 | 4097 |
| 4090 bool WebViewImpl::useExternalPopupMenus() | 4098 bool WebViewImpl::useExternalPopupMenus() |
| 4091 { | 4099 { |
| 4092 return shouldUseExternalPopupMenus; | 4100 return shouldUseExternalPopupMenus; |
| 4093 } | 4101 } |
| 4094 | 4102 |
| 4095 void WebViewImpl::startDragging(LocalFrame* frame, | 4103 void WebViewImpl::startDragging(LocalFrame* frame, |
| 4096 const WebDragData& dragData, | 4104 const WebDragData& dragData, |
| 4097 WebDragOperationsMask mask, | 4105 WebDragOperationsMask mask, |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4428 { | 4436 { |
| 4429 DCHECK(page()); | 4437 DCHECK(page()); |
| 4430 DCHECK(m_layerTreeView); | 4438 DCHECK(m_layerTreeView); |
| 4431 | 4439 |
| 4432 float deviceScaleFactor = m_compositorDeviceScaleFactorOverride ? m_composit
orDeviceScaleFactorOverride : page()->deviceScaleFactor(); | 4440 float deviceScaleFactor = m_compositorDeviceScaleFactorOverride ? m_composit
orDeviceScaleFactorOverride : page()->deviceScaleFactor(); |
| 4433 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor); | 4441 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor); |
| 4434 } | 4442 } |
| 4435 | 4443 |
| 4436 void WebViewImpl::updateRootLayerTransform() | 4444 void WebViewImpl::updateRootLayerTransform() |
| 4437 { | 4445 { |
| 4438 if (m_visualViewportContainerLayer) { | 4446 if (m_visualViewportContainerLayer) |
| 4439 TransformationMatrix transform; | 4447 m_visualViewportContainerLayer->setTransform(m_rootLayerTransform); |
| 4440 transform.translate(m_rootLayerOffset.width, m_rootLayerOffset.height); | |
| 4441 transform = transform.scale(m_rootLayerScale); | |
| 4442 m_visualViewportContainerLayer->setTransform(transform); | |
| 4443 } | |
| 4444 } | 4448 } |
| 4445 | 4449 |
| 4446 bool WebViewImpl::detectContentOnTouch(const GestureEventWithHitTestResults& tar
getedEvent) | 4450 bool WebViewImpl::detectContentOnTouch(const GestureEventWithHitTestResults& tar
getedEvent) |
| 4447 { | 4451 { |
| 4448 if (!m_page->mainFrame()->isLocalFrame()) | 4452 if (!m_page->mainFrame()->isLocalFrame()) |
| 4449 return false; | 4453 return false; |
| 4450 | 4454 |
| 4451 // Need a local copy of the hit test as setToShadowHostIfInUserAgentShadowRo
ot() will modify it. | 4455 // Need a local copy of the hit test as setToShadowHostIfInUserAgentShadowRo
ot() will modify it. |
| 4452 HitTestResult touchHit = targetedEvent.hitTestResult(); | 4456 HitTestResult touchHit = targetedEvent.hitTestResult(); |
| 4453 touchHit.setToShadowHostIfInUserAgentShadowRoot(); | 4457 touchHit.setToShadowHostIfInUserAgentShadowRoot(); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4585 return nullptr; | 4589 return nullptr; |
| 4586 return focusedFrame; | 4590 return focusedFrame; |
| 4587 } | 4591 } |
| 4588 | 4592 |
| 4589 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const | 4593 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const |
| 4590 { | 4594 { |
| 4591 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4595 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
| 4592 } | 4596 } |
| 4593 | 4597 |
| 4594 } // namespace blink | 4598 } // namespace blink |
| OLD | NEW |