diff options
author | lazyboy@chromium.org <lazyboy@chromium.org> | 2015-08-08 05:09:06 +0000 |
---|---|---|
committer | lazyboy@chromium.org <lazyboy@chromium.org> | 2015-08-08 05:09:06 +0000 |
commit | 507ff46e3b09ab44618ba162c53fffd1e2719781 (patch) | |
tree | 65448fd7a5d92ada7a00d52c932a537a0b92fa12 | |
parent | e4b0a1265f8a9e80a1273b6f6aba5f08cb3e1ba6 (diff) | |
download | chromium_src-507ff46e3b09ab44618ba162c53fffd1e2719781.zip chromium_src-507ff46e3b09ab44618ba162c53fffd1e2719781.tar.gz chromium_src-507ff46e3b09ab44618ba162c53fffd1e2719781.tar.bz2 |
Notify embedder when a remote frame is resized.
This is used to fix resizing OOP iframes. Chromium patch that uses it is:
https://chromiumcodereview.appspot.com/1272573007/
BUG=517291
Test=With the chromium CL and --site-per-process flag, load a cross origin
<iframe>, resize it using JavaScript, e.g.
document.querySelector('iframe').style.width = '400px';
Notice that
1) this should not clip the iframe if new width is smaller.
2) this should not introduce gutter around the iframe if the new width is larger.
Review URL: https://codereview.chromium.org/1273743004
git-svn-id: svn://svn.chromium.org/blink/trunk@200218 bbb929c8-8fbe-4397-9dbb-9b2b20218538
8 files changed, 34 insertions, 9 deletions
diff --git a/third_party/WebKit/Source/core/frame/RemoteFrame.cpp b/third_party/WebKit/Source/core/frame/RemoteFrame.cpp index 7f80c6f..9811458 100644 --- a/third_party/WebKit/Source/core/frame/RemoteFrame.cpp +++ b/third_party/WebKit/Source/core/frame/RemoteFrame.cpp @@ -133,6 +133,11 @@ void RemoteFrame::forwardInputEvent(Event* event) remoteFrameClient()->forwardInputEvent(event); } +void RemoteFrame::frameRectsChanged(const IntRect& frameRect) +{ + remoteFrameClient()->frameRectsChanged(frameRect); +} + void RemoteFrame::setView(PassRefPtrWillBeRawPtr<RemoteFrameView> view) { // Oilpan: as RemoteFrameView performs no finalization actions, diff --git a/third_party/WebKit/Source/core/frame/RemoteFrame.h b/third_party/WebKit/Source/core/frame/RemoteFrame.h index bff45fd..c12ec4b 100644 --- a/third_party/WebKit/Source/core/frame/RemoteFrame.h +++ b/third_party/WebKit/Source/core/frame/RemoteFrame.h @@ -12,6 +12,7 @@ namespace blink { class Event; +class IntRect; class RemoteDOMWindow; class RemoteFrameClient; class RemoteFrameView; @@ -44,6 +45,8 @@ public: // process. See http://crbug.com/339659. void forwardInputEvent(Event*); + void frameRectsChanged(const IntRect& frameRect); + void setRemotePlatformLayer(WebLayer*); WebLayer* remotePlatformLayer() const { return m_remotePlatformLayer; } diff --git a/third_party/WebKit/Source/core/frame/RemoteFrameClient.h b/third_party/WebKit/Source/core/frame/RemoteFrameClient.h index 1316bb0..50d88f8 100644 --- a/third_party/WebKit/Source/core/frame/RemoteFrameClient.h +++ b/third_party/WebKit/Source/core/frame/RemoteFrameClient.h @@ -12,6 +12,7 @@ namespace blink { class Event; +class IntRect; class ResourceRequest; class RemoteFrameClient : public FrameClient { @@ -25,6 +26,8 @@ public: // FIXME: Remove this method once we have input routing in the browser // process. See http://crbug.com/339659. virtual void forwardInputEvent(Event*) = 0; + + virtual void frameRectsChanged(const IntRect& frameRect) = 0; }; } // namespace blink diff --git a/third_party/WebKit/Source/core/frame/RemoteFrameView.cpp b/third_party/WebKit/Source/core/frame/RemoteFrameView.cpp index a629286..1003baa 100644 --- a/third_party/WebKit/Source/core/frame/RemoteFrameView.cpp +++ b/third_party/WebKit/Source/core/frame/RemoteFrameView.cpp @@ -53,7 +53,7 @@ void RemoteFrameView::setFrameRect(const IntRect& newRect) void RemoteFrameView::frameRectsChanged() { - // FIXME: Notify embedder via WebLocalFrameClient when that is possible. + m_remoteFrame->frameRectsChanged(frameRect()); } DEFINE_TRACE(RemoteFrameView) diff --git a/third_party/WebKit/Source/web/RemoteFrameClientImpl.cpp b/third_party/WebKit/Source/web/RemoteFrameClientImpl.cpp index a8b1f6d..5876dd9 100644 --- a/third_party/WebKit/Source/web/RemoteFrameClientImpl.cpp +++ b/third_party/WebKit/Source/web/RemoteFrameClientImpl.cpp @@ -144,4 +144,9 @@ void RemoteFrameClientImpl::forwardInputEvent(Event* event) m_webFrame->client()->forwardInputEvent(webEvent.get()); } +void RemoteFrameClientImpl::frameRectsChanged(const IntRect& frameRect) +{ + m_webFrame->client()->frameRectsChanged(frameRect); +} + } // namespace blink diff --git a/third_party/WebKit/Source/web/RemoteFrameClientImpl.h b/third_party/WebKit/Source/web/RemoteFrameClientImpl.h index 8eb019a..f206675 100644 --- a/third_party/WebKit/Source/web/RemoteFrameClientImpl.h +++ b/third_party/WebKit/Source/web/RemoteFrameClientImpl.h @@ -33,6 +33,7 @@ public: void reload(FrameLoadType, ClientRedirectPolicy) override; unsigned backForwardLength() override; void forwardInputEvent(Event*) override; + void frameRectsChanged(const IntRect& frameRect) override; WebRemoteFrameImpl* webFrame() const { return m_webFrame; } diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp index dd42a6b..388e7e2 100644 --- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp +++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp @@ -6993,7 +6993,8 @@ void swapAndVerifyFirstChildConsistency(const char* const message, WebFrame* par TEST_F(WebFrameSwapTest, SwapFirstChild) { - WebRemoteFrame* remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Document, nullptr); + FrameTestHelpers::TestWebRemoteFrameClient remoteFrameClient; + WebRemoteFrame* remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Document, &remoteFrameClient); swapAndVerifyFirstChildConsistency("local->remote", mainFrame(), remoteFrame); FrameTestHelpers::TestWebFrameClient client; @@ -7031,7 +7032,8 @@ void swapAndVerifyMiddleChildConsistency(const char* const message, WebFrame* pa TEST_F(WebFrameSwapTest, SwapMiddleChild) { - WebRemoteFrame* remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Document, nullptr); + FrameTestHelpers::TestWebRemoteFrameClient remoteFrameClient; + WebRemoteFrame* remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Document, &remoteFrameClient); swapAndVerifyMiddleChildConsistency("local->remote", mainFrame(), remoteFrame); FrameTestHelpers::TestWebFrameClient client; @@ -7066,7 +7068,8 @@ void swapAndVerifyLastChildConsistency(const char* const message, WebFrame* pare TEST_F(WebFrameSwapTest, SwapLastChild) { - WebRemoteFrame* remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Document, nullptr); + FrameTestHelpers::TestWebRemoteFrameClient remoteFrameClient; + WebRemoteFrame* remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Document, &remoteFrameClient); swapAndVerifyLastChildConsistency("local->remote", mainFrame(), remoteFrame); FrameTestHelpers::TestWebFrameClient client; @@ -7101,7 +7104,8 @@ void swapAndVerifySubframeConsistency(const char* const message, WebFrame* oldFr TEST_F(WebFrameSwapTest, SwapParentShouldDetachChildren) { - WebRemoteFrame* remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Document, nullptr); + FrameTestHelpers::TestWebRemoteFrameClient remoteFrameClient1; + WebRemoteFrame* remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Document, &remoteFrameClient1); WebFrame* targetFrame = mainFrame()->firstChild()->nextSibling(); EXPECT_TRUE(targetFrame); swapAndVerifySubframeConsistency("local->remote", targetFrame, remoteFrame); @@ -7110,8 +7114,8 @@ TEST_F(WebFrameSwapTest, SwapParentShouldDetachChildren) EXPECT_TRUE(targetFrame); // Create child frames in the target frame before testing the swap. - FrameTestHelpers::TestWebRemoteFrameClient remoteFrameClient; - WebRemoteFrame* childRemoteFrame = remoteFrame->createRemoteChild(WebTreeScopeType::Document, "", WebSandboxFlags::None, &remoteFrameClient); + FrameTestHelpers::TestWebRemoteFrameClient remoteFrameClient2; + WebRemoteFrame* childRemoteFrame = remoteFrame->createRemoteChild(WebTreeScopeType::Document, "", WebSandboxFlags::None, &remoteFrameClient2); FrameTestHelpers::TestWebFrameClient client; WebLocalFrame* localFrame = WebLocalFrame::create(WebTreeScopeType::Document, &client); @@ -7328,7 +7332,8 @@ public: // first navigation occurs. TEST_F(WebFrameSwapTest, HistoryCommitTypeAfterNewRemoteToLocalSwap) { - WebRemoteFrame* remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Document, nullptr); + FrameTestHelpers::TestWebRemoteFrameClient remoteFrameClient; + WebRemoteFrame* remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Document, &remoteFrameClient); WebFrame* targetFrame = mainFrame()->firstChild(); ASSERT_TRUE(targetFrame); targetFrame->swap(remoteFrame); @@ -7352,7 +7357,8 @@ TEST_F(WebFrameSwapTest, HistoryCommitTypeAfterNewRemoteToLocalSwap) // process will inform us via setCommittedFirstRealLoad. TEST_F(WebFrameSwapTest, HistoryCommitTypeAfterExistingRemoteToLocalSwap) { - WebRemoteFrame* remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Document, nullptr); + FrameTestHelpers::TestWebRemoteFrameClient remoteFrameClient; + WebRemoteFrame* remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Document, &remoteFrameClient); WebFrame* targetFrame = mainFrame()->firstChild(); ASSERT_TRUE(targetFrame); targetFrame->swap(remoteFrame); diff --git a/third_party/WebKit/public/web/WebRemoteFrameClient.h b/third_party/WebKit/public/web/WebRemoteFrameClient.h index 64b15a8..3893ab2 100644 --- a/third_party/WebKit/public/web/WebRemoteFrameClient.h +++ b/third_party/WebKit/public/web/WebRemoteFrameClient.h @@ -44,6 +44,8 @@ public: // process. See http://crbug.com/339659. virtual void forwardInputEvent(const WebInputEvent*) { } + virtual void frameRectsChanged(const WebRect&) { } + // This frame updated its opener to another frame. virtual void didChangeOpener(WebFrame* opener) { } }; |