OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008, 2009 Apple 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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 for (Node* n = startNode; n && n != enclosingNode; n = n->parentNode()) { | 532 for (Node* n = startNode; n && n != enclosingNode; n = n->parentNode()) { |
533 if (n->isHTMLElement() && getIdentifierValue(CSSComputedStyleDeclaration
::create(n).get(), CSSPropertyUnicodeBidi) == CSSValueEmbed) | 533 if (n->isHTMLElement() && getIdentifierValue(CSSComputedStyleDeclaration
::create(n).get(), CSSPropertyUnicodeBidi) == CSSValueEmbed) |
534 return n; | 534 return n; |
535 } | 535 } |
536 | 536 |
537 return 0; | 537 return 0; |
538 } | 538 } |
539 | 539 |
540 void ApplyStyleCommand::applyInlineStyle(EditingStyle* style) | 540 void ApplyStyleCommand::applyInlineStyle(EditingStyle* style) |
541 { | 541 { |
542 Node* startDummySpanAncestor = 0; | 542 RefPtr<Node> startDummySpanAncestor = 0; |
543 Node* endDummySpanAncestor = 0; | 543 RefPtr<Node> endDummySpanAncestor = 0; |
544 | 544 |
545 // update document layout once before removing styles | 545 // update document layout once before removing styles |
546 // so that we avoid the expense of updating before each and every call | 546 // so that we avoid the expense of updating before each and every call |
547 // to check a computed style | 547 // to check a computed style |
548 document()->updateLayoutIgnorePendingStylesheets(); | 548 document()->updateLayoutIgnorePendingStylesheets(); |
549 | 549 |
550 // adjust to the positions we want to use for applying style | 550 // adjust to the positions we want to use for applying style |
551 Position start = startPosition(); | 551 Position start = startPosition(); |
552 Position end = endPosition(); | 552 Position end = endPosition(); |
553 | 553 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 } | 658 } |
659 fixRangeAndApplyInlineStyle(embeddingStyle.get(), embeddingApplyStar
t, embeddingApplyEnd); | 659 fixRangeAndApplyInlineStyle(embeddingStyle.get(), embeddingApplyStar
t, embeddingApplyEnd); |
660 | 660 |
661 styleToApply = styleWithoutEmbedding; | 661 styleToApply = styleWithoutEmbedding; |
662 } | 662 } |
663 } | 663 } |
664 | 664 |
665 fixRangeAndApplyInlineStyle(styleToApply.get(), start, end); | 665 fixRangeAndApplyInlineStyle(styleToApply.get(), start, end); |
666 | 666 |
667 // Remove dummy style spans created by splitting text elements. | 667 // Remove dummy style spans created by splitting text elements. |
668 cleanupUnstyledAppleStyleSpans(startDummySpanAncestor); | 668 cleanupUnstyledAppleStyleSpans(startDummySpanAncestor.get()); |
669 if (endDummySpanAncestor != startDummySpanAncestor) | 669 if (endDummySpanAncestor != startDummySpanAncestor) |
670 cleanupUnstyledAppleStyleSpans(endDummySpanAncestor); | 670 cleanupUnstyledAppleStyleSpans(endDummySpanAncestor.get()); |
671 } | 671 } |
672 | 672 |
673 void ApplyStyleCommand::fixRangeAndApplyInlineStyle(EditingStyle* style, const P
osition& start, const Position& end) | 673 void ApplyStyleCommand::fixRangeAndApplyInlineStyle(EditingStyle* style, const P
osition& start, const Position& end) |
674 { | 674 { |
675 Node* startNode = start.deprecatedNode(); | 675 Node* startNode = start.deprecatedNode(); |
676 | 676 |
677 if (start.deprecatedEditingOffset() >= caretMaxOffset(start.deprecatedNode()
)) { | 677 if (start.deprecatedEditingOffset() >= caretMaxOffset(start.deprecatedNode()
)) { |
678 startNode = startNode->traverseNextNode(); | 678 startNode = startNode->traverseNextNode(); |
679 if (!startNode || comparePositions(end, firstPositionInOrBeforeNode(star
tNode)) < 0) | 679 if (!startNode || comparePositions(end, firstPositionInOrBeforeNode(star
tNode)) < 0) |
680 return; | 680 return; |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1478 String textToMove = nextText->data(); | 1478 String textToMove = nextText->data(); |
1479 insertTextIntoNode(childText, childText->length(), textToMove); | 1479 insertTextIntoNode(childText, childText->length(), textToMove); |
1480 removeNode(next); | 1480 removeNode(next); |
1481 // don't move child node pointer. it may want to merge with more text no
des. | 1481 // don't move child node pointer. it may want to merge with more text no
des. |
1482 } | 1482 } |
1483 | 1483 |
1484 updateStartEnd(newStart, newEnd); | 1484 updateStartEnd(newStart, newEnd); |
1485 } | 1485 } |
1486 | 1486 |
1487 } | 1487 } |
OLD | NEW |