2009-09-18 Simon Fraser <simon.fraser@apple.com>

        Reviewed by Dave Hyatt.

        Compositing layers are incorrectly positioned after scrolling with position:fixed
        https://bugs.webkit.org/show_bug.cgi?id=29262

        When scrolling a page with compositing layers inside a position:fixed element,
        we need to update the compositing layer positions when the scroll position changes.

        Test: compositing/geometry/fixed-position.html

        * WebCore.base.exp:
        Export FrameView::scrollPositionChanged()

        * page/FrameView.h:
        * page/FrameView.cpp:
        (WebCore::FrameView::scrollPositionChanged):
        New method that sends the scroll event, and updates compositing layers positions if necessary.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48526 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 32aaad09
2009-09-18 Simon Fraser <simon.fraser@apple.com>
Reviewed by Dave Hyatt.
Compositing layers are incorrectly positioned after scrolling with position:fixed
https://bugs.webkit.org/show_bug.cgi?id=29262
Add testcase for scrolling a page with position:fixed composited content.
* compositing/geometry/fixed-position.html: Added.
* platform/mac/compositing/geometry/fixed-position-expected.checksum: Added.
* platform/mac/compositing/geometry/fixed-position-expected.png: Added.
* platform/mac/compositing/geometry/fixed-position-expected.txt: Added.
2009-09-18 Simon Fraser <simon.fraser@apple.com>
Reviewed by Dave Hyatt.
......
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Position fixed</title>
<style type="text/css" media="screen">
body {
height: 1000px;
width: 1000px;
}
#fixed {
position: fixed;
top: 0;
left: 0;
height: 100px;
width: 100px;
opacity: 0.8; /* makes this a compositing layer without assigning a transform */
background-color: orange;
}
.box {
height: 50px;
width: 50px;
background-color: green;
}
.compositing {
-webkit-transform: translateZ(0);
}
p {
position: absolute;
left: 50px;
top: 150px;
}
</style>
<script type="text/javascript" charset="utf-8">
window.addEventListener('load', function() {
window.scrollBy(50, 50);
}, false);
</script>
</head>
<body>
<p>You should see a green square in the top left corner of an orange box.</p>
<div id="fixed">
<div class="compositing box">
</div>
</div>
</body>
</html>
1bb716783916e0a67d95469a957b138c
\ No newline at end of file
layer at (0,0) size 1008x1016
RenderView at (0,0) size 785x585
layer at (0,0) size 1008x1016
RenderBlock {HTML} at (0,0) size 785x1016
RenderBody {BODY} at (8,8) size 1000x1000
layer at (50,166) size 439x18
RenderBlock (positioned) {P} at (50,166) size 439x18
RenderText {#text} at (0,0) size 439x18
text run at (0,0) width 439: "You should see a green square in the top left corner of an orange box."
layer at (50,50) size 100x100
RenderBlock (positioned) {DIV} at (0,0) size 100x100 [bgcolor=#FFA500]
layer at (50,50) size 50x50
RenderBlock {DIV} at (0,0) size 50x50 [bgcolor=#008000]
scrolled to 50,50
2009-09-18 Simon Fraser <simon.fraser@apple.com>
Reviewed by Dave Hyatt.
Compositing layers are incorrectly positioned after scrolling with position:fixed
https://bugs.webkit.org/show_bug.cgi?id=29262
When scrolling a page with compositing layers inside a position:fixed element,
we need to update the compositing layer positions when the scroll position changes.
Test: compositing/geometry/fixed-position.html
* WebCore.base.exp:
Export FrameView::scrollPositionChanged()
* page/FrameView.h:
* page/FrameView.cpp:
(WebCore::FrameView::scrollPositionChanged):
New method that sends the scroll event, and updates compositing layers positions if necessary.
2009-09-18 Simon Fraser <simon.fraser@apple.com>
Reviewed by Dave Hyatt.
......@@ -683,6 +683,7 @@ __ZN7WebCore9FrameView29setShouldUpdateWhileOffscreenEb
__ZN7WebCore9FrameView29syncCompositingStateRecursiveEv
__ZN7WebCore9FrameView6createEPNS_5FrameE
__ZN7WebCore9FrameView6createEPNS_5FrameERKNS_7IntSizeE
__ZN7WebCore9FrameView21scrollPositionChangedEv
__ZN7WebCore9HTMLNames10listingTagE
__ZN7WebCore9HTMLNames11textareaTagE
__ZN7WebCore9HTMLNames13blockquoteTagE
......
......@@ -803,6 +803,22 @@ void FrameView::setScrollPosition(const IntPoint& scrollPoint)
m_inProgrammaticScroll = wasInProgrammaticScroll;
}
void FrameView::scrollPositionChanged()
{
frame()->eventHandler()->sendScrollEvent();
#if USE(ACCELERATED_COMPOSITING)
// We need to update layer positions after scrolling to account for position:fixed layers.
Document* document = m_frame->document();
if (!document)
return;
RenderLayer* layer = document->renderer() ? document->renderer()->enclosingLayer() : 0;
if (layer)
layer->updateLayerPositions(RenderLayer::UpdateCompositingLayers);
#endif
}
HostWindow* FrameView::hostWindow() const
{
Page* page = frame() ? frame()->page() : 0;
......
......@@ -131,6 +131,7 @@ public:
virtual void scrollRectIntoViewRecursively(const IntRect&);
virtual void setScrollPosition(const IntPoint&);
void scrollPositionChanged();
String mediaType() const;
void setMediaType(const String&);
......
2009-09-17 Simon Fraser <simon.fraser@apple.com>
Reviewed by Dave Hyatt.
Compositing layers are incorrectly positioned after scrolling with position:fixed
https://bugs.webkit.org/show_bug.cgi?id=29262
When scrolling a page with compositing layers inside a position:fixed element,
we need to update the compositing layer positions when the scroll position changes.
* WebView/WebHTMLView.mm:
(-[WebHTMLView _frameOrBoundsChanged]):
Call the new FrameView::scrollPositionChanged() method rather than sending the
scroll event directly.
2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org>
Reviewed by Simon Hausmann.
......
......@@ -1151,8 +1151,11 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
{
NSPoint origin = [[self superview] bounds].origin;
if (!NSEqualPoints(_private->lastScrollPosition, origin)) {
if (Frame* coreFrame = core([self _frame]))
coreFrame->eventHandler()->sendScrollEvent();
if (Frame* coreFrame = core([self _frame])) {
if (FrameView* coreView = coreFrame->view())
coreView->scrollPositionChanged();
}
[_private->completionController endRevertingChange:NO moveLeft:NO];
WebView *webView = [self _webView];
......
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