https://bugs.webkit.org/show_bug.cgi?id=105486
Patch by Tien-Ren Chen <trchen@chromium.org> on 2013-02-27
Reviewed by James Robinson.
In settings()->fixedElementsLayoutRelativeToFrame() mode, fixed-position
elements are layout relative to the current visible viewport, which can
be different from the layout viewport when using fixed-layout mode.
We need to re-layout fixed-position elements in case of visible content
size changes.
The test is currently chromium-specific due to difficulties to make this
test works on Mac. The mac port seems to work very differently with
visible content size when a page is scaled. And there is no reliable way
to hide scrollbars in mac-wk1 that doesn't cause a side effect.
Source/WebCore:
Test: platform/chromium/fast/repaint/relayout-fixed-position-after-scale.html
* page/FrameView.h:
(FrameView):
* page/Page.cpp:
(WebCore::Page::setPageScaleFactor):
LayoutTests:
* platform/chromium/fast/repaint/relayout-fixed-position-after-scale-expected.html: Added.
* platform/chromium/fast/repaint/relayout-fixed-position-after-scale.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@144260
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2013-02-27 Tien-Ren Chen <trchen@chromium.org>
+
+ Need to re-layout fixed position elements after scale when using settings()->fixedElementsLayoutRelativeToFrame()
+ https://bugs.webkit.org/show_bug.cgi?id=105486
+
+ Reviewed by James Robinson.
+
+ In settings()->fixedElementsLayoutRelativeToFrame() mode, fixed-position
+ elements are layout relative to the current visible viewport, which can
+ be different from the layout viewport when using fixed-layout mode.
+ We need to re-layout fixed-position elements in case of visible content
+ size changes.
+
+ The test is currently chromium-specific due to difficulties to make this
+ test works on Mac. The mac port seems to work very differently with
+ visible content size when a page is scaled. And there is no reliable way
+ to hide scrollbars in mac-wk1 that doesn't cause a side effect.
+
+ * platform/chromium/fast/repaint/relayout-fixed-position-after-scale-expected.html: Added.
+ * platform/chromium/fast/repaint/relayout-fixed-position-after-scale.html: Added.
+
2013-02-27 Hans Muller <hmuller@adobe.com>
[CSS Exclusions] Enable shape-inside rectangle support for shape-padding
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.fixed_size {
+ position:absolute;
+ background-color:#ccffcc;
+ width:25px;
+ height:25px;
+}
+.percentage_size {
+ position:absolute;
+ background-color:#ccccff;
+ width:10%;
+ height:10%;
+}
+</style>
+</head>
+<body style="width:800px;height:600px;margin:0;">
+<div class="fixed_size" style="left:5px;top:10px"></div>
+<div class="fixed_size" style="right:15px;top:20px"></div>
+<div class="fixed_size" style="left:25px;bottom:30px"></div>
+<div class="fixed_size" style="right:35px;bottom:40px"></div>
+<div class="percentage_size" style="left:40%;top:35%"></div>
+<div class="percentage_size" style="right:30%;top:25%"></div>
+<div class="percentage_size" style="left:20%;bottom:15%"></div>
+<div class="percentage_size" style="right:10%;bottom:5%"></div>
+</body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+<title>This test is successful if fixed position elements re-layout correctly on page scale changes</title>
+<style>
+.fixed_size {
+ position:fixed;
+ background-color:#ccffcc;
+ width:50px;
+ height:50px;
+}
+.percentage_size {
+ position:fixed;
+ background-color:#ccccff;
+ width:10%;
+ height:10%;
+}
+</style>
+</head>
+<body onload="runTest();" style="width:1600px;height:1200px;margin:0;">
+<div class="fixed_size" style="left:10px;top:20px"></div>
+<div class="fixed_size" style="right:30px;top:40px"></div>
+<div class="fixed_size" style="left:50px;bottom:60px"></div>
+<div class="fixed_size" style="right:70px;bottom:80px"></div>
+<div class="percentage_size" style="left:40%;top:35%"></div>
+<div class="percentage_size" style="right:30%;top:25%"></div>
+<div class="percentage_size" style="left:20%;bottom:15%"></div>
+<div class="percentage_size" style="right:10%;bottom:5%"></div>
+<script>
+function runTest() {
+ if (window.internals) {
+ window.internals.settings.setFixedElementsLayoutRelativeToFrame(true);
+
+ // Force scrollbar to hide and re-layout immediately.
+ window.internals.setPageScaleFactor(0.1, 0, 0);
+ document.body.offsetTop;
+
+ window.internals.setPageScaleFactor(0.5, 0, 0);
+ }
+}
+</script>
+</body>
+</html>
+2013-02-27 Tien-Ren Chen <trchen@chromium.org>
+
+ Need to re-layout fixed position elements after scale when using settings()->fixedElementsLayoutRelativeToFrame()
+ https://bugs.webkit.org/show_bug.cgi?id=105486
+
+ Reviewed by James Robinson.
+
+ In settings()->fixedElementsLayoutRelativeToFrame() mode, fixed-position
+ elements are layout relative to the current visible viewport, which can
+ be different from the layout viewport when using fixed-layout mode.
+ We need to re-layout fixed-position elements in case of visible content
+ size changes.
+
+ The test is currently chromium-specific due to difficulties to make this
+ test works on Mac. The mac port seems to work very differently with
+ visible content size when a page is scaled. And there is no reliable way
+ to hide scrollbars in mac-wk1 that doesn't cause a side effect.
+
+ Test: platform/chromium/fast/repaint/relayout-fixed-position-after-scale.html
+
+ * page/FrameView.h:
+ (FrameView):
+ * page/Page.cpp:
+ (WebCore::Page::setPageScaleFactor):
+
2013-02-27 Hans Muller <hmuller@adobe.com>
[CSS Exclusions] Enable shape-inside rectangle support for shape-padding
bool needsLayout() const;
void setNeedsLayout();
+ void setViewportConstrainedObjectsNeedLayout();
bool needsFullRepaint() const { return m_doFullRepaint; }
bool doLayoutWithFrameFlattening(bool allowSubtree);
- void setViewportConstrainedObjectsNeedLayout();
-
virtual AXObjectCache* axObjectCache() const;
void notifyWidgetsInAllFrames(WidgetNotification);
void removeFromAXObjectCache();
mainFrame()->deviceOrPageScaleFactorChanged();
#endif
+ if (view && view->fixedElementsLayoutRelativeToFrame())
+ view->setViewportConstrainedObjectsNeedLayout();
+
if (view && view->scrollPosition() != origin) {
if (!m_settings->applyPageScaleFactorInCompositor() && document->renderer() && document->renderer()->needsLayout() && view->didFirstLayout())
view->layout();