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

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

Issue 2705113003: Add clean layout DCHECK to mostBackwardCaretPosition() (Closed)
Patch Set: 2017-02-21T17:42:08 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 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 // If the pushDownStart is at the end of a text node, then this node is not 1390 // 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 1391 // 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 1392 // 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 1393 // Position("hello", 5) in <b>hello<div>world</div></b>, we want
1394 // Position("world", 0) instead. 1394 // Position("world", 0) instead.
1395 Node* pushDownStartContainer = pushDownStart.computeContainerNode(); 1395 Node* pushDownStartContainer = pushDownStart.computeContainerNode();
1396 if (pushDownStartContainer && pushDownStartContainer->isTextNode() && 1396 if (pushDownStartContainer && pushDownStartContainer->isTextNode() &&
1397 pushDownStart.computeOffsetInContainerNode() == 1397 pushDownStart.computeOffsetInContainerNode() ==
1398 pushDownStartContainer->maxCharacterOffset()) 1398 pushDownStartContainer->maxCharacterOffset())
1399 pushDownStart = nextVisuallyDistinctCandidate(pushDownStart); 1399 pushDownStart = nextVisuallyDistinctCandidate(pushDownStart);
1400
1401 // TODO(editing-dev): Use of updateStyleAndLayoutIgnorePendingStylesheets
1402 // needs to be audited. See http://crbug.com/590369 for more details.
1403 document().updateStyleAndLayoutIgnorePendingStylesheets();
1404
1400 Position pushDownEnd = mostBackwardCaretPosition(end); 1405 Position pushDownEnd = mostBackwardCaretPosition(end);
1401 // If pushDownEnd is at the start of a text node, then this node is not fully 1406 // If pushDownEnd is at the start of a text node, then this node is not fully
1402 // selected. Move it to the previous deep equivalent position to avoid 1407 // selected. Move it to the previous deep equivalent position to avoid
1403 // removing the style from this node. 1408 // removing the style from this node.
1404 Node* pushDownEndContainer = pushDownEnd.computeContainerNode(); 1409 Node* pushDownEndContainer = pushDownEnd.computeContainerNode();
1405 if (pushDownEndContainer && pushDownEndContainer->isTextNode() && 1410 if (pushDownEndContainer && pushDownEndContainer->isTextNode() &&
1406 !pushDownEnd.computeOffsetInContainerNode()) 1411 !pushDownEnd.computeOffsetInContainerNode())
1407 pushDownEnd = previousVisuallyDistinctCandidate(pushDownEnd); 1412 pushDownEnd = previousVisuallyDistinctCandidate(pushDownEnd);
1408 1413
1409 pushDownInlineStyleAroundNode(style, pushDownStart.anchorNode(), 1414 pushDownInlineStyleAroundNode(style, pushDownStart.anchorNode(),
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
2012 2017
2013 DEFINE_TRACE(ApplyStyleCommand) { 2018 DEFINE_TRACE(ApplyStyleCommand) {
2014 visitor->trace(m_style); 2019 visitor->trace(m_style);
2015 visitor->trace(m_start); 2020 visitor->trace(m_start);
2016 visitor->trace(m_end); 2021 visitor->trace(m_end);
2017 visitor->trace(m_styledInlineElement); 2022 visitor->trace(m_styledInlineElement);
2018 CompositeEditCommand::trace(visitor); 2023 CompositeEditCommand::trace(visitor);
2019 } 2024 }
2020 2025
2021 } // namespace blink 2026 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698