Changeset 141657 in webkit
- Timestamp:
- Feb 1, 2013, 3:59:32 PM (12 years ago)
- Location:
- trunk/Source/WebKit/chromium
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/chromium/ChangeLog
r141655 r141657 1 2013-02-01 Chris Hopman <cjhopman@chromium.org> 2 3 [Chromium] WebWidget::selectionBounds should return the bounds in document space 4 https://bugs.webkit.org/show_bug.cgi?id=108386 5 6 Reviewed by James Robinson. 7 8 When in applyPageScaleFactorInCompositor mode, selectionBounds needs 9 to scale the anchor/focus window points by the pageScaleFactor. 10 11 * src/WebViewImpl.cpp: 12 (WebKit::WebViewImpl::selectionBounds): 13 (WebKit::WebViewImpl::computeScaleAndScrollForFocusedNode): 14 1 15 2013-02-01 Dominic Mazzoni <dmazzoni@google.com> 2 16 -
trunk/Source/WebKit/chromium/src/WebViewImpl.cpp
r141540 r141657 2368 2368 return false; 2369 2369 2370 if (selection->isCaret()) { 2371 anchor = focus = frame->view()->contentsToWindow(selection->absoluteCaretBounds()); 2372 return true; 2373 } 2374 2375 RefPtr<Range> selectedRange = frame->selection()->toNormalizedRange(); 2376 if (!selectedRange) 2377 return false; 2378 2379 RefPtr<Range> range(Range::create(selectedRange->startContainer()->document(), 2380 selectedRange->startContainer(), 2381 selectedRange->startOffset(), 2382 selectedRange->startContainer(), 2383 selectedRange->startOffset())); 2384 anchor = frame->editor()->firstRectForRange(range.get()); 2385 2386 range = Range::create(selectedRange->endContainer()->document(), 2387 selectedRange->endContainer(), 2388 selectedRange->endOffset(), 2389 selectedRange->endContainer(), 2390 selectedRange->endOffset()); 2391 focus = frame->editor()->firstRectForRange(range.get()); 2392 2393 anchor = frame->view()->contentsToWindow(anchor); 2394 focus = frame->view()->contentsToWindow(focus); 2370 if (selection->isCaret()) 2371 anchor = focus = selection->absoluteCaretBounds(); 2372 else { 2373 RefPtr<Range> selectedRange = frame->selection()->toNormalizedRange(); 2374 if (!selectedRange) 2375 return false; 2376 2377 RefPtr<Range> range(Range::create(selectedRange->startContainer()->document(), 2378 selectedRange->startContainer(), 2379 selectedRange->startOffset(), 2380 selectedRange->startContainer(), 2381 selectedRange->startOffset())); 2382 anchor = frame->editor()->firstRectForRange(range.get()); 2383 2384 range = Range::create(selectedRange->endContainer()->document(), 2385 selectedRange->endContainer(), 2386 selectedRange->endOffset(), 2387 selectedRange->endContainer(), 2388 selectedRange->endOffset()); 2389 focus = frame->editor()->firstRectForRange(range.get()); 2390 } 2391 2392 IntRect scaledAnchor(frame->view()->contentsToWindow(anchor)); 2393 IntRect scaledFocus(frame->view()->contentsToWindow(focus)); 2394 if (m_webSettings->applyPageScaleFactorInCompositor()) { 2395 scaledAnchor.scale(pageScaleFactor()); 2396 scaledFocus.scale(pageScaleFactor()); 2397 } 2398 anchor = scaledAnchor; 2399 focus = scaledFocus; 2395 2400 2396 2401 if (!frame->selection()->selection().isBaseFirst()) … … 2781 2786 // 'caret' is rect encompassing the blinking cursor. 2782 2787 IntRect textboxRect = focusedNode->document()->view()->contentsToWindow(pixelSnappedIntRect(focusedNode->Node::boundingBox())); 2783 WebRect caret, end; 2784 selectionBounds(caret, end); 2788 WebRect caret, unusedEnd; 2789 selectionBounds(caret, unusedEnd); 2790 if (settingsImpl()->applyPageScaleFactorInCompositor()) { 2791 IntRect unscaledCaret = caret; 2792 unscaledCaret.scale(1 / pageScaleFactor()); 2793 caret = unscaledCaret; 2794 } 2785 2795 2786 2796 // Pick a scale which is reasonably readable. This is the scale at which
Note:
See TracChangeset
for help on using the changeset viewer.