| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 m_removeOnly(true), | 182 m_removeOnly(true), |
| 183 m_isInlineElementToRemoveFunction(isInlineElementToRemoveFunction) {} | 183 m_isInlineElementToRemoveFunction(isInlineElementToRemoveFunction) {} |
| 184 | 184 |
| 185 void ApplyStyleCommand::updateStartEnd(const Position& newStart, | 185 void ApplyStyleCommand::updateStartEnd(const Position& newStart, |
| 186 const Position& newEnd) { | 186 const Position& newEnd) { |
| 187 DCHECK_GE(comparePositions(newEnd, newStart), 0); | 187 DCHECK_GE(comparePositions(newEnd, newStart), 0); |
| 188 | 188 |
| 189 if (!m_useEndingSelection && (newStart != m_start || newEnd != m_end)) | 189 if (!m_useEndingSelection && (newStart != m_start || newEnd != m_end)) |
| 190 m_useEndingSelection = true; | 190 m_useEndingSelection = true; |
| 191 | 191 |
| 192 document().updateStyleAndLayoutIgnorePendingStylesheets(); | 192 setEndingSelection(SelectionInDOMTree::Builder() |
| 193 setEndingSelection(createVisibleSelection( | 193 .collapse(newStart) |
| 194 SelectionInDOMTree::Builder() | 194 .extend(newEnd) |
| 195 .collapse(newStart) | 195 .setIsDirectional(endingSelection().isDirectional()) |
| 196 .extend(newEnd) | 196 .build()); |
| 197 .setIsDirectional(endingSelection().isDirectional()) | |
| 198 .build())); | |
| 199 m_start = newStart; | 197 m_start = newStart; |
| 200 m_end = newEnd; | 198 m_end = newEnd; |
| 201 } | 199 } |
| 202 | 200 |
| 203 Position ApplyStyleCommand::startPosition() { | 201 Position ApplyStyleCommand::startPosition() { |
| 204 if (m_useEndingSelection) | 202 if (m_useEndingSelection) |
| 205 return endingSelection().start(); | 203 return endingSelection().start(); |
| 206 | 204 |
| 207 return m_start; | 205 return m_start; |
| 208 } | 206 } |
| (...skipping 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2031 | 2029 |
| 2032 DEFINE_TRACE(ApplyStyleCommand) { | 2030 DEFINE_TRACE(ApplyStyleCommand) { |
| 2033 visitor->trace(m_style); | 2031 visitor->trace(m_style); |
| 2034 visitor->trace(m_start); | 2032 visitor->trace(m_start); |
| 2035 visitor->trace(m_end); | 2033 visitor->trace(m_end); |
| 2036 visitor->trace(m_styledInlineElement); | 2034 visitor->trace(m_styledInlineElement); |
| 2037 CompositeEditCommand::trace(visitor); | 2035 CompositeEditCommand::trace(visitor); |
| 2038 } | 2036 } |
| 2039 | 2037 |
| 2040 } // namespace blink | 2038 } // namespace blink |
| OLD | NEW |