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