Be more restrictive when adding ScrollableArea's to FrameView's ScrollableArea's map
authortonikitoo@webkit.org <tonikitoo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Apr 2012 21:32:53 +0000 (21:32 +0000)
committertonikitoo@webkit.org <tonikitoo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Apr 2012 21:32:53 +0000 (21:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=79611

Reviewed by James Robinson.
Patch by Antonio Gomes <agomes@rim.com>

Source/WebCore:

As of today, any FrameView attached to the Widget-tree or any
RenderLayer whose corresponding RenderBox's style has a 'overflow'
property set to 'auto' is cached in its containing scrollable areas set.
We could be more restrictive about what we in fact want to
cache as scrollable areas, by checking if the element as an overflow
(i.e. more content than its viewport).

* page/FrameView.cpp:
(WebCore::FrameView::setFrameRect):

Whenever the viewport changes, check if we have an scrollable/overflowed
content, and update the cache accordingly.

(WebCore::FrameView::setContentsSize):

Whenever the contents size changes, check if we have a scrollable/overflowed
content, and update the cache accordingly.

(WebCore::FrameView::calculateScrollbarModesForLayout):

Introduces a way to query for the scrollbars by only
taking into account the "rules" set by the web author.
For that, a new enum was added called SrollbarModesCalculationStrategy,
which allows callers to discard for example client-side scrollbar policies
in order to verify if a given frameview is scrollable or not.

(WebCore::FrameView::updateScrollableAreaSet):

Take into account various factors before considering a FrameView as
scrollable. If in the end it is, it gets added to its parent FrameView
scrollable areas map, otherwise removed.

(WebCore):
(WebCore::FrameView::addScrollableArea):

Became unneeded, thus removed.

(WebCore::FrameView::removeScrollableArea):

Whenever a FrameView is removed from the Widget-tree,
remove it from the cache.

* page/FrameView.h:
(FrameView):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateScrollbarsAfterLayout):

Update scrollable area set after layout.

(WebCore::RenderLayer::updateScrollbarsAfterStyleChange):

Update scrollable area set after style changes.

(WebCore::RenderLayer::styleChanged):

Removed the scrollable areas logic detection from it.

(WebCore::RenderLayer::updateScrollableAreaSet):

Updates the containing FrameView scrollable areas cache
only when needed (i.e. an overflow exists).

(WebCore):
* rendering/RenderLayer.h:
(RenderLayer):
* testing/Internals.cpp:
(WebCore::Internals::numberOfScrollableAreas):
(WebCore):
* testing/Internals.h:
(Internals):
* testing/Internals.idl:

Tests: fast/scrolling/scrollable-area-frame-inherited-visibility-hidden.html
       fast/scrolling/scrollable-area-frame-overflow-hidden.html
       fast/scrolling/scrollable-area-frame-overried-inherited-visibility-hidden.html
       fast/scrolling/scrollable-area-frame-scrolling-no-overried-inherited-visibility-hidden.html
       fast/scrolling/scrollable-area-frame-scrolling-no-visibility-hidden-child.html
       fast/scrolling/scrollable-area-frame-scrolling-no.html
       fast/scrolling/scrollable-area-frame-scrolling-yes-display-none.html
       fast/scrolling/scrollable-area-frame-scrolling-yes.html
       fast/scrolling/scrollable-area-frame-visibility-hidden-child.html
       fast/scrolling/scrollable-area-frame-zero-size-and-border.html
       fast/scrolling/scrollable-area-frame.html
       fast/scrolling/scrollable-area-overflow-auto-display-none-in-parent.html
       fast/scrolling/scrollable-area-overflow-auto-display-none.html
       fast/scrolling/scrollable-area-overflow-auto-visibility-hidden-in-parent.html
       fast/scrolling/scrollable-area-overflow-auto-visibility-hidden.html
       fast/scrolling/scrollable-area-overflow-auto-visibility-override.html
       fast/scrolling/scrollable-area-overflow-auto-visibility-visible.html
       fast/scrolling/scrollable-area-overflow-auto.html
       fast/scrolling/scrollable-area-overflow-not-set.html
       fast/scrolling/scrollable-area-overflow-visible.html

LayoutTests:

Reviewed by NOBODY (OOPS!).

Added scrollable area set count tests to many situations observed
in real world sites.

* fast/scrolling/resources/generic-scrollable-content.html: Added.
* fast/scrolling/resources/hidden-generic-scrollable-content.html: Added.
* fast/scrolling/resources/scrollable-area.js: Added.
(runTest):
(end):
* fast/scrolling/resources/scrollable-style.css: Added.
(.inner):
(.offscreen):
* fast/scrolling/scrollable-area-frame-expected.txt: Added.
* fast/scrolling/scrollable-area-frame-inherited-visibility-hidden-expected.txt: Added.
* fast/scrolling/scrollable-area-frame-inherited-visibility-hidden.html: Added.
* fast/scrolling/scrollable-area-frame-overflow-hidden-expected.txt: Added.
* fast/scrolling/scrollable-area-frame-overflow-hidden.html: Added.
* fast/scrolling/scrollable-area-frame-overried-inherited-visibility-hidden-expected.txt: Added.
* fast/scrolling/scrollable-area-frame-overried-inherited-visibility-hidden.html: Added.
* fast/scrolling/scrollable-area-frame-scrolling-no-expected.txt: Added.
* fast/scrolling/scrollable-area-frame-scrolling-no-overried-inherited-visibility-hidden-expected.txt: Added.
* fast/scrolling/scrollable-area-frame-scrolling-no-overried-inherited-visibility-hidden.html: Added.
* fast/scrolling/scrollable-area-frame-scrolling-no-visibility-hidden-child-expected.txt: Added.
* fast/scrolling/scrollable-area-frame-scrolling-no-visibility-hidden-child.html: Added.
* fast/scrolling/scrollable-area-frame-scrolling-no.html: Added.
* fast/scrolling/scrollable-area-frame-scrolling-yes-display-none-expected.txt: Added.
* fast/scrolling/scrollable-area-frame-scrolling-yes-display-none.html: Added.
* fast/scrolling/scrollable-area-frame-scrolling-yes-expected.txt: Added.
* fast/scrolling/scrollable-area-frame-scrolling-yes.html: Added.
* fast/scrolling/scrollable-area-frame-visibility-hidden-child-expected.txt: Added.
* fast/scrolling/scrollable-area-frame-visibility-hidden-child.html: Added.
* fast/scrolling/scrollable-area-frame-zero-size-and-border-expected.txt: Added.
* fast/scrolling/scrollable-area-frame-zero-size-and-border.html: Added.
* fast/scrolling/scrollable-area-frame.html: Added.
* fast/scrolling/scrollable-area-overflow-auto-display-none-expected.txt: Added.
* fast/scrolling/scrollable-area-overflow-auto-display-none-in-parent-expected.txt: Added.
* fast/scrolling/scrollable-area-overflow-auto-display-none-in-parent.html: Added.
* fast/scrolling/scrollable-area-overflow-auto-display-none.html: Added.
* fast/scrolling/scrollable-area-overflow-auto-expected.txt: Added.
* fast/scrolling/scrollable-area-overflow-auto-visibility-hidden-expected.txt: Added.
* fast/scrolling/scrollable-area-overflow-auto-visibility-hidden-in-parent-expected.txt: Added.
* fast/scrolling/scrollable-area-overflow-auto-visibility-hidden-in-parent.html: Added.
* fast/scrolling/scrollable-area-overflow-auto-visibility-hidden.html: Added.
* fast/scrolling/scrollable-area-overflow-auto-visibility-override-expected.txt: Added.
* fast/scrolling/scrollable-area-overflow-auto-visibility-override.html: Added.
* fast/scrolling/scrollable-area-overflow-auto-visibility-visible-expected.txt: Added.
* fast/scrolling/scrollable-area-overflow-auto-visibility-visible.html: Added.
* fast/scrolling/scrollable-area-overflow-auto.html: Added.
* fast/scrolling/scrollable-area-overflow-not-set-expected.txt: Added.
* fast/scrolling/scrollable-area-overflow-not-set.html: Added.
* fast/scrolling/scrollable-area-overflow-visible-expected.txt: Added.
* fast/scrolling/scrollable-area-overflow-visible.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@114170 268f45cc-cd09-0410-ab3c-d52691b4dbfc

55 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/scrolling/resources/generic-scrollable-content.html [new file with mode: 0644]
LayoutTests/fast/scrolling/resources/hidden-generic-scrollable-content.html [new file with mode: 0644]
LayoutTests/fast/scrolling/resources/scrollable-area.js [new file with mode: 0644]
LayoutTests/fast/scrolling/resources/scrollable-style.css [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-dynamic-overflow-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-dynamic-overflow.html [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-frame-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-frame-inherited-visibility-hidden-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-frame-inherited-visibility-hidden.html [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-frame-overflow-hidden-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-frame-overflow-hidden.html [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-frame-overried-inherited-visibility-hidden-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-frame-overried-inherited-visibility-hidden.html [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-no-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-no-overried-inherited-visibility-hidden-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-no-overried-inherited-visibility-hidden.html [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-no-visibility-hidden-child-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-no-visibility-hidden-child.html [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-no.html [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-yes-display-none-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-yes-display-none.html [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-yes-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-yes.html [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-frame-visibility-hidden-child-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-frame-visibility-hidden-child.html [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-frame-zero-size-and-border-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-frame-zero-size-and-border.html [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-frame.html [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-overflow-auto-display-none-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-overflow-auto-display-none-in-parent-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-overflow-auto-display-none-in-parent.html [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-overflow-auto-display-none.html [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-overflow-auto-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-overflow-auto-visibility-hidden-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-overflow-auto-visibility-hidden-in-parent-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-overflow-auto-visibility-hidden-in-parent.html [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-overflow-auto-visibility-hidden.html [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-overflow-auto-visibility-override-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-overflow-auto-visibility-override.html [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-overflow-auto-visibility-visible-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-overflow-auto-visibility-visible.html [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-overflow-auto.html [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-overflow-not-set-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-overflow-not-set.html [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-overflow-visible-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollable-area-overflow-visible.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayer.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl

index ab7050b..efcf51f 100644 (file)
@@ -1,3 +1,62 @@
+2012-04-11  Antonio Gomes  <agomes@rim.com>
+
+        Be more restrictive when adding ScrollableArea's to FrameView's ScrollableArea's map
+        https://bugs.webkit.org/show_bug.cgi?id=79611
+
+        Reviewed by James Robinson.
+
+        Added scrollable area set count tests to many situations observed
+        in real world sites.
+
+        * fast/scrolling/resources/generic-scrollable-content.html: Added.
+        * fast/scrolling/resources/hidden-generic-scrollable-content.html: Added.
+        * fast/scrolling/resources/scrollable-area.js: Added.
+        (runTest):
+        (end):
+        * fast/scrolling/resources/scrollable-style.css: Added.
+        (.inner):
+        (.offscreen):
+        * fast/scrolling/scrollable-area-frame-expected.txt: Added.
+        * fast/scrolling/scrollable-area-frame-inherited-visibility-hidden-expected.txt: Added.
+        * fast/scrolling/scrollable-area-frame-inherited-visibility-hidden.html: Added.
+        * fast/scrolling/scrollable-area-frame-overflow-hidden-expected.txt: Added.
+        * fast/scrolling/scrollable-area-frame-overflow-hidden.html: Added.
+        * fast/scrolling/scrollable-area-frame-overried-inherited-visibility-hidden-expected.txt: Added.
+        * fast/scrolling/scrollable-area-frame-overried-inherited-visibility-hidden.html: Added.
+        * fast/scrolling/scrollable-area-frame-scrolling-no-expected.txt: Added.
+        * fast/scrolling/scrollable-area-frame-scrolling-no-overried-inherited-visibility-hidden-expected.txt: Added.
+        * fast/scrolling/scrollable-area-frame-scrolling-no-overried-inherited-visibility-hidden.html: Added.
+        * fast/scrolling/scrollable-area-frame-scrolling-no-visibility-hidden-child-expected.txt: Added.
+        * fast/scrolling/scrollable-area-frame-scrolling-no-visibility-hidden-child.html: Added.
+        * fast/scrolling/scrollable-area-frame-scrolling-no.html: Added.
+        * fast/scrolling/scrollable-area-frame-scrolling-yes-display-none-expected.txt: Added.
+        * fast/scrolling/scrollable-area-frame-scrolling-yes-display-none.html: Added.
+        * fast/scrolling/scrollable-area-frame-scrolling-yes-expected.txt: Added.
+        * fast/scrolling/scrollable-area-frame-scrolling-yes.html: Added.
+        * fast/scrolling/scrollable-area-frame-visibility-hidden-child-expected.txt: Added.
+        * fast/scrolling/scrollable-area-frame-visibility-hidden-child.html: Added.
+        * fast/scrolling/scrollable-area-frame-zero-size-and-border-expected.txt: Added.
+        * fast/scrolling/scrollable-area-frame-zero-size-and-border.html: Added.
+        * fast/scrolling/scrollable-area-frame.html: Added.
+        * fast/scrolling/scrollable-area-overflow-auto-display-none-expected.txt: Added.
+        * fast/scrolling/scrollable-area-overflow-auto-display-none-in-parent-expected.txt: Added.
+        * fast/scrolling/scrollable-area-overflow-auto-display-none-in-parent.html: Added.
+        * fast/scrolling/scrollable-area-overflow-auto-display-none.html: Added.
+        * fast/scrolling/scrollable-area-overflow-auto-expected.txt: Added.
+        * fast/scrolling/scrollable-area-overflow-auto-visibility-hidden-expected.txt: Added.
+        * fast/scrolling/scrollable-area-overflow-auto-visibility-hidden-in-parent-expected.txt: Added.
+        * fast/scrolling/scrollable-area-overflow-auto-visibility-hidden-in-parent.html: Added.
+        * fast/scrolling/scrollable-area-overflow-auto-visibility-hidden.html: Added.
+        * fast/scrolling/scrollable-area-overflow-auto-visibility-override-expected.txt: Added.
+        * fast/scrolling/scrollable-area-overflow-auto-visibility-override.html: Added.
+        * fast/scrolling/scrollable-area-overflow-auto-visibility-visible-expected.txt: Added.
+        * fast/scrolling/scrollable-area-overflow-auto-visibility-visible.html: Added.
+        * fast/scrolling/scrollable-area-overflow-auto.html: Added.
+        * fast/scrolling/scrollable-area-overflow-not-set-expected.txt: Added.
+        * fast/scrolling/scrollable-area-overflow-not-set.html: Added.
+        * fast/scrolling/scrollable-area-overflow-visible-expected.txt: Added.
+        * fast/scrolling/scrollable-area-overflow-visible.html: Added.
+
 2012-04-13  Vincent Scheib  <scheib@chromium.org>
 
         Chromium test_expectations TIMOUT mask for fast/canvas/2d.imageDataHD.html
diff --git a/LayoutTests/fast/scrolling/resources/generic-scrollable-content.html b/LayoutTests/fast/scrolling/resources/generic-scrollable-content.html
new file mode 100644 (file)
index 0000000..60f52bb
--- /dev/null
@@ -0,0 +1,18 @@
+<textarea rows='5' cols='20'>
+content
+content
+content
+content
+content
+content
+content
+content
+content
+content
+content
+content
+content
+content
+content
+content
+</textarea>
diff --git a/LayoutTests/fast/scrolling/resources/hidden-generic-scrollable-content.html b/LayoutTests/fast/scrolling/resources/hidden-generic-scrollable-content.html
new file mode 100644 (file)
index 0000000..c1d1d83
--- /dev/null
@@ -0,0 +1,18 @@
+<textarea style="visibility:hidden;" rows='5' cols='20'>
+content
+content
+content
+content
+content
+content
+content
+content
+content
+content
+content
+content
+content
+content
+content
+content
+</textarea>
diff --git a/LayoutTests/fast/scrolling/resources/scrollable-area.js b/LayoutTests/fast/scrolling/resources/scrollable-area.js
new file mode 100644 (file)
index 0000000..5f41f88
--- /dev/null
@@ -0,0 +1,40 @@
+var referenceResult = 0;
+var referenceResult2 = 0;
+var referenceIntermediateFunction = 0;
+var isDRT = window.layoutTestController && window.internals && window.internals.numberOfScrollableAreas;
+
+function runTest(firstResult, intermediateFunction, secondResult)
+{
+    if (isDRT) {
+        layoutTestController.waitUntilDone();
+        layoutTestController.dumpAsText();
+    }
+
+    referenceResult = firstResult;
+    if (intermediateFunction) {
+        referenceIntermediateFunction = intermediateFunction;
+        referenceResult2 = secondResult;
+    }
+    setTimeout(end, 0);
+}
+
+function end()
+{
+    var result = 0;
+
+    if (isDRT) {
+        result = internals.numberOfScrollableAreas(document);
+        shouldBeTrue(stringify(result == referenceResult));
+        if (referenceIntermediateFunction) {
+            referenceIntermediateFunction();
+            result = internals.numberOfScrollableAreas(document);
+            shouldBeTrue(stringify(result == referenceResult2));
+        }
+
+        layoutTestController.notifyDone();
+        return;
+    }
+
+    if (referenceIntermediateFunction)
+        referenceIntermediateFunction();
+}
diff --git a/LayoutTests/fast/scrolling/resources/scrollable-style.css b/LayoutTests/fast/scrolling/resources/scrollable-style.css
new file mode 100644 (file)
index 0000000..efa180f
--- /dev/null
@@ -0,0 +1,12 @@
+.inner {
+    position: relative;
+    left: 5px;
+    color: #ffffff;
+    padding: 4px;
+    width: 80px;
+    height: 30px;
+}
+.offscreen {
+    position: relative;
+    top: 100px;
+}
diff --git a/LayoutTests/fast/scrolling/scrollable-area-dynamic-overflow-expected.txt b/LayoutTests/fast/scrolling/scrollable-area-dynamic-overflow-expected.txt
new file mode 100644 (file)
index 0000000..eb70db3
--- /dev/null
@@ -0,0 +1,5 @@
+content
+content
+PASS true is true
+PASS true is true
+
diff --git a/LayoutTests/fast/scrolling/scrollable-area-dynamic-overflow.html b/LayoutTests/fast/scrolling/scrollable-area-dynamic-overflow.html
new file mode 100644 (file)
index 0000000..048ee59
--- /dev/null
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<head>
+    <style type="text/css"> @import "resources/scrollable-style.css"; </style>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script src="resources/scrollable-area.js"></script>
+    <script>
+        function changeOverflow()
+        {
+            document.getElementById('scrollable').style.overflow= 'hidden';
+            var forceLayout = document.body.offsetHeight;
+        }
+    </script>
+</head>
+<body onload="runTest(1, changeOverflow, 0);">
+    <div id="scrollable" class="inner" style="color: black; background: grey; overflow: auto; border: 1px solid blue;">content
+        <div class="offscreen">content</div>
+    </div>
+    <div id='console'></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/scrolling/scrollable-area-frame-expected.txt b/LayoutTests/fast/scrolling/scrollable-area-frame-expected.txt
new file mode 100644 (file)
index 0000000..f8d5d7c
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS true is true
+
diff --git a/LayoutTests/fast/scrolling/scrollable-area-frame-inherited-visibility-hidden-expected.txt b/LayoutTests/fast/scrolling/scrollable-area-frame-inherited-visibility-hidden-expected.txt
new file mode 100644 (file)
index 0000000..49f3460
--- /dev/null
@@ -0,0 +1,2 @@
+ PASS true is true
+
diff --git a/LayoutTests/fast/scrolling/scrollable-area-frame-inherited-visibility-hidden.html b/LayoutTests/fast/scrolling/scrollable-area-frame-inherited-visibility-hidden.html
new file mode 100644 (file)
index 0000000..8e3b894
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<head>
+    <style type="text/css"> @import "resources/scrollable-style.css"; </style>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script src="resources/scrollable-area.js"></script>
+</head>
+<body onload="runTest(0);">
+    <span style="visibility: hidden">
+        <iframe width=120 scrolling=yes src="resources/generic-scrollable-content.html"></iframe>
+    </span>
+    <div id='console'></div>
+</html>
diff --git a/LayoutTests/fast/scrolling/scrollable-area-frame-overflow-hidden-expected.txt b/LayoutTests/fast/scrolling/scrollable-area-frame-overflow-hidden-expected.txt
new file mode 100644 (file)
index 0000000..ae56de8
--- /dev/null
@@ -0,0 +1,3 @@
+  
+PASS true is true
+
diff --git a/LayoutTests/fast/scrolling/scrollable-area-frame-overflow-hidden.html b/LayoutTests/fast/scrolling/scrollable-area-frame-overflow-hidden.html
new file mode 100644 (file)
index 0000000..ff38a22
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<head>
+    <style type="text/css"> @import "resources/scrollable-style.css"; </style>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script src="resources/scrollable-area.js"></script>
+</head>
+<body onload="runTest(4);">
+    <!-- 'overflow:hidden' on an inner frame  works on Firefox and Opera, but not on WebKit-based Browsers: Chromium or Safari-->
+    <iframe width=120 style="overflow: hidden;" src="resources/generic-scrollable-content.html"></iframe>
+    <iframe width=120 style="overflow-x: hidden;" src="resources/generic-scrollable-content.html"></iframe>
+    <div id='console'></div>
+</html>
diff --git a/LayoutTests/fast/scrolling/scrollable-area-frame-overried-inherited-visibility-hidden-expected.txt b/LayoutTests/fast/scrolling/scrollable-area-frame-overried-inherited-visibility-hidden-expected.txt
new file mode 100644 (file)
index 0000000..f8d5d7c
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS true is true
+
diff --git a/LayoutTests/fast/scrolling/scrollable-area-frame-overried-inherited-visibility-hidden.html b/LayoutTests/fast/scrolling/scrollable-area-frame-overried-inherited-visibility-hidden.html
new file mode 100644 (file)
index 0000000..430a6e2
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<head>
+    <style type="text/css"> @import "resources/scrollable-style.css"; </style>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script src="resources/scrollable-area.js"></script>
+</head>
+<body onload="runTest(2);">
+    <span style="visibility: hidden">
+        <iframe width=120 scrolling=yes style="visibility: visible;" src="resources/generic-scrollable-content.html"></iframe>
+    </span>
+    <div id='console'></div>
+</html>
diff --git a/LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-no-expected.txt b/LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-no-expected.txt
new file mode 100644 (file)
index 0000000..f8d5d7c
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS true is true
+
diff --git a/LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-no-overried-inherited-visibility-hidden-expected.txt b/LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-no-overried-inherited-visibility-hidden-expected.txt
new file mode 100644 (file)
index 0000000..f8d5d7c
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS true is true
+
diff --git a/LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-no-overried-inherited-visibility-hidden.html b/LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-no-overried-inherited-visibility-hidden.html
new file mode 100644 (file)
index 0000000..14e51a6
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<head>
+    <style type="text/css"> @import "resources/scrollable-style.css"; </style>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script src="resources/scrollable-area.js"></script>
+    </script>
+</head>
+<body onload="runTest(1);">
+    <span style="visibility: hidden">
+        <iframe width=120 scrolling=no style="visibility: visible;" src="resources/generic-scrollable-content.html"></iframe>
+    </span>
+    <div id='console'></div>
+</html>
diff --git a/LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-no-visibility-hidden-child-expected.txt b/LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-no-visibility-hidden-child-expected.txt
new file mode 100644 (file)
index 0000000..f8d5d7c
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS true is true
+
diff --git a/LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-no-visibility-hidden-child.html b/LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-no-visibility-hidden-child.html
new file mode 100644 (file)
index 0000000..743b21f
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<head>
+    <style type="text/css"> @import "resources/scrollable-style.css"; </style>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script src="resources/scrollable-area.js"></script>
+</head>
+<body onload="runTest(0);">
+    <iframe width=120 scrolling=no style="visibility: visible;" src="resources/hidden-generic-scrollable-content.html"></iframe>
+    <div id='console'></div>
+</html>
diff --git a/LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-no.html b/LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-no.html
new file mode 100644 (file)
index 0000000..3ef50e8
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<head>
+    <style type="text/css"> @import "resources/scrollable-style.css"; </style>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script src="resources/scrollable-area.js"></script>
+</head>
+<body onload="runTest(1);">
+    <iframe width=120 scrolling=no src="resources/generic-scrollable-content.html"></iframe>
+    <div id='console'></div>
+</html>
diff --git a/LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-yes-display-none-expected.txt b/LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-yes-display-none-expected.txt
new file mode 100644 (file)
index 0000000..6497b11
--- /dev/null
@@ -0,0 +1,2 @@
+PASS true is true
+
diff --git a/LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-yes-display-none.html b/LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-yes-display-none.html
new file mode 100644 (file)
index 0000000..1b3ad03
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<head>
+    <style type="text/css"> @import "resources/scrollable-style.css"; </style>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script src="resources/scrollable-area.js"></script>
+</head>
+<body onload="runTest(0);">
+    <iframe width=120 scrolling=yes style="display: none;" src="resources/generic-scrollable-content.html"></iframe>
+    <div id='console'></div>
+</html>
diff --git a/LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-yes-expected.txt b/LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-yes-expected.txt
new file mode 100644 (file)
index 0000000..f8d5d7c
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS true is true
+
diff --git a/LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-yes.html b/LayoutTests/fast/scrolling/scrollable-area-frame-scrolling-yes.html
new file mode 100644 (file)
index 0000000..45e2d41
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<head>
+    <style type="text/css"> @import "resources/scrollable-style.css"; </style>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script src="resources/scrollable-area.js"></script>
+</head>
+<body onload="runTest(2);">
+    <iframe width=120 scrolling=yes src="resources/generic-scrollable-content.html"></iframe>
+    <div id='console'></div>
+</html>
diff --git a/LayoutTests/fast/scrolling/scrollable-area-frame-visibility-hidden-child-expected.txt b/LayoutTests/fast/scrolling/scrollable-area-frame-visibility-hidden-child-expected.txt
new file mode 100644 (file)
index 0000000..f8d5d7c
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS true is true
+
diff --git a/LayoutTests/fast/scrolling/scrollable-area-frame-visibility-hidden-child.html b/LayoutTests/fast/scrolling/scrollable-area-frame-visibility-hidden-child.html
new file mode 100644 (file)
index 0000000..03cae0e
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<head>
+    <style type="text/css"> @import "resources/scrollable-style.css"; </style>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script src="resources/scrollable-area.js"></script>
+</head>
+<body onload="runTest(1);">
+    <iframe width=120 src="resources/hidden-generic-scrollable-content.html"></iframe>
+    <div id='console'></div>
+</html>
diff --git a/LayoutTests/fast/scrolling/scrollable-area-frame-zero-size-and-border-expected.txt b/LayoutTests/fast/scrolling/scrollable-area-frame-zero-size-and-border-expected.txt
new file mode 100644 (file)
index 0000000..f8d5d7c
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS true is true
+
diff --git a/LayoutTests/fast/scrolling/scrollable-area-frame-zero-size-and-border.html b/LayoutTests/fast/scrolling/scrollable-area-frame-zero-size-and-border.html
new file mode 100644 (file)
index 0000000..e8cd3b7
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<head>
+    <style type="text/css"> @import "resources/scrollable-style.css"; </style>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script src="resources/scrollable-area.js"></script>
+</head>
+<body onload="runTest(0);">
+    <iframe width=0 height=0 border=0></iframe>
+    <div id='console'></div>
+</html>
diff --git a/LayoutTests/fast/scrolling/scrollable-area-frame.html b/LayoutTests/fast/scrolling/scrollable-area-frame.html
new file mode 100644 (file)
index 0000000..26fefbc
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<head>
+    <style type="text/css"> @import "resources/scrollable-style.css"; </style>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script src="resources/scrollable-area.js"></script>
+</head>
+<body onload="runTest(2);">
+    <iframe width=120 src="resources/generic-scrollable-content.html"></iframe>
+    <div id='console'></div>
+</html>
diff --git a/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-display-none-expected.txt b/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-display-none-expected.txt
new file mode 100644 (file)
index 0000000..6497b11
--- /dev/null
@@ -0,0 +1,2 @@
+PASS true is true
+
diff --git a/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-display-none-in-parent-expected.txt b/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-display-none-in-parent-expected.txt
new file mode 100644 (file)
index 0000000..6497b11
--- /dev/null
@@ -0,0 +1,2 @@
+PASS true is true
+
diff --git a/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-display-none-in-parent.html b/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-display-none-in-parent.html
new file mode 100644 (file)
index 0000000..55b4a02
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<head>
+    <style type="text/css"> @import "resources/scrollable-style.css"; </style>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script src="resources/scrollable-area.js"></script>
+</head>
+<body onload="runTest(0);">
+    <div style="display:none">
+        <div id="scrollable" class="inner" style="color: brown; background: purple; overflow: auto; visibility: visible">content
+            <div class="offscreen">content</div>
+        </div>
+    </div>
+    <div id='console'></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-display-none.html b/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-display-none.html
new file mode 100644 (file)
index 0000000..4f47023
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<head>
+    <style type="text/css"> @import "resources/scrollable-style.css"; </style>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script src="resources/scrollable-area.js"></script>
+</head>
+<body onload="runTest(0);">
+    <div id="scrollable" class="inner" style="color: violet; background: purple; overflow: auto; display: none;">content
+        <div class="offscreen">content</div>
+    </div>
+    <div id='console'></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-expected.txt b/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-expected.txt
new file mode 100644 (file)
index 0000000..1096004
--- /dev/null
@@ -0,0 +1,4 @@
+content
+content
+PASS true is true
+
diff --git a/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-visibility-hidden-expected.txt b/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-visibility-hidden-expected.txt
new file mode 100644 (file)
index 0000000..6497b11
--- /dev/null
@@ -0,0 +1,2 @@
+PASS true is true
+
diff --git a/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-visibility-hidden-in-parent-expected.txt b/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-visibility-hidden-in-parent-expected.txt
new file mode 100644 (file)
index 0000000..6497b11
--- /dev/null
@@ -0,0 +1,2 @@
+PASS true is true
+
diff --git a/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-visibility-hidden-in-parent.html b/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-visibility-hidden-in-parent.html
new file mode 100644 (file)
index 0000000..65ad7ba
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<head>
+    <style type="text/css"> @import "resources/scrollable-style.css"; </style>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script src="resources/scrollable-area.js"></script>
+</head>
+<body onload="runTest(0);">
+    <div style="visibility:hidden">
+        <div id="scrollable" class="inner" style="background: yellow; overflow: auto;">content
+            <div class="offscreen">content</div>
+        </div>
+    </div>
+    <div id='console'></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-visibility-hidden.html b/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-visibility-hidden.html
new file mode 100644 (file)
index 0000000..b460571
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<head>
+    <style type="text/css"> @import "resources/scrollable-style.css"; </style>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script src="resources/scrollable-area.js"></script>
+</head>
+<body onload="runTest(0);">
+    <div id="scrollable" class="inner" style="background: yellow; overflow: auto; visibility: hidden">content
+        <div class="offscreen">content</div>
+    </div>
+    <div id='console'></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-visibility-override-expected.txt b/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-visibility-override-expected.txt
new file mode 100644 (file)
index 0000000..1096004
--- /dev/null
@@ -0,0 +1,4 @@
+content
+content
+PASS true is true
+
diff --git a/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-visibility-override.html b/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-visibility-override.html
new file mode 100644 (file)
index 0000000..8f404e2
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<head>
+    <style type="text/css"> @import "resources/scrollable-style.css"; </style>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script src="resources/scrollable-area.js"></script>
+</head>
+<body onload="runTest(1);">
+    <div style="visibility:hidden">
+        <div id="scrollable" class="inner" style="color: black; background: yellow; overflow: auto; visibility: visible">content
+            <div class="offscreen">content</div>
+        </div>
+    </div>
+    <div id='console'></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-visibility-visible-expected.txt b/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-visibility-visible-expected.txt
new file mode 100644 (file)
index 0000000..1096004
--- /dev/null
@@ -0,0 +1,4 @@
+content
+content
+PASS true is true
+
diff --git a/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-visibility-visible.html b/LayoutTests/fast/scrolling/scrollable-area-overflow-auto-visibility-visible.html
new file mode 100644 (file)
index 0000000..17e8c31
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<head>
+    <style type="text/css"> @import "resources/scrollable-style.css"; </style>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script src="resources/scrollable-area.js"></script>
+</head>
+<body onload="runTest(1);">
+    <div id="scrollable" class="inner" style="background: red; overflow: auto; visibility: visible">content
+        <div class="offscreen">content</div>
+    </div>
+    <div id='console'></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/scrolling/scrollable-area-overflow-auto.html b/LayoutTests/fast/scrolling/scrollable-area-overflow-auto.html
new file mode 100644 (file)
index 0000000..10a3dc6
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<head>
+    <style type="text/css"> @import "resources/scrollable-style.css"; </style>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script src="resources/scrollable-area.js"></script>
+</head>
+<body onload="runTest(1);">
+    <div id="scrollable" class="inner" style="background: black; overflow: auto;">content
+        <div class="offscreen">content</div>
+    </div>
+    <div id='console'></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/scrolling/scrollable-area-overflow-not-set-expected.txt b/LayoutTests/fast/scrolling/scrollable-area-overflow-not-set-expected.txt
new file mode 100644 (file)
index 0000000..1096004
--- /dev/null
@@ -0,0 +1,4 @@
+content
+content
+PASS true is true
+
diff --git a/LayoutTests/fast/scrolling/scrollable-area-overflow-not-set.html b/LayoutTests/fast/scrolling/scrollable-area-overflow-not-set.html
new file mode 100644 (file)
index 0000000..23dbefd
--- /dev/null
@@ -0,0 +1,14 @@
+
+<!DOCTYPE html>
+<head>
+    <style type="text/css"> @import "resources/scrollable-style.css"; </style>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script src="resources/scrollable-area.js"></script>
+</head>
+<body onload="runTest(0);">
+    <div id="scrollable" class="inner" style="background: green;">content
+        <div class="offscreen">content</div>
+    </div>
+    <div id='console'></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/scrolling/scrollable-area-overflow-visible-expected.txt b/LayoutTests/fast/scrolling/scrollable-area-overflow-visible-expected.txt
new file mode 100644 (file)
index 0000000..1096004
--- /dev/null
@@ -0,0 +1,4 @@
+content
+content
+PASS true is true
+
diff --git a/LayoutTests/fast/scrolling/scrollable-area-overflow-visible.html b/LayoutTests/fast/scrolling/scrollable-area-overflow-visible.html
new file mode 100644 (file)
index 0000000..0b65185
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<head>
+    <style type="text/css"> @import "resources/scrollable-style.css"; </style>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script src="resources/scrollable-area.js"></script>
+</head>
+<body onload="runTest(0);">
+    <div id="scrollable" class="inner" style="color: black; background: grey; overflow: visible; border: 1px solid blue;">content
+        <div class="offscreen">content</div>
+    </div>
+    <div id='console'></div>
+</body>
+</html>
index 7f51f85..172bc26 100644 (file)
@@ -1,3 +1,105 @@
+2012-04-11  Antonio Gomes  <agomes@rim.com>
+
+        Be more restrictive when adding ScrollableArea's to FrameView's ScrollableArea's map
+        https://bugs.webkit.org/show_bug.cgi?id=79611
+
+        Reviewed by James Robinson.
+
+        Source/WebCore:
+
+        As of today, any FrameView attached to the Widget-tree or any
+        RenderLayer whose corresponding RenderBox's style has a 'overflow'
+        property set to 'auto' is cached in its containing scrollable areas set.
+        We could be more restrictive about what we in fact want to
+        cache as scrollable areas, by checking if the element as an overflow
+        (i.e. more content than its viewport).
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::setFrameRect):
+
+        Whenever the viewport changes, check if we have an scrollable/overflowed
+        content, and update the cache accordingly.
+
+        (WebCore::FrameView::setContentsSize):
+
+        Whenever the contents size changes, check if we have a scrollable/overflowed
+        content, and update the cache accordingly.
+
+        (WebCore::FrameView::calculateScrollbarModesForLayout):
+
+        Introduces a way to query for the scrollbars by only
+        taking into account the "rules" set by the web author.
+        For that, a new enum was added called SrollbarModesCalculationStrategy,
+        which allows callers to discard for example client-side scrollbar policies
+        in order to verify if a given frameview is scrollable or not.
+
+        (WebCore::FrameView::updateScrollableAreaSet):
+
+        Take into account various factors before considering a FrameView as
+        scrollable. If in the end it is, it gets added to its parent FrameView
+        scrollable areas map, otherwise removed.
+
+        (WebCore):
+        (WebCore::FrameView::addScrollableArea):
+
+        Became unneeded, thus removed.
+
+        (WebCore::FrameView::removeScrollableArea):
+
+        Whenever a FrameView is removed from the Widget-tree,
+        remove it from the cache.
+
+        * page/FrameView.h:
+        (FrameView):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::updateScrollbarsAfterLayout):
+
+        Update scrollable area set after layout.
+
+        (WebCore::RenderLayer::updateScrollbarsAfterStyleChange):
+
+        Update scrollable area set after style changes.
+
+        (WebCore::RenderLayer::styleChanged):
+
+        Removed the scrollable areas logic detection from it.
+
+        (WebCore::RenderLayer::updateScrollableAreaSet):
+
+        Updates the containing FrameView scrollable areas cache
+        only when needed (i.e. an overflow exists).
+
+        (WebCore):
+        * rendering/RenderLayer.h:
+        (RenderLayer):
+        * testing/Internals.cpp:
+        (WebCore::Internals::numberOfScrollableAreas):
+        (WebCore):
+        * testing/Internals.h:
+        (Internals):
+        * testing/Internals.idl:
+
+        Tests: fast/scrolling/scrollable-area-frame-inherited-visibility-hidden.html
+               fast/scrolling/scrollable-area-frame-overflow-hidden.html
+               fast/scrolling/scrollable-area-frame-overried-inherited-visibility-hidden.html
+               fast/scrolling/scrollable-area-frame-scrolling-no-overried-inherited-visibility-hidden.html
+               fast/scrolling/scrollable-area-frame-scrolling-no-visibility-hidden-child.html
+               fast/scrolling/scrollable-area-frame-scrolling-no.html
+               fast/scrolling/scrollable-area-frame-scrolling-yes-display-none.html
+               fast/scrolling/scrollable-area-frame-scrolling-yes.html
+               fast/scrolling/scrollable-area-frame-visibility-hidden-child.html
+               fast/scrolling/scrollable-area-frame-zero-size-and-border.html
+               fast/scrolling/scrollable-area-frame.html
+               fast/scrolling/scrollable-area-overflow-auto-display-none-in-parent.html
+               fast/scrolling/scrollable-area-overflow-auto-display-none.html
+               fast/scrolling/scrollable-area-overflow-auto-visibility-hidden-in-parent.html
+               fast/scrolling/scrollable-area-overflow-auto-visibility-hidden.html
+               fast/scrolling/scrollable-area-overflow-auto-visibility-override.html
+               fast/scrolling/scrollable-area-overflow-auto-visibility-visible.html
+               fast/scrolling/scrollable-area-overflow-auto.html
+               fast/scrolling/scrollable-area-overflow-not-set.html
+               fast/scrolling/scrollable-area-overflow-visible.html
+
 2012-04-13  Antti Koivisto  <antti@apple.com>
 
         Track rem unit usage in StyleSheetInternal
index 931e68a..f99ad19 100644 (file)
@@ -405,6 +405,8 @@ void FrameView::setFrameRect(const IntRect& newRect)
 
     ScrollView::setFrameRect(newRect);
 
+    updateScrollableAreaSet();
+
 #if USE(ACCELERATED_COMPOSITING)
     if (RenderView* root = rootRenderer(this)) {
         if (root->usesCompositing())
@@ -508,6 +510,8 @@ void FrameView::setContentsSize(const IntSize& size)
     if (!page)
         return;
 
+    updateScrollableAreaSet();
+
     page->chrome()->contentsSizeChanged(frame(), size); //notify only
 
     m_deferSetNeedsLayouts--;
@@ -595,7 +599,7 @@ void FrameView::applyOverflowToViewport(RenderObject* o, ScrollbarMode& hMode, S
     m_viewportRenderer = o;
 }
 
-void FrameView::calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode)
+void FrameView::calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode, ScrollbarModesCalculationStrategy strategy)
 {
     m_viewportRenderer = 0;
 
@@ -606,7 +610,7 @@ void FrameView::calculateScrollbarModesForLayout(ScrollbarMode& hMode, Scrollbar
         return;
     }  
     
-    if (m_canHaveScrollbars) {
+    if (m_canHaveScrollbars || strategy == RulesFromWebContentOnly) {
         hMode = ScrollbarAuto;
         vMode = ScrollbarAuto;
     } else {
@@ -2624,6 +2628,43 @@ IntRect FrameView::scrollableAreaBoundingBox() const
     return frameRect();
 }
 
+void FrameView::updateScrollableAreaSet()
+{
+    // That ensures that only inner frames are cached.
+    if (!parentFrameView())
+        return;
+
+    // Check for:
+    // 1) display:none or visibility:hidden set to self or inherited.
+    // 2) overflow{-x,-y}: hidden;
+    // 3) scrolling: no;
+
+    // Covers #1.
+    HTMLFrameOwnerElement* owner = m_frame->ownerElement();
+    if (!owner || !owner->renderer() || !owner->renderer()->visibleToHitTesting()) {
+        parentFrameView()->removeScrollableArea(this);
+        return;
+    }
+
+    IntSize contentSize = contentsSize();
+    IntSize visibleContentSize = visibleContentRect().size();
+    if ((contentSize.height() <= visibleContentSize.height() && contentSize.width() <= visibleContentSize.width())) {
+        parentFrameView()->removeScrollableArea(this);
+        return;
+    }
+
+    // Cover #2 and #3.
+    ScrollbarMode horizontalMode;
+    ScrollbarMode verticalMode;
+    calculateScrollbarModesForLayout(horizontalMode, verticalMode, RulesFromWebContentOnly);
+    if (horizontalMode == ScrollbarAlwaysOff && verticalMode == ScrollbarAlwaysOff) {
+        parentFrameView()->removeScrollableArea(this);
+        return;
+    }
+
+    parentFrameView()->addScrollableArea(this);
+}
+
 bool FrameView::shouldSuspendScrollAnimations() const
 {
     return m_frame->loader()->state() != FrameStateComplete;
@@ -3451,14 +3492,6 @@ bool FrameView::containsScrollableArea(ScrollableArea* scrollableArea) const
     return m_scrollableAreas->contains(scrollableArea);
 }
 
-void FrameView::addChild(PassRefPtr<Widget> widget)
-{
-    if (widget->isFrameView())
-        addScrollableArea(static_cast<FrameView*>(widget.get()));
-
-    ScrollView::addChild(widget);
-}
-
 void FrameView::removeChild(Widget* widget)
 {
     if (widget->isFrameView())
index 0ecc917..1d25085 100644 (file)
@@ -291,7 +291,8 @@ public:
 
     bool isFrameViewScrollCorner(RenderScrollbarPart* scrollCorner) const { return m_scrollCorner == scrollCorner; }
 
-    void calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode);
+    enum ScrollbarModesCalculationStrategy { RulesFromWebContentOnly, AnyRule };
+    void calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode, ScrollbarModesCalculationStrategy = AnyRule);
 
     // Normal delay
     static void setRepaintThrottlingDeferredRepaintDelay(double p);
@@ -327,7 +328,6 @@ public:
     bool containsScrollableArea(ScrollableArea*) const;
     const ScrollableAreaSet* scrollableAreas() const { return m_scrollableAreas.get(); }
 
-    virtual void addChild(PassRefPtr<Widget>) OVERRIDE;
     virtual void removeChild(Widget*) OVERRIDE;
 
     // This function exists for ports that need to handle wheel events manually.
@@ -389,6 +389,8 @@ private:
     virtual ScrollableArea* enclosingScrollableArea() const;
     virtual IntRect scrollableAreaBoundingBox() const OVERRIDE;
 
+    void updateScrollableAreaSet();
+
 #if USE(ACCELERATED_COMPOSITING)
     virtual GraphicsLayer* layerForHorizontalScrollbar() const OVERRIDE;
     virtual GraphicsLayer* layerForVerticalScrollbar() const OVERRIDE;
index 0952cad..7bbb003 100644 (file)
@@ -2200,7 +2200,7 @@ bool RenderLayer::scrollsOverflow() const
 {
     if (!renderer()->isBox())
         return false;
-    
+
     return toRenderBox(renderer())->scrollsOverflow();
 }
 
@@ -2402,7 +2402,7 @@ void RenderLayer::computeScrollDimensions()
 {
     RenderBox* box = renderBox();
     ASSERT(box);
-    
+
     m_scrollDimensionsDirty = false;
 
     m_scrollOverflow.setWidth(overflowLeft() - box->borderLeft());
@@ -2489,6 +2489,8 @@ void RenderLayer::updateScrollbarsAfterLayout()
         m_vBar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep);
         m_vBar->setProportion(clientHeight, m_scrollSize.height());
     }
+
+    updateScrollableAreaSet((hasHorizontalOverflow || hasVerticalOverflow) && scrollsOverflow());
 }
 
 void RenderLayer::updateScrollInfoAfterLayout()
@@ -4654,6 +4656,9 @@ void RenderLayer::updateScrollbarsAfterStyleChange(const RenderStyle* oldStyle)
         ASSERT(overflowCanHaveAScrollbar(overflowY));
         m_vBar->setEnabled(true);
     }
+
+    if (!m_scrollDimensionsDirty)
+        updateScrollableAreaSet((hasHorizontalOverflow() || hasVerticalOverflow()) && scrollsOverflow());
 }
 
 void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle)
@@ -4687,15 +4692,6 @@ void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle)
         updateReflectionStyle();
     }
     
-    if (Frame* frame = renderer()->frame()) {
-        if (FrameView* frameView = frame->view()) {
-            if (scrollsOverflow())
-                frameView->addScrollableArea(this);
-            else
-                frameView->removeScrollableArea(this);
-        }
-    }
-    
     // FIXME: Need to detect a swap from custom to native scrollbars (and vice versa).
     if (m_hBar)
         m_hBar->styleChanged();
@@ -4734,6 +4730,26 @@ void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle)
 #endif
 }
 
+void RenderLayer::updateScrollableAreaSet(bool hasOverflow)
+{
+    Frame* frame = renderer()->frame();
+    if (!frame)
+        return;
+
+    FrameView* frameView = frame->view();
+    if (!frameView)
+        return;
+
+    bool isVisibleToHitTest = renderer()->visibleToHitTesting();
+    if (HTMLFrameOwnerElement* owner = frame->ownerElement())
+        isVisibleToHitTest &= owner->renderer() && owner->renderer()->visibleToHitTesting();
+
+    if (hasOverflow && isVisibleToHitTest)
+        frameView->addScrollableArea(this);
+    else
+        frameView->removeScrollableArea(this);
+}
+
 void RenderLayer::updateScrollCornerStyle()
 {
     RenderObject* actualRenderer = renderer()->node() ? renderer()->node()->shadowAncestorNode()->renderer() : renderer();
index a294d2d..90b011a 100644 (file)
@@ -702,6 +702,8 @@ private:
 
     IntSize scrollbarOffset(const Scrollbar*) const;
     
+    void updateScrollableAreaSet(bool hasOverflow);
+
     void childVisibilityChanged(bool newVisibility);
     void dirtyVisibleDescendantStatus();
     void updateVisibilityStatus();
index 12cd0f6..1c5331a 100644 (file)
@@ -954,4 +954,19 @@ bool Internals::hasGrammarMarker(Document* document, int from, int length, Excep
     return document->frame()->editor()->selectionStartHasMarkerFor(DocumentMarker::Grammar, from, length);
 }
 
+unsigned Internals::numberOfScrollableAreas(Document* document, ExceptionCode&)
+{
+    unsigned count = 0;
+    Frame* frame = document->frame();
+    if (frame->view()->scrollableAreas())
+        count += frame->view()->scrollableAreas()->size();
+
+    for (Frame* child = frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) {
+        if (child->view() && child->view()->scrollableAreas())
+            count += child->view()->scrollableAreas()->size();
+    }
+
+    return count;
+}
+
 }
index 7364281..98428ea 100644 (file)
@@ -150,6 +150,8 @@ public:
     bool hasSpellingMarker(Document*, int from, int length, ExceptionCode&);
     bool hasGrammarMarker(Document*, int from, int length, ExceptionCode&);
 
+    unsigned numberOfScrollableAreas(Document*, ExceptionCode&);
+
     static const char* internalsId;
 
     InternalSettings* settings() const { return m_settings.get(); }
index 5e37dd7..00ebd50 100644 (file)
@@ -125,6 +125,8 @@ module window {
         boolean hasSpellingMarker(in Document document, in long from, in long length) raises (DOMException);
         boolean hasGrammarMarker(in Document document, in long from, in long length) raises (DOMException);
 
+        unsigned long numberOfScrollableAreas(in Document document) raises (DOMException);
+
         readonly attribute InternalSettings settings;
 
 #if defined(ENABLE_BATTERY_STATUS) && ENABLE_BATTERY_STATUS