OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Google Inc. All rights reserved. | 3 * Copyright (C) 2010 Google Inc. All rights reserved. |
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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 // Include \n at the end of line if we're at an empty paragraph | 220 // Include \n at the end of line if we're at an empty paragraph |
221 if (endStyle->preserveNewline() && start == end && end.offsetInContainer
Node() < end.computeContainerNode()->maxCharacterOffset()) { | 221 if (endStyle->preserveNewline() && start == end && end.offsetInContainer
Node() < end.computeContainerNode()->maxCharacterOffset()) { |
222 int endOffset = end.offsetInContainerNode(); | 222 int endOffset = end.offsetInContainerNode(); |
223 if (!isNewLineAtPosition(end.previous()) && isNewLineAtPosition(end)
) | 223 if (!isNewLineAtPosition(end.previous()) && isNewLineAtPosition(end)
) |
224 end = Position(end.computeContainerNode(), endOffset + 1); | 224 end = Position(end.computeContainerNode(), endOffset + 1); |
225 if (isEndAndEndOfLastParagraphOnSameNode && end.offsetInContainerNod
e() >= m_endOfLastParagraph.offsetInContainerNode()) | 225 if (isEndAndEndOfLastParagraphOnSameNode && end.offsetInContainerNod
e() >= m_endOfLastParagraph.offsetInContainerNode()) |
226 m_endOfLastParagraph = end; | 226 m_endOfLastParagraph = end; |
227 } | 227 } |
228 | 228 |
229 // If end is in the middle of a text node, split. | 229 // If end is in the middle of a text node, split. |
230 if (!endStyle->collapseWhiteSpace() && end.offsetInContainerNode() && en
d.offsetInContainerNode() < end.computeContainerNode()->maxCharacterOffset()) { | 230 if (endStyle->userModify() != READ_ONLY && !endStyle->collapseWhiteSpace
() && end.offsetInContainerNode() && end.offsetInContainerNode() < end.computeCo
ntainerNode()->maxCharacterOffset()) { |
231 RefPtrWillBeRawPtr<Text> endContainer = toText(end.computeContainerN
ode()); | 231 RefPtrWillBeRawPtr<Text> endContainer = toText(end.computeContainerN
ode()); |
232 splitTextNode(endContainer, end.offsetInContainerNode()); | 232 splitTextNode(endContainer, end.offsetInContainerNode()); |
233 if (isStartAndEndOnSameNode) | 233 if (isStartAndEndOnSameNode) |
234 start = firstPositionInOrBeforeNode(endContainer->previousSiblin
g()); | 234 start = firstPositionInOrBeforeNode(endContainer->previousSiblin
g()); |
235 if (isEndAndEndOfLastParagraphOnSameNode) { | 235 if (isEndAndEndOfLastParagraphOnSameNode) { |
236 if (m_endOfLastParagraph.offsetInContainerNode() == end.offsetIn
ContainerNode()) | 236 if (m_endOfLastParagraph.offsetInContainerNode() == end.offsetIn
ContainerNode()) |
237 m_endOfLastParagraph = lastPositionInOrAfterNode(endContaine
r->previousSibling()); | 237 m_endOfLastParagraph = lastPositionInOrAfterNode(endContaine
r->previousSibling()); |
238 else | 238 else |
239 m_endOfLastParagraph = Position(endContainer, m_endOfLastPar
agraph.offsetInContainerNode() - end.offsetInContainerNode()); | 239 m_endOfLastParagraph = Position(endContainer, m_endOfLastPar
agraph.offsetInContainerNode() - end.offsetInContainerNode()); |
240 } | 240 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 return element.release(); | 289 return element.release(); |
290 } | 290 } |
291 | 291 |
292 DEFINE_TRACE(ApplyBlockElementCommand) | 292 DEFINE_TRACE(ApplyBlockElementCommand) |
293 { | 293 { |
294 visitor->trace(m_endOfLastParagraph); | 294 visitor->trace(m_endOfLastParagraph); |
295 CompositeEditCommand::trace(visitor); | 295 CompositeEditCommand::trace(visitor); |
296 } | 296 } |
297 | 297 |
298 } | 298 } |
OLD | NEW |