- Revision
- 225791
- Author
- simon.fra...@apple.com
- Date
- 2017-12-12 11:15:50 -0800 (Tue, 12 Dec 2017)
Log Message
HTML-page with <object type="image/svg+xml" data="" often is blank
https://bugs.webkit.org/show_bug.cgi?id=180524
<rdar://problem/35920554>
Reviewed by Antti Koivisto.
Source/WebCore:
The test case has script that conditionalizes behavior on whether window.innerWidth/Height
are zero during the load event. We didn't force layout in innerWidth/Height, so whether
they would zero depended on whether the parent frame had laid out, which was timing-sensitive.
Fix by triggering enough layout in the parent document so that the FrameView is resized before
fetching its dimensions in innerWidth/Height. This causes our behavior to match Chrome and Firefox.
Test: fast/dom/iframe-innerWidth.html
* dom/EventDispatcher.cpp:
(WebCore::EventDispatcher::dispatchEvent): Add some logging that helped me diagnose this.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::innerHeight const):
(WebCore::DOMWindow::innerWidth const):
LayoutTests:
Adjust a test where the new layout is triggering scrollbar creation.
* fast/dom/iframe-inner-size-scaling-expected.txt:
* fast/dom/iframe-inner-size-scaling.html:
* fast/dom/iframe-innerWidth-expected.txt: Added.
* fast/dom/iframe-innerWidth.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (225790 => 225791)
--- trunk/LayoutTests/ChangeLog 2017-12-12 19:01:18 UTC (rev 225790)
+++ trunk/LayoutTests/ChangeLog 2017-12-12 19:15:50 UTC (rev 225791)
@@ -1,3 +1,18 @@
+2017-12-12 Simon Fraser <simon.fra...@apple.com>
+
+ HTML-page with <object type="image/svg+xml" data="" often is blank
+ https://bugs.webkit.org/show_bug.cgi?id=180524
+ <rdar://problem/35920554>
+
+ Reviewed by Antti Koivisto.
+
+ Adjust a test where the new layout is triggering scrollbar creation.
+
+ * fast/dom/iframe-inner-size-scaling-expected.txt:
+ * fast/dom/iframe-inner-size-scaling.html:
+ * fast/dom/iframe-innerWidth-expected.txt: Added.
+ * fast/dom/iframe-innerWidth.html: Added.
+
2017-12-11 Antoine Quint <grao...@apple.com>
[Web Animations] Enqueue and dispatch animation events
Modified: trunk/LayoutTests/fast/dom/iframe-inner-size-scaling-expected.txt (225790 => 225791)
--- trunk/LayoutTests/fast/dom/iframe-inner-size-scaling-expected.txt 2017-12-12 19:01:18 UTC (rev 225790)
+++ trunk/LayoutTests/fast/dom/iframe-inner-size-scaling-expected.txt 2017-12-12 19:15:50 UTC (rev 225791)
@@ -6,7 +6,7 @@
PASS frame.contentWindow.innerWidth is non-zero.
PASS frame.contentWindow.innerHeight is non-zero.
PASS frame.contentWindow.innerWidth is originalWidth
-PASS frame.contentWindow.innerHeight is originalHeight
+PASS frame.contentWindow.innerHeight is originalHeight - scrollbarWidth
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/dom/iframe-inner-size-scaling.html (225790 => 225791)
--- trunk/LayoutTests/fast/dom/iframe-inner-size-scaling.html 2017-12-12 19:01:18 UTC (rev 225790)
+++ trunk/LayoutTests/fast/dom/iframe-inner-size-scaling.html 2017-12-12 19:15:50 UTC (rev 225791)
@@ -1,5 +1,6 @@
<html>
<script src=""
+ <script src=""
<script>
description("This tests that innerWidth/innerHeight on an frame window returns the size of the frame itself in CSS pixels, regardless of page scale.");
window.jsTestIsAsync = true;
@@ -15,7 +16,9 @@
shouldBeNonZero("frame.contentWindow.innerWidth");
shouldBeNonZero("frame.contentWindow.innerHeight");
shouldBe("frame.contentWindow.innerWidth", "originalWidth");
- shouldBe("frame.contentWindow.innerHeight", "originalHeight");
+
+ scrollbarWidth = UIHelper.isIOS() ? 0 : 15;
+ shouldBe("frame.contentWindow.innerHeight", "originalHeight - scrollbarWidth");
finishJSTest();
}
Added: trunk/LayoutTests/fast/dom/iframe-innerWidth-expected.txt (0 => 225791)
--- trunk/LayoutTests/fast/dom/iframe-innerWidth-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/iframe-innerWidth-expected.txt 2017-12-12 19:15:50 UTC (rev 225791)
@@ -0,0 +1,11 @@
+This tests that innerWidth/innerHeight on an frame window are valid in the load event handler.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS frame.contentWindow.innerWidth is 300
+PASS frame.contentWindow.innerHeight is 150
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/iframe-innerWidth.html (0 => 225791)
--- trunk/LayoutTests/fast/dom/iframe-innerWidth.html (rev 0)
+++ trunk/LayoutTests/fast/dom/iframe-innerWidth.html 2017-12-12 19:15:50 UTC (rev 225791)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+ <script src=""
+ <script>
+ var jsTestIsAsync = true;
+ description("This tests that innerWidth/innerHeight on an frame window are valid in the load event handler.");
+ function runTest() {
+ frame = document.getElementById('iframe');
+ shouldBe("frame.contentWindow.innerWidth", "300");
+ shouldBe("frame.contentWindow.innerHeight", "150");
+ finishJSTest();
+ }
+
+ window.addEventListener('load', runTest, false);
+ </script>
+ <iframe id="iframe"></iframe>
+ <script src=""
+</html>
Modified: trunk/Source/WebCore/ChangeLog (225790 => 225791)
--- trunk/Source/WebCore/ChangeLog 2017-12-12 19:01:18 UTC (rev 225790)
+++ trunk/Source/WebCore/ChangeLog 2017-12-12 19:15:50 UTC (rev 225791)
@@ -1,3 +1,26 @@
+2017-12-12 Simon Fraser <simon.fra...@apple.com>
+
+ HTML-page with <object type="image/svg+xml" data="" often is blank
+ https://bugs.webkit.org/show_bug.cgi?id=180524
+ <rdar://problem/35920554>
+
+ Reviewed by Antti Koivisto.
+
+ The test case has script that conditionalizes behavior on whether window.innerWidth/Height
+ are zero during the load event. We didn't force layout in innerWidth/Height, so whether
+ they would zero depended on whether the parent frame had laid out, which was timing-sensitive.
+
+ Fix by triggering enough layout in the parent document so that the FrameView is resized before
+ fetching its dimensions in innerWidth/Height. This causes our behavior to match Chrome and Firefox.
+
+ Test: fast/dom/iframe-innerWidth.html
+
+ * dom/EventDispatcher.cpp:
+ (WebCore::EventDispatcher::dispatchEvent): Add some logging that helped me diagnose this.
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::innerHeight const):
+ (WebCore::DOMWindow::innerWidth const):
+
2017-12-11 Antoine Quint <grao...@apple.com>
[Web Animations] Enqueue and dispatch animation events
Modified: trunk/Source/WebCore/dom/EventDispatcher.cpp (225790 => 225791)
--- trunk/Source/WebCore/dom/EventDispatcher.cpp 2017-12-12 19:01:18 UTC (rev 225790)
+++ trunk/Source/WebCore/dom/EventDispatcher.cpp 2017-12-12 19:15:50 UTC (rev 225791)
@@ -34,6 +34,7 @@
#include "HTMLInputElement.h"
#include "InputEvent.h"
#include "KeyboardEvent.h"
+#include "Logging.h"
#include "MainFrame.h"
#include "MouseEvent.h"
#include "NoEventDispatchAssertion.h"
@@ -130,6 +131,8 @@
void EventDispatcher::dispatchEvent(Node& node, Event& event)
{
ASSERT_WITH_SECURITY_IMPLICATION(NoEventDispatchAssertion::InMainThread::isEventDispatchAllowedInSubtree(node));
+
+ LOG(Events, "EventDispatcher::dispatchEvent %s on node %s", event.type().string().utf8().data(), node.nodeName().utf8().data());
auto protectedNode = makeRef(node);
auto protectedView = makeRefPtr(node.document().view());
Modified: trunk/Source/WebCore/page/DOMWindow.cpp (225790 => 225791)
--- trunk/Source/WebCore/page/DOMWindow.cpp 2017-12-12 19:01:18 UTC (rev 225790)
+++ trunk/Source/WebCore/page/DOMWindow.cpp 2017-12-12 19:15:50 UTC (rev 225791)
@@ -62,7 +62,6 @@
#include "FrameLoaderClient.h"
#include "FrameTree.h"
#include "FrameView.h"
-#include "HTMLFrameOwnerElement.h"
#include "History.h"
#include "InspectorInstrumentation.h"
#include "JSDOMWindowBase.h"
@@ -1260,6 +1259,10 @@
if (!m_frame)
return 0;
+ // Force enough layout in the parent document to ensure that the FrameView has been resized.
+ if (auto* frameElement = this->frameElement())
+ frameElement->document().updateLayoutIfDimensionsOutOfDate(*frameElement, HeightDimensionsCheck);
+
FrameView* view = m_frame->view();
if (!view)
return 0;
@@ -1272,6 +1275,10 @@
if (!m_frame)
return 0;
+ // Force enough layout in the parent document to ensure that the FrameView has been resized.
+ if (auto* frameElement = this->frameElement())
+ frameElement->document().updateLayoutIfDimensionsOutOfDate(*frameElement, WidthDimensionsCheck);
+
FrameView* view = m_frame->view();
if (!view)
return 0;