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

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

Issue 2706163002: Add clean layout DCHECK to mostForwardCaretPosition() (Closed)
Patch Set: 2017-02-21T17:13:25 Created 3 years, 10 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, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008, 2009 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 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 EditingState* editingState) { 1379 EditingState* editingState) {
1380 DCHECK(start.isNotNull()); 1380 DCHECK(start.isNotNull());
1381 DCHECK(end.isNotNull()); 1381 DCHECK(end.isNotNull());
1382 DCHECK(start.isConnected()) << start; 1382 DCHECK(start.isConnected()) << start;
1383 DCHECK(end.isConnected()) << end; 1383 DCHECK(end.isConnected()) << end;
1384 DCHECK(Position::commonAncestorTreeScope(start, end)) << start << " " << end; 1384 DCHECK(Position::commonAncestorTreeScope(start, end)) << start << " " << end;
1385 DCHECK_LE(start, end); 1385 DCHECK_LE(start, end);
1386 // FIXME: We should assert that start/end are not in the middle of a text 1386 // FIXME: We should assert that start/end are not in the middle of a text
1387 // node. 1387 // node.
1388 1388
1389 // TODO(editing-dev): Use of updateStyleAndLayoutIgnorePendingStylesheets
1390 // needs to be audited. See http://crbug.com/590369 for more details.
1391 document().updateStyleAndLayoutIgnorePendingStylesheets();
1392
1389 Position pushDownStart = mostForwardCaretPosition(start); 1393 Position pushDownStart = mostForwardCaretPosition(start);
1390 // If the pushDownStart is at the end of a text node, then this node is not 1394 // If the pushDownStart is at the end of a text node, then this node is not
1391 // fully selected. Move it to the next deep quivalent position to avoid 1395 // fully selected. Move it to the next deep quivalent position to avoid
1392 // removing the style from this node. e.g. if pushDownStart was at 1396 // removing the style from this node. e.g. if pushDownStart was at
1393 // Position("hello", 5) in <b>hello<div>world</div></b>, we want 1397 // Position("hello", 5) in <b>hello<div>world</div></b>, we want
1394 // Position("world", 0) instead. 1398 // Position("world", 0) instead.
1395 Node* pushDownStartContainer = pushDownStart.computeContainerNode(); 1399 Node* pushDownStartContainer = pushDownStart.computeContainerNode();
1396 if (pushDownStartContainer && pushDownStartContainer->isTextNode() && 1400 if (pushDownStartContainer && pushDownStartContainer->isTextNode() &&
1397 pushDownStart.computeOffsetInContainerNode() == 1401 pushDownStart.computeOffsetInContainerNode() ==
1398 pushDownStartContainer->maxCharacterOffset()) 1402 pushDownStartContainer->maxCharacterOffset())
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
2012 2016
2013 DEFINE_TRACE(ApplyStyleCommand) { 2017 DEFINE_TRACE(ApplyStyleCommand) {
2014 visitor->trace(m_style); 2018 visitor->trace(m_style);
2015 visitor->trace(m_start); 2019 visitor->trace(m_start);
2016 visitor->trace(m_end); 2020 visitor->trace(m_end);
2017 visitor->trace(m_styledInlineElement); 2021 visitor->trace(m_styledInlineElement);
2018 CompositeEditCommand::trace(visitor); 2022 CompositeEditCommand::trace(visitor);
2019 } 2023 }
2020 2024
2021 } // namespace blink 2025 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698