Commit 9f9a70a7 authored by aroben@apple.com's avatar aroben@apple.com

Tell ScrollView's child Widgets that their frame rects have changed when its own frame rect changes

r79167 moved some code from setFrameRect to setBoundsSize, including a call to
frameRectsChanged. This was done because positionScrollbarLayers, which is called by
frameRectsChanged, only needs to be called when the bounds change, not when the frame rect
changes. But the recursive calls inside frameRectsChanged *do* need to be called when the
frame rect changes.

This patch moves the positionScrollbarLayers call out of frameRectsChanged, since it needs
to be called at different times from frameRectsChanged. Then it restores the
frameRectsChanged call to setFrameRect, which fixes the bug.

Test: platform/win/plugins/iframe-inside-overflow.html

Fixes <http://webkit.org/b/60194> <rdar://problem/9383760> REGRESSION (r79167): Windowed
plugins in Google Reader don't move when the article list is scrolled

Reviewed by Dan Bernstein.

Source/WebCore:

* platform/ScrollView.cpp:
(WebCore::ScrollView::updateScrollbars): Added a positionScrollbarLayers call here now that
frameRectsChanged doesn't call it for us. Also added a FIXME because it seems strange to
call frameRectsChanged here when our frame rect hasn't changed.
(WebCore::ScrollView::setFrameRect): Added back the frameRectsChanged call that was removed
in r79167.
(WebCore::ScrollView::setBoundsSize): Replaced a frameRectsChanged call with a call to
positionScrollbarLayers. We were only calling frameRectsChanged here in order to get
positionScrollbarLayers to be called.
(WebCore::ScrollView::frameRectsChanged): Removed the call to positionScrollbarLayers. All
callers of frameRectsChanged have been updated to call positionScrollbarLayers if needed.

Tools:

Add a plugin test that dumps the plugin window's rect

* DumpRenderTree/TestNetscapePlugIn/Tests/win/DumpWindowRect.cpp: Added.
(DumpWindowRect::DumpWindowRect): Just call up to the base class.
(DumpWindowRect::performWindowGeometryTest): Find our window rect relative to the test
harness window and log it.

* DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj: Added DumpWindowRect.

LayoutTests:

Add a test for windowed plugins inside iframes inside scrolled overflow areas

* platform/win/plugins/iframe-inside-overflow-expected.txt: Added.
* platform/win/plugins/iframe-inside-overflow.html: Added.
(loaded): Scrolls the div and tells the plugin to start its test (which will cause its
window rect to be logged).
* platform/win/plugins/resources/dump-window-rect-iframe.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@86442 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6d09c98a
2011-05-13 Adam Roben <aroben@apple.com>
Add a test for windowed plugins inside iframes inside scrolled overflow areas
Part of the test for <http://webkit.org/b/60194> <rdar://problem/9383760> REGRESSION
(r79167): Windowed plugins in Google Reader don't move when the article list is scrolled
Reviewed by Dan Bernstein.
* platform/win/plugins/iframe-inside-overflow-expected.txt: Added.
* platform/win/plugins/iframe-inside-overflow.html: Added.
(loaded): Scrolls the div and tells the plugin to start its test (which will cause its
window rect to be logged).
* platform/win/plugins/resources/dump-window-rect-iframe.html: Added.
2011-05-02 Robert Hogan <robert@webkit.org>
Reviewed by Eric Seidel.
CONSOLE MESSAGE: line 0: PLUGIN: Plugin window rect: {left=-227, top=-189, right=73, bottom=111}
This tests that windowed plugins inside iframes inside overflow areas obey the overflow area's scroll offset.
<!DOCTYPE html>
<html>
<head>
<script>
function loaded() {
if (window.layoutTestController)
layoutTestController.dumpAsText();
var container = document.getElementsByTagName('div')[0];
container.scrollLeft = 300;
container.scrollTop = 300;
frames[0].document.getElementsByTagName('embed')[0].startTest();
}
addEventListener('load', loaded, false);
</script>
<style>
div {
float: left;
overflow: auto;
width: 100px;
height: 100px;
}
iframe {
width: 320px;
height: 320px;
border: none;
}
</style>
</head>
<body>
<p>This tests that windowed plugins inside iframes inside overflow areas obey the overflow area's scroll offset.</p>
<div>
<iframe src="resources/dump-window-rect-iframe.html"></iframe>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
body {
margin: 0;
}
embed {
width: 300px;
height: 300px;
visibility: hidden;
}
</style>
</head>
<body>
<embed type="application/x-webkit-test-netscape" test="dump-window-rect"></embed>
</body>
</html>
2011-05-13 Adam Roben <aroben@apple.com>
Tell ScrollView's child Widgets that their frame rects have changed when its own frame rect
changes
r79167 moved some code from setFrameRect to setBoundsSize, including a call to
frameRectsChanged. This was done because positionScrollbarLayers, which is called by
frameRectsChanged, only needs to be called when the bounds change, not when the frame rect
changes. But the recursive calls inside frameRectsChanged *do* need to be called when the
frame rect changes.
This patch moves the positionScrollbarLayers call out of frameRectsChanged, since it needs
to be called at different times from frameRectsChanged. Then it restores the
frameRectsChanged call to setFrameRect, which fixes the bug.
Test: platform/win/plugins/iframe-inside-overflow.html
Fixes <http://webkit.org/b/60194> <rdar://problem/9383760> REGRESSION (r79167): Windowed
plugins in Google Reader don't move when the article list is scrolled
Reviewed by Dan Bernstein.
* platform/ScrollView.cpp:
(WebCore::ScrollView::updateScrollbars): Added a positionScrollbarLayers call here now that
frameRectsChanged doesn't call it for us. Also added a FIXME because it seems strange to
call frameRectsChanged here when our frame rect hasn't changed.
(WebCore::ScrollView::setFrameRect): Added back the frameRectsChanged call that was removed
in r79167.
(WebCore::ScrollView::setBoundsSize): Replaced a frameRectsChanged call with a call to
positionScrollbarLayers. We were only calling frameRectsChanged here in order to get
positionScrollbarLayers to be called.
(WebCore::ScrollView::frameRectsChanged): Removed the call to positionScrollbarLayers. All
callers of frameRectsChanged have been updated to call positionScrollbarLayers if needed.
2011-05-13 Martin Robinson <mrobinson@igalia.com>
Reviewed by Eric Seidel.
......@@ -579,7 +579,9 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset)
}
if (hasHorizontalScrollbar != (m_horizontalScrollbar != 0) || hasVerticalScrollbar != (m_verticalScrollbar != 0)) {
// FIXME: Is frameRectsChanged really necessary here? Have any frame rects changed?
frameRectsChanged();
positionScrollbarLayers();
updateScrollCorner();
}
......@@ -817,6 +819,8 @@ void ScrollView::setFrameRect(const IntRect& newRect)
return;
Widget::setFrameRect(newRect);
frameRectsChanged();
}
void ScrollView::setBoundsSize(const IntSize& newSize)
......@@ -834,7 +838,7 @@ void ScrollView::setBoundsSize(const IntSize& newSize)
if (!m_useFixedLayout)
contentsResized();
frameRectsChanged();
positionScrollbarLayers();
}
void ScrollView::setInitialBoundsSize(const IntSize& newSize)
......@@ -851,7 +855,6 @@ void ScrollView::frameRectsChanged()
HashSet<RefPtr<Widget> >::const_iterator end = m_children.end();
for (HashSet<RefPtr<Widget> >::const_iterator current = m_children.begin(); current != end; ++current)
(*current)->frameRectsChanged();
positionScrollbarLayers();
}
#if USE(ACCELERATED_COMPOSITING)
......
2011-05-13 Adam Roben <aroben@apple.com>
Add a plugin test that dumps the plugin window's rect
Part of the test for <http://webkit.org/b/60194> <rdar://problem/9383760> REGRESSION
(r79167): Windowed plugins in Google Reader don't move when the article list is scrolled
Reviewed by Dan Bernstein.
* DumpRenderTree/TestNetscapePlugIn/Tests/win/DumpWindowRect.cpp: Added.
(DumpWindowRect::DumpWindowRect): Just call up to the base class.
(DumpWindowRect::performWindowGeometryTest): Find our window rect relative to the test
harness window and log it.
* DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj: Added DumpWindowRect.
2011-05-13 Adam Roben <aroben@apple.com>
Move code required for most tests of plugin window geometry into a base class
......
/*
* Copyright (C) 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "WindowGeometryTest.h"
#include "PluginObject.h"
using namespace std;
// This plugin dumps its window rect (relative to the test harness window) to the console when it
// is instantiated.
class DumpWindowRect : public WindowGeometryTest {
public:
DumpWindowRect(NPP, const string& identifier);
private:
virtual void performWindowGeometryTest();
};
static PluginTest::Register<DumpWindowRect> registrar("dump-window-rect");
DumpWindowRect::DumpWindowRect(NPP npp, const string& identifier)
: WindowGeometryTest(npp, identifier)
{
}
void DumpWindowRect::performWindowGeometryTest()
{
RECT rect;
if (!::GetClientRect(window(), &rect)) {
log("::GetClientRect failed");
return;
}
// MSDN says that calling ::MapWindowPoints this way will tell it to treat the points as a rect.
if (!::MapWindowPoints(window(), testHarnessWindow(), reinterpret_cast<LPPOINT>(&rect), 2)) {
log("::MapWindowPoints failed");
return;
}
log("Plugin window rect: {left=%d, top=%d, right=%d, bottom=%d}", rect.left, rect.top, rect.right, rect.bottom);
}
......@@ -440,6 +440,10 @@
RelativePath="..\Tests\win\DrawsGradient.cpp"
>
</File>
<File
RelativePath="..\Tests\win\DumpWindowRect.cpp"
>
</File>
<File
RelativePath="..\Tests\win\GetValueNetscapeWindow.cpp"
>
......
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