| Index: Source/web/WebViewImpl.cpp
|
| diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
|
| index 03a17e4291a42a38a598eb6315447ce66eea4a2f..ae1b4e20767eb6c8079a13eced7c466f5f1cc0ff 100644
|
| --- a/Source/web/WebViewImpl.cpp
|
| +++ b/Source/web/WebViewImpl.cpp
|
| @@ -49,6 +49,7 @@
|
| #include "core/frame/FrameView.h"
|
| #include "core/frame/LocalFrame.h"
|
| #include "core/frame/PinchViewport.h"
|
| +#include "core/frame/RemoteFrame.h"
|
| #include "core/frame/Settings.h"
|
| #include "core/frame/SmartClip.h"
|
| #include "core/html/HTMLInputElement.h"
|
| @@ -316,9 +317,11 @@ void WebView::didExitModalLoop()
|
| void WebViewImpl::setMainFrame(WebFrame* frame)
|
| {
|
| if (frame->isWebLocalFrame())
|
| - toWebLocalFrameImpl(frame)->initializeAsMainFrame(page());
|
| - else
|
| - toWebRemoteFrameImpl(frame)->initializeAsMainFrame(page());
|
| + toWebLocalFrameImpl(frame)->initializeWebCoreFrame(&page()->frameHost(), 0, nullAtom, nullAtom);
|
| + else {
|
| + m_baseBackgroundColor = Color::darkGray;
|
| + toWebRemoteFrameImpl(frame)->initializeWebCoreFrame(&page()->frameHost(), 0, nullAtom);
|
| + }
|
| }
|
|
|
| void WebViewImpl::setAutofillClient(WebAutofillClient* autofillClient)
|
| @@ -446,6 +449,16 @@ WebLocalFrameImpl* WebViewImpl::mainFrameImpl()
|
| return m_page && m_page->mainFrame() && m_page->mainFrame()->isLocalFrame() ? WebLocalFrameImpl::fromFrame(m_page->deprecatedLocalMainFrame()) : 0;
|
| }
|
|
|
| +WebLocalFrameImpl* WebViewImpl::localRootFrame()
|
| +{
|
| + for (WebCore::Frame* frame = page()->mainFrame()->tree().top(); frame; frame = frame->tree().traverseNext()) {
|
| + if (frame->isLocalRoot()) {
|
| + return WebLocalFrameImpl::fromFrame(toLocalFrame(frame));
|
| + }
|
| + }
|
| + return 0;
|
| +}
|
| +
|
| bool WebViewImpl::tabKeyCyclesThroughElements() const
|
| {
|
| ASSERT(m_page);
|
| @@ -1030,8 +1043,10 @@ bool WebViewImpl::handleCharEvent(const WebKeyboardEvent& event)
|
|
|
| WebRect WebViewImpl::computeBlockBounds(const WebRect& rect, bool ignoreClipping)
|
| {
|
| - if (!mainFrameImpl())
|
| + if (!mainFrameImpl()) {
|
| + printf("WVI::computeBlockBounds: null mainFrameImpl\n");
|
| return WebRect();
|
| + }
|
|
|
| // Use the rect-based hit test to find the node.
|
| IntPoint point = mainFrameImpl()->frameView()->windowToContents(IntPoint(rect.x, rect.y));
|
| @@ -1581,12 +1596,25 @@ void WebViewImpl::resizePinchViewport(const WebSize& newSize)
|
|
|
| void WebViewImpl::resize(const WebSize& newSize)
|
| {
|
| - if (m_shouldAutoResize || m_size == newSize)
|
| + printf("WebViewImpl::resize: %dx%d\n", newSize.width, newSize.height);
|
| + if (m_shouldAutoResize || m_size == newSize) {
|
| + printf("WebViewImpl::resize: auto or same\n");
|
| return;
|
| + }
|
|
|
| - FrameView* view = mainFrameImpl()->frameView();
|
| - if (!view)
|
| + /*
|
| + if (!mainFrameImpl()) {
|
| + printf("WCI::resize: null mainFrameImpl\n");
|
| return;
|
| + }
|
| + */
|
| + WebLocalFrameImpl* mainFrameImpl = localRootFrame();
|
| +
|
| + FrameView* view = mainFrameImpl->frameView();
|
| + if (!view) {
|
| + printf("WebViewImpl::resize: no view\n");
|
| + return;
|
| + }
|
|
|
| WebSize oldSize = m_size;
|
| float oldPageScaleFactor = pageScaleFactor();
|
| @@ -1597,7 +1625,7 @@ void WebViewImpl::resize(const WebSize& newSize)
|
| bool shouldAnchorAndRescaleViewport = settings()->mainFrameResizesAreOrientationChanges()
|
| && oldSize.width && oldContentsWidth && newSize.width != oldSize.width && !m_fullscreenController->isFullscreen();
|
|
|
| - ViewportAnchor viewportAnchor(&mainFrameImpl()->frame()->eventHandler());
|
| + ViewportAnchor viewportAnchor(&mainFrameImpl->frame()->eventHandler());
|
| if (shouldAnchorAndRescaleViewport) {
|
| viewportAnchor.setAnchor(view->visibleContentRect(),
|
| FloatSize(viewportAnchorXCoord, viewportAnchorYCoord));
|
| @@ -1605,17 +1633,17 @@ void WebViewImpl::resize(const WebSize& newSize)
|
|
|
| {
|
| // Avoids unnecessary invalidations while various bits of state in FastTextAutosizer are updated.
|
| - FastTextAutosizer::DeferUpdatePageInfo deferUpdatePageInfo(page());
|
| + //FastTextAutosizer::DeferUpdatePageInfo deferUpdatePageInfo(page());
|
|
|
| m_pageScaleConstraintsSet.didChangeViewSize(m_size);
|
|
|
| - updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->viewportDescription());
|
| + updatePageDefinedViewportConstraints(mainFrameImpl->frame()->document()->viewportDescription());
|
| updateMainFrameLayoutSize();
|
|
|
| // If the virtual viewport pinch mode is enabled, the main frame will be resized
|
| // after layout so it can be sized to the contentsSize.
|
| - if (!pinchVirtualViewportEnabled() && mainFrameImpl()->frameView())
|
| - mainFrameImpl()->frameView()->resize(m_size);
|
| + if (!pinchVirtualViewportEnabled() && mainFrameImpl->frameView())
|
| + mainFrameImpl->frameView()->resize(m_size);
|
|
|
| if (pinchVirtualViewportEnabled())
|
| page()->frameHost().pinchViewport().setSize(m_size);
|
| @@ -1626,7 +1654,7 @@ void WebViewImpl::resize(const WebSize& newSize)
|
| // and thus will not be invalidated in |FrameView::performPreLayoutTasks|.
|
| // Therefore we should force explicit media queries invalidation here.
|
| if (page()->inspectorController().deviceEmulationEnabled()) {
|
| - if (Document* document = mainFrameImpl()->frame()->document())
|
| + if (Document* document = mainFrameImpl->frame()->document())
|
| document->mediaQueryAffectingValueChanged();
|
| }
|
| }
|
| @@ -2106,7 +2134,11 @@ WebTextInputInfo WebViewImpl::textInputInfo()
|
| {
|
| WebTextInputInfo info;
|
|
|
| - LocalFrame* focused = toLocalFrame(focusedWebCoreFrame());
|
| + Frame* focusedFrame = focusedWebCoreFrame();
|
| + if (focusedFrame->isRemoteFrame())
|
| + return info;
|
| +
|
| + LocalFrame* focused = toLocalFrame(focusedFrame);
|
| if (!focused)
|
| return info;
|
|
|
| @@ -2232,7 +2264,11 @@ WebString WebViewImpl::inputModeOfFocusedElement()
|
|
|
| bool WebViewImpl::selectionBounds(WebRect& anchor, WebRect& focus) const
|
| {
|
| - const LocalFrame* frame = toLocalFrame(focusedWebCoreFrame());
|
| + const Frame* local_frame = focusedWebCoreFrame();
|
| + if (local_frame && local_frame->isRemoteFrame())
|
| + return false;
|
| +
|
| + const LocalFrame* frame = toLocalFrame(local_frame);
|
| if (!frame)
|
| return false;
|
| FrameSelection& selection = frame->selection();
|
| @@ -2521,7 +2557,10 @@ WebFrame* WebViewImpl::findFrameByName(
|
|
|
| WebFrame* WebViewImpl::focusedFrame()
|
| {
|
| - return WebLocalFrameImpl::fromFrame(toLocalFrame(focusedWebCoreFrame()));
|
| + Frame* frame = focusedWebCoreFrame();
|
| + if (frame->isRemoteFrame())
|
| + return WebRemoteFrameImpl::fromFrame(toRemoteFrame(*frame));
|
| + return WebLocalFrameImpl::fromFrame(toLocalFrame(frame));
|
| }
|
|
|
| void WebViewImpl::setFocusedFrame(WebFrame* frame)
|
| @@ -2869,10 +2908,13 @@ void WebViewImpl::setUserAgentPageScaleConstraints(PageScaleConstraints newConst
|
|
|
| m_pageScaleConstraintsSet.setUserAgentConstraints(newConstraints);
|
|
|
| - if (!mainFrameImpl() || !mainFrameImpl()->frameView())
|
| + WebLocalFrameImpl* mainFrameImpl = localRootFrame();
|
| + if (!mainFrameImpl || !mainFrameImpl->frameView()) {
|
| + printf("WCI::setUserAgentPageScaleConstraints: %p\n", mainFrameImpl);
|
| return;
|
| + }
|
|
|
| - mainFrameImpl()->frameView()->setNeedsLayout();
|
| + mainFrameImpl->frameView()->setNeedsLayout();
|
| }
|
|
|
| void WebViewImpl::setInitialPageScaleOverride(float initialPageScaleFactorOverride)
|
| @@ -2910,11 +2952,20 @@ void WebViewImpl::setIgnoreViewportTagScaleLimits(bool ignore)
|
|
|
| void WebViewImpl::refreshPageScaleFactorAfterLayout()
|
| {
|
| - if (!mainFrame() || !page() || !page()->mainFrame() || !page()->mainFrame()->isLocalFrame() || !page()->deprecatedLocalMainFrame()->view())
|
| + /*
|
| + if (!mainFrame() || !page() || !page()->mainFrame() || !page()->mainFrame()->isLocalFrame() || !page()->deprecatedLocalMainFrame()->view()) {
|
| + printf("WebViewImpl::refreshPageScaleFactorAfterLayout: returning due to framing\n");
|
| return;
|
| - FrameView* view = page()->deprecatedLocalMainFrame()->view();
|
| + }
|
| + */
|
| + WebLocalFrameImpl* mainFrameImpl = localRootFrame();
|
| + if (!mainFrameImpl->frameView()) {
|
| + printf("WebViewImpl::refreshPageScaleFactorAfterLayout: returning no view\n");
|
| + return;
|
| + }
|
| + FrameView* view = mainFrameImpl->frameView();
|
|
|
| - updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->viewportDescription());
|
| + updatePageDefinedViewportConstraints(mainFrameImpl->frame()->document()->viewportDescription());
|
| m_pageScaleConstraintsSet.computeFinalConstraints();
|
|
|
| if (settings()->shrinksViewportContentToFit() && !m_fixedLayoutSizeLock) {
|
| @@ -2925,7 +2976,7 @@ void WebViewImpl::refreshPageScaleFactorAfterLayout()
|
| }
|
|
|
| if (pinchVirtualViewportEnabled())
|
| - mainFrameImpl()->frameView()->resize(m_pageScaleConstraintsSet.mainFrameSize(contentsSize()));
|
| + mainFrameImpl->frameView()->resize(m_pageScaleConstraintsSet.mainFrameSize(contentsSize()));
|
|
|
| float newPageScaleFactor = pageScaleFactor();
|
| if (m_pageScaleConstraintsSet.needsReset() && m_pageScaleConstraintsSet.finalConstraints().initialScale != -1) {
|
| @@ -3009,10 +3060,14 @@ void WebViewImpl::updatePageDefinedViewportConstraints(const ViewportDescription
|
|
|
| void WebViewImpl::updateMainFrameLayoutSize()
|
| {
|
| - if (m_fixedLayoutSizeLock || m_shouldAutoResize || !mainFrameImpl())
|
| + WebLocalFrameImpl* mainFrameImpl = localRootFrame();
|
| +
|
| + if (m_fixedLayoutSizeLock || m_shouldAutoResize || !mainFrameImpl) {
|
| + printf("WCI::updateMainFrameLayoutSize: null mainFrameImpl\n");
|
| return;
|
| + }
|
|
|
| - RefPtr<FrameView> view = mainFrameImpl()->frameView();
|
| + RefPtr<FrameView> view = mainFrameImpl->frameView();
|
| if (!view)
|
| return;
|
|
|
| @@ -3355,12 +3410,13 @@ WebDragOperation WebViewImpl::dragTargetDragEnterOrOver(const WebPoint& clientPo
|
|
|
| void WebViewImpl::sendResizeEventAndRepaint()
|
| {
|
| + WebLocalFrameImpl* mainFrameImpl = localRootFrame();
|
| // FIXME: This is wrong. The FrameView is responsible sending a resizeEvent
|
| // as part of layout. Layout is also responsible for sending invalidations
|
| // to the embedder. This method and all callers may be wrong. -- eseidel.
|
| - if (mainFrameImpl()->frameView()) {
|
| + if (mainFrameImpl->frameView()) {
|
| // Enqueues the resize event.
|
| - mainFrameImpl()->frame()->document()->enqueueResizeEvent();
|
| + mainFrameImpl->frame()->document()->enqueueResizeEvent();
|
| }
|
|
|
| if (m_client) {
|
| @@ -3612,16 +3668,22 @@ void WebViewImpl::didCommitLoad(bool isNewNavigation, bool isNavigationWithinPag
|
|
|
| void WebViewImpl::willInsertBody(WebLocalFrameImpl* webframe)
|
| {
|
| - if (webframe != mainFrameImpl())
|
| + /*
|
| + if (webframe != mainFrameImpl()) {
|
| + printf("WCI::willInsertBody: frame != mainFrameImpl\n");
|
| return;
|
| + }
|
|
|
| - if (!m_page->mainFrame()->isLocalFrame())
|
| + if (!m_page->mainFrame()->isLocalFrame()) {
|
| + printf("WCI::willInsertBody: mainFrame not local\n");
|
| return;
|
| + }
|
| + */
|
|
|
| // If we get to the <body> tag and we have no pending stylesheet and import load, we
|
| // can be fairly confident we'll have something sensible to paint soon and
|
| // can turn off deferred commits.
|
| - if (m_page->deprecatedLocalMainFrame()->document()->isRenderingReady())
|
| + if (webframe->frame()->document()->isRenderingReady())
|
| resumeTreeViewCommits();
|
| }
|
|
|
| @@ -3636,15 +3698,15 @@ void WebViewImpl::resumeTreeViewCommits()
|
|
|
| void WebViewImpl::layoutUpdated(WebLocalFrameImpl* webframe)
|
| {
|
| - if (!m_client || webframe != mainFrameImpl())
|
| + if (!m_client || !webframe->frame()->isLocalRoot())
|
| return;
|
|
|
| // If we finished a layout while in deferred commit mode,
|
| // that means it's time to start producing frames again so un-defer.
|
| resumeTreeViewCommits();
|
|
|
| - if (m_shouldAutoResize && mainFrameImpl()->frame() && mainFrameImpl()->frame()->view()) {
|
| - WebSize frameSize = mainFrameImpl()->frame()->view()->frameRect().size();
|
| + if (m_shouldAutoResize && webframe->frame() && webframe->frame()->view()) {
|
| + WebSize frameSize = webframe->frame()->view()->frameRect().size();
|
| if (frameSize != m_size) {
|
| m_size = frameSize;
|
|
|
| @@ -3860,6 +3922,11 @@ WebCore::GraphicsLayerFactory* WebViewImpl::graphicsLayerFactory() const
|
|
|
| WebCore::RenderLayerCompositor* WebViewImpl::compositor() const
|
| {
|
| + for (Frame* frame = page()->mainFrame()->tree().top(); frame; frame = frame->tree().traverseNext()) {
|
| + if (frame->isLocalRoot())
|
| + return toLocalFrame(frame)->document()->renderView()->compositor();
|
| + }
|
| +
|
| if (!page()
|
| || !page()->mainFrame()
|
| || !page()->mainFrame()->isLocalFrame()
|
| @@ -3981,8 +4048,10 @@ void WebViewImpl::updateMainFrameScrollPosition(const IntPoint& scrollPosition,
|
|
|
| void WebViewImpl::applyScrollAndScale(const WebSize& scrollDelta, float pageScaleDelta)
|
| {
|
| - if (!mainFrameImpl() || !mainFrameImpl()->frameView())
|
| + if (!mainFrameImpl() || !mainFrameImpl()->frameView()) {
|
| + printf("WCI::applyScrollAndScale: null mainFrameImpl\n");
|
| return;
|
| + }
|
|
|
| if (pinchVirtualViewportEnabled()) {
|
| if (pageScaleDelta != 1) {
|
|
|