Chromium Code Reviews| 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 13 matching lines...) Expand all Loading... | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef WebRange_h | 31 #ifndef WebRange_h |
| 32 #define WebRange_h | 32 #define WebRange_h |
| 33 | 33 |
| 34 #include "../platform/WebCommon.h" | |
| 35 #include "../platform/WebVector.h" | |
| 36 #include "WebFrame.h" | 34 #include "WebFrame.h" |
| 35 #include "public/platform/WebCommon.h" | |
| 36 #include "public/platform/WebPrivatePtr.h" | |
| 37 #include "public/platform/WebVector.h" | |
| 37 | 38 |
| 38 #if BLINK_IMPLEMENTATION | |
| 39 namespace WebCore { class Range; } | 39 namespace WebCore { class Range; } |
| 40 namespace WTF { template <typename T> class PassRefPtr; } | |
| 41 #endif | |
| 42 | 40 |
| 43 namespace blink { | 41 namespace blink { |
| 44 | 42 |
| 45 struct WebFloatQuad; | 43 struct WebFloatQuad; |
| 46 class WebNode; | 44 class WebNode; |
| 47 class WebRangePrivate; | |
| 48 class WebString; | 45 class WebString; |
| 49 | 46 |
| 50 // Provides readonly access to some properties of a DOM range. | 47 // Provides readonly access to some properties of a DOM range. |
| 51 class WebRange { | 48 class WebRange { |
| 52 public: | 49 public: |
| 53 ~WebRange() { reset(); } | 50 ~WebRange() { reset(); } |
| 54 | 51 |
| 55 WebRange() : m_private(0) { } | 52 WebRange() { } |
| 56 WebRange(const WebRange& r) : m_private(0) { assign(r); } | 53 WebRange(const WebRange& r) { assign(r); } |
| 57 WebRange& operator=(const WebRange& r) | 54 WebRange& operator=(const WebRange& r) |
| 58 { | 55 { |
| 59 assign(r); | 56 assign(r); |
| 60 return *this; | 57 return *this; |
| 61 } | 58 } |
| 62 | 59 |
| 63 BLINK_EXPORT void reset(); | 60 BLINK_EXPORT void reset(); |
| 64 BLINK_EXPORT void assign(const WebRange&); | 61 BLINK_EXPORT void assign(const WebRange&); |
| 65 | 62 |
| 66 bool isNull() const { return !m_private; } | 63 bool isNull() const { return m_private.isNull(); } |
|
haraken
2014/04/04 02:30:19
If we forget to change this, is there any way to n
sof
2014/04/04 07:33:23
If I understand your question correctly, then yes
| |
| 67 | 64 |
| 68 BLINK_EXPORT int startOffset() const; | 65 BLINK_EXPORT int startOffset() const; |
| 69 BLINK_EXPORT int endOffset() const; | 66 BLINK_EXPORT int endOffset() const; |
| 70 BLINK_EXPORT WebNode startContainer(int& exceptionCode) const; | 67 BLINK_EXPORT WebNode startContainer(int& exceptionCode) const; |
| 71 BLINK_EXPORT WebNode endContainer(int& exceptionCode) const; | 68 BLINK_EXPORT WebNode endContainer(int& exceptionCode) const; |
| 72 | 69 |
| 73 BLINK_EXPORT WebString toHTMLText() const; | 70 BLINK_EXPORT WebString toHTMLText() const; |
| 74 BLINK_EXPORT WebString toPlainText() const; | 71 BLINK_EXPORT WebString toPlainText() const; |
| 75 | 72 |
| 76 BLINK_EXPORT WebRange expandedToParagraph() const; | 73 BLINK_EXPORT WebRange expandedToParagraph() const; |
| 77 | 74 |
| 78 BLINK_EXPORT static WebRange fromDocumentRange(WebLocalFrame*, int start, in t length); | 75 BLINK_EXPORT static WebRange fromDocumentRange(WebLocalFrame*, int start, in t length); |
| 79 | 76 |
| 80 BLINK_EXPORT WebVector<WebFloatQuad> textQuads() const; | 77 BLINK_EXPORT WebVector<WebFloatQuad> textQuads() const; |
| 81 | 78 |
| 82 #if BLINK_IMPLEMENTATION | 79 #if BLINK_IMPLEMENTATION |
| 83 WebRange(const WTF::PassRefPtr<WebCore::Range>&); | 80 WebRange(const PassRefPtrWillBeRawPtr<WebCore::Range>&); |
| 84 WebRange& operator=(const WTF::PassRefPtr<WebCore::Range>&); | 81 operator PassRefPtrWillBeRawPtr<WebCore::Range>() const; |
| 85 operator WTF::PassRefPtr<WebCore::Range>() const; | |
| 86 #endif | 82 #endif |
| 87 | 83 |
| 88 private: | 84 private: |
| 89 void assign(WebRangePrivate*); | 85 WebPrivatePtr<WebCore::Range> m_private; |
| 90 WebRangePrivate* m_private; | |
| 91 }; | 86 }; |
| 92 | 87 |
| 93 } // namespace blink | 88 } // namespace blink |
| 94 | 89 |
| 95 #endif | 90 #endif |
| OLD | NEW |