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

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

Issue 340713003: Ignore visibility when checking whether Position is editable or not at DeletetSelectionCommand (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2014-06-19T03:44:02 Created 6 years, 6 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/htmlediting.h ('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) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 editablePosition = isAtomicNode(editablePosition.deprecatedNode()) ? pos itionInParentAfterNode(*editablePosition.deprecatedNode()) : nextVisuallyDistinc tCandidate(editablePosition); 278 editablePosition = isAtomicNode(editablePosition.deprecatedNode()) ? pos itionInParentAfterNode(*editablePosition.deprecatedNode()) : nextVisuallyDistinc tCandidate(editablePosition);
279 279
280 if (editablePosition.deprecatedNode() && editablePosition.deprecatedNode() ! = highestRoot && !editablePosition.deprecatedNode()->isDescendantOf(highestRoot) ) 280 if (editablePosition.deprecatedNode() && editablePosition.deprecatedNode() ! = highestRoot && !editablePosition.deprecatedNode()->isDescendantOf(highestRoot) )
281 return VisiblePosition(); 281 return VisiblePosition();
282 282
283 return VisiblePosition(editablePosition); 283 return VisiblePosition(editablePosition);
284 } 284 }
285 285
286 VisiblePosition lastEditableVisiblePositionBeforePositionInRoot(const Position& position, Node* highestRoot) 286 VisiblePosition lastEditableVisiblePositionBeforePositionInRoot(const Position& position, Node* highestRoot)
287 { 287 {
288 return VisiblePosition(lastEditablePositionBeforePositionInRoot(position, hi ghestRoot));
289 }
290
291 Position lastEditablePositionBeforePositionInRoot(const Position& position, Node * highestRoot)
292 {
288 // When position falls after highestRoot, the result is easy to compute. 293 // When position falls after highestRoot, the result is easy to compute.
289 if (comparePositions(position, lastPositionInNode(highestRoot)) == 1) 294 if (comparePositions(position, lastPositionInNode(highestRoot)) == 1)
290 return VisiblePosition(lastPositionInNode(highestRoot)); 295 return lastPositionInNode(highestRoot);
291 296
292 Position editablePosition = position; 297 Position editablePosition = position;
293 298
294 if (position.deprecatedNode()->treeScope() != highestRoot->treeScope()) { 299 if (position.deprecatedNode()->treeScope() != highestRoot->treeScope()) {
295 Node* shadowAncestor = highestRoot->treeScope().ancestorInThisScope(edit ablePosition.deprecatedNode()); 300 Node* shadowAncestor = highestRoot->treeScope().ancestorInThisScope(edit ablePosition.deprecatedNode());
296 if (!shadowAncestor) 301 if (!shadowAncestor)
297 return VisiblePosition(); 302 return Position();
298 303
299 editablePosition = firstPositionInOrBeforeNode(shadowAncestor); 304 editablePosition = firstPositionInOrBeforeNode(shadowAncestor);
300 } 305 }
301 306
302 while (editablePosition.deprecatedNode() && !isEditablePosition(editablePosi tion) && editablePosition.deprecatedNode()->isDescendantOf(highestRoot)) 307 while (editablePosition.deprecatedNode() && !isEditablePosition(editablePosi tion) && editablePosition.deprecatedNode()->isDescendantOf(highestRoot))
303 editablePosition = isAtomicNode(editablePosition.deprecatedNode()) ? pos itionInParentBeforeNode(*editablePosition.deprecatedNode()) : previousVisuallyDi stinctCandidate(editablePosition); 308 editablePosition = isAtomicNode(editablePosition.deprecatedNode()) ? pos itionInParentBeforeNode(*editablePosition.deprecatedNode()) : previousVisuallyDi stinctCandidate(editablePosition);
304 309
305 if (editablePosition.deprecatedNode() && editablePosition.deprecatedNode() ! = highestRoot && !editablePosition.deprecatedNode()->isDescendantOf(highestRoot) ) 310 if (editablePosition.deprecatedNode() && editablePosition.deprecatedNode() ! = highestRoot && !editablePosition.deprecatedNode()->isDescendantOf(highestRoot) )
306 return VisiblePosition(); 311 return Position();
307 312 return editablePosition;
308 return VisiblePosition(editablePosition);
309 } 313 }
310 314
311 // FIXME: The method name, comment, and code say three different things here! 315 // FIXME: The method name, comment, and code say three different things here!
312 // Whether or not content before and after this node will collapse onto the same line as it. 316 // Whether or not content before and after this node will collapse onto the same line as it.
313 bool isBlock(const Node* node) 317 bool isBlock(const Node* node)
314 { 318 {
315 return node && node->renderer() && !node->renderer()->isInline() && !node->r enderer()->isRubyText(); 319 return node && node->renderer() && !node->renderer()->isInline() && !node->r enderer()->isRubyText();
316 } 320 }
317 321
318 bool isInline(const Node* node) 322 bool isInline(const Node* node)
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 // if the selection starts just before a paragraph break, skip over it 1119 // if the selection starts just before a paragraph break, skip over it
1116 if (isEndOfParagraph(visiblePosition)) 1120 if (isEndOfParagraph(visiblePosition))
1117 return visiblePosition.next().deepEquivalent().downstream(); 1121 return visiblePosition.next().deepEquivalent().downstream();
1118 1122
1119 // otherwise, make sure to be at the start of the first selected node, 1123 // otherwise, make sure to be at the start of the first selected node,
1120 // instead of possibly at the end of the last node before the selection 1124 // instead of possibly at the end of the last node before the selection
1121 return visiblePosition.deepEquivalent().downstream(); 1125 return visiblePosition.deepEquivalent().downstream();
1122 } 1126 }
1123 1127
1124 } // namespace WebCore 1128 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/editing/htmlediting.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698