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

Side by Side Diff: third_party/WebKit/Source/core/editing/RenderedPosition.cpp

Issue 1878473002: ASSERT -> DCHECK in core/editing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Output info for some DCHECKs, add TODOs. Created 4 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 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 23 matching lines...) Expand all
34 #include "core/editing/VisiblePosition.h" 34 #include "core/editing/VisiblePosition.h"
35 #include "core/editing/VisibleUnits.h" 35 #include "core/editing/VisibleUnits.h"
36 #include "core/layout/api/LineLayoutAPIShim.h" 36 #include "core/layout/api/LineLayoutAPIShim.h"
37 #include "core/layout/compositing/CompositedSelectionBound.h" 37 #include "core/layout/compositing/CompositedSelectionBound.h"
38 #include "core/paint/PaintLayer.h" 38 #include "core/paint/PaintLayer.h"
39 39
40 namespace blink { 40 namespace blink {
41 41
42 static inline LayoutObject* layoutObjectFromPosition(const Position& position) 42 static inline LayoutObject* layoutObjectFromPosition(const Position& position)
43 { 43 {
44 ASSERT(position.isNotNull()); 44 DCHECK(position.isNotNull());
45 Node* layoutObjectNode = nullptr; 45 Node* layoutObjectNode = nullptr;
46 switch (position.anchorType()) { 46 switch (position.anchorType()) {
47 case PositionAnchorType::OffsetInAnchor: 47 case PositionAnchorType::OffsetInAnchor:
48 layoutObjectNode = position.computeNodeAfterPosition(); 48 layoutObjectNode = position.computeNodeAfterPosition();
49 if (!layoutObjectNode || !layoutObjectNode->layoutObject()) 49 if (!layoutObjectNode || !layoutObjectNode->layoutObject())
50 layoutObjectNode = position.anchorNode()->lastChild(); 50 layoutObjectNode = position.anchorNode()->lastChild();
51 break; 51 break;
52 52
53 case PositionAnchorType::BeforeAnchor: 53 case PositionAnchorType::BeforeAnchor:
54 case PositionAnchorType::AfterAnchor: 54 case PositionAnchorType::AfterAnchor:
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 if (shouldMatchBidiLevel == IgnoreBidiLevel) 201 if (shouldMatchBidiLevel == IgnoreBidiLevel)
202 return prevLeafChild() && m_inlineBox->bidiLevel() < prevLeafChild() ->bidiLevel(); 202 return prevLeafChild() && m_inlineBox->bidiLevel() < prevLeafChild() ->bidiLevel();
203 return prevLeafChild() && m_inlineBox->bidiLevel() < bidiLevelOfRun && p revLeafChild()->bidiLevel() >= bidiLevelOfRun; 203 return prevLeafChild() && m_inlineBox->bidiLevel() < bidiLevelOfRun && p revLeafChild()->bidiLevel() >= bidiLevelOfRun;
204 } 204 }
205 205
206 return false; 206 return false;
207 } 207 }
208 208
209 Position RenderedPosition::positionAtLeftBoundaryOfBiDiRun() const 209 Position RenderedPosition::positionAtLeftBoundaryOfBiDiRun() const
210 { 210 {
211 ASSERT(atLeftBoundaryOfBidiRun()); 211 DCHECK(atLeftBoundaryOfBidiRun());
212 212
213 if (atLeftmostOffsetInBox()) 213 if (atLeftmostOffsetInBox())
214 return Position::editingPositionOf(m_layoutObject->node(), m_offset); 214 return Position::editingPositionOf(m_layoutObject->node(), m_offset);
215 215
216 return Position::editingPositionOf(nextLeafChild()->getLineLayoutItem().node (), nextLeafChild()->caretLeftmostOffset()); 216 return Position::editingPositionOf(nextLeafChild()->getLineLayoutItem().node (), nextLeafChild()->caretLeftmostOffset());
217 } 217 }
218 218
219 Position RenderedPosition::positionAtRightBoundaryOfBiDiRun() const 219 Position RenderedPosition::positionAtRightBoundaryOfBiDiRun() const
220 { 220 {
221 ASSERT(atRightBoundaryOfBidiRun()); 221 DCHECK(atRightBoundaryOfBidiRun());
222 222
223 if (atRightmostOffsetInBox()) 223 if (atRightmostOffsetInBox())
224 return Position::editingPositionOf(m_layoutObject->node(), m_offset); 224 return Position::editingPositionOf(m_layoutObject->node(), m_offset);
225 225
226 return Position::editingPositionOf(prevLeafChild()->getLineLayoutItem().node (), prevLeafChild()->caretRightmostOffset()); 226 return Position::editingPositionOf(prevLeafChild()->getLineLayoutItem().node (), prevLeafChild()->caretRightmostOffset());
227 } 227 }
228 228
229 IntRect RenderedPosition::absoluteRect(LayoutUnit* extraWidthToEndOfLine) const 229 IntRect RenderedPosition::absoluteRect(LayoutUnit* extraWidthToEndOfLine) const
230 { 230 {
231 if (isNull()) 231 if (isNull())
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 bool layoutObjectContainsPosition(LayoutObject* target, const Position& position ) 271 bool layoutObjectContainsPosition(LayoutObject* target, const Position& position )
272 { 272 {
273 for (LayoutObject* layoutObject = layoutObjectFromPosition(position); layout Object && layoutObject->node(); layoutObject = layoutObject->parent()) { 273 for (LayoutObject* layoutObject = layoutObjectFromPosition(position); layout Object && layoutObject->node(); layoutObject = layoutObject->parent()) {
274 if (layoutObject == target) 274 if (layoutObject == target)
275 return true; 275 return true;
276 } 276 }
277 return false; 277 return false;
278 } 278 }
279 279
280 } // namespace blink 280 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698