Title: [106730] trunk
Revision
106730
Author
[email protected]
Date
2012-02-04 01:19:57 -0800 (Sat, 04 Feb 2012)

Log Message

Source/WebCore: Patch by Swapna P <[email protected]> on 2012-02-04
Reviewed by Antonio Gomes.

Bug: iframe with scrolling=no incorrectly autoscrollable
https://bugs.webkit.org/show_bug.cgi?id=61558

Added check for frame scrolling mode just before applying scroll on frame content in function RenderLayer::scrollRect

Testcase: LayoutTests/fast/events/autoscroll-with-non-scrollable-parent.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollRectToVisible):

LayoutTests: Patch by Swapna P <[email protected]> on 2012-02-04
Reviewed by Antonio Gomes.

Bug: iframe with scrolling=no incorrectly autoscrollable
https://bugs.webkit.org/show_bug.cgi?id=61558

Did change inorder to print correct log as per the description provided in test case.

* fast/events/autoscroll-with-non-scrollable-parent.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (106729 => 106730)


--- trunk/LayoutTests/ChangeLog	2012-02-04 06:43:50 UTC (rev 106729)
+++ trunk/LayoutTests/ChangeLog	2012-02-04 09:19:57 UTC (rev 106730)
@@ -1,3 +1,14 @@
+2012-02-04  Swapna P  <[email protected]>
+
+        Reviewed by Antonio Gomes.
+        
+        Bug: iframe with scrolling=no incorrectly autoscrollable
+        https://bugs.webkit.org/show_bug.cgi?id=61558
+        
+        Did change inorder to print correct log as per the description provided in test case.
+        
+        * fast/events/autoscroll-with-non-scrollable-parent.html:
+
 2012-02-03  Adam Barth  <[email protected]>
 
         Add a Chromium-specific baseline for this test.  These results appear to be passing.

Modified: trunk/LayoutTests/fast/events/autoscroll-with-non-scrollable-parent.html (106729 => 106730)


--- trunk/LayoutTests/fast/events/autoscroll-with-non-scrollable-parent.html	2012-02-04 06:43:50 UTC (rev 106729)
+++ trunk/LayoutTests/fast/events/autoscroll-with-non-scrollable-parent.html	2012-02-04 09:19:57 UTC (rev 106730)
@@ -39,7 +39,7 @@
            
            var iframe = document.getElementById('NoScrolliFrame');
            var iframeDocument = iframe.contentDocument;
-           if (iframeDocument.body.scrollLeft != 0)
+           if (iframeDocument.body.scrollLeft == 0)
                log("PASSED");
            else
                log("FAILED : " + iframeDocument.body.scrollLeft + " pixels have been scrolled");

Modified: trunk/Source/WebCore/ChangeLog (106729 => 106730)


--- trunk/Source/WebCore/ChangeLog	2012-02-04 06:43:50 UTC (rev 106729)
+++ trunk/Source/WebCore/ChangeLog	2012-02-04 09:19:57 UTC (rev 106730)
@@ -1,3 +1,17 @@
+2012-02-04  Swapna P  <[email protected]>
+
+        Reviewed by Antonio Gomes.
+        
+        Bug: iframe with scrolling=no incorrectly autoscrollable
+        https://bugs.webkit.org/show_bug.cgi?id=61558
+        
+        Added check for frame scrolling mode just before applying scroll on frame content in function RenderLayer::scrollRect
+        
+        Testcase: LayoutTests/fast/events/autoscroll-with-non-scrollable-parent.html
+        
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::scrollRectToVisible):
+
 2012-02-03  Tim Horton  <[email protected]>
 
         Canvas-into-canvas drawing should respect backing store scale ratio

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (106729 => 106730)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2012-02-04 06:43:50 UTC (rev 106729)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2012-02-04 09:19:57 UTC (rev 106730)
@@ -66,6 +66,7 @@
 #include "FrameView.h"
 #include "Gradient.h"
 #include "GraphicsContext.h"
+#include "HTMLFrameElement.h"
 #include "HTMLFrameOwnerElement.h"
 #include "HTMLNames.h"
 #include "HitTestingTransformState.h"
@@ -1542,20 +1543,31 @@
         }
     } else if (!parentLayer && renderer()->isBox() && renderBox()->canBeProgramaticallyScrolled()) {
         if (frameView) {
-            if (renderer()->document() && renderer()->document()->ownerElement() && renderer()->document()->ownerElement()->renderer()) {
-                LayoutRect viewRect = frameView->visibleContentRect();
-                LayoutRect r = getRectToExpose(viewRect, rect, alignX, alignY);
-                
-                LayoutUnit xOffset = r.x();
-                LayoutUnit yOffset = r.y();
-                // Adjust offsets if they're outside of the allowable range.
-                xOffset = max<LayoutUnit>(0, min(frameView->contentsWidth(), xOffset));
-                yOffset = max<LayoutUnit>(0, min(frameView->contentsHeight(), yOffset));
+            Element* ownerElement = 0;
+            if (renderer()->document())
+                ownerElement = renderer()->document()->ownerElement();
 
-                frameView->setScrollPosition(IntPoint(xOffset, yOffset));
-                parentLayer = renderer()->document()->ownerElement()->renderer()->enclosingLayer();
-                newRect.setX(rect.x() - frameView->scrollX() + frameView->x());
-                newRect.setY(rect.y() - frameView->scrollY() + frameView->y());
+            if (ownerElement && ownerElement->renderer()) {
+                HTMLFrameElement* frameElement = 0;
+
+                if (ownerElement->hasTagName(frameTag) || ownerElement->hasTagName(iframeTag))
+                    frameElement = static_cast<HTMLFrameElement*>(ownerElement);
+
+                if (frameElement && frameElement->scrollingMode() != ScrollbarAlwaysOff) {
+                    LayoutRect viewRect = frameView->visibleContentRect();
+                    LayoutRect exposeRect = getRectToExpose(viewRect, rect, alignX, alignY);
+
+                    LayoutUnit xOffset = exposeRect.x();
+                    LayoutUnit yOffset = exposeRect.y();
+                    // Adjust offsets if they're outside of the allowable range.
+                    xOffset = max<LayoutUnit>(0, min(frameView->contentsWidth(), xOffset));
+                    yOffset = max<LayoutUnit>(0, min(frameView->contentsHeight(), yOffset));
+
+                    frameView->setScrollPosition(IntPoint(xOffset, yOffset));
+                    parentLayer = ownerElement->renderer()->enclosingLayer();
+                    newRect.setX(rect.x() - frameView->scrollX() + frameView->x());
+                    newRect.setY(rect.y() - frameView->scrollY() + frameView->y());
+                }
             } else {
                 LayoutRect viewRect = frameView->visibleContentRect();
                 LayoutRect r = getRectToExpose(viewRect, rect, alignX, alignY);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to