From 55f4533e6fc4f50a0ac57b1b180276d679aa04fc Mon Sep 17 00:00:00 2001 From: George Mount Date: Tue, 14 Aug 2012 15:24:24 -0700 Subject: Use content size for scroll width calculation. Bug 6976140 Horizontal scrolling calculation requires use of content and not client width. Vertical scrolling uses client width because text areas support padding differently than text inputs. Change-Id: Ib105c6c185415c1784c83f7203810a3e5416a9c8 --- Source/WebKit/android/jni/WebViewCore.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index 3324bfd..fd5e9c4 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -3006,7 +3006,7 @@ void WebViewCore::scrollFocusedTextInput(float xPercent, int y) } int x = (int)round(xPercent * (renderText->scrollWidth() - - renderText->clientWidth())); + renderText->contentWidth())); renderText->setScrollLeft(x); renderText->setScrollTop(y); focus->document()->frame()->selection()->recomputeCaretRect(); @@ -3417,6 +3417,9 @@ WebCore::IntRect WebViewCore::absoluteClientRect(WebCore::Node* node, RenderBox* renderBox = toRenderBox(render); clientRect = renderBox->clientBoxRect(); + IntRect contentBox = renderBox->contentBoxRect(); + clientRect.setX(contentBox.x()); + clientRect.setWidth(contentBox.width()); FloatPoint absPos = renderBox->localToAbsolute(FloatPoint()); clientRect.move(absPos.x() - offset.x(), absPos.y() - offset.y()); } -- cgit v1.1