Commit 478927e2 authored by fsamuel's avatar fsamuel Committed by Commit bot

BrowserPlugin: Grab the correct viewsize to report to BrowserPluginGuestDelegate

This size is used to determine when autosize has resized the guest.

BUG=273089
Test=Launch chrome with --enable-embedded-extension-options, Open up chrome://extensions, click on Options for Goolge SPDY Proxy VPN and it shows a scrollbar.

Review URL: https://codereview.chromium.org/544313002

Cr-Commit-Position: refs/heads/master@{#293611}
parent 469b8770
......@@ -894,6 +894,10 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, DISABLED_Shim_TestAutosizeAfterNavigation) {
TestHelper("testAutosizeAfterNavigation", "web_view/shim", NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeHeight) {
TestHelper("testAutosizeHeight", "web_view/shim", NO_TEST_SERVER);
}
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeBeforeNavigation) {
TestHelper("testAutosizeBeforeNavigation", "web_view/shim", NO_TEST_SERVER);
}
......
......@@ -93,6 +93,48 @@ embedder.test.assertFalse = function(condition) {
// Tests begin.
// This test verifies that a lengthy page with autosize enabled will report
// the correct height in the sizechanged event.
function testAutosizeHeight() {
var webview = document.createElement('webview');
webview.autosize = true;
webview.minwidth = 200;
webview.maxwidth = 210;
webview.minheight = 40;
webview.maxheight = 200;
var step = 1;
webview.addEventListener('sizechanged', function(e) {
switch (step) {
case 1:
embedder.test.assertEq(0, e.oldHeight);
embedder.test.assertEq(200, e.newHeight);
// Change the maxheight to verify that we see the change.
webview.maxheight = 50;
break;
case 2:
embedder.test.assertEq(200, e.oldHeight);
embedder.test.assertEq(50, e.newHeight);
embedder.test.succeed();
break;
default:
window.console.log('Unexpected sizechanged event, step = ' + step);
embedder.test.fail();
break;
}
++step;
});
webview.src = 'data:text/html,' +
'a<br/>b<br/>c<br/>d<br/>e<br/>f<br/>' +
'a<br/>b<br/>c<br/>d<br/>e<br/>f<br/>' +
'a<br/>b<br/>c<br/>d<br/>e<br/>f<br/>' +
'a<br/>b<br/>c<br/>d<br/>e<br/>f<br/>' +
'a<br/>b<br/>c<br/>d<br/>e<br/>f<br/>';
document.body.appendChild(webview);
}
// This test verifies that if a browser plugin is in autosize mode before
// navigation then the guest starts auto-sized.
function testAutosizeBeforeNavigation() {
......@@ -1732,6 +1774,7 @@ function testFindAPI_findupdate() {
};
embedder.test.testList = {
'testAutosizeHeight': testAutosizeHeight,
'testAutosizeAfterNavigation': testAutosizeAfterNavigation,
'testAutosizeBeforeNavigation': testAutosizeBeforeNavigation,
'testAutosizeRemoveAttributes': testAutosizeRemoveAttributes,
......
......@@ -322,8 +322,9 @@ void BrowserPluginGuest::SwapCompositorFrame(
return;
}
gfx::Size view_size(frame->metadata.root_layer_size.width(),
frame->metadata.root_layer_size.height());
cc::RenderPass* root_pass =
frame->delegated_frame_data->render_pass_list.back();
gfx::Size view_size(root_pass->output_rect.size());
if (last_seen_view_size_ != view_size) {
delegate_->GuestSizeChanged(last_seen_view_size_, view_size);
last_seen_view_size_ = view_size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment