| 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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 if (hasEditableStyle(*node, editableType)) | 272 if (hasEditableStyle(*node, editableType)) |
| 273 highestRoot = node; | 273 highestRoot = node; |
| 274 if (isHTMLBodyElement(*node)) | 274 if (isHTMLBodyElement(*node)) |
| 275 break; | 275 break; |
| 276 node = node->parentNode(); | 276 node = node->parentNode(); |
| 277 } | 277 } |
| 278 | 278 |
| 279 return highestRoot; | 279 return highestRoot; |
| 280 } | 280 } |
| 281 | 281 |
| 282 ContainerNode* highestEditableRoot(const PositionInFlatTree& position, EditableT
ype editableType) | 282 ContainerNode* highestEditableRoot(const PositionInFlatTree& position) |
| 283 { | 283 { |
| 284 return highestEditableRoot(toPositionInDOMTree(position), editableType); | 284 return highestEditableRoot(toPositionInDOMTree(position), ContentIsEditable)
; |
| 285 } | 285 } |
| 286 | 286 |
| 287 bool isEditablePosition(const Position& position) | 287 bool isEditablePosition(const Position& position) |
| 288 { | 288 { |
| 289 Node* node = position.parentAnchoredEquivalent().anchorNode(); | 289 Node* node = position.parentAnchoredEquivalent().anchorNode(); |
| 290 if (!node) | 290 if (!node) |
| 291 return false; | 291 return false; |
| 292 DCHECK(node->document().isActive()); | 292 DCHECK(node->document().isActive()); |
| 293 if (node->document().lifecycle().state() >= DocumentLifecycle::InStyleRecalc
) { | 293 if (node->document().lifecycle().state() >= DocumentLifecycle::InStyleRecalc
) { |
| 294 // TODO(yosin): Once we change |LayoutObject::adjustStyleDifference()| | 294 // TODO(yosin): Once we change |LayoutObject::adjustStyleDifference()| |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 Node* node = p.computeContainerNode(); | 335 Node* node = p.computeContainerNode(); |
| 336 if (!node) | 336 if (!node) |
| 337 return 0; | 337 return 0; |
| 338 | 338 |
| 339 if (isDisplayInsideTable(node)) | 339 if (isDisplayInsideTable(node)) |
| 340 node = node->parentNode(); | 340 node = node->parentNode(); |
| 341 | 341 |
| 342 return rootEditableElement(*node, editableType); | 342 return rootEditableElement(*node, editableType); |
| 343 } | 343 } |
| 344 | 344 |
| 345 Element* rootEditableElementOf(const PositionInFlatTree& p, EditableType editabl
eType) | 345 Element* rootEditableElementOf(const PositionInFlatTree& p) |
| 346 { | 346 { |
| 347 return rootEditableElementOf(toPositionInDOMTree(p), editableType); | 347 return rootEditableElementOf(toPositionInDOMTree(p), ContentIsEditable); |
| 348 } | 348 } |
| 349 | 349 |
| 350 // TODO(yosin) This does not handle [table, 0] correctly. | 350 // TODO(yosin) This does not handle [table, 0] correctly. |
| 351 Element* rootEditableElementOf(const VisiblePosition& visiblePosition) | 351 Element* rootEditableElementOf(const VisiblePosition& visiblePosition) |
| 352 { | 352 { |
| 353 Node* anchorNode = visiblePosition.deepEquivalent().anchorNode(); | 353 Node* anchorNode = visiblePosition.deepEquivalent().anchorNode(); |
| 354 return anchorNode ? rootEditableElement(*anchorNode) : nullptr; | 354 return anchorNode ? rootEditableElement(*anchorNode) : nullptr; |
| 355 } | 355 } |
| 356 | 356 |
| 357 // Finds the enclosing element until which the tree can be split. | 357 // Finds the enclosing element until which the tree can be split. |
| (...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1816 { | 1816 { |
| 1817 if (!RuntimeEnabledFeatures::inputEventEnabled()) | 1817 if (!RuntimeEnabledFeatures::inputEventEnabled()) |
| 1818 return DispatchEventResult::NotCanceled; | 1818 return DispatchEventResult::NotCanceled; |
| 1819 if (!target) | 1819 if (!target) |
| 1820 return DispatchEventResult::NotCanceled; | 1820 return DispatchEventResult::NotCanceled; |
| 1821 InputEvent* beforeInputEvent = InputEvent::createBeforeInput(inputType, data
, InputEvent::EventCancelable::IsCancelable, InputEvent::EventIsComposing::NotCo
mposing, ranges); | 1821 InputEvent* beforeInputEvent = InputEvent::createBeforeInput(inputType, data
, InputEvent::EventCancelable::IsCancelable, InputEvent::EventIsComposing::NotCo
mposing, ranges); |
| 1822 return target->dispatchEvent(beforeInputEvent); | 1822 return target->dispatchEvent(beforeInputEvent); |
| 1823 } | 1823 } |
| 1824 | 1824 |
| 1825 } // namespace blink | 1825 } // namespace blink |
| OLD | NEW |