- Revision
- 110938
- Author
- [email protected]
- Date
- 2012-03-15 21:03:24 -0700 (Thu, 15 Mar 2012)
Log Message
REGRESSION(r106232): The resize handler is always called after loading.
https://bugs.webkit.org/show_bug.cgi?id=80242
Patch by Allan Sandfeld Jensen <[email protected]> on 2012-03-15
Reviewed by Kenneth Rohde Christiansen.
Source/WebCore:
Ensure resize-events are not emitted when layout-size changes due to added
scrollbars. For fixed layout, scrollbars are never subtracted or added, so
we can compare fixedLayoutSize directly. For normal layout, use the full
visible rect size which is the same as layout size plus scrollbars.
Test: fast/events/resize-events.html
* page/FrameView.cpp:
(WebCore::FrameView::reset):
(WebCore::FrameView::layout):
(WebCore::FrameView::performPostLayoutTasks):
* page/FrameView.h:
(FrameView):
LayoutTests:
Tests that no resize events are emitted during page creation,
even if the page overflows and adds a scrollbar.
* fast/events/resize-events-expected.txt: Added.
* fast/events/resize-events.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (110937 => 110938)
--- trunk/LayoutTests/ChangeLog 2012-03-16 03:45:29 UTC (rev 110937)
+++ trunk/LayoutTests/ChangeLog 2012-03-16 04:03:24 UTC (rev 110938)
@@ -1,3 +1,16 @@
+2012-03-15 Allan Sandfeld Jensen <[email protected]>
+
+ REGRESSION(r106232): The resize handler is always called after loading.
+ https://bugs.webkit.org/show_bug.cgi?id=80242
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Tests that no resize events are emitted during page creation,
+ even if the page overflows and adds a scrollbar.
+
+ * fast/events/resize-events-expected.txt: Added.
+ * fast/events/resize-events.html: Added.
+
2012-03-15 Matt Falkenhagen <[email protected]>
Add layout tests for font selection based on lang/xml:lang
Added: trunk/LayoutTests/fast/events/resize-events-expected.txt (0 => 110938)
--- trunk/LayoutTests/fast/events/resize-events-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/resize-events-expected.txt 2012-03-16 04:03:24 UTC (rev 110938)
@@ -0,0 +1,20 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x582
+ RenderBlock {DIV} at (0,0) size 784x79
+ RenderBlock (anonymous) at (0,0) size 784x42
+ RenderText {#text} at (0,0) size 772x42
+ text run at (0,0) width 652: "Test how many resize events are emitted during page load and dynamic content generation. "
+ text run at (652,0) width 120: "Do not resize the"
+ text run at (0,21) width 192: "page. It invalidates the test."
+ RenderBlock {P} at (0,58) size 784x21
+ RenderText {#text} at (10,0) size 206x21
+ text run at (10,0) width 206: "Resize events (should be 0): "
+ RenderInline {SPAN} at (0,0) size 9x21
+ RenderText {#text} at (216,0) size 9x21
+ text run at (216,0) width 9: "0"
+ RenderText {#text} at (0,0) size 0x0
+ RenderBlock {DIV} at (0,95) size 784x402
+ RenderBlock {DIV} at (10,0) size 764x402 [border: (1px solid #000000)]
Added: trunk/LayoutTests/fast/events/resize-events.html (0 => 110938)
--- trunk/LayoutTests/fast/events/resize-events.html (rev 0)
+++ trunk/LayoutTests/fast/events/resize-events.html 2012-03-16 04:03:24 UTC (rev 110938)
@@ -0,0 +1,54 @@
+<html>
+<head>
+ <style>
+ div.block { height: 400px; 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): <span id=count1>0</span>
+ </div>
+ <div id=expandingblock>
+ </div>
+ <script>
+ if (window.layoutTestController) {
+ layoutTestController.waitUntilDone();
+ }
+
+ var blockcount = 0;
+ function addBlock() {
+ var el = document.createElement('div');
+ el.setAttribute('class','block');
+ document.getElementById('expandingblock').appendChild(el);
+ if (++blockcount < 10)
+ setTimeout(addBlock, 20);
+ else
+ finish();
+ }
+ function finish() {
+ var result;
+ // No resize events are acceptable.
+ if (resizecount < 1)
+ result = '<p style="color: green">PASS';
+ else
+ result = '<p style="color: red">FAIL';
+ var resultElement = document.getElementById('result1')
+ resultElement.innerHTML += result;
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }
+ _onload_ = addBlock;
+ </script>
+</body>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (110937 => 110938)
--- trunk/Source/WebCore/ChangeLog 2012-03-16 03:45:29 UTC (rev 110937)
+++ trunk/Source/WebCore/ChangeLog 2012-03-16 04:03:24 UTC (rev 110938)
@@ -1,3 +1,24 @@
+2012-03-15 Allan Sandfeld Jensen <[email protected]>
+
+ REGRESSION(r106232): The resize handler is always called after loading.
+ https://bugs.webkit.org/show_bug.cgi?id=80242
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Ensure resize-events are not emitted when layout-size changes due to added
+ scrollbars. For fixed layout, scrollbars are never subtracted or added, so
+ we can compare fixedLayoutSize directly. For normal layout, use the full
+ visible rect size which is the same as layout size plus scrollbars.
+
+ Test: fast/events/resize-events.html
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::reset):
+ (WebCore::FrameView::layout):
+ (WebCore::FrameView::performPostLayoutTasks):
+ * page/FrameView.h:
+ (FrameView):
+
2012-03-15 Tommy Widenflycht <[email protected]>
MediaStream API (JSEP): Introducing MediaHints and IceOptions
Modified: trunk/Source/WebCore/page/FrameView.cpp (110937 => 110938)
--- trunk/Source/WebCore/page/FrameView.cpp 2012-03-16 03:45:29 UTC (rev 110937)
+++ trunk/Source/WebCore/page/FrameView.cpp 2012-03-16 04:03:24 UTC (rev 110938)
@@ -228,7 +228,7 @@
m_firstLayout = true;
m_firstLayoutCallbackPending = false;
m_wasScrolledByUser = false;
- m_lastLayoutSize = LayoutSize();
+ m_lastViewportSize = IntSize();
m_lastZoomFactor = 1.0f;
m_deferringRepaints = 0;
m_repaintCount = 0;
@@ -1022,7 +1022,10 @@
m_firstLayout = false;
m_firstLayoutCallbackPending = true;
- m_lastLayoutSize = LayoutSize(layoutWidth(), layoutHeight());
+ if (useFixedLayout() && !fixedLayoutSize().isEmpty() && delegatesScrolling())
+ m_lastViewportSize = fixedLayoutSize();
+ else
+ m_lastViewportSize = visibleContentRect(true /*includeScrollbars*/).size();
m_lastZoomFactor = root->style()->zoom();
// Set the initial vMode to AlwaysOn if we're auto.
@@ -2306,10 +2309,14 @@
m_actionScheduler->resume();
if (!root->printing()) {
- LayoutSize currentSize = LayoutSize(layoutWidth(), layoutHeight());
+ IntSize currentSize;
+ if (useFixedLayout() && !fixedLayoutSize().isEmpty() && delegatesScrolling())
+ currentSize = fixedLayoutSize();
+ else
+ currentSize = visibleContentRect(true /*includeScrollbars*/).size();
float currentZoomFactor = root->style()->zoom();
- bool resized = !m_firstLayout && (currentSize != m_lastLayoutSize || currentZoomFactor != m_lastZoomFactor);
- m_lastLayoutSize = currentSize;
+ bool resized = !m_firstLayout && (currentSize != m_lastViewportSize || currentZoomFactor != m_lastZoomFactor);
+ m_lastViewportSize = currentSize;
m_lastZoomFactor = currentZoomFactor;
if (resized) {
m_frame->eventHandler()->sendResizeEvent();
Modified: trunk/Source/WebCore/page/FrameView.h (110937 => 110938)
--- trunk/Source/WebCore/page/FrameView.h 2012-03-16 03:45:29 UTC (rev 110937)
+++ trunk/Source/WebCore/page/FrameView.h 2012-03-16 04:03:24 UTC (rev 110938)
@@ -446,7 +446,7 @@
bool m_firstLayout;
bool m_isTransparent;
Color m_baseBackgroundColor;
- LayoutSize m_lastLayoutSize;
+ IntSize m_lastViewportSize;
float m_lastZoomFactor;
String m_mediaType;