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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 #include "wtf/TemporaryChange.h" | 162 #include "wtf/TemporaryChange.h" |
163 | 163 |
164 #if USE(DEFAULT_RENDER_THEME) | 164 #if USE(DEFAULT_RENDER_THEME) |
165 #include "core/rendering/RenderThemeChromiumDefault.h" | 165 #include "core/rendering/RenderThemeChromiumDefault.h" |
166 #endif | 166 #endif |
167 | 167 |
168 // Get rid of WTF's pow define so we can use std::pow. | 168 // Get rid of WTF's pow define so we can use std::pow. |
169 #undef pow | 169 #undef pow |
170 #include <cmath> // for std::pow | 170 #include <cmath> // for std::pow |
171 | 171 |
172 using namespace blink; | |
173 | |
174 // The following constants control parameters for automated scaling of webpages | 172 // The following constants control parameters for automated scaling of webpages |
175 // (such as due to a double tap gesture or find in page etc.). These are | 173 // (such as due to a double tap gesture or find in page etc.). These are |
176 // experimentally determined. | 174 // experimentally determined. |
177 static const int touchPointPadding = 32; | 175 static const int touchPointPadding = 32; |
178 static const int nonUserInitiatedPointPadding = 11; | 176 static const int nonUserInitiatedPointPadding = 11; |
179 static const float minScaleDifference = 0.01f; | 177 static const float minScaleDifference = 0.01f; |
180 static const float doubleTapZoomContentDefaultMargin = 5; | 178 static const float doubleTapZoomContentDefaultMargin = 5; |
181 static const float doubleTapZoomContentMinimumMargin = 2; | 179 static const float doubleTapZoomContentMinimumMargin = 2; |
182 static const double doubleTapZoomAnimationDurationInSeconds = 0.25; | 180 static const double doubleTapZoomAnimationDurationInSeconds = 0.25; |
183 static const float doubleTapZoomAlreadyLegibleRatio = 1.2f; | 181 static const float doubleTapZoomAlreadyLegibleRatio = 1.2f; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 COMPILE_ASSERT_MATCHING_ENUM(DragOperationMove); | 224 COMPILE_ASSERT_MATCHING_ENUM(DragOperationMove); |
227 COMPILE_ASSERT_MATCHING_ENUM(DragOperationDelete); | 225 COMPILE_ASSERT_MATCHING_ENUM(DragOperationDelete); |
228 COMPILE_ASSERT_MATCHING_ENUM(DragOperationEvery); | 226 COMPILE_ASSERT_MATCHING_ENUM(DragOperationEvery); |
229 | 227 |
230 static bool shouldUseExternalPopupMenus = false; | 228 static bool shouldUseExternalPopupMenus = false; |
231 | 229 |
232 static int webInputEventKeyStateToPlatformEventKeyState(int webInputEventKeyStat
e) | 230 static int webInputEventKeyStateToPlatformEventKeyState(int webInputEventKeyStat
e) |
233 { | 231 { |
234 int platformEventKeyState = 0; | 232 int platformEventKeyState = 0; |
235 if (webInputEventKeyState & WebInputEvent::ShiftKey) | 233 if (webInputEventKeyState & WebInputEvent::ShiftKey) |
236 platformEventKeyState = platformEventKeyState | blink::PlatformEvent::Sh
iftKey; | 234 platformEventKeyState = platformEventKeyState | PlatformEvent::ShiftKey; |
237 if (webInputEventKeyState & WebInputEvent::ControlKey) | 235 if (webInputEventKeyState & WebInputEvent::ControlKey) |
238 platformEventKeyState = platformEventKeyState | blink::PlatformEvent::Ct
rlKey; | 236 platformEventKeyState = platformEventKeyState | PlatformEvent::CtrlKey; |
239 if (webInputEventKeyState & WebInputEvent::AltKey) | 237 if (webInputEventKeyState & WebInputEvent::AltKey) |
240 platformEventKeyState = platformEventKeyState | blink::PlatformEvent::Al
tKey; | 238 platformEventKeyState = platformEventKeyState | PlatformEvent::AltKey; |
241 if (webInputEventKeyState & WebInputEvent::MetaKey) | 239 if (webInputEventKeyState & WebInputEvent::MetaKey) |
242 platformEventKeyState = platformEventKeyState | blink::PlatformEvent::Me
taKey; | 240 platformEventKeyState = platformEventKeyState | PlatformEvent::MetaKey; |
243 return platformEventKeyState; | 241 return platformEventKeyState; |
244 } | 242 } |
245 | 243 |
246 namespace { | 244 namespace { |
247 | 245 |
248 class UserGestureNotifier { | 246 class UserGestureNotifier { |
249 public: | 247 public: |
250 // If a UserGestureIndicator is created for a user gesture since the last | 248 // If a UserGestureIndicator is created for a user gesture since the last |
251 // page load and *userGestureObserved is false, the UserGestureNotifier | 249 // page load and *userGestureObserved is false, the UserGestureNotifier |
252 // will notify the client and set *userGestureObserved to true. | 250 // will notify the client and set *userGestureObserved to true. |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 bool WebViewImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseWheelEve
nt& event) | 581 bool WebViewImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseWheelEve
nt& event) |
584 { | 582 { |
585 hidePopups(); | 583 hidePopups(); |
586 return PageWidgetEventHandler::handleMouseWheel(mainFrame, event); | 584 return PageWidgetEventHandler::handleMouseWheel(mainFrame, event); |
587 } | 585 } |
588 | 586 |
589 bool WebViewImpl::scrollBy(const WebFloatSize& delta, const WebFloatSize& veloci
ty) | 587 bool WebViewImpl::scrollBy(const WebFloatSize& delta, const WebFloatSize& veloci
ty) |
590 { | 588 { |
591 if (m_flingSourceDevice == WebGestureDeviceTouchpad) { | 589 if (m_flingSourceDevice == WebGestureDeviceTouchpad) { |
592 WebMouseWheelEvent syntheticWheel; | 590 WebMouseWheelEvent syntheticWheel; |
593 const float tickDivisor = blink::WheelEvent::TickMultiplier; | 591 const float tickDivisor = WheelEvent::TickMultiplier; |
594 | 592 |
595 syntheticWheel.deltaX = delta.width; | 593 syntheticWheel.deltaX = delta.width; |
596 syntheticWheel.deltaY = delta.height; | 594 syntheticWheel.deltaY = delta.height; |
597 syntheticWheel.wheelTicksX = delta.width / tickDivisor; | 595 syntheticWheel.wheelTicksX = delta.width / tickDivisor; |
598 syntheticWheel.wheelTicksY = delta.height / tickDivisor; | 596 syntheticWheel.wheelTicksY = delta.height / tickDivisor; |
599 syntheticWheel.hasPreciseScrollingDeltas = true; | 597 syntheticWheel.hasPreciseScrollingDeltas = true; |
600 syntheticWheel.x = m_positionOnFlingStart.x; | 598 syntheticWheel.x = m_positionOnFlingStart.x; |
601 syntheticWheel.y = m_positionOnFlingStart.y; | 599 syntheticWheel.y = m_positionOnFlingStart.y; |
602 syntheticWheel.globalX = m_globalPositionOnFlingStart.x; | 600 syntheticWheel.globalX = m_globalPositionOnFlingStart.x; |
603 syntheticWheel.globalY = m_globalPositionOnFlingStart.y; | 601 syntheticWheel.globalY = m_globalPositionOnFlingStart.y; |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1443 #endif | 1441 #endif |
1444 if (!mapKeyCodeForScroll(keyCode, &scrollDirection, &scrollGranularity)) | 1442 if (!mapKeyCodeForScroll(keyCode, &scrollDirection, &scrollGranularity)) |
1445 return false; | 1443 return false; |
1446 | 1444 |
1447 LocalFrame* frame = toLocalFrame(focusedWebCoreFrame()); | 1445 LocalFrame* frame = toLocalFrame(focusedWebCoreFrame()); |
1448 if (!frame) | 1446 if (!frame) |
1449 return false; | 1447 return false; |
1450 return frame->eventHandler().bubblingScroll(scrollDirection, scrollGranulari
ty); | 1448 return frame->eventHandler().bubblingScroll(scrollDirection, scrollGranulari
ty); |
1451 } | 1449 } |
1452 | 1450 |
1453 bool WebViewImpl::mapKeyCodeForScroll(int keyCode, | 1451 bool WebViewImpl::mapKeyCodeForScroll( |
1454 blink::ScrollDirection* scrollDirection, | 1452 int keyCode, |
1455 blink::ScrollGranularity* scrollGranularit
y) | 1453 ScrollDirection* scrollDirection, |
| 1454 ScrollGranularity* scrollGranularity) |
1456 { | 1455 { |
1457 switch (keyCode) { | 1456 switch (keyCode) { |
1458 case VKEY_LEFT: | 1457 case VKEY_LEFT: |
1459 *scrollDirection = ScrollLeft; | 1458 *scrollDirection = ScrollLeft; |
1460 *scrollGranularity = ScrollByLine; | 1459 *scrollGranularity = ScrollByLine; |
1461 break; | 1460 break; |
1462 case VKEY_RIGHT: | 1461 case VKEY_RIGHT: |
1463 *scrollDirection = ScrollRight; | 1462 *scrollDirection = ScrollRight; |
1464 *scrollGranularity = ScrollByLine; | 1463 *scrollGranularity = ScrollByLine; |
1465 break; | 1464 break; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1608 page()->frameHost().pinchViewport().setSize(newSize); | 1607 page()->frameHost().pinchViewport().setSize(newSize); |
1609 } | 1608 } |
1610 | 1609 |
1611 WebLocalFrameImpl* WebViewImpl::localFrameRootTemporary() const | 1610 WebLocalFrameImpl* WebViewImpl::localFrameRootTemporary() const |
1612 { | 1611 { |
1613 // FIXME: This is a temporary method that finds the first localFrame in a tr
aversal. | 1612 // FIXME: This is a temporary method that finds the first localFrame in a tr
aversal. |
1614 // This is equivalent to mainFrame() if the mainFrame is in-process. We need
to create | 1613 // This is equivalent to mainFrame() if the mainFrame is in-process. We need
to create |
1615 // separate WebWidgets to be created by RenderWidgets, which are associated
with *all* | 1614 // separate WebWidgets to be created by RenderWidgets, which are associated
with *all* |
1616 // local frame roots, not just the first one in the tree. Until then, this l
imits us | 1615 // local frame roots, not just the first one in the tree. Until then, this l
imits us |
1617 // to having only one functioning connected LocalFrame subtree per process. | 1616 // to having only one functioning connected LocalFrame subtree per process. |
1618 for (blink::Frame* frame = page()->mainFrame(); frame; frame = frame->tree()
.traverseNext()) { | 1617 for (Frame* frame = page()->mainFrame(); frame; frame = frame->tree().traver
seNext()) { |
1619 if (frame->isLocalRoot()) | 1618 if (frame->isLocalRoot()) |
1620 return WebLocalFrameImpl::fromFrame(toLocalFrame(frame)); | 1619 return WebLocalFrameImpl::fromFrame(toLocalFrame(frame)); |
1621 } | 1620 } |
1622 return 0; | 1621 return 0; |
1623 } | 1622 } |
1624 | 1623 |
1625 void WebViewImpl::performResize() | 1624 void WebViewImpl::performResize() |
1626 { | 1625 { |
1627 m_pageScaleConstraintsSet.didChangeViewSize(m_size); | 1626 m_pageScaleConstraintsSet.didChangeViewSize(m_size); |
1628 | 1627 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1781 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) | 1780 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) |
1782 { | 1781 { |
1783 // This should only be used when compositing is not being used for this | 1782 // This should only be used when compositing is not being used for this |
1784 // WebView, and it is painting into the recording of its parent. | 1783 // WebView, and it is painting into the recording of its parent. |
1785 ASSERT(!isAcceleratedCompositingActive()); | 1784 ASSERT(!isAcceleratedCompositingActive()); |
1786 | 1785 |
1787 double paintStart = currentTime(); | 1786 double paintStart = currentTime(); |
1788 PageWidgetDelegate::paint(m_page.get(), pageOverlays(), canvas, rect, isTran
sparent() ? PageWidgetDelegate::Translucent : PageWidgetDelegate::Opaque); | 1787 PageWidgetDelegate::paint(m_page.get(), pageOverlays(), canvas, rect, isTran
sparent() ? PageWidgetDelegate::Translucent : PageWidgetDelegate::Opaque); |
1789 double paintEnd = currentTime(); | 1788 double paintEnd = currentTime(); |
1790 double pixelsPerSec = (rect.width * rect.height) / (paintEnd - paintStart); | 1789 double pixelsPerSec = (rect.width * rect.height) / (paintEnd - paintStart); |
1791 blink::Platform::current()->histogramCustomCounts("Renderer4.SoftwarePaintDu
rationMS", (paintEnd - paintStart) * 1000, 0, 120, 30); | 1790 Platform::current()->histogramCustomCounts("Renderer4.SoftwarePaintDurationM
S", (paintEnd - paintStart) * 1000, 0, 120, 30); |
1792 blink::Platform::current()->histogramCustomCounts("Renderer4.SoftwarePaintMe
gapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30); | 1791 Platform::current()->histogramCustomCounts("Renderer4.SoftwarePaintMegapixPe
rSecond", pixelsPerSec / 1000000, 10, 210, 30); |
1793 } | 1792 } |
1794 | 1793 |
1795 #if OS(ANDROID) | 1794 #if OS(ANDROID) |
1796 void WebViewImpl::paintCompositedDeprecated(WebCanvas* canvas, const WebRect& re
ct) | 1795 void WebViewImpl::paintCompositedDeprecated(WebCanvas* canvas, const WebRect& re
ct) |
1797 { | 1796 { |
1798 // Note: This method exists on OS(ANDROID) and will hopefully be | 1797 // Note: This method exists on OS(ANDROID) and will hopefully be |
1799 // removed once the link disambiguation feature renders using | 1798 // removed once the link disambiguation feature renders using |
1800 // the compositor. | 1799 // the compositor. |
1801 ASSERT(isAcceleratedCompositingActive()); | 1800 ASSERT(isAcceleratedCompositingActive()); |
1802 | 1801 |
(...skipping 28 matching lines...) Expand all Loading... |
1831 if (!page()) | 1830 if (!page()) |
1832 return; | 1831 return; |
1833 if (!page()->mainFrame()->isLocalFrame()) | 1832 if (!page()->mainFrame()->isLocalFrame()) |
1834 return; | 1833 return; |
1835 FrameView* view = page()->deprecatedLocalMainFrame()->view(); | 1834 FrameView* view = page()->deprecatedLocalMainFrame()->view(); |
1836 | 1835 |
1837 WebRect damagedRect(0, 0, m_size.width, m_size.height); | 1836 WebRect damagedRect(0, 0, m_size.width, m_size.height); |
1838 view->invalidateRect(damagedRect); | 1837 view->invalidateRect(damagedRect); |
1839 } | 1838 } |
1840 | 1839 |
1841 void WebViewImpl::enterFullScreenForElement(blink::Element* element) | 1840 void WebViewImpl::enterFullScreenForElement(Element* element) |
1842 { | 1841 { |
1843 m_fullscreenController->enterFullScreenForElement(element); | 1842 m_fullscreenController->enterFullScreenForElement(element); |
1844 } | 1843 } |
1845 | 1844 |
1846 void WebViewImpl::exitFullScreenForElement(blink::Element* element) | 1845 void WebViewImpl::exitFullScreenForElement(Element* element) |
1847 { | 1846 { |
1848 m_fullscreenController->exitFullScreenForElement(element); | 1847 m_fullscreenController->exitFullScreenForElement(element); |
1849 } | 1848 } |
1850 | 1849 |
1851 void WebViewImpl::clearCompositedSelectionBounds() | 1850 void WebViewImpl::clearCompositedSelectionBounds() |
1852 { | 1851 { |
1853 if (m_layerTreeView) | 1852 if (m_layerTreeView) |
1854 m_layerTreeView->clearSelection(); | 1853 m_layerTreeView->clearSelection(); |
1855 } | 1854 } |
1856 | 1855 |
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3296 { | 3295 { |
3297 if (!m_page) | 3296 if (!m_page) |
3298 return; | 3297 return; |
3299 | 3298 |
3300 KURL url = hitTestResultForWindowPos(point).absoluteImageURLIncludingCanvasD
ataURL(); | 3299 KURL url = hitTestResultForWindowPos(point).absoluteImageURLIncludingCanvasD
ataURL(); |
3301 | 3300 |
3302 if (url.isEmpty()) | 3301 if (url.isEmpty()) |
3303 return; | 3302 return; |
3304 | 3303 |
3305 ResourceRequest request(url); | 3304 ResourceRequest request(url); |
3306 request.setRequestContext(blink::WebURLRequest::RequestContextDownload); | 3305 request.setRequestContext(WebURLRequest::RequestContextDownload); |
3307 m_page->deprecatedLocalMainFrame()->loader().client()->loadURLExternally( | 3306 m_page->deprecatedLocalMainFrame()->loader().client()->loadURLExternally( |
3308 request, NavigationPolicyDownloadTo, WebString()); | 3307 request, NavigationPolicyDownloadTo, WebString()); |
3309 } | 3308 } |
3310 | 3309 |
3311 void WebViewImpl::dragSourceEndedAt( | 3310 void WebViewImpl::dragSourceEndedAt( |
3312 const WebPoint& clientPoint, | 3311 const WebPoint& clientPoint, |
3313 const WebPoint& screenPoint, | 3312 const WebPoint& screenPoint, |
3314 WebDragOperation operation) | 3313 WebDragOperation operation) |
3315 { | 3314 { |
3316 PlatformMouseEvent pme(clientPoint, | 3315 PlatformMouseEvent pme(clientPoint, |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3568 if (LocalFrame* focusedFrame = toLocalFrame(page()->focusController().focuse
dOrMainFrame())) | 3567 if (LocalFrame* focusedFrame = toLocalFrame(page()->focusController().focuse
dOrMainFrame())) |
3569 focusedFrame->eventHandler().sendContextMenuEventForKey(); | 3568 focusedFrame->eventHandler().sendContextMenuEventForKey(); |
3570 m_contextMenuAllowed = false; | 3569 m_contextMenuAllowed = false; |
3571 } | 3570 } |
3572 | 3571 |
3573 void WebViewImpl::extractSmartClipData(WebRect rect, WebString& clipText, WebStr
ing& clipHtml, WebRect& clipRect) | 3572 void WebViewImpl::extractSmartClipData(WebRect rect, WebString& clipText, WebStr
ing& clipHtml, WebRect& clipRect) |
3574 { | 3573 { |
3575 LocalFrame* localFrame = toLocalFrame(focusedWebCoreFrame()); | 3574 LocalFrame* localFrame = toLocalFrame(focusedWebCoreFrame()); |
3576 if (!localFrame) | 3575 if (!localFrame) |
3577 return; | 3576 return; |
3578 SmartClipData clipData = blink::SmartClip(localFrame).dataForRect(rect); | 3577 SmartClipData clipData = SmartClip(localFrame).dataForRect(rect); |
3579 clipText = clipData.clipData(); | 3578 clipText = clipData.clipData(); |
3580 clipRect = clipData.rect(); | 3579 clipRect = clipData.rect(); |
3581 | 3580 |
3582 WebLocalFrameImpl* frame = mainFrameImpl(); | 3581 WebLocalFrameImpl* frame = mainFrameImpl(); |
3583 if (!frame) | 3582 if (!frame) |
3584 return; | 3583 return; |
3585 WebPoint startPoint(rect.x, rect.y); | 3584 WebPoint startPoint(rect.x, rect.y); |
3586 WebPoint endPoint(rect.x + rect.width, rect.y + rect.height); | 3585 WebPoint endPoint(rect.x + rect.width, rect.y + rect.height); |
3587 VisiblePosition startVisiblePosition = frame->visiblePositionForWindowPoint(
startPoint); | 3586 VisiblePosition startVisiblePosition = frame->visiblePositionForWindowPoint(
startPoint); |
3588 VisiblePosition endVisiblePosition = frame->visiblePositionForWindowPoint(en
dPoint); | 3587 VisiblePosition endVisiblePosition = frame->visiblePositionForWindowPoint(en
dPoint); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3819 | 3818 |
3820 m_pageOverlays->add(overlay, zOrder); | 3819 m_pageOverlays->add(overlay, zOrder); |
3821 } | 3820 } |
3822 | 3821 |
3823 void WebViewImpl::removePageOverlay(WebPageOverlay* overlay) | 3822 void WebViewImpl::removePageOverlay(WebPageOverlay* overlay) |
3824 { | 3823 { |
3825 if (m_pageOverlays && m_pageOverlays->remove(overlay) && m_pageOverlays->emp
ty()) | 3824 if (m_pageOverlays && m_pageOverlays->remove(overlay) && m_pageOverlays->emp
ty()) |
3826 m_pageOverlays = nullptr; | 3825 m_pageOverlays = nullptr; |
3827 } | 3826 } |
3828 | 3827 |
3829 void WebViewImpl::setOverlayLayer(blink::GraphicsLayer* layer) | 3828 void WebViewImpl::setOverlayLayer(GraphicsLayer* layer) |
3830 { | 3829 { |
3831 if (!m_rootGraphicsLayer) | 3830 if (!m_rootGraphicsLayer) |
3832 return; | 3831 return; |
3833 | 3832 |
3834 if (!m_page->mainFrame()->isLocalFrame()) | 3833 if (!m_page->mainFrame()->isLocalFrame()) |
3835 return; | 3834 return; |
3836 | 3835 |
3837 if (pinchVirtualViewportEnabled()) { | 3836 if (pinchVirtualViewportEnabled()) { |
3838 m_page->deprecatedLocalMainFrame()->view()->renderView()->compositor()->
setOverlayLayer(layer); | 3837 m_page->deprecatedLocalMainFrame()->view()->renderView()->compositor()->
setOverlayLayer(layer); |
3839 return; | 3838 return; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3949 | 3948 |
3950 void WebViewImpl::invalidateRect(const IntRect& rect) | 3949 void WebViewImpl::invalidateRect(const IntRect& rect) |
3951 { | 3950 { |
3952 if (m_isAcceleratedCompositingActive) { | 3951 if (m_isAcceleratedCompositingActive) { |
3953 ASSERT(m_layerTreeView); | 3952 ASSERT(m_layerTreeView); |
3954 updateLayerTreeViewport(); | 3953 updateLayerTreeViewport(); |
3955 } else if (m_client) | 3954 } else if (m_client) |
3956 m_client->didInvalidateRect(rect); | 3955 m_client->didInvalidateRect(rect); |
3957 } | 3956 } |
3958 | 3957 |
3959 blink::GraphicsLayerFactory* WebViewImpl::graphicsLayerFactory() const | 3958 GraphicsLayerFactory* WebViewImpl::graphicsLayerFactory() const |
3960 { | 3959 { |
3961 return m_graphicsLayerFactory.get(); | 3960 return m_graphicsLayerFactory.get(); |
3962 } | 3961 } |
3963 | 3962 |
3964 blink::RenderLayerCompositor* WebViewImpl::compositor() const | 3963 RenderLayerCompositor* WebViewImpl::compositor() const |
3965 { | 3964 { |
3966 if (!page() || !page()->mainFrame()) | 3965 if (!page() || !page()->mainFrame()) |
3967 return 0; | 3966 return 0; |
3968 | 3967 |
3969 if (!page()->mainFrame()->isLocalFrame()) | 3968 if (!page()->mainFrame()->isLocalFrame()) |
3970 return localFrameRootTemporary()->frame()->document()->renderView()->com
positor(); | 3969 return localFrameRootTemporary()->frame()->document()->renderView()->com
positor(); |
3971 | 3970 |
3972 if (!page()->deprecatedLocalMainFrame()->document() || !page()->deprecatedLo
calMainFrame()->document()->renderView()) | 3971 if (!page()->deprecatedLocalMainFrame()->document() || !page()->deprecatedLo
calMainFrame()->document()->renderView()) |
3973 return 0; | 3972 return 0; |
3974 | 3973 |
3975 return page()->deprecatedLocalMainFrame()->document()->renderView()->composi
tor(); | 3974 return page()->deprecatedLocalMainFrame()->document()->renderView()->composi
tor(); |
3976 } | 3975 } |
3977 | 3976 |
3978 void WebViewImpl::registerForAnimations(WebLayer* layer) | 3977 void WebViewImpl::registerForAnimations(WebLayer* layer) |
3979 { | 3978 { |
3980 if (m_layerTreeView) | 3979 if (m_layerTreeView) |
3981 m_layerTreeView->registerForAnimations(layer); | 3980 m_layerTreeView->registerForAnimations(layer); |
3982 } | 3981 } |
3983 | 3982 |
3984 blink::GraphicsLayer* WebViewImpl::rootGraphicsLayer() | 3983 GraphicsLayer* WebViewImpl::rootGraphicsLayer() |
3985 { | 3984 { |
3986 return m_rootGraphicsLayer; | 3985 return m_rootGraphicsLayer; |
3987 } | 3986 } |
3988 | 3987 |
3989 void WebViewImpl::scheduleAnimation() | 3988 void WebViewImpl::scheduleAnimation() |
3990 { | 3989 { |
3991 if (isAcceleratedCompositingActive()) { | 3990 if (isAcceleratedCompositingActive()) { |
3992 ASSERT(m_layerTreeView); | 3991 ASSERT(m_layerTreeView); |
3993 m_layerTreeView->setNeedsAnimate(); | 3992 m_layerTreeView->setNeedsAnimate(); |
3994 return; | 3993 return; |
(...skipping 18 matching lines...) Expand all Loading... |
4013 | 4012 |
4014 void WebViewImpl::setIsAcceleratedCompositingActive(bool active) | 4013 void WebViewImpl::setIsAcceleratedCompositingActive(bool active) |
4015 { | 4014 { |
4016 // In the middle of shutting down; don't try to spin back up a compositor. | 4015 // In the middle of shutting down; don't try to spin back up a compositor. |
4017 // FIXME: compositing startup/shutdown should be refactored so that it | 4016 // FIXME: compositing startup/shutdown should be refactored so that it |
4018 // turns on explicitly rather than lazily, which causes this awkwardness. | 4017 // turns on explicitly rather than lazily, which causes this awkwardness. |
4019 if (m_layerTreeViewClosed) | 4018 if (m_layerTreeViewClosed) |
4020 return; | 4019 return; |
4021 | 4020 |
4022 ASSERT(!active || m_layerTreeView); | 4021 ASSERT(!active || m_layerTreeView); |
4023 blink::Platform::current()->histogramEnumeration("GPU.setIsAcceleratedCompos
itingActive", active * 2 + m_isAcceleratedCompositingActive, 4); | 4022 Platform::current()->histogramEnumeration("GPU.setIsAcceleratedCompositingAc
tive", active * 2 + m_isAcceleratedCompositingActive, 4); |
4024 | 4023 |
4025 if (m_isAcceleratedCompositingActive == active) | 4024 if (m_isAcceleratedCompositingActive == active) |
4026 return; | 4025 return; |
4027 | 4026 |
4028 if (!m_client) | 4027 if (!m_client) |
4029 return; | 4028 return; |
4030 | 4029 |
4031 if (!active) { | 4030 if (!active) { |
4032 m_isAcceleratedCompositingActive = false; | 4031 m_isAcceleratedCompositingActive = false; |
4033 if (!m_layerTreeViewCommitsDeferred) { | 4032 if (!m_layerTreeViewCommitsDeferred) { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4151 // or update the transform layer. | 4150 // or update the transform layer. |
4152 if (!m_rootGraphicsLayer) | 4151 if (!m_rootGraphicsLayer) |
4153 return; | 4152 return; |
4154 | 4153 |
4155 // FIXME(bokan): m_rootTransformLayer is always set here in pinch virtual vi
ewport. This can go away once | 4154 // FIXME(bokan): m_rootTransformLayer is always set here in pinch virtual vi
ewport. This can go away once |
4156 // that's default everywhere. | 4155 // that's default everywhere. |
4157 if (!m_rootTransformLayer && m_page->mainFrame()->isLocalFrame()) | 4156 if (!m_rootTransformLayer && m_page->mainFrame()->isLocalFrame()) |
4158 m_rootTransformLayer = m_page->deprecatedLocalMainFrame()->view()->rende
rView()->compositor()->ensureRootTransformLayer(); | 4157 m_rootTransformLayer = m_page->deprecatedLocalMainFrame()->view()->rende
rView()->compositor()->ensureRootTransformLayer(); |
4159 | 4158 |
4160 if (m_rootTransformLayer) { | 4159 if (m_rootTransformLayer) { |
4161 blink::TransformationMatrix transform; | 4160 TransformationMatrix transform; |
4162 transform.translate(m_rootLayerOffset.width, m_rootLayerOffset.height); | 4161 transform.translate(m_rootLayerOffset.width, m_rootLayerOffset.height); |
4163 transform = transform.scale(m_rootLayerScale); | 4162 transform = transform.scale(m_rootLayerScale); |
4164 m_rootTransformLayer->setTransform(transform); | 4163 m_rootTransformLayer->setTransform(transform); |
4165 } | 4164 } |
4166 } | 4165 } |
4167 | 4166 |
4168 bool WebViewImpl::detectContentOnTouch(const WebPoint& position) | 4167 bool WebViewImpl::detectContentOnTouch(const WebPoint& position) |
4169 { | 4168 { |
4170 HitTestResult touchHit = hitTestResultForWindowPos(position); | 4169 HitTestResult touchHit = hitTestResultForWindowPos(position); |
4171 | 4170 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4259 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); | 4258 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); |
4260 | 4259 |
4261 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4260 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
4262 return false; | 4261 return false; |
4263 | 4262 |
4264 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4263 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4265 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4264 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
4266 } | 4265 } |
4267 | 4266 |
4268 } // namespace blink | 4267 } // namespace blink |
OLD | NEW |