Title: [91735] trunk/Source/WebCore
- Revision
- 91735
- Author
- [email protected]
- Date
- 2011-07-25 18:07:32 -0700 (Mon, 25 Jul 2011)
Log Message
Refactor ScrollableArea pinned predicates to be more generally useful
<rdar://problem/9740379>
Reviewed by Dan Bernstein.
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::isPinnedInBothDirections):
(WebCore::ScrollableArea::isPinnedHorizontallyInDirection):
(WebCore::ScrollableArea::isPinnedVerticallyInDirection):
* platform/ScrollableArea.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (91734 => 91735)
--- trunk/Source/WebCore/ChangeLog 2011-07-26 01:04:49 UTC (rev 91734)
+++ trunk/Source/WebCore/ChangeLog 2011-07-26 01:07:32 UTC (rev 91735)
@@ -1,3 +1,16 @@
+2011-07-25 Sam Weinig <[email protected]>
+
+ Refactor ScrollableArea pinned predicates to be more generally useful
+ <rdar://problem/9740379>
+
+ Reviewed by Dan Bernstein.
+
+ * platform/ScrollableArea.cpp:
+ (WebCore::ScrollableArea::isPinnedInBothDirections):
+ (WebCore::ScrollableArea::isPinnedHorizontallyInDirection):
+ (WebCore::ScrollableArea::isPinnedVerticallyInDirection):
+ * platform/ScrollableArea.h:
+
2011-07-25 Nico Weber <[email protected]>
[chromium] components/mac: Make webcore not depend on CoreAnimation
Modified: trunk/Source/WebCore/platform/ScrollableArea.cpp (91734 => 91735)
--- trunk/Source/WebCore/platform/ScrollableArea.cpp 2011-07-26 01:04:49 UTC (rev 91734)
+++ trunk/Source/WebCore/platform/ScrollableArea.cpp 2011-07-26 01:07:32 UTC (rev 91735)
@@ -227,18 +227,26 @@
}
}
-bool ScrollableArea::isPinnedInDirection(const IntSize& scrollDelta) const
+bool ScrollableArea::isPinnedInBothDirections(const IntSize& scrollDelta) const
{
- if (scrollDelta.width() < 0 && isHorizontalScrollerPinnedToMinimumPosition())
+ return isPinnedHorizontallyInDirection(scrollDelta.width()) && isPinnedVerticallyInDirection(scrollDelta.height());
+}
+
+bool ScrollableArea::isPinnedHorizontallyInDirection(int horizontalScrollDelta) const
+{
+ if (horizontalScrollDelta < 0 && isHorizontalScrollerPinnedToMinimumPosition())
return true;
- if (scrollDelta.width() > 0 && isHorizontalScrollerPinnedToMaximumPosition())
+ if (horizontalScrollDelta > 0 && isHorizontalScrollerPinnedToMaximumPosition())
return true;
+ return false;
+}
- if (scrollDelta.height() < 0 && isVerticalScrollerPinnedToMinimumPosition())
+bool ScrollableArea::isPinnedVerticallyInDirection(int verticalScrollDelta) const
+{
+ if (verticalScrollDelta < 0 && isVerticalScrollerPinnedToMinimumPosition())
return true;
- if (scrollDelta.height() > 0 && isVerticalScrollerPinnedToMaximumPosition())
+ if (verticalScrollDelta > 0 && isVerticalScrollerPinnedToMaximumPosition())
return true;
-
return false;
}
Modified: trunk/Source/WebCore/platform/ScrollableArea.h (91734 => 91735)
--- trunk/Source/WebCore/platform/ScrollableArea.h 2011-07-26 01:04:49 UTC (rev 91734)
+++ trunk/Source/WebCore/platform/ScrollableArea.h 2011-07-26 01:07:32 UTC (rev 91735)
@@ -148,7 +148,9 @@
// Note that this only returns scrollable areas that can actually be scrolled.
virtual ScrollableArea* enclosingScrollableArea() const = 0;
- bool isPinnedInDirection(const IntSize&) const;
+ bool isPinnedInBothDirections(const IntSize&) const;
+ bool isPinnedHorizontallyInDirection(int horizontalScrollDelta) const;
+ bool isPinnedVerticallyInDirection(int verticalScrollDelta) const;
virtual bool shouldRubberBandInDirection(ScrollDirection) const { return true; }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes