| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #ifndef PlainTextRange_h | 26 #ifndef PlainTextRange_h |
| 27 #define PlainTextRange_h | 27 #define PlainTextRange_h |
| 28 | 28 |
| 29 #include "platform/heap/Handle.h" | 29 #include "platform/heap/Handle.h" |
| 30 #include "wtf/NotFound.h" | 30 #include "wtf/NotFound.h" |
| 31 #include "wtf/PassRefPtr.h" | 31 #include "wtf/PassRefPtr.h" |
| 32 | 32 |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 class ContainerNode; | 35 class ContainerNode; |
| 36 class Node; | |
| 37 class Range; | 36 class Range; |
| 38 | 37 |
| 39 class PlainTextRange { | 38 class PlainTextRange { |
| 40 public: | 39 public: |
| 41 PlainTextRange(); | 40 PlainTextRange(); |
| 42 PlainTextRange(const PlainTextRange&); | 41 PlainTextRange(const PlainTextRange&); |
| 43 explicit PlainTextRange(int location); | 42 explicit PlainTextRange(int location); |
| 44 PlainTextRange(int start, int end); | 43 PlainTextRange(int start, int end); |
| 45 | 44 |
| 46 size_t end() const { ASSERT(!isNull()); return m_end; } | 45 size_t end() const { ASSERT(!isNull()); return m_end; } |
| 47 size_t start() const { ASSERT(!isNull()); return m_start; } | 46 size_t start() const { ASSERT(!isNull()); return m_start; } |
| 48 bool isNull() const { return m_start == kNotFound; } | 47 bool isNull() const { return m_start == kNotFound; } |
| 49 bool isNotNull() const { return m_start != kNotFound; } | 48 bool isNotNull() const { return m_start != kNotFound; } |
| 50 size_t length() const { ASSERT(!isNull()); return m_end - m_start; } | 49 size_t length() const { ASSERT(!isNull()); return m_end - m_start; } |
| 51 | 50 |
| 52 PassRefPtrWillBeRawPtr<Range> createRange(const ContainerNode& scope) const; | 51 PassRefPtrWillBeRawPtr<Range> createRange(const ContainerNode& scope) const; |
| 53 PassRefPtrWillBeRawPtr<Range> createRangeForSelection(const ContainerNode& s
cope) const; | 52 PassRefPtrWillBeRawPtr<Range> createRangeForSelection(const ContainerNode& s
cope) const; |
| 54 | 53 |
| 55 static PlainTextRange create(const Node& scope, const Range&); | 54 static PlainTextRange create(const ContainerNode& scope, const Range&); |
| 56 | 55 |
| 57 private: | 56 private: |
| 58 PlainTextRange& operator=(const PlainTextRange&) WTF_DELETED_FUNCTION; | 57 PlainTextRange& operator=(const PlainTextRange&) WTF_DELETED_FUNCTION; |
| 59 | 58 |
| 60 enum GetRangeFor { ForGeneric, ForSelection }; | 59 enum GetRangeFor { ForGeneric, ForSelection }; |
| 61 PassRefPtrWillBeRawPtr<Range> createRangeFor(const ContainerNode& scope, Get
RangeFor) const; | 60 PassRefPtrWillBeRawPtr<Range> createRangeFor(const ContainerNode& scope, Get
RangeFor) const; |
| 62 | 61 |
| 63 const size_t m_start; | 62 const size_t m_start; |
| 64 const size_t m_end; | 63 const size_t m_end; |
| 65 }; | 64 }; |
| 66 | 65 |
| 67 } // namespace blink | 66 } // namespace blink |
| 68 | 67 |
| 69 #endif // PlainTextRange_h | 68 #endif // PlainTextRange_h |
| OLD | NEW |