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

Side by Side Diff: Source/core/editing/htmlediting.h

Issue 717603002: Clean up htmlediting (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing Created 6 years 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
« no previous file with comments | « Source/core/editing/ReplaceSelectionCommand.cpp ('k') | Source/core/editing/htmlediting.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2008 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 bool isTabHTMLSpanElement(const Node*); 108 bool isTabHTMLSpanElement(const Node*);
109 bool isTabHTMLSpanElementTextNode(const Node*); 109 bool isTabHTMLSpanElementTextNode(const Node*);
110 bool isMailHTMLBlockquoteElement(const Node*); 110 bool isMailHTMLBlockquoteElement(const Node*);
111 bool isRenderedTableElement(const Node*); 111 bool isRenderedTableElement(const Node*);
112 bool isRenderedHTMLTableElement(const Node*); 112 bool isRenderedHTMLTableElement(const Node*);
113 bool isTableCell(const Node*); 113 bool isTableCell(const Node*);
114 bool isEmptyTableCell(const Node*); 114 bool isEmptyTableCell(const Node*);
115 bool isTableStructureNode(const Node*); 115 bool isTableStructureNode(const Node*);
116 bool isHTMLListElement(Node*); 116 bool isHTMLListElement(Node*);
117 bool isListItem(const Node*); 117 bool isListItem(const Node*);
118 bool isNodeRendered(const Node*); 118 bool isNodeRendered(const Node&);
119 bool isNodeVisiblyContainedWithin(Node&, const Range&); 119 bool isNodeVisiblyContainedWithin(Node&, const Range&);
120 bool isRenderedAsNonInlineTableImageOrHR(const Node*); 120 bool isRenderedAsNonInlineTableImageOrHR(const Node*);
121 bool areIdenticalElements(const Node*, const Node*); 121 bool areIdenticalElements(const Node*, const Node*);
122 bool isNonTableCellHTMLBlockElement(const Node*); 122 bool isNonTableCellHTMLBlockElement(const Node*);
123 bool isBlockFlowElement(const Node&); 123 bool isBlockFlowElement(const Node&);
124 TextDirection directionOfEnclosingBlock(const Position&); 124 TextDirection directionOfEnclosingBlock(const Position&);
125 125
126 // ------------------------------------------------------------------------- 126 // -------------------------------------------------------------------------
127 // Position 127 // Position
128 // ------------------------------------------------------------------------- 128 // -------------------------------------------------------------------------
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // boolean functions on Position 162 // boolean functions on Position
163 163
164 enum EUpdateStyle { UpdateStyle, DoNotUpdateStyle }; 164 enum EUpdateStyle { UpdateStyle, DoNotUpdateStyle };
165 // FIXME: Both isEditablePosition and isRichlyEditablePosition rely on up-to-dat e 165 // FIXME: Both isEditablePosition and isRichlyEditablePosition rely on up-to-dat e
166 // style to give proper results. They shouldn't update style by default, but 166 // style to give proper results. They shouldn't update style by default, but
167 // should make it clear that that is the contract. 167 // should make it clear that that is the contract.
168 // FIXME: isRichlyEditablePosition should also take EUpdateStyle. 168 // FIXME: isRichlyEditablePosition should also take EUpdateStyle.
169 bool isEditablePosition(const Position&, EditableType = ContentIsEditable, EUpda teStyle = UpdateStyle); 169 bool isEditablePosition(const Position&, EditableType = ContentIsEditable, EUpda teStyle = UpdateStyle);
170 bool isRichlyEditablePosition(const Position&, EditableType = ContentIsEditable) ; 170 bool isRichlyEditablePosition(const Position&, EditableType = ContentIsEditable) ;
171 bool lineBreakExistsAtPosition(const Position&); 171 bool lineBreakExistsAtPosition(const Position&);
172 bool isVisiblyAdjacent(const Position& first, const Position& second);
173 bool isAtUnsplittableElement(const Position&); 172 bool isAtUnsplittableElement(const Position&);
174 173
175 // miscellaneous functions on Position 174 // miscellaneous functions on Position
176 175
177 enum WhitespacePositionOption { NotConsiderNonCollapsibleWhitespace, ConsiderNon CollapsibleWhitespace }; 176 enum WhitespacePositionOption { NotConsiderNonCollapsibleWhitespace, ConsiderNon CollapsibleWhitespace };
178 Position leadingWhitespacePosition(const Position&, EAffinity, WhitespacePositio nOption = NotConsiderNonCollapsibleWhitespace); 177 Position leadingWhitespacePosition(const Position&, EAffinity, WhitespacePositio nOption = NotConsiderNonCollapsibleWhitespace);
179 Position trailingWhitespacePosition(const Position&, EAffinity, WhitespacePositi onOption = NotConsiderNonCollapsibleWhitespace); 178 Position trailingWhitespacePosition(const Position&, EAffinity, WhitespacePositi onOption = NotConsiderNonCollapsibleWhitespace);
180 unsigned numEnclosingMailBlockquotes(const Position&); 179 unsigned numEnclosingMailBlockquotes(const Position&);
181 void updatePositionForNodeRemoval(Position&, Node&); 180 void updatePositionForNodeRemoval(Position&, Node&);
182 181
183 // ------------------------------------------------------------------------- 182 // -------------------------------------------------------------------------
184 // VisiblePosition 183 // VisiblePosition
185 // ------------------------------------------------------------------------- 184 // -------------------------------------------------------------------------
186 185
187 // Functions returning VisiblePosition 186 // Functions returning VisiblePosition
188 187
189 VisiblePosition firstEditableVisiblePositionAfterPositionInRoot(const Position&, ContainerNode*); 188 VisiblePosition firstEditableVisiblePositionAfterPositionInRoot(const Position&, ContainerNode*);
190 VisiblePosition lastEditableVisiblePositionBeforePositionInRoot(const Position&, ContainerNode*); 189 VisiblePosition lastEditableVisiblePositionBeforePositionInRoot(const Position&, ContainerNode*);
191 VisiblePosition visiblePositionBeforeNode(Node&); 190 VisiblePosition visiblePositionBeforeNode(Node&);
192 VisiblePosition visiblePositionAfterNode(Node&); 191 VisiblePosition visiblePositionAfterNode(Node&);
193 192
194 bool lineBreakExistsAtVisiblePosition(const VisiblePosition&); 193 bool lineBreakExistsAtVisiblePosition(const VisiblePosition&);
195 194
196 int comparePositions(const VisiblePosition&, const VisiblePosition&); 195 int comparePositions(const VisiblePosition&, const VisiblePosition&);
197 196
198 int indexForVisiblePosition(const VisiblePosition&, RefPtrWillBeRawPtr<Container Node>& scope); 197 int indexForVisiblePosition(const VisiblePosition&, RefPtrWillBeRawPtr<Container Node>& scope);
199 VisiblePosition visiblePositionForIndex(int index, ContainerNode* scope); 198 VisiblePosition visiblePositionForIndex(int index, ContainerNode* scope);
200 199
201 // ------------------------------------------------------------------------- 200 // -------------------------------------------------------------------------
202 // Range
203 // -------------------------------------------------------------------------
204
205 // Functions returning Range
206
207 PassRefPtrWillBeRawPtr<Range> createRange(Document&, const VisiblePosition& star t, const VisiblePosition& end, ExceptionState&);
208
209 // -------------------------------------------------------------------------
210 // HTMLElement 201 // HTMLElement
211 // ------------------------------------------------------------------------- 202 // -------------------------------------------------------------------------
212 203
213 // Functions returning HTMLElement 204 // Functions returning HTMLElement
214 205
215 PassRefPtrWillBeRawPtr<HTMLElement> createDefaultParagraphElement(Document&); 206 PassRefPtrWillBeRawPtr<HTMLElement> createDefaultParagraphElement(Document&);
216 PassRefPtrWillBeRawPtr<HTMLBRElement> createBreakElement(Document&); 207 PassRefPtrWillBeRawPtr<HTMLBRElement> createBreakElement(Document&);
217 PassRefPtrWillBeRawPtr<HTMLOListElement> createOrderedListElement(Document&); 208 PassRefPtrWillBeRawPtr<HTMLOListElement> createOrderedListElement(Document&);
218 PassRefPtrWillBeRawPtr<HTMLUListElement> createUnorderedListElement(Document&); 209 PassRefPtrWillBeRawPtr<HTMLUListElement> createUnorderedListElement(Document&);
219 PassRefPtrWillBeRawPtr<HTMLLIElement> createListItemElement(Document&); 210 PassRefPtrWillBeRawPtr<HTMLLIElement> createListItemElement(Document&);
220 PassRefPtrWillBeRawPtr<HTMLElement> createHTMLElement(Document&, const Qualified Name&); 211 PassRefPtrWillBeRawPtr<HTMLElement> createHTMLElement(Document&, const Qualified Name&);
221 PassRefPtrWillBeRawPtr<HTMLElement> createHTMLElement(Document&, const AtomicStr ing&);
222 212
223 HTMLElement* enclosingList(Node*); 213 HTMLElement* enclosingList(Node*);
224 HTMLElement* outermostEnclosingList(Node*, HTMLElement* rootList = nullptr); 214 HTMLElement* outermostEnclosingList(Node*, HTMLElement* rootList = nullptr);
225 Node* enclosingListChild(Node*); 215 Node* enclosingListChild(Node*);
226 216
227 // ------------------------------------------------------------------------- 217 // -------------------------------------------------------------------------
228 // Element 218 // Element
229 // ------------------------------------------------------------------------- 219 // -------------------------------------------------------------------------
230 220
231 // Functions returning Element 221 // Functions returning Element
232 222
233 PassRefPtrWillBeRawPtr<HTMLSpanElement> createTabSpanElement(Document&); 223 PassRefPtrWillBeRawPtr<HTMLSpanElement> createTabSpanElement(Document&);
234 PassRefPtrWillBeRawPtr<HTMLSpanElement> createTabSpanElement(Document&, PassRefP trWillBeRawPtr<Text> tabTextNode);
235 PassRefPtrWillBeRawPtr<HTMLSpanElement> createTabSpanElement(Document&, const St ring& tabText); 224 PassRefPtrWillBeRawPtr<HTMLSpanElement> createTabSpanElement(Document&, const St ring& tabText);
236 PassRefPtrWillBeRawPtr<HTMLBRElement> createBlockPlaceholderElement(Document&); 225 PassRefPtrWillBeRawPtr<HTMLBRElement> createBlockPlaceholderElement(Document&);
237 226
238 Element* editableRootForPosition(const Position&, EditableType = ContentIsEditab le); 227 Element* editableRootForPosition(const Position&, EditableType = ContentIsEditab le);
239 Element* unsplittableElementForPosition(const Position&); 228 Element* unsplittableElementForPosition(const Position&);
240 229
241 // Boolean functions on Element 230 // Boolean functions on Element
242 231
243 bool canMergeLists(Element* firstList, Element* secondList); 232 bool canMergeLists(Element* firstList, Element* secondList);
244 233
(...skipping 26 matching lines...) Expand all
271 // FIXME: this is required until 6853027 is fixed and text checking can do t his for us. 260 // FIXME: this is required until 6853027 is fixed and text checking can do t his for us.
272 return character == '\'' || character == rightSingleQuotationMark || charact er == hebrewPunctuationGershayim; 261 return character == '\'' || character == rightSingleQuotationMark || charact er == hebrewPunctuationGershayim;
273 } 262 }
274 263
275 String stringWithRebalancedWhitespace(const String&, bool startIsStartOfParagrap h, bool endIsEndOfParagraph); 264 String stringWithRebalancedWhitespace(const String&, bool startIsStartOfParagrap h, bool endIsEndOfParagraph);
276 const String& nonBreakingSpaceString(); 265 const String& nonBreakingSpaceString();
277 266
278 } 267 }
279 268
280 #endif 269 #endif
OLDNEW
« no previous file with comments | « Source/core/editing/ReplaceSelectionCommand.cpp ('k') | Source/core/editing/htmlediting.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698