| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 #include "core/editing/PlainTextRange.h" | 41 #include "core/editing/PlainTextRange.h" |
| 42 #include "core/frame/FrameView.h" | 42 #include "core/frame/FrameView.h" |
| 43 #include "core/frame/LocalFrame.h" | 43 #include "core/frame/LocalFrame.h" |
| 44 #include "public/platform/WebFloatQuad.h" | 44 #include "public/platform/WebFloatQuad.h" |
| 45 #include "public/platform/WebString.h" | 45 #include "public/platform/WebString.h" |
| 46 #include "public/web/WebExceptionCode.h" | 46 #include "public/web/WebExceptionCode.h" |
| 47 #include "public/web/WebNode.h" | 47 #include "public/web/WebNode.h" |
| 48 #include "web/WebLocalFrameImpl.h" | 48 #include "web/WebLocalFrameImpl.h" |
| 49 #include "wtf/PassRefPtr.h" | 49 #include "wtf/PassRefPtr.h" |
| 50 | 50 |
| 51 using namespace WebCore; | 51 using namespace blink; |
| 52 | 52 |
| 53 namespace blink { | 53 namespace blink { |
| 54 | 54 |
| 55 void WebRange::reset() | 55 void WebRange::reset() |
| 56 { | 56 { |
| 57 m_private.reset(); | 57 m_private.reset(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void WebRange::assign(const WebRange& other) | 60 void WebRange::assign(const WebRange& other) |
| 61 { | 61 { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 WebRange WebRange::expandedToParagraph() const | 101 WebRange WebRange::expandedToParagraph() const |
| 102 { | 102 { |
| 103 WebRange copy(*this); | 103 WebRange copy(*this); |
| 104 copy.m_private->expand("block", IGNORE_EXCEPTION); | 104 copy.m_private->expand("block", IGNORE_EXCEPTION); |
| 105 return copy; | 105 return copy; |
| 106 } | 106 } |
| 107 | 107 |
| 108 // static | 108 // static |
| 109 WebRange WebRange::fromDocumentRange(WebLocalFrame* frame, int start, int length
) | 109 WebRange WebRange::fromDocumentRange(WebLocalFrame* frame, int start, int length
) |
| 110 { | 110 { |
| 111 WebCore::LocalFrame* webFrame = toWebLocalFrameImpl(frame)->frame(); | 111 blink::LocalFrame* webFrame = toWebLocalFrameImpl(frame)->frame(); |
| 112 Element* selectionRoot = webFrame->selection().rootEditableElement(); | 112 Element* selectionRoot = webFrame->selection().rootEditableElement(); |
| 113 ContainerNode* scope = selectionRoot ? selectionRoot : webFrame->document()-
>documentElement(); | 113 ContainerNode* scope = selectionRoot ? selectionRoot : webFrame->document()-
>documentElement(); |
| 114 return PlainTextRange(start, start + length).createRange(*scope); | 114 return PlainTextRange(start, start + length).createRange(*scope); |
| 115 } | 115 } |
| 116 | 116 |
| 117 WebVector<WebFloatQuad> WebRange::textQuads() const | 117 WebVector<WebFloatQuad> WebRange::textQuads() const |
| 118 { | 118 { |
| 119 if (isNull()) | 119 if (isNull()) |
| 120 return WebVector<WebFloatQuad>(); | 120 return WebVector<WebFloatQuad>(); |
| 121 | 121 |
| 122 LocalFrame* frame = m_private->ownerDocument().frame(); | 122 LocalFrame* frame = m_private->ownerDocument().frame(); |
| 123 if (!frame) | 123 if (!frame) |
| 124 return WebVector<WebFloatQuad>(); | 124 return WebVector<WebFloatQuad>(); |
| 125 | 125 |
| 126 Vector<FloatQuad> quads; | 126 Vector<FloatQuad> quads; |
| 127 m_private->textQuads(quads); | 127 m_private->textQuads(quads); |
| 128 for (unsigned i = 0; i < quads.size(); ++i) { | 128 for (unsigned i = 0; i < quads.size(); ++i) { |
| 129 quads[i].setP1(frame->view()->contentsToWindow(roundedIntPoint(quads[i].
p1()))); | 129 quads[i].setP1(frame->view()->contentsToWindow(roundedIntPoint(quads[i].
p1()))); |
| 130 quads[i].setP2(frame->view()->contentsToWindow(roundedIntPoint(quads[i].
p2()))); | 130 quads[i].setP2(frame->view()->contentsToWindow(roundedIntPoint(quads[i].
p2()))); |
| 131 quads[i].setP3(frame->view()->contentsToWindow(roundedIntPoint(quads[i].
p3()))); | 131 quads[i].setP3(frame->view()->contentsToWindow(roundedIntPoint(quads[i].
p3()))); |
| 132 quads[i].setP4(frame->view()->contentsToWindow(roundedIntPoint(quads[i].
p4()))); | 132 quads[i].setP4(frame->view()->contentsToWindow(roundedIntPoint(quads[i].
p4()))); |
| 133 } | 133 } |
| 134 | 134 |
| 135 return quads; | 135 return quads; |
| 136 } | 136 } |
| 137 | 137 |
| 138 WebRange::WebRange(const PassRefPtrWillBeRawPtr<WebCore::Range>& range) | 138 WebRange::WebRange(const PassRefPtrWillBeRawPtr<blink::Range>& range) |
| 139 : m_private(range) | 139 : m_private(range) |
| 140 { | 140 { |
| 141 } | 141 } |
| 142 | 142 |
| 143 WebRange::operator PassRefPtrWillBeRawPtr<WebCore::Range>() const | 143 WebRange::operator PassRefPtrWillBeRawPtr<blink::Range>() const |
| 144 { | 144 { |
| 145 return m_private.get(); | 145 return m_private.get(); |
| 146 } | 146 } |
| 147 | 147 |
| 148 } // namespace blink | 148 } // namespace blink |
| OLD | NEW |