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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Node* listChildNode = enclosingListChild(insertionPosition.parentAnchoredEqu
ivalent().containerNode()); | 167 Node* listChildNode = enclosingListChild(insertionPosition.parentAnchoredEqu
ivalent().containerNode()); |
168 RefPtr<Element> listChild = listChildNode && listChildNode->isHTMLElement()
? toHTMLElement(listChildNode) : 0; | 168 RefPtr<Element> listChild = listChildNode && listChildNode->isHTMLElement()
? toHTMLElement(listChildNode) : 0; |
169 Position canonicalPos = VisiblePosition(insertionPosition).deepEquivalent(); | 169 Position canonicalPos = VisiblePosition(insertionPosition).deepEquivalent(); |
170 if (!startBlock | 170 if (!startBlock |
171 || !startBlock->nonShadowBoundaryParentNode() | 171 || !startBlock->nonShadowBoundaryParentNode() |
172 || isTableCell(startBlock.get()) | 172 || isTableCell(startBlock.get()) |
173 || startBlock->hasTagName(formTag) | 173 || startBlock->hasTagName(formTag) |
174 // 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 | 174 // 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 |
175 || (!canonicalPos.isNull() && canonicalPos.deprecatedNode()->renderer()
&& canonicalPos.deprecatedNode()->renderer()->isTable()) | 175 || (!canonicalPos.isNull() && isRenderedTable(canonicalPos.deprecatedNod
e())) |
176 || (!canonicalPos.isNull() && canonicalPos.deprecatedNode()->hasTagName(
hrTag))) { | 176 || (!canonicalPos.isNull() && canonicalPos.deprecatedNode()->hasTagName(
hrTag))) { |
177 applyCommandToComposite(InsertLineBreakCommand::create(document())); | 177 applyCommandToComposite(InsertLineBreakCommand::create(document())); |
178 return; | 178 return; |
179 } | 179 } |
180 | 180 |
181 // Use the leftmost candidate. | 181 // Use the leftmost candidate. |
182 insertionPosition = insertionPosition.upstream(); | 182 insertionPosition = insertionPosition.upstream(); |
183 if (!insertionPosition.isCandidate()) | 183 if (!insertionPosition.isCandidate()) |
184 insertionPosition = insertionPosition.downstream(); | 184 insertionPosition = insertionPosition.downstream(); |
185 | 185 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 if (positionAfterSplit.deprecatedNode()->isTextNode()) | 419 if (positionAfterSplit.deprecatedNode()->isTextNode()) |
420 insertTextIntoNode(toText(positionAfterSplit.containerNode()), 0
, nonBreakingSpaceString()); | 420 insertTextIntoNode(toText(positionAfterSplit.containerNode()), 0
, nonBreakingSpaceString()); |
421 } | 421 } |
422 } | 422 } |
423 | 423 |
424 setEndingSelection(VisibleSelection(firstPositionInNode(blockToInsert.get())
, DOWNSTREAM, endingSelection().isDirectional())); | 424 setEndingSelection(VisibleSelection(firstPositionInNode(blockToInsert.get())
, DOWNSTREAM, endingSelection().isDirectional())); |
425 applyStyleAfterInsertion(startBlock.get()); | 425 applyStyleAfterInsertion(startBlock.get()); |
426 } | 426 } |
427 | 427 |
428 } // namespace WebCore | 428 } // namespace WebCore |
OLD | NEW |