Chromium Code Reviews| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 #include "core/page/EventWithHitTestResults.h" | 72 #include "core/page/EventWithHitTestResults.h" |
| 73 #include "core/page/FocusController.h" | 73 #include "core/page/FocusController.h" |
| 74 #include "core/page/FrameTree.h" | 74 #include "core/page/FrameTree.h" |
| 75 #include "core/page/InjectedStyleSheets.h" | 75 #include "core/page/InjectedStyleSheets.h" |
| 76 #include "core/page/Page.h" | 76 #include "core/page/Page.h" |
| 77 #include "core/page/PagePopupClient.h" | 77 #include "core/page/PagePopupClient.h" |
| 78 #include "core/page/PointerLockController.h" | 78 #include "core/page/PointerLockController.h" |
| 79 #include "core/page/ScopedPageLoadDeferrer.h" | 79 #include "core/page/ScopedPageLoadDeferrer.h" |
| 80 #include "core/page/TouchDisambiguation.h" | 80 #include "core/page/TouchDisambiguation.h" |
| 81 #include "core/rendering/FastTextAutosizer.h" | 81 #include "core/rendering/FastTextAutosizer.h" |
| 82 #include "core/rendering/RenderGeometryMap.h" | |
| 82 #include "core/rendering/RenderView.h" | 83 #include "core/rendering/RenderView.h" |
| 83 #include "core/rendering/RenderWidget.h" | 84 #include "core/rendering/RenderWidget.h" |
| 84 #include "core/rendering/TextAutosizer.h" | 85 #include "core/rendering/TextAutosizer.h" |
| 86 #include "core/rendering/compositing/CompositedLayerMapping.h" | |
| 85 #include "core/rendering/compositing/RenderLayerCompositor.h" | 87 #include "core/rendering/compositing/RenderLayerCompositor.h" |
| 88 #include "core/timing/Performance.h" | |
| 86 #include "modules/device_orientation/DeviceOrientationInspectorAgent.h" | 89 #include "modules/device_orientation/DeviceOrientationInspectorAgent.h" |
| 87 #include "modules/encryptedmedia/MediaKeysController.h" | 90 #include "modules/encryptedmedia/MediaKeysController.h" |
| 88 #include "modules/filesystem/InspectorFileSystemAgent.h" | 91 #include "modules/filesystem/InspectorFileSystemAgent.h" |
| 89 #include "modules/indexeddb/InspectorIndexedDBAgent.h" | 92 #include "modules/indexeddb/InspectorIndexedDBAgent.h" |
| 90 #include "modules/push_messaging/PushController.h" | 93 #include "modules/push_messaging/PushController.h" |
| 91 #include "platform/ContextMenu.h" | 94 #include "platform/ContextMenu.h" |
| 92 #include "platform/ContextMenuItem.h" | 95 #include "platform/ContextMenuItem.h" |
| 93 #include "platform/Cursor.h" | 96 #include "platform/Cursor.h" |
| 94 #include "platform/KeyboardCodes.h" | 97 #include "platform/KeyboardCodes.h" |
| 95 #include "platform/NotImplemented.h" | 98 #include "platform/NotImplemented.h" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 113 #include "public/platform/WebDragData.h" | 116 #include "public/platform/WebDragData.h" |
| 114 #include "public/platform/WebFloatPoint.h" | 117 #include "public/platform/WebFloatPoint.h" |
| 115 #include "public/platform/WebGestureCurve.h" | 118 #include "public/platform/WebGestureCurve.h" |
| 116 #include "public/platform/WebImage.h" | 119 #include "public/platform/WebImage.h" |
| 117 #include "public/platform/WebLayerTreeView.h" | 120 #include "public/platform/WebLayerTreeView.h" |
| 118 #include "public/platform/WebURLRequest.h" | 121 #include "public/platform/WebURLRequest.h" |
| 119 #include "public/platform/WebVector.h" | 122 #include "public/platform/WebVector.h" |
| 120 #include "public/web/WebAXObject.h" | 123 #include "public/web/WebAXObject.h" |
| 121 #include "public/web/WebActiveWheelFlingParameters.h" | 124 #include "public/web/WebActiveWheelFlingParameters.h" |
| 122 #include "public/web/WebAutofillClient.h" | 125 #include "public/web/WebAutofillClient.h" |
| 126 #include "public/web/WebFrame.h" | |
| 123 #include "public/web/WebFrameClient.h" | 127 #include "public/web/WebFrameClient.h" |
| 124 #include "public/web/WebHitTestResult.h" | 128 #include "public/web/WebHitTestResult.h" |
| 125 #include "public/web/WebInputElement.h" | 129 #include "public/web/WebInputElement.h" |
| 126 #include "public/web/WebMediaPlayerAction.h" | 130 #include "public/web/WebMediaPlayerAction.h" |
| 127 #include "public/web/WebNode.h" | 131 #include "public/web/WebNode.h" |
| 132 #include "public/web/WebPerformance.h" | |
| 128 #include "public/web/WebPlugin.h" | 133 #include "public/web/WebPlugin.h" |
| 129 #include "public/web/WebPluginAction.h" | 134 #include "public/web/WebPluginAction.h" |
| 130 #include "public/web/WebRange.h" | 135 #include "public/web/WebRange.h" |
| 131 #include "public/web/WebTextInputInfo.h" | 136 #include "public/web/WebTextInputInfo.h" |
| 132 #include "public/web/WebViewClient.h" | 137 #include "public/web/WebViewClient.h" |
| 133 #include "public/web/WebWindowFeatures.h" | 138 #include "public/web/WebWindowFeatures.h" |
| 134 #include "web/CompositionUnderlineVectorBuilder.h" | 139 #include "web/CompositionUnderlineVectorBuilder.h" |
| 135 #include "web/ContextFeaturesClientImpl.h" | 140 #include "web/ContextFeaturesClientImpl.h" |
| 136 #include "web/DatabaseClientImpl.h" | 141 #include "web/DatabaseClientImpl.h" |
| 137 #include "web/FullscreenController.h" | 142 #include "web/FullscreenController.h" |
| (...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1748 return; | 1753 return; |
| 1749 | 1754 |
| 1750 PageWidgetDelegate::animate(m_page.get(), monotonicFrameBeginTime); | 1755 PageWidgetDelegate::animate(m_page.get(), monotonicFrameBeginTime); |
| 1751 | 1756 |
| 1752 if (m_continuousPaintingEnabled) { | 1757 if (m_continuousPaintingEnabled) { |
| 1753 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, m_pageO verlays.get()); | 1758 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, m_pageO verlays.get()); |
| 1754 m_client->scheduleAnimation(); | 1759 m_client->scheduleAnimation(); |
| 1755 } | 1760 } |
| 1756 } | 1761 } |
| 1757 | 1762 |
| 1763 typedef WTF::HashMap<const GraphicsLayer*, std::vector<std::pair<int64_t, WebRec t> > > | |
| 1764 GraphicsLayerDrawRects; | |
| 1765 | |
| 1758 void WebViewImpl::layout() | 1766 void WebViewImpl::layout() |
| 1759 { | 1767 { |
| 1760 TRACE_EVENT0("blink", "WebViewImpl::layout"); | 1768 TRACE_EVENT0("blink", "WebViewImpl::layout"); |
| 1761 if (!localFrameRootTemporary()) | 1769 if (!localFrameRootTemporary()) |
| 1762 return; | 1770 return; |
| 1763 | 1771 |
| 1764 PageWidgetDelegate::layout(m_page.get(), localFrameRootTemporary()->frame()) ; | 1772 PageWidgetDelegate::layout(m_page.get(), localFrameRootTemporary()->frame()) ; |
| 1765 updateLayerTreeBackgroundColor(); | 1773 updateLayerTreeBackgroundColor(); |
| 1766 | 1774 |
| 1767 for (size_t i = 0; i < m_linkHighlights.size(); ++i) | 1775 for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
| 1768 m_linkHighlights[i]->updateGeometry(); | 1776 m_linkHighlights[i]->updateGeometry(); |
| 1769 | 1777 |
| 1778 GraphicsLayerDrawRects glRects; | |
| 1779 | |
| 1780 Frame* frame = m_page ? m_page->mainFrame() : 0; | |
| 1781 while (frame) { | |
|
chrishtr
2014/07/16 20:00:25
Random nit, but I would make this a for loop.
| |
| 1782 if (!frame->isLocalFrame()) { | |
| 1783 frame = frame->tree().traverseNext(); | |
| 1784 continue; | |
| 1785 } | |
| 1786 LocalFrame* localframe = toLocalFrame(frame); | |
| 1787 | |
| 1788 const GraphicsLayer* graphicsLayer = | |
| 1789 localframe->document()->renderView()->enclosingLayer() | |
| 1790 ->enclosingLayerForPaintInvalidationCrossingFrameBoundaries() | |
| 1791 ->graphicsLayerBackingForScrolling(); | |
| 1792 | |
| 1793 // Find frame's rect in graphics layer space | |
| 1794 LayoutRect rect = | |
| 1795 localframe->contentRenderer()->rectForPaintInvalidation(); | |
| 1796 RenderLayerModelObject* paintInvalidationContainer = | |
| 1797 localframe->contentRenderer()->enclosingLayer() | |
| 1798 ->enclosingLayerForPaintInvalidationCrossingFrameBoundaries() | |
| 1799 ->renderer(); | |
| 1800 RenderLayer::mapRectToPaintBackingCoordinates(paintInvalidationContainer , rect); | |
|
chrishtr
2014/07/16 20:00:25
This looks right.
| |
| 1801 | |
| 1802 GraphicsLayerDrawRects::iterator glIter = glRects.find(graphicsLayer); | |
| 1803 std::vector<std::pair<int64_t, WebRect> > *glVector; | |
| 1804 if (glIter == glRects.end()) { | |
| 1805 glVector = &glRects.add(graphicsLayer, | |
| 1806 std::vector<std::pair<int64_t, WebRect> >()).storedValue->value; | |
| 1807 } else { | |
| 1808 glVector = &glIter->value; | |
| 1809 } | |
| 1810 glVector->push_back(std::make_pair(frame->frameID(), enclosingIntRect(re ct))); | |
| 1811 | |
| 1812 frame = frame->tree().traverseNext(); | |
| 1813 } | |
| 1814 | |
| 1815 for (GraphicsLayerDrawRects::const_iterator iter = glRects.begin(); iter != glRects.end(); ++iter) { | |
| 1816 const GraphicsLayer* graphicsLayer = iter->key; | |
| 1817 graphicsLayer->platformLayer()->setDrawFrameRequestRects(iter->value); | |
| 1818 } | |
| 1819 | |
| 1770 if (m_devToolsAgent) | 1820 if (m_devToolsAgent) |
| 1771 m_devToolsAgent->didLayout(); | 1821 m_devToolsAgent->didLayout(); |
| 1772 } | 1822 } |
| 1773 | 1823 |
| 1774 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) | 1824 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) |
| 1775 { | 1825 { |
| 1776 // This should only be used when compositing is not being used for this | 1826 // This should only be used when compositing is not being used for this |
| 1777 // WebView, and it is painting into the recording of its parent. | 1827 // WebView, and it is painting into the recording of its parent. |
| 1778 ASSERT(!isAcceleratedCompositingActive()); | 1828 ASSERT(!isAcceleratedCompositingActive()); |
| 1779 | 1829 |
| (...skipping 2313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4093 WebSize scrollOffset = mainFrame()->scrollOffset(); | 4143 WebSize scrollOffset = mainFrame()->scrollOffset(); |
| 4094 scrollOffset.width += scrollDelta.width; | 4144 scrollOffset.width += scrollDelta.width; |
| 4095 scrollOffset.height += scrollDelta.height; | 4145 scrollOffset.height += scrollDelta.height; |
| 4096 | 4146 |
| 4097 WebPoint scrollPoint(scrollOffset.width, scrollOffset.height); | 4147 WebPoint scrollPoint(scrollOffset.width, scrollOffset.height); |
| 4098 setPageScaleFactor(pageScaleFactor() * pageScaleDelta, scrollPoint); | 4148 setPageScaleFactor(pageScaleFactor() * pageScaleDelta, scrollPoint); |
| 4099 m_doubleTapZoomPending = false; | 4149 m_doubleTapZoomPending = false; |
| 4100 } | 4150 } |
| 4101 } | 4151 } |
| 4102 | 4152 |
| 4153 void WebViewImpl::recordDrawTiming(int64_t FrameId, const WebVector<std::pair<in t, double> >& draws) | |
| 4154 { | |
| 4155 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | |
| 4156 return; | |
| 4157 | |
| 4158 Frame* frame = m_page ? m_page->mainFrame() : 0; | |
| 4159 | |
| 4160 while (frame && frame->frameID() != FrameId) { | |
| 4161 frame = frame->tree().traverseNext(); | |
| 4162 } | |
| 4163 | |
| 4164 if (!frame) | |
| 4165 return; // ASSERT? Other way to report error? | |
| 4166 | |
| 4167 ASSERT(frame->isLocalFrame()); | |
| 4168 | |
| 4169 WebCore::LocalDOMWindow* domWindow = toLocalFrame(frame)->domWindow(); | |
| 4170 WebCore::Performance& performance = domWindow->performance(); | |
| 4171 for (size_t i = 0; i < draws.size(); ++i) { | |
| 4172 performance.addDrawTiming(domWindow->document(), draws[i].first, draws[i ].second); | |
| 4173 } | |
| 4174 } | |
| 4175 | |
| 4103 void WebViewImpl::updateLayerTreeViewport() | 4176 void WebViewImpl::updateLayerTreeViewport() |
| 4104 { | 4177 { |
| 4105 if (!page() || !m_layerTreeView) | 4178 if (!page() || !m_layerTreeView) |
| 4106 return; | 4179 return; |
| 4107 | 4180 |
| 4108 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumPageS caleFactor(), maximumPageScaleFactor()); | 4181 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumPageS caleFactor(), maximumPageScaleFactor()); |
| 4109 } | 4182 } |
| 4110 | 4183 |
| 4111 void WebViewImpl::updateLayerTreeBackgroundColor() | 4184 void WebViewImpl::updateLayerTreeBackgroundColor() |
| 4112 { | 4185 { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4239 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); | 4312 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); |
| 4240 | 4313 |
| 4241 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4314 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
| 4242 return false; | 4315 return false; |
| 4243 | 4316 |
| 4244 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4317 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
| 4245 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); | 4318 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); |
| 4246 } | 4319 } |
| 4247 | 4320 |
| 4248 } // namespace blink | 4321 } // namespace blink |
| OLD | NEW |