| 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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 | 365 |
| 366 start = start.upstream(); // Move upstream to ensure we do not add redundant
spans. | 366 start = start.upstream(); // Move upstream to ensure we do not add redundant
spans. |
| 367 Node* startNode = start.deprecatedNode(); | 367 Node* startNode = start.deprecatedNode(); |
| 368 ASSERT(startNode); | 368 ASSERT(startNode); |
| 369 | 369 |
| 370 // Make sure we're not already at the end or the next NodeTraversal::next()
will traverse | 370 // Make sure we're not already at the end or the next NodeTraversal::next()
will traverse |
| 371 // past it. | 371 // past it. |
| 372 if (startNode == beyondEnd) | 372 if (startNode == beyondEnd) |
| 373 return; | 373 return; |
| 374 | 374 |
| 375 if (startNode->isTextNode() && start.deprecatedEditingOffset() >= caretMaxOf
fset(startNode)) // Move out of text node if range does not include its characte
rs. | 375 if (startNode->isTextNode() && start.deprecatedEditingOffset() >= caretMaxOf
fset(startNode)) { |
| 376 // Move out of text node if range does not include its characters. |
| 376 startNode = NodeTraversal::next(*startNode); | 377 startNode = NodeTraversal::next(*startNode); |
| 378 if (!startNode) |
| 379 return; |
| 380 } |
| 377 | 381 |
| 378 // Store away font size before making any changes to the document. | 382 // Store away font size before making any changes to the document. |
| 379 // This ensures that changes to one node won't effect another. | 383 // This ensures that changes to one node won't effect another. |
| 380 WillBeHeapHashMap<RawPtrWillBeMember<Node>, float> startingFontSizes; | 384 WillBeHeapHashMap<RawPtrWillBeMember<Node>, float> startingFontSizes; |
| 381 for (Node* node = startNode; node != beyondEnd; node = NodeTraversal::next(*
node)) { | 385 for (Node* node = startNode; node != beyondEnd; node = NodeTraversal::next(*
node)) { |
| 382 ASSERT(node); | 386 ASSERT(node); |
| 383 startingFontSizes.set(node, computedFontSize(node)); | 387 startingFontSizes.set(node, computedFontSize(node)); |
| 384 } | 388 } |
| 385 | 389 |
| 386 // These spans were added by us. If empty after font size changes, they can
be removed. | 390 // These spans were added by us. If empty after font size changes, they can
be removed. |
| (...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1587 DEFINE_TRACE(ApplyStyleCommand) | 1591 DEFINE_TRACE(ApplyStyleCommand) |
| 1588 { | 1592 { |
| 1589 visitor->trace(m_style); | 1593 visitor->trace(m_style); |
| 1590 visitor->trace(m_start); | 1594 visitor->trace(m_start); |
| 1591 visitor->trace(m_end); | 1595 visitor->trace(m_end); |
| 1592 visitor->trace(m_styledInlineElement); | 1596 visitor->trace(m_styledInlineElement); |
| 1593 CompositeEditCommand::trace(visitor); | 1597 CompositeEditCommand::trace(visitor); |
| 1594 } | 1598 } |
| 1595 | 1599 |
| 1596 } | 1600 } |
| OLD | NEW |