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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 #include "core/page/DragSession.h" | 80 #include "core/page/DragSession.h" |
| 81 #include "core/page/EventHandler.h" | 81 #include "core/page/EventHandler.h" |
| 82 #include "core/page/FocusController.h" | 82 #include "core/page/FocusController.h" |
| 83 #include "core/page/FrameTree.h" | 83 #include "core/page/FrameTree.h" |
| 84 #include "core/page/InjectedStyleSheets.h" | 84 #include "core/page/InjectedStyleSheets.h" |
| 85 #include "core/page/Page.h" | 85 #include "core/page/Page.h" |
| 86 #include "core/page/PagePopupClient.h" | 86 #include "core/page/PagePopupClient.h" |
| 87 #include "core/page/PointerLockController.h" | 87 #include "core/page/PointerLockController.h" |
| 88 #include "core/page/ScopedPageLoadDeferrer.h" | 88 #include "core/page/ScopedPageLoadDeferrer.h" |
| 89 #include "core/page/TouchDisambiguation.h" | 89 #include "core/page/TouchDisambiguation.h" |
| 90 #include "core/timing/DOMWindowPerformance.h" | |
| 91 #include "core/timing/Performance.h" | |
| 90 #include "modules/accessibility/AXObject.h" | 92 #include "modules/accessibility/AXObject.h" |
| 91 #include "modules/accessibility/AXObjectCacheImpl.h" | 93 #include "modules/accessibility/AXObjectCacheImpl.h" |
| 92 #include "modules/credentialmanager/CredentialManagerClient.h" | 94 #include "modules/credentialmanager/CredentialManagerClient.h" |
| 93 #include "modules/encryptedmedia/MediaKeysController.h" | 95 #include "modules/encryptedmedia/MediaKeysController.h" |
| 94 #include "modules/storage/StorageNamespaceController.h" | 96 #include "modules/storage/StorageNamespaceController.h" |
| 95 #include "platform/ContextMenu.h" | 97 #include "platform/ContextMenu.h" |
| 96 #include "platform/ContextMenuItem.h" | 98 #include "platform/ContextMenuItem.h" |
| 97 #include "platform/Cursor.h" | 99 #include "platform/Cursor.h" |
| 98 #include "platform/KeyboardCodes.h" | 100 #include "platform/KeyboardCodes.h" |
| 99 #include "platform/Logging.h" | 101 #include "platform/Logging.h" |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 119 #include "public/platform/WebFloatPoint.h" | 121 #include "public/platform/WebFloatPoint.h" |
| 120 #include "public/platform/WebGestureCurve.h" | 122 #include "public/platform/WebGestureCurve.h" |
| 121 #include "public/platform/WebImage.h" | 123 #include "public/platform/WebImage.h" |
| 122 #include "public/platform/WebLayerTreeView.h" | 124 #include "public/platform/WebLayerTreeView.h" |
| 123 #include "public/platform/WebURLRequest.h" | 125 #include "public/platform/WebURLRequest.h" |
| 124 #include "public/platform/WebVector.h" | 126 #include "public/platform/WebVector.h" |
| 125 #include "public/web/WebAXObject.h" | 127 #include "public/web/WebAXObject.h" |
| 126 #include "public/web/WebActiveWheelFlingParameters.h" | 128 #include "public/web/WebActiveWheelFlingParameters.h" |
| 127 #include "public/web/WebAutofillClient.h" | 129 #include "public/web/WebAutofillClient.h" |
| 128 #include "public/web/WebBeginFrameArgs.h" | 130 #include "public/web/WebBeginFrameArgs.h" |
| 131 #include "public/web/WebFrame.h" | |
| 129 #include "public/web/WebFrameClient.h" | 132 #include "public/web/WebFrameClient.h" |
| 130 #include "public/web/WebHitTestResult.h" | 133 #include "public/web/WebHitTestResult.h" |
| 131 #include "public/web/WebInputElement.h" | 134 #include "public/web/WebInputElement.h" |
| 132 #include "public/web/WebMediaPlayerAction.h" | 135 #include "public/web/WebMediaPlayerAction.h" |
| 133 #include "public/web/WebNode.h" | 136 #include "public/web/WebNode.h" |
| 134 #include "public/web/WebPlugin.h" | 137 #include "public/web/WebPlugin.h" |
| 135 #include "public/web/WebPluginAction.h" | 138 #include "public/web/WebPluginAction.h" |
| 136 #include "public/web/WebRange.h" | 139 #include "public/web/WebRange.h" |
| 137 #include "public/web/WebTextInputInfo.h" | 140 #include "public/web/WebTextInputInfo.h" |
| 138 #include "public/web/WebViewClient.h" | 141 #include "public/web/WebViewClient.h" |
| (...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1929 // FIXME: This should probably be using the local root? | 1932 // FIXME: This should probably be using the local root? |
| 1930 if (m_page->mainFrame()->isLocalFrame()) | 1933 if (m_page->mainFrame()->isLocalFrame()) |
| 1931 PageWidgetDelegate::animate(*m_page, validFrameTime.lastFrameTimeMonoton ic, *m_page->deprecatedLocalMainFrame()); | 1934 PageWidgetDelegate::animate(*m_page, validFrameTime.lastFrameTimeMonoton ic, *m_page->deprecatedLocalMainFrame()); |
| 1932 | 1935 |
| 1933 if (m_continuousPaintingEnabled) { | 1936 if (m_continuousPaintingEnabled) { |
| 1934 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, m_pageO verlays.get()); | 1937 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, m_pageO verlays.get()); |
| 1935 m_client->scheduleAnimation(); | 1938 m_client->scheduleAnimation(); |
| 1936 } | 1939 } |
| 1937 } | 1940 } |
| 1938 | 1941 |
| 1942 static void pushFrameTimingRequestRectsToGraphicsLayer(Page* page) | |
| 1943 { | |
| 1944 typedef WTF::HashMap<const GraphicsLayer*, | |
| 1945 std::vector<std::pair<int64_t, WebRect>>> | |
| 1946 GraphicsLayerFrameTimingRequests; | |
| 1947 | |
| 1948 GraphicsLayerFrameTimingRequests glRequests; | |
| 1949 | |
| 1950 for (Frame* frame = page ? page->mainFrame() : 0; frame; | |
| 1951 frame = frame->tree().traverseNext()) { | |
| 1952 | |
| 1953 // Need a LocalFrame to get the GraphicsLayer to use. | |
| 1954 if (!frame->isLocalFrame()) | |
| 1955 continue; | |
| 1956 | |
| 1957 LocalFrame* localframe = toLocalFrame(frame); | |
| 1958 Document* document = localframe->document(); | |
| 1959 HTMLFrameOwnerElement* ownerElement = document->ownerElement(); | |
| 1960 | |
| 1961 const GraphicsLayer* graphicsLayer; | |
| 1962 | |
| 1963 // Find frame's rect in graphics layer space | |
| 1964 LayoutRect rect = localframe->contentRenderer()->viewRect(); | |
| 1965 Layer::mapRectToPaintInvalidationBacking(localframe->contentRenderer(), | |
| 1966 localframe->contentRenderer()->containerForPaintInvalidation(), | |
| 1967 rect); | |
| 1968 | |
| 1969 if (document->layoutView()->enclosingLayer()->compositingState() | |
|
chrishtr
2015/03/27 01:13:02
Why do you need this complicated conditional inste
MikeB
2015/04/14 18:05:46
I can't find us actually going back and forth last
| |
| 1970 == PaintsIntoOwnBacking || !ownerElement) { | |
| 1971 graphicsLayer = document->layoutView()->enclosingLayer() | |
| 1972 ->enclosingLayerForPaintInvalidationCrossingFrameBoundaries() | |
| 1973 ->graphicsLayerBacking(); | |
| 1974 } else { | |
| 1975 if (!ownerElement->layoutObject()) | |
| 1976 continue; | |
| 1977 graphicsLayer = ownerElement->layoutObject()->enclosingLayer() | |
| 1978 ->enclosingLayerForPaintInvalidationCrossingFrameBoundaries() | |
| 1979 ->graphicsLayerBacking(); | |
| 1980 | |
| 1981 Layer::mapRectToPaintInvalidationBacking( | |
| 1982 ownerElement->layoutObject(), | |
| 1983 ownerElement->layoutObject()->containerForPaintInvalidation(), | |
| 1984 rect); | |
| 1985 } | |
| 1986 | |
| 1987 GraphicsLayerFrameTimingRequests::iterator glIter = glRequests.find(grap hicsLayer); | |
|
chrishtr
2015/03/27 01:13:02
s/glIter/requestIterator/
MikeB
2015/04/14 18:05:46
Done.
| |
| 1988 std::vector<std::pair<int64_t, WebRect>> *glVector; | |
|
chrishtr
2015/03/27 01:13:03
s/glVector/graphicsLayerTimingRect/
MikeB
2015/04/14 18:05:46
Done.
| |
| 1989 if (glIter == glRequests.end()) { | |
| 1990 glVector = &glRequests.add(graphicsLayer, | |
| 1991 std::vector<std::pair<int64_t, WebRect>>()).storedValue->value; | |
| 1992 } else { | |
| 1993 glVector = &glIter->value; | |
| 1994 } | |
| 1995 glVector->push_back(std::make_pair(frame->frameID(), enclosingIntRect(re ct))); | |
| 1996 } | |
| 1997 | |
| 1998 for (GraphicsLayerFrameTimingRequests::const_iterator iter = glRequests.begi n(); iter != glRequests.end(); ++iter) { | |
| 1999 const GraphicsLayer* graphicsLayer = iter->key; | |
| 2000 graphicsLayer->platformLayer()->setFrameTimingRequests(iter->value); | |
| 2001 } | |
| 2002 } | |
| 2003 | |
| 1939 void WebViewImpl::layout() | 2004 void WebViewImpl::layout() |
| 1940 { | 2005 { |
| 1941 TRACE_EVENT0("blink", "WebViewImpl::layout"); | 2006 TRACE_EVENT0("blink", "WebViewImpl::layout"); |
| 1942 if (!mainFrameImpl()) | 2007 if (!mainFrameImpl()) |
| 1943 return; | 2008 return; |
| 1944 | 2009 |
| 1945 PageWidgetDelegate::layout(*m_page, *mainFrameImpl()->frame()); | 2010 PageWidgetDelegate::layout(*m_page, *mainFrameImpl()->frame()); |
| 1946 updateLayerTreeBackgroundColor(); | 2011 updateLayerTreeBackgroundColor(); |
| 1947 | 2012 |
| 1948 for (size_t i = 0; i < m_linkHighlights.size(); ++i) | 2013 for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
| 1949 m_linkHighlights[i]->updateGeometry(); | 2014 m_linkHighlights[i]->updateGeometry(); |
| 2015 | |
| 2016 pushFrameTimingRequestRectsToGraphicsLayer(m_page.get()); | |
| 1950 } | 2017 } |
| 1951 | 2018 |
| 1952 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) | 2019 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) |
| 1953 { | 2020 { |
| 1954 // This should only be used when compositing is not being used for this | 2021 // This should only be used when compositing is not being used for this |
| 1955 // WebView, and it is painting into the recording of its parent. | 2022 // WebView, and it is painting into the recording of its parent. |
| 1956 ASSERT(!isAcceleratedCompositingActive()); | 2023 ASSERT(!isAcceleratedCompositingActive()); |
| 1957 | 2024 |
| 1958 double paintStart = currentTime(); | 2025 double paintStart = currentTime(); |
| 1959 PageWidgetDelegate::paint(*m_page, pageOverlays(), canvas, rect, *m_page->de precatedLocalMainFrame()); | 2026 PageWidgetDelegate::paint(*m_page, pageOverlays(), canvas, rect, *m_page->de precatedLocalMainFrame()); |
| (...skipping 2539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4499 WebSize scrollOffset = mainFrame()->scrollOffset(); | 4566 WebSize scrollOffset = mainFrame()->scrollOffset(); |
| 4500 scrollOffset.width += scrollDelta.width; | 4567 scrollOffset.width += scrollDelta.width; |
| 4501 scrollOffset.height += scrollDelta.height; | 4568 scrollOffset.height += scrollDelta.height; |
| 4502 | 4569 |
| 4503 WebPoint scrollPoint(scrollOffset.width, scrollOffset.height); | 4570 WebPoint scrollPoint(scrollOffset.width, scrollOffset.height); |
| 4504 setPageScaleFactor(pageScaleFactor() * pageScaleDelta, scrollPoint); | 4571 setPageScaleFactor(pageScaleFactor() * pageScaleDelta, scrollPoint); |
| 4505 m_doubleTapZoomPending = false; | 4572 m_doubleTapZoomPending = false; |
| 4506 } | 4573 } |
| 4507 } | 4574 } |
| 4508 | 4575 |
| 4576 void WebViewImpl::recordFrameTimingEvent(FrameTimingEventType eventType, int64_t FrameId, const WebVector<std::pair<int, double>>& events) | |
| 4577 { | |
| 4578 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | |
|
chrishtr
2015/03/27 01:13:03
In what situation do you need this conditional?
MikeB
2015/04/14 18:05:45
Most of the routines in this file (at least, the o
| |
| 4579 return; | |
| 4580 | |
| 4581 Frame* frame = m_page ? m_page->mainFrame() : 0; | |
|
chrishtr
2015/03/27 01:13:03
Ditto.
MikeB
2015/04/14 18:05:46
For this one, I don't feel comfortable dereferenci
| |
| 4582 | |
| 4583 while (frame && frame->frameID() != FrameId) { | |
| 4584 frame = frame->tree().traverseNext(); | |
| 4585 } | |
| 4586 | |
| 4587 if (!frame || !frame->domWindow() || !frame->domWindow()->document()) | |
| 4588 return; // ASSERT? Other way to report error? | |
|
chrishtr
2015/03/27 01:13:03
Is the frameID supposed to be guaranteed to exist?
MikeB
2015/04/14 18:05:46
No, there is a possibility that the frame has sinc
| |
| 4589 | |
| 4590 ASSERT(frame->isLocalFrame()); | |
|
chrishtr
2015/03/27 01:13:03
Why is this guaranteed?
MikeB
2015/04/14 18:05:46
No longer required. I was using localframe-only AP
| |
| 4591 | |
| 4592 blink::DOMWindow* domWindow = frame->domWindow(); | |
| 4593 blink::Performance* performance = DOMWindowPerformance::performance(*domWind ow); | |
| 4594 for (size_t i = 0; i < events.size(); ++i) { | |
| 4595 if (eventType == CompositeEvent) | |
| 4596 performance->addCompositeTiming(domWindow->document(), events[i].fir st, events[i].second); | |
| 4597 else if (eventType == RenderEvent) | |
| 4598 performance->addRenderTiming(domWindow->document(), events[i].first, events[i].second); | |
| 4599 } | |
| 4600 } | |
| 4601 | |
| 4509 void WebViewImpl::updateLayerTreeViewport() | 4602 void WebViewImpl::updateLayerTreeViewport() |
| 4510 { | 4603 { |
| 4511 if (!page() || !m_layerTreeView) | 4604 if (!page() || !m_layerTreeView) |
| 4512 return; | 4605 return; |
| 4513 | 4606 |
| 4514 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumPageS caleFactor(), maximumPageScaleFactor()); | 4607 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumPageS caleFactor(), maximumPageScaleFactor()); |
| 4515 } | 4608 } |
| 4516 | 4609 |
| 4517 void WebViewImpl::updateLayerTreeBackgroundColor() | 4610 void WebViewImpl::updateLayerTreeBackgroundColor() |
| 4518 { | 4611 { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4659 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4752 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
| 4660 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); | 4753 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); |
| 4661 } | 4754 } |
| 4662 | 4755 |
| 4663 void WebViewImpl::forceNextWebGLContextCreationToFail() | 4756 void WebViewImpl::forceNextWebGLContextCreationToFail() |
| 4664 { | 4757 { |
| 4665 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); | 4758 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); |
| 4666 } | 4759 } |
| 4667 | 4760 |
| 4668 } // namespace blink | 4761 } // namespace blink |
| OLD | NEW |