Title: [132968] trunk/Source/WebCore
- Revision
- 132968
- Author
- [email protected]
- Date
- 2012-10-30 17:18:18 -0700 (Tue, 30 Oct 2012)
Log Message
https://bugs.webkit.org/show_bug.cgi?id=100796
Should add FixedPositionViewportConstraints to ScrollingConstraints.h
Reviewed by Simon Fraser.
ScrollingConstraints.h currently contains an abstract class called
ViewportConstraints that is intended to encapsulate data and logic
required to reposition elements whose layout depends on the viewport
rect (positions fixed and sticky), when scrolling and zooming.
However, at this time there is only a subclass for sticky. We should
add a sub-class for fixed. This is required to get pages with fixed
position elements scrolling on the scrolling thread.
* page/scrolling/ScrollingConstraints.cpp:
(WebCore::FixedPositionViewportConstraints::layerPositionForViewportRect):
(WebCore):
* page/scrolling/ScrollingConstraints.h:
(WebCore::ViewportConstraints::ViewportConstraints):
(ViewportConstraints):
(WebCore::ViewportConstraints::setAnchorEdges):
(FixedPositionViewportConstraints):
(WebCore::FixedPositionViewportConstraints::FixedPositionViewportConstraints):
(WebCore::FixedPositionViewportConstraints::viewportRectAtLastLayout):
(WebCore::FixedPositionViewportConstraints::setViewportRectAtLastLayout):
(WebCore::FixedPositionViewportConstraints::layerPositionAtLastLayout):
(WebCore::FixedPositionViewportConstraints::setLayerPositionAtLastLayout):
(WebCore):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (132967 => 132968)
--- trunk/Source/WebCore/ChangeLog 2012-10-31 00:12:46 UTC (rev 132967)
+++ trunk/Source/WebCore/ChangeLog 2012-10-31 00:18:18 UTC (rev 132968)
@@ -1,3 +1,33 @@
+2012-10-30 Beth Dakin <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=100796
+ Should add FixedPositionViewportConstraints to ScrollingConstraints.h
+
+ Reviewed by Simon Fraser.
+
+ ScrollingConstraints.h currently contains an abstract class called
+ ViewportConstraints that is intended to encapsulate data and logic
+ required to reposition elements whose layout depends on the viewport
+ rect (positions fixed and sticky), when scrolling and zooming.
+ However, at this time there is only a subclass for sticky. We should
+ add a sub-class for fixed. This is required to get pages with fixed
+ position elements scrolling on the scrolling thread.
+
+ * page/scrolling/ScrollingConstraints.cpp:
+ (WebCore::FixedPositionViewportConstraints::layerPositionForViewportRect):
+ (WebCore):
+ * page/scrolling/ScrollingConstraints.h:
+ (WebCore::ViewportConstraints::ViewportConstraints):
+ (ViewportConstraints):
+ (WebCore::ViewportConstraints::setAnchorEdges):
+ (FixedPositionViewportConstraints):
+ (WebCore::FixedPositionViewportConstraints::FixedPositionViewportConstraints):
+ (WebCore::FixedPositionViewportConstraints::viewportRectAtLastLayout):
+ (WebCore::FixedPositionViewportConstraints::setViewportRectAtLastLayout):
+ (WebCore::FixedPositionViewportConstraints::layerPositionAtLastLayout):
+ (WebCore::FixedPositionViewportConstraints::setLayerPositionAtLastLayout):
+ (WebCore):
+
2012-10-30 Tiancheng Jiang <[email protected]>
[BlackBerry] update form theme for BB10.
Modified: trunk/Source/WebCore/page/scrolling/ScrollingConstraints.cpp (132967 => 132968)
--- trunk/Source/WebCore/page/scrolling/ScrollingConstraints.cpp 2012-10-31 00:12:46 UTC (rev 132967)
+++ trunk/Source/WebCore/page/scrolling/ScrollingConstraints.cpp 2012-10-31 00:18:18 UTC (rev 132968)
@@ -28,6 +28,23 @@
namespace WebCore {
+FloatPoint FixedPositionViewportConstraints::layerPositionForViewportRect(const FloatRect& viewportRect) const
+{
+ FloatSize offset;
+
+ if (hasAnchorEdge(AnchorEdgeLeft))
+ offset.setWidth(viewportRect.x() - m_viewportRectAtLastLayout.x());
+ else if (hasAnchorEdge(AnchorEdgeRight))
+ offset.setWidth(viewportRect.maxX() - m_viewportRectAtLastLayout.maxX());
+
+ if (hasAnchorEdge(AnchorEdgeTop))
+ offset.setHeight(viewportRect.y() - m_viewportRectAtLastLayout.y());
+ else if (hasAnchorEdge(AnchorEdgeBottom))
+ offset.setHeight(viewportRect.maxY() - m_viewportRectAtLastLayout.maxY());
+
+ return m_layerPositionAtLastLayout + offset;
+}
+
FloatSize StickyPositionViewportConstraints::computeStickyOffset(const FloatRect& viewportRect) const
{
FloatRect boxRect = m_absoluteStickyBoxRect;
Modified: trunk/Source/WebCore/page/scrolling/ScrollingConstraints.h (132967 => 132968)
--- trunk/Source/WebCore/page/scrolling/ScrollingConstraints.h 2012-10-31 00:12:46 UTC (rev 132967)
+++ trunk/Source/WebCore/page/scrolling/ScrollingConstraints.h 2012-10-31 00:18:18 UTC (rev 132968)
@@ -51,6 +51,11 @@
: m_anchorEdges(0)
{ }
+ ViewportConstraints(ViewportConstraints* constraints)
+ : m_alignmentOffset(constraints->alignmentOffset())
+ , m_anchorEdges(constraints->anchorEdges())
+ { }
+
virtual ~ViewportConstraints() { }
virtual ConstraintType constraintType() const = 0;
@@ -58,6 +63,7 @@
AnchorEdges anchorEdges() const { return m_anchorEdges; }
bool hasAnchorEdge(AnchorEdgeFlags flag) const { return m_anchorEdges & flag; }
void addAnchorEdge(AnchorEdgeFlags edgeFlag) { m_anchorEdges |= edgeFlag; }
+ void setAnchorEdges(AnchorEdges edges) { m_anchorEdges = edges; }
FloatSize alignmentOffset() const { return m_alignmentOffset; }
void setAlignmentOffset(const FloatSize& offset) { m_alignmentOffset = offset; }
@@ -67,6 +73,32 @@
AnchorEdges m_anchorEdges;
};
+class FixedPositionViewportConstraints : public ViewportConstraints {
+public:
+ FixedPositionViewportConstraints()
+ { }
+
+ FixedPositionViewportConstraints(FixedPositionViewportConstraints* constraints)
+ : ViewportConstraints(constraints)
+ , m_viewportRectAtLastLayout(constraints->viewportRectAtLastLayout())
+ , m_layerPositionAtLastLayout(constraints->layerPositionAtLastLayout())
+ { }
+
+ virtual ConstraintType constraintType() const OVERRIDE { return FixedPositionConstaint; };
+
+ FloatPoint layerPositionForViewportRect(const FloatRect& viewportRect) const;
+
+ const FloatRect& viewportRectAtLastLayout() const { return m_viewportRectAtLastLayout; }
+ void setViewportRectAtLastLayout(const FloatRect& rect) { m_viewportRectAtLastLayout = rect; }
+
+ const FloatPoint& layerPositionAtLastLayout() const { return m_layerPositionAtLastLayout; }
+ void setLayerPositionAtLastLayout(const FloatPoint& point) { m_layerPositionAtLastLayout = point; }
+
+private:
+ FloatRect m_viewportRectAtLastLayout;
+ FloatPoint m_layerPositionAtLastLayout;
+};
+
class StickyPositionViewportConstraints : public ViewportConstraints {
public:
StickyPositionViewportConstraints()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes