OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights |
3 * reserved. | 3 * reserved. |
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) | 5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) |
6 * Copyright (C) 2015 Google Inc. All rights reserved. | 6 * Copyright (C) 2015 Google Inc. All rights reserved. |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 | 346 |
347 Node* target = hit_test_result.InnerNode(); | 347 Node* target = hit_test_result.InnerNode(); |
348 if (!target) | 348 if (!target) |
349 return; | 349 return; |
350 | 350 |
351 // TODO(editing-dev): Use of updateStyleAndLayoutIgnorePendingStylesheets | 351 // TODO(editing-dev): Use of updateStyleAndLayoutIgnorePendingStylesheets |
352 // needs to be audited. See http://crbug.com/590369 for more details. | 352 // needs to be audited. See http://crbug.com/590369 for more details. |
353 frame_->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); | 353 frame_->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); |
354 | 354 |
355 const PositionWithAffinity& raw_target_position = | 355 const PositionWithAffinity& raw_target_position = |
356 PositionRespectingEditingBoundary( | 356 Selection().SelectionHasFocus() |
357 Selection().ComputeVisibleSelectionInDOMTree().Start(), | 357 ? PositionRespectingEditingBoundary( |
358 hit_test_result.LocalPoint(), target); | 358 Selection().ComputeVisibleSelectionInDOMTree().Start(), |
| 359 hit_test_result.LocalPoint(), target) |
| 360 : PositionWithAffinity(); |
359 VisiblePositionInFlatTree target_position = CreateVisiblePosition( | 361 VisiblePositionInFlatTree target_position = CreateVisiblePosition( |
360 FromPositionInDOMTree<EditingInFlatTreeStrategy>(raw_target_position)); | 362 FromPositionInDOMTree<EditingInFlatTreeStrategy>(raw_target_position)); |
361 // Don't modify the selection if we're not on a node. | 363 // Don't modify the selection if we're not on a node. |
362 if (target_position.IsNull()) | 364 if (target_position.IsNull()) |
363 return; | 365 return; |
364 | 366 |
365 // Restart the selection if this is the first mouse move. This work is usually | 367 // Restart the selection if this is the first mouse move. This work is usually |
366 // done in handleMousePressEvent, but not if the mouse press was on an | 368 // done in handleMousePressEvent, but not if the mouse press was on an |
367 // existing selection. | 369 // existing selection. |
368 | 370 |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 | 1133 |
1132 bool IsExtendingSelection(const MouseEventWithHitTestResults& event) { | 1134 bool IsExtendingSelection(const MouseEventWithHitTestResults& event) { |
1133 bool is_mouse_down_on_link_or_image = | 1135 bool is_mouse_down_on_link_or_image = |
1134 event.IsOverLink() || event.GetHitTestResult().GetImage(); | 1136 event.IsOverLink() || event.GetHitTestResult().GetImage(); |
1135 return (event.Event().GetModifiers() & WebInputEvent::Modifiers::kShiftKey) != | 1137 return (event.Event().GetModifiers() & WebInputEvent::Modifiers::kShiftKey) != |
1136 0 && | 1138 0 && |
1137 !is_mouse_down_on_link_or_image; | 1139 !is_mouse_down_on_link_or_image; |
1138 } | 1140 } |
1139 | 1141 |
1140 } // namespace blink | 1142 } // namespace blink |
OLD | NEW |