OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006 Apple Computer, 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } | 163 } |
164 | 164 |
165 // FIXME: The parentAnchoredEquivalent conversion needs to be moved into enc
losingBlock. | 165 // FIXME: The parentAnchoredEquivalent conversion needs to be moved into enc
losingBlock. |
166 RefPtr<Element> startBlock = enclosingBlock(insertionPosition.parentAnchored
Equivalent().containerNode()); | 166 RefPtr<Element> startBlock = enclosingBlock(insertionPosition.parentAnchored
Equivalent().containerNode()); |
167 Position canonicalPos = VisiblePosition(insertionPosition).deepEquivalent(); | 167 Position canonicalPos = VisiblePosition(insertionPosition).deepEquivalent(); |
168 if (!startBlock | 168 if (!startBlock |
169 || !startBlock->nonShadowBoundaryParentNode() | 169 || !startBlock->nonShadowBoundaryParentNode() |
170 || isTableCell(startBlock.get()) | 170 || isTableCell(startBlock.get()) |
171 || startBlock->hasTagName(formTag) | 171 || startBlock->hasTagName(formTag) |
172 // FIXME: If the node is hidden, we don't have a canonical position so w
e will do the wrong thing for tables and <hr>. https://bugs.webkit.org/show_bug.
cgi?id=40342 | 172 // FIXME: If the node is hidden, we don't have a canonical position so w
e will do the wrong thing for tables and <hr>. https://bugs.webkit.org/show_bug.
cgi?id=40342 |
173 || (!canonicalPos.isNull() && canonicalPos.deprecatedNode()->renderer()
&& canonicalPos.deprecatedNode()->renderer()->isTable()) | 173 || (!canonicalPos.isNull() && canonicalPos.renderer() && canonicalPos.re
nderer()->isTable()) |
174 || (!canonicalPos.isNull() && canonicalPos.deprecatedNode()->hasTagName(
hrTag))) { | 174 || (!canonicalPos.isNull() && canonicalPos.deprecatedNode()->hasTagName(
hrTag))) { |
175 applyCommandToComposite(InsertLineBreakCommand::create(document())); | 175 applyCommandToComposite(InsertLineBreakCommand::create(document())); |
176 return; | 176 return; |
177 } | 177 } |
178 | 178 |
179 // Use the leftmost candidate. | 179 // Use the leftmost candidate. |
180 insertionPosition = insertionPosition.upstream(); | 180 insertionPosition = insertionPosition.upstream(); |
181 if (!insertionPosition.isCandidate()) | 181 if (!insertionPosition.isCandidate()) |
182 insertionPosition = insertionPosition.downstream(); | 182 insertionPosition = insertionPosition.downstream(); |
183 | 183 |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 if (positionAfterSplit.deprecatedNode()->isTextNode()) | 399 if (positionAfterSplit.deprecatedNode()->isTextNode()) |
400 insertTextIntoNode(toText(positionAfterSplit.containerNode()), 0
, nonBreakingSpaceString()); | 400 insertTextIntoNode(toText(positionAfterSplit.containerNode()), 0
, nonBreakingSpaceString()); |
401 } | 401 } |
402 } | 402 } |
403 | 403 |
404 setEndingSelection(VisibleSelection(firstPositionInNode(blockToInsert.get())
, DOWNSTREAM, endingSelection().isDirectional())); | 404 setEndingSelection(VisibleSelection(firstPositionInNode(blockToInsert.get())
, DOWNSTREAM, endingSelection().isDirectional())); |
405 applyStyleAfterInsertion(startBlock.get()); | 405 applyStyleAfterInsertion(startBlock.get()); |
406 } | 406 } |
407 | 407 |
408 } // namespace WebCore | 408 } // namespace WebCore |
OLD | NEW |