Bug 30034

Summary: caretRangeFromPoint() returns wrong result for a zoomed and scrolled page
Product: WebKit Reporter: Xiaomei Ji <xji>
Component: DOMAssignee: Nobody <webkit-unassigned>
Severity: Normal CC: commit-queue, eric, jshin, mjs, sam, simon.fraser, xji
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Description Flags
test case
patch w/ layout test none

Description Xiaomei Ji 2009-10-02 16:25:37 PDT
Created attachment 40556 [details]
test case

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.

the printd offset is different when page is zoomed and scrolled.

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));

Same bug applies to elementFromPoint() as well.
Comment 1 Xiaomei Ji 2009-10-07 10:08:20 PDT
Created attachment 40802 [details]
patch w/ layout test
Comment 2 Eric Seidel (no email) 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.
Comment 3 WebKit Commit Bot 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
Comment 4 Eric Seidel (no email) 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.
Comment 5 WebKit Commit Bot 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>
Comment 6 WebKit Commit Bot 2009-10-12 21:59:48 PDT
All reviewed patches have been landed.  Closing bug.