diff options
Diffstat (limited to 'Source/WebKit/chromium/src/WebRange.cpp')
-rw-r--r-- | Source/WebKit/chromium/src/WebRange.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/WebKit/chromium/src/WebRange.cpp b/Source/WebKit/chromium/src/WebRange.cpp index 05a421251..be24dd793 100644 --- a/Source/WebKit/chromium/src/WebRange.cpp +++ b/Source/WebKit/chromium/src/WebRange.cpp @@ -33,10 +33,12 @@ #include "Document.h" #include "Frame.h" +#include "FrameView.h" #include "Range.h" #include "TextIterator.h" #include "WebFrameImpl.h" #include "WebNode.h" +#include "platform/WebFloatQuad.h" #include "platform/WebString.h" #include <wtf/PassRefPtr.h> @@ -99,6 +101,27 @@ WebRange WebRange::fromDocumentRange(WebFrame* frame, int start, int length) return TextIterator::rangeFromLocationAndLength(scope, start, length); } +WebVector<WebFloatQuad> WebRange::textQuads() const +{ + if (isNull()) + return WebVector<WebFloatQuad>(); + + Frame* frame = m_private->ownerDocument() ? m_private->ownerDocument()->frame() : 0; + if (!frame) + return WebVector<WebFloatQuad>(); + + Vector<FloatQuad> quads; + m_private->textQuads(quads); + for (unsigned i = 0; i < quads.size(); ++i) { + quads[i].setP1(frame->view()->contentsToWindow(roundedIntPoint(quads[i].p1()))); + quads[i].setP2(frame->view()->contentsToWindow(roundedIntPoint(quads[i].p2()))); + quads[i].setP3(frame->view()->contentsToWindow(roundedIntPoint(quads[i].p3()))); + quads[i].setP4(frame->view()->contentsToWindow(roundedIntPoint(quads[i].p4()))); + } + + return quads; +} + WebRange::WebRange(const WTF::PassRefPtr<WebCore::Range>& range) : m_private(static_cast<WebRangePrivate*>(range.leakRef())) { |