ScrollingTreeState.cpp [plain text]
#include "config.h"
#include "ScrollingTreeState.h"
#if ENABLE(THREADED_SCROLLING)
namespace WebCore {
PassOwnPtr<ScrollingTreeState> ScrollingTreeState::create()
{
return adoptPtr(new ScrollingTreeState);
}
ScrollingTreeState::ScrollingTreeState()
: m_changedProperties(0)
, m_wheelEventHandlerCount(0)
, m_shouldUpdateScrollLayerPositionOnMainThread(false)
, m_horizontalScrollElasticity(ScrollElasticityNone)
, m_verticalScrollElasticity(ScrollElasticityNone)
, m_hasEnabledHorizontalScrollbar(false)
, m_hasEnabledVerticalScrollbar(false)
, m_horizontalScrollbarMode(ScrollbarAuto)
, m_verticalScrollbarMode(ScrollbarAuto)
{
}
ScrollingTreeState::~ScrollingTreeState()
{
}
void ScrollingTreeState::setViewportRect(const IntRect& viewportRect)
{
if (m_viewportRect == viewportRect)
return;
m_viewportRect = viewportRect;
m_changedProperties |= ViewportRect;
}
void ScrollingTreeState::setContentsSize(const IntSize& contentsSize)
{
if (m_contentsSize == contentsSize)
return;
m_contentsSize = contentsSize;
m_changedProperties |= ContentsSize;
}
void ScrollingTreeState::setNonFastScrollableRegion(const Region& nonFastScrollableRegion)
{
if (m_nonFastScrollableRegion == nonFastScrollableRegion)
return;
m_nonFastScrollableRegion = nonFastScrollableRegion;
m_changedProperties |= NonFastScrollableRegion;
}
void ScrollingTreeState::setWheelEventHandlerCount(unsigned wheelEventHandlerCount)
{
if (m_wheelEventHandlerCount == wheelEventHandlerCount)
return;
m_wheelEventHandlerCount = wheelEventHandlerCount;
m_changedProperties |= WheelEventHandlerCount;
}
void ScrollingTreeState::setShouldUpdateScrollLayerPositionOnMainThread(bool shouldUpdateScrollLayerPositionOnMainThread)
{
if (m_shouldUpdateScrollLayerPositionOnMainThread == shouldUpdateScrollLayerPositionOnMainThread)
return;
m_shouldUpdateScrollLayerPositionOnMainThread = shouldUpdateScrollLayerPositionOnMainThread;
m_changedProperties |= ShouldUpdateScrollLayerPositionOnMainThread;
}
void ScrollingTreeState::setHorizontalScrollElasticity(ScrollElasticity horizontalScrollElasticity)
{
if (m_horizontalScrollElasticity == horizontalScrollElasticity)
return;
m_horizontalScrollElasticity = horizontalScrollElasticity;
m_changedProperties |= HorizontalScrollElasticity;
}
void ScrollingTreeState::setVerticalScrollElasticity(ScrollElasticity verticalScrollElasticity)
{
if (m_verticalScrollElasticity == verticalScrollElasticity)
return;
m_verticalScrollElasticity = verticalScrollElasticity;
m_changedProperties |= VerticalScrollElasticity;
}
void ScrollingTreeState::setHasEnabledHorizontalScrollbar(bool hasEnabledHorizontalScrollbar)
{
if (m_hasEnabledHorizontalScrollbar == hasEnabledHorizontalScrollbar)
return;
m_hasEnabledHorizontalScrollbar = hasEnabledHorizontalScrollbar;
m_changedProperties |= HasEnabledHorizontalScrollbar;
}
void ScrollingTreeState::setHasEnabledVerticalScrollbar(bool hasEnabledVerticalScrollbar)
{
if (m_hasEnabledVerticalScrollbar == hasEnabledVerticalScrollbar)
return;
m_hasEnabledVerticalScrollbar = hasEnabledVerticalScrollbar;
m_changedProperties |= HasEnabledVerticalScrollbar;
}
void ScrollingTreeState::setHorizontalScrollbarMode(ScrollbarMode horizontalScrollbarMode)
{
if (m_horizontalScrollbarMode == horizontalScrollbarMode)
return;
m_horizontalScrollbarMode = horizontalScrollbarMode;
m_changedProperties |= HorizontalScrollbarMode;
}
void ScrollingTreeState::setVerticalScrollbarMode(ScrollbarMode verticalScrollbarMode)
{
if (m_verticalScrollbarMode == verticalScrollbarMode)
return;
m_verticalScrollbarMode = verticalScrollbarMode;
m_changedProperties |= VerticalScrollbarMode;
}
void ScrollingTreeState::setRequestedScrollPosition(const IntPoint& requestedScrollPosition)
{
m_requestedScrollPosition = requestedScrollPosition;
m_changedProperties |= RequestedScrollPosition;
}
void ScrollingTreeState::setScrollOrigin(const IntPoint& scrollOrigin)
{
if (m_scrollOrigin == scrollOrigin)
return;
m_scrollOrigin = scrollOrigin;
m_changedProperties |= ScrollOrigin;
}
PassOwnPtr<ScrollingTreeState> ScrollingTreeState::commit()
{
OwnPtr<ScrollingTreeState> treeState = adoptPtr(new ScrollingTreeState(*this));
m_changedProperties = 0;
return treeState.release();
}
}
#endif // ENABLE(THREADED_SCROLLING)