LayoutTests/ChangeLog

112011-09-22 Alpha Lam <hclam@chromium.org>
22
 3 https://bugs.webkit.org/show_bug.cgi?id=68617
 4 Add layout tests for page scaling and position:fixed.
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * fast/repaint/fixed-in-page-scale-expected.png: Added.
 9 * fast/repaint/fixed-in-page-scale-expected.txt: Added.
 10 * fast/repaint/fixed-in-page-scale.html: Added.
 11 * fast/repaint/fixed-right-bottom-in-page-scale-expected.png: Added.
 12 * fast/repaint/fixed-right-bottom-in-page-scale-expected.txt: Added.
 13 * fast/repaint/fixed-right-bottom-in-page-scale.html: Added.
 14 * fast/repaint/fixed-right-in-page-scale-expected.png: Added.
 15 * fast/repaint/fixed-right-in-page-scale-expected.txt: Added.
 16 * fast/repaint/fixed-right-in-page-scale.html: Added.
 17
 182011-09-22 Alpha Lam <hclam@chromium.org>
 19
320 https://bugs.webkit.org/show_bug.cgi?id=68081
421 Add layout test for page scale and scrolling.
522

LayoutTests/fast/repaint/fixed-in-page-scale-expected.png

Exception raised during decoding git binary patch:
Error running git apply --directory=/tmp
with patch:
diff --git a/PrettyPatch20260325-3888-18lgzuq.bin b/PrettyPatch20260325-3888-18lgzuq.bin
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 0
HcmV?d00001

...
error: invalid path '/tmp/PrettyPatch20260325-3888-18lgzuq.bin'

/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:924:in `run_git_apply_on_patch'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:935:in `extract_contents_from_git_binary_literal_chunk'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:950:in `extract_contents_from_remote'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:713:in `initialize'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:845:in `new'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:845:in `block in parse'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:845:in `collect'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:845:in `parse'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:21:in `prettify'
/var/www/html/PrettyPatch/prettify.rb:30:in `<main>'

LayoutTests/fast/repaint/fixed-in-page-scale-expected.txt

 1

LayoutTests/fast/repaint/fixed-in-page-scale.html

 1<html>
 2<head>
 3 <style>
 4 ::-webkit-scrollbar {
 5 width: 0px;
 6 height: 0px;
 7 }
 8 </style>
 9 <script>
 10 window.enablePixelTesting = true;
 11
 12 function scroll() {
 13 window.scrollTo(100,100);
 14 }
 15
 16 function scaleWithEventSender() {
 17 var scaleFactor = 2.0;
 18 var scaleOffset = 0;
 19 if (window.eventSender) {
 20 eventSender.scalePageBy(scaleFactor, scaleOffset, scaleOffset);
 21 }
 22 }
 23
 24 function test() {
 25 scaleWithEventSender();
 26 scroll();
 27 }
 28 </script>
 29 <script src="../js/resources/js-test-pre.js"></script>
 30</head>
 31<body style="width:2000px; height:2000px; margin:0px;" onload="test();">
 32 <div style="position: fixed; top: -100px; left: -100px; z-index: 1">
 33 <div style="left:0; top:0; width:100px; height:100px; position:absolute; background:yellow;"></div>
 34 <div style="left:100px; top:0; width:100px; height:100px; position:absolute; background:green;"></div>
 35
 36 <div style="left:0; top:100px; width:100px; height:100px; position:absolute; background:green;"></div>
 37 <div style="left:100px; top:100px; width:100px; height:100px; position:absolute; background:black;"></div>
 38 </div>
 39
 40 <div style="left:0; top:0; width:100px; height:100px; position:absolute; background:yellow;"></div>
 41 <div style="left:100px; top:0; width:100px; height:100px; position:absolute; background:green;"></div>
 42 <div style="left:200px; top:0; width:100px; height:100px; position:absolute; background:blue;"></div>
 43
 44 <div style="left:0; top:100px; width:100px; height:100px; position:absolute; background: green;"></div>
 45 <div style="left:100px; top:100px; width:100px; height:100px; position:absolute; background:blue;"></div>
 46 <div style="left:200px; top:100px; width:100px; height:100px; position:absolute; background:yellow;"></div>
 47
 48 <div style="left:0; top:200px; width:100px; height:100px; position:absolute; background:blue;"></div>
 49 <div style="left:100px; top:200px; width:100px; height:100px; position:absolute; background:yellow;"></div>
 50 <div style="left:200px; top:200px; width:100px; height:100px; position:absolute; background:green;"></div>
 51</body>
 52</html>

LayoutTests/fast/repaint/fixed-right-bottom-in-page-scale-expected.png

Exception raised during decoding git binary patch:
Error running git apply --directory=/tmp
with patch:
diff --git a/PrettyPatch20260325-3888-nxgvl.bin b/PrettyPatch20260325-3888-nxgvl.bin
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 0
HcmV?d00001

...
error: invalid path '/tmp/PrettyPatch20260325-3888-nxgvl.bin'

/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:924:in `run_git_apply_on_patch'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:935:in `extract_contents_from_git_binary_literal_chunk'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:950:in `extract_contents_from_remote'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:713:in `initialize'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:845:in `new'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:845:in `block in parse'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:845:in `collect'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:845:in `parse'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:21:in `prettify'
/var/www/html/PrettyPatch/prettify.rb:30:in `<main>'

LayoutTests/fast/repaint/fixed-right-bottom-in-page-scale-expected.txt

 1

LayoutTests/fast/repaint/fixed-right-bottom-in-page-scale.html

 1<html>
 2<head>
 3 <style>
 4 ::-webkit-scrollbar {
 5 width: 0px;
 6 height: 0px;
 7 }
 8 </style>
 9 <script>
 10 window.enablePixelTesting = true;
 11
 12 function scroll() {
 13 window.scrollTo(100,100);
 14 }
 15
 16 function scaleWithEventSender() {
 17 var scaleFactor = 2.0;
 18 var scaleOffset = 0;
 19 if (window.eventSender) {
 20 eventSender.scalePageBy(scaleFactor, scaleOffset, scaleOffset);
 21 }
 22 }
 23
 24 function test() {
 25 document.body.style.width = (document.body.clientWidth + 100) + "px";
 26 scaleWithEventSender();
 27 scroll();
 28 }
 29 </script>
 30 <script src="../js/resources/js-test-pre.js"></script>
 31</head>
 32<body style="height: 2000px; width: 2000px; margin:0px;" onload="test();">
 33 <div style="position: fixed; bottom: 100px; right: 100px; z-index: 1">
 34 <div style="left:0; top:0; width:100px; height:100px; position:absolute; background:black;"></div>
 35 <div style="left:100px; top:0; width:100px; height:100px; position:absolute; background:green;"></div>
 36
 37 <div style="left:0px; top:100px; width:100px; height:100px; position:absolute; background:yellow;"></div>
 38 <div style="left:100px; top:100px; width:100px; height:100px; position:absolute; background:blue;"></div>
 39 </div>
 40</body>
 41</html>

LayoutTests/fast/repaint/fixed-right-in-page-scale-expected.png

Exception raised during decoding git binary patch:
Error running git apply --directory=/tmp
with patch:
diff --git a/PrettyPatch20260325-3888-7t2w2z.bin b/PrettyPatch20260325-3888-7t2w2z.bin
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 0
HcmV?d00001

...
error: invalid path '/tmp/PrettyPatch20260325-3888-7t2w2z.bin'

/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:924:in `run_git_apply_on_patch'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:935:in `extract_contents_from_git_binary_literal_chunk'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:950:in `extract_contents_from_remote'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:713:in `initialize'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:845:in `new'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:845:in `block in parse'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:845:in `collect'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:845:in `parse'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:21:in `prettify'
/var/www/html/PrettyPatch/prettify.rb:30:in `<main>'

LayoutTests/fast/repaint/fixed-right-in-page-scale-expected.txt

 1

LayoutTests/fast/repaint/fixed-right-in-page-scale.html

 1<html>
 2<head>
 3 <style>
 4 ::-webkit-scrollbar {
 5 width: 0px;
 6 height: 0px;
 7 }
 8 </style>
 9 <script>
 10 window.enablePixelTesting = true;
 11
 12 function scroll() {
 13 window.scrollTo(100,100);
 14 }
 15
 16 function scaleWithEventSender() {
 17 var scaleFactor = 2.0;
 18 var scaleOffset = 0;
 19 if (window.eventSender) {
 20 eventSender.scalePageBy(scaleFactor, scaleOffset, scaleOffset);
 21 }
 22 }
 23
 24 function test() {
 25 scaleWithEventSender();
 26 scroll();
 27 }
 28 </script>
 29 <script src="../js/resources/js-test-pre.js"></script>
 30</head>
 31<body style="height:2000px; width: 2000px; margin:0px;" onload="test();">
 32 <div style="position: fixed; top: -100px; right: 100px; z-index: 1">
 33 <div style="left:0; top:0; width:100px; height:100px; position:absolute; background:yellow;"></div>
 34 <div style="left:100px; top:0; width:100px; height:100px; position:absolute; background:green;"></div>
 35
 36 <div style="left:0; top:100px; width:100px; height:100px; position:absolute; background:black;"></div>
 37 <div style="left:100px; top:100px; width:100px; height:100px; position:absolute; background:blue;"></div>
 38 </div>
 39 <div style="position: absolute; width:300px; height:300px; top: 0px; left: 300px" id="grid">
 40 <div style="float:left; width:100px; height:100px; background:yellow;"></div>
 41 <div style="float:left; width:100px; height:100px; background:green;"></div>
 42 <div style="float:left; width:100px; height:100px; background:blue;"></div>
 43
 44 <div style="float:left; width:100px; height:100px; background: green;"></div>
 45 <div style="float:left; width:100px; height:100px; background:blue;"></div>
 46 <div style="float:left; width:100px; height:100px; background:yellow;"></div>
 47
 48 <div style="float:left; width:100px; height:100px; background:blue;"></div>
 49 <div style="float:left; width:100px; height:100px; background:yellow;"></div>
 50 <div style="float:left; width:100px; height:100px; background:green;"></div>
 51 </div>
 52 <div id="console"></div>
 53</body>
 54</html>

Source/WebCore/ChangeLog

112011-09-22 Alpha Lam <hclam@chromium.org>
22
 3 https://bugs.webkit.org/show_bug.cgi?id=68617
 4 Proper positioning for position:fixed when page scale is in use.
 5
 6 position:fixed elements should be fixed to the frame instead of the
 7 layout rectangle of the document.
 8
 9 Reviewed by NOBODY (OOPS!).
 10
 11 Tests: fast/repaint/fixed-right-bottom-in-page-scale.html
 12 fast/repaint/fixed-right-in-page-scale.html
 13 fast/repaint/fixed-in-page-scale.html
 14
 15 * page/FrameView.cpp:
 16 (WebCore::FrameView::scrollXForFixedPosition):
 17 (WebCore::FrameView::scrollYForFixedPosition):
 18 The original logic for scrollX and scrollY for fixed elements has
 19 problems and rather than having proportional to the scroll position
 20 in the document this patch just set it to the visible content rect.
 21 * rendering/RenderBox.cpp:
 22 (WebCore::RenderBox::containingBlockLogicalWidthForPositioned):
 23 (WebCore::RenderBox::containingBlockLogicalHeightForPositioned):
 24 Container for position:fixed is the frame instead of the layout
 25 rect of the document. This allows proper positioning of these elements
 26 to the right and bottom.
 27
 282011-09-22 Alpha Lam <hclam@chromium.org>
 29
330 Define export symbol correctly due to rename of pageScaleFactor to
431 frameScaleFactor.
532

Source/WebCore/page/FrameView.cpp

@@LayoutUnit FrameView::scrollXForFixedPosition() const
13501350 return x;
13511351
13521352 float frameScaleFactor = m_frame->frameScaleFactor();
1353 
1354  // When the page is scaled, the scaled "viewport" with respect to which fixed object are positioned
1355  // doesn't move as fast as the content view, so that when the content is scrolled all the way to the
1356  // end, the bottom of the scaled "viewport" touches the bottom of the real viewport.
1357  float dragFactor = (contentsWidth() - visibleContentWidth * frameScaleFactor) / maxX;
1358 
1359  return x * dragFactor / frameScaleFactor;
 1353 return x / frameScaleFactor;
13601354}
13611355
13621356LayoutUnit FrameView::scrollYForFixedPosition() const
13631357{
13641358 LayoutUnit visibleContentHeight = visibleContentRect().height();
1365 
13661359 LayoutUnit maxY = contentsHeight() - visibleContentHeight;
 1360
13671361 if (maxY == 0)
13681362 return 0;
13691363

@@LayoutUnit FrameView::scrollYForFixedPosition() const
13851379 return y;
13861380
13871381 float frameScaleFactor = m_frame->frameScaleFactor();
1388  float dragFactor = (contentsHeight() - visibleContentHeight * frameScaleFactor) / maxY;
1389 
1390  return y * dragFactor / frameScaleFactor;
 1382 return y / frameScaleFactor;
13911383}
13921384
13931385LayoutSize FrameView::scrollOffsetForFixedPosition() const

Source/WebCore/rendering/RenderBox.cpp

@@void RenderBox::computeBlockDirectionMargins(RenderBlock* containingBlock)
21572157
21582158int RenderBox::containingBlockLogicalWidthForPositioned(const RenderBoxModelObject* containingBlock, bool checkForPerpendicularWritingMode) const
21592159{
 2160 // Container for position:fixed is the frame.
 2161 if (style() && style()->position() == FixedPosition && view() && view()->frame() && view()->frameView())
 2162 return (view()->isHorizontalWritingMode() ? view()->frameView()->visibleWidth() : view()->frameView()->visibleHeight()) / view()->frame()->frameScaleFactor();
 2163
21602164 if (checkForPerpendicularWritingMode && containingBlock->isHorizontalWritingMode() != isHorizontalWritingMode())
21612165 return containingBlockLogicalHeightForPositioned(containingBlock, false);
21622166

@@int RenderBox::containingBlockLogicalWidthForPositioned(const RenderBoxModelObje
21882192
21892193int RenderBox::containingBlockLogicalHeightForPositioned(const RenderBoxModelObject* containingBlock, bool checkForPerpendicularWritingMode) const
21902194{
 2195 if (style() && style()->position() == FixedPosition && view() && view()->frame() && view()->frameView())
 2196 return (view()->isHorizontalWritingMode() ? view()->frameView()->visibleHeight() : view()->frameView()->visibleWidth()) / view()->frame()->frameScaleFactor();
 2197
21912198 if (checkForPerpendicularWritingMode && containingBlock->isHorizontalWritingMode() != isHorizontalWritingMode())
21922199 return containingBlockLogicalWidthForPositioned(containingBlock, false);
21932200