Changeset 49490 in webkit
- Timestamp:
- Oct 12, 2009 9:59:36 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r49489 r49490 1 2009-10-12 Xiaomei Ji <xji@chromium.org> 2 3 Reviewed by Sam Weinig. 4 5 Fix issue caretRangeFromPoint() returns wrong result for a zoomed and 6 scrolled page. 7 https://bugs.webkit.org/show_bug.cgi?id=30034 8 9 * fast/dom/Document/CaretRangeFromPoint/hittest-relative-to-viewport-expected.txt: 10 * fast/dom/Document/CaretRangeFromPoint/hittest-relative-to-viewport.html: 11 * fast/dom/elementFromPoint-relative-to-viewport-expected.txt: 12 * fast/dom/elementFromPoint-relative-to-viewport.html: 13 1 14 2009-10-12 Fumitoshi Ukai <ukai@chromium.org> 2 15 -
trunk/LayoutTests/fast/dom/Document/CaretRangeFromPoint/hittest-relative-to-viewport-expected.txt
r48398 r49490 22 22 PASS Range.startOffset check (got 14, expected 14) 23 23 24 PASS Range.startContainer check (got [object Text], expected [object Text]) 25 PASS Range.startOffset check (got 1, expected 1) 26 PASS Range.startContainer check (got [object Text], expected [object Text]) 27 PASS Range.startOffset check (got 7, expected 7) 28 PASS Range.startContainer check (got [object Text], expected [object Text]) 29 PASS Range.startOffset check (got 3, expected 3) 30 PASS Range.startContainer check (got [object Text], expected [object Text]) 31 PASS Range.startOffset check (got 9, expected 9) 32 24 33 PASS successfullyParsed is true 25 34 -
trunk/LayoutTests/fast/dom/Document/CaretRangeFromPoint/hittest-relative-to-viewport.html
r48398 r49490 32 32 elementBottom = document.getElementById('test-bottom'); 33 33 34 function testsWithBaseline(baselinePos, expectedContainer ) {34 function testsWithBaseline(baselinePos, expectedContainer, zoomOrNot) { 35 35 function test(expectedOffset, scrollByX, scrollByY) { 36 36 var hitPosition = { x: 15, y: 15 }, … … 65 65 } 66 66 67 test(0, 0, 0); 68 test(12, 0, 25); 69 test(2, 25, 0); 70 test(14, 25, 25); 67 if (zoomOrNot == "zoom") { 68 test(1, 0, 0); 69 test(7, 0, 25); 70 test(3, 50, 0); 71 test(9, 50, 25); 72 } else { 73 test(0, 0, 0); 74 test(12, 0, 25); 75 test(2, 25, 0); 76 test(14, 25, 25); 77 } 78 71 79 debug(" "); 72 80 } … … 79 87 80 88 // Testing inside initial containing block (top left) 81 testsWithBaseline(topBaseline, elementTop.firstChild );89 testsWithBaseline(topBaseline, elementTop.firstChild, "none"); 82 90 83 91 // Testing outside initial containing block (mid-page) 84 testsWithBaseline(bottomBaseline, elementBottom.firstChild); 92 testsWithBaseline(bottomBaseline, elementBottom.firstChild, "none"); 93 94 eventSender.zoomPageOut(); 95 testsWithBaseline(topBaseline, elementTop.firstChild, "zoom"); 85 96 86 97 if (window.layoutTestController) { -
trunk/LayoutTests/fast/dom/elementFromPoint-relative-to-viewport-expected.txt
r48398 r49490 5 5 6 6 PASS unscrolledBoxInitial is '0' 7 PASS scrolledDownBoxInitial is ' 15'7 PASS scrolledDownBoxInitial is '5' 8 8 PASS scrolledRightBoxInitial is '3' 9 PASS scrolledDownAndRightBoxInitial is ' 18'9 PASS scrolledDownAndRightBoxInitial is '8' 10 10 PASS unscrolledBoxOffscreen is '0' 11 PASS scrolledDownBoxOffscreen is ' 15'11 PASS scrolledDownBoxOffscreen is '5' 12 12 PASS scrolledRightBoxOffscreen is '3' 13 PASS scrolledDownAndRightBoxOffscreen is '18' 13 PASS scrolledDownAndRightBoxOffscreen is '8' 14 PASS unscrolledBoxInitial is '0' 15 PASS scrolledDownBoxInitial is '5' 16 PASS scrolledRightBoxInitial is '2' 17 PASS scrolledDownAndRightBoxInitial is '7' 14 18 PASS successfullyParsed is true 15 19 -
trunk/LayoutTests/fast/dom/elementFromPoint-relative-to-viewport.html
r48398 r49490 40 40 description('This test document.elementFromPoint is evaluated in with respect to the viewport, not the document.'); 41 41 42 function testElement(element, label, offsetX, offsetY ) {42 function testElement(element, label, offsetX, offsetY, zoomOrNot) { 43 43 for (var i = 0; i < 25; ++i) { 44 44 var item = document.createElement("div"); … … 72 72 73 73 // Test scrolling down 74 window[scrolledDownBox] = getFromPoint(0, 50);74 window[scrolledDownBox] = getFromPoint(0, 20); 75 75 76 76 // Test scrolling right … … 78 78 79 79 // Test scrolling down and right 80 window[scrolledDownAndRightBox] = getFromPoint(50, 50);80 window[scrolledDownAndRightBox] = getFromPoint(50, 20); 81 81 82 82 shouldBe(unscrolledBox, "'0'"); 83 shouldBe(scrolledDownBox, "'15'"); 84 shouldBe(scrolledRightBox, "'3'"); 85 shouldBe(scrolledDownAndRightBox, "'18'"); 83 shouldBe(scrolledDownBox, "'5'"); 84 if (zoomOrNot == "zoom") { 85 shouldBe(scrolledRightBox, "'2'"); 86 shouldBe(scrolledDownAndRightBox, "'7'"); 87 } else { 88 shouldBe(scrolledRightBox, "'3'"); 89 shouldBe(scrolledDownAndRightBox, "'8'"); 90 } 86 91 } 87 92 … … 89 94 var elementOffscreen = document.getElementById('test-offscreen'); 90 95 var offset = elementInitial.getBoundingClientRect(); 91 testElement(elementInitial, "Initial", offset.left, offset.top); 92 testElement(elementOffscreen, "Offscreen", offset.left, offset.top + 1100); 96 testElement(elementInitial, "Initial", offset.left, offset.top, "none"); 97 testElement(elementOffscreen, "Offscreen", offset.left, offset.top + 1100, "none"); 98 99 eventSender.zoomPageOut(); 100 testElement(elementInitial, "Initial", offset.left, offset.top, "zoom"); 101 93 102 94 103 if (window.layoutTestController) { -
trunk/WebCore/ChangeLog
r49488 r49490 1 2009-10-12 Xiaomei Ji <xji@chromium.org> 2 3 Reviewed by Sam Weinig. 4 5 Fix issue caretRangeFromPoint() returns wrong result for a zoomed and 6 scrolled page. 7 https://bugs.webkit.org/show_bug.cgi?id=30034 8 9 * dom/Document.cpp: 10 (WebCore::Document::elementFromPoint): calculate the correct point 11 relative to document when the page is zoomed and scrolled. 12 (WebCore::Document::caretRangeFromPoint): calculate the correct point 13 relative to document when the page is zoomed and scrolled. 14 1 15 2009-10-12 Fumitoshi Ukai <ukai@chromium.org> 2 16 -
trunk/WebCore/dom/Document.cpp
r49428 r49490 944 944 945 945 float zoomFactor = frame->pageZoomFactor(); 946 IntPoint point = roundedIntPoint(FloatPoint( x * zoomFactor, y * zoomFactor)) + view()->scrollOffset();946 IntPoint point = roundedIntPoint(FloatPoint((x + view()->scrollX()) * zoomFactor, (y + view()->scrollY()) * zoomFactor)); 947 947 948 948 if (!frameView->visibleContentRect().contains(point)) … … 974 974 975 975 float zoomFactor = frame->pageZoomFactor(); 976 IntPoint point = roundedIntPoint(FloatPoint( x * zoomFactor, y * zoomFactor)) + view()->scrollOffset();976 IntPoint point = roundedIntPoint(FloatPoint((x + view()->scrollX()) * zoomFactor, (y + view()->scrollY()) * zoomFactor)); 977 977 978 978 if (!frameView->visibleContentRect().contains(point))
Note: See TracChangeset
for help on using the changeset viewer.