Skip to content
Permalink
Browse files
[FrameView::layout cleanup] Move scrollbars setup logic to a separate…
… function

https://bugs.webkit.org/show_bug.cgi?id=178394
<rdar://problem/35031066>

Reviewed by Antti Koivisto.

Decouple scrollbars setup and the unrelated first-layout logic.
FIXME: find out why m_firstLayout depends on the subtree flag (I'd assume we issue full layout the very first time).

Covered by existing test cases.

* page/FrameView.cpp:
(WebCore::FrameView::adjustScrollbarsForLayout):
(WebCore::FrameView::layout):
* page/FrameView.h:


Canonical link: https://commits.webkit.org/194728@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223712 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
alanbujtas committed Oct 19, 2017
1 parent 757faa2 commit 09f01146f0e7a49a6947d531690303a59b6d0861
Showing with 48 additions and 26 deletions.
  1. +18 −0 Source/WebCore/ChangeLog
  2. +28 −26 Source/WebCore/page/FrameView.cpp
  3. +2 −0 Source/WebCore/page/FrameView.h
@@ -1,3 +1,21 @@
2017-10-19 Zalan Bujtas <zalan@apple.com>

[FrameView::layout cleanup] Move scrollbars setup logic to a separate function
https://bugs.webkit.org/show_bug.cgi?id=178394
<rdar://problem/35031066>

Reviewed by Antti Koivisto.

Decouple scrollbars setup and the unrelated first-layout logic.
FIXME: find out why m_firstLayout depends on the subtree flag (I'd assume we issue full layout the very first time).

Covered by existing test cases.

* page/FrameView.cpp:
(WebCore::FrameView::adjustScrollbarsForLayout):
(WebCore::FrameView::layout):
* page/FrameView.h:

2017-10-19 Tim Horton <timothy_horton@apple.com>

Expand r209943 to suppress paste during provisional navigation as well
@@ -1340,6 +1340,28 @@ void FrameView::markRootOrBodyRendererDirty() const
rootRenderer->setChildNeedsLayout();
}

void FrameView::adjustScrollbarsForLayout(bool isFirstLayout)
{
ScrollbarMode hMode;
ScrollbarMode vMode;
calculateScrollbarModesForLayout(hMode, vMode);
if (isFirstLayout && !isLayoutNested()) {
setScrollbarsSuppressed(true);
// Set the initial vMode to AlwaysOn if we're auto.
if (vMode == ScrollbarAuto)
setVerticalScrollbarMode(ScrollbarAlwaysOn); // This causes a vertical scrollbar to appear.
// Set the initial hMode to AlwaysOff if we're auto.
if (hMode == ScrollbarAuto)
setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This causes a horizontal scrollbar to disappear.
ASSERT(frame().page());
if (frame().page()->expectsWheelEventTriggers())
scrollAnimator().setWheelEventTestTrigger(frame().page()->testTrigger());
setScrollbarModes(hMode, vMode);
setScrollbarsSuppressed(false, true);
} else if (hMode != horizontalScrollbarMode() || vMode != verticalScrollbarMode())
setScrollbarModes(hMode, vMode);
}

void FrameView::layout(bool allowSubtreeLayout)
{
ASSERT_WITH_SECURITY_IMPLICATION(!frame().document()->inRenderTreeUpdate());
@@ -1436,33 +1458,12 @@ void FrameView::layout(bool allowSubtreeLayout)
if (m_firstLayout && !frame().ownerElement())
LOG(Layout, "FrameView %p elapsed time before first layout: %.3fs\n", this, document.timeSinceDocumentCreation().value());
#endif
ScrollbarMode hMode;
ScrollbarMode vMode;
calculateScrollbarModesForLayout(hMode, vMode);

if (m_firstLayout || (hMode != horizontalScrollbarMode() || vMode != verticalScrollbarMode())) {
if (m_firstLayout) {
setScrollbarsSuppressed(true);

m_firstLayout = false;
m_firstLayoutCallbackPending = true;
m_lastViewportSize = sizeForResizeEvent();
m_lastZoomFactor = layoutRoot->style().zoom();

// Set the initial vMode to AlwaysOn if we're auto.
if (vMode == ScrollbarAuto)
setVerticalScrollbarMode(ScrollbarAlwaysOn); // This causes a vertical scrollbar to appear.
// Set the initial hMode to AlwaysOff if we're auto.
if (hMode == ScrollbarAuto)
setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This causes a horizontal scrollbar to disappear.
Page* page = frame().page();
if (page && page->expectsWheelEventTriggers())
scrollAnimator().setWheelEventTestTrigger(page->testTrigger());
setScrollbarModes(hMode, vMode);
setScrollbarsSuppressed(false, true);
} else
setScrollbarModes(hMode, vMode);
if (m_firstLayout) {
m_lastViewportSize = sizeForResizeEvent();
m_lastZoomFactor = layoutRoot->style().zoom();
m_firstLayoutCallbackPending = true;
}
adjustScrollbarsForLayout(m_firstLayout);

auto oldSize = m_size;
m_size = layoutSize();
@@ -1473,6 +1474,7 @@ void FrameView::layout(bool allowSubtreeLayout)
markRootOrBodyRendererDirty();
}
m_layoutPhase = InPreLayout;
m_firstLayout = false;
}

ASSERT(allowSubtreeLayout || !isSubtreeLayout);
@@ -735,6 +735,8 @@ class FrameView final : public ScrollView {
IntSize sizeForResizeEvent() const;
void sendResizeEventIfNeeded();

void adjustScrollbarsForLayout(bool firstLayout);

void handleDeferredScrollbarsUpdateAfterDirectionChange();

void updateScrollableAreaSet();

0 comments on commit 09f0114

Please sign in to comment.