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

Side by Side Diff: Source/core/layout/LayoutObject.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/layout/LayoutBlock.cpp ('k') | no next file » | 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 2981 matching lines...) Expand 10 before | Expand all | Expand 10 after
2992 // If it can be found, we prefer a visually equivalent position that is editable. 2992 // If it can be found, we prefer a visually equivalent position that is editable.
2993 const Position position = Position(node, offset); 2993 const Position position = Position(node, offset);
2994 Position candidate = position.downstream(CanCrossEditingBoundary); 2994 Position candidate = position.downstream(CanCrossEditingBoundary);
2995 if (candidate.anchorNode()->hasEditableStyle()) 2995 if (candidate.anchorNode()->hasEditableStyle())
2996 return PositionWithAffinity(candidate, affinity); 2996 return PositionWithAffinity(candidate, affinity);
2997 candidate = position.upstream(CanCrossEditingBoundary); 2997 candidate = position.upstream(CanCrossEditingBoundary);
2998 if (candidate.anchorNode()->hasEditableStyle()) 2998 if (candidate.anchorNode()->hasEditableStyle())
2999 return PositionWithAffinity(candidate, affinity); 2999 return PositionWithAffinity(candidate, affinity);
3000 } 3000 }
3001 // FIXME: Eliminate legacy editing positions 3001 // FIXME: Eliminate legacy editing positions
3002 return PositionWithAffinity(createLegacyEditingPosition(node, offset), a ffinity); 3002 return PositionWithAffinity(Position::editingPositionOf(node, offset), a ffinity);
3003 } 3003 }
3004 3004
3005 // We don't want to cross the boundary between editable and non-editable 3005 // We don't want to cross the boundary between editable and non-editable
3006 // regions of the document, but that is either impossible or at least 3006 // regions of the document, but that is either impossible or at least
3007 // extremely unlikely in any normal case because we stop as soon as we 3007 // extremely unlikely in any normal case because we stop as soon as we
3008 // find a single non-anonymous layoutObject. 3008 // find a single non-anonymous layoutObject.
3009 3009
3010 // Find a nearby non-anonymous layoutObject. 3010 // Find a nearby non-anonymous layoutObject.
3011 LayoutObject* child = this; 3011 LayoutObject* child = this;
3012 while (LayoutObject* parent = child->parent()) { 3012 while (LayoutObject* parent = child->parent()) {
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
3397 const blink::LayoutObject* root = object1; 3397 const blink::LayoutObject* root = object1;
3398 while (root->parent()) 3398 while (root->parent())
3399 root = root->parent(); 3399 root = root->parent();
3400 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3400 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3401 } else { 3401 } else {
3402 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3402 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3403 } 3403 }
3404 } 3404 }
3405 3405
3406 #endif 3406 #endif
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBlock.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698