OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007 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 1707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1718 if (s.isNull() || e.isNull()) | 1718 if (s.isNull() || e.isNull()) |
1719 return EphemeralRange(); | 1719 return EphemeralRange(); |
1720 | 1720 |
1721 return EphemeralRange(s, e); | 1721 return EphemeralRange(s, e); |
1722 } | 1722 } |
1723 | 1723 |
1724 template <typename Strategy> | 1724 template <typename Strategy> |
1725 static EphemeralRangeTemplate<Strategy> normalizeRangeAlgorithm(const EphemeralR
angeTemplate<Strategy>& range) | 1725 static EphemeralRangeTemplate<Strategy> normalizeRangeAlgorithm(const EphemeralR
angeTemplate<Strategy>& range) |
1726 { | 1726 { |
1727 DCHECK(range.isNotNull()); | 1727 DCHECK(range.isNotNull()); |
1728 range.document().updateStyleAndLayoutIgnorePendingStylesheets(); | 1728 DCHECK(!range.document().needsLayoutTreeUpdate()); |
| 1729 DocumentLifecycle::DisallowTransitionScope disallowTransition(range.document
().lifecycle()); |
1729 | 1730 |
1730 // TODO(yosin) We should not call |parentAnchoredEquivalent()|, it is | 1731 // TODO(yosin) We should not call |parentAnchoredEquivalent()|, it is |
1731 // redundant. | 1732 // redundant. |
1732 const PositionTemplate<Strategy> normalizedStart = mostForwardCaretPosition(
range.startPosition()).parentAnchoredEquivalent(); | 1733 const PositionTemplate<Strategy> normalizedStart = mostForwardCaretPosition(
range.startPosition()).parentAnchoredEquivalent(); |
1733 const PositionTemplate<Strategy> normalizedEnd = mostBackwardCaretPosition(r
ange.endPosition()).parentAnchoredEquivalent(); | 1734 const PositionTemplate<Strategy> normalizedEnd = mostBackwardCaretPosition(r
ange.endPosition()).parentAnchoredEquivalent(); |
1734 // The order of the positions of |start| and |end| can be swapped after | 1735 // The order of the positions of |start| and |end| can be swapped after |
1735 // upstream/downstream. e.g. editing/pasteboard/copy-display-none.html | 1736 // upstream/downstream. e.g. editing/pasteboard/copy-display-none.html |
1736 if (normalizedStart.compareTo(normalizedEnd) > 0) | 1737 if (normalizedStart.compareTo(normalizedEnd) > 0) |
1737 return EphemeralRangeTemplate<Strategy>(normalizedEnd, normalizedStart); | 1738 return EphemeralRangeTemplate<Strategy>(normalizedEnd, normalizedStart); |
1738 return EphemeralRangeTemplate<Strategy>(normalizedStart, normalizedEnd); | 1739 return EphemeralRangeTemplate<Strategy>(normalizedStart, normalizedEnd); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1917 return InputType::DeleteWordBackward; | 1918 return InputType::DeleteWordBackward; |
1918 if (granularity == LineBoundary) | 1919 if (granularity == LineBoundary) |
1919 return InputType::DeleteLineBackward; | 1920 return InputType::DeleteLineBackward; |
1920 return InputType::DeleteContentBackward; | 1921 return InputType::DeleteContentBackward; |
1921 default: | 1922 default: |
1922 return InputType::None; | 1923 return InputType::None; |
1923 } | 1924 } |
1924 } | 1925 } |
1925 | 1926 |
1926 } // namespace blink | 1927 } // namespace blink |
OLD | NEW |