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

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

Issue 2089993003: Get rid of EUpdateStyle parameter from isEditablePosition() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-06-27T14:42:23 Created 4 years, 5 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) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 2008 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 if (parent->lastChild() == refChild) { 335 if (parent->lastChild() == refChild) {
336 appendNode(insertChild, parent, editingState); 336 appendNode(insertChild, parent, editingState);
337 } else { 337 } else {
338 DCHECK(refChild->nextSibling()) << refChild; 338 DCHECK(refChild->nextSibling()) << refChild;
339 insertNodeBefore(insertChild, refChild->nextSibling(), editingState); 339 insertNodeBefore(insertChild, refChild->nextSibling(), editingState);
340 } 340 }
341 } 341 }
342 342
343 void CompositeEditCommand::insertNodeAt(Node* insertChild, const Position& editi ngPosition, EditingState* editingState) 343 void CompositeEditCommand::insertNodeAt(Node* insertChild, const Position& editi ngPosition, EditingState* editingState)
344 { 344 {
345 ABORT_EDITING_COMMAND_IF(!isEditablePosition(editingPosition, ContentIsEdita ble, DoNotUpdateStyle)); 345 document().updateStyleAndLayoutIgnorePendingStylesheets();
346 ABORT_EDITING_COMMAND_IF(!isEditablePosition(editingPosition, ContentIsEdita ble));
346 // For editing positions like [table, 0], insert before the table, 347 // For editing positions like [table, 0], insert before the table,
347 // likewise for replaced elements, brs, etc. 348 // likewise for replaced elements, brs, etc.
348 Position p = editingPosition.parentAnchoredEquivalent(); 349 Position p = editingPosition.parentAnchoredEquivalent();
349 Node* refChild = p.anchorNode(); 350 Node* refChild = p.anchorNode();
350 int offset = p.offsetInContainerNode(); 351 int offset = p.offsetInContainerNode();
351 352
352 if (canHaveChildrenForEditing(refChild)) { 353 if (canHaveChildrenForEditing(refChild)) {
353 Node* child = refChild->firstChild(); 354 Node* child = refChild->firstChild();
354 for (int i = 0; child && i < offset; i++) 355 for (int i = 0; child && i < offset; i++)
355 child = child->nextSibling(); 356 child = child->nextSibling();
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 insertNodeAt(paragraphElement, position, editingState); 958 insertNodeAt(paragraphElement, position, editingState);
958 if (editingState->isAborted()) 959 if (editingState->isAborted())
959 return nullptr; 960 return nullptr;
960 return paragraphElement; 961 return paragraphElement;
961 } 962 }
962 963
963 // If the paragraph is not entirely within it's own block, create one and move t he paragraph into 964 // If the paragraph is not entirely within it's own block, create one and move t he paragraph into
964 // it, and return that block. Otherwise return 0. 965 // it, and return that block. Otherwise return 0.
965 HTMLElement* CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary(co nst Position& pos, EditingState* editingState) 966 HTMLElement* CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary(co nst Position& pos, EditingState* editingState)
966 { 967 {
967 DCHECK(isEditablePosition(pos, ContentIsEditable, DoNotUpdateStyle)) << pos; 968 DCHECK(isEditablePosition(pos, ContentIsEditable)) << pos;
968 969
969 // It's strange that this function is responsible for verifying that pos has not been invalidated 970 // It's strange that this function is responsible for verifying that pos has not been invalidated
970 // by an earlier call to this function. The caller, applyBlockStyle, should do this. 971 // by an earlier call to this function. The caller, applyBlockStyle, should do this.
971 VisiblePosition visiblePos = createVisiblePosition(pos, VP_DEFAULT_AFFINITY) ; 972 VisiblePosition visiblePos = createVisiblePosition(pos, VP_DEFAULT_AFFINITY) ;
972 VisiblePosition visibleParagraphStart = startOfParagraph(visiblePos); 973 VisiblePosition visibleParagraphStart = startOfParagraph(visiblePos);
973 VisiblePosition visibleParagraphEnd = endOfParagraph(visiblePos); 974 VisiblePosition visibleParagraphEnd = endOfParagraph(visiblePos);
974 VisiblePosition next = nextPositionOf(visibleParagraphEnd); 975 VisiblePosition next = nextPositionOf(visibleParagraphEnd);
975 VisiblePosition visibleEnd = next.isNotNull() ? next : visibleParagraphEnd; 976 VisiblePosition visibleEnd = next.isNotNull() ? next : visibleParagraphEnd;
976 977
977 Position upstreamStart = mostBackwardCaretPosition(visibleParagraphStart.dee pEquivalent()); 978 Position upstreamStart = mostBackwardCaretPosition(visibleParagraphStart.dee pEquivalent());
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
1617 } 1618 }
1618 1619
1619 DEFINE_TRACE(CompositeEditCommand) 1620 DEFINE_TRACE(CompositeEditCommand)
1620 { 1621 {
1621 visitor->trace(m_commands); 1622 visitor->trace(m_commands);
1622 visitor->trace(m_composition); 1623 visitor->trace(m_composition);
1623 EditCommand::trace(visitor); 1624 EditCommand::trace(visitor);
1624 } 1625 }
1625 1626
1626 } // namespace blink 1627 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698