<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[173074] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/173074">173074</a></dd>
<dt>Author</dt> <dd>benjamin@webkit.org</dd>
<dt>Date</dt> <dd>2014-08-28 13:01:18 -0700 (Thu, 28 Aug 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Scrolling with spacebar on a page with fixed header breaks reading flow
https://bugs.webkit.org/show_bug.cgi?id=135506

Patch by Benjamin Poulain &lt;bpoulain@apple.com&gt; on 2014-08-28
Reviewed by Simon Fraser.

Source/WebCore:

When scrolling by page, find the height of any bar that is obscuring the top or bottom of the page,
and substract that height from the step to scroll.

Tests: scrollbars/scrolling-backward-by-page-accounting-bottom-fixed-elements-on-keyboard-spacebar.html
       scrollbars/scrolling-backward-by-page-on-keyboard-spacebar.html
       scrollbars/scrolling-by-page-accounting-oversized-fixed-elements-on-keyboard-spacebar.html
       scrollbars/scrolling-by-page-accounting-top-fixed-elements-on-keyboard-spacebar.html
       scrollbars/scrolling-by-page-accounting-top-fixed-elements-with-negative-top-on-keyboard-spacebar.html
       scrollbars/scrolling-by-page-ignoring-hidden-fixed-elements-on-keyboard-spacebar.html
       scrollbars/scrolling-by-page-ignoring-transparent-fixed-elements-on-keyboard-spacebar.html
       scrollbars/scrolling-by-page-on-keyboard-spacebar.html

* WebCore.exp.in:
* page/FrameView.cpp:
(WebCore::FrameView::adjustScrollStepForFixedContent):
* page/FrameView.h:
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::adjustScrollStepForFixedContent):
(WebCore::ScrollableArea::scroll):
* platform/ScrollableArea.h:

LayoutTests:

There was pretty much no test coverage for scrolling by page, add some tests.

* fast/events/scrollbar-double-click-expected.txt:
* platform/mac-wk1/TestExpectations:
* scrollbars/scrolling-backward-by-page-accounting-bottom-fixed-elements-on-keyboard-spacebar-expected.txt: Added.
* scrollbars/scrolling-backward-by-page-accounting-bottom-fixed-elements-on-keyboard-spacebar.html: Added.
* scrollbars/scrolling-backward-by-page-on-keyboard-spacebar-expected.txt: Added.
* scrollbars/scrolling-backward-by-page-on-keyboard-spacebar.html: Added.
* scrollbars/scrolling-by-page-accounting-oversized-fixed-elements-on-keyboard-spacebar-expected.txt: Added.
* scrollbars/scrolling-by-page-accounting-oversized-fixed-elements-on-keyboard-spacebar.html: Added.
* scrollbars/scrolling-by-page-accounting-top-fixed-elements-on-keyboard-spacebar-expected.txt: Added.
* scrollbars/scrolling-by-page-accounting-top-fixed-elements-on-keyboard-spacebar.html: Added.
* scrollbars/scrolling-by-page-accounting-top-fixed-elements-with-negative-top-on-keyboard-spacebar-expected.txt: Added.
* scrollbars/scrolling-by-page-accounting-top-fixed-elements-with-negative-top-on-keyboard-spacebar.html: Added.
* scrollbars/scrolling-by-page-ignoring-hidden-fixed-elements-on-keyboard-spacebar-expected.txt: Added.
* scrollbars/scrolling-by-page-ignoring-hidden-fixed-elements-on-keyboard-spacebar.html: Added.
* scrollbars/scrolling-by-page-ignoring-transparent-fixed-elements-on-keyboard-spacebar-expected.txt: Added.
* scrollbars/scrolling-by-page-ignoring-transparent-fixed-elements-on-keyboard-spacebar.html: Added.
* scrollbars/scrolling-by-page-on-keyboard-spacebar-expected.txt: Added.
* scrollbars/scrolling-by-page-on-keyboard-spacebar.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfasteventsscrollbardoubleclickexpectedtxt">trunk/LayoutTests/fast/events/scrollbar-double-click-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk1TestExpectations">trunk/LayoutTests/platform/mac-wk1/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewh">trunk/Source/WebCore/page/FrameView.h</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollableAreacpp">trunk/Source/WebCore/platform/ScrollableArea.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollableAreah">trunk/Source/WebCore/platform/ScrollableArea.h</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollbarh">trunk/Source/WebCore/platform/Scrollbar.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmockScrollbarThemeMockh">trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsscrollbarsscrollingbackwardbypageaccountingbottomfixedelementsonkeyboardspacebarexpectedtxt">trunk/LayoutTests/scrollbars/scrolling-backward-by-page-accounting-bottom-fixed-elements-on-keyboard-spacebar-expected.txt</a></li>
<li><a href="#trunkLayoutTestsscrollbarsscrollingbackwardbypageaccountingbottomfixedelementsonkeyboardspacebarhtml">trunk/LayoutTests/scrollbars/scrolling-backward-by-page-accounting-bottom-fixed-elements-on-keyboard-spacebar.html</a></li>
<li><a href="#trunkLayoutTestsscrollbarsscrollingbackwardbypageonkeyboardspacebarexpectedtxt">trunk/LayoutTests/scrollbars/scrolling-backward-by-page-on-keyboard-spacebar-expected.txt</a></li>
<li><a href="#trunkLayoutTestsscrollbarsscrollingbackwardbypageonkeyboardspacebarhtml">trunk/LayoutTests/scrollbars/scrolling-backward-by-page-on-keyboard-spacebar.html</a></li>
<li><a href="#trunkLayoutTestsscrollbarsscrollingbypageaccountingoversizedfixedelementsonkeyboardspacebarexpectedtxt">trunk/LayoutTests/scrollbars/scrolling-by-page-accounting-oversized-fixed-elements-on-keyboard-spacebar-expected.txt</a></li>
<li><a href="#trunkLayoutTestsscrollbarsscrollingbypageaccountingoversizedfixedelementsonkeyboardspacebarhtml">trunk/LayoutTests/scrollbars/scrolling-by-page-accounting-oversized-fixed-elements-on-keyboard-spacebar.html</a></li>
<li><a href="#trunkLayoutTestsscrollbarsscrollingbypageaccountingtopfixedelementsonkeyboardspacebarexpectedtxt">trunk/LayoutTests/scrollbars/scrolling-by-page-accounting-top-fixed-elements-on-keyboard-spacebar-expected.txt</a></li>
<li><a href="#trunkLayoutTestsscrollbarsscrollingbypageaccountingtopfixedelementsonkeyboardspacebarhtml">trunk/LayoutTests/scrollbars/scrolling-by-page-accounting-top-fixed-elements-on-keyboard-spacebar.html</a></li>
<li><a href="#trunkLayoutTestsscrollbarsscrollingbypageaccountingtopfixedelementswithnegativetoponkeyboardspacebarexpectedtxt">trunk/LayoutTests/scrollbars/scrolling-by-page-accounting-top-fixed-elements-with-negative-top-on-keyboard-spacebar-expected.txt</a></li>
<li><a href="#trunkLayoutTestsscrollbarsscrollingbypageaccountingtopfixedelementswithnegativetoponkeyboardspacebarhtml">trunk/LayoutTests/scrollbars/scrolling-by-page-accounting-top-fixed-elements-with-negative-top-on-keyboard-spacebar.html</a></li>
<li><a href="#trunkLayoutTestsscrollbarsscrollingbypageignoringhiddenfixedelementsonkeyboardspacebarexpectedtxt">trunk/LayoutTests/scrollbars/scrolling-by-page-ignoring-hidden-fixed-elements-on-keyboard-spacebar-expected.txt</a></li>
<li><a href="#trunkLayoutTestsscrollbarsscrollingbypageignoringhiddenfixedelementsonkeyboardspacebarhtml">trunk/LayoutTests/scrollbars/scrolling-by-page-ignoring-hidden-fixed-elements-on-keyboard-spacebar.html</a></li>
<li><a href="#trunkLayoutTestsscrollbarsscrollingbypageignoringtransparentfixedelementsonkeyboardspacebarexpectedtxt">trunk/LayoutTests/scrollbars/scrolling-by-page-ignoring-transparent-fixed-elements-on-keyboard-spacebar-expected.txt</a></li>
<li><a href="#trunkLayoutTestsscrollbarsscrollingbypageignoringtransparentfixedelementsonkeyboardspacebarhtml">trunk/LayoutTests/scrollbars/scrolling-by-page-ignoring-transparent-fixed-elements-on-keyboard-spacebar.html</a></li>
<li><a href="#trunkLayoutTestsscrollbarsscrollingbypageonkeyboardspacebarexpectedtxt">trunk/LayoutTests/scrollbars/scrolling-by-page-on-keyboard-spacebar-expected.txt</a></li>
<li><a href="#trunkLayoutTestsscrollbarsscrollingbypageonkeyboardspacebarhtml">trunk/LayoutTests/scrollbars/scrolling-by-page-on-keyboard-spacebar.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (173073 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-08-28 19:48:50 UTC (rev 173073)
+++ trunk/LayoutTests/ChangeLog        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2014-08-28  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
+
+        Scrolling with spacebar on a page with fixed header breaks reading flow
+        https://bugs.webkit.org/show_bug.cgi?id=135506
+
+        Reviewed by Simon Fraser.
+
+        There was pretty much no test coverage for scrolling by page, add some tests.
+
+        * fast/events/scrollbar-double-click-expected.txt:
+        * platform/mac-wk1/TestExpectations:
+        * scrollbars/scrolling-backward-by-page-accounting-bottom-fixed-elements-on-keyboard-spacebar-expected.txt: Added.
+        * scrollbars/scrolling-backward-by-page-accounting-bottom-fixed-elements-on-keyboard-spacebar.html: Added.
+        * scrollbars/scrolling-backward-by-page-on-keyboard-spacebar-expected.txt: Added.
+        * scrollbars/scrolling-backward-by-page-on-keyboard-spacebar.html: Added.
+        * scrollbars/scrolling-by-page-accounting-oversized-fixed-elements-on-keyboard-spacebar-expected.txt: Added.
+        * scrollbars/scrolling-by-page-accounting-oversized-fixed-elements-on-keyboard-spacebar.html: Added.
+        * scrollbars/scrolling-by-page-accounting-top-fixed-elements-on-keyboard-spacebar-expected.txt: Added.
+        * scrollbars/scrolling-by-page-accounting-top-fixed-elements-on-keyboard-spacebar.html: Added.
+        * scrollbars/scrolling-by-page-accounting-top-fixed-elements-with-negative-top-on-keyboard-spacebar-expected.txt: Added.
+        * scrollbars/scrolling-by-page-accounting-top-fixed-elements-with-negative-top-on-keyboard-spacebar.html: Added.
+        * scrollbars/scrolling-by-page-ignoring-hidden-fixed-elements-on-keyboard-spacebar-expected.txt: Added.
+        * scrollbars/scrolling-by-page-ignoring-hidden-fixed-elements-on-keyboard-spacebar.html: Added.
+        * scrollbars/scrolling-by-page-ignoring-transparent-fixed-elements-on-keyboard-spacebar-expected.txt: Added.
+        * scrollbars/scrolling-by-page-ignoring-transparent-fixed-elements-on-keyboard-spacebar.html: Added.
+        * scrollbars/scrolling-by-page-on-keyboard-spacebar-expected.txt: Added.
+        * scrollbars/scrolling-by-page-on-keyboard-spacebar.html: Added.
+
</ins><span class="cx"> 2014-08-27  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         FTL should be able to do polymorphic call inlining
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsscrollbardoubleclickexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/scrollbar-double-click-expected.txt (173073 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/scrollbar-double-click-expected.txt        2014-08-28 19:48:50 UTC (rev 173073)
+++ trunk/LayoutTests/fast/events/scrollbar-double-click-expected.txt        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -1 +1 @@
</span><del>-Scroll offset is 700
</del><ins>+Scroll offset is 720
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk1TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (173073 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk1/TestExpectations        2014-08-28 19:48:50 UTC (rev 173073)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -54,5 +54,15 @@
</span><span class="cx"> [ MountainLion Mavericks ] platform/mac/fast/scrolling/scroll-select-bottom-test.html [ Skip ]
</span><span class="cx"> [ MountainLion Mavericks ] platform/mac-wk1/fast/backgrounds/top-content-inset-fixed-attachment.html [ Skip ]
</span><span class="cx"> 
</span><ins>+# WK1 uses the native scrollview for scrolling by page.
+scrollbars/scrolling-backward-by-page-accounting-bottom-fixed-elements-on-keyboard-spacebar.html
+scrollbars/scrolling-backward-by-page-on-keyboard-spacebar.html
+scrollbars/scrolling-by-page-accounting-oversized-fixed-elements-on-keyboard-spacebar.html
+scrollbars/scrolling-by-page-accounting-top-fixed-elements-on-keyboard-spacebar.html
+scrollbars/scrolling-by-page-accounting-top-fixed-elements-with-negative-top-on-keyboard-spacebar.html
+scrollbars/scrolling-by-page-ignoring-hidden-fixed-elements-on-keyboard-spacebar.html
+scrollbars/scrolling-by-page-ignoring-transparent-fixed-elements-on-keyboard-spacebar.html
+scrollbars/scrolling-by-page-on-keyboard-spacebar.html
+
</ins><span class="cx"> ### END OF (2) Failures without bug reports
</span><span class="cx"> ########################################
</span></span></pre></div>
<a id="trunkLayoutTestsscrollbarsscrollingbackwardbypageaccountingbottomfixedelementsonkeyboardspacebarexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/scrollbars/scrolling-backward-by-page-accounting-bottom-fixed-elements-on-keyboard-spacebar-expected.txt (0 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/scrollbars/scrolling-backward-by-page-accounting-bottom-fixed-elements-on-keyboard-spacebar-expected.txt                                (rev 0)
+++ trunk/LayoutTests/scrollbars/scrolling-backward-by-page-accounting-bottom-fixed-elements-on-keyboard-spacebar-expected.txt        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test that scrolling backward by page excludes the area taken by fixed element covering the full width.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS Scrolled to 520
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsscrollbarsscrollingbackwardbypageaccountingbottomfixedelementsonkeyboardspacebarhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/scrollbars/scrolling-backward-by-page-accounting-bottom-fixed-elements-on-keyboard-spacebar.html (0 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/scrollbars/scrolling-backward-by-page-accounting-bottom-fixed-elements-on-keyboard-spacebar.html                                (rev 0)
+++ trunk/LayoutTests/scrollbars/scrolling-backward-by-page-accounting-bottom-fixed-elements-on-keyboard-spacebar.html        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -0,0 +1,76 @@
</span><ins>+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            body {
+                height: 10000px;
+            }
+            #bottom-bar {
+                position: fixed;
+                height: 120px;
+                width: 100%;
+                background-color: green;
+                bottom: 0;
+                left: 0;
+            }
+            /* This fixed element does not cover the entire width and should be ignored. */
+            #ignored-right {
+                position: fixed;
+                width: 20px;
+                height: 5000px;
+                background-color: red;
+                right: 0;
+                top: 0;
+            }
+            /* This fixed element does not cover an edge and should be ignored. */
+            #ignored-center {
+                position: fixed;
+                width: 100%;
+                height: 150px;
+                background-color: red;
+                left: 0;
+                top: 50%;
+            }
+        &lt;/style&gt;
+        &lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;div id=&quot;bottom-bar&quot;&gt;&lt;/div&gt;
+        &lt;div id=&quot;ignored-right&quot;&gt;&lt;/div&gt;
+        &lt;div id=&quot;ignored-center&quot;&gt;&lt;/div&gt;
+        &lt;script&gt;
+            description(&quot;Test that scrolling backward by page excludes the area taken by fixed element covering the full width.&quot;);
+
+            jsTestIsAsync = true;
+
+            var failTimeoutId;
+            function test() {
+                if (window.eventSender) {
+                    // Force the first layout to avoid the suppressed scrollbar cases.
+                    scratch = document.documentElement.offsetWidth;
+                    scrollBy(0, 1000);
+
+                    // Avoid special cases for being &quot;onload&quot;.
+                    setTimeout(function() {
+                        eventSender.keyDown(' ', ['shiftKey']);
+                    } , 0);
+
+                    failTimeoutId = setTimeout(function() {
+                        testFailed(&quot;The scrollview failed to scroll in response to the event.&quot;);
+                        debug(&quot;window.scrollY = &quot; + window.scrollY + &quot; excepted value around &quot; + (1000 - (window.innerHeight - 120)));
+                        finishJSTest();
+                    }, 1000);
+                }
+            }
+
+            window.addEventListener(&quot;scroll&quot;, function() {
+                if (window.scrollY == 1000 - (window.innerHeight - 120)) {
+                    testPassed(&quot;Scrolled to &quot; + window.scrollY);
+                    clearTimeout(failTimeoutId);
+                    finishJSTest();
+                }
+            })
+            window.addEventListener(&quot;load&quot;, test);
+        &lt;/script&gt;
+        &lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsscrollbarsscrollingbackwardbypageonkeyboardspacebarexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/scrollbars/scrolling-backward-by-page-on-keyboard-spacebar-expected.txt (0 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/scrollbars/scrolling-backward-by-page-on-keyboard-spacebar-expected.txt                                (rev 0)
+++ trunk/LayoutTests/scrollbars/scrolling-backward-by-page-on-keyboard-spacebar-expected.txt        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test scrolling backward with page granularity by using the space bar.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS Scrolled to 440
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsscrollbarsscrollingbackwardbypageonkeyboardspacebarhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/scrollbars/scrolling-backward-by-page-on-keyboard-spacebar.html (0 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/scrollbars/scrolling-backward-by-page-on-keyboard-spacebar.html                                (rev 0)
+++ trunk/LayoutTests/scrollbars/scrolling-backward-by-page-on-keyboard-spacebar.html        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            body {
+                height: 10000px;
+            }
+        &lt;/style&gt;
+        &lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;script&gt;
+            description(&quot;Test scrolling backward with page granularity by using the space bar.&quot;);
+
+            jsTestIsAsync = true;
+
+            var failTimeoutId;
+            function test() {
+                if (window.eventSender) {
+                    // Force the first layout to avoid the suppressed scrollbar cases.
+                    scratch = document.documentElement.offsetWidth;
+                    scrollBy(0, 1000);
+
+                    // Avoid special cases for being &quot;onload&quot;.
+                    setTimeout(function() {
+                        eventSender.keyDown(' ', ['shiftKey']);
+                    } , 0);
+
+                    failTimeoutId = setTimeout(function() {
+                        testFailed(&quot;The scrollview failed to scroll in response to the event.&quot;);
+                        debug(&quot;window.scrollY = &quot; + window.scrollY + &quot; excepted value around &quot; + (1000 - (window.innerHeight - 40)));
+                        finishJSTest();
+                    }, 1000);
+                }
+            }
+
+            window.addEventListener(&quot;scroll&quot;, function() {
+                if (window.scrollY == 1000 - (window.innerHeight - 40)) {
+                    testPassed(&quot;Scrolled to &quot; + window.scrollY);
+                    clearTimeout(failTimeoutId);
+                    finishJSTest();
+                }
+            })
+            window.addEventListener(&quot;load&quot;, test);
+        &lt;/script&gt;
+        &lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsscrollbarsscrollingbypageaccountingoversizedfixedelementsonkeyboardspacebarexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/scrollbars/scrolling-by-page-accounting-oversized-fixed-elements-on-keyboard-spacebar-expected.txt (0 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/scrollbars/scrolling-by-page-accounting-oversized-fixed-elements-on-keyboard-spacebar-expected.txt                                (rev 0)
+++ trunk/LayoutTests/scrollbars/scrolling-by-page-accounting-oversized-fixed-elements-on-keyboard-spacebar-expected.txt        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test scrolling with page granularity by using the space bar excludes the height of fixed element covering the full page width. In this case, the cumulative size of both bars is larger than the threshold, and only 120px are removed from the 240px fixed height.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS Scrolled to 480
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsscrollbarsscrollingbypageaccountingoversizedfixedelementsonkeyboardspacebarhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/scrollbars/scrolling-by-page-accounting-oversized-fixed-elements-on-keyboard-spacebar.html (0 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/scrollbars/scrolling-by-page-accounting-oversized-fixed-elements-on-keyboard-spacebar.html                                (rev 0)
+++ trunk/LayoutTests/scrollbars/scrolling-by-page-accounting-oversized-fixed-elements-on-keyboard-spacebar.html        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -0,0 +1,84 @@
</span><ins>+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            body {
+                height: 10000px;
+            }
+            #top-bar {
+                position: fixed;
+                width: 100%;
+                height: 120px;
+                background-color: green;
+                top: 0;
+                left: 0;
+            }
+            #bottom-bar {
+                position: fixed;
+                width: 100%;
+                height: 120px;
+                background-color: green;
+                bottom: 0;
+                left: 0;
+            }
+            /* This fixed element does not cover the entire width and should be ignored. */
+            #ignored-left {
+                position: fixed;
+                width: 20px;
+                height: 5000px;
+                background-color: red;
+                left: 0;
+                top: 0;
+            }
+            /* This fixed element does not cover an edge and should be ignored. */
+            #ignored-center {
+                position: fixed;
+                width: 100%;
+                height: 150px;
+                background-color: red;
+                left: 0;
+                top: 50%;
+            }
+        &lt;/style&gt;
+        &lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;div id=&quot;top-bar&quot;&gt;&lt;/div&gt;
+        &lt;div id=&quot;bottom-bar&quot;&gt;&lt;/div&gt;
+        &lt;div id=&quot;ignored-left&quot;&gt;&lt;/div&gt;
+        &lt;div id=&quot;ignored-center&quot;&gt;&lt;/div&gt;
+        &lt;script&gt;
+            description(&quot;Test scrolling with page granularity by using the space bar excludes the height of fixed element covering the full page width. In this case, the cumulative size of both bars is larger than the threshold, and only 120px are removed from the 240px fixed height.&quot;);
+
+            jsTestIsAsync = true;
+
+            var failTimeoutId;
+            function test() {
+                if (window.eventSender) {
+                    // Force the first layout to avoid the suppressed scrollbar cases.
+                    scratch = document.documentElement.offsetWidth;
+
+                    // Avoid special cases for being &quot;onload&quot;.
+                    setTimeout(function() {
+                        eventSender.keyDown(' ');
+                    } , 0);
+
+                    failTimeoutId = setTimeout(function() {
+                        testFailed(&quot;The scrollview failed to scroll in response to the event.&quot;);
+                        debug(&quot;window.scrollY = &quot; + window.scrollY + &quot; excepted value around &quot; + (window.innerHeight - 120));
+                        finishJSTest();
+                    }, 1000);
+                }
+            }
+
+            window.addEventListener(&quot;scroll&quot;, function() {
+                if (window.scrollY == window.innerHeight - 120) {
+                    testPassed(&quot;Scrolled to &quot; + window.scrollY);
+                    clearTimeout(failTimeoutId);
+                    finishJSTest();
+                }
+            })
+            window.addEventListener(&quot;load&quot;, test);
+        &lt;/script&gt;
+        &lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsscrollbarsscrollingbypageaccountingtopfixedelementsonkeyboardspacebarexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/scrollbars/scrolling-by-page-accounting-top-fixed-elements-on-keyboard-spacebar-expected.txt (0 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/scrollbars/scrolling-by-page-accounting-top-fixed-elements-on-keyboard-spacebar-expected.txt                                (rev 0)
+++ trunk/LayoutTests/scrollbars/scrolling-by-page-accounting-top-fixed-elements-on-keyboard-spacebar-expected.txt        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test scrolling with page granularity by using the space bar excludes the height of fixed element covering the full page width.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS Scrolled to 480
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsscrollbarsscrollingbypageaccountingtopfixedelementsonkeyboardspacebarhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/scrollbars/scrolling-by-page-accounting-top-fixed-elements-on-keyboard-spacebar.html (0 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/scrollbars/scrolling-by-page-accounting-top-fixed-elements-on-keyboard-spacebar.html                                (rev 0)
+++ trunk/LayoutTests/scrollbars/scrolling-by-page-accounting-top-fixed-elements-on-keyboard-spacebar.html        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -0,0 +1,75 @@
</span><ins>+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            body {
+                height: 10000px;
+            }
+            #top-bar {
+                position: fixed;
+                width: 100%;
+                height: 120px;
+                background-color: green;
+                top: 0;
+                left: 0;
+            }
+            /* This fixed element does not cover the entire width and should be ignored. */
+            #ignored-left {
+                position: fixed;
+                width: 20px;
+                height: 5000px;
+                background-color: red;
+                left: 0;
+                top: 0;
+            }
+            /* This fixed element does not cover an edge and should be ignored. */
+            #ignored-center {
+                position: fixed;
+                width: 100%;
+                height: 150px;
+                background-color: red;
+                left: 0;
+                top: 50%;
+            }
+        &lt;/style&gt;
+        &lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;div id=&quot;top-bar&quot;&gt;&lt;/div&gt;
+        &lt;div id=&quot;ignored-left&quot;&gt;&lt;/div&gt;
+        &lt;div id=&quot;ignored-center&quot;&gt;&lt;/div&gt;
+        &lt;script&gt;
+            description(&quot;Test scrolling with page granularity by using the space bar excludes the height of fixed element covering the full page width.&quot;);
+
+            jsTestIsAsync = true;
+
+            var failTimeoutId;
+            function test() {
+                if (window.eventSender) {
+                    // Force the first layout to avoid the suppressed scrollbar cases.
+                    scratch = document.documentElement.offsetWidth;
+
+                    // Avoid special cases for being &quot;onload&quot;.
+                    setTimeout(function() {
+                        eventSender.keyDown(' ');
+                    } , 0);
+
+                    failTimeoutId = setTimeout(function() {
+                        testFailed(&quot;The scrollview failed to scroll in response to the event.&quot;);
+                        debug(&quot;window.scrollY = &quot; + window.scrollY + &quot; excepted value around &quot; + (window.innerHeight - 120));
+                        finishJSTest();
+                    }, 1000);
+                }
+            }
+
+            window.addEventListener(&quot;scroll&quot;, function() {
+                if (window.scrollY == window.innerHeight - 120) {
+                    testPassed(&quot;Scrolled to &quot; + window.scrollY);
+                    clearTimeout(failTimeoutId);
+                    finishJSTest();
+                }
+            })
+            window.addEventListener(&quot;load&quot;, test);
+        &lt;/script&gt;
+        &lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsscrollbarsscrollingbypageaccountingtopfixedelementswithnegativetoponkeyboardspacebarexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/scrollbars/scrolling-by-page-accounting-top-fixed-elements-with-negative-top-on-keyboard-spacebar-expected.txt (0 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/scrollbars/scrolling-by-page-accounting-top-fixed-elements-with-negative-top-on-keyboard-spacebar-expected.txt                                (rev 0)
+++ trunk/LayoutTests/scrollbars/scrolling-by-page-accounting-top-fixed-elements-with-negative-top-on-keyboard-spacebar-expected.txt        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test scrolling with page granularity by using the space bar excludes the height of fixed element covering the full page width. In this case, the top fixed element starts above the page, but the overlap should still be accounted for.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS Scrolled to 510
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsscrollbarsscrollingbypageaccountingtopfixedelementswithnegativetoponkeyboardspacebarhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/scrollbars/scrolling-by-page-accounting-top-fixed-elements-with-negative-top-on-keyboard-spacebar.html (0 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/scrollbars/scrolling-by-page-accounting-top-fixed-elements-with-negative-top-on-keyboard-spacebar.html                                (rev 0)
+++ trunk/LayoutTests/scrollbars/scrolling-by-page-accounting-top-fixed-elements-with-negative-top-on-keyboard-spacebar.html        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -0,0 +1,76 @@
</span><ins>+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            body {
+                height: 10000px;
+            }
+            #top-bar {
+                position: fixed;
+                width: 100%;
+                height: 200px;
+                background-color: green;
+                top: -150px;
+                left: 0;
+            }
+            /* This fixed element does not cover the entire width and should be ignored. */
+            #ignored-left {
+                position: fixed;
+                width: 20px;
+                height: 5000px;
+                background-color: red;
+                left: 0;
+                top: 0;
+            }
+            /* This fixed element does not cover an edge and should be ignored. */
+            #ignored-center {
+                position: fixed;
+                width: 100%;
+                height: 150px;
+                background-color: red;
+                left: 0;
+                top: 50%;
+            }
+        &lt;/style&gt;
+        &lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;div id=&quot;top-bar&quot;&gt;&lt;/div&gt;
+        &lt;div id=&quot;ignored-left&quot;&gt;&lt;/div&gt;
+        &lt;div id=&quot;ignored-center&quot;&gt;&lt;/div&gt;
+        &lt;script&gt;
+            description(&quot;Test scrolling with page granularity by using the space bar excludes the height of fixed element covering the full page width. In this case, the top fixed element starts above the page, but the overlap should still be accounted for.&quot;);
+
+            jsTestIsAsync = true;
+
+            var maxOverlapBetweenPages = 40;
+            var failTimeoutId;
+            function test() {
+                if (window.eventSender) {
+                    // Force the first layout to avoid the suppressed scrollbar cases.
+                    scratch = document.documentElement.offsetWidth;
+
+                    // Avoid special cases for being &quot;onload&quot;.
+                    setTimeout(function() {
+                        eventSender.keyDown(' ');
+                    } , 0);
+
+                    failTimeoutId = setTimeout(function() {
+                        testFailed(&quot;The scrollview failed to scroll in response to the event.&quot;);
+                        debug(&quot;window.scrollY = &quot; + window.scrollY + &quot; excepted value around &quot; + (window.innerHeight - 50 - maxOverlapBetweenPages));
+                        finishJSTest();
+                    }, 1000);
+                }
+            }
+
+            window.addEventListener(&quot;scroll&quot;, function() {
+                if (window.scrollY == window.innerHeight - 50 - maxOverlapBetweenPages) {
+                    testPassed(&quot;Scrolled to &quot; + window.scrollY);
+                    clearTimeout(failTimeoutId);
+                    finishJSTest();
+                }
+            })
+            window.addEventListener(&quot;load&quot;, test);
+        &lt;/script&gt;
+        &lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsscrollbarsscrollingbypageignoringhiddenfixedelementsonkeyboardspacebarexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/scrollbars/scrolling-by-page-ignoring-hidden-fixed-elements-on-keyboard-spacebar-expected.txt (0 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/scrollbars/scrolling-by-page-ignoring-hidden-fixed-elements-on-keyboard-spacebar-expected.txt                                (rev 0)
+++ trunk/LayoutTests/scrollbars/scrolling-by-page-ignoring-hidden-fixed-elements-on-keyboard-spacebar-expected.txt        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test scrolling with page granularity by using the space bar. The fixed elements should be ignored because they are hidden.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS Scrolled to 560
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsscrollbarsscrollingbypageignoringhiddenfixedelementsonkeyboardspacebarhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/scrollbars/scrolling-by-page-ignoring-hidden-fixed-elements-on-keyboard-spacebar.html (0 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/scrollbars/scrolling-by-page-ignoring-hidden-fixed-elements-on-keyboard-spacebar.html                                (rev 0)
+++ trunk/LayoutTests/scrollbars/scrolling-by-page-ignoring-hidden-fixed-elements-on-keyboard-spacebar.html        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -0,0 +1,66 @@
</span><ins>+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            body {
+                height: 10000px;
+            }
+            #top-bar {
+                position: fixed;
+                width: 100%;
+                height: 200px;
+                background-color: green;
+                top: 0;
+                left: 0;
+                visibility: hidden;
+            }
+            #bottom-bar {
+                position: fixed;
+                width: 100%;
+                height: 200px;
+                background-color: green;
+                bottom: 0;
+                left: 0;
+                visibility: hidden;
+            }
+        &lt;/style&gt;
+        &lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;div id=&quot;top-bar&quot;&gt;&lt;/div&gt;
+        &lt;div id=&quot;bottom-bar&quot;&gt;&lt;/div&gt;
+        &lt;script&gt;
+            description(&quot;Test scrolling with page granularity by using the space bar. The fixed elements should be ignored because they are hidden.&quot;);
+
+            jsTestIsAsync = true;
+
+            var failTimeoutId;
+            function test() {
+                if (window.eventSender) {
+                    // Force the first layout to avoid the suppressed scrollbar cases.
+                    scratch = document.documentElement.offsetWidth;
+
+                    // Avoid special cases for being &quot;onload&quot;.
+                    setTimeout(function() {
+                        eventSender.keyDown(' ');
+                    } , 0);
+
+                    failTimeoutId = setTimeout(function() {
+                        testFailed(&quot;The scrollview failed to scroll in response to the event.&quot;);
+                        debug(&quot;window.scrollY = &quot; + window.scrollY + &quot; excepted value around &quot; + (window.innerHeight - 40));
+                        finishJSTest();
+                    }, 1000);
+                }
+            }
+
+            window.addEventListener(&quot;scroll&quot;, function() {
+                if (window.scrollY == window.innerHeight - 40) {
+                    testPassed(&quot;Scrolled to &quot; + window.scrollY);
+                    clearTimeout(failTimeoutId);
+                    finishJSTest();
+                }
+            })
+            window.addEventListener(&quot;load&quot;, test);
+        &lt;/script&gt;
+        &lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsscrollbarsscrollingbypageignoringtransparentfixedelementsonkeyboardspacebarexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/scrollbars/scrolling-by-page-ignoring-transparent-fixed-elements-on-keyboard-spacebar-expected.txt (0 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/scrollbars/scrolling-by-page-ignoring-transparent-fixed-elements-on-keyboard-spacebar-expected.txt                                (rev 0)
+++ trunk/LayoutTests/scrollbars/scrolling-by-page-ignoring-transparent-fixed-elements-on-keyboard-spacebar-expected.txt        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test scrolling with page granularity by using the space bar. The fixed elements should be ignored because they are transparent.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS Scrolled to 560
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsscrollbarsscrollingbypageignoringtransparentfixedelementsonkeyboardspacebarhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/scrollbars/scrolling-by-page-ignoring-transparent-fixed-elements-on-keyboard-spacebar.html (0 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/scrollbars/scrolling-by-page-ignoring-transparent-fixed-elements-on-keyboard-spacebar.html                                (rev 0)
+++ trunk/LayoutTests/scrollbars/scrolling-by-page-ignoring-transparent-fixed-elements-on-keyboard-spacebar.html        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -0,0 +1,66 @@
</span><ins>+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            body {
+                height: 10000px;
+            }
+            #top-bar {
+                position: fixed;
+                width: 100%;
+                height: 200px;
+                background-color: green;
+                top: 0;
+                left: 0;
+                opacity: 0;
+            }
+            #bottom-bar {
+                position: fixed;
+                width: 100%;
+                height: 200px;
+                background-color: green;
+                bottom: 0;
+                left: 0;
+                opacity: 0;
+            }
+        &lt;/style&gt;
+        &lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;div id=&quot;top-bar&quot;&gt;&lt;/div&gt;
+        &lt;div id=&quot;bottom-bar&quot;&gt;&lt;/div&gt;
+        &lt;script&gt;
+            description(&quot;Test scrolling with page granularity by using the space bar. The fixed elements should be ignored because they are transparent.&quot;);
+
+            jsTestIsAsync = true;
+
+            var failTimeoutId;
+            function test() {
+                if (window.eventSender) {
+                    // Force the first layout to avoid the suppressed scrollbar cases.
+                    scratch = document.documentElement.offsetWidth;
+
+                    // Avoid special cases for being &quot;onload&quot;.
+                    setTimeout(function() {
+                        eventSender.keyDown(' ');
+                    } , 0);
+
+                    failTimeoutId = setTimeout(function() {
+                        testFailed(&quot;The scrollview failed to scroll in response to the event.&quot;);
+                        debug(&quot;window.scrollY = &quot; + window.scrollY + &quot; excepted value around &quot; + (window.innerHeight - 40));
+                        finishJSTest();
+                    }, 1000);
+                }
+            }
+
+            window.addEventListener(&quot;scroll&quot;, function() {
+                if (window.scrollY == window.innerHeight - 40) {
+                    testPassed(&quot;Scrolled to &quot; + window.scrollY);
+                    clearTimeout(failTimeoutId);
+                    finishJSTest();
+                }
+            })
+            window.addEventListener(&quot;load&quot;, test);
+        &lt;/script&gt;
+        &lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsscrollbarsscrollingbypageonkeyboardspacebarexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/scrollbars/scrolling-by-page-on-keyboard-spacebar-expected.txt (0 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/scrollbars/scrolling-by-page-on-keyboard-spacebar-expected.txt                                (rev 0)
+++ trunk/LayoutTests/scrollbars/scrolling-by-page-on-keyboard-spacebar-expected.txt        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test scrolling with page granularity by using the space bar.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS Scrolled to 560
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsscrollbarsscrollingbypageonkeyboardspacebarhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/scrollbars/scrolling-by-page-on-keyboard-spacebar.html (0 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/scrollbars/scrolling-by-page-on-keyboard-spacebar.html                                (rev 0)
+++ trunk/LayoutTests/scrollbars/scrolling-by-page-on-keyboard-spacebar.html        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+&lt;html&gt;
+    &lt;head&gt;
+        &lt;style&gt;
+            body {
+                height: 10000px;
+            }
+        &lt;/style&gt;
+        &lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;script&gt;
+            description(&quot;Test scrolling with page granularity by using the space bar.&quot;);
+
+            jsTestIsAsync = true;
+
+            var failTimeoutId;
+            function test() {
+                if (window.eventSender) {
+                    // Force the first layout to avoid the suppressed scrollbar cases.
+                    scratch = document.documentElement.offsetWidth;
+
+                    // Avoid special cases for being &quot;onload&quot;.
+                    setTimeout(function() {
+                        eventSender.keyDown(' ');
+                    } , 0);
+
+                    failTimeoutId = setTimeout(function() {
+                        testFailed(&quot;The scrollview failed to scroll in response to the event.&quot;);
+                        debug(&quot;window.scrollY = &quot; + window.scrollY + &quot; excepted value around &quot; + (window.innerHeight - 40));
+                        finishJSTest();
+                    }, 1000);
+                }
+            }
+
+            window.addEventListener(&quot;scroll&quot;, function() {
+                if (window.scrollY == window.innerHeight - 40) {
+                    testPassed(&quot;Scrolled to &quot; + window.scrollY);
+                    clearTimeout(failTimeoutId);
+                    finishJSTest();
+                }
+            })
+            window.addEventListener(&quot;load&quot;, test);
+        &lt;/script&gt;
+        &lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (173073 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-08-28 19:48:50 UTC (rev 173073)
+++ trunk/Source/WebCore/ChangeLog        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2014-08-28  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
+
+        Scrolling with spacebar on a page with fixed header breaks reading flow
+        https://bugs.webkit.org/show_bug.cgi?id=135506
+
+        Reviewed by Simon Fraser.
+
+        When scrolling by page, find the height of any bar that is obscuring the top or bottom of the page,
+        and substract that height from the step to scroll.
+
+        Tests: scrollbars/scrolling-backward-by-page-accounting-bottom-fixed-elements-on-keyboard-spacebar.html
+               scrollbars/scrolling-backward-by-page-on-keyboard-spacebar.html
+               scrollbars/scrolling-by-page-accounting-oversized-fixed-elements-on-keyboard-spacebar.html
+               scrollbars/scrolling-by-page-accounting-top-fixed-elements-on-keyboard-spacebar.html
+               scrollbars/scrolling-by-page-accounting-top-fixed-elements-with-negative-top-on-keyboard-spacebar.html
+               scrollbars/scrolling-by-page-ignoring-hidden-fixed-elements-on-keyboard-spacebar.html
+               scrollbars/scrolling-by-page-ignoring-transparent-fixed-elements-on-keyboard-spacebar.html
+               scrollbars/scrolling-by-page-on-keyboard-spacebar.html
+
+        * WebCore.exp.in:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::adjustScrollStepForFixedContent):
+        * page/FrameView.h:
+        * platform/ScrollableArea.cpp:
+        (WebCore::ScrollableArea::adjustScrollStepForFixedContent):
+        (WebCore::ScrollableArea::scroll):
+        * platform/ScrollableArea.h:
+
</ins><span class="cx"> 2014-08-28  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Subpixel layout: Remove unused pixel snapping functions.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (173073 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-08-28 19:48:50 UTC (rev 173073)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -430,6 +430,7 @@
</span><span class="cx"> __ZN7WebCore14ScrollableArea27notifyScrollPositionChangedERKNS_8IntPointE
</span><span class="cx"> __ZN7WebCore14ScrollableArea28setScrollOffsetFromInternalsERKNS_8IntPointE
</span><span class="cx"> __ZN7WebCore14ScrollableArea30scrollToOffsetWithoutAnimationERKNS_10FloatPointE
</span><ins>+__ZN7WebCore14ScrollableArea31adjustScrollStepForFixedContentEfNS_20ScrollbarOrientationENS_17ScrollGranularityE
</ins><span class="cx"> __ZN7WebCore14ScrollableArea34constrainScrollPositionForOverhangERKNS_10LayoutRectERKNS_10LayoutSizeERKNS_11LayoutPointES9_ii
</span><span class="cx"> __ZN7WebCore14ScrollableArea6scrollENS_15ScrollDirectionENS_17ScrollGranularityEf
</span><span class="cx"> __ZN7WebCore14ScrollableAreaC2Ev
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (173073 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp        2014-08-28 19:48:50 UTC (rev 173073)
+++ trunk/Source/WebCore/page/FrameView.cpp        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -3219,6 +3219,45 @@
</span><span class="cx">     frame().loader().client().didChangeScrollOffset();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+float FrameView::adjustScrollStepForFixedContent(float step, ScrollbarOrientation orientation, ScrollGranularity granularity)
+{
+    if (granularity != ScrollByPage || orientation == HorizontalScrollbar)
+        return step;
+
+    TrackedRendererListHashSet* positionedObjects = nullptr;
+    if (RenderView* root = m_frame-&gt;contentRenderer()) {
+        if (!root-&gt;hasPositionedObjects())
+            return step;
+        positionedObjects = root-&gt;positionedObjects();
+    }
+
+    FloatRect unobscuredContentRect = this-&gt;unobscuredContentRect();
+    float topObscuredArea = 0;
+    float bottomObscuredArea = 0;
+    for (const auto&amp; positionedObject : *positionedObjects) {
+        const RenderStyle&amp; style = positionedObject-&gt;style();
+        if (style.position() != FixedPosition || style.visibility() == HIDDEN || !style.opacity())
+            continue;
+
+        FloatQuad contentQuad = positionedObject-&gt;absoluteContentQuad();
+        if (!contentQuad.isRectilinear())
+            continue;
+
+        FloatRect contentBoundingBox = contentQuad.boundingBox();
+        FloatRect fixedRectInView = intersection(unobscuredContentRect, contentBoundingBox);
+
+        if (fixedRectInView.width() &lt; unobscuredContentRect.width())
+            continue;
+
+        if (fixedRectInView.y() == unobscuredContentRect.y())
+            topObscuredArea = std::max(topObscuredArea, fixedRectInView.height());
+        else if (fixedRectInView.maxY() == unobscuredContentRect.maxY())
+            bottomObscuredArea = std::max(bottomObscuredArea, fixedRectInView.height());
+    }
+
+    return Scrollbar::pageStep(unobscuredContentRect.height(), unobscuredContentRect.height() - topObscuredArea - bottomObscuredArea);
+}
+
</ins><span class="cx"> void FrameView::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect&amp; rect)
</span><span class="cx"> {
</span><span class="cx">     // Add in our offset within the FrameView.
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.h (173073 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.h        2014-08-28 19:48:50 UTC (rev 173073)
+++ trunk/Source/WebCore/page/FrameView.h        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -509,6 +509,8 @@
</span><span class="cx">     virtual void updateSnapOffsets() override;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    virtual float adjustScrollStepForFixedContent(float step, ScrollbarOrientation, ScrollGranularity) override;
+
</ins><span class="cx"> protected:
</span><span class="cx">     virtual bool scrollContentsFastPath(const IntSize&amp; scrollDelta, const IntRect&amp; rectToScroll, const IntRect&amp; clipRect) override;
</span><span class="cx">     virtual void scrollContentsSlowPath(const IntRect&amp; updateRect) override;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollableAreacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollableArea.cpp (173073 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollableArea.cpp        2014-08-28 19:48:50 UTC (rev 173073)
+++ trunk/Source/WebCore/platform/ScrollableArea.cpp        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -87,6 +87,11 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+float ScrollableArea::adjustScrollStepForFixedContent(float step, ScrollbarOrientation, ScrollGranularity)
+{
+    return step;
+}
+
</ins><span class="cx"> bool ScrollableArea::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier)
</span><span class="cx"> {
</span><span class="cx">     ScrollbarOrientation orientation;
</span><span class="lines">@@ -122,6 +127,7 @@
</span><span class="cx">     if (direction == ScrollUp || direction == ScrollLeft)
</span><span class="cx">         multiplier = -multiplier;
</span><span class="cx"> 
</span><ins>+    step = adjustScrollStepForFixedContent(step, orientation, granularity);
</ins><span class="cx">     return scrollAnimator()-&gt;scroll(orientation, granularity, step, multiplier);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollableAreah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollableArea.h (173073 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollableArea.h        2014-08-28 19:48:50 UTC (rev 173073)
+++ trunk/Source/WebCore/platform/ScrollableArea.h        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -261,6 +261,7 @@
</span><span class="cx">     void setScrollOrigin(const IntPoint&amp;);
</span><span class="cx">     void resetScrollOriginChanged() { m_scrollOriginChanged = false; }
</span><span class="cx"> 
</span><ins>+    virtual float adjustScrollStepForFixedContent(float step, ScrollbarOrientation, ScrollGranularity);
</ins><span class="cx">     virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&amp;) = 0;
</span><span class="cx">     virtual void invalidateScrollCornerRect(const IntRect&amp;) = 0;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollbarh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/Scrollbar.h (173073 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/Scrollbar.h        2014-08-28 19:48:50 UTC (rev 173073)
+++ trunk/Source/WebCore/platform/Scrollbar.h        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -97,9 +97,10 @@
</span><span class="cx">     void offsetDidChange();
</span><span class="cx"> 
</span><span class="cx">     static int pixelsPerLineStep() { return 40; }
</span><del>-    static float minFractionToStepWhenPaging() { return 0.875f; }
</del><ins>+    static float minFractionToStepWhenPaging() { return 0.8; }
</ins><span class="cx">     WEBCORE_EXPORT static int maxOverlapBetweenPages();
</span><del>-    static int pageStep(int widthOrHeight) { return std::max(std::max&lt;int&gt;(lroundf(widthOrHeight * Scrollbar::minFractionToStepWhenPaging()), lroundf(widthOrHeight - Scrollbar::maxOverlapBetweenPages())), 1); }
</del><ins>+    static int pageStep(int viewWidthOrHeight, int contentWidthOrHeight) { return std::max(std::max&lt;int&gt;(lroundf(viewWidthOrHeight * Scrollbar::minFractionToStepWhenPaging()), lroundf(contentWidthOrHeight - Scrollbar::maxOverlapBetweenPages())), 1); }
+    static int pageStep(int viewWidthOrHeight) { return pageStep(viewWidthOrHeight, viewWidthOrHeight); }
</ins><span class="cx">     static float pageStepDelta(int widthOrHeight) { return std::max(std::max(static_cast&lt;float&gt;(widthOrHeight) * Scrollbar::minFractionToStepWhenPaging(), static_cast&lt;float&gt;(widthOrHeight) - Scrollbar::maxOverlapBetweenPages()), 1.0f); }
</span><span class="cx"> 
</span><span class="cx">     void disconnectFromScrollableArea() { m_scrollableArea = 0; }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmockScrollbarThemeMockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.h (173073 => 173074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.h        2014-08-28 19:48:50 UTC (rev 173073)
+++ trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.h        2014-08-28 20:01:18 UTC (rev 173074)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx">     
</span><span class="cx">     virtual void paintTrackBackground(GraphicsContext*, ScrollbarThemeClient*, const IntRect&amp;);
</span><span class="cx">     virtual void paintThumb(GraphicsContext*, ScrollbarThemeClient*, const IntRect&amp;);
</span><ins>+    virtual int maxOverlapBetweenPages() { return 40; }
</ins><span class="cx">     
</span><span class="cx"> private:
</span><span class="cx">     virtual bool isMockTheme() const { return true; }
</span></span></pre>
</div>
</div>

</body>
</html>