OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 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 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1056 if (isNull()) | 1056 if (isNull()) |
1057 return Position(); | 1057 return Position(); |
1058 | 1058 |
1059 if (isHTMLBRElement(*upstream().deprecatedNode())) | 1059 if (isHTMLBRElement(*upstream().deprecatedNode())) |
1060 return Position(); | 1060 return Position(); |
1061 | 1061 |
1062 Position prev = previousCharacterPosition(affinity); | 1062 Position prev = previousCharacterPosition(affinity); |
1063 if (prev != *this && prev.deprecatedNode()->inSameContainingBlockFlowElement (deprecatedNode()) && prev.deprecatedNode()->isTextNode()) { | 1063 if (prev != *this && prev.deprecatedNode()->inSameContainingBlockFlowElement (deprecatedNode()) && prev.deprecatedNode()->isTextNode()) { |
1064 String string = toText(prev.deprecatedNode())->data(); | 1064 String string = toText(prev.deprecatedNode())->data(); |
1065 UChar c = string[prev.deprecatedEditingOffset()]; | 1065 UChar c = string[prev.deprecatedEditingOffset()]; |
1066 if (considerNonCollapsibleWhitespace ? (isSpaceOrNewline(c) || c == noBr eakSpace) : isCollapsibleWhitespace(c)) | 1066 if (considerNonCollapsibleWhitespace ? (isSpaceOrNewline(c) || c == noBr eakSpace) : prev.deprecatedNode()->renderer()->style()->isCollapsibleWhiteSpace( c)) |
esprehn
2014/04/01 00:25:55
How do you know the renderer() is available here?
| |
1067 if (isEditablePosition(prev)) | 1067 if (isEditablePosition(prev)) |
1068 return prev; | 1068 return prev; |
1069 } | 1069 } |
1070 | 1070 |
1071 return Position(); | 1071 return Position(); |
1072 } | 1072 } |
1073 | 1073 |
1074 // This assumes that it starts in editable content. | 1074 // This assumes that it starts in editable content. |
1075 Position Position::trailingWhitespacePosition(EAffinity, bool considerNonCollaps ibleWhitespace) const | 1075 Position Position::trailingWhitespacePosition(EAffinity, bool considerNonCollaps ibleWhitespace) const |
1076 { | 1076 { |
1077 ASSERT(isEditablePosition(*this, ContentIsEditable, DoNotUpdateStyle)); | 1077 ASSERT(isEditablePosition(*this, ContentIsEditable, DoNotUpdateStyle)); |
1078 if (isNull()) | 1078 if (isNull()) |
1079 return Position(); | 1079 return Position(); |
1080 | 1080 |
1081 VisiblePosition v(*this); | 1081 VisiblePosition v(*this); |
1082 UChar c = v.characterAfter(); | 1082 UChar c = v.characterAfter(); |
1083 // The space must not be in another paragraph and it must be editable. | 1083 // The space must not be in another paragraph and it must be editable. |
1084 if (!isEndOfParagraph(v) && v.next(CannotCrossEditingBoundary).isNotNull()) | 1084 if (!isEndOfParagraph(v) && v.next(CannotCrossEditingBoundary).isNotNull()) |
1085 if (considerNonCollapsibleWhitespace ? (isSpaceOrNewline(c) || c == noBr eakSpace) : isCollapsibleWhitespace(c)) | 1085 if (considerNonCollapsibleWhitespace ? (isSpaceOrNewline(c) || c == noBr eakSpace) : deprecatedNode()->renderer()->style()->isCollapsibleWhiteSpace(c)) |
esprehn
2014/04/01 00:25:55
ditto
| |
1086 return *this; | 1086 return *this; |
1087 | 1087 |
1088 return Position(); | 1088 return Position(); |
1089 } | 1089 } |
1090 | 1090 |
1091 void Position::getInlineBoxAndOffset(EAffinity affinity, InlineBox*& inlineBox, int& caretOffset) const | 1091 void Position::getInlineBoxAndOffset(EAffinity affinity, InlineBox*& inlineBox, int& caretOffset) const |
1092 { | 1092 { |
1093 getInlineBoxAndOffset(affinity, primaryDirection(), inlineBox, caretOffset); | 1093 getInlineBoxAndOffset(affinity, primaryDirection(), inlineBox, caretOffset); |
1094 } | 1094 } |
1095 | 1095 |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1388 pos.showTreeForThis(); | 1388 pos.showTreeForThis(); |
1389 } | 1389 } |
1390 | 1390 |
1391 void showTree(const WebCore::Position* pos) | 1391 void showTree(const WebCore::Position* pos) |
1392 { | 1392 { |
1393 if (pos) | 1393 if (pos) |
1394 pos->showTreeForThis(); | 1394 pos->showTreeForThis(); |
1395 } | 1395 } |
1396 | 1396 |
1397 #endif | 1397 #endif |
OLD | NEW |