diff options
author | Mangesh Ghiware <mghiware@google.com> | 2012-05-12 14:45:53 -0700 |
---|---|---|
committer | Mangesh Ghiware <mghiware@google.com> | 2012-05-12 15:48:31 -0700 |
commit | 0f39f1e7935bcf830614bf1e619b7f787c1859d2 (patch) | |
tree | 23f937967824024758fd3ad91aa5a2d2ea68ac34 /Source/WebKit/android/jni | |
parent | 926da2f4af55f63fdf9bb4b6150babfbe3323cf4 (diff) | |
download | external_webkit-0f39f1e7935bcf830614bf1e619b7f787c1859d2.zip external_webkit-0f39f1e7935bcf830614bf1e619b7f787c1859d2.tar.gz external_webkit-0f39f1e7935bcf830614bf1e619b7f787c1859d2.tar.bz2 |
Use slop to determine the node used for anchoring top/left.
Certain sites use tables for layout and padding elements instead of
standard CSS. If the exact scrollX/Y is used to find the anchor,
hit test result may return an incorrect node. A little bit of slop
helps in finding the correct node, if necessary.
Bug: 5291151
Change-Id: I13e8d2b04ef5049c14c299be42c6699c3d0c945e
Diffstat (limited to 'Source/WebKit/android/jni')
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index e621644..1fe4a1d 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -1164,6 +1164,16 @@ void WebViewCore::setSizeScreenWidthAndScale(int width, int height, m_mainFrame->eventHandler()->hitTestResultAtPoint( anchorPoint, false); node = hitTestResult.innerNode(); + if (node && !node->isTextNode()) { + // If the hitTestResultAtPoint didn't find a suitable node + // for anchoring, try again with some slop. + static const int HIT_SLOP = 30; + anchorPoint.move(HIT_SLOP, HIT_SLOP); + hitTestResult = + m_mainFrame->eventHandler()->hitTestResultAtPoint( + anchorPoint, false); + node = hitTestResult.innerNode(); + } } if (node) { bounds = node->getRect(); |