Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutTextFragment.cpp

Issue 2770123003: Replace ASSERT with DCHECK in core/layout/ excluding subdirs (Closed)
Patch Set: Split some DCHECKs and add DCHECK_ops wherever possible Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Dirk Mueller (mueller@kde.org) 3 * (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 30 matching lines...) Expand all
41 m_start(startOffset), 41 m_start(startOffset),
42 m_fragmentLength(length), 42 m_fragmentLength(length),
43 m_isRemainingTextLayoutObject(false), 43 m_isRemainingTextLayoutObject(false),
44 m_contentString(str), 44 m_contentString(str),
45 m_firstLetterPseudoElement(nullptr) {} 45 m_firstLetterPseudoElement(nullptr) {}
46 46
47 LayoutTextFragment::LayoutTextFragment(Node* node, StringImpl* str) 47 LayoutTextFragment::LayoutTextFragment(Node* node, StringImpl* str)
48 : LayoutTextFragment(node, str, 0, str ? str->length() : 0) {} 48 : LayoutTextFragment(node, str, 0, str ? str->length() : 0) {}
49 49
50 LayoutTextFragment::~LayoutTextFragment() { 50 LayoutTextFragment::~LayoutTextFragment() {
51 ASSERT(!m_firstLetterPseudoElement); 51 DCHECK(!m_firstLetterPseudoElement);
52 } 52 }
53 53
54 LayoutTextFragment* LayoutTextFragment::createAnonymous(PseudoElement& pseudo, 54 LayoutTextFragment* LayoutTextFragment::createAnonymous(PseudoElement& pseudo,
55 StringImpl* text, 55 StringImpl* text,
56 unsigned start, 56 unsigned start,
57 unsigned length) { 57 unsigned length) {
58 LayoutTextFragment* fragment = 58 LayoutTextFragment* fragment =
59 new LayoutTextFragment(nullptr, text, start, length); 59 new LayoutTextFragment(nullptr, text, start, length);
60 fragment->setDocumentForAnonymous(&pseudo.document()); 60 fragment->setDocumentForAnonymous(&pseudo.document());
61 if (length) 61 if (length)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 void LayoutTextFragment::setText(PassRefPtr<StringImpl> text, bool force) { 95 void LayoutTextFragment::setText(PassRefPtr<StringImpl> text, bool force) {
96 LayoutText::setText(std::move(text), force); 96 LayoutText::setText(std::move(text), force);
97 97
98 m_start = 0; 98 m_start = 0;
99 m_fragmentLength = textLength(); 99 m_fragmentLength = textLength();
100 100
101 // If we're the remaining text from a first letter then we have to tell the 101 // If we're the remaining text from a first letter then we have to tell the
102 // first letter pseudo element to reattach itself so it can re-calculate the 102 // first letter pseudo element to reattach itself so it can re-calculate the
103 // correct first-letter settings. 103 // correct first-letter settings.
104 if (isRemainingTextLayoutObject()) { 104 if (isRemainingTextLayoutObject()) {
105 ASSERT(firstLetterPseudoElement()); 105 DCHECK(firstLetterPseudoElement());
106 firstLetterPseudoElement()->updateTextFragments(); 106 firstLetterPseudoElement()->updateTextFragments();
107 } 107 }
108 } 108 }
109 109
110 void LayoutTextFragment::setTextFragment(PassRefPtr<StringImpl> text, 110 void LayoutTextFragment::setTextFragment(PassRefPtr<StringImpl> text,
111 unsigned start, 111 unsigned start,
112 unsigned length) { 112 unsigned length) {
113 LayoutText::setText(std::move(text), false); 113 LayoutText::setText(std::move(text), false);
114 114
115 m_start = start; 115 m_start = start;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 LayoutObject::updateHitTestResult(result, point); 168 LayoutObject::updateHitTestResult(result, point);
169 169
170 // If we aren't part of a first-letter element, or if we 170 // If we aren't part of a first-letter element, or if we
171 // are part of first-letter but we're the remaining text then return. 171 // are part of first-letter but we're the remaining text then return.
172 if (m_isRemainingTextLayoutObject || !firstLetterPseudoElement()) 172 if (m_isRemainingTextLayoutObject || !firstLetterPseudoElement())
173 return; 173 return;
174 result.setInnerNode(firstLetterPseudoElement()); 174 result.setInnerNode(firstLetterPseudoElement());
175 } 175 }
176 176
177 } // namespace blink 177 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698