RESOLVED FIXED 30034
caretRangeFromPoint() returns wrong result for a zoomed and scrolled page
https://bugs.webkit.org/show_bug.cgi?id=30034
Summary caretRangeFromPoint() returns wrong result for a zoomed and scrolled page
Xiaomei Ji
Reported 2009-10-02 16:25:37 PDT
Created attachment 40556 [details] test case Steps: 1. Open the attached HTML 2. click mouse somewhere to show the offset of mouse within the element 3. zoom the page *and* resize the window to make the page scroll 4. scroll the page horizontally and/or vertically, 5. click mouse in the same place as step 2., observe the printed offset. Results: the printd offset is different when page is zoomed and scrolled. Expected: the printed offset should be the same. Problem: in Document.caretRangeFromPoint() IntPoint point = roundedIntPoint(FloatPoint(x * zoomFactor, y * zoomFactor)) + view()->scrollOffset(); should be: IntPoint point = roundedIntPoint(FloatPoint((x + view()->scrollX()) * zoomFactor, (y + view()->scrollY()) * zoomFactor)); Note: Same bug applies to elementFromPoint() as well.
Attachments
test case (1.38 KB, text/html)
2009-10-02 16:25 PDT, Xiaomei Ji
no flags
patch w/ layout test (9.29 KB, patch)
2009-10-07 10:08 PDT, Xiaomei Ji
no flags
Xiaomei Ji
Comment 1 2009-10-07 10:08:20 PDT
Created attachment 40802 [details] patch w/ layout test
Eric Seidel (no email)
Comment 2 2009-10-07 12:06:59 PDT
Sam's your best bet. Why don't we have a zoomAndPanTransform() accessor on the document and just map points through that. It seems using TransformationMatrix and IntPoint would make this code (which we have lots of) much less error prone.
WebKit Commit Bot
Comment 3 2009-10-12 19:06:31 PDT
Comment on attachment 40802 [details] patch w/ layout test Rejecting patch 40802 from commit-queue. Failed to run "['WebKitTools/Scripts/run-webkit-tests', '--no-launch-safari', '--quiet', '--exit-after-n-failures=1']" exit_code: 1 Running build-dumprendertree Running tests from /Users/eseidel/Projects/CommitQueue/LayoutTests Testing 11423 test cases. fast/dom/prototype-inheritance-2.html -> failed Exiting early after 1 failures. 5497 tests run. 253.83s total testing time 5496 test cases (99%) succeeded 1 test case (<1%) had incorrect layout 1 test case (<1%) had stderr output
Eric Seidel (no email)
Comment 4 2009-10-12 19:11:58 PDT
Comment on attachment 40802 [details] patch w/ layout test Sorry. The bots were behind. bug 30098. This is a false rejection. Trying again.
WebKit Commit Bot
Comment 5 2009-10-12 21:59:44 PDT
Comment on attachment 40802 [details] patch w/ layout test Clearing flags on attachment: 40802 Committed r49490: <http://trac.webkit.org/changeset/49490>
WebKit Commit Bot
Comment 6 2009-10-12 21:59:48 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.