OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2005 Apple Computer, 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
277 } | 277 } |
278 | 278 |
279 void DeleteSelectionCommand::saveTypingStyleState() | 279 void DeleteSelectionCommand::saveTypingStyleState() |
280 { | 280 { |
281 // A common case is deleting characters that are all from the same text node . In | 281 // A common case is deleting characters that are all from the same text node . In |
282 // that case, the style at the start of the selection before deletion will b e the | 282 // that case, the style at the start of the selection before deletion will b e the |
283 // same as the style at the start of the selection after deletion (since tho se | 283 // same as the style at the start of the selection after deletion (since tho se |
284 // two positions will be identical). Therefore there is no need to save the | 284 // two positions will be identical). Therefore there is no need to save the |
285 // typing style at the start of the selection, nor is there a reason to | 285 // typing style at the start of the selection, nor is there a reason to |
286 // compute the style at the start of the selection after deletion (see the | 286 // compute the style at the start of the selection after deletion (see the |
287 // early return in calculateTypingStyleAfterDelete). | 287 // early return in calculateTypingStyleAfterDelete). |
yosin_UTC9
2013/09/06 08:10:16
We should update this comment.
| |
288 if (m_upstreamStart.deprecatedNode() == m_downstreamEnd.deprecatedNode() && m_upstreamStart.deprecatedNode()->isTextNode()) | 288 if (m_upstreamStart.deprecatedNode() == m_downstreamEnd.deprecatedNode() && m_upstreamStart.deprecatedNode()->isTextNode()) { |
289 document()->frame()->selection()->clearTypingStyle(); | |
yosin_UTC9
2013/09/06 08:10:16
nit: It seems you are working on old source code.
yosin_UTC9
2013/09/06 08:10:16
Should we call clearTypingStyle() in calculateTypi
arpitab_
2013/09/06 14:01:32
My bad! Have made the appropriate change in the ne
arpitab_
2013/09/06 14:01:32
Yes! Although I don't see much difference between
| |
289 return; | 290 return; |
291 } | |
290 | 292 |
291 if (shouldNotInheritStyleFrom(*m_selectionToDelete.start().anchorNode())) | 293 if (shouldNotInheritStyleFrom(*m_selectionToDelete.start().anchorNode())) |
292 return; | 294 return; |
293 | 295 |
294 // Figure out the typing style in effect before the delete is done. | 296 // Figure out the typing style in effect before the delete is done. |
295 m_typingStyle = EditingStyle::create(m_selectionToDelete.start()); | 297 m_typingStyle = EditingStyle::create(m_selectionToDelete.start()); |
296 m_typingStyle->removeStyleAddedByNode(enclosingAnchorElement(m_selectionToDe lete.start())); | 298 m_typingStyle->removeStyleAddedByNode(enclosingAnchorElement(m_selectionToDe lete.start())); |
297 | 299 |
298 // If we're deleting into a Mail blockquote, save the style at end() instead of start() | 300 // If we're deleting into a Mail blockquote, save the style at end() instead of start() |
299 // We'll use this later in computeTypingStyleAfterDelete if we end up outsid e of a Mail blockquote | 301 // We'll use this later in computeTypingStyleAfterDelete if we end up outsid e of a Mail blockquote |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
848 | 850 |
849 // Normally deletion doesn't preserve the typing style that was present before i t. For example, | 851 // Normally deletion doesn't preserve the typing style that was present before i t. For example, |
850 // type a character, Bold, then delete the character and start typing. The Bold typing style shouldn't | 852 // type a character, Bold, then delete the character and start typing. The Bold typing style shouldn't |
851 // stick around. Deletion should preserve a typing style that *it* sets, howeve r. | 853 // stick around. Deletion should preserve a typing style that *it* sets, howeve r. |
852 bool DeleteSelectionCommand::preservesTypingStyle() const | 854 bool DeleteSelectionCommand::preservesTypingStyle() const |
853 { | 855 { |
854 return m_typingStyle; | 856 return m_typingStyle; |
855 } | 857 } |
856 | 858 |
857 } // namespace WebCore | 859 } // namespace WebCore |
OLD | NEW |