1 #define LOG_TAG "IFrameContentLayerAndroid" 2 #define LOG_NDEBUG 1 3 4 #include "config.h" 5 #include "IFrameContentLayerAndroid.h" 6 7 #include "AndroidLog.h" 8 9 #if USE(ACCELERATED_COMPOSITING) 10 11 namespace WebCore { 12 13 bool IFrameContentLayerAndroid::scrollTo(int x, int y) 14 { 15 IntRect scrollBounds; 16 getScrollBounds(&scrollBounds); 17 if (!scrollBounds.width() && !scrollBounds.height()) 18 return false; 19 SkScalar newX = SkScalarPin(x, scrollBounds.x(), scrollBounds.width()); 20 SkScalar newY = SkScalarPin(y, scrollBounds.y(), scrollBounds.height()); 21 // Check for no change. 22 if (newX == m_iframeScrollOffset.x() && newY == m_iframeScrollOffset.y()) 23 return false; 24 newX = newX - m_iframeScrollOffset.x(); 25 newY = newY - m_iframeScrollOffset.y(); 26 setScrollOffset(IntPoint(newX, newY)); 27 return true; 28 } 29 30 void IFrameContentLayerAndroid::getScrollRect(SkIRect* out) const 31 { 32 const SkPoint& pos = getPosition(); 33 out->fLeft = m_scrollLimits.fLeft - pos.fX + m_iframeScrollOffset.x(); 34 out->fTop = m_scrollLimits.fTop - pos.fY + m_iframeScrollOffset.y(); 35 36 out->fRight = m_scrollLimits.width(); 37 out->fBottom = m_scrollLimits.height(); 38 } 39 40 } // namespace WebCore 41 42 #endif // USE(ACCELERATED_COMPOSITING) 43