blob: dadb13d1ae0457e8d8cab9bc58af8441e2c3dd74 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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)
|