Commit 9d3bf065 authored by bdakin@apple.com's avatar bdakin@apple.com

Need WK2 API to give a WebView a header and footer

https://bugs.webkit.org/show_bug.cgi?id=113352
-and corresponding-
<rdar://problem/13383835>

Reviewed by Simon Fraser.

Source/WebCore: 

This API will require RenderLayerCompositor to keep layers for the header and 
footer when the exist. It also requires the scrolling machinery to know that the 
size of the scrollable area will differ from the contentsSize when there is a 
header or footer.

setWantsLayerForHeader() and setWantsLayerForFooter() return GraphicsLayers to 
WK2. setHeaderHeight() and setFooterHeight() set the header and footer heights
respectively.
* WebCore.exp.in:
* page/FrameView.h:
(FrameView):
* page/FrameView.cpp:
(WebCore::FrameView::FrameView):
(WebCore::FrameView::setWantsLayerForHeader):
(WebCore::FrameView::setWantsLayerForFooter):
(WebCore::FrameView::setHeaderHeight):
(WebCore::FrameView::setFooterHeight):

Should use totalContentsSize() instead of contentsSize().
(WebCore::FrameView::windowClipRect):
(WebCore::FrameView::isScrollable):
* page/SpatialNavigation.cpp:
(WebCore::canScrollInDirection):

This should also use totalContentsSize() instead of contentsSize(), and while 
we're at it, re-name the variable and function names in the scrolling tree code 
from contentsSize to totalContentsSize.
* page/scrolling/ScrollingStateScrollingNode.cpp:
(WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
(WebCore::ScrollingStateScrollingNode::setTotalContentsSize):
(WebCore::ScrollingStateScrollingNode::dumpProperties):
* page/scrolling/ScrollingStateScrollingNode.h:
(WebCore::ScrollingStateScrollingNode::totalContentsSize):
(ScrollingStateScrollingNode):
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::updateBeforeChildren):
* page/scrolling/ScrollingTreeScrollingNode.h:
(WebCore::ScrollingTreeScrollingNode::totalContentsSize):
(ScrollingTreeScrollingNode):
* page/scrolling/mac/ScrollingCoordinatorMac.h:
(ScrollParameters):
* page/scrolling/mac/ScrollingCoordinatorMac.mm:
(WebCore::ScrollingCoordinatorMac::frameViewLayoutUpdated):
(WebCore::ScrollingCoordinatorMac::setScrollParametersForNode):
* page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
(WebCore::ScrollingTreeScrollingNodeMac::updateAfterChildren):
(WebCore::ScrollingTreeScrollingNodeMac::setScrollLayerPosition):
(WebCore::ScrollingTreeScrollingNodeMac::maximumScrollPosition):

Use totalContentsSize() instead of contentsSize().
* platform/ScrollView.cpp:
(WebCore::ScrollView::maximumScrollPosition):
(WebCore::ScrollView::setScrollOffset):
(WebCore::ScrollView::overhangAmount):
(WebCore::ScrollView::updateScrollbars):
(WebCore::ScrollView::calculateOverhangAreasForPainting):

scrollOffset() represents the offset within the totalContentsSize, but that is 
not what we need here. So subtract out the headerHeight() for the appropriate 
value.
(WebCore::ScrollView::windowToContents):
(WebCore::ScrollView::contentsToWindow):

Use totalContentsSize() instead of contentsSize().
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::maximumScrollPosition):
(WebCore):
(WebCore::ScrollableArea::totalContentsSize):
* platform/ScrollableArea.h:
(WebCore::ScrollableArea::headerHeight):
(WebCore::ScrollableArea::footerHeight):
(ScrollableArea):
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::adjustScrollPositionIfNecessary):
(WebCore::ScrollAnimatorMac::pinnedInDirection):
* platform/mac/ThemeMac.mm:
(WebCore::ThemeMac::ensuredView):

The rootContentLayer needs to be offset by the headerHeight().
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateRootLayerPosition):

New member variables m_layerForHeader and m_layerForFooter. This code properly 
creates and manages them.
(WebCore::RenderLayerCompositor::updateLayerForBottomOverhangArea):
(WebCore::RenderLayerCompositor::updateLayerForHeader):
(WebCore):
(WebCore::RenderLayerCompositor::updateLayerForFooter):
(WebCore::RenderLayerCompositor::computeFixedViewportConstraints):
(WebCore::RenderLayerCompositor::reportMemoryUsage):
* rendering/RenderLayerCompositor.h:
(RenderLayerCompositor):

Test infrastructure. 
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::setHeaderHeight):
(WebCore):
(WebCore::Internals::setFooterHeight):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit2: 

New API allows setting and getting layers for a header and footer.

* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/InjectedBundle/API/c/mac: Added.
* WebProcess/InjectedBundle/API/c/mac/WKBundlePagePrivateMac.h: Added.
* WebProcess/InjectedBundle/API/c/mac/WKBundlePagePrivateMac.mm: Added.
(WKBundlePageGetHeaderLayer):
(WKBundlePageSetHeaderLayer):
(WKBundlePageGetFooterLayer):
(WKBundlePageSetFooterLayer):
* WebProcess/WebPage/WebPage.h:
(WebPage):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::setTopOverhangImage):
(WebKit::WebPage::setBottomOverhangImage):
(WebKit):
(WebKit::WebPage::getHeaderLayer):
(WebKit::WebPage::setHeaderLayerWithHeight):
(WebKit::WebPage::getFooterLayer):
(WebKit::WebPage::setFooterLayerWithHeight):

LayoutTests: 

* platform/mac-wk2/tiled-drawing/header-and-footer-hit-testing-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/header-and-footer-hit-testing-with-page-scale-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/header-and-footer-hit-testing-with-page-scale.html: Added.
* platform/mac-wk2/tiled-drawing/header-and-footer-hit-testing.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@147039 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7b53ab4c
2013-03-27 Beth Dakin <bdakin@apple.com>
Need WK2 API to give a WebView a header and footer
https://bugs.webkit.org/show_bug.cgi?id=113352
-and corresponding-
<rdar://problem/13383835>
Reviewed by Simon Fraser.
* platform/mac-wk2/tiled-drawing/header-and-footer-hit-testing-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/header-and-footer-hit-testing-with-page-scale-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/header-and-footer-hit-testing-with-page-scale.html: Added.
* platform/mac-wk2/tiled-drawing/header-and-footer-hit-testing.html: Added.
2013-03-27 Arnaud Renevier <a.renevier@sisa.samsung.com>
javascriptcore bindings do not check exception after calling valueToStringWithNullCheck
<html>
<head>
<style>
#target {
background-color:purple;
width:25px;
height:25px;
}
</style>
<script>
var numberOfClicks = 0;
function runTest() {
if (!window.eventSender)
return;
if (window.internals) {
window.internals.setHeaderHeight(document, 100);
window.internals.setPageScaleFactor(2, 0, 0);
}
if (window.testRunner)
testRunner.dumpAsText();
// The page should scale, but the header should not.
eventSender.mouseMoveTo(25, 125);
eventSender.mouseDown();
eventSender.mouseUp();
var result = document.getElementById("result");
if (numberOfClicks > 0)
result.innerHTML = "Pass!";
else
result.innerHTML = "Fail.";
}
function clicked() {
numberOfClicks = 1;
}
</script>
</head>
<body onload="runTest()">
<div id="target" onclick="clicked()"></div>
<div id="result">This test needs to be run through WebKitTestRunner.</div>
</body>
</html>
<html>
<head>
<style>
#target {
background-color:purple;
width:25px;
height:25px;
}
</style>
<script>
var numberOfClicks = 0;
function runTest() {
if (!window.eventSender)
return;
if (window.internals)
window.internals.setHeaderHeight(document, 100);
if (window.testRunner)
testRunner.dumpAsText();
eventSender.mouseMoveTo(15, 115);
eventSender.mouseDown();
eventSender.mouseUp();
var result = document.getElementById("result");
if (numberOfClicks > 0)
result.innerHTML = "Pass!";
else
result.innerHTML = "Fail.";
}
function clicked() {
numberOfClicks = 1;
}
</script>
</head>
<body onload="runTest()">
<div id="target" onclick="clicked()"></div>
<div id="result">This test needs to be run through WebKitTestRunner.</div>
</body>
</html>
2013-03-27 Beth Dakin <bdakin@apple.com>
Need WK2 API to give a WebView a header and footer
https://bugs.webkit.org/show_bug.cgi?id=113352
-and corresponding-
<rdar://problem/13383835>
Reviewed by Simon Fraser.
This API will require RenderLayerCompositor to keep layers for the header and
footer when the exist. It also requires the scrolling machinery to know that the
size of the scrollable area will differ from the contentsSize when there is a
header or footer.
setWantsLayerForHeader() and setWantsLayerForFooter() return GraphicsLayers to
WK2. setHeaderHeight() and setFooterHeight() set the header and footer heights
respectively.
* WebCore.exp.in:
* page/FrameView.h:
(FrameView):
* page/FrameView.cpp:
(WebCore::FrameView::FrameView):
(WebCore::FrameView::setWantsLayerForHeader):
(WebCore::FrameView::setWantsLayerForFooter):
(WebCore::FrameView::setHeaderHeight):
(WebCore::FrameView::setFooterHeight):
Should use totalContentsSize() instead of contentsSize().
(WebCore::FrameView::windowClipRect):
(WebCore::FrameView::isScrollable):
* page/SpatialNavigation.cpp:
(WebCore::canScrollInDirection):
This should also use totalContentsSize() instead of contentsSize(), and while
we're at it, re-name the variable and function names in the scrolling tree code
from contentsSize to totalContentsSize.
* page/scrolling/ScrollingStateScrollingNode.cpp:
(WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
(WebCore::ScrollingStateScrollingNode::setTotalContentsSize):
(WebCore::ScrollingStateScrollingNode::dumpProperties):
* page/scrolling/ScrollingStateScrollingNode.h:
(WebCore::ScrollingStateScrollingNode::totalContentsSize):
(ScrollingStateScrollingNode):
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::updateBeforeChildren):
* page/scrolling/ScrollingTreeScrollingNode.h:
(WebCore::ScrollingTreeScrollingNode::totalContentsSize):
(ScrollingTreeScrollingNode):
* page/scrolling/mac/ScrollingCoordinatorMac.h:
(ScrollParameters):
* page/scrolling/mac/ScrollingCoordinatorMac.mm:
(WebCore::ScrollingCoordinatorMac::frameViewLayoutUpdated):
(WebCore::ScrollingCoordinatorMac::setScrollParametersForNode):
* page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
(WebCore::ScrollingTreeScrollingNodeMac::updateAfterChildren):
(WebCore::ScrollingTreeScrollingNodeMac::setScrollLayerPosition):
(WebCore::ScrollingTreeScrollingNodeMac::maximumScrollPosition):
Use totalContentsSize() instead of contentsSize().
* platform/ScrollView.cpp:
(WebCore::ScrollView::maximumScrollPosition):
(WebCore::ScrollView::setScrollOffset):
(WebCore::ScrollView::overhangAmount):
(WebCore::ScrollView::updateScrollbars):
(WebCore::ScrollView::calculateOverhangAreasForPainting):
scrollOffset() represents the offset within the totalContentsSize, but that is
not what we need here. So subtract out the headerHeight() for the appropriate
value.
(WebCore::ScrollView::windowToContents):
(WebCore::ScrollView::contentsToWindow):
Use totalContentsSize() instead of contentsSize().
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::maximumScrollPosition):
(WebCore):
(WebCore::ScrollableArea::totalContentsSize):
* platform/ScrollableArea.h:
(WebCore::ScrollableArea::headerHeight):
(WebCore::ScrollableArea::footerHeight):
(ScrollableArea):
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::adjustScrollPositionIfNecessary):
(WebCore::ScrollAnimatorMac::pinnedInDirection):
* platform/mac/ThemeMac.mm:
(WebCore::ThemeMac::ensuredView):
The rootContentLayer needs to be offset by the headerHeight().
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateRootLayerPosition):
New member variables m_layerForHeader and m_layerForFooter. This code properly
creates and manages them.
(WebCore::RenderLayerCompositor::updateLayerForBottomOverhangArea):
(WebCore::RenderLayerCompositor::updateLayerForHeader):
(WebCore):
(WebCore::RenderLayerCompositor::updateLayerForFooter):
(WebCore::RenderLayerCompositor::computeFixedViewportConstraints):
(WebCore::RenderLayerCompositor::reportMemoryUsage):
* rendering/RenderLayerCompositor.h:
(RenderLayerCompositor):
Test infrastructure.
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::setHeaderHeight):
(WebCore):
(WebCore::Internals::setFooterHeight):
* testing/Internals.h:
* testing/Internals.idl:
2013-03-27 Arnaud Renevier <a.renevier@sisa.samsung.com>
javascriptcore bindings do not check exception after calling valueToStringWithNullCheck
......@@ -329,6 +329,8 @@ __ZN7WebCore14LoaderStrategy25loadResourceSynchronouslyEPNS_17NetworkingContextE
__ZN7WebCore14PluginDocument10pluginNodeEv
__ZNK7WebCore5Frame25trackedRepaintRectsAsTextEv
__ZN7WebCore9FrameView13setNodeToDrawEPNS_4NodeE
__ZN7WebCore9FrameView15setFooterHeightEi
__ZN7WebCore9FrameView15setHeaderHeightEi
__ZN7WebCore9FrameView17setTracksRepaintsEb
__ZN7WebCore9FrameView20resetTrackedRepaintsEv
__ZN7WebCore14PluginDocument12pluginWidgetEv
......@@ -1571,6 +1573,8 @@ __ZNK7WebCore9FrameView13paintBehaviorEv
__ZNK7WebCore9FrameView14didFirstLayoutEv
__ZNK7WebCore9FrameView19baseBackgroundColorEv
__ZNK7WebCore9FrameView20isSoftwareRenderableEv
__ZNK7WebCore9FrameView22setWantsLayerForFooterEb
__ZNK7WebCore9FrameView22setWantsLayerForHeaderEb
__ZNK7WebCore9FrameView23documentBackgroundColorEv
__ZNK7WebCore9FrameView27windowClipRectForFrameOwnerEPKNS_21HTMLFrameOwnerElementEb
__ZNK7WebCore9FrameView28isEnclosedInCompositingLayerEv
......
......@@ -195,6 +195,8 @@ FrameView::FrameView(Frame* frame)
, m_shouldAutoSize(false)
, m_inAutoSize(false)
, m_didRunAutosize(false)
, m_headerHeight(0)
, m_footerHeight(0)
#if ENABLE(CSS_FILTERS)
, m_hasSoftwareFilters(false)
#endif
......@@ -884,7 +886,52 @@ GraphicsLayer* FrameView::setWantsLayerForBottomOverHangArea(bool wantsLayer) co
return 0;
#endif
}
GraphicsLayer* FrameView::setWantsLayerForHeader(bool wantsLayer) const
{
RenderView* renderView = this->renderView();
if (!renderView)
return 0;
ASSERT(m_frame == m_frame->page()->mainFrame());
#if USE(ACCELERATED_COMPOSITING)
return renderView->compositor()->updateLayerForHeader(wantsLayer);
#else
return 0;
#endif
}
GraphicsLayer* FrameView::setWantsLayerForFooter(bool wantsLayer) const
{
RenderView* renderView = this->renderView();
if (!renderView)
return 0;
ASSERT(m_frame == m_frame->page()->mainFrame());
#if USE(ACCELERATED_COMPOSITING)
return renderView->compositor()->updateLayerForFooter(wantsLayer);
#else
return 0;
#endif
}
#endif
void FrameView::setHeaderHeight(int headerHeight)
{
if (m_frame && m_frame->page())
ASSERT(m_frame == m_frame->page()->mainFrame());
m_headerHeight = headerHeight;
}
void FrameView::setFooterHeight(int footerHeight)
{
if (m_frame && m_frame->page())
ASSERT(m_frame == m_frame->page()->mainFrame());
m_footerHeight = footerHeight;
}
bool FrameView::flushCompositingStateForThisFrame(Frame* rootFrameForFlush)
{
......@@ -2852,7 +2899,7 @@ IntRect FrameView::windowClipRect(bool clipToContents) const
ASSERT(m_frame->view() == this);
if (paintsEntireContents())
return IntRect(IntPoint(), contentsSize());
return IntRect(IntPoint(), totalContentsSize());
// Set our clip rect to be our contents.
IntRect clipRect = contentsToWindow(visibleContentRect(clipToContents ? ExcludeScrollbars : IncludeScrollbars));
......@@ -2989,9 +3036,9 @@ bool FrameView::isScrollable()
// 4) scrolling: no;
// Covers #1
IntSize contentSize = contentsSize();
IntSize totalContentsSize = this->totalContentsSize();
IntSize visibleContentSize = visibleContentRect().size();
if ((contentSize.height() <= visibleContentSize.height() && contentSize.width() <= visibleContentSize.width()))
if ((totalContentsSize.height() <= visibleContentSize.height() && totalContentsSize.width() <= visibleContentSize.width()))
return false;
// Covers #2.
......
......@@ -402,8 +402,15 @@ public:
#if ENABLE(RUBBER_BANDING)
GraphicsLayer* setWantsLayerForTopOverHangArea(bool) const;
GraphicsLayer* setWantsLayerForBottomOverHangArea(bool) const;
GraphicsLayer* setWantsLayerForHeader(bool) const;
GraphicsLayer* setWantsLayerForFooter(bool) const;
#endif
virtual int headerHeight() const OVERRIDE { return m_headerHeight; }
void setHeaderHeight(int);
virtual int footerHeight() const OVERRIDE { return m_footerHeight; }
void setFooterHeight(int);
protected:
virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
virtual void scrollContentsSlowPath(const IntRect& updateRect);
......@@ -595,6 +602,9 @@ private:
OwnPtr<ScrollableAreaSet> m_scrollableAreas;
OwnPtr<ViewportConstrainedObjectSet> m_viewportConstrainedObjects;
int m_headerHeight;
int m_footerHeight;
static double s_normalDeferredRepaintDelay;
static double s_initialDeferredRepaintDelayDuringLoading;
static double s_maxDeferredRepaintDelayDuringLoading;
......
......@@ -483,7 +483,7 @@ bool canScrollInDirection(const Frame* frame, FocusDirection direction)
return false;
if ((direction == FocusDirectionUp || direction == FocusDirectionDown) && ScrollbarAlwaysOff == verticalMode)
return false;
LayoutSize size = frame->view()->contentsSize();
LayoutSize size = frame->view()->totalContentsSize();
LayoutSize offset = frame->view()->scrollOffset();
LayoutRect rect = frame->view()->visibleContentRect(ScrollableArea::IncludeScrollbars);
......
......@@ -58,7 +58,7 @@ ScrollingStateScrollingNode::ScrollingStateScrollingNode(ScrollingStateTree* sta
ScrollingStateScrollingNode::ScrollingStateScrollingNode(const ScrollingStateScrollingNode& stateNode)
: ScrollingStateNode(stateNode)
, m_viewportRect(stateNode.viewportRect())
, m_contentsSize(stateNode.contentsSize())
, m_totalContentsSize(stateNode.totalContentsSize())
, m_frameScaleFactor(stateNode.frameScaleFactor())
, m_nonFastScrollableRegion(stateNode.nonFastScrollableRegion())
, m_wheelEventHandlerCount(stateNode.wheelEventHandlerCount())
......@@ -95,13 +95,13 @@ void ScrollingStateScrollingNode::setViewportRect(const IntRect& viewportRect)
m_scrollingStateTree->setHasChangedProperties(true);
}
void ScrollingStateScrollingNode::setContentsSize(const IntSize& contentsSize)
void ScrollingStateScrollingNode::setTotalContentsSize(const IntSize& totalContentsSize)
{
if (m_contentsSize == contentsSize)
if (m_totalContentsSize == totalContentsSize)
return;
m_contentsSize = contentsSize;
setPropertyChanged(ContentsSize);
m_totalContentsSize = totalContentsSize;
setPropertyChanged(TotalContentsSize);
m_scrollingStateTree->setHasChangedProperties(true);
}
......@@ -233,9 +233,9 @@ void ScrollingStateScrollingNode::dumpProperties(TextStream& ts, int indent) con
ts << "(viewport rect " << m_viewportRect.x() << " " << m_viewportRect.y() << " " << m_viewportRect.width() << " " << m_viewportRect.height() << ")\n";
}
if (!m_contentsSize.isEmpty()) {
if (!m_totalContentsSize.isEmpty()) {
writeIndent(ts, indent + 1);
ts << "(contents size " << m_contentsSize.width() << " " << m_contentsSize.height() << ")\n";
ts << "(contents size " << m_totalContentsSize.width() << " " << m_totalContentsSize.height() << ")\n";
}
if (m_frameScaleFactor != 1) {
......
......@@ -47,7 +47,7 @@ public:
enum ChangedProperty {
ViewportRect = NumStateNodeBits,
ContentsSize,
TotalContentsSize,
FrameScaleFactor,
NonFastScrollableRegion,
WheelEventHandlerCount,
......@@ -68,8 +68,8 @@ public:
const IntRect& viewportRect() const { return m_viewportRect; }
void setViewportRect(const IntRect&);
const IntSize& contentsSize() const { return m_contentsSize; }
void setContentsSize(const IntSize&);
const IntSize& totalContentsSize() const { return m_totalContentsSize; }
void setTotalContentsSize(const IntSize&);
float frameScaleFactor() const { return m_frameScaleFactor; }
void setFrameScaleFactor(float);
......@@ -126,7 +126,7 @@ private:
#endif
IntRect m_viewportRect;
IntSize m_contentsSize;
IntSize m_totalContentsSize;
float m_frameScaleFactor;
......
......@@ -56,8 +56,8 @@ void ScrollingTreeScrollingNode::updateBeforeChildren(ScrollingStateNode* stateN
if (state->hasChangedProperty(ScrollingStateScrollingNode::ViewportRect))
m_viewportRect = state->viewportRect();
if (state->hasChangedProperty(ScrollingStateScrollingNode::ContentsSize))
m_contentsSize = state->contentsSize();
if (state->hasChangedProperty(ScrollingStateScrollingNode::TotalContentsSize))
m_totalContentsSize = state->totalContentsSize();
if (state->hasChangedProperty(ScrollingStateScrollingNode::FrameScaleFactor))
m_frameScaleFactor = state->frameScaleFactor();
......
......@@ -59,7 +59,7 @@ protected:
explicit ScrollingTreeScrollingNode(ScrollingTree*, ScrollingNodeID);
const IntRect& viewportRect() const { return m_viewportRect; }
const IntSize& contentsSize() const { return m_contentsSize; }
const IntSize& totalContentsSize() const { return m_totalContentsSize; }
float frameScaleFactor() const { return m_frameScaleFactor; }
......@@ -75,7 +75,7 @@ protected:
private:
IntRect m_viewportRect;
IntSize m_contentsSize;
IntSize m_totalContentsSize;
IntPoint m_scrollOrigin;
float m_frameScaleFactor;
......
......@@ -111,7 +111,7 @@ private:
IntPoint scrollOrigin;
IntRect viewportRect;
IntSize contentsSize;
IntSize totalContentsSize;
float frameScaleFactor;
};
......
......@@ -157,7 +157,7 @@ void ScrollingCoordinatorMac::frameViewLayoutUpdated(FrameView* frameView)
scrollParameters.scrollOrigin = frameView->scrollOrigin();
scrollParameters.viewportRect = IntRect(IntPoint(), frameView->visibleContentRect().size());
scrollParameters.contentsSize = frameView->contentsSize();
scrollParameters.totalContentsSize = frameView->totalContentsSize();
scrollParameters.frameScaleFactor = frameView->frame()->frameScaleFactor();
setScrollParametersForNode(scrollParameters, node);
......@@ -289,7 +289,7 @@ void ScrollingCoordinatorMac::setScrollParametersForNode(const ScrollParameters&
node->setScrollOrigin(scrollParameters.scrollOrigin);
node->setViewportRect(scrollParameters.viewportRect);
node->setContentsSize(scrollParameters.contentsSize);
node->setTotalContentsSize(scrollParameters.totalContentsSize);
node->setFrameScaleFactor(scrollParameters.frameScaleFactor);
scheduleTreeStateCommit();
......
......@@ -111,7 +111,7 @@ void ScrollingTreeScrollingNodeMac::updateAfterChildren(ScrollingStateNode* stat
if (scrollingStateNode->hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition))
setScrollPosition(scrollingStateNode->requestedScrollPosition());
if (scrollingStateNode->hasChangedProperty(ScrollingStateNode::ScrollLayer) || scrollingStateNode->hasChangedProperty(ScrollingStateScrollingNode::ContentsSize) || scrollingStateNode->hasChangedProperty(ScrollingStateScrollingNode::ViewportRect))
if (scrollingStateNode->hasChangedProperty(ScrollingStateNode::ScrollLayer) || scrollingStateNode->hasChangedProperty(ScrollingStateScrollingNode::TotalContentsSize) || scrollingStateNode->hasChangedProperty(ScrollingStateScrollingNode::ViewportRect))
updateMainFramePinState(scrollPosition());
}
......@@ -305,7 +305,7 @@ void ScrollingTreeScrollingNodeMac::setScrollLayerPosition(const IntPoint& posit
ASSERT(!shouldUpdateScrollLayerPositionOnMainThread());
m_scrollLayer.get().position = CGPointMake(-position.x() + scrollOrigin().x(), -position.y() + scrollOrigin().y());
IntSize scrollOffsetForFixedChildren = FrameView::scrollOffsetForFixedPosition(viewportRect(), contentsSize(), position, scrollOrigin(), frameScaleFactor(), false);
IntSize scrollOffsetForFixedChildren = FrameView::scrollOffsetForFixedPosition(viewportRect(), totalContentsSize(), position, scrollOrigin(), frameScaleFactor(), false);
if (m_counterScrollingLayer)
m_counterScrollingLayer.get().position = FloatPoint(scrollOffsetForFixedChildren);
......@@ -327,8 +327,8 @@ IntPoint ScrollingTreeScrollingNodeMac::minimumScrollPosition() const
IntPoint ScrollingTreeScrollingNodeMac::maximumScrollPosition() const
{
IntPoint position(contentsSize().width() - viewportRect().width(),
contentsSize().height() - viewportRect().height());
IntPoint position(totalContentsSize().width() - viewportRect().width(),
totalContentsSize().height() - viewportRect().height());
position.clampNegativeToZero();
......
......@@ -315,7 +315,7 @@ void ScrollView::setContentsSize(const IntSize& newSize)
IntPoint ScrollView::maximumScrollPosition() const
{
IntPoint maximumOffset(contentsWidth() - visibleWidth() - scrollOrigin().x(), contentsHeight() - visibleHeight() - scrollOrigin().y());
IntPoint maximumOffset(contentsWidth() - visibleWidth() - scrollOrigin().x(), totalContentsSize().height() - visibleHeight() - scrollOrigin().y());
maximumOffset.clampNegativeToZero();
return maximumOffset;
}
......@@ -358,7 +358,7 @@ void ScrollView::setScrollOffset(const IntPoint& offset)
int verticalOffset = offset.y();
if (constrainsScrollingToContentEdge()) {
horizontalOffset = max(min(horizontalOffset, contentsWidth() - visibleWidth()), 0);
verticalOffset = max(min(verticalOffset, contentsHeight() - visibleHeight()), 0);
verticalOffset = max(min(verticalOffset, totalContentsSize().height() - visibleHeight()), 0);
}
IntSize newOffset = m_scrollOffset;
......@@ -443,8 +443,8 @@ IntSize ScrollView::overhangAmount() const
int physicalScrollY = scrollPosition().y() + scrollOrigin().y();
if (physicalScrollY < 0)
stretch.setHeight(physicalScrollY);
else if (contentsHeight() && physicalScrollY > contentsHeight() - visibleHeight())
stretch.setHeight(physicalScrollY - (contentsHeight() - visibleHeight()));
else if (totalContentsSize().height() && physicalScrollY > totalContentsSize().height() - visibleHeight())
stretch.setHeight(physicalScrollY - (totalContentsSize().height() - visibleHeight()));
int physicalScrollX = scrollPosition().x() + scrollOrigin().x();
if (physicalScrollX < 0)
......@@ -503,7 +503,7 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset)
} else {
bool sendContentResizedNotification = false;
IntSize docSize = contentsSize();
IntSize docSize = totalContentsSize();
IntSize fullVisibleSize = visibleContentRect(IncludeScrollbars).size();
if (hScroll == ScrollbarAuto) {
......@@ -546,7 +546,7 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset)
m_updateScrollbarsPass++;
contentsResized();
visibleContentsResized();
IntSize newDocSize = contentsSize();
IntSize newDocSize = totalContentsSize();
if (newDocSize == docSize) {
// The layout with the new scroll state had no impact on
// the document's overall size, so updateScrollbars didn't get called.
......@@ -599,9 +599,9 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset)
if (m_scrollbarsSuppressed)
m_verticalScrollbar->setSuppressInvalidation(true);
m_verticalScrollbar->setEnabled(contentsHeight() > clientHeight);
m_verticalScrollbar->setEnabled(totalContentsSize().height() > clientHeight);
m_verticalScrollbar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep);
m_verticalScrollbar->setProportion(clientHeight, contentsHeight());
m_verticalScrollbar->setProportion(clientHeight, totalContentsSize().height());
if (m_scrollbarsSuppressed)
m_verticalScrollbar->setSuppressInvalidation(false);
}
......@@ -736,7 +736,8 @@ IntPoint ScrollView::windowToContents(const IntPoint& windowPoint) const
return convertFromContainingWindow(windowPoint);
IntPoint viewPoint = convertFromContainingWindow(windowPoint);
return viewPoint + scrollOffset();
IntSize offsetInDocument = scrollOffset() - IntSize(0, headerHeight());
return viewPoint + offsetInDocument;
}
IntPoint ScrollView::contentsToWindow(const IntPoint& contentsPoint) const
......@@ -744,7 +745,8 @@ IntPoint ScrollView::contentsToWindow(const IntPoint& contentsPoint) const
if (delegatesScrolling())
return convertToContainingWindow(contentsPoint);
IntPoint viewPoint = contentsPoint - scrollOffset();
IntSize offsetInDocument = scrollOffset() + IntSize(0, headerHeight());
IntPoint viewPoint = contentsPoint - offsetInDocument;
return convertToContainingWindow(viewPoint);
}
......@@ -754,7 +756,8 @@ IntRect ScrollView::windowToContents(const IntRect& windowRect) const
return convertFromContainingWindow(windowRect);
IntRect viewRect = convertFromContainingWindow(windowRect);
viewRect.move(scrollOffset());
IntSize offsetInDocument = scrollOffset() - IntSize(0, headerHeight());
viewRect.move(offsetInDocument);
return viewRect;
}
......@@ -764,7 +767,7 @@ IntRect ScrollView::contentsToWindow(const IntRect& contentsRect) const
return convertToContainingWindow(contentsRect);
IntRect viewRect = contentsRect;
viewRect.move(-scrollOffset());
viewRect.move(-scrollOffset() + IntSize(0, headerHeight()));
return convertToContainingWindow(viewRect);
}
......@@ -1116,8 +1119,8 @@ void ScrollView::calculateOverhangAreasForPainting(IntRect& horizontalOverhangRe