| 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 Element* startBlock = enclosingBlock( | 191 Element* startBlock = enclosingBlock( |
| 192 insertionPosition.parentAnchoredEquivalent().computeContainerNode()); | 192 insertionPosition.parentAnchoredEquivalent().computeContainerNode()); |
| 193 Node* listChildNode = enclosingListChild( | 193 Node* listChildNode = enclosingListChild( |
| 194 insertionPosition.parentAnchoredEquivalent().computeContainerNode()); | 194 insertionPosition.parentAnchoredEquivalent().computeContainerNode()); |
| 195 HTMLElement* listChild = listChildNode && listChildNode->isHTMLElement() | 195 HTMLElement* listChild = listChildNode && listChildNode->isHTMLElement() |
| 196 ? toHTMLElement(listChildNode) | 196 ? toHTMLElement(listChildNode) |
| 197 : 0; | 197 : 0; |
| 198 Position canonicalPos = | 198 Position canonicalPos = |
| 199 createVisiblePosition(insertionPosition).deepEquivalent(); | 199 createVisiblePosition(insertionPosition).deepEquivalent(); |
| 200 if (!startBlock || !startBlock->nonShadowBoundaryParentNode() || | 200 if (!startBlock || !startBlock->nonShadowBoundaryParentNode() || |
| 201 isTableCell(startBlock) || isHTMLFormElement(*startBlock) | 201 isTableCell(startBlock) || |
| 202 isHTMLFormElement(*startBlock) |
| 202 // FIXME: If the node is hidden, we don't have a canonical position so we | 203 // FIXME: If the node is hidden, we don't have a canonical position so we |
| 203 // will do the wrong thing for tables and <hr>. | 204 // will do the wrong thing for tables and <hr>. |
| 204 // https://bugs.webkit.org/show_bug.cgi?id=40342 | 205 // https://bugs.webkit.org/show_bug.cgi?id=40342 |
| 205 || (!canonicalPos.isNull() && | 206 || |
| 206 isDisplayInsideTable(canonicalPos.anchorNode())) || | 207 (!canonicalPos.isNull() && |
| 208 isDisplayInsideTable(canonicalPos.anchorNode())) || |
| 207 (!canonicalPos.isNull() && isHTMLHRElement(*canonicalPos.anchorNode()))) { | 209 (!canonicalPos.isNull() && isHTMLHRElement(*canonicalPos.anchorNode()))) { |
| 208 applyCommandToComposite(InsertLineBreakCommand::create(document()), | 210 applyCommandToComposite(InsertLineBreakCommand::create(document()), |
| 209 editingState); | 211 editingState); |
| 210 return; | 212 return; |
| 211 } | 213 } |
| 212 | 214 |
| 213 // Use the leftmost candidate. | 215 // Use the leftmost candidate. |
| 214 insertionPosition = mostBackwardCaretPosition(insertionPosition); | 216 insertionPosition = mostBackwardCaretPosition(insertionPosition); |
| 215 if (!isVisuallyEquivalentCandidate(insertionPosition)) | 217 if (!isVisuallyEquivalentCandidate(insertionPosition)) |
| 216 insertionPosition = mostForwardCaretPosition(insertionPosition); | 218 insertionPosition = mostForwardCaretPosition(insertionPosition); |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 .build()); | 579 .build()); |
| 578 applyStyleAfterInsertion(startBlock, editingState); | 580 applyStyleAfterInsertion(startBlock, editingState); |
| 579 } | 581 } |
| 580 | 582 |
| 581 DEFINE_TRACE(InsertParagraphSeparatorCommand) { | 583 DEFINE_TRACE(InsertParagraphSeparatorCommand) { |
| 582 visitor->trace(m_style); | 584 visitor->trace(m_style); |
| 583 CompositeEditCommand::trace(visitor); | 585 CompositeEditCommand::trace(visitor); |
| 584 } | 586 } |
| 585 | 587 |
| 586 } // namespace blink | 588 } // namespace blink |
| OLD | NEW |