Title: [141657] trunk/Source/WebKit/chromium
- Revision
- 141657
- Author
- commit-qu...@webkit.org
- Date
- 2013-02-01 15:59:32 -0800 (Fri, 01 Feb 2013)
Log Message
[Chromium] WebWidget::selectionBounds should return the bounds in document space
https://bugs.webkit.org/show_bug.cgi?id=108386
Patch by Chris Hopman <cjhop...@chromium.org> on 2013-02-01
Reviewed by James Robinson.
When in applyPageScaleFactorInCompositor mode, selectionBounds needs
to scale the anchor/focus window points by the pageScaleFactor.
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::selectionBounds):
(WebKit::WebViewImpl::computeScaleAndScrollForFocusedNode):
Modified Paths
Diff
Modified: trunk/Source/WebKit/chromium/ChangeLog (141656 => 141657)
--- trunk/Source/WebKit/chromium/ChangeLog 2013-02-01 23:55:46 UTC (rev 141656)
+++ trunk/Source/WebKit/chromium/ChangeLog 2013-02-01 23:59:32 UTC (rev 141657)
@@ -1,3 +1,17 @@
+2013-02-01 Chris Hopman <cjhop...@chromium.org>
+
+ [Chromium] WebWidget::selectionBounds should return the bounds in document space
+ https://bugs.webkit.org/show_bug.cgi?id=108386
+
+ Reviewed by James Robinson.
+
+ When in applyPageScaleFactorInCompositor mode, selectionBounds needs
+ to scale the anchor/focus window points by the pageScaleFactor.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::selectionBounds):
+ (WebKit::WebViewImpl::computeScaleAndScrollForFocusedNode):
+
2013-02-01 Dominic Mazzoni <dmazz...@google.com>
AX: memoize expensive computation during blocks where tree doesn't change
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (141656 => 141657)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2013-02-01 23:55:46 UTC (rev 141656)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2013-02-01 23:59:32 UTC (rev 141657)
@@ -2367,32 +2367,37 @@
if (!selection)
return false;
- if (selection->isCaret()) {
- anchor = focus = frame->view()->contentsToWindow(selection->absoluteCaretBounds());
- return true;
- }
+ if (selection->isCaret())
+ anchor = focus = selection->absoluteCaretBounds();
+ else {
+ RefPtr<Range> selectedRange = frame->selection()->toNormalizedRange();
+ if (!selectedRange)
+ return false;
- RefPtr<Range> selectedRange = frame->selection()->toNormalizedRange();
- if (!selectedRange)
- return false;
+ RefPtr<Range> range(Range::create(selectedRange->startContainer()->document(),
+ selectedRange->startContainer(),
+ selectedRange->startOffset(),
+ selectedRange->startContainer(),
+ selectedRange->startOffset()));
+ anchor = frame->editor()->firstRectForRange(range.get());
- RefPtr<Range> range(Range::create(selectedRange->startContainer()->document(),
- selectedRange->startContainer(),
- selectedRange->startOffset(),
- selectedRange->startContainer(),
- selectedRange->startOffset()));
- anchor = frame->editor()->firstRectForRange(range.get());
+ range = Range::create(selectedRange->endContainer()->document(),
+ selectedRange->endContainer(),
+ selectedRange->endOffset(),
+ selectedRange->endContainer(),
+ selectedRange->endOffset());
+ focus = frame->editor()->firstRectForRange(range.get());
+ }
- range = Range::create(selectedRange->endContainer()->document(),
- selectedRange->endContainer(),
- selectedRange->endOffset(),
- selectedRange->endContainer(),
- selectedRange->endOffset());
- focus = frame->editor()->firstRectForRange(range.get());
+ IntRect scaledAnchor(frame->view()->contentsToWindow(anchor));
+ IntRect scaledFocus(frame->view()->contentsToWindow(focus));
+ if (m_webSettings->applyPageScaleFactorInCompositor()) {
+ scaledAnchor.scale(pageScaleFactor());
+ scaledFocus.scale(pageScaleFactor());
+ }
+ anchor = scaledAnchor;
+ focus = scaledFocus;
- anchor = frame->view()->contentsToWindow(anchor);
- focus = frame->view()->contentsToWindow(focus);
-
if (!frame->selection()->selection().isBaseFirst())
std::swap(anchor, focus);
return true;
@@ -2780,8 +2785,13 @@
// 'caret' is rect encompassing the blinking cursor.
IntRect textboxRect = focusedNode->document()->view()->contentsToWindow(pixelSnappedIntRect(focusedNode->Node::boundingBox()));
- WebRect caret, end;
- selectionBounds(caret, end);
+ WebRect caret, unusedEnd;
+ selectionBounds(caret, unusedEnd);
+ if (settingsImpl()->applyPageScaleFactorInCompositor()) {
+ IntRect unscaledCaret = caret;
+ unscaledCaret.scale(1 / pageScaleFactor());
+ caret = unscaledCaret;
+ }
// Pick a scale which is reasonably readable. This is the scale at which
// the caret height will become minReadableCaretHeight (adjusted for dpi
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes