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

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

Issue 1203613003: Make inSameLine() in VisibleUnits.cpp to work with positions in composed tree (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-06-24T17:52:54 Get rid of redundant explict in RenderedPosition Created 5 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
« no previous file with comments | « Source/core/editing/VisibleUnitsTest.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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 // This file contains a set of helper functions used by the editing commands 52 // This file contains a set of helper functions used by the editing commands
53 53
54 // ------------------------------------------------------------------------- 54 // -------------------------------------------------------------------------
55 // Node 55 // Node
56 // ------------------------------------------------------------------------- 56 // -------------------------------------------------------------------------
57 57
58 // Functions returning Node 58 // Functions returning Node
59 59
60 CORE_EXPORT ContainerNode* highestEditableRoot(const Position&, EditableType = C ontentIsEditable); 60 CORE_EXPORT ContainerNode* highestEditableRoot(const Position&, EditableType = C ontentIsEditable);
61 ContainerNode* highestEditableRoot(const PositionInComposedTree&, EditableType = ContentIsEditable);
61 62
62 Node* highestEnclosingNodeOfType(const Position&, bool (*nodeIsOfType)(const Nod e*), 63 Node* highestEnclosingNodeOfType(const Position&, bool (*nodeIsOfType)(const Nod e*),
63 EditingBoundaryCrossingRule = CannotCrossEditingBoundary, Node* stayWithin = nullptr); 64 EditingBoundaryCrossingRule = CannotCrossEditingBoundary, Node* stayWithin = nullptr);
64 Node* highestNodeToRemoveInPruning(Node*, Node* excludeNode = nullptr); 65 Node* highestNodeToRemoveInPruning(Node*, Node* excludeNode = nullptr);
65 Element* lowestEditableAncestor(Node*); 66 Element* lowestEditableAncestor(Node*);
66 67
67 Element* enclosingBlock(Node*, EditingBoundaryCrossingRule = CannotCrossEditingB oundary); 68 Element* enclosingBlock(Node*, EditingBoundaryCrossingRule = CannotCrossEditingB oundary);
68 Element* enclosingBlockFlowElement(Node&); // Deprecated, use enclosingBlock ins tead. 69 Element* enclosingBlockFlowElement(Node&); // Deprecated, use enclosingBlock ins tead.
69 bool inSameContainingBlockFlowElement(Node*, Node*); 70 bool inSameContainingBlockFlowElement(Node*, Node*);
70 Element* enclosingTableCell(const Position&); 71 Element* enclosingTableCell(const Position&);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 128
128 // Functions returning Position 129 // Functions returning Position
129 130
130 Position nextCandidate(const Position&); 131 Position nextCandidate(const Position&);
131 PositionInComposedTree nextCandidate(const PositionInComposedTree&); 132 PositionInComposedTree nextCandidate(const PositionInComposedTree&);
132 Position previousCandidate(const Position&); 133 Position previousCandidate(const Position&);
133 PositionInComposedTree previousCandidate(const PositionInComposedTree&); 134 PositionInComposedTree previousCandidate(const PositionInComposedTree&);
134 135
135 Position nextVisuallyDistinctCandidate(const Position&); 136 Position nextVisuallyDistinctCandidate(const Position&);
136 Position previousVisuallyDistinctCandidate(const Position&); 137 Position previousVisuallyDistinctCandidate(const Position&);
138 PositionInComposedTree previousVisuallyDistinctCandidate(const PositionInCompose dTree&);
137 139
138 Position positionBeforeContainingSpecialElement(const Position&, HTMLElement** c ontainingSpecialElement = nullptr); 140 Position positionBeforeContainingSpecialElement(const Position&, HTMLElement** c ontainingSpecialElement = nullptr);
139 Position positionAfterContainingSpecialElement(const Position&, HTMLElement** co ntainingSpecialElement = nullptr); 141 Position positionAfterContainingSpecialElement(const Position&, HTMLElement** co ntainingSpecialElement = nullptr);
140 142
141 inline Position firstPositionInOrBeforeNode(Node* node) 143 inline Position firstPositionInOrBeforeNode(Node* node)
142 { 144 {
143 return Position::firstPositionInOrBeforeNode(node); 145 return Position::firstPositionInOrBeforeNode(node);
144 } 146 }
145 147
146 inline Position lastPositionInOrAfterNode(Node* node) 148 inline Position lastPositionInOrAfterNode(Node* node)
147 { 149 {
148 return Position::lastPositionInOrAfterNode(node); 150 return Position::lastPositionInOrAfterNode(node);
149 } 151 }
150 152
151 Position lastEditablePositionBeforePositionInRoot(const Position&, Node*); 153 Position lastEditablePositionBeforePositionInRoot(const Position&, Node*);
154 PositionInComposedTree lastEditablePositionBeforePositionInRoot(const PositionIn ComposedTree&, Node*);
152 155
153 // comparision functions on Position 156 // comparision functions on Position
154 157
155 int comparePositions(const Position&, const Position&); 158 int comparePositions(const Position&, const Position&);
156 int comparePositions(const PositionWithAffinity&, const PositionWithAffinity&); 159 int comparePositions(const PositionWithAffinity&, const PositionWithAffinity&);
157 160
158 // boolean functions on Position 161 // boolean functions on Position
159 162
160 enum EUpdateStyle { UpdateStyle, DoNotUpdateStyle }; 163 enum EUpdateStyle { UpdateStyle, DoNotUpdateStyle };
161 // FIXME: Both isEditablePosition and isRichlyEditablePosition rely on up-to-dat e 164 // FIXME: Both isEditablePosition and isRichlyEditablePosition rely on up-to-dat e
162 // style to give proper results. They shouldn't update style by default, but 165 // style to give proper results. They shouldn't update style by default, but
163 // should make it clear that that is the contract. 166 // should make it clear that that is the contract.
164 // FIXME: isRichlyEditablePosition should also take EUpdateStyle. 167 // FIXME: isRichlyEditablePosition should also take EUpdateStyle.
165 bool isEditablePosition(const Position&, EditableType = ContentIsEditable, EUpda teStyle = UpdateStyle); 168 bool isEditablePosition(const Position&, EditableType = ContentIsEditable, EUpda teStyle = UpdateStyle);
169 bool isEditablePosition(const PositionInComposedTree&, EditableType = ContentIsE ditable, EUpdateStyle = UpdateStyle);
166 bool isRichlyEditablePosition(const Position&, EditableType = ContentIsEditable) ; 170 bool isRichlyEditablePosition(const Position&, EditableType = ContentIsEditable) ;
167 bool lineBreakExistsAtPosition(const Position&); 171 bool lineBreakExistsAtPosition(const Position&);
168 bool isAtUnsplittableElement(const Position&); 172 bool isAtUnsplittableElement(const Position&);
169 173
170 // miscellaneous functions on Position 174 // miscellaneous functions on Position
171 175
172 enum WhitespacePositionOption { NotConsiderNonCollapsibleWhitespace, ConsiderNon CollapsibleWhitespace }; 176 enum WhitespacePositionOption { NotConsiderNonCollapsibleWhitespace, ConsiderNon CollapsibleWhitespace };
173 Position leadingWhitespacePosition(const Position&, EAffinity, WhitespacePositio nOption = NotConsiderNonCollapsibleWhitespace); 177 Position leadingWhitespacePosition(const Position&, EAffinity, WhitespacePositio nOption = NotConsiderNonCollapsibleWhitespace);
174 Position trailingWhitespacePosition(const Position&, EAffinity, WhitespacePositi onOption = NotConsiderNonCollapsibleWhitespace); 178 Position trailingWhitespacePosition(const Position&, EAffinity, WhitespacePositi onOption = NotConsiderNonCollapsibleWhitespace);
175 unsigned numEnclosingMailBlockquotes(const Position&); 179 unsigned numEnclosingMailBlockquotes(const Position&);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 // 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.
257 return character == '\'' || character == rightSingleQuotationMarkCharacter | | character == hebrewPunctuationGershayimCharacter; 261 return character == '\'' || character == rightSingleQuotationMarkCharacter | | character == hebrewPunctuationGershayimCharacter;
258 } 262 }
259 263
260 String stringWithRebalancedWhitespace(const String&, bool startIsStartOfParagrap h, bool endIsEndOfParagraph); 264 String stringWithRebalancedWhitespace(const String&, bool startIsStartOfParagrap h, bool endIsEndOfParagraph);
261 const String& nonBreakingSpaceString(); 265 const String& nonBreakingSpaceString();
262 266
263 } 267 }
264 268
265 #endif 269 #endif
OLDNEW
« no previous file with comments | « Source/core/editing/VisibleUnitsTest.cpp ('k') | Source/core/editing/htmlediting.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698