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

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

Issue 1300823002: Introduce PositionAlgorithm<Strategy>::editingPositionOf() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-18T17:38:11 Created 5 years, 4 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
« no previous file with comments | « Source/core/editing/PositionIterator.cpp ('k') | Source/core/editing/VisiblePosition.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 } 211 }
212 212
213 return false; 213 return false;
214 } 214 }
215 215
216 Position RenderedPosition::positionAtLeftBoundaryOfBiDiRun() const 216 Position RenderedPosition::positionAtLeftBoundaryOfBiDiRun() const
217 { 217 {
218 ASSERT(atLeftBoundaryOfBidiRun()); 218 ASSERT(atLeftBoundaryOfBidiRun());
219 219
220 if (atLeftmostOffsetInBox()) 220 if (atLeftmostOffsetInBox())
221 return createLegacyEditingPosition(m_layoutObject->node(), m_offset); 221 return Position::editingPositionOf(m_layoutObject->node(), m_offset);
222 222
223 return createLegacyEditingPosition(nextLeafChild()->layoutObject().node(), n extLeafChild()->caretLeftmostOffset()); 223 return Position::editingPositionOf(nextLeafChild()->layoutObject().node(), n extLeafChild()->caretLeftmostOffset());
224 } 224 }
225 225
226 Position RenderedPosition::positionAtRightBoundaryOfBiDiRun() const 226 Position RenderedPosition::positionAtRightBoundaryOfBiDiRun() const
227 { 227 {
228 ASSERT(atRightBoundaryOfBidiRun()); 228 ASSERT(atRightBoundaryOfBidiRun());
229 229
230 if (atRightmostOffsetInBox()) 230 if (atRightmostOffsetInBox())
231 return createLegacyEditingPosition(m_layoutObject->node(), m_offset); 231 return Position::editingPositionOf(m_layoutObject->node(), m_offset);
232 232
233 return createLegacyEditingPosition(prevLeafChild()->layoutObject().node(), p revLeafChild()->caretRightmostOffset()); 233 return Position::editingPositionOf(prevLeafChild()->layoutObject().node(), p revLeafChild()->caretRightmostOffset());
234 } 234 }
235 235
236 IntRect RenderedPosition::absoluteRect(LayoutUnit* extraWidthToEndOfLine) const 236 IntRect RenderedPosition::absoluteRect(LayoutUnit* extraWidthToEndOfLine) const
237 { 237 {
238 if (isNull()) 238 if (isNull())
239 return IntRect(); 239 return IntRect();
240 240
241 IntRect localRect = pixelSnappedIntRect(m_layoutObject->localCaretRect(m_inl ineBox, m_offset, extraWidthToEndOfLine)); 241 IntRect localRect = pixelSnappedIntRect(m_layoutObject->localCaretRect(m_inl ineBox, m_offset, extraWidthToEndOfLine));
242 return localRect == IntRect() ? IntRect() : m_layoutObject->localToAbsoluteQ uad(FloatRect(localRect)).enclosingBoundingBox(); 242 return localRect == IntRect() ? IntRect() : m_layoutObject->localToAbsoluteQ uad(FloatRect(localRect)).enclosingBoundingBox();
243 } 243 }
(...skipping 16 matching lines...) Expand all
260 bool layoutObjectContainsPosition(LayoutObject* target, const Position& position ) 260 bool layoutObjectContainsPosition(LayoutObject* target, const Position& position )
261 { 261 {
262 for (LayoutObject* layoutObject = layoutObjectFromPosition(position); layout Object && layoutObject->node(); layoutObject = layoutObject->parent()) { 262 for (LayoutObject* layoutObject = layoutObjectFromPosition(position); layout Object && layoutObject->node(); layoutObject = layoutObject->parent()) {
263 if (layoutObject == target) 263 if (layoutObject == target)
264 return true; 264 return true;
265 } 265 }
266 return false; 266 return false;
267 } 267 }
268 268
269 }; 269 };
OLDNEW
« no previous file with comments | « Source/core/editing/PositionIterator.cpp ('k') | Source/core/editing/VisiblePosition.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698