<rdar://problem/
7615997>
https://bugs.webkit.org/show_bug.cgi?id=54054
Reviewed by Dan Bernstein.
Take the overhang into account when calculating position for elements with position: fixed.
* platform/ScrollView.cpp:
(WebCore::ScrollView::scrollXForFixedPosition):
(WebCore::ScrollView::scrollYForFixedPosition):
(WebCore::ScrollView::scrollOffsetForFixedPosition):
* platform/ScrollView.h:
* rendering/RenderView.cpp:
(WebCore::RenderView::mapLocalToContainer):
(WebCore::RenderView::mapAbsoluteToLocalPoint):
(WebCore::RenderView::computeRectForRepaint):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@78066
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-02-09 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Dan Bernstein.
+
+ Fixed positioned elements at very top or bottom of page remain fixed but clip during rubber-banding
+ <rdar://problem/7615997>
+ https://bugs.webkit.org/show_bug.cgi?id=54054
+
+ Take the overhang into account when calculating position for elements with position: fixed.
+
+ * platform/ScrollView.cpp:
+ (WebCore::ScrollView::scrollXForFixedPosition):
+ (WebCore::ScrollView::scrollYForFixedPosition):
+ (WebCore::ScrollView::scrollOffsetForFixedPosition):
+ * platform/ScrollView.h:
+ * rendering/RenderView.cpp:
+ (WebCore::RenderView::mapLocalToContainer):
+ (WebCore::RenderView::mapAbsoluteToLocalPoint):
+ (WebCore::RenderView::computeRectForRepaint):
+
2011-02-09 Simon Fraser <simon.fraser@apple.com>
Reviewed by Dirk Schulze.
return newScrollPosition;
}
+int ScrollView::scrollXForFixedPosition() const
+{
+ int x = scrollX();
+ if (x < 0)
+ x = 0;
+ else if (x > contentsWidth() - visibleContentRect().width())
+ x = contentsWidth() - visibleContentRect().width();
+ return x;
+}
+
+int ScrollView::scrollYForFixedPosition() const
+{
+ int y = scrollY();
+ if (y < 0)
+ y = 0;
+ else if (y > contentsHeight() - visibleContentRect().height())
+ y = contentsHeight() - visibleContentRect().height();
+ return y;
+}
+
+IntSize ScrollView::scrollOffsetForFixedPosition() const
+{
+ return IntSize(scrollXForFixedPosition(), scrollYForFixedPosition());
+}
+
int ScrollView::scrollSize(ScrollbarOrientation orientation) const
{
Scrollbar* scrollbar = ((orientation == HorizontalScrollbar) ? m_horizontalScrollbar : m_verticalScrollbar).get();
int scrollX() const { return scrollPosition().x(); }
int scrollY() const { return scrollPosition().y(); }
+ // Functions for querying the current scrolled position, negating the effects of overhang.
+ int scrollXForFixedPosition() const;
+ int scrollYForFixedPosition() const;
+ IntSize scrollOffsetForFixedPosition() const;
+
IntSize overhangAmount() const;
// Functions for scrolling the view.
}
if (fixed && m_frameView)
- transformState.move(m_frameView->scrollOffset());
+ transformState.move(m_frameView->scrollOffsetForFixedPosition());
}
void RenderView::mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState& transformState) const
{
if (fixed && m_frameView)
- transformState.move(-m_frameView->scrollOffset());
+ transformState.move(-m_frameView->scrollOffsetForFixedPosition());
if (useTransforms && shouldUseTransformFromContainer(0)) {
TransformationMatrix t;
}
if (fixed && m_frameView)
- rect.move(m_frameView->scrollX(), m_frameView->scrollY());
+ rect.move(m_frameView->scrollXForFixedPosition(), m_frameView->scrollYForFixedPosition());
// Apply our transform if we have one (because of full page zooming).
if (m_layer && m_layer->transform())