haikuwebkit/ManualTests/remove-add-fixed-position.html

94 lines
1.3 KiB
HTML
Raw Permalink Normal View History

[Qt][WK2] Fixed elements position is wrong after zooming. https://bugs.webkit.org/show_bug.cgi?id=83981 Reviewed by Kenneth Rohde Christiansen. .: * ManualTests/remove-add-fixed-position.html: Added. Source/WebCore: When setFixedVisibleContentRect is called we mark all fixed elements in the frame for layout. In order to find these elements, RenderView maintains a list of fixed elements. They are added and removed at the same time that they are added and removed from their parent RenderBlock. The idea is taken from the iOS5.1 branch, at opensource.apple.com. Added a manual test that allows removing and adding fixed elements at will. * page/FrameView.cpp: (WebCore::FrameView::setFixedVisibleContentRect): * rendering/RenderBlock.cpp: (WebCore::RenderBlock::insertPositionedObject): (WebCore::RenderBlock::removePositionedObject): * rendering/RenderView.cpp: (WebCore::RenderView::setFixedPositionedObjectsNeedLayout): (WebCore): (WebCore::RenderView::insertFixedPositionedObject): (WebCore::RenderView::removeFixedPositionedObject): * rendering/RenderView.h: (RenderView): Source/WebKit2: Turn on the flag setFixedElementsLayoutRelativeToFrame. This causes fixed elements position to be calculated based on visibleWidth and visibleHeight. When zoom level grows, the visibleWidth and visibleHeight become smaller. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::setResizesToContentsUsingLayoutSize): Canonical link: https://commits.webkit.org/101525@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@114249 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-04-16 14:05:42 +00:00
<html><head>
<meta name="viewport" content="width=device-width">
<style>
.d1 {position:fixed; top:5; right:5; z-index:2; overflow:hidden;}
.o {background:green; height:40px; width:200px;}
.t { width:2000px; height:198px; background-color: lightgray; border: 1px solid blue;}
body { margin: 0px; }
</style>
<script>
var fixed;
function remove_child()
{
fixed = document.getElementById("d1");
fixed.parentElement.removeChild(fixed);
}
function add_child()
{
document.body.appendChild(fixed);
}
</script>
</head>
<body>
<div class="d1" id="d1"><div class="o">This is a test</div></div>
<div class="t">
000
</div>
<div class="t">
200<br>
<button onclick="remove_child();">remove fixed</button>
</div>
<div class="t">
400<br>
<button onclick="add_child();">add fixed</button>
</div>
<div class="t">
600<br>
</div>
<div class="t">
800
</div>
<div class="t">
1000
</div>
<div class="t">
1200
</div>
<div class="t">
1400
</div>
<div class="t">
1600
</div>
<div class="t">
1800
</div>
<div class="t">
2000
</div>
<div class="t">
2200
</div>
<div class="t">
2400
</div>
<div class="t">
2600
</div>
<div class="t">
2800
</div>
<div class="t">
3000
</div>
<div class="t">
3200
</div>
<div class="t">
3400
</div>
<div class="t">
3600
</div>
<div class="t">
3800
</div>
<div class="t">
4000
</div>
</body></html>