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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 { | 261 { |
262 return highestEditableRoot(toPositionInDOMTree(position), editableType); | 262 return highestEditableRoot(toPositionInDOMTree(position), editableType); |
263 } | 263 } |
264 | 264 |
265 bool isEditablePosition(const Position& p, EditableType editableType, EUpdateSty
le updateStyle) | 265 bool isEditablePosition(const Position& p, EditableType editableType, EUpdateSty
le updateStyle) |
266 { | 266 { |
267 Node* node = p.parentAnchoredEquivalent().anchorNode(); | 267 Node* node = p.parentAnchoredEquivalent().anchorNode(); |
268 if (!node) | 268 if (!node) |
269 return false; | 269 return false; |
270 if (updateStyle == UpdateStyle) | 270 if (updateStyle == UpdateStyle) |
271 node->document().updateLayoutIgnorePendingStylesheets(); | 271 node->document().updateStyleAndLayoutIgnorePendingStylesheets(); |
272 else | 272 else |
273 DCHECK_EQ(updateStyle, DoNotUpdateStyle); | 273 DCHECK_EQ(updateStyle, DoNotUpdateStyle); |
274 | 274 |
275 if (isDisplayInsideTable(node)) | 275 if (isDisplayInsideTable(node)) |
276 node = node->parentNode(); | 276 node = node->parentNode(); |
277 | 277 |
278 if (node->isDocumentNode()) | 278 if (node->isDocumentNode()) |
279 return false; | 279 return false; |
280 return node->hasEditableStyle(editableType); | 280 return node->hasEditableStyle(editableType); |
281 } | 281 } |
(...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1596 if (s.isNull() || e.isNull()) | 1596 if (s.isNull() || e.isNull()) |
1597 return EphemeralRange(); | 1597 return EphemeralRange(); |
1598 | 1598 |
1599 return EphemeralRange(s, e); | 1599 return EphemeralRange(s, e); |
1600 } | 1600 } |
1601 | 1601 |
1602 template <typename Strategy> | 1602 template <typename Strategy> |
1603 static EphemeralRangeTemplate<Strategy> normalizeRangeAlgorithm(const EphemeralR
angeTemplate<Strategy>& range) | 1603 static EphemeralRangeTemplate<Strategy> normalizeRangeAlgorithm(const EphemeralR
angeTemplate<Strategy>& range) |
1604 { | 1604 { |
1605 DCHECK(range.isNotNull()); | 1605 DCHECK(range.isNotNull()); |
1606 range.document().updateLayoutIgnorePendingStylesheets(); | 1606 range.document().updateStyleAndLayoutIgnorePendingStylesheets(); |
1607 | 1607 |
1608 // TODO(yosin) We should not call |parentAnchoredEquivalent()|, it is | 1608 // TODO(yosin) We should not call |parentAnchoredEquivalent()|, it is |
1609 // redundant. | 1609 // redundant. |
1610 const PositionTemplate<Strategy> normalizedStart = mostForwardCaretPosition(
range.startPosition()).parentAnchoredEquivalent(); | 1610 const PositionTemplate<Strategy> normalizedStart = mostForwardCaretPosition(
range.startPosition()).parentAnchoredEquivalent(); |
1611 const PositionTemplate<Strategy> normalizedEnd = mostBackwardCaretPosition(r
ange.endPosition()).parentAnchoredEquivalent(); | 1611 const PositionTemplate<Strategy> normalizedEnd = mostBackwardCaretPosition(r
ange.endPosition()).parentAnchoredEquivalent(); |
1612 // The order of the positions of |start| and |end| can be swapped after | 1612 // The order of the positions of |start| and |end| can be swapped after |
1613 // upstream/downstream. e.g. editing/pasteboard/copy-display-none.html | 1613 // upstream/downstream. e.g. editing/pasteboard/copy-display-none.html |
1614 if (normalizedStart.compareTo(normalizedEnd) > 0) | 1614 if (normalizedStart.compareTo(normalizedEnd) > 0) |
1615 return EphemeralRangeTemplate<Strategy>(normalizedEnd, normalizedStart); | 1615 return EphemeralRangeTemplate<Strategy>(normalizedEnd, normalizedStart); |
1616 return EphemeralRangeTemplate<Strategy>(normalizedStart, normalizedEnd); | 1616 return EphemeralRangeTemplate<Strategy>(normalizedStart, normalizedEnd); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1760 { | 1760 { |
1761 if (!RuntimeEnabledFeatures::inputEventEnabled()) | 1761 if (!RuntimeEnabledFeatures::inputEventEnabled()) |
1762 return DispatchEventResult::NotCanceled; | 1762 return DispatchEventResult::NotCanceled; |
1763 if (!target) | 1763 if (!target) |
1764 return DispatchEventResult::NotCanceled; | 1764 return DispatchEventResult::NotCanceled; |
1765 InputEvent* beforeInputEvent = InputEvent::createBeforeInput(inputType, data
, InputEvent::EventCancelable::IsCancelable, InputEvent::EventIsComposing::NotCo
mposing); | 1765 InputEvent* beforeInputEvent = InputEvent::createBeforeInput(inputType, data
, InputEvent::EventCancelable::IsCancelable, InputEvent::EventIsComposing::NotCo
mposing); |
1766 return target->dispatchEvent(beforeInputEvent); | 1766 return target->dispatchEvent(beforeInputEvent); |
1767 } | 1767 } |
1768 | 1768 |
1769 } // namespace blink | 1769 } // namespace blink |
OLD | NEW |