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

Side by Side Diff: Source/core/editing/ApplyStyleCommand.cpp

Issue 335773002: Don't move uneditable paragraph contents in CompositeEditCommand::moveParagraphContentsToNewBlockIfN (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2014-06-16T12:44:07 Created 6 years, 6 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 int startIndex = TextIterator::rangeLength(startRange.get(), true); 258 int startIndex = TextIterator::rangeLength(startRange.get(), true);
259 int endIndex = TextIterator::rangeLength(endRange.get(), true); 259 int endIndex = TextIterator::rangeLength(endRange.get(), true);
260 260
261 VisiblePosition paragraphStart(startOfParagraph(visibleStart)); 261 VisiblePosition paragraphStart(startOfParagraph(visibleStart));
262 VisiblePosition nextParagraphStart(endOfParagraph(paragraphStart).next()); 262 VisiblePosition nextParagraphStart(endOfParagraph(paragraphStart).next());
263 VisiblePosition beyondEnd(endOfParagraph(visibleEnd).next()); 263 VisiblePosition beyondEnd(endOfParagraph(visibleEnd).next());
264 while (paragraphStart.isNotNull() && paragraphStart != beyondEnd) { 264 while (paragraphStart.isNotNull() && paragraphStart != beyondEnd) {
265 StyleChange styleChange(style, paragraphStart.deepEquivalent()); 265 StyleChange styleChange(style, paragraphStart.deepEquivalent());
266 if (styleChange.cssStyle().length() || m_removeOnly) { 266 if (styleChange.cssStyle().length() || m_removeOnly) {
267 RefPtrWillBeRawPtr<Node> block = enclosingBlock(paragraphStart.deepE quivalent().deprecatedNode()); 267 RefPtrWillBeRawPtr<Node> block = enclosingBlock(paragraphStart.deepE quivalent().deprecatedNode());
268 if (!m_removeOnly) { 268 const Position& paragraphStartToMove = paragraphStart.deepEquivalent ();
269 RefPtrWillBeRawPtr<Element> newBlock = moveParagraphContentsToNe wBlockIfNecessary(paragraphStart.deepEquivalent()); 269 if (!m_removeOnly && isEditablePosition(paragraphStartToMove)) {
270 RefPtrWillBeRawPtr<Element> newBlock = moveParagraphContentsToNe wBlockIfNecessary(paragraphStartToMove);
270 if (newBlock) 271 if (newBlock)
271 block = newBlock; 272 block = newBlock;
272 } 273 }
273 ASSERT(!block || block->isHTMLElement()); 274 ASSERT(!block || block->isHTMLElement());
274 if (block && block->isHTMLElement()) { 275 if (block && block->isHTMLElement()) {
275 removeCSSStyle(style, toHTMLElement(block)); 276 removeCSSStyle(style, toHTMLElement(block));
276 if (!m_removeOnly) 277 if (!m_removeOnly)
277 addBlockStyle(styleChange, toHTMLElement(block)); 278 addBlockStyle(styleChange, toHTMLElement(block));
278 } 279 }
279 280
(...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 void ApplyStyleCommand::trace(Visitor* visitor) 1568 void ApplyStyleCommand::trace(Visitor* visitor)
1568 { 1569 {
1569 visitor->trace(m_style); 1570 visitor->trace(m_style);
1570 visitor->trace(m_start); 1571 visitor->trace(m_start);
1571 visitor->trace(m_end); 1572 visitor->trace(m_end);
1572 visitor->trace(m_styledInlineElement); 1573 visitor->trace(m_styledInlineElement);
1573 CompositeEditCommand::trace(visitor); 1574 CompositeEditCommand::trace(visitor);
1574 } 1575 }
1575 1576
1576 } 1577 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698