Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. |
| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 // FIXME (9535): Canonicalizing to the leftmost candidate means that if | 95 // FIXME (9535): Canonicalizing to the leftmost candidate means that if |
| 96 // we're at a line wrap, we will ask layoutObjects to paint downstream | 96 // we're at a line wrap, we will ask layoutObjects to paint downstream |
| 97 // carets for other layoutObjects. To fix this, we need to either a) add | 97 // carets for other layoutObjects. To fix this, we need to either a) add |
| 98 // code to all paintCarets to pass the responsibility off to the appropriate | 98 // code to all paintCarets to pass the responsibility off to the appropriate |
| 99 // layoutObject for VisiblePosition's like these, or b) canonicalize to the | 99 // layoutObject for VisiblePosition's like these, or b) canonicalize to the |
| 100 // rightmost candidate unless the affinity is upstream. | 100 // rightmost candidate unless the affinity is upstream. |
| 101 if (position.isNull()) | 101 if (position.isNull()) |
| 102 return PositionType(); | 102 return PositionType(); |
| 103 | 103 |
| 104 DCHECK(position.document()); | 104 DCHECK(position.document()); |
| 105 position.document()->updateStyleAndLayoutIgnorePendingStylesheets(); | 105 DCHECK(!position.document()->needsLayoutTreeUpdate()); |
| 106 | 106 |
| 107 Node* node = position.computeContainerNode(); | 107 Node* node = position.computeContainerNode(); |
| 108 | 108 |
| 109 PositionType candidate = mostBackwardCaretPosition(position); | 109 PositionType candidate = mostBackwardCaretPosition(position); |
| 110 if (isVisuallyEquivalentCandidate(candidate)) | 110 if (isVisuallyEquivalentCandidate(candidate)) |
| 111 return candidate; | 111 return candidate; |
| 112 candidate = mostForwardCaretPosition(position); | 112 candidate = mostForwardCaretPosition(position); |
| 113 if (isVisuallyEquivalentCandidate(candidate)) | 113 if (isVisuallyEquivalentCandidate(candidate)) |
| 114 return candidate; | 114 return candidate; |
| 115 | 115 |
| (...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1233 VisiblePositionInFlatTree logicalEndOfLine(const VisiblePositionInFlatTree& curr entPosition) | 1233 VisiblePositionInFlatTree logicalEndOfLine(const VisiblePositionInFlatTree& curr entPosition) |
| 1234 { | 1234 { |
| 1235 return logicalEndOfLineAlgorithm<EditingInFlatTreeStrategy>(currentPosition) ; | 1235 return logicalEndOfLineAlgorithm<EditingInFlatTreeStrategy>(currentPosition) ; |
| 1236 } | 1236 } |
| 1237 | 1237 |
| 1238 template <typename Strategy> | 1238 template <typename Strategy> |
| 1239 bool inSameLineAlgorithm(const PositionWithAffinityTemplate<Strategy>& position1 , const PositionWithAffinityTemplate<Strategy>& position2) | 1239 bool inSameLineAlgorithm(const PositionWithAffinityTemplate<Strategy>& position1 , const PositionWithAffinityTemplate<Strategy>& position2) |
| 1240 { | 1240 { |
| 1241 if (position1.isNull() || position2.isNull()) | 1241 if (position1.isNull() || position2.isNull()) |
| 1242 return false; | 1242 return false; |
| 1243 if (position1.position().document() != position2.position().document()) | |
|
yosin_UTC9
2016/09/12 09:25:03
Could you change this to DCHEC_EQ(position1.positi
Xiaocheng
2016/09/12 11:20:49
Done.
Haven't found any call site that may compar
| |
| 1244 return false; | |
| 1245 | |
| 1246 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets | |
| 1247 // needs to be audited. See http://crbug.com/590369 for more details. | |
| 1248 position1.position().document()->updateStyleAndLayoutIgnorePendingStylesheet s(); | |
| 1249 | |
| 1243 PositionWithAffinityTemplate<Strategy> startOfLine1 = startOfLine(position1) ; | 1250 PositionWithAffinityTemplate<Strategy> startOfLine1 = startOfLine(position1) ; |
| 1244 PositionWithAffinityTemplate<Strategy> startOfLine2 = startOfLine(position2) ; | 1251 PositionWithAffinityTemplate<Strategy> startOfLine2 = startOfLine(position2) ; |
| 1245 if (startOfLine1 == startOfLine2) | 1252 if (startOfLine1 == startOfLine2) |
| 1246 return true; | 1253 return true; |
| 1247 PositionTemplate<Strategy> canonicalized1 = canonicalPositionOf(startOfLine1 .position()); | 1254 PositionTemplate<Strategy> canonicalized1 = canonicalPositionOf(startOfLine1 .position()); |
| 1248 if (canonicalized1 == startOfLine2.position()) | 1255 if (canonicalized1 == startOfLine2.position()) |
| 1249 return true; | 1256 return true; |
| 1250 return canonicalized1 == canonicalPositionOf(startOfLine2.position()); | 1257 return canonicalized1 == canonicalPositionOf(startOfLine2.position()); |
| 1251 } | 1258 } |
| 1252 | 1259 |
| (...skipping 2063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3316 { | 3323 { |
| 3317 return previousPositionOfAlgorithm<EditingStrategy>(visiblePosition, rule); | 3324 return previousPositionOfAlgorithm<EditingStrategy>(visiblePosition, rule); |
| 3318 } | 3325 } |
| 3319 | 3326 |
| 3320 VisiblePositionInFlatTree previousPositionOf(const VisiblePositionInFlatTree& vi siblePosition, EditingBoundaryCrossingRule rule) | 3327 VisiblePositionInFlatTree previousPositionOf(const VisiblePositionInFlatTree& vi siblePosition, EditingBoundaryCrossingRule rule) |
| 3321 { | 3328 { |
| 3322 return previousPositionOfAlgorithm<EditingInFlatTreeStrategy>(visiblePositio n, rule); | 3329 return previousPositionOfAlgorithm<EditingInFlatTreeStrategy>(visiblePositio n, rule); |
| 3323 } | 3330 } |
| 3324 | 3331 |
| 3325 } // namespace blink | 3332 } // namespace blink |
| OLD | NEW |