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

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

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: 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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 } 514 }
515 515
516 for (const auto& unstyledSpan : unstyledSpans) { 516 for (const auto& unstyledSpan : unstyledSpans) {
517 removeNodePreservingChildren(unstyledSpan, editingState); 517 removeNodePreservingChildren(unstyledSpan, editingState);
518 if (editingState->isAborted()) 518 if (editingState->isAborted())
519 return; 519 return;
520 } 520 }
521 } 521 }
522 522
523 static ContainerNode* dummySpanAncestorForNode(const Node* node) { 523 static ContainerNode* dummySpanAncestorForNode(const Node* node) {
524 while (node && (!node->isElementNode() || 524 while (node &&
525 !isStyleSpanOrSpanWithOnlyStyleAttribute(toElement(node)))) 525 (!node->isElementNode() ||
526 !isStyleSpanOrSpanWithOnlyStyleAttribute(toElement(node))))
526 node = node->parentNode(); 527 node = node->parentNode();
527 528
528 return node ? node->parentNode() : 0; 529 return node ? node->parentNode() : 0;
529 } 530 }
530 531
531 void ApplyStyleCommand::cleanupUnstyledAppleStyleSpans( 532 void ApplyStyleCommand::cleanupUnstyledAppleStyleSpans(
532 ContainerNode* dummySpanAncestor, 533 ContainerNode* dummySpanAncestor,
533 EditingState* editingState) { 534 EditingState* editingState) {
534 if (!dummySpanAncestor) 535 if (!dummySpanAncestor)
535 return; 536 return;
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 replaceWithSpanOrRemoveIfWithoutAttributes(element, editingState); 1186 replaceWithSpanOrRemoveIfWithoutAttributes(element, editingState);
1186 if (editingState->isAborted()) 1187 if (editingState->isAborted())
1187 return false; 1188 return false;
1188 return true; 1189 return true;
1189 } 1190 }
1190 1191
1191 // unicode-bidi and direction are pushed down separately so don't push down 1192 // unicode-bidi and direction are pushed down separately so don't push down
1192 // with other styles 1193 // with other styles
1193 Vector<QualifiedName> attributes; 1194 Vector<QualifiedName> attributes;
1194 if (!style->extractConflictingImplicitStyleOfAttributes( 1195 if (!style->extractConflictingImplicitStyleOfAttributes(
1195 element, extractedStyle ? EditingStyle::PreserveWritingDirection 1196 element,
1196 : EditingStyle::DoNotPreserveWritingDirection, 1197 extractedStyle ? EditingStyle::PreserveWritingDirection
1198 : EditingStyle::DoNotPreserveWritingDirection,
1197 extractedStyle, attributes, 1199 extractedStyle, attributes,
1198 mode == RemoveAlways ? EditingStyle::ExtractMatchingStyle 1200 mode == RemoveAlways ? EditingStyle::ExtractMatchingStyle
1199 : EditingStyle::DoNotExtractMatchingStyle)) 1201 : EditingStyle::DoNotExtractMatchingStyle))
1200 return false; 1202 return false;
1201 1203
1202 for (const auto& attribute : attributes) 1204 for (const auto& attribute : attributes)
1203 removeElementAttribute(element, attribute); 1205 removeElementAttribute(element, attribute);
1204 1206
1205 if (isEmptyFontTag(element) || 1207 if (isEmptyFontTag(element) ||
1206 isSpanWithoutAttributesOrUnstyledStyleSpan(element)) { 1208 isSpanWithoutAttributesOrUnstyledStyleSpan(element)) {
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 void ApplyStyleCommand::addInlineStyleIfNeeded(EditingStyle* style, 1791 void ApplyStyleCommand::addInlineStyleIfNeeded(EditingStyle* style,
1790 Node* passedStart, 1792 Node* passedStart,
1791 Node* passedEnd, 1793 Node* passedEnd,
1792 EditingState* editingState) { 1794 EditingState* editingState) {
1793 if (!passedStart || !passedEnd || !passedStart->isConnected() || 1795 if (!passedStart || !passedEnd || !passedStart->isConnected() ||
1794 !passedEnd->isConnected()) 1796 !passedEnd->isConnected())
1795 return; 1797 return;
1796 1798
1797 Node* start = passedStart; 1799 Node* start = passedStart;
1798 Member<HTMLSpanElement> dummyElement = nullptr; 1800 Member<HTMLSpanElement> dummyElement = nullptr;
1799 StyleChange styleChange(style, positionToComputeInlineStyleChange( 1801 StyleChange styleChange(
1800 start, dummyElement, editingState)); 1802 style,
1803 positionToComputeInlineStyleChange(start, dummyElement, editingState));
1801 if (editingState->isAborted()) 1804 if (editingState->isAborted())
1802 return; 1805 return;
1803 1806
1804 if (dummyElement) { 1807 if (dummyElement) {
1805 removeNode(dummyElement, editingState); 1808 removeNode(dummyElement, editingState);
1806 if (editingState->isAborted()) 1809 if (editingState->isAborted())
1807 return; 1810 return;
1808 } 1811 }
1809 1812
1810 applyInlineStyleChange(start, passedEnd, styleChange, DoNotAddStyledElement, 1813 applyInlineStyleChange(start, passedEnd, styleChange, DoNotAddStyledElement,
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 2033
2031 DEFINE_TRACE(ApplyStyleCommand) { 2034 DEFINE_TRACE(ApplyStyleCommand) {
2032 visitor->trace(m_style); 2035 visitor->trace(m_style);
2033 visitor->trace(m_start); 2036 visitor->trace(m_start);
2034 visitor->trace(m_end); 2037 visitor->trace(m_end);
2035 visitor->trace(m_styledInlineElement); 2038 visitor->trace(m_styledInlineElement);
2036 CompositeEditCommand::trace(visitor); 2039 CompositeEditCommand::trace(visitor);
2037 } 2040 }
2038 2041
2039 } // namespace blink 2042 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698