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 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. |
4 * Copyright (C) 2011 Igalia S.L. | 4 * Copyright (C) 2011 Igalia S.L. |
5 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 5 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
241 | 241 |
242 String StyledMarkupAccumulator::renderedText(Node& node, const Range* range) | 242 String StyledMarkupAccumulator::renderedText(Node& node, const Range* range) |
243 { | 243 { |
244 if (!node.isTextNode()) | 244 if (!node.isTextNode()) |
245 return String(); | 245 return String(); |
246 | 246 |
247 const Text& textNode = toText(node); | 247 const Text& textNode = toText(node); |
248 unsigned startOffset = 0; | 248 unsigned startOffset = 0; |
249 unsigned endOffset = textNode.length(); | 249 unsigned endOffset = textNode.length(); |
250 | 250 |
251 TextIteratorBehavior behavior = TextIteratorDefaultBehavior; | |
tyoshino (SeeGerritForStatus)
2014/02/17 09:20:51
Move to right above L254?
| |
251 if (range && node == range->startContainer()) | 252 if (range && node == range->startContainer()) |
252 startOffset = range->startOffset(); | 253 startOffset = range->startOffset(); |
tyoshino (SeeGerritForStatus)
2014/02/17 09:20:51
have one blank line here?
| |
253 if (range && node == range->endContainer()) | 254 if (range && node == range->endContainer()) |
254 endOffset = range->endOffset(); | 255 endOffset = range->endOffset(); |
256 else if (range) | |
257 behavior = TextIteratorBehavesAsIfNodesFollowing; | |
tyoshino (SeeGerritForStatus)
2014/02/17 09:20:51
let's factor out |range| checking into outer if-cl
| |
255 | 258 |
256 Position start = createLegacyEditingPosition(&node, startOffset); | 259 Position start = createLegacyEditingPosition(&node, startOffset); |
257 Position end = createLegacyEditingPosition(&node, endOffset); | 260 Position end = createLegacyEditingPosition(&node, endOffset); |
258 return plainText(Range::create(node.document(), start, end).get()); | 261 return plainText(Range::create(node.document(), start, end).get(), behavior) ; |
259 } | 262 } |
260 | 263 |
261 String StyledMarkupAccumulator::stringValueForRange(const Node& node, const Rang e* range) | 264 String StyledMarkupAccumulator::stringValueForRange(const Node& node, const Rang e* range) |
262 { | 265 { |
263 if (!range) | 266 if (!range) |
264 return node.nodeValue(); | 267 return node.nodeValue(); |
265 | 268 |
266 String str = node.nodeValue(); | 269 String str = node.nodeValue(); |
267 if (node == range->endContainer()) | 270 if (node == range->endContainer()) |
268 str.truncate(range->endOffset()); | 271 str.truncate(range->endOffset()); |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1044 return; | 1047 return; |
1045 | 1048 |
1046 RefPtr<Text> textNode = toText(node.get()); | 1049 RefPtr<Text> textNode = toText(node.get()); |
1047 RefPtr<Text> textNext = toText(next); | 1050 RefPtr<Text> textNext = toText(next); |
1048 textNode->appendData(textNext->data()); | 1051 textNode->appendData(textNext->data()); |
1049 if (textNext->parentNode()) // Might have been removed by mutation event. | 1052 if (textNext->parentNode()) // Might have been removed by mutation event. |
1050 textNext->remove(exceptionState); | 1053 textNext->remove(exceptionState); |
1051 } | 1054 } |
1052 | 1055 |
1053 } | 1056 } |
OLD | NEW |