Skip to content
Permalink
Browse files
[FrameView::layout cleanup] Move style update related logic to a sepa…
…rate 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:


Canonical link: https://commits.webkit.org/194754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223742 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
alanbujtas committed Oct 20, 2017
1 parent e071aa6 commit 87c9ee2e116da2d9eadc7451850259c2eeef9e1e
Showing with 37 additions and 17 deletions.
  1. +15 −0 Source/WebCore/ChangeLog
  2. +21 −17 Source/WebCore/page/FrameView.cpp
  3. +1 −0 Source/WebCore/page/FrameView.h
@@ -1,3 +1,18 @@
2017-10-19 Zalan Bujtas <zalan@apple.com>

[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:

2017-10-19 JF Bastien <jfbastien@apple.com>

WebAssembly: no VM / JS version of everything but Instance
@@ -1363,6 +1363,26 @@ void FrameView::adjustScrollbarsForLayout(bool isFirstLayout)
setScrollbarModes(hMode, vMode);
}

void FrameView::updateStyleForLayout()
{
Document& document = *frame().document();
// Viewport-dependent media queries may cause us to need completely different style information.
auto* styleResolver = document.styleScope().resolverIfExists();
if (!styleResolver || styleResolver->hasMediaQueriesAffectedByViewportChange()) {
LOG(Layout, " hasMediaQueriesAffectedByViewportChange, enqueueing style recalc");
document.styleScope().didChangeStyleSheetEnvironment();
// FIXME: This instrumentation event is not strictly accurate since cached media query results do not persist across StyleResolver rebuilds.
InspectorInstrumentation::mediaQueryResultChanged(document);
}
document.evaluateMediaQueryList();
// If there is any pagination to apply, it will affect the RenderView's style, so we should
// take care of that now.
applyPaginationToViewport();
// Always ensure our style info is up-to-date. This can happen in situations where
// the layout beats any sort of style recalc update that needs to occur.
document.updateStyleIfNeeded();
}

void FrameView::layout(bool allowSubtreeLayout)
{
ASSERT_WITH_SECURITY_IMPLICATION(!frame().document()->inRenderTreeUpdate());
@@ -1420,23 +1440,7 @@ void FrameView::layout(bool allowSubtreeLayout)
if (!isLayoutNested() && m_postLayoutTasksTimer.isActive() && !isInChildFrameWithFrameFlattening())
performPostLayoutTasks();

// Viewport-dependent media queries may cause us to need completely different style information.
auto* styleResolver = document.styleScope().resolverIfExists();
if (!styleResolver || styleResolver->hasMediaQueriesAffectedByViewportChange()) {
LOG(Layout, " hasMediaQueriesAffectedByViewportChange, enqueueing style recalc");
document.styleScope().didChangeStyleSheetEnvironment();
// FIXME: This instrumentation event is not strictly accurate since cached media query results do not persist across StyleResolver rebuilds.
InspectorInstrumentation::mediaQueryResultChanged(document);
}
document.evaluateMediaQueryList();
// If there is any pagination to apply, it will affect the RenderView's style, so we should
// take care of that now.
applyPaginationToViewport();
// Always ensure our style info is up-to-date. This can happen in situations where
// the layout beats any sort of style recalc update that needs to occur.
document.updateStyleIfNeeded();
// If there is only one ref to this view left, then its going to be destroyed as soon as we exit,
// so there's no point to continuing to layout
updateStyleForLayout();
if (hasOneRef())
return;

@@ -737,6 +737,7 @@ class FrameView final : public ScrollView {
void sendResizeEventIfNeeded();

void adjustScrollbarsForLayout(bool firstLayout);
void updateStyleForLayout();

void handleDeferredScrollbarsUpdateAfterDirectionChange();

0 comments on commit 87c9ee2

Please sign in to comment.