Changeset 223742 in webkit


Ignore:
Timestamp:
Oct 19, 2017 9:52:06 PM (7 years ago)
Author:
Alan Bujtas
Message:

[FrameView::layout cleanup] Move style update related logic to a separate function
https://bugs.webkit.org/show_bug.cgi?id=178558
<rdar://problem/35088218>

Reviewed by Simon Fraser.

No change in functionality.

  • page/FrameView.cpp:

(WebCore::FrameView::ensureStyleIsUpToDateForLayout):
(WebCore::FrameView::layout):

  • page/FrameView.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r223738 r223742  
     12017-10-19  Zalan Bujtas  <zalan@apple.com>
     2
     3        [FrameView::layout cleanup] Move style update related logic to a separate function
     4        https://bugs.webkit.org/show_bug.cgi?id=178558
     5        <rdar://problem/35088218>
     6
     7        Reviewed by Simon Fraser.
     8
     9        No change in functionality.
     10
     11        * page/FrameView.cpp:
     12        (WebCore::FrameView::ensureStyleIsUpToDateForLayout):
     13        (WebCore::FrameView::layout):
     14        * page/FrameView.h:
     15
    1162017-10-19  JF Bastien  <jfbastien@apple.com>
    217
  • trunk/Source/WebCore/page/FrameView.cpp

    r223720 r223742  
    13641364}
    13651365
     1366void FrameView::updateStyleForLayout()
     1367{
     1368    Document& document = *frame().document();
     1369    // Viewport-dependent media queries may cause us to need completely different style information.
     1370    auto* styleResolver = document.styleScope().resolverIfExists();
     1371    if (!styleResolver || styleResolver->hasMediaQueriesAffectedByViewportChange()) {
     1372        LOG(Layout, "  hasMediaQueriesAffectedByViewportChange, enqueueing style recalc");
     1373        document.styleScope().didChangeStyleSheetEnvironment();
     1374        // FIXME: This instrumentation event is not strictly accurate since cached media query results do not persist across StyleResolver rebuilds.
     1375        InspectorInstrumentation::mediaQueryResultChanged(document);
     1376    }
     1377    document.evaluateMediaQueryList();
     1378    // If there is any pagination to apply, it will affect the RenderView's style, so we should
     1379    // take care of that now.
     1380    applyPaginationToViewport();
     1381    // Always ensure our style info is up-to-date. This can happen in situations where
     1382    // the layout beats any sort of style recalc update that needs to occur.
     1383    document.updateStyleIfNeeded();
     1384}
     1385
    13661386void FrameView::layout(bool allowSubtreeLayout)
    13671387{
     
    14211441            performPostLayoutTasks();
    14221442
    1423         // Viewport-dependent media queries may cause us to need completely different style information.
    1424         auto* styleResolver = document.styleScope().resolverIfExists();
    1425         if (!styleResolver || styleResolver->hasMediaQueriesAffectedByViewportChange()) {
    1426             LOG(Layout, "  hasMediaQueriesAffectedByViewportChange, enqueueing style recalc");
    1427             document.styleScope().didChangeStyleSheetEnvironment();
    1428             // FIXME: This instrumentation event is not strictly accurate since cached media query results do not persist across StyleResolver rebuilds.
    1429             InspectorInstrumentation::mediaQueryResultChanged(document);
    1430         }
    1431         document.evaluateMediaQueryList();
    1432         // If there is any pagination to apply, it will affect the RenderView's style, so we should
    1433         // take care of that now.
    1434         applyPaginationToViewport();
    1435         // Always ensure our style info is up-to-date. This can happen in situations where
    1436         // the layout beats any sort of style recalc update that needs to occur.
    1437         document.updateStyleIfNeeded();
    1438         // If there is only one ref to this view left, then its going to be destroyed as soon as we exit,
    1439         // so there's no point to continuing to layout
     1443        updateStyleForLayout();
    14401444        if (hasOneRef())
    14411445            return;
  • trunk/Source/WebCore/page/FrameView.h

    r223717 r223742  
    738738
    739739    void adjustScrollbarsForLayout(bool firstLayout);
     740    void updateStyleForLayout();
    740741
    741742    void handleDeferredScrollbarsUpdateAfterDirectionChange();
Note: See TracChangeset for help on using the changeset viewer.