⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 245924 in webkit


Ignore:
Timestamp:
May 30, 2019, 5:30:10 PM (7 years ago)
Author:
Alan Coon
Message:

Cherry-pick r245509. rdar://problem/51264845

Wait to get frame until after layout has been run
https://bugs.webkit.org/show_bug.cgi?id=197999
<rdar://problem/50800345>

Reviewed by Alex Christensen.

Source/WebCore:

The current frame can change when layout runs, so don't bother retrieving
the frame until the final layout pass is complete.

Test: fast/dom/window-inner-width-crash.html

  • page/DOMWindow.cpp: (WebCore::DOMWindow::innerHeight const): Move frame access past the layout operation. (WebCore::DOMWindow::innerWidth const): Ditto. (WebCore::DOMWindow::scrollX const): Ditto. (WebCore::DOMWindow::scrollY const): Ditto.

LayoutTests:

  • fast/dom/window-inner-width-crash-expected.txt: Added.
  • fast/dom/window-inner-width-crash.html: Added.

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

Location:
branches/safari-607-branch
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-607-branch/LayoutTests/ChangeLog

    r245922 r245924  
     12019-05-30  Kocsen Chung  <kocsen_chung@apple.com>
     2
     3        Cherry-pick r245509. rdar://problem/51264845
     4
     5    Wait to get frame until after layout has been run
     6    https://bugs.webkit.org/show_bug.cgi?id=197999
     7    <rdar://problem/50800345>
     8   
     9    Reviewed by Alex Christensen.
     10   
     11    Source/WebCore:
     12   
     13    The current frame can change when layout runs, so don't bother retrieving
     14    the frame until the final layout pass is complete.
     15   
     16    Test: fast/dom/window-inner-width-crash.html
     17   
     18    * page/DOMWindow.cpp:
     19    (WebCore::DOMWindow::innerHeight const): Move frame access past the
     20    layout operation.
     21    (WebCore::DOMWindow::innerWidth const): Ditto.
     22    (WebCore::DOMWindow::scrollX const): Ditto.
     23    (WebCore::DOMWindow::scrollY const): Ditto.
     24   
     25    LayoutTests:
     26   
     27    * fast/dom/window-inner-width-crash-expected.txt: Added.
     28    * fast/dom/window-inner-width-crash.html: Added.
     29   
     30    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245509 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     31
     32    2019-05-19  Brent Fulgham  <bfulgham@apple.com>
     33
     34            Wait to get frame until after layout has been run
     35            https://bugs.webkit.org/show_bug.cgi?id=197999
     36            <rdar://problem/50800345>
     37
     38            Reviewed by Alex Christensen.
     39
     40            * fast/dom/window-inner-width-crash-expected.txt: Added.
     41            * fast/dom/window-inner-width-crash.html: Added.
     42
    1432019-05-30  Kocsen Chung  <kocsen_chung@apple.com>
    244
  • branches/safari-607-branch/Source/WebCore/ChangeLog

    r245923 r245924  
     12019-05-30  Kocsen Chung  <kocsen_chung@apple.com>
     2
     3        Cherry-pick r245509. rdar://problem/51264845
     4
     5    Wait to get frame until after layout has been run
     6    https://bugs.webkit.org/show_bug.cgi?id=197999
     7    <rdar://problem/50800345>
     8   
     9    Reviewed by Alex Christensen.
     10   
     11    Source/WebCore:
     12   
     13    The current frame can change when layout runs, so don't bother retrieving
     14    the frame until the final layout pass is complete.
     15   
     16    Test: fast/dom/window-inner-width-crash.html
     17   
     18    * page/DOMWindow.cpp:
     19    (WebCore::DOMWindow::innerHeight const): Move frame access past the
     20    layout operation.
     21    (WebCore::DOMWindow::innerWidth const): Ditto.
     22    (WebCore::DOMWindow::scrollX const): Ditto.
     23    (WebCore::DOMWindow::scrollY const): Ditto.
     24   
     25    LayoutTests:
     26   
     27    * fast/dom/window-inner-width-crash-expected.txt: Added.
     28    * fast/dom/window-inner-width-crash.html: Added.
     29   
     30    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245509 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     31
     32    2019-05-19  Brent Fulgham  <bfulgham@apple.com>
     33
     34            Wait to get frame until after layout has been run
     35            https://bugs.webkit.org/show_bug.cgi?id=197999
     36            <rdar://problem/50800345>
     37
     38            Reviewed by Alex Christensen.
     39
     40            The current frame can change when layout runs, so don't bother retrieving
     41            the frame until the final layout pass is complete.
     42
     43            Test: fast/dom/window-inner-width-crash.html
     44
     45            * page/DOMWindow.cpp:
     46            (WebCore::DOMWindow::innerHeight const): Move frame access past the
     47            layout operation.
     48            (WebCore::DOMWindow::innerWidth const): Ditto.
     49            (WebCore::DOMWindow::scrollX const): Ditto.
     50            (WebCore::DOMWindow::scrollY const): Ditto.
     51
    1522019-05-30  Kocsen Chung  <kocsen_chung@apple.com>
    253
  • branches/safari-607-branch/Source/WebCore/page/DOMWindow.cpp

    r245346 r245924  
    12371237int DOMWindow::innerHeight() const
    12381238{
    1239     auto* frame = this->frame();
    1240     if (!frame)
    1241         return 0;
    1242 
     1239    if (!frame())
     1240        return 0;
     1241   
    12431242    // Force enough layout in the parent document to ensure that the FrameView has been resized.
    12441243    if (auto* frameElement = this->frameElement())
    12451244        frameElement->document().updateLayoutIfDimensionsOutOfDate(*frameElement, HeightDimensionsCheck);
    12461245
     1246    auto* frame = this->frame();
     1247    if (!frame)
     1248        return 0;
     1249   
    12471250    FrameView* view = frame->view();
    12481251    if (!view)
     
    12541257int DOMWindow::innerWidth() const
    12551258{
    1256     auto* frame = this->frame();
    1257     if (!frame)
     1259    if (!frame())
    12581260        return 0;
    12591261
     
    12621264        frameElement->document().updateLayoutIfDimensionsOutOfDate(*frameElement, WidthDimensionsCheck);
    12631265
     1266    auto* frame = this->frame();
     1267    if (!frame)
     1268        return 0;
     1269
    12641270    FrameView* view = frame->view();
    12651271    if (!view)
     
    13111317    frame->document()->updateLayoutIgnorePendingStylesheets();
    13121318
    1313     return view->mapFromLayoutToCSSUnits(view->contentsScrollPosition().x());
     1319    // Layout may have affected the current frame:
     1320    auto* frameAfterLayout = this->frame();
     1321    if (!frameAfterLayout)
     1322        return 0;
     1323   
     1324    FrameView* viewAfterLayout = frameAfterLayout->view();
     1325    if (!viewAfterLayout)
     1326        return 0;
     1327
     1328    return viewAfterLayout->mapFromLayoutToCSSUnits(viewAfterLayout->contentsScrollPosition().x());
    13141329}
    13151330
     
    13301345    frame->document()->updateLayoutIgnorePendingStylesheets();
    13311346
    1332     return view->mapFromLayoutToCSSUnits(view->contentsScrollPosition().y());
     1347    // Layout may have affected the current frame:
     1348    auto* frameAfterLayout = this->frame();
     1349    if (!frameAfterLayout)
     1350        return 0;
     1351   
     1352    FrameView* viewAfterLayout = frameAfterLayout->view();
     1353    if (!viewAfterLayout)
     1354        return 0;
     1355   
     1356    return viewAfterLayout->mapFromLayoutToCSSUnits(viewAfterLayout->contentsScrollPosition().y());
    13331357}
    13341358
Note: See TracChangeset for help on using the changeset viewer.