[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 14:41:23 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit be05566c116b9a6d5d55768898986bed6de7d176
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 15 23:39:07 2010 +0000

    2010-10-15  Mike Lawther  <mikelawther at chromium.org>
    
            Reviewed by James Robinson.
    
            iframes keep getting scrollbars with scrolling="no"
            https://bugs.webkit.org/show_bug.cgi?id=29240
    
            Prevent scrollbars from appearing in iframes with scrolling=no
            when the embedded content has overflow:scroll set on the html
            or body tags.
    
            * fast/frames/iframe-scrolling-attribute-overflowscroll-expected.txt: Added.
            * fast/frames/iframe-scrolling-attribute-overflowscroll.html: Added.
    2010-10-15  Mike Lawther  <mikelawther at chromium.org>
    
            Reviewed by James Robinson.
    
            Prevent scrollbars from appearing in iframes with scrolling=no
            when the embedded content has overflow:scroll set on the html
            or body tags.
    
            iframes keep getting scrollbars with scrolling="no"
            https://bugs.webkit.org/show_bug.cgi?id=29240
    
            Test: fast/frames/iframe-scrolling-attribute-overflowscroll.html
    
            * page/FrameView.cpp:
            (WebCore::FrameView::calculateScrollbarModesForLayout)
            (WebCore::FrameView::updateCanHaveScrollbars):
            (WebCore::FrameView::layout):
            * page/FrameView.h:
            (WebCore::FrameView::calculateScrollbarModesForLayout)
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69896 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 586badc..df55e78 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-10-15  Mike Lawther  <mikelawther at chromium.org>
+
+        Reviewed by James Robinson.
+
+        iframes keep getting scrollbars with scrolling="no"
+        https://bugs.webkit.org/show_bug.cgi?id=29240
+        
+        Prevent scrollbars from appearing in iframes with scrolling=no
+        when the embedded content has overflow:scroll set on the html
+        or body tags.
+
+        * fast/frames/iframe-scrolling-attribute-overflowscroll-expected.txt: Added.
+        * fast/frames/iframe-scrolling-attribute-overflowscroll.html: Added.
+
 2010-10-15  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/fast/frames/iframe-scrolling-attribute-overflowscroll-expected.txt b/LayoutTests/fast/frames/iframe-scrolling-attribute-overflowscroll-expected.txt
new file mode 100644
index 0000000..c9f221b
--- /dev/null
+++ b/LayoutTests/fast/frames/iframe-scrolling-attribute-overflowscroll-expected.txt
@@ -0,0 +1,4 @@
+This page tests that there are no scrollbars with iframe elements which have scrolling=no, contain a page large enough to need to be scrolled and have overflow:scroll set on the html or body elements. If the page doesn't have a scrollbar, then the iframe's body's clientWidth should be equal to the iframe's clientWidth.
+
+ 
+PASSED
diff --git a/LayoutTests/fast/frames/iframe-scrolling-attribute-overflowscroll.html b/LayoutTests/fast/frames/iframe-scrolling-attribute-overflowscroll.html
new file mode 100644
index 0000000..7bbf716
--- /dev/null
+++ b/LayoutTests/fast/frames/iframe-scrolling-attribute-overflowscroll.html
@@ -0,0 +1,60 @@
+<html>
+<head>
+<title>Bug 29240: iframes keep getting scrollbars with scrolling=no</title>
+<style>
+    iframe {
+        width: 220px;
+        height: 200px;
+    }
+</style>
+<script>
+    
+    function inject(frameId, scrolltype) {
+        var content = 
+            '<html><head><style type="text/css">' + scrolltype + ' { overflow:scroll; }</style></head>' +
+            '<body><div style="width:380px; height:400px; background-color:green"></div></body></html>';
+
+        var doc = document.getElementById(frameId).contentDocument;
+        doc.open();
+        doc.write(content);
+        doc.close();        
+    }
+    
+    function testDimensions(frameId) {
+        var frame = document.getElementById(frameId);
+        var body = frame.contentDocument.body;
+        return (frame.clientWidth == body.clientWidth) && (frame.clientHeight == body.clientHeight);        
+    }
+
+    function reportMismatch(frameId) {
+        var frame = document.getElementById(frameId);
+        var body = frame.contentDocument.body;
+        return frameId + ": expected (" + frame.clientWidth + "," + frame.clientHeight + "), " + 
+               "actual (" + body.clientWidth + "," + body.clientHeight + ")";               
+    }
+    
+    function test() {
+        var htmlScrollSuccess = testDimensions("frame1");
+        var bodyScrollSuccess = testDimensions("frame2");
+
+        var output = document.getElementById('output');
+        output.innerHTML = htmlScrollSuccess && bodyScrollSuccess ? 
+            "PASSED" : 
+            "FAILED: " + reportMismatch("frame1") + "; " + reportMismatch("frame2");
+
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+    }
+    
+</script>
+</head>
+<body onload="test()">
+<p>This page tests that there are no scrollbars with iframe elements which have scrolling=no, 
+contain a page large enough to need to be scrolled and have overflow:scroll set on the html 
+or body elements. If the page doesn't have a scrollbar, then the iframe's body's clientWidth 
+should be equal to the iframe's clientWidth.</p>
+<iframe id="frame1" scrolling="no" onload="inject('frame1', 'html')"></iframe>
+<iframe id="frame2" scrolling="no" onload="inject('frame2', 'body')"></iframe>
+<div id='output'></div>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 86aa30a..8fbddc0 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2010-10-15  Mike Lawther  <mikelawther at chromium.org>
+
+        Reviewed by James Robinson.
+
+        Prevent scrollbars from appearing in iframes with scrolling=no
+        when the embedded content has overflow:scroll set on the html
+        or body tags.
+
+        iframes keep getting scrollbars with scrolling="no"
+        https://bugs.webkit.org/show_bug.cgi?id=29240
+
+        Test: fast/frames/iframe-scrolling-attribute-overflowscroll.html
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::calculateScrollbarModesForLayout)
+        (WebCore::FrameView::updateCanHaveScrollbars):
+        (WebCore::FrameView::layout):
+        * page/FrameView.h:
+        (WebCore::FrameView::calculateScrollbarModesForLayout)
+
 2010-10-15  Dan Bernstein  <mitz at apple.com>
 
         Reviewed by Adele Peterson.
diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp
index 09255f1..676c864 100644
--- a/WebCore/page/FrameView.cpp
+++ b/WebCore/page/FrameView.cpp
@@ -378,9 +378,9 @@ void FrameView::updateCanHaveScrollbars()
     ScrollbarMode vMode;
     scrollbarModes(hMode, vMode);
     if (hMode == ScrollbarAlwaysOff && vMode == ScrollbarAlwaysOff)
-        m_canHaveScrollbars = false;
+        setCanHaveScrollbars(false);
     else
-        m_canHaveScrollbars = true;
+        setCanHaveScrollbars(true);
 }
 
 PassRefPtr<Scrollbar> FrameView::createScrollbar(ScrollbarOrientation orientation)
@@ -477,6 +477,58 @@ void FrameView::applyOverflowToViewport(RenderObject* o, ScrollbarMode& hMode, S
     m_viewportRenderer = o;
 }
 
+void FrameView::calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode)
+{
+    if (m_canHaveScrollbars) {
+        hMode = ScrollbarAuto;
+        vMode = ScrollbarAuto;
+    } else {
+        hMode = ScrollbarAlwaysOff;
+        vMode = ScrollbarAlwaysOff;
+    }
+    
+    if (!m_layoutRoot) {
+        Document* document = m_frame->document();
+        Node* documentElement = document->documentElement();
+        RenderObject* rootRenderer = documentElement ? documentElement->renderer() : 0;
+        Node* body = document->body();
+        if (body && body->renderer()) {
+            if (body->hasTagName(framesetTag) && m_frame->settings() && !m_frame->settings()->frameFlatteningEnabled()) {
+                body->renderer()->setChildNeedsLayout(true);
+                vMode = ScrollbarAlwaysOff;
+                hMode = ScrollbarAlwaysOff;
+            } else if (body->hasTagName(bodyTag)) {
+                if (!m_firstLayout && m_size.height() != layoutHeight() && body->renderer()->enclosingBox()->stretchesToViewport())
+                    body->renderer()->setChildNeedsLayout(true);
+                // It's sufficient to just check the X overflow,
+                // since it's illegal to have visible in only one direction.
+                RenderObject* o = rootRenderer->style()->overflowX() == OVISIBLE && document->documentElement()->hasTagName(htmlTag) ? body->renderer() : rootRenderer;
+                applyOverflowToViewport(o, hMode, vMode);
+            }
+        } else if (rootRenderer) {
+#if ENABLE(SVG)
+            if (documentElement->isSVGElement()) {
+                if (!m_firstLayout && (m_size.width() != layoutWidth() || m_size.height() != layoutHeight()))
+                    rootRenderer->setChildNeedsLayout(true);
+            } else
+                applyOverflowToViewport(rootRenderer, hMode, vMode);
+#else
+            applyOverflowToViewport(rootRenderer, hMode, vMode);
+#endif
+        }
+#ifdef INSTRUMENT_LAYOUT_SCHEDULING
+        if (m_firstLayout && !document->ownerElement())
+            printf("Elapsed time before first layout: %d\n", document->elapsedTime());
+#endif
+    }
+    
+    HTMLFrameOwnerElement* owner = m_frame->ownerElement();
+    if (owner && (owner->scrollingMode() == ScrollbarAlwaysOff)) {
+        hMode = ScrollbarAlwaysOff;
+        vMode = ScrollbarAlwaysOff;
+    }     
+}
+    
 #if USE(ACCELERATED_COMPOSITING)
 void FrameView::updateCompositingLayers()
 {
@@ -666,47 +718,8 @@ void FrameView::layout(bool allowSubtree)
 
     ScrollbarMode hMode;
     ScrollbarMode vMode;
-    if (m_canHaveScrollbars) {
-        hMode = ScrollbarAuto;
-        vMode = ScrollbarAuto;
-    } else {
-        hMode = ScrollbarAlwaysOff;
-        vMode = ScrollbarAlwaysOff;
-    }
-
-    if (!subtree) {
-        Node* documentElement = document->documentElement();
-        RenderObject* rootRenderer = documentElement ? documentElement->renderer() : 0;
-        Node* body = document->body();
-        if (body && body->renderer()) {
-            if (body->hasTagName(framesetTag) && m_frame->settings() && !m_frame->settings()->frameFlatteningEnabled()) {
-                body->renderer()->setChildNeedsLayout(true);
-                vMode = ScrollbarAlwaysOff;
-                hMode = ScrollbarAlwaysOff;
-            } else if (body->hasTagName(bodyTag)) {
-                if (!m_firstLayout && m_size.height() != layoutHeight() && body->renderer()->enclosingBox()->stretchesToViewport())
-                    body->renderer()->setChildNeedsLayout(true);
-                // It's sufficient to just check the X overflow,
-                // since it's illegal to have visible in only one direction.
-                RenderObject* o = rootRenderer->style()->overflowX() == OVISIBLE && document->documentElement()->hasTagName(htmlTag) ? body->renderer() : rootRenderer;
-                applyOverflowToViewport(o, hMode, vMode);
-            }
-        } else if (rootRenderer) {
-#if ENABLE(SVG)
-            if (documentElement->isSVGElement()) {
-                if (!m_firstLayout && (m_size.width() != layoutWidth() || m_size.height() != layoutHeight()))
-                    rootRenderer->setChildNeedsLayout(true);
-            } else
-                applyOverflowToViewport(rootRenderer, hMode, vMode);
-#else
-            applyOverflowToViewport(rootRenderer, hMode, vMode);
-#endif
-        }
-#ifdef INSTRUMENT_LAYOUT_SCHEDULING
-        if (m_firstLayout && !document->ownerElement())
-            printf("Elapsed time before first layout: %d\n", document->elapsedTime());
-#endif
-    }
+    
+    calculateScrollbarModesForLayout(hMode, vMode);
 
     m_doFullRepaint = !subtree && (m_firstLayout || toRenderView(root)->printing());
 
diff --git a/WebCore/page/FrameView.h b/WebCore/page/FrameView.h
index 5e27433..1518233 100644
--- a/WebCore/page/FrameView.h
+++ b/WebCore/page/FrameView.h
@@ -258,6 +258,7 @@ private:
     bool hasFixedObjects() const { return m_fixedObjectCount > 0; }
 
     void applyOverflowToViewport(RenderObject*, ScrollbarMode& hMode, ScrollbarMode& vMode);
+    void calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode);
 
     void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow);
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list