REGRESSION (r114170): Scroll areas in nested frames improperly placed when tiled...
authorjpfau@apple.com <jpfau@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 12 May 2012 02:01:51 +0000 (02:01 +0000)
committerjpfau@apple.com <jpfau@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 12 May 2012 02:01:51 +0000 (02:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=86239

Reviewed by Anders Carlsson.

.:

* ManualTests/resources/frame-textarea.html: Added.
* ManualTests/scrollable-positioned-frame.html: Added.
* ManualTests/scrollable-positioned-nested-frame.html: Added.

Source/WebCore:

Fixes a regression introduced in r114170 by recursively adding positions of parent frames to placement of nested frame scroll areas.

Manual tests: ManualTests/scrollable-positioned-frame.html
              ManualTests/scrollable-positioned-nested-frame.html

* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::computeNonFastScrollableRegion):
(WebCore::ScrollingCoordinator::frameViewLayoutUpdated):

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

ChangeLog
ManualTests/resources/frame-textarea.html [new file with mode: 0644]
ManualTests/scrollable-positioned-frame.html [new file with mode: 0644]
ManualTests/scrollable-positioned-nested-frame.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/scrolling/ScrollingCoordinator.cpp

index a668667..bd2fb91 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-05-11  Jeffrey Pfau  <jpfau@apple.com>
+
+        REGRESSION (r114170): Scroll areas in nested frames improperly placed when tiled drawing is enabled
+        https://bugs.webkit.org/show_bug.cgi?id=86239
+
+        Reviewed by Anders Carlsson.
+
+        * ManualTests/resources/frame-textarea.html: Added.
+        * ManualTests/scrollable-positioned-frame.html: Added.
+        * ManualTests/scrollable-positioned-nested-frame.html: Added.
+
 2012-05-11  Kevin Ollivier  <kevino@theolliviers.com>
 
         [wx] Unreviewed build fix, exclude some files we don't use from the build.
diff --git a/ManualTests/resources/frame-textarea.html b/ManualTests/resources/frame-textarea.html
new file mode 100644 (file)
index 0000000..54a3e09
--- /dev/null
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<body>
+  <textarea>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque nulla est, tincidunt pharetra hendrerit nec, ultrices non mi. Fusce feugiat tempus mollis. Nulla sapien augue, iaculis sit amet ornare vitae, ultricies non ante. Aliquam dignissim porta dolor, ac laoreet lectus faucibus ac. Phasellus luctus eros in erat fermentum rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec venenatis bibendum quam.
+
+Cras vel tellus tellus, accumsan malesuada erat. Mauris tincidunt fermentum massa sit amet ornare. Sed pellentesque ultrices sapien, non cursus felis vestibulum id. Integer vitae enim nec lacus hendrerit consequat id in purus. Suspendisse porta, enim nec congue auctor, nisi augue vulputate magna, eu sollicitudin elit felis id erat. Curabitur in ante elit, et lobortis nulla. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean gravida odio non nulla porta convallis.
+  </textarea>
+</body>
+</html>
\ No newline at end of file
diff --git a/ManualTests/scrollable-positioned-frame.html b/ManualTests/scrollable-positioned-frame.html
new file mode 100644 (file)
index 0000000..56f80f3
--- /dev/null
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+  <p>The contents of this frame should scroll with the mouse wheel.</p>
+  <iframe width=200 scrolling=yes src="resources/frame-textarea.html" style="position:fixed; left: 200px" id="frame"></iframe>
+</body>
+</html>
diff --git a/ManualTests/scrollable-positioned-nested-frame.html b/ManualTests/scrollable-positioned-nested-frame.html
new file mode 100644 (file)
index 0000000..4e53bbb
--- /dev/null
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+  <p>The contents of this frame should scroll with the mouse wheel.</p>
+  <iframe width=400 scrolling=yes src="scrollable-positioned-frame.html" style="position:fixed; left: 200px" id="frame"></iframe>
+</body>
+</html>
index 117167e..8b5ccc7 100644 (file)
@@ -1,3 +1,19 @@
+2012-05-11  Jeffrey Pfau  <jpfau@apple.com>
+
+        REGRESSION (r114170): Scroll areas in nested frames improperly placed when tiled drawing is enabled
+        https://bugs.webkit.org/show_bug.cgi?id=86239
+
+        Reviewed by Anders Carlsson.
+
+        Fixes a regression introduced in r114170 by recursively adding positions of parent frames to placement of nested frame scroll areas.
+
+        Manual tests: ManualTests/scrollable-positioned-frame.html
+                      ManualTests/scrollable-positioned-nested-frame.html
+
+        * page/scrolling/ScrollingCoordinator.cpp:
+        (WebCore::computeNonFastScrollableRegion):
+        (WebCore::ScrollingCoordinator::frameViewLayoutUpdated):
+
 2012-05-11  Beth Dakin  <bdakin@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=86278
index 9cf9615..d38bbd5 100644 (file)
@@ -105,34 +105,40 @@ bool ScrollingCoordinator::coordinatesScrollingForFrameView(FrameView* frameView
 #endif
 }
 
-static Region computeNonFastScrollableRegion(Frame* mainFrame)
+static Region computeNonFastScrollableRegion(Frame* frame, const IntPoint& frameLocation)
 {
     Region nonFastScrollableRegion;
+    FrameView* frameView = frame->view();
+    if (!frameView)
+        return nonFastScrollableRegion;
 
-    for (Frame* frame = mainFrame; frame; frame = frame->tree()->traverseNext()) {
-        FrameView* frameView = frame->view();
-        if (!frameView)
-            continue;
+    IntPoint offset = frameLocation;
+    offset.moveBy(frameView->frameRect().location());
 
-        if (const FrameView::ScrollableAreaSet* scrollableAreas = frameView->scrollableAreas()) {
-            for (FrameView::ScrollableAreaSet::const_iterator it = scrollableAreas->begin(), end = scrollableAreas->end(); it != end; ++it) {
-                ScrollableArea* scrollableArea = *it;
-                nonFastScrollableRegion.unite(scrollableArea->scrollableAreaBoundingBox());
-            }
+    if (const FrameView::ScrollableAreaSet* scrollableAreas = frameView->scrollableAreas()) {
+        for (FrameView::ScrollableAreaSet::const_iterator it = scrollableAreas->begin(), end = scrollableAreas->end(); it != end; ++it) {
+            ScrollableArea* scrollableArea = *it;
+            IntRect box = scrollableArea->scrollableAreaBoundingBox();
+            box.moveBy(offset);
+            nonFastScrollableRegion.unite(box);
         }
+    }
 
-        if (const HashSet<RefPtr<Widget> >* children = frameView->children()) {
-            for (HashSet<RefPtr<Widget> >::const_iterator it = children->begin(), end = children->end(); it != end; ++it) {
-                if (!(*it)->isPluginViewBase())
-                    continue;
-                
-                PluginViewBase* pluginViewBase = static_cast<PluginViewBase*>((*it).get());
-                if (pluginViewBase->wantsWheelEvents())
-                    nonFastScrollableRegion.unite(pluginViewBase->frameRect());
-            }
+    if (const HashSet<RefPtr<Widget> >* children = frameView->children()) {
+        for (HashSet<RefPtr<Widget> >::const_iterator it = children->begin(), end = children->end(); it != end; ++it) {
+            if (!(*it)->isPluginViewBase())
+                continue;
+
+            PluginViewBase* pluginViewBase = static_cast<PluginViewBase*>((*it).get());
+            if (pluginViewBase->wantsWheelEvents())
+                nonFastScrollableRegion.unite(pluginViewBase->frameRect());
         }
     }
 
+    FrameTree* tree = frame->tree();
+    for (Frame* subFrame = tree->firstChild(); subFrame; subFrame = subFrame->tree()->nextSibling())
+        nonFastScrollableRegion.unite(computeNonFastScrollableRegion(subFrame, offset));
+
     return nonFastScrollableRegion;
 }
 
@@ -144,7 +150,7 @@ void ScrollingCoordinator::frameViewLayoutUpdated(FrameView* frameView)
     // Compute the region of the page that we can't do fast scrolling for. This currently includes
     // all scrollable areas, such as subframes, overflow divs and list boxes. We need to do this even if the
     // frame view whose layout was updated is not the main frame.
-    Region nonFastScrollableRegion = computeNonFastScrollableRegion(m_page->mainFrame());
+    Region nonFastScrollableRegion = computeNonFastScrollableRegion(m_page->mainFrame(), IntPoint());
     setNonFastScrollableRegion(nonFastScrollableRegion);
 
     if (!coordinatesScrollingForFrameView(frameView))