OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2009, 2010, 2011 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 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1025 // If the downstream node has been removed there's no point in continuing. | 1025 // If the downstream node has been removed there's no point in continuing. |
1026 if (!insertionPos.downstream().anchorNode()) | 1026 if (!insertionPos.downstream().anchorNode()) |
1027 return; | 1027 return; |
1028 | 1028 |
1029 // NOTE: This would be an incorrect usage of downstream() if downstream() we
re changed to mean the last position after | 1029 // NOTE: This would be an incorrect usage of downstream() if downstream() we
re changed to mean the last position after |
1030 // p that maps to the same visible position as p (since in the case where a
br is at the end of a block and collapsed | 1030 // p that maps to the same visible position as p (since in the case where a
br is at the end of a block and collapsed |
1031 // away, there are positions after the br which map to the same visible posi
tion as [br, 0]). | 1031 // away, there are positions after the br which map to the same visible posi
tion as [br, 0]). |
1032 HTMLBRElement* endBR = isHTMLBRElement(*insertionPos.downstream().anchorNode
()) ? toHTMLBRElement(insertionPos.downstream().anchorNode()) : 0; | 1032 HTMLBRElement* endBR = isHTMLBRElement(*insertionPos.downstream().anchorNode
()) ? toHTMLBRElement(insertionPos.downstream().anchorNode()) : 0; |
1033 VisiblePosition originalVisPosBeforeEndBR; | 1033 VisiblePosition originalVisPosBeforeEndBR; |
1034 if (endBR) | 1034 if (endBR) |
1035 originalVisPosBeforeEndBR = VisiblePosition(positionBeforeNode(endBR), D
OWNSTREAM).previous(); | 1035 originalVisPosBeforeEndBR = VisiblePosition(positionBeforeNode(endBR)).p
revious(); |
1036 | 1036 |
1037 RefPtrWillBeRawPtr<Element> enclosingBlockOfInsertionPos = enclosingBlock(in
sertionPos.anchorNode()); | 1037 RefPtrWillBeRawPtr<Element> enclosingBlockOfInsertionPos = enclosingBlock(in
sertionPos.anchorNode()); |
1038 | 1038 |
1039 // Adjust insertionPos to prevent nesting. | 1039 // Adjust insertionPos to prevent nesting. |
1040 // If the start was in a Mail blockquote, we will have already handled adjus
ting insertionPos above. | 1040 // If the start was in a Mail blockquote, we will have already handled adjus
ting insertionPos above. |
1041 if (m_preventNesting && enclosingBlockOfInsertionPos && !isTableCell(enclosi
ngBlockOfInsertionPos.get()) && !startIsInsideMailBlockquote) { | 1041 if (m_preventNesting && enclosingBlockOfInsertionPos && !isTableCell(enclosi
ngBlockOfInsertionPos.get()) && !startIsInsideMailBlockquote) { |
1042 ASSERT(enclosingBlockOfInsertionPos != currentRoot); | 1042 ASSERT(enclosingBlockOfInsertionPos != currentRoot); |
1043 VisiblePosition visibleInsertionPos(insertionPos); | 1043 VisiblePosition visibleInsertionPos(insertionPos); |
1044 if (isEndOfBlock(visibleInsertionPos) && !(isStartOfBlock(visibleInserti
onPos) && fragment.hasInterchangeNewlineAtEnd())) | 1044 if (isEndOfBlock(visibleInsertionPos) && !(isStartOfBlock(visibleInserti
onPos) && fragment.hasInterchangeNewlineAtEnd())) |
1045 insertionPos = positionInParentAfterNode(*enclosingBlockOfInsertionP
os); | 1045 insertionPos = positionInParentAfterNode(*enclosingBlockOfInsertionP
os); |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1549 DEFINE_TRACE(ReplaceSelectionCommand) | 1549 DEFINE_TRACE(ReplaceSelectionCommand) |
1550 { | 1550 { |
1551 visitor->trace(m_startOfInsertedContent); | 1551 visitor->trace(m_startOfInsertedContent); |
1552 visitor->trace(m_endOfInsertedContent); | 1552 visitor->trace(m_endOfInsertedContent); |
1553 visitor->trace(m_insertionStyle); | 1553 visitor->trace(m_insertionStyle); |
1554 visitor->trace(m_documentFragment); | 1554 visitor->trace(m_documentFragment); |
1555 CompositeEditCommand::trace(visitor); | 1555 CompositeEditCommand::trace(visitor); |
1556 } | 1556 } |
1557 | 1557 |
1558 } // namespace blink | 1558 } // namespace blink |
OLD | NEW |