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

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

Issue 2121313003: [Editing][DOM][CodeHealth] Make Node::isContentEditable and Node::isRichEditable global functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 966 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 if (runEnd == element) 977 if (runEnd == element)
978 runEnd = nextSibling ? nextSibling->previousSibling() : parent-> lastChild(); 978 runEnd = nextSibling ? nextSibling->previousSibling() : parent-> lastChild();
979 } 979 }
980 } 980 }
981 } 981 }
982 982
983 bool ApplyStyleCommand::removeInlineStyleFromElement(EditingStyle* style, HTMLEl ement* element, EditingState* editingState, InlineStyleRemovalMode mode, Editing Style* extractedStyle) 983 bool ApplyStyleCommand::removeInlineStyleFromElement(EditingStyle* style, HTMLEl ement* element, EditingState* editingState, InlineStyleRemovalMode mode, Editing Style* extractedStyle)
984 { 984 {
985 DCHECK(element); 985 DCHECK(element);
986 986
987 if (!element->parentNode() || !element->parentNode()->isContentEditable()) 987 if (!element->parentNode() || !isContentEditable(*element->parentNode()))
988 return false; 988 return false;
989 989
990 if (isStyledInlineElementToRemove(element)) { 990 if (isStyledInlineElementToRemove(element)) {
991 if (mode == RemoveNone) 991 if (mode == RemoveNone)
992 return true; 992 return true;
993 if (extractedStyle) 993 if (extractedStyle)
994 extractedStyle->mergeInlineStyleOfElement(element, EditingStyle::Ove rrideValues); 994 extractedStyle->mergeInlineStyleOfElement(element, EditingStyle::Ove rrideValues);
995 removeNodePreservingChildren(element, editingState); 995 removeNodePreservingChildren(element, editingState);
996 if (editingState->isAborted()) 996 if (editingState->isAborted())
997 return false; 997 return false;
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 DCHECK(elementToInsert); 1469 DCHECK(elementToInsert);
1470 Node* node = passedStartNode; 1470 Node* node = passedStartNode;
1471 Element* element = elementToInsert; 1471 Element* element = elementToInsert;
1472 1472
1473 insertNodeBefore(element, node, editingState); 1473 insertNodeBefore(element, node, editingState);
1474 if (editingState->isAborted()) 1474 if (editingState->isAborted())
1475 return; 1475 return;
1476 1476
1477 while (node) { 1477 while (node) {
1478 Node* next = node->nextSibling(); 1478 Node* next = node->nextSibling();
1479 if (node->isContentEditable()) { 1479 if (isContentEditable(*node)) {
1480 removeNode(node, editingState); 1480 removeNode(node, editingState);
1481 if (editingState->isAborted()) 1481 if (editingState->isAborted())
1482 return; 1482 return;
1483 appendNode(node, element, editingState); 1483 appendNode(node, element, editingState);
1484 if (editingState->isAborted()) 1484 if (editingState->isAborted())
1485 return; 1485 return;
1486 } 1486 }
1487 if (node == endNode) 1487 if (node == endNode)
1488 break; 1488 break;
1489 node = next; 1489 node = next;
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1731 DEFINE_TRACE(ApplyStyleCommand) 1731 DEFINE_TRACE(ApplyStyleCommand)
1732 { 1732 {
1733 visitor->trace(m_style); 1733 visitor->trace(m_style);
1734 visitor->trace(m_start); 1734 visitor->trace(m_start);
1735 visitor->trace(m_end); 1735 visitor->trace(m_end);
1736 visitor->trace(m_styledInlineElement); 1736 visitor->trace(m_styledInlineElement);
1737 CompositeEditCommand::trace(visitor); 1737 CompositeEditCommand::trace(visitor);
1738 } 1738 }
1739 1739
1740 } // namespace blink 1740 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698