| 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 } | 282 } |
| 283 | 283 |
| 284 HTMLElement* ReplacementFragment::insertFragmentForTestRendering(Element* rootEd
itableElement) | 284 HTMLElement* ReplacementFragment::insertFragmentForTestRendering(Element* rootEd
itableElement) |
| 285 { | 285 { |
| 286 TRACE_EVENT0("blink", "ReplacementFragment::insertFragmentForTestRendering")
; | 286 TRACE_EVENT0("blink", "ReplacementFragment::insertFragmentForTestRendering")
; |
| 287 DCHECK(m_document); | 287 DCHECK(m_document); |
| 288 HTMLElement* holder = createDefaultParagraphElement(*m_document.get()); | 288 HTMLElement* holder = createDefaultParagraphElement(*m_document.get()); |
| 289 | 289 |
| 290 holder->appendChild(m_fragment); | 290 holder->appendChild(m_fragment); |
| 291 rootEditableElement->appendChild(holder); | 291 rootEditableElement->appendChild(holder); |
| 292 m_document->updateLayoutIgnorePendingStylesheets(); | 292 m_document->updateStyleAndLayoutIgnorePendingStylesheets(); |
| 293 | 293 |
| 294 return holder; | 294 return holder; |
| 295 } | 295 } |
| 296 | 296 |
| 297 void ReplacementFragment::restoreAndRemoveTestRenderingNodesToFragment(Element*
holder) | 297 void ReplacementFragment::restoreAndRemoveTestRenderingNodesToFragment(Element*
holder) |
| 298 { | 298 { |
| 299 if (!holder) | 299 if (!holder) |
| 300 return; | 300 return; |
| 301 | 301 |
| 302 while (Node* node = holder->firstChild()) { | 302 while (Node* node = holder->firstChild()) { |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 removeNode(ancestor, editingState); | 729 removeNode(ancestor, editingState); |
| 730 } | 730 } |
| 731 | 731 |
| 732 static inline bool nodeHasVisibleLayoutText(Text& text) | 732 static inline bool nodeHasVisibleLayoutText(Text& text) |
| 733 { | 733 { |
| 734 return text.layoutObject() && text.layoutObject()->resolvedTextLength() > 0; | 734 return text.layoutObject() && text.layoutObject()->resolvedTextLength() > 0; |
| 735 } | 735 } |
| 736 | 736 |
| 737 void ReplaceSelectionCommand::removeUnrenderedTextNodesAtEnds(InsertedNodes& ins
ertedNodes) | 737 void ReplaceSelectionCommand::removeUnrenderedTextNodesAtEnds(InsertedNodes& ins
ertedNodes) |
| 738 { | 738 { |
| 739 document().updateLayoutIgnorePendingStylesheets(); | 739 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
| 740 | 740 |
| 741 Node* lastLeafInserted = insertedNodes.lastLeafInserted(); | 741 Node* lastLeafInserted = insertedNodes.lastLeafInserted(); |
| 742 if (lastLeafInserted && lastLeafInserted->isTextNode() && !nodeHasVisibleLay
outText(toText(*lastLeafInserted)) | 742 if (lastLeafInserted && lastLeafInserted->isTextNode() && !nodeHasVisibleLay
outText(toText(*lastLeafInserted)) |
| 743 && !enclosingElementWithTag(firstPositionInOrBeforeNode(lastLeafInserted
), selectTag) | 743 && !enclosingElementWithTag(firstPositionInOrBeforeNode(lastLeafInserted
), selectTag) |
| 744 && !enclosingElementWithTag(firstPositionInOrBeforeNode(lastLeafInserted
), scriptTag)) { | 744 && !enclosingElementWithTag(firstPositionInOrBeforeNode(lastLeafInserted
), scriptTag)) { |
| 745 insertedNodes.willRemoveNode(*lastLeafInserted); | 745 insertedNodes.willRemoveNode(*lastLeafInserted); |
| 746 // Removing a Text node won't dispatch synchronous events. | 746 // Removing a Text node won't dispatch synchronous events. |
| 747 removeNode(lastLeafInserted, ASSERT_NO_EDITING_ABORT); | 747 removeNode(lastLeafInserted, ASSERT_NO_EDITING_ABORT); |
| 748 } | 748 } |
| 749 | 749 |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1451 m_endOfInsertedContent = Position(endNode, m_endOfInsertedConten
t.offsetInContainerNode() + 1); | 1451 m_endOfInsertedContent = Position(endNode, m_endOfInsertedConten
t.offsetInContainerNode() + 1); |
| 1452 } else { | 1452 } else { |
| 1453 Text* node = document().createEditingTextNode(collapseWhiteSpace ? n
onBreakingSpaceString() : " "); | 1453 Text* node = document().createEditingTextNode(collapseWhiteSpace ? n
onBreakingSpaceString() : " "); |
| 1454 insertNodeAfter(node, endNode, editingState); | 1454 insertNodeAfter(node, endNode, editingState); |
| 1455 if (editingState->isAborted()) | 1455 if (editingState->isAborted()) |
| 1456 return; | 1456 return; |
| 1457 updateNodesInserted(node); | 1457 updateNodesInserted(node); |
| 1458 } | 1458 } |
| 1459 } | 1459 } |
| 1460 | 1460 |
| 1461 document().updateLayout(); | 1461 document().updateStyleAndLayout(); |
| 1462 | 1462 |
| 1463 Position startDownstream = mostForwardCaretPosition(startOfInsertedContent.d
eepEquivalent()); | 1463 Position startDownstream = mostForwardCaretPosition(startOfInsertedContent.d
eepEquivalent()); |
| 1464 Node* startNode = startDownstream.computeNodeAfterPosition(); | 1464 Node* startNode = startDownstream.computeNodeAfterPosition(); |
| 1465 unsigned startOffset = 0; | 1465 unsigned startOffset = 0; |
| 1466 if (startDownstream.isOffsetInAnchor()) { | 1466 if (startDownstream.isOffsetInAnchor()) { |
| 1467 startNode = startDownstream.computeContainerNode(); | 1467 startNode = startDownstream.computeContainerNode(); |
| 1468 startOffset = startDownstream.offsetInContainerNode(); | 1468 startOffset = startDownstream.offsetInContainerNode(); |
| 1469 } | 1469 } |
| 1470 | 1470 |
| 1471 bool needsLeadingSpace = !isStartOfParagraph(startOfInsertedContent) && !isC
haracterSmartReplaceExemptConsideringNonBreakingSpace(characterBefore(startOfIns
ertedContent), true); | 1471 bool needsLeadingSpace = !isStartOfParagraph(startOfInsertedContent) && !isC
haracterSmartReplaceExemptConsideringNonBreakingSpace(characterBefore(startOfIns
ertedContent), true); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1717 visitor->trace(m_startOfInsertedContent); | 1717 visitor->trace(m_startOfInsertedContent); |
| 1718 visitor->trace(m_endOfInsertedContent); | 1718 visitor->trace(m_endOfInsertedContent); |
| 1719 visitor->trace(m_insertionStyle); | 1719 visitor->trace(m_insertionStyle); |
| 1720 visitor->trace(m_documentFragment); | 1720 visitor->trace(m_documentFragment); |
| 1721 visitor->trace(m_startOfInsertedRange); | 1721 visitor->trace(m_startOfInsertedRange); |
| 1722 visitor->trace(m_endOfInsertedRange); | 1722 visitor->trace(m_endOfInsertedRange); |
| 1723 CompositeEditCommand::trace(visitor); | 1723 CompositeEditCommand::trace(visitor); |
| 1724 } | 1724 } |
| 1725 | 1725 |
| 1726 } // namespace blink | 1726 } // namespace blink |
| OLD | NEW |