| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 243 |
| 244 // get positions we want to use for applying style | 244 // get positions we want to use for applying style |
| 245 Position start = startPosition(); | 245 Position start = startPosition(); |
| 246 Position end = endPosition(); | 246 Position end = endPosition(); |
| 247 if (comparePositions(end, start) < 0) { | 247 if (comparePositions(end, start) < 0) { |
| 248 Position swap = start; | 248 Position swap = start; |
| 249 start = end; | 249 start = end; |
| 250 end = swap; | 250 end = swap; |
| 251 } | 251 } |
| 252 | 252 |
| 253 VisiblePosition visibleStart(start); | 253 VisiblePosition visibleStart = createVisiblePosition(start); |
| 254 VisiblePosition visibleEnd(end); | 254 VisiblePosition visibleEnd = createVisiblePosition(end); |
| 255 | 255 |
| 256 if (visibleStart.isNull() || visibleStart.isOrphan() || visibleEnd.isNull()
|| visibleEnd.isOrphan()) | 256 if (visibleStart.isNull() || visibleStart.isOrphan() || visibleEnd.isNull()
|| visibleEnd.isOrphan()) |
| 257 return; | 257 return; |
| 258 | 258 |
| 259 // Save and restore the selection endpoints using their indices in the docum
ent, since | 259 // Save and restore the selection endpoints using their indices in the docum
ent, since |
| 260 // addBlockStyleIfNeeded may moveParagraphs, which can remove these endpoint
s. | 260 // addBlockStyleIfNeeded may moveParagraphs, which can remove these endpoint
s. |
| 261 // Calculate start and end indices from the start of the tree that they're i
n. | 261 // Calculate start and end indices from the start of the tree that they're i
n. |
| 262 Node& scope = NodeTraversal::highestAncestorOrSelf(*visibleStart.deepEquival
ent().anchorNode()); | 262 Node& scope = NodeTraversal::highestAncestorOrSelf(*visibleStart.deepEquival
ent().anchorNode()); |
| 263 RefPtrWillBeRawPtr<Range> startRange = Range::create(document(), firstPositi
onInNode(&scope), visibleStart.deepEquivalent().parentAnchoredEquivalent()); | 263 RefPtrWillBeRawPtr<Range> startRange = Range::create(document(), firstPositi
onInNode(&scope), visibleStart.deepEquivalent().parentAnchoredEquivalent()); |
| 264 RefPtrWillBeRawPtr<Range> endRange = Range::create(document(), firstPosition
InNode(&scope), visibleEnd.deepEquivalent().parentAnchoredEquivalent()); | 264 RefPtrWillBeRawPtr<Range> endRange = Range::create(document(), firstPosition
InNode(&scope), visibleEnd.deepEquivalent().parentAnchoredEquivalent()); |
| (...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1594 DEFINE_TRACE(ApplyStyleCommand) | 1594 DEFINE_TRACE(ApplyStyleCommand) |
| 1595 { | 1595 { |
| 1596 visitor->trace(m_style); | 1596 visitor->trace(m_style); |
| 1597 visitor->trace(m_start); | 1597 visitor->trace(m_start); |
| 1598 visitor->trace(m_end); | 1598 visitor->trace(m_end); |
| 1599 visitor->trace(m_styledInlineElement); | 1599 visitor->trace(m_styledInlineElement); |
| 1600 CompositeEditCommand::trace(visitor); | 1600 CompositeEditCommand::trace(visitor); |
| 1601 } | 1601 } |
| 1602 | 1602 |
| 1603 } | 1603 } |
| OLD | NEW |