.: Manual test of number of resize events emitted during page generation.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Jan 2012 12:36:41 +0000 (12:36 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Jan 2012 12:36:41 +0000 (12:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=77212

Is needed to test if too many resize events are send when using fixed
layout, and needs to be a manual test because the test framework does
not currently support testing fixed layout.

Patch by Allan Sandfeld Jensen <allan.jensen@nokia.com> on 2012-01-30
Reviewed by Kenneth Rohde Christiansen.

* ManualTests/resize-events.html: Added.

Source/WebCore: Only send resize events when layout size changes.
https://bugs.webkit.org/show_bug.cgi?id=77212

When using fixed layout the widget size is the size of content, therefore
resize checks must check against layoutsize and not widget size.

Patch by Allan Sandfeld Jensen <allan.jensen@nokia.com> on 2012-01-30
Reviewed by Kenneth Rohde Christiansen.

Needs to be manual tests because the test framework does not currently
support testing fixed layout.

Tests: ManualTests/resize-events.html

* page/FrameView.cpp:
(WebCore::FrameView::layout):
(WebCore::FrameView::performPostLayoutTasks):

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

ChangeLog
ManualTests/resize-events.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/FrameView.cpp

index c649b9d..0e27ce3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2012-01-30  Allan Sandfeld Jensen  <allan.jensen@nokia.com>
+
+        Manual test of number of resize events emitted during page generation.
+        https://bugs.webkit.org/show_bug.cgi?id=77212
+
+        Is needed to test if too many resize events are send when using fixed
+        layout, and needs to be a manual test because the test framework does
+        not currently support testing fixed layout.
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        * ManualTests/resize-events.html: Added.
+
 2012-01-29  Zoltan Herczeg  <zherczeg@webkit.org>
 
         Custom written CSS lexer
diff --git a/ManualTests/resize-events.html b/ManualTests/resize-events.html
new file mode 100644 (file)
index 0000000..42aebb1
--- /dev/null
@@ -0,0 +1,48 @@
+<html>
+<head>
+    <style>
+        div.block { height: 100px; border: 1px solid black; margin:10px; }
+    </style>
+    <script>
+        var resizecount = 0;
+        var loaded = false;
+        window.onresize = function() {
+            resizecount++;
+            document.getElementById('count1').innerHTML = resizecount;
+        }
+    </script>
+</head>
+<body>
+    <div>
+        Test how many resize events are emitted during page load and dynamic content generation.
+
+        Do not resize the page. It invalidates the test.
+        <p style="text-indent: 10px" id=result1>
+        Resize events (should be 0 or 1): <span id=count1>0</span>
+    </div>
+    <div id=expandingblock>
+    </div>
+    <script>
+        var blockcount = 0;
+        function addBlock() {
+            var el = document.createElement('div');
+            el.setAttribute('class','block');
+            document.getElementById('expandingblock').appendChild(el);
+            if (++blockcount < 30)
+                setTimeout(addBlock, 20);
+            else
+                finish();
+        }
+        function finish() {
+            var result;
+            // 0 or 1 resize events are acceptable.
+            if (resizecount < 2)
+                result = '<p style="color: green">PASS';
+            else
+                result = '<p style="color: red">FAIL';
+            var resultElement = document.getElementById('result1')
+            resultElement.innerHTML += result;
+        }
+        onload = addBlock;
+    </script>
+</body>
\ No newline at end of file
index 61917bf..2d2733d 100644 (file)
@@ -1,3 +1,22 @@
+2012-01-30  Allan Sandfeld Jensen  <allan.jensen@nokia.com>
+
+        Only send resize events when layout size changes.
+        https://bugs.webkit.org/show_bug.cgi?id=77212
+
+        When using fixed layout the widget size is the size of content, therefore
+        resize checks must check against layoutsize and not widget size.
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Needs to be manual tests because the test framework does not currently
+        support testing fixed layout.
+
+        Tests: ManualTests/resize-events.html
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::layout):
+        (WebCore::FrameView::performPostLayoutTasks):
+
 2012-01-30  Pavel Feldman  <pfeldman@google.com>
 
         Web Inspector: TimelinePanel does not respect InspectorFrontendHost.canSaveAs
index d26df80..585c8dc 100644 (file)
@@ -1059,7 +1059,7 @@ void FrameView::layout(bool allowSubtree)
 
                     m_firstLayout = false;
                     m_firstLayoutCallbackPending = true;
-                    m_lastLayoutSize = LayoutSize(width(), height());
+                    m_lastLayoutSize = LayoutSize(layoutWidth(), layoutHeight());
                     m_lastZoomFactor = root->style()->zoom();
 
                     // Set the initial vMode to AlwaysOn if we're auto.
@@ -2308,7 +2308,7 @@ void FrameView::performPostLayoutTasks()
     m_actionScheduler->resume();
 
     if (!root->printing()) {
-        LayoutSize currentSize = LayoutSize(width(), height());
+        LayoutSize currentSize = LayoutSize(layoutWidth(), layoutHeight());
         float currentZoomFactor = root->style()->zoom();
         bool resized = !m_firstLayout && (currentSize != m_lastLayoutSize || currentZoomFactor != m_lastZoomFactor);
         m_lastLayoutSize = currentSize;