| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 } | 70 } |
| 71 | 71 |
| 72 m_positionOffsetInContent = Range::create(*document, backwardsRange->endPosi
tion(), position)->text().length(); | 72 m_positionOffsetInContent = Range::create(*document, backwardsRange->endPosi
tion(), position)->text().length(); |
| 73 m_contentRange = Range::create(*document, backwardsRange->endPosition(), for
wardRange->startPosition()); | 73 m_contentRange = Range::create(*document, backwardsRange->endPosition(), for
wardRange->startPosition()); |
| 74 ASSERT(m_contentRange); | 74 ASSERT(m_contentRange); |
| 75 } | 75 } |
| 76 | 76 |
| 77 PassRefPtr<Range> SurroundingText::rangeFromContentOffsets(unsigned startOffsetI
nContent, unsigned endOffsetInContent) | 77 PassRefPtr<Range> SurroundingText::rangeFromContentOffsets(unsigned startOffsetI
nContent, unsigned endOffsetInContent) |
| 78 { | 78 { |
| 79 if (startOffsetInContent >= endOffsetInContent || endOffsetInContent > conte
nt().length()) | 79 if (startOffsetInContent >= endOffsetInContent || endOffsetInContent > conte
nt().length()) |
| 80 return 0; | 80 return nullptr; |
| 81 | 81 |
| 82 CharacterIterator iterator(m_contentRange.get()); | 82 CharacterIterator iterator(m_contentRange.get()); |
| 83 | 83 |
| 84 ASSERT(!iterator.atEnd()); | 84 ASSERT(!iterator.atEnd()); |
| 85 iterator.advance(startOffsetInContent); | 85 iterator.advance(startOffsetInContent); |
| 86 | 86 |
| 87 ASSERT(iterator.range()); | 87 ASSERT(iterator.range()); |
| 88 Position start = iterator.range()->startPosition(); | 88 Position start = iterator.range()->startPosition(); |
| 89 | 89 |
| 90 ASSERT(!iterator.atEnd()); | 90 ASSERT(!iterator.atEnd()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 103 return m_contentRange->text(); | 103 return m_contentRange->text(); |
| 104 return String(); | 104 return String(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 unsigned SurroundingText::positionOffsetInContent() const | 107 unsigned SurroundingText::positionOffsetInContent() const |
| 108 { | 108 { |
| 109 return m_positionOffsetInContent; | 109 return m_positionOffsetInContent; |
| 110 } | 110 } |
| 111 | 111 |
| 112 } // namespace WebCore | 112 } // namespace WebCore |
| OLD | NEW |