| 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 23 matching lines...) Expand all Loading... |
| 34 #include "WebCommon.h" | 34 #include "WebCommon.h" |
| 35 | 35 |
| 36 #if WEBKIT_IMPLEMENTATION | 36 #if WEBKIT_IMPLEMENTATION |
| 37 namespace WebCore { class Range; } | 37 namespace WebCore { class Range; } |
| 38 namespace WTF { template <typename T> class PassRefPtr; } | 38 namespace WTF { template <typename T> class PassRefPtr; } |
| 39 #endif | 39 #endif |
| 40 | 40 |
| 41 namespace WebKit { | 41 namespace WebKit { |
| 42 class WebNode; | 42 class WebNode; |
| 43 class WebRangePrivate; | 43 class WebRangePrivate; |
| 44 class WebString; |
| 44 | 45 |
| 45 // Provides readonly access to some properties of a DOM range. | 46 // Provides readonly access to some properties of a DOM range. |
| 46 class WebRange { | 47 class WebRange { |
| 47 public: | 48 public: |
| 48 ~WebRange() { reset(); } | 49 ~WebRange() { reset(); } |
| 49 | 50 |
| 50 WebRange() : m_private(0) { } | 51 WebRange() : m_private(0) { } |
| 51 WebRange(const WebRange& r) : m_private(0) { assign(r); } | 52 WebRange(const WebRange& r) : m_private(0) { assign(r); } |
| 52 WebRange& operator=(const WebRange& r) { assign(r); return *this; } | 53 WebRange& operator=(const WebRange& r) { assign(r); return *this; } |
| 53 | 54 |
| 54 WEBKIT_API void reset(); | 55 WEBKIT_API void reset(); |
| 55 WEBKIT_API void assign(const WebRange&); | 56 WEBKIT_API void assign(const WebRange&); |
| 56 | 57 |
| 57 bool isNull() const { return m_private == 0; } | 58 bool isNull() const { return m_private == 0; } |
| 58 | 59 |
| 59 WEBKIT_API int startOffset() const; | 60 WEBKIT_API int startOffset() const; |
| 60 WEBKIT_API int endOffset() const; | 61 WEBKIT_API int endOffset() const; |
| 61 WEBKIT_API WebNode startContainer(int& exceptionCode) const; | 62 WEBKIT_API WebNode startContainer(int& exceptionCode) const; |
| 62 WEBKIT_API WebNode endContainer(int& exceptionCode) const; | 63 WEBKIT_API WebNode endContainer(int& exceptionCode) const; |
| 63 | 64 |
| 65 WEBKIT_API WebString toHTMLText() const; |
| 66 WEBKIT_API WebString toPlainText() const; |
| 67 |
| 64 #if WEBKIT_IMPLEMENTATION | 68 #if WEBKIT_IMPLEMENTATION |
| 65 WebRange(const WTF::PassRefPtr<WebCore::Range>&); | 69 WebRange(const WTF::PassRefPtr<WebCore::Range>&); |
| 66 WebRange& operator=(const WTF::PassRefPtr<WebCore::Range>&); | 70 WebRange& operator=(const WTF::PassRefPtr<WebCore::Range>&); |
| 67 operator WTF::PassRefPtr<WebCore::Range>() const; | 71 operator WTF::PassRefPtr<WebCore::Range>() const; |
| 68 #endif | 72 #endif |
| 69 | 73 |
| 70 private: | 74 private: |
| 71 void assign(WebRangePrivate*); | 75 void assign(WebRangePrivate*); |
| 72 WebRangePrivate* m_private; | 76 WebRangePrivate* m_private; |
| 73 }; | 77 }; |
| 74 | 78 |
| 75 } // namespace WebKit | 79 } // namespace WebKit |
| 76 | 80 |
| 77 #endif | 81 #endif |
| OLD | NEW |