OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 16 matching lines...) Expand all Loading... |
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 SurroundingText_h | 31 #ifndef SurroundingText_h |
32 #define SurroundingText_h | 32 #define SurroundingText_h |
33 | 33 |
34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
35 #include "core/editing/Position.h" | 35 #include "core/editing/Position.h" |
36 #include "platform/heap/Handle.h" | 36 #include "platform/heap/Handle.h" |
37 #include "wtf/text/WTFString.h" | 37 #include "platform/wtf/text/WTFString.h" |
38 | 38 |
39 namespace blink { | 39 namespace blink { |
40 | 40 |
41 class Range; | 41 class Range; |
42 | 42 |
43 class CORE_EXPORT SurroundingText { | 43 class CORE_EXPORT SurroundingText { |
44 USING_FAST_MALLOC(SurroundingText); | 44 USING_FAST_MALLOC(SurroundingText); |
45 WTF_MAKE_NONCOPYABLE(SurroundingText); | 45 WTF_MAKE_NONCOPYABLE(SurroundingText); |
46 | 46 |
47 public: | 47 public: |
48 SurroundingText(const Range&, unsigned max_length); | 48 SurroundingText(const Range&, unsigned max_length); |
49 SurroundingText(const Position&, unsigned max_length); | 49 SurroundingText(const Position&, unsigned max_length); |
50 | 50 |
51 String Content() const; | 51 String Content() const; |
52 unsigned StartOffsetInContent() const; | 52 unsigned StartOffsetInContent() const; |
53 unsigned EndOffsetInContent() const; | 53 unsigned EndOffsetInContent() const; |
54 | 54 |
55 private: | 55 private: |
56 void Initialize(const Position&, const Position&, unsigned max_length); | 56 void Initialize(const Position&, const Position&, unsigned max_length); |
57 | 57 |
58 Persistent<Range> content_range_; | 58 Persistent<Range> content_range_; |
59 size_t start_offset_in_content_; | 59 size_t start_offset_in_content_; |
60 size_t end_offset_in_content_; | 60 size_t end_offset_in_content_; |
61 }; | 61 }; |
62 | 62 |
63 } // namespace blink | 63 } // namespace blink |
64 | 64 |
65 #endif // SurroundingText_h | 65 #endif // SurroundingText_h |
OLD | NEW |