Skip to content
Permalink
Browse files
Add optional debug logging when we fall into/out of threaded scrolling
https://bugs.webkit.org/show_bug.cgi?id=93898
<rdar://problem/12089098>

Reviewed by Simon Fraser.

Add logging when we enter and exit the threaded scrolling mode, and logs the reasons we
fall into main-thread scrolling.

The logging output looks like this:
    SCROLLING: Switching to main-thread scrolling mode. Time: 15843.554718 Reason(s): viewport-constrained objects
    SCROLLING: Switching to threaded scrolling mode. Time: 15844.550866
    SCROLLING: Switching to main-thread scrolling mode. Time: 15845.551214 Reason(s): viewport-constrained objects
    SCROLLING: Switching to threaded scrolling mode. Time: 15846.552619
    SCROLLING: Switching to main-thread scrolling mode. Time: 15847.553587 Reason(s): viewport-constrained objects
    SCROLLING: Switching to threaded scrolling mode. Time: 15848.554084

No new tests, as this is just debugging logging.

* WebCore.xcodeproj/project.pbxproj:
Expose ScrollingTreeState.h as a private header.

* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange):
(WebCore::ScrollingCoordinator::frameViewFixedObjectsDidChange):
(WebCore::ScrollingCoordinator::frameViewRootLayerDidChange):
(WebCore::ScrollingCoordinator::setForceMainThreadScrollLayerPositionUpdates):
(WebCore::ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThreadReason):
* page/scrolling/ScrollingCoordinator.h:
(ScrollingCoordinator):
* page/scrolling/ScrollingCoordinatorNone.cpp:
(WebCore::ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThreadReason):
* page/scrolling/ScrollingTreeNode.cpp:
(WebCore::ScrollingTreeNode::ScrollingTreeNode):
(WebCore::ScrollingTreeNode::update):
* page/scrolling/ScrollingTreeNode.h:
(WebCore::ScrollingTreeNode::shouldUpdateScrollLayerPositionOnMainThreadReason):
(ScrollingTreeNode):
* page/scrolling/ScrollingTreeState.cpp:
(WebCore::ScrollingTreeState::ScrollingTreeState):
(WebCore::ScrollingTreeState::setShouldUpdateScrollLayerPositionOnMainThreadReason):
* page/scrolling/ScrollingTreeState.h:
(WebCore::ScrollingTreeState::shouldUpdateScrollLayerPositionOnMainThreadReason):
* page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:
(WebCore::ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThreadReason):
Rename updateShouldUpdateScrollLayerPositionOnMainThread to updateShouldUpdateScrollLayerPositionOnMainThreadReason (and related).

* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::hasNonLayerViewportConstrainedObjects):
Renamed from hasNonLayerFixedObjects to match the rest of the renames going on.
(WebCore::ScrollingCoordinator::updateShouldUpdateScrollLayerPositionOnMainThreadReason):
Construct a bitfield describing the reasons we fall into main-thread scrolling mode.

* page/scrolling/ScrollingTreeState.h:
(ScrollingTreeState):
Add ReasonsForUpdatingScrollLayerPositionOnMainThread enum, with the current reasons that we might fallback to main-thread scrolling.

* page/scrolling/mac/ScrollingTreeNodeMac.mm:
(WebCore):
(WebCore::ScrollingTreeNodeMac::update): Log every time scrolling mode changes.
(WebCore::ScrollingTreeNodeMac::scrollPosition):
(WebCore::ScrollingTreeNodeMac::setScrollPositionWithoutContentEdgeConstraints):
(WebCore::ScrollingTreeNodeMac::setScrollLayerPosition):
(WebCore::logThreadedScrollingMode): Pretty-print the scrolling mode and shouldUpdateScrollLayerPositionOnMainThreadReason.

Update the scrolling tree's scrollingPerformanceLoggingEnabled preference
before the early-return if we don't have layer debugging borders on.

* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::updatePreferences):


Canonical link: https://commits.webkit.org/113938@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@127837 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
hortont424 committed Sep 7, 2012
1 parent af3aa84 commit 7a12b3fb4c4357c7c02831e02a641ae45eddba3b
Showing 16 changed files with 201 additions and 54 deletions.
@@ -1,3 +1,70 @@
2012-09-07 Tim Horton <timothy_horton@apple.com>

Add optional debug logging when we fall into/out of threaded scrolling
https://bugs.webkit.org/show_bug.cgi?id=93898
<rdar://problem/12089098>

Reviewed by Simon Fraser.

Add logging when we enter and exit the threaded scrolling mode, and logs the reasons we
fall into main-thread scrolling.

The logging output looks like this:
SCROLLING: Switching to main-thread scrolling mode. Time: 15843.554718 Reason(s): viewport-constrained objects
SCROLLING: Switching to threaded scrolling mode. Time: 15844.550866
SCROLLING: Switching to main-thread scrolling mode. Time: 15845.551214 Reason(s): viewport-constrained objects
SCROLLING: Switching to threaded scrolling mode. Time: 15846.552619
SCROLLING: Switching to main-thread scrolling mode. Time: 15847.553587 Reason(s): viewport-constrained objects
SCROLLING: Switching to threaded scrolling mode. Time: 15848.554084

No new tests, as this is just debugging logging.

* WebCore.xcodeproj/project.pbxproj:
Expose ScrollingTreeState.h as a private header.

* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange):
(WebCore::ScrollingCoordinator::frameViewFixedObjectsDidChange):
(WebCore::ScrollingCoordinator::frameViewRootLayerDidChange):
(WebCore::ScrollingCoordinator::setForceMainThreadScrollLayerPositionUpdates):
(WebCore::ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThreadReason):
* page/scrolling/ScrollingCoordinator.h:
(ScrollingCoordinator):
* page/scrolling/ScrollingCoordinatorNone.cpp:
(WebCore::ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThreadReason):
* page/scrolling/ScrollingTreeNode.cpp:
(WebCore::ScrollingTreeNode::ScrollingTreeNode):
(WebCore::ScrollingTreeNode::update):
* page/scrolling/ScrollingTreeNode.h:
(WebCore::ScrollingTreeNode::shouldUpdateScrollLayerPositionOnMainThreadReason):
(ScrollingTreeNode):
* page/scrolling/ScrollingTreeState.cpp:
(WebCore::ScrollingTreeState::ScrollingTreeState):
(WebCore::ScrollingTreeState::setShouldUpdateScrollLayerPositionOnMainThreadReason):
* page/scrolling/ScrollingTreeState.h:
(WebCore::ScrollingTreeState::shouldUpdateScrollLayerPositionOnMainThreadReason):
* page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:
(WebCore::ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThreadReason):
Rename updateShouldUpdateScrollLayerPositionOnMainThread to updateShouldUpdateScrollLayerPositionOnMainThreadReason (and related).

* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::hasNonLayerViewportConstrainedObjects):
Renamed from hasNonLayerFixedObjects to match the rest of the renames going on.
(WebCore::ScrollingCoordinator::updateShouldUpdateScrollLayerPositionOnMainThreadReason):
Construct a bitfield describing the reasons we fall into main-thread scrolling mode.

* page/scrolling/ScrollingTreeState.h:
(ScrollingTreeState):
Add ReasonsForUpdatingScrollLayerPositionOnMainThread enum, with the current reasons that we might fallback to main-thread scrolling.

* page/scrolling/mac/ScrollingTreeNodeMac.mm:
(WebCore):
(WebCore::ScrollingTreeNodeMac::update): Log every time scrolling mode changes.
(WebCore::ScrollingTreeNodeMac::scrollPosition):
(WebCore::ScrollingTreeNodeMac::setScrollPositionWithoutContentEdgeConstraints):
(WebCore::ScrollingTreeNodeMac::setScrollLayerPosition):
(WebCore::logThreadedScrollingMode): Pretty-print the scrolling mode and shouldUpdateScrollLayerPositionOnMainThreadReason.

2012-09-06 Patrick Gansterer <paroga@webkit.org>

Build fix for WinCE after r127801.
@@ -511,7 +511,7 @@
1AAADDA314DB409F00AF64B3 /* ScrollingTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AAADDA114DB409F00AF64B3 /* ScrollingTree.cpp */; };
1AAADDA414DB409F00AF64B3 /* ScrollingTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAADDA214DB409F00AF64B3 /* ScrollingTree.h */; settings = {ATTRIBUTES = (Private, ); }; };
1AAADDBE14DC640700AF64B3 /* ScrollingTreeState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AAADDBC14DC640600AF64B3 /* ScrollingTreeState.cpp */; };
1AAADDBF14DC640700AF64B3 /* ScrollingTreeState.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAADDBD14DC640600AF64B3 /* ScrollingTreeState.h */; };
1AAADDBF14DC640700AF64B3 /* ScrollingTreeState.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAADDBD14DC640600AF64B3 /* ScrollingTreeState.h */; settings = {ATTRIBUTES = (Private, ); }; };
1AAADDDA14DC74EC00AF64B3 /* ScrollingTreeStateMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AAADDD814DC74EC00AF64B3 /* ScrollingTreeStateMac.mm */; };
1AAADDE314DC8C8F00AF64B3 /* ScrollingTreeNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AAADDE114DC8C8F00AF64B3 /* ScrollingTreeNode.cpp */; };
1AAADDE414DC8C8F00AF64B3 /* ScrollingTreeNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAADDE214DC8C8F00AF64B3 /* ScrollingTreeNode.h */; };
@@ -36,7 +36,6 @@
#include "Region.h"
#include "RenderView.h"
#include "ScrollAnimator.h"
#include "ScrollingTreeState.h"
#include <wtf/MainThread.h>

#if USE(ACCELERATED_COMPOSITING)
@@ -46,6 +45,7 @@
#if ENABLE(THREADED_SCROLLING)
#include "ScrollingThread.h"
#include "ScrollingTree.h"
#include "ScrollingTreeState.h"
#include <wtf/Functional.h>
#include <wtf/PassRefPtr.h>
#endif
@@ -192,7 +192,7 @@ void ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange(FrameView* fr
if (!coordinatesScrollingForFrameView(frameView))
return;

updateShouldUpdateScrollLayerPositionOnMainThread();
updateShouldUpdateScrollLayerPositionOnMainThreadReason();
}

void ScrollingCoordinator::frameViewFixedObjectsDidChange(FrameView* frameView)
@@ -203,7 +203,7 @@ void ScrollingCoordinator::frameViewFixedObjectsDidChange(FrameView* frameView)
if (!coordinatesScrollingForFrameView(frameView))
return;

updateShouldUpdateScrollLayerPositionOnMainThread();
updateShouldUpdateScrollLayerPositionOnMainThreadReason();
}

static GraphicsLayer* scrollLayerForFrameView(FrameView* frameView)
@@ -232,7 +232,7 @@ void ScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView)

frameViewLayoutUpdated(frameView);
recomputeWheelEventHandlerCount();
updateShouldUpdateScrollLayerPositionOnMainThread();
updateShouldUpdateScrollLayerPositionOnMainThreadReason();
setScrollLayer(scrollLayerForFrameView(frameView));
}

@@ -359,7 +359,7 @@ void ScrollingCoordinator::recomputeWheelEventHandlerCount()
setWheelEventHandlerCount(wheelEventHandlerCount);
}

bool ScrollingCoordinator::hasNonLayerFixedObjects(FrameView* frameView)
bool ScrollingCoordinator::hasNonLayerViewportConstrainedObjects(FrameView* frameView)
{
const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects = frameView->viewportConstrainedObjects();
if (!viewportConstrainedObjects)
@@ -380,15 +380,26 @@ bool ScrollingCoordinator::hasNonLayerFixedObjects(FrameView* frameView)
#endif
}

void ScrollingCoordinator::updateShouldUpdateScrollLayerPositionOnMainThread()
void ScrollingCoordinator::updateShouldUpdateScrollLayerPositionOnMainThreadReason()
{
#if ENABLE(THREADED_SCROLLING)
FrameView* frameView = m_page->mainFrame()->view();

setShouldUpdateScrollLayerPositionOnMainThread(m_forceMainThreadScrollLayerPositionUpdates
|| frameView->hasSlowRepaintObjects()
|| (!supportsFixedPositionLayers() && frameView->hasViewportConstrainedObjects())
|| (supportsFixedPositionLayers() && hasNonLayerFixedObjects(frameView))
|| m_page->mainFrame()->document()->isImageDocument());
ReasonForUpdatingScrollLayerPositionOnMainThreadFlags reasonsForUpdatingScrollLayerPositionOnMainThread = (ReasonForUpdatingScrollLayerPositionOnMainThreadFlags)0;

if (m_forceMainThreadScrollLayerPositionUpdates)
reasonsForUpdatingScrollLayerPositionOnMainThread |= ScrollingTreeState::ForcedOnMainThread;
if (frameView->hasSlowRepaintObjects())
reasonsForUpdatingScrollLayerPositionOnMainThread |= ScrollingTreeState::HasSlowRepaintObjects;
if (!supportsFixedPositionLayers() && frameView->hasViewportConstrainedObjects())
reasonsForUpdatingScrollLayerPositionOnMainThread |= ScrollingTreeState::HasNonCompositedViewportConstrainedObjects;
if (supportsFixedPositionLayers() && hasNonLayerViewportConstrainedObjects(frameView))
reasonsForUpdatingScrollLayerPositionOnMainThread |= ScrollingTreeState::HasNonLayerViewportConstrainedObjects;
if (m_page->mainFrame()->document()->isImageDocument())
reasonsForUpdatingScrollLayerPositionOnMainThread |= ScrollingTreeState::IsImageDocument;

setShouldUpdateScrollLayerPositionOnMainThreadReason(reasonsForUpdatingScrollLayerPositionOnMainThread);
#endif
}

void ScrollingCoordinator::setForceMainThreadScrollLayerPositionUpdates(bool forceMainThreadScrollLayerPositionUpdates)
@@ -397,7 +408,7 @@ void ScrollingCoordinator::setForceMainThreadScrollLayerPositionUpdates(bool for
return;

m_forceMainThreadScrollLayerPositionUpdates = forceMainThreadScrollLayerPositionUpdates;
updateShouldUpdateScrollLayerPositionOnMainThread();
updateShouldUpdateScrollLayerPositionOnMainThreadReason();
}

#if ENABLE(THREADED_SCROLLING)
@@ -435,16 +446,18 @@ void ScrollingCoordinator::setWheelEventHandlerCount(unsigned wheelEventHandlerC
scheduleTreeStateCommit();
}

void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(bool shouldUpdateScrollLayerPositionOnMainThread)
#if ENABLE(THREADED_SCROLLING)
void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThreadReason(ReasonForUpdatingScrollLayerPositionOnMainThreadFlags reasons)
{
// The FrameView's GraphicsLayer is likely to be out-of-synch with the PlatformLayer
// at this point. So we'll update it before we switch back to main thread scrolling
// in order to avoid layer positioning bugs.
if (shouldUpdateScrollLayerPositionOnMainThread)
if (reasons)
updateMainFrameScrollLayerPosition();
m_scrollingTreeState->setShouldUpdateScrollLayerPositionOnMainThread(shouldUpdateScrollLayerPositionOnMainThread);
m_scrollingTreeState->setShouldUpdateScrollLayerPositionOnMainThreadReason(reasons);
scheduleTreeStateCommit();
}
#endif

void ScrollingCoordinator::scheduleTreeStateCommit()
{
@@ -34,6 +34,7 @@
#include <wtf/Forward.h>

#if ENABLE(THREADED_SCROLLING)
#include "ScrollingTreeState.h"
#include <wtf/ThreadSafeRefCounted.h>
#include <wtf/Threading.h>
#endif
@@ -131,8 +132,8 @@ class ScrollingCoordinator : public ThreadSafeRefCounted<ScrollingCoordinator> {
explicit ScrollingCoordinator(Page*);

void recomputeWheelEventHandlerCount();
bool hasNonLayerFixedObjects(FrameView*);
void updateShouldUpdateScrollLayerPositionOnMainThread();
bool hasNonLayerViewportConstrainedObjects(FrameView*);
void updateShouldUpdateScrollLayerPositionOnMainThreadReason();

void setScrollLayer(GraphicsLayer*);
void setNonFastScrollableRegion(const Region&);
@@ -155,7 +156,9 @@ class ScrollingCoordinator : public ThreadSafeRefCounted<ScrollingCoordinator> {

void setScrollParameters(const ScrollParameters&);
void setWheelEventHandlerCount(unsigned);
void setShouldUpdateScrollLayerPositionOnMainThread(bool);
#if ENABLE(THREADED_SCROLLING)
void setShouldUpdateScrollLayerPositionOnMainThreadReason(ReasonForUpdatingScrollLayerPositionOnMainThreadFlags);
#endif

void updateMainFrameScrollLayerPosition();

@@ -67,9 +67,11 @@ void ScrollingCoordinator::setWheelEventHandlerCount(unsigned)
{
}

void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(bool)
#if ENABLE(THREADED_SCROLLING)
void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThreadReason(ReasonForUpdatingScrollLayerPositionOnMainThreadFlags)
{
}
#endif

bool ScrollingCoordinator::supportsFixedPositionLayers() const
{
@@ -224,7 +224,7 @@ void ScrollingTree::setScrollingPerformanceLoggingEnabled(bool flag)
m_scrollingPerformanceLoggingEnabled = flag;
}

bool ScrollingTree::scrollingPeformanceLoggingEnabled()
bool ScrollingTree::scrollingPerformanceLoggingEnabled()
{
return m_scrollingPerformanceLoggingEnabled;
}
@@ -98,7 +98,7 @@ class ScrollingTree : public ThreadSafeRefCounted<ScrollingTree> {
#endif

void setScrollingPerformanceLoggingEnabled(bool flag);
bool scrollingPeformanceLoggingEnabled();
bool scrollingPerformanceLoggingEnabled();

private:
explicit ScrollingTree(ScrollingCoordinator*);
@@ -34,7 +34,7 @@ namespace WebCore {

ScrollingTreeNode::ScrollingTreeNode(ScrollingTree* scrollingTree)
: m_scrollingTree(scrollingTree)
, m_shouldUpdateScrollLayerPositionOnMainThread(false)
, m_shouldUpdateScrollLayerPositionOnMainThreadReason(0)
, m_horizontalScrollElasticity(ScrollElasticityNone)
, m_verticalScrollElasticity(ScrollElasticityNone)
, m_hasEnabledHorizontalScrollbar(false)
@@ -56,8 +56,8 @@ void ScrollingTreeNode::update(ScrollingTreeState* state)
if (state->changedProperties() & ScrollingTreeState::ContentsSize)
m_contentsSize = state->contentsSize();

if (state->changedProperties() & ScrollingTreeState::ShouldUpdateScrollLayerPositionOnMainThread)
m_shouldUpdateScrollLayerPositionOnMainThread = state->shouldUpdateScrollLayerPositionOnMainThread();
if (state->changedProperties() & ScrollingTreeState::ShouldUpdateScrollLayerPositionOnMainThreadReason)
m_shouldUpdateScrollLayerPositionOnMainThreadReason = state->shouldUpdateScrollLayerPositionOnMainThreadReason();

if (state->changedProperties() & ScrollingTreeState::HorizontalScrollElasticity)
m_horizontalScrollElasticity = state->horizontalScrollElasticity();
@@ -30,6 +30,7 @@

#include "IntRect.h"
#include "ScrollTypes.h"
#include "ScrollingTreeState.h"
#include <wtf/PassOwnPtr.h>

namespace WebCore {
@@ -47,7 +48,7 @@ class ScrollingTreeNode {
virtual void handleWheelEvent(const PlatformWheelEvent&) = 0;
virtual void setScrollPosition(const IntPoint&) = 0;

bool shouldUpdateScrollLayerPositionOnMainThread() const { return m_shouldUpdateScrollLayerPositionOnMainThread; }
ReasonForUpdatingScrollLayerPositionOnMainThreadFlags shouldUpdateScrollLayerPositionOnMainThreadReason() const { return m_shouldUpdateScrollLayerPositionOnMainThreadReason; }

protected:
explicit ScrollingTreeNode(ScrollingTree*);
@@ -74,7 +75,7 @@ class ScrollingTreeNode {
IntSize m_contentsSize;
IntPoint m_scrollOrigin;

bool m_shouldUpdateScrollLayerPositionOnMainThread;
ReasonForUpdatingScrollLayerPositionOnMainThreadFlags m_shouldUpdateScrollLayerPositionOnMainThreadReason;

ScrollElasticity m_horizontalScrollElasticity;
ScrollElasticity m_verticalScrollElasticity;
@@ -38,7 +38,7 @@ PassOwnPtr<ScrollingTreeState> ScrollingTreeState::create()
ScrollingTreeState::ScrollingTreeState()
: m_changedProperties(0)
, m_wheelEventHandlerCount(0)
, m_shouldUpdateScrollLayerPositionOnMainThread(false)
, m_shouldUpdateScrollLayerPositionOnMainThreadReason(0)
, m_horizontalScrollElasticity(ScrollElasticityNone)
, m_verticalScrollElasticity(ScrollElasticityNone)
, m_hasEnabledHorizontalScrollbar(false)
@@ -88,13 +88,13 @@ void ScrollingTreeState::setWheelEventHandlerCount(unsigned wheelEventHandlerCou
m_changedProperties |= WheelEventHandlerCount;
}

void ScrollingTreeState::setShouldUpdateScrollLayerPositionOnMainThread(bool shouldUpdateScrollLayerPositionOnMainThread)
void ScrollingTreeState::setShouldUpdateScrollLayerPositionOnMainThreadReason(ReasonForUpdatingScrollLayerPositionOnMainThreadFlags reasons)
{
if (m_shouldUpdateScrollLayerPositionOnMainThread == shouldUpdateScrollLayerPositionOnMainThread)
if ((bool)m_shouldUpdateScrollLayerPositionOnMainThreadReason == (bool)reasons)
return;

m_shouldUpdateScrollLayerPositionOnMainThread = shouldUpdateScrollLayerPositionOnMainThread;
m_changedProperties |= ShouldUpdateScrollLayerPositionOnMainThread;
m_shouldUpdateScrollLayerPositionOnMainThreadReason = reasons;
m_changedProperties |= ShouldUpdateScrollLayerPositionOnMainThreadReason;
}

void ScrollingTreeState::setHorizontalScrollElasticity(ScrollElasticity horizontalScrollElasticity)
@@ -40,6 +40,8 @@

namespace WebCore {

typedef unsigned ReasonForUpdatingScrollLayerPositionOnMainThreadFlags;

// The ScrollingTreeState object keeps track of the current state of scrolling related properties.
// Whenever any properties change, the scrolling coordinator will be informed and will update the state
// and schedule a timer that will clone the new state and send it over to the scrolling thread, avoiding locking.
@@ -54,7 +56,7 @@ class ScrollingTreeState {
ContentsSize = 1 << 1,
NonFastScrollableRegion = 1 << 2,
WheelEventHandlerCount = 1 << 3,
ShouldUpdateScrollLayerPositionOnMainThread = 1 << 4,
ShouldUpdateScrollLayerPositionOnMainThreadReason = 1 << 4,
HorizontalScrollElasticity = 1 << 5,
VerticalScrollElasticity = 1 << 6,
HasEnabledHorizontalScrollbar = 1 << 7,
@@ -66,6 +68,14 @@ class ScrollingTreeState {
RequestedScrollPosition = 1 << 13,
};

enum ReasonForUpdatingScrollLayerPositionOnMainThread {
ForcedOnMainThread = 1 << 0,
HasSlowRepaintObjects = 1 << 1,
HasNonCompositedViewportConstrainedObjects = 1 << 2,
HasNonLayerViewportConstrainedObjects = 1 << 3,
IsImageDocument = 1 << 4
};

bool hasChangedProperties() const { return m_changedProperties; }
unsigned changedProperties() const { return m_changedProperties; }

@@ -81,8 +91,8 @@ class ScrollingTreeState {
unsigned wheelEventHandlerCount() const { return m_wheelEventHandlerCount; }
void setWheelEventHandlerCount(unsigned);

bool shouldUpdateScrollLayerPositionOnMainThread() const { return m_shouldUpdateScrollLayerPositionOnMainThread; }
void setShouldUpdateScrollLayerPositionOnMainThread(bool);
ReasonForUpdatingScrollLayerPositionOnMainThreadFlags shouldUpdateScrollLayerPositionOnMainThreadReason() const { return m_shouldUpdateScrollLayerPositionOnMainThreadReason; }
void setShouldUpdateScrollLayerPositionOnMainThreadReason(ReasonForUpdatingScrollLayerPositionOnMainThreadFlags);

ScrollElasticity horizontalScrollElasticity() const { return m_horizontalScrollElasticity; }
void setHorizontalScrollElasticity(ScrollElasticity);
@@ -126,7 +136,7 @@ class ScrollingTreeState {

unsigned m_wheelEventHandlerCount;

bool m_shouldUpdateScrollLayerPositionOnMainThread;
ReasonForUpdatingScrollLayerPositionOnMainThreadFlags m_shouldUpdateScrollLayerPositionOnMainThreadReason;

ScrollElasticity m_horizontalScrollElasticity;
ScrollElasticity m_verticalScrollElasticity;

0 comments on commit 7a12b3f

Please sign in to comment.