| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 #include "core/page/EventHandler.h" | 74 #include "core/page/EventHandler.h" |
| 75 #include "core/page/EventWithHitTestResults.h" | 75 #include "core/page/EventWithHitTestResults.h" |
| 76 #include "core/page/FocusController.h" | 76 #include "core/page/FocusController.h" |
| 77 #include "core/page/FrameTree.h" | 77 #include "core/page/FrameTree.h" |
| 78 #include "core/page/InjectedStyleSheets.h" | 78 #include "core/page/InjectedStyleSheets.h" |
| 79 #include "core/page/Page.h" | 79 #include "core/page/Page.h" |
| 80 #include "core/page/PagePopupClient.h" | 80 #include "core/page/PagePopupClient.h" |
| 81 #include "core/page/PointerLockController.h" | 81 #include "core/page/PointerLockController.h" |
| 82 #include "core/page/ScopedPageLoadDeferrer.h" | 82 #include "core/page/ScopedPageLoadDeferrer.h" |
| 83 #include "core/page/TouchDisambiguation.h" | 83 #include "core/page/TouchDisambiguation.h" |
| 84 #include "core/rendering/RenderGeometryMap.h" |
| 84 #include "core/rendering/RenderView.h" | 85 #include "core/rendering/RenderView.h" |
| 85 #include "core/rendering/RenderWidget.h" | 86 #include "core/rendering/RenderWidget.h" |
| 86 #include "core/rendering/TextAutosizer.h" | 87 #include "core/rendering/TextAutosizer.h" |
| 88 #include "core/rendering/compositing/CompositedLayerMapping.h" |
| 87 #include "core/rendering/compositing/RenderLayerCompositor.h" | 89 #include "core/rendering/compositing/RenderLayerCompositor.h" |
| 90 #include "core/timing/Performance.h" |
| 88 #include "modules/credentialmanager/CredentialManagerClient.h" | 91 #include "modules/credentialmanager/CredentialManagerClient.h" |
| 89 #include "modules/device_orientation/DeviceOrientationInspectorAgent.h" | 92 #include "modules/device_orientation/DeviceOrientationInspectorAgent.h" |
| 90 #include "modules/encryptedmedia/MediaKeysController.h" | 93 #include "modules/encryptedmedia/MediaKeysController.h" |
| 91 #include "modules/filesystem/InspectorFileSystemAgent.h" | 94 #include "modules/filesystem/InspectorFileSystemAgent.h" |
| 92 #include "modules/indexeddb/InspectorIndexedDBAgent.h" | 95 #include "modules/indexeddb/InspectorIndexedDBAgent.h" |
| 93 #include "modules/push_messaging/PushController.h" | 96 #include "modules/push_messaging/PushController.h" |
| 94 #include "platform/ContextMenu.h" | 97 #include "platform/ContextMenu.h" |
| 95 #include "platform/ContextMenuItem.h" | 98 #include "platform/ContextMenuItem.h" |
| 96 #include "platform/Cursor.h" | 99 #include "platform/Cursor.h" |
| 97 #include "platform/KeyboardCodes.h" | 100 #include "platform/KeyboardCodes.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 119 #include "public/platform/WebFloatPoint.h" | 122 #include "public/platform/WebFloatPoint.h" |
| 120 #include "public/platform/WebGestureCurve.h" | 123 #include "public/platform/WebGestureCurve.h" |
| 121 #include "public/platform/WebImage.h" | 124 #include "public/platform/WebImage.h" |
| 122 #include "public/platform/WebLayerTreeView.h" | 125 #include "public/platform/WebLayerTreeView.h" |
| 123 #include "public/platform/WebURLRequest.h" | 126 #include "public/platform/WebURLRequest.h" |
| 124 #include "public/platform/WebVector.h" | 127 #include "public/platform/WebVector.h" |
| 125 #include "public/web/WebAXObject.h" | 128 #include "public/web/WebAXObject.h" |
| 126 #include "public/web/WebActiveWheelFlingParameters.h" | 129 #include "public/web/WebActiveWheelFlingParameters.h" |
| 127 #include "public/web/WebAutofillClient.h" | 130 #include "public/web/WebAutofillClient.h" |
| 128 #include "public/web/WebBeginFrameArgs.h" | 131 #include "public/web/WebBeginFrameArgs.h" |
| 132 #include "public/web/WebFrame.h" |
| 129 #include "public/web/WebFrameClient.h" | 133 #include "public/web/WebFrameClient.h" |
| 130 #include "public/web/WebHitTestResult.h" | 134 #include "public/web/WebHitTestResult.h" |
| 131 #include "public/web/WebInputElement.h" | 135 #include "public/web/WebInputElement.h" |
| 132 #include "public/web/WebMediaPlayerAction.h" | 136 #include "public/web/WebMediaPlayerAction.h" |
| 133 #include "public/web/WebNode.h" | 137 #include "public/web/WebNode.h" |
| 138 #include "public/web/WebPerformance.h" |
| 134 #include "public/web/WebPlugin.h" | 139 #include "public/web/WebPlugin.h" |
| 135 #include "public/web/WebPluginAction.h" | 140 #include "public/web/WebPluginAction.h" |
| 136 #include "public/web/WebRange.h" | 141 #include "public/web/WebRange.h" |
| 137 #include "public/web/WebTextInputInfo.h" | 142 #include "public/web/WebTextInputInfo.h" |
| 138 #include "public/web/WebViewClient.h" | 143 #include "public/web/WebViewClient.h" |
| 139 #include "public/web/WebWindowFeatures.h" | 144 #include "public/web/WebWindowFeatures.h" |
| 140 #include "web/CompositionUnderlineVectorBuilder.h" | 145 #include "web/CompositionUnderlineVectorBuilder.h" |
| 141 #include "web/ContextFeaturesClientImpl.h" | 146 #include "web/ContextFeaturesClientImpl.h" |
| 142 #include "web/DatabaseClientImpl.h" | 147 #include "web/DatabaseClientImpl.h" |
| 143 #include "web/FullscreenController.h" | 148 #include "web/FullscreenController.h" |
| (...skipping 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1773 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, m_pageO
verlays.get()); | 1778 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, m_pageO
verlays.get()); |
| 1774 m_client->scheduleAnimation(); | 1779 m_client->scheduleAnimation(); |
| 1775 } | 1780 } |
| 1776 } | 1781 } |
| 1777 | 1782 |
| 1778 void WebViewImpl::didCommitFrameToCompositor() | 1783 void WebViewImpl::didCommitFrameToCompositor() |
| 1779 { | 1784 { |
| 1780 Scheduler::shared()->didCommitFrameToCompositor(); | 1785 Scheduler::shared()->didCommitFrameToCompositor(); |
| 1781 } | 1786 } |
| 1782 | 1787 |
| 1788 typedef WTF::HashMap<const GraphicsLayer*, std::vector<std::pair<int64_t, WebRec
t> > > |
| 1789 GraphicsLayerDrawRects; |
| 1790 |
| 1791 static void findSmoothnessRequestRects(Page* page) |
| 1792 { |
| 1793 typedef WTF::HashMap<const GraphicsLayer*, |
| 1794 std::vector<std::pair<int64_t, WebRect> > > |
| 1795 GraphicsLayerSmoothnessRects; |
| 1796 |
| 1797 GraphicsLayerSmoothnessRects glRects; |
| 1798 |
| 1799 for (Frame* frame = page ? page->mainFrame() : 0; frame; |
| 1800 frame = frame->tree().traverseNext()) { |
| 1801 |
| 1802 if (!frame->isLocalFrame()) |
| 1803 continue; |
| 1804 |
| 1805 LocalFrame* localframe = toLocalFrame(frame); |
| 1806 Document* document = localframe->document(); |
| 1807 HTMLFrameOwnerElement* ownerElement = document->ownerElement(); |
| 1808 |
| 1809 const GraphicsLayer* graphicsLayer; |
| 1810 |
| 1811 // Find frame's rect in graphics layer space |
| 1812 LayoutRect rect = |
| 1813 localframe->contentRenderer()->rectForPaintInvalidation(); |
| 1814 |
| 1815 if (document->renderView()->enclosingLayer()->compositingState() |
| 1816 == PaintsIntoOwnBacking || !ownerElement) { |
| 1817 graphicsLayer = document->renderView()->enclosingLayer() |
| 1818 ->enclosingLayerForPaintInvalidationCrossingFrameBoundaries() |
| 1819 ->graphicsLayerBacking(); |
| 1820 } else { |
| 1821 if (!ownerElement->renderer()) |
| 1822 continue; |
| 1823 graphicsLayer = ownerElement->renderer()->enclosingLayer() |
| 1824 ->enclosingLayerForPaintInvalidationCrossingFrameBoundaries() |
| 1825 ->graphicsLayerBacking(); |
| 1826 |
| 1827 RenderLayer::mapRectToPaintInvalidationBacking( |
| 1828 ownerElement->renderer(), |
| 1829 ownerElement->renderer()->containerForPaintInvalidation(), |
| 1830 rect); |
| 1831 } |
| 1832 |
| 1833 GraphicsLayerSmoothnessRects::iterator glIter = glRects.find(graphicsLay
er); |
| 1834 std::vector<std::pair<int64_t, WebRect> > *glVector; |
| 1835 if (glIter == glRects.end()) { |
| 1836 glVector = &glRects.add(graphicsLayer, |
| 1837 std::vector<std::pair<int64_t, WebRect> >()).storedValue->value; |
| 1838 } else { |
| 1839 glVector = &glIter->value; |
| 1840 } |
| 1841 glVector->push_back(std::make_pair(frame->frameID(), enclosingIntRect(re
ct))); |
| 1842 } |
| 1843 |
| 1844 for (GraphicsLayerSmoothnessRects::const_iterator iter = glRects.begin(); it
er != glRects.end(); ++iter) { |
| 1845 const GraphicsLayer* graphicsLayer = iter->key; |
| 1846 graphicsLayer->platformLayer()->setSmoothnessTimingRequests(iter->value)
; |
| 1847 } |
| 1848 } |
| 1849 |
| 1783 void WebViewImpl::layout() | 1850 void WebViewImpl::layout() |
| 1784 { | 1851 { |
| 1785 TRACE_EVENT0("blink", "WebViewImpl::layout"); | 1852 TRACE_EVENT0("blink", "WebViewImpl::layout"); |
| 1786 if (!localFrameRootTemporary()) | 1853 if (!localFrameRootTemporary()) |
| 1787 return; | 1854 return; |
| 1788 | 1855 |
| 1789 PageWidgetDelegate::layout(m_page.get(), localFrameRootTemporary()->frame())
; | 1856 PageWidgetDelegate::layout(m_page.get(), localFrameRootTemporary()->frame())
; |
| 1790 updateLayerTreeBackgroundColor(); | 1857 updateLayerTreeBackgroundColor(); |
| 1791 | 1858 |
| 1792 for (size_t i = 0; i < m_linkHighlights.size(); ++i) | 1859 for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
| 1793 m_linkHighlights[i]->updateGeometry(); | 1860 m_linkHighlights[i]->updateGeometry(); |
| 1794 | 1861 |
| 1862 findSmoothnessRequestRects(m_page.get()); |
| 1863 |
| 1795 if (m_devToolsAgent) | 1864 if (m_devToolsAgent) |
| 1796 m_devToolsAgent->didLayout(); | 1865 m_devToolsAgent->didLayout(); |
| 1797 } | 1866 } |
| 1798 | 1867 |
| 1799 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) | 1868 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) |
| 1800 { | 1869 { |
| 1801 // This should only be used when compositing is not being used for this | 1870 // This should only be used when compositing is not being used for this |
| 1802 // WebView, and it is painting into the recording of its parent. | 1871 // WebView, and it is painting into the recording of its parent. |
| 1803 ASSERT(!isAcceleratedCompositingActive()); | 1872 ASSERT(!isAcceleratedCompositingActive()); |
| 1804 | 1873 |
| (...skipping 2335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4140 WebSize scrollOffset = mainFrame()->scrollOffset(); | 4209 WebSize scrollOffset = mainFrame()->scrollOffset(); |
| 4141 scrollOffset.width += scrollDelta.width; | 4210 scrollOffset.width += scrollDelta.width; |
| 4142 scrollOffset.height += scrollDelta.height; | 4211 scrollOffset.height += scrollDelta.height; |
| 4143 | 4212 |
| 4144 WebPoint scrollPoint(scrollOffset.width, scrollOffset.height); | 4213 WebPoint scrollPoint(scrollOffset.width, scrollOffset.height); |
| 4145 setPageScaleFactor(pageScaleFactor() * pageScaleDelta, scrollPoint); | 4214 setPageScaleFactor(pageScaleFactor() * pageScaleDelta, scrollPoint); |
| 4146 m_doubleTapZoomPending = false; | 4215 m_doubleTapZoomPending = false; |
| 4147 } | 4216 } |
| 4148 } | 4217 } |
| 4149 | 4218 |
| 4219 void WebViewImpl::recordSmoothnessTimingEvent(smoothnessTimingEventType eventTyp
e, int64_t FrameId, const WebVector<std::pair<int, double> >& events) |
| 4220 { |
| 4221 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
| 4222 return; |
| 4223 |
| 4224 Frame* frame = m_page ? m_page->mainFrame() : 0; |
| 4225 |
| 4226 while (frame && frame->frameID() != FrameId) { |
| 4227 frame = frame->tree().traverseNext(); |
| 4228 } |
| 4229 |
| 4230 if (!frame) |
| 4231 return; // ASSERT? Other way to report error? |
| 4232 |
| 4233 ASSERT(frame->isLocalFrame()); |
| 4234 |
| 4235 blink::LocalDOMWindow* domWindow = toLocalFrame(frame)->domWindow(); |
| 4236 blink::Performance& performance = domWindow->performance(); |
| 4237 for (size_t i = 0; i < events.size(); ++i) { |
| 4238 if (eventType == CompositeEvent) |
| 4239 performance.addSmoothnessTiming("composite", domWindow->document(),
events[i].first, events[i].second); |
| 4240 else if (eventType == CommitEvent) |
| 4241 performance.addSmoothnessTiming("commit", domWindow->document(), eve
nts[i].first, events[i].second); |
| 4242 } |
| 4243 } |
| 4244 |
| 4150 void WebViewImpl::updateLayerTreeViewport() | 4245 void WebViewImpl::updateLayerTreeViewport() |
| 4151 { | 4246 { |
| 4152 if (!page() || !m_layerTreeView) | 4247 if (!page() || !m_layerTreeView) |
| 4153 return; | 4248 return; |
| 4154 | 4249 |
| 4155 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumPageS
caleFactor(), maximumPageScaleFactor()); | 4250 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumPageS
caleFactor(), maximumPageScaleFactor()); |
| 4156 } | 4251 } |
| 4157 | 4252 |
| 4158 void WebViewImpl::updateLayerTreeBackgroundColor() | 4253 void WebViewImpl::updateLayerTreeBackgroundColor() |
| 4159 { | 4254 { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4290 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); | 4385 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); |
| 4291 | 4386 |
| 4292 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4387 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
| 4293 return false; | 4388 return false; |
| 4294 | 4389 |
| 4295 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4390 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
| 4296 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4391 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
| 4297 } | 4392 } |
| 4298 | 4393 |
| 4299 } // namespace blink | 4394 } // namespace blink |
| OLD | NEW |