Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved. |
| 3 * Copyright (C) 2005 Alexey Proskuryakov. | 3 * Copyright (C) 2005 Alexey Proskuryakov. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 resultEnd = textRunStartPosition; | 141 resultEnd = textRunStartPosition; |
| 142 else | 142 else |
| 143 resultEnd = textRunEndPosition; | 143 resultEnd = textRunEndPosition; |
| 144 } | 144 } |
| 145 docTextPosition += len; | 145 docTextPosition += len; |
| 146 break; | 146 break; |
| 147 } | 147 } |
| 148 docTextPosition += len; | 148 docTextPosition += len; |
| 149 } | 149 } |
| 150 | 150 |
| 151 if (!startRangeFound) | 151 if (!startRangeFound) { |
|
Changwan Ryu
2016/04/04 06:23:13
Could you leave some comment on how startRangeFoun
yabinh
2016/04/04 08:31:51
OK.
| |
| 152 return EphemeralRange(); | 152 // If cursor position exceeds the right boundary, it should stay at the right boundary |
| 153 resultStart = textRunEndPosition; | |
| 154 resultEnd = textRunEndPosition; | |
| 155 } | |
| 153 | 156 |
| 154 if (length() && end() > docTextPosition) { // end() is out of bounds | 157 if (length() && end() > docTextPosition) { // end() is out of bounds |
| 155 resultEnd = textRunEndPosition; | 158 resultEnd = textRunEndPosition; |
| 156 } | 159 } |
| 157 | 160 |
| 158 return EphemeralRange(resultStart.toOffsetInAnchor(), resultEnd.toOffsetInAn chor()); | 161 return EphemeralRange(resultStart.toOffsetInAnchor(), resultEnd.toOffsetInAn chor()); |
| 159 } | 162 } |
| 160 | 163 |
| 161 PlainTextRange PlainTextRange::create(const ContainerNode& scope, const Ephemera lRange& range) | 164 PlainTextRange PlainTextRange::create(const ContainerNode& scope, const Ephemera lRange& range) |
| 162 { | 165 { |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 180 | 183 |
| 181 return PlainTextRange(start, end); | 184 return PlainTextRange(start, end); |
| 182 } | 185 } |
| 183 | 186 |
| 184 PlainTextRange PlainTextRange::create(const ContainerNode& scope, const Range& r ange) | 187 PlainTextRange PlainTextRange::create(const ContainerNode& scope, const Range& r ange) |
| 185 { | 188 { |
| 186 return create(scope, EphemeralRange(&range)); | 189 return create(scope, EphemeralRange(&range)); |
| 187 } | 190 } |
| 188 | 191 |
| 189 } // namespace blink | 192 } // namespace blink |
| OLD | NEW |