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

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

Issue 2804943002: Avoid duplicate functions/code in core/editing: endTag (Closed)
Patch Set: Created 3 years, 8 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) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007 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 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after
1827 1827
1828 if (!position.anchorNode()->isTextNode() || 1828 if (!position.anchorNode()->isTextNode() ||
1829 !position.anchorNode()->layoutObject()->style()->preserveNewline()) 1829 !position.anchorNode()->layoutObject()->style()->preserveNewline())
1830 return false; 1830 return false;
1831 1831
1832 Text* textNode = toText(position.anchorNode()); 1832 Text* textNode = toText(position.anchorNode());
1833 unsigned offset = position.offsetInContainerNode(); 1833 unsigned offset = position.offsetInContainerNode();
1834 return offset < textNode->length() && textNode->data()[offset] == '\n'; 1834 return offset < textNode->length() && textNode->data()[offset] == '\n';
1835 } 1835 }
1836 1836
1837 bool elementCannotHaveEndTag(const Node& node) {
1838 if (!node.isHTMLElement())
1839 return false;
1840
1841 return !toHTMLElement(node).shouldSerializeEndTag();
Peter Kasting 2017/04/06 10:03:35 Drive-by: Possibly clearer: return node.isHTMLE
1842 }
1843
1837 // Modifies selections that have an end point at the edge of a table 1844 // Modifies selections that have an end point at the edge of a table
1838 // that contains the other endpoint so that they don't confuse 1845 // that contains the other endpoint so that they don't confuse
1839 // code that iterates over selected paragraphs. 1846 // code that iterates over selected paragraphs.
1840 VisibleSelection selectionForParagraphIteration( 1847 VisibleSelection selectionForParagraphIteration(
1841 const VisibleSelection& original) { 1848 const VisibleSelection& original) {
1842 VisibleSelection newSelection(original); 1849 VisibleSelection newSelection(original);
1843 VisiblePosition startOfSelection(newSelection.visibleStart()); 1850 VisiblePosition startOfSelection(newSelection.visibleStart());
1844 VisiblePosition endOfSelection(newSelection.visibleEnd()); 1851 VisiblePosition endOfSelection(newSelection.visibleEnd());
1845 1852
1846 // If the end of the selection to modify is just after a table, and if the 1853 // If the end of the selection to modify is just after a table, and if the
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
2160 return InputType::DeleteSoftLineBackward; 2167 return InputType::DeleteSoftLineBackward;
2161 if (granularity == ParagraphBoundary) 2168 if (granularity == ParagraphBoundary)
2162 return InputType::DeleteHardLineBackward; 2169 return InputType::DeleteHardLineBackward;
2163 return InputType::DeleteContentBackward; 2170 return InputType::DeleteContentBackward;
2164 default: 2171 default:
2165 return InputType::None; 2172 return InputType::None;
2166 } 2173 }
2167 } 2174 }
2168 2175
2169 } // namespace blink 2176 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698