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

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

Issue 2415613003: Ensure clean layout for all (but deprecated) functions creating VisiblePositions (Closed)
Patch Set: 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/DeleteSelectionCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
index 82b47623c7882840fcfe3b2d2da153ca23e61687..8b78769158cd994842230b5fdcbe0dd7e2b8621f 100644
--- a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
@@ -56,6 +56,7 @@ static bool isTableRowEmpty(Node* row) {
if (!isHTMLTableRowElement(row))
return false;
+ row->document().updateStyleAndLayoutIgnorePendingStylesheets();
for (Node* child = row->firstChild(); child; child = child->nextSibling()) {
if (isTableCell(child) && !isTableCellEmpty(child))
return false;
@@ -414,11 +415,13 @@ bool DeleteSelectionCommand::handleSpecialCaseBRDelete(
// FIXME: This code doesn't belong in here.
// We detect the case where the start is an empty line consisting of BR not
// wrapped in a block element.
- if (upstreamStartIsBR && downstreamStartIsBR &&
- !(isStartOfBlock(VisiblePosition::beforeNode(nodeAfterUpstreamStart)) &&
- isEndOfBlock(VisiblePosition::afterNode(nodeAfterUpstreamStart)))) {
- m_startsAtEmptyLine = true;
- m_endingPosition = m_downstreamEnd;
+ if (upstreamStartIsBR && downstreamStartIsBR) {
+ document().updateStyleAndLayoutIgnorePendingStylesheets();
yosin_UTC9 2016/10/13 06:26:46 Wow, we has been updating layout in if-condition!
+ if (!(isStartOfBlock(VisiblePosition::beforeNode(nodeAfterUpstreamStart)) &&
+ isEndOfBlock(VisiblePosition::afterNode(nodeAfterUpstreamStart)))) {
+ m_startsAtEmptyLine = true;
+ m_endingPosition = m_downstreamEnd;
+ }
}
return false;
@@ -490,6 +493,7 @@ void DeleteSelectionCommand::removeNode(
return;
}
+ document().updateStyleAndLayoutIgnorePendingStylesheets();
if (node == m_startBlock) {
VisiblePosition previous = previousPositionOf(
VisiblePosition::firstPositionInNode(m_startBlock.get()));

Powered by Google App Engine
This is Rietveld 408576698