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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 #include "core/page/EventWithHitTestResults.h" | 73 #include "core/page/EventWithHitTestResults.h" |
74 #include "core/page/FocusController.h" | 74 #include "core/page/FocusController.h" |
75 #include "core/page/FrameTree.h" | 75 #include "core/page/FrameTree.h" |
76 #include "core/page/InjectedStyleSheets.h" | 76 #include "core/page/InjectedStyleSheets.h" |
77 #include "core/page/Page.h" | 77 #include "core/page/Page.h" |
78 #include "core/page/PagePopupClient.h" | 78 #include "core/page/PagePopupClient.h" |
79 #include "core/page/PointerLockController.h" | 79 #include "core/page/PointerLockController.h" |
80 #include "core/page/ScopedPageLoadDeferrer.h" | 80 #include "core/page/ScopedPageLoadDeferrer.h" |
81 #include "core/page/TouchDisambiguation.h" | 81 #include "core/page/TouchDisambiguation.h" |
82 #include "core/rendering/FastTextAutosizer.h" | 82 #include "core/rendering/FastTextAutosizer.h" |
| 83 #include "core/rendering/RenderGeometryMap.h" |
83 #include "core/rendering/RenderView.h" | 84 #include "core/rendering/RenderView.h" |
84 #include "core/rendering/RenderWidget.h" | 85 #include "core/rendering/RenderWidget.h" |
85 #include "core/rendering/TextAutosizer.h" | 86 #include "core/rendering/TextAutosizer.h" |
| 87 #include "core/rendering/compositing/CompositedLayerMapping.h" |
86 #include "core/rendering/compositing/RenderLayerCompositor.h" | 88 #include "core/rendering/compositing/RenderLayerCompositor.h" |
| 89 #include "core/timing/Performance.h" |
87 #include "modules/device_orientation/DeviceOrientationInspectorAgent.h" | 90 #include "modules/device_orientation/DeviceOrientationInspectorAgent.h" |
88 #include "modules/encryptedmedia/MediaKeysController.h" | 91 #include "modules/encryptedmedia/MediaKeysController.h" |
89 #include "modules/filesystem/InspectorFileSystemAgent.h" | 92 #include "modules/filesystem/InspectorFileSystemAgent.h" |
90 #include "modules/indexeddb/InspectorIndexedDBAgent.h" | 93 #include "modules/indexeddb/InspectorIndexedDBAgent.h" |
91 #include "modules/push_messaging/PushController.h" | 94 #include "modules/push_messaging/PushController.h" |
92 #include "platform/ContextMenu.h" | 95 #include "platform/ContextMenu.h" |
93 #include "platform/ContextMenuItem.h" | 96 #include "platform/ContextMenuItem.h" |
94 #include "platform/Cursor.h" | 97 #include "platform/Cursor.h" |
95 #include "platform/KeyboardCodes.h" | 98 #include "platform/KeyboardCodes.h" |
96 #include "platform/NotImplemented.h" | 99 #include "platform/NotImplemented.h" |
(...skipping 18 matching lines...) Expand all Loading... |
115 #include "public/platform/WebFloatPoint.h" | 118 #include "public/platform/WebFloatPoint.h" |
116 #include "public/platform/WebGestureCurve.h" | 119 #include "public/platform/WebGestureCurve.h" |
117 #include "public/platform/WebImage.h" | 120 #include "public/platform/WebImage.h" |
118 #include "public/platform/WebLayerTreeView.h" | 121 #include "public/platform/WebLayerTreeView.h" |
119 #include "public/platform/WebURLRequest.h" | 122 #include "public/platform/WebURLRequest.h" |
120 #include "public/platform/WebVector.h" | 123 #include "public/platform/WebVector.h" |
121 #include "public/web/WebAXObject.h" | 124 #include "public/web/WebAXObject.h" |
122 #include "public/web/WebActiveWheelFlingParameters.h" | 125 #include "public/web/WebActiveWheelFlingParameters.h" |
123 #include "public/web/WebAutofillClient.h" | 126 #include "public/web/WebAutofillClient.h" |
124 #include "public/web/WebBeginFrameArgs.h" | 127 #include "public/web/WebBeginFrameArgs.h" |
| 128 #include "public/web/WebFrame.h" |
125 #include "public/web/WebFrameClient.h" | 129 #include "public/web/WebFrameClient.h" |
126 #include "public/web/WebHitTestResult.h" | 130 #include "public/web/WebHitTestResult.h" |
127 #include "public/web/WebInputElement.h" | 131 #include "public/web/WebInputElement.h" |
128 #include "public/web/WebMediaPlayerAction.h" | 132 #include "public/web/WebMediaPlayerAction.h" |
129 #include "public/web/WebNode.h" | 133 #include "public/web/WebNode.h" |
| 134 #include "public/web/WebPerformance.h" |
130 #include "public/web/WebPlugin.h" | 135 #include "public/web/WebPlugin.h" |
131 #include "public/web/WebPluginAction.h" | 136 #include "public/web/WebPluginAction.h" |
132 #include "public/web/WebRange.h" | 137 #include "public/web/WebRange.h" |
133 #include "public/web/WebTextInputInfo.h" | 138 #include "public/web/WebTextInputInfo.h" |
134 #include "public/web/WebViewClient.h" | 139 #include "public/web/WebViewClient.h" |
135 #include "public/web/WebWindowFeatures.h" | 140 #include "public/web/WebWindowFeatures.h" |
136 #include "web/CompositionUnderlineVectorBuilder.h" | 141 #include "web/CompositionUnderlineVectorBuilder.h" |
137 #include "web/ContextFeaturesClientImpl.h" | 142 #include "web/ContextFeaturesClientImpl.h" |
138 #include "web/DatabaseClientImpl.h" | 143 #include "web/DatabaseClientImpl.h" |
139 #include "web/FullscreenController.h" | 144 #include "web/FullscreenController.h" |
(...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1751 return; | 1756 return; |
1752 | 1757 |
1753 PageWidgetDelegate::animate(m_page.get(), monotonicFrameBeginTime); | 1758 PageWidgetDelegate::animate(m_page.get(), monotonicFrameBeginTime); |
1754 | 1759 |
1755 if (m_continuousPaintingEnabled) { | 1760 if (m_continuousPaintingEnabled) { |
1756 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, m_pageO
verlays.get()); | 1761 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, m_pageO
verlays.get()); |
1757 m_client->scheduleAnimation(); | 1762 m_client->scheduleAnimation(); |
1758 } | 1763 } |
1759 } | 1764 } |
1760 | 1765 |
| 1766 static void findDrawFrameRequestRects(Page* page) |
| 1767 { |
| 1768 typedef WTF::HashMap<const GraphicsLayer*, |
| 1769 std::vector<std::pair<int64_t, WebRect> > > |
| 1770 GraphicsLayerDrawRects; |
| 1771 |
| 1772 GraphicsLayerDrawRects glRects; |
| 1773 |
| 1774 for (Frame* frame = page ? page->mainFrame() : 0; frame; |
| 1775 frame = frame->tree().traverseNext()) { |
| 1776 |
| 1777 if (!frame->isLocalFrame()) |
| 1778 continue; |
| 1779 |
| 1780 LocalFrame* localframe = toLocalFrame(frame); |
| 1781 Document* document = localframe->document(); |
| 1782 HTMLFrameOwnerElement* ownerElement = document->ownerElement(); |
| 1783 |
| 1784 const GraphicsLayer* graphicsLayer; |
| 1785 |
| 1786 // Find frame's rect in graphics layer space |
| 1787 LayoutRect rect = |
| 1788 localframe->contentRenderer()->rectForPaintInvalidation(); |
| 1789 |
| 1790 if (document->renderView()->enclosingLayer()->compositingState() |
| 1791 == PaintsIntoOwnBacking || !ownerElement) { |
| 1792 graphicsLayer = document->renderView()->enclosingLayer() |
| 1793 ->enclosingLayerForPaintInvalidationCrossingFrameBoundaries() |
| 1794 ->graphicsLayerBacking(); |
| 1795 } else { |
| 1796 graphicsLayer = ownerElement->renderer()->enclosingLayer() |
| 1797 ->enclosingLayerForPaintInvalidationCrossingFrameBoundaries() |
| 1798 ->graphicsLayerBacking(); |
| 1799 |
| 1800 RenderLayer::mapRectToPaintInvalidationBacking( |
| 1801 ownerElement->renderer(), |
| 1802 ownerElement->renderer()->containerForPaintInvalidation(), |
| 1803 rect); |
| 1804 } |
| 1805 |
| 1806 GraphicsLayerDrawRects::iterator glIter = glRects.find(graphicsLayer); |
| 1807 std::vector<std::pair<int64_t, WebRect> > *glVector; |
| 1808 if (glIter == glRects.end()) { |
| 1809 glVector = &glRects.add(graphicsLayer, |
| 1810 std::vector<std::pair<int64_t, WebRect> >()).storedValue->value; |
| 1811 } else { |
| 1812 glVector = &glIter->value; |
| 1813 } |
| 1814 glVector->push_back(std::make_pair(frame->frameID(), enclosingIntRect(re
ct))); |
| 1815 } |
| 1816 |
| 1817 for (GraphicsLayerDrawRects::const_iterator iter = glRects.begin(); iter !=
glRects.end(); ++iter) { |
| 1818 const GraphicsLayer* graphicsLayer = iter->key; |
| 1819 graphicsLayer->platformLayer()->setDrawFrameRequestRects(iter->value); |
| 1820 } |
| 1821 } |
| 1822 |
1761 void WebViewImpl::layout() | 1823 void WebViewImpl::layout() |
1762 { | 1824 { |
1763 TRACE_EVENT0("blink", "WebViewImpl::layout"); | 1825 TRACE_EVENT0("blink", "WebViewImpl::layout"); |
1764 if (!localFrameRootTemporary()) | 1826 if (!localFrameRootTemporary()) |
1765 return; | 1827 return; |
1766 | 1828 |
1767 PageWidgetDelegate::layout(m_page.get(), localFrameRootTemporary()->frame())
; | 1829 PageWidgetDelegate::layout(m_page.get(), localFrameRootTemporary()->frame())
; |
1768 updateLayerTreeBackgroundColor(); | 1830 updateLayerTreeBackgroundColor(); |
1769 | 1831 |
1770 for (size_t i = 0; i < m_linkHighlights.size(); ++i) | 1832 for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
1771 m_linkHighlights[i]->updateGeometry(); | 1833 m_linkHighlights[i]->updateGeometry(); |
1772 | 1834 |
| 1835 findDrawFrameRequestRects(m_page.get()); |
| 1836 |
1773 if (m_devToolsAgent) | 1837 if (m_devToolsAgent) |
1774 m_devToolsAgent->didLayout(); | 1838 m_devToolsAgent->didLayout(); |
1775 } | 1839 } |
1776 | 1840 |
1777 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) | 1841 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) |
1778 { | 1842 { |
1779 // This should only be used when compositing is not being used for this | 1843 // This should only be used when compositing is not being used for this |
1780 // WebView, and it is painting into the recording of its parent. | 1844 // WebView, and it is painting into the recording of its parent. |
1781 ASSERT(!isAcceleratedCompositingActive()); | 1845 ASSERT(!isAcceleratedCompositingActive()); |
1782 | 1846 |
(...skipping 2324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4107 WebSize scrollOffset = mainFrame()->scrollOffset(); | 4171 WebSize scrollOffset = mainFrame()->scrollOffset(); |
4108 scrollOffset.width += scrollDelta.width; | 4172 scrollOffset.width += scrollDelta.width; |
4109 scrollOffset.height += scrollDelta.height; | 4173 scrollOffset.height += scrollDelta.height; |
4110 | 4174 |
4111 WebPoint scrollPoint(scrollOffset.width, scrollOffset.height); | 4175 WebPoint scrollPoint(scrollOffset.width, scrollOffset.height); |
4112 setPageScaleFactor(pageScaleFactor() * pageScaleDelta, scrollPoint); | 4176 setPageScaleFactor(pageScaleFactor() * pageScaleDelta, scrollPoint); |
4113 m_doubleTapZoomPending = false; | 4177 m_doubleTapZoomPending = false; |
4114 } | 4178 } |
4115 } | 4179 } |
4116 | 4180 |
| 4181 void WebViewImpl::recordDrawTiming(int64_t FrameId, const WebVector<std::pair<in
t, double> >& draws) |
| 4182 { |
| 4183 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
| 4184 return; |
| 4185 |
| 4186 Frame* frame = m_page ? m_page->mainFrame() : 0; |
| 4187 |
| 4188 while (frame && frame->frameID() != FrameId) { |
| 4189 frame = frame->tree().traverseNext(); |
| 4190 } |
| 4191 |
| 4192 if (!frame) |
| 4193 return; // ASSERT? Other way to report error? |
| 4194 |
| 4195 ASSERT(frame->isLocalFrame()); |
| 4196 |
| 4197 WebCore::LocalDOMWindow* domWindow = toLocalFrame(frame)->domWindow(); |
| 4198 WebCore::Performance& performance = domWindow->performance(); |
| 4199 for (size_t i = 0; i < draws.size(); ++i) { |
| 4200 performance.addDrawTiming(domWindow->document(), draws[i].first, draws[i
].second); |
| 4201 } |
| 4202 } |
| 4203 |
4117 void WebViewImpl::updateLayerTreeViewport() | 4204 void WebViewImpl::updateLayerTreeViewport() |
4118 { | 4205 { |
4119 if (!page() || !m_layerTreeView) | 4206 if (!page() || !m_layerTreeView) |
4120 return; | 4207 return; |
4121 | 4208 |
4122 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumPageS
caleFactor(), maximumPageScaleFactor()); | 4209 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumPageS
caleFactor(), maximumPageScaleFactor()); |
4123 } | 4210 } |
4124 | 4211 |
4125 void WebViewImpl::updateLayerTreeBackgroundColor() | 4212 void WebViewImpl::updateLayerTreeBackgroundColor() |
4126 { | 4213 { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4253 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); | 4340 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); |
4254 | 4341 |
4255 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4342 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
4256 return false; | 4343 return false; |
4257 | 4344 |
4258 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4345 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4259 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4346 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
4260 } | 4347 } |
4261 | 4348 |
4262 } // namespace blink | 4349 } // namespace blink |
OLD | NEW |