summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/layers/IFrameContentLayerAndroid.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/graphics/android/layers/IFrameContentLayerAndroid.cpp')
-rw-r--r--Source/WebCore/platform/graphics/android/layers/IFrameContentLayerAndroid.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/Source/WebCore/platform/graphics/android/layers/IFrameContentLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/layers/IFrameContentLayerAndroid.cpp
new file mode 100644
index 0000000..dadb13d
--- /dev/null
+++ b/Source/WebCore/platform/graphics/android/layers/IFrameContentLayerAndroid.cpp
@@ -0,0 +1,42 @@
+#define LOG_TAG "IFrameContentLayerAndroid"
+#define LOG_NDEBUG 1
+
+#include "config.h"
+#include "IFrameContentLayerAndroid.h"
+
+#include "AndroidLog.h"
+
+#if USE(ACCELERATED_COMPOSITING)
+
+namespace WebCore {
+
+bool IFrameContentLayerAndroid::scrollTo(int x, int y)
+{
+ IntRect scrollBounds;
+ getScrollBounds(&scrollBounds);
+ if (!scrollBounds.width() && !scrollBounds.height())
+ return false;
+ SkScalar newX = SkScalarPin(x, scrollBounds.x(), scrollBounds.width());
+ SkScalar newY = SkScalarPin(y, scrollBounds.y(), scrollBounds.height());
+ // Check for no change.
+ if (newX == m_iframeScrollOffset.x() && newY == m_iframeScrollOffset.y())
+ return false;
+ newX = newX - m_iframeScrollOffset.x();
+ newY = newY - m_iframeScrollOffset.y();
+ setScrollOffset(IntPoint(newX, newY));
+ return true;
+}
+
+void IFrameContentLayerAndroid::getScrollRect(SkIRect* out) const
+{
+ const SkPoint& pos = getPosition();
+ out->fLeft = m_scrollLimits.fLeft - pos.fX + m_iframeScrollOffset.x();
+ out->fTop = m_scrollLimits.fTop - pos.fY + m_iframeScrollOffset.y();
+
+ out->fRight = getSize().width() - m_scrollLimits.width();
+ out->fBottom = getSize().height() - m_scrollLimits.height();
+}
+
+} // namespace WebCore
+
+#endif // USE(ACCELERATED_COMPOSITING)