| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 .length(); | 97 .length(); |
| 98 m_endOffsetInContent = | 98 m_endOffsetInContent = |
| 99 Range::create(*document, backwardsIterator.endPosition(), endPosition) | 99 Range::create(*document, backwardsIterator.endPosition(), endPosition) |
| 100 ->text() | 100 ->text() |
| 101 .length(); | 101 .length(); |
| 102 m_contentRange = Range::create(*document, backwardsIterator.endPosition(), | 102 m_contentRange = Range::create(*document, backwardsIterator.endPosition(), |
| 103 forwardRange.startPosition()); | 103 forwardRange.startPosition()); |
| 104 DCHECK(m_contentRange); | 104 DCHECK(m_contentRange); |
| 105 } | 105 } |
| 106 | 106 |
| 107 Document* SurroundingText::document() const { | |
| 108 if (m_contentRange) | |
| 109 return &m_contentRange->ownerDocument(); | |
| 110 return nullptr; | |
| 111 } | |
| 112 | |
| 113 String SurroundingText::content() const { | 107 String SurroundingText::content() const { |
| 114 if (m_contentRange) | 108 if (m_contentRange) { |
| 109 // SurroundingText is created with clean layout and must not be stored |
| 110 // through DOM or style changes, so layout must still be clean here. |
| 111 DCHECK(!m_contentRange->ownerDocument().needsLayoutTreeUpdate()); |
| 115 return m_contentRange->text(); | 112 return m_contentRange->text(); |
| 113 } |
| 116 return String(); | 114 return String(); |
| 117 } | 115 } |
| 118 | 116 |
| 119 unsigned SurroundingText::startOffsetInContent() const { | 117 unsigned SurroundingText::startOffsetInContent() const { |
| 120 return m_startOffsetInContent; | 118 return m_startOffsetInContent; |
| 121 } | 119 } |
| 122 | 120 |
| 123 unsigned SurroundingText::endOffsetInContent() const { | 121 unsigned SurroundingText::endOffsetInContent() const { |
| 124 return m_endOffsetInContent; | 122 return m_endOffsetInContent; |
| 125 } | 123 } |
| 126 | 124 |
| 127 } // namespace blink | 125 } // namespace blink |
| OLD | NEW |