Changeset 225791 in webkit


Ignore:
Timestamp:
Dec 12, 2017 11:15:50 AM (6 years ago)
Author:
Simon Fraser
Message:

HTML-page with <object type="image/svg+xml" data="foo.svg"> 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.
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r225790 r225791  
     12017-12-12  Simon Fraser  <simon.fraser@apple.com>
     2
     3        HTML-page with <object type="image/svg+xml" data="foo.svg"> often is blank
     4        https://bugs.webkit.org/show_bug.cgi?id=180524
     5        <rdar://problem/35920554>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        Adjust a test where the new layout is triggering scrollbar creation.
     10
     11        * fast/dom/iframe-inner-size-scaling-expected.txt:
     12        * fast/dom/iframe-inner-size-scaling.html:
     13        * fast/dom/iframe-innerWidth-expected.txt: Added.
     14        * fast/dom/iframe-innerWidth.html: Added.
     15
    1162017-12-11  Antoine Quint  <graouts@apple.com>
    217
  • trunk/LayoutTests/fast/dom/iframe-inner-size-scaling-expected.txt

    r105512 r225791  
    77PASS frame.contentWindow.innerHeight is non-zero.
    88PASS frame.contentWindow.innerWidth is originalWidth
    9 PASS frame.contentWindow.innerHeight is originalHeight
     9PASS frame.contentWindow.innerHeight is originalHeight - scrollbarWidth
    1010PASS successfullyParsed is true
    1111
  • trunk/LayoutTests/fast/dom/iframe-inner-size-scaling.html

    r155265 r225791  
    11<html>
    22    <script src="../../resources/js-test-pre.js"></script>
     3    <script src="../../resources/ui-helper.js"></script>
    34    <script>
    45        description("This tests that innerWidth/innerHeight on an frame window returns the size of the frame itself in CSS pixels, regardless of page scale.");
     
    1617            shouldBeNonZero("frame.contentWindow.innerHeight");
    1718            shouldBe("frame.contentWindow.innerWidth", "originalWidth");
    18             shouldBe("frame.contentWindow.innerHeight", "originalHeight");
     19           
     20            scrollbarWidth = UIHelper.isIOS() ? 0 : 15;
     21            shouldBe("frame.contentWindow.innerHeight", "originalHeight - scrollbarWidth");
    1922            finishJSTest();
    2023        }
  • trunk/Source/WebCore/ChangeLog

    r225790 r225791  
     12017-12-12  Simon Fraser  <simon.fraser@apple.com>
     2
     3        HTML-page with <object type="image/svg+xml" data="foo.svg"> often is blank
     4        https://bugs.webkit.org/show_bug.cgi?id=180524
     5        <rdar://problem/35920554>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        The test case has script that conditionalizes behavior on whether window.innerWidth/Height
     10        are zero during the load event. We didn't force layout in innerWidth/Height, so whether
     11        they would zero depended on whether the parent frame had laid out, which was timing-sensitive.
     12
     13        Fix by triggering enough layout in the parent document so that the FrameView is resized before
     14        fetching its dimensions in innerWidth/Height. This causes our behavior to match Chrome and Firefox.
     15
     16        Test: fast/dom/iframe-innerWidth.html
     17
     18        * dom/EventDispatcher.cpp:
     19        (WebCore::EventDispatcher::dispatchEvent): Add some logging that helped me diagnose this.
     20        * page/DOMWindow.cpp:
     21        (WebCore::DOMWindow::innerHeight const):
     22        (WebCore::DOMWindow::innerWidth const):
     23
    1242017-12-11  Antoine Quint  <graouts@apple.com>
    225
  • trunk/Source/WebCore/dom/EventDispatcher.cpp

    r224459 r225791  
    3535#include "InputEvent.h"
    3636#include "KeyboardEvent.h"
     37#include "Logging.h"
    3738#include "MainFrame.h"
    3839#include "MouseEvent.h"
     
    131132{
    132133    ASSERT_WITH_SECURITY_IMPLICATION(NoEventDispatchAssertion::InMainThread::isEventDispatchAllowedInSubtree(node));
     134   
     135    LOG(Events, "EventDispatcher::dispatchEvent %s on node %s", event.type().string().utf8().data(), node.nodeName().utf8().data());
    133136
    134137    auto protectedNode = makeRef(node);
  • trunk/Source/WebCore/page/DOMWindow.cpp

    r225656 r225791  
    6363#include "FrameTree.h"
    6464#include "FrameView.h"
    65 #include "HTMLFrameOwnerElement.h"
    6665#include "History.h"
    6766#include "InspectorInstrumentation.h"
     
    12611260        return 0;
    12621261
     1262    // Force enough layout in the parent document to ensure that the FrameView has been resized.
     1263    if (auto* frameElement = this->frameElement())
     1264        frameElement->document().updateLayoutIfDimensionsOutOfDate(*frameElement, HeightDimensionsCheck);
     1265
    12631266    FrameView* view = m_frame->view();
    12641267    if (!view)
     
    12721275    if (!m_frame)
    12731276        return 0;
     1277
     1278    // Force enough layout in the parent document to ensure that the FrameView has been resized.
     1279    if (auto* frameElement = this->frameElement())
     1280        frameElement->document().updateLayoutIfDimensionsOutOfDate(*frameElement, WidthDimensionsCheck);
    12741281
    12751282    FrameView* view = m_frame->view();
Note: See TracChangeset for help on using the changeset viewer.