Chromium Code Reviews| Index: third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.cpp |
| diff --git a/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.cpp b/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.cpp |
| index ecfab53065ac4731fc22a8ae23255ace2dcc921b..28d2fbb6711269c26da60117fa70ac5f19719243 100644 |
| --- a/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.cpp |
| +++ b/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.cpp |
| @@ -46,8 +46,8 @@ UChar TextIteratorTextState::characterAt(unsigned index) const |
| return 0; |
| if (m_singleCharacterBuffer) { |
| - ASSERT(!index); |
| - ASSERT(length() == 1); |
| + DCHECK(!index); |
| + DCHECK_EQ(length(), 1); |
| return m_singleCharacterBuffer; |
| } |
| @@ -61,8 +61,8 @@ String TextIteratorTextState::substring(unsigned position, unsigned length) cons |
| if (!length) |
| return emptyString(); |
| if (m_singleCharacterBuffer) { |
| - ASSERT(!position); |
| - ASSERT(length == 1); |
| + DCHECK(!position); |
| + DCHECK_EQ(length, 1u); |
| return String(&m_singleCharacterBuffer, 1); |
| } |
| return string().substring(positionStartOffset() + position, length); |
| @@ -74,7 +74,7 @@ void TextIteratorTextState::appendTextToStringBuilder(StringBuilder& builder, un |
| if (!lengthToAppend) |
| return; |
| if (m_singleCharacterBuffer) { |
| - ASSERT(!position); |
| + DCHECK(!position); |
| builder.append(m_singleCharacterBuffer); |
| } else { |
| builder.append(string(), positionStartOffset() + position, lengthToAppend); |
| @@ -113,7 +113,7 @@ void TextIteratorTextState::flushPositionOffsets() const |
| void TextIteratorTextState::spliceBuffer(UChar c, Node* textNode, Node* offsetBaseNode, int textStartOffset, int textEndOffset) |
| { |
| - ASSERT(textNode); |
| + DCHECK(textNode); |
| m_hasEmitted = true; |
| // Remember information with which to construct the TextIterator::range(). |
| @@ -125,7 +125,7 @@ void TextIteratorTextState::spliceBuffer(UChar c, Node* textNode, Node* offsetBa |
| // remember information with which to construct the TextIterator::characters() and length() |
| m_singleCharacterBuffer = c; |
| - ASSERT(m_singleCharacterBuffer); |
| + DCHECK(m_singleCharacterBuffer); |
| m_textLength = 1; |
| // remember some iteration state |
| @@ -134,12 +134,12 @@ void TextIteratorTextState::spliceBuffer(UChar c, Node* textNode, Node* offsetBa |
| void TextIteratorTextState::emitText(Node* textNode, LayoutText* layoutObject, int textStartOffset, int textEndOffset) |
| { |
| - ASSERT(textNode); |
| + DCHECK(textNode); |
| m_text = m_emitsOriginalText ? layoutObject->originalText() : layoutObject->text(); |
| - ASSERT(!m_text.isEmpty()); |
| - ASSERT(0 <= textStartOffset && textStartOffset < static_cast<int>(m_text.length())); |
| - ASSERT(0 <= textEndOffset && textEndOffset <= static_cast<int>(m_text.length())); |
| - ASSERT(textStartOffset <= textEndOffset); |
| + DCHECK(!m_text.isEmpty()); |
| + DCHECK(0 <= textStartOffset && textStartOffset < static_cast<int>(m_text.length())); |
|
yosin_UTC9
2016/04/11 04:09:10
Could you split this |DCHECK()| into two |DCHECK()
|
| + DCHECK(0 <= textEndOffset && textEndOffset <= static_cast<int>(m_text.length())); |
|
yosin_UTC9
2016/04/11 04:09:10
Could you split this |DCHECK()| into two |DCHECK()
|
| + DCHECK_LE(textStartOffset, textEndOffset); |
| m_positionNode = textNode; |
| m_positionOffsetBaseNode = nullptr; |
| @@ -159,10 +159,10 @@ void TextIteratorTextState::appendTextTo(ForwardsTextBuffer* output, unsigned po |
| ASSERT_WITH_SECURITY_IMPLICATION(position + lengthToAppend >= position); |
| if (!lengthToAppend) |
| return; |
| - ASSERT(output); |
| + DCHECK(output); |
| if (m_singleCharacterBuffer) { |
| - ASSERT(!position); |
| - ASSERT(length() == 1); |
| + DCHECK(!position); |
| + DCHECK_EQ(length(), 1); |
| output->pushCharacters(m_singleCharacterBuffer, 1); |
| return; |
| } |