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

Unified Diff: third_party/WebKit/Source/core/editing/commands/FormatBlockCommand.cpp

Issue 2393133002: Prune deprecated editing functions from ApplyBlockElementCommand and its subclasses (Closed)
Patch Set: Add a missing layout update call Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/commands/FormatBlockCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/FormatBlockCommand.cpp b/third_party/WebKit/Source/core/editing/commands/FormatBlockCommand.cpp
index 6ad926034a3feb8079dc41757fcc62c972f15d66..bc3c6ea65d28c3d6e8bee5b3abdec935fa6328a2 100644
--- a/third_party/WebKit/Source/core/editing/commands/FormatBlockCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/FormatBlockCommand.cpp
@@ -73,8 +73,7 @@ void FormatBlockCommand::formatRange(const Position& start,
const Position& endOfSelection,
HTMLElement*& blockElement,
EditingState* editingState) {
- Element* refElement =
- enclosingBlockFlowElement(createVisiblePositionDeprecated(end));
+ Element* refElement = enclosingBlockFlowElement(createVisiblePosition(end));
Element* root = rootEditableElementOf(start);
// Root is null for elements with contenteditable=false.
if (!root || !refElement)
@@ -87,12 +86,12 @@ void FormatBlockCommand::formatRange(const Position& start,
Node* nodeAfterInsertionPosition = outerBlock;
Range* range = Range::create(document(), start, endOfSelection);
+ document().updateStyleAndLayoutIgnorePendingStylesheets();
if (isElementForFormatBlock(refElement->tagQName()) &&
- createVisiblePositionDeprecated(start).deepEquivalent() ==
- startOfBlock(createVisiblePositionDeprecated(start))
- .deepEquivalent() &&
- (createVisiblePositionDeprecated(end).deepEquivalent() ==
- endOfBlock(createVisiblePositionDeprecated(end)).deepEquivalent() ||
+ createVisiblePosition(start).deepEquivalent() ==
+ startOfBlock(createVisiblePosition(start)).deepEquivalent() &&
+ (createVisiblePosition(end).deepEquivalent() ==
+ endOfBlock(createVisiblePosition(end)).deepEquivalent() ||
isNodeVisiblyContainedWithin(*refElement, *range)) &&
refElement != root && !root->isDescendantOf(refElement)) {
// Already in a block element that only contains the current paragraph
@@ -108,17 +107,18 @@ void FormatBlockCommand::formatRange(const Position& start,
insertNodeBefore(blockElement, nodeAfterInsertionPosition, editingState);
if (editingState->isAborted())
return;
+ document().updateStyleAndLayoutIgnorePendingStylesheets();
}
Position lastParagraphInBlockNode =
blockElement->lastChild() ? Position::afterNode(blockElement->lastChild())
: Position();
- bool wasEndOfParagraph = isEndOfParagraphDeprecated(
- createVisiblePositionDeprecated(lastParagraphInBlockNode));
+ bool wasEndOfParagraph =
+ isEndOfParagraph(createVisiblePosition(lastParagraphInBlockNode));
- moveParagraphWithClones(createVisiblePositionDeprecated(start),
- createVisiblePositionDeprecated(end), blockElement,
- outerBlock, editingState);
+ moveParagraphWithClones(createVisiblePosition(start),
+ createVisiblePosition(end), blockElement, outerBlock,
+ editingState);
if (editingState->isAborted())
return;
@@ -129,11 +129,11 @@ void FormatBlockCommand::formatRange(const Position& start,
styleAttr,
toHTMLElement(nodeAfterInsertionPosition)->getAttribute(styleAttr));
+ document().updateStyleAndLayoutIgnorePendingStylesheets();
+
if (wasEndOfParagraph &&
- !isEndOfParagraphDeprecated(
- createVisiblePositionDeprecated(lastParagraphInBlockNode)) &&
- !isStartOfParagraphDeprecated(
- createVisiblePositionDeprecated(lastParagraphInBlockNode)))
+ !isEndOfParagraph(createVisiblePosition(lastParagraphInBlockNode)) &&
+ !isStartOfParagraph(createVisiblePosition(lastParagraphInBlockNode)))
insertBlockPlaceholder(lastParagraphInBlockNode, editingState);
}

Powered by Google App Engine
This is Rietveld 408576698