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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 parent->insertBefore(node, refNode); | 215 parent->insertBefore(node, refNode); |
216 } | 216 } |
217 | 217 |
218 PassRefPtr<HTMLElement> ReplacementFragment::insertFragmentForTestRendering(Elem
ent* rootEditableElement) | 218 PassRefPtr<HTMLElement> ReplacementFragment::insertFragmentForTestRendering(Elem
ent* rootEditableElement) |
219 { | 219 { |
220 ASSERT(m_document); | 220 ASSERT(m_document); |
221 RefPtr<HTMLElement> holder = createDefaultParagraphElement(*m_document.get()
); | 221 RefPtr<HTMLElement> holder = createDefaultParagraphElement(*m_document.get()
); |
222 | 222 |
223 holder->appendChild(m_fragment); | 223 holder->appendChild(m_fragment); |
224 rootEditableElement->appendChild(holder.get()); | 224 rootEditableElement->appendChild(holder.get()); |
225 m_document->updateLayoutIgnorePendingStylesheets(); | 225 m_document->updateLayout(); |
226 | 226 |
227 return holder.release(); | 227 return holder.release(); |
228 } | 228 } |
229 | 229 |
230 void ReplacementFragment::restoreAndRemoveTestRenderingNodesToFragment(Element*
holder) | 230 void ReplacementFragment::restoreAndRemoveTestRenderingNodesToFragment(Element*
holder) |
231 { | 231 { |
232 if (!holder) | 232 if (!holder) |
233 return; | 233 return; |
234 | 234 |
235 while (RefPtr<Node> node = holder->firstChild()) { | 235 while (RefPtr<Node> node = holder->firstChild()) { |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 removeNode(ancestor.release()); | 413 removeNode(ancestor.release()); |
414 } | 414 } |
415 | 415 |
416 static inline bool nodeHasVisibleRenderText(Text& text) | 416 static inline bool nodeHasVisibleRenderText(Text& text) |
417 { | 417 { |
418 return text.renderer() && text.renderer()->renderedTextLength() > 0; | 418 return text.renderer() && text.renderer()->renderedTextLength() > 0; |
419 } | 419 } |
420 | 420 |
421 void ReplaceSelectionCommand::removeUnrenderedTextNodesAtEnds(InsertedNodes& ins
ertedNodes) | 421 void ReplaceSelectionCommand::removeUnrenderedTextNodesAtEnds(InsertedNodes& ins
ertedNodes) |
422 { | 422 { |
423 document().updateLayoutIgnorePendingStylesheets(); | 423 document().updateLayout(); |
424 | 424 |
425 Node* lastLeafInserted = insertedNodes.lastLeafInserted(); | 425 Node* lastLeafInserted = insertedNodes.lastLeafInserted(); |
426 if (lastLeafInserted && lastLeafInserted->isTextNode() && !nodeHasVisibleRen
derText(toText(*lastLeafInserted)) | 426 if (lastLeafInserted && lastLeafInserted->isTextNode() && !nodeHasVisibleRen
derText(toText(*lastLeafInserted)) |
427 && !enclosingElementWithTag(firstPositionInOrBeforeNode(lastLeafInserted
), HTMLNames::scriptTag)) { | 427 && !enclosingElementWithTag(firstPositionInOrBeforeNode(lastLeafInserted
), HTMLNames::scriptTag)) { |
428 insertedNodes.willRemoveNode(*lastLeafInserted); | 428 insertedNodes.willRemoveNode(*lastLeafInserted); |
429 removeNode(lastLeafInserted); | 429 removeNode(lastLeafInserted); |
430 } | 430 } |
431 | 431 |
432 // We don't have to make sure that firstNodeInserted isn't inside a select o
r script element, because | 432 // We don't have to make sure that firstNodeInserted isn't inside a select o
r script element, because |
433 // it is a top level node in the fragment and the user can't insert into tho
se elements. | 433 // it is a top level node in the fragment and the user can't insert into tho
se elements. |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 return false; | 1005 return false; |
1006 | 1006 |
1007 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en
d); | 1007 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en
d); |
1008 | 1008 |
1009 setEndingSelection(selectionAfterReplace); | 1009 setEndingSelection(selectionAfterReplace); |
1010 | 1010 |
1011 return true; | 1011 return true; |
1012 } | 1012 } |
1013 | 1013 |
1014 } // namespace blink | 1014 } // namespace blink |
OLD | NEW |