| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2008, 2009, 2010 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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 if (ComputeVisibleSelectionInFlatTree().IsNone()) { | 446 if (ComputeVisibleSelectionInFlatTree().IsNone()) { |
| 447 // TODO(editing-dev): We should avoid any case where VSInFlatTree is none | 447 // TODO(editing-dev): We should avoid any case where VSInFlatTree is none |
| 448 // but VSInDOMTree is not none. | 448 // but VSInDOMTree is not none. |
| 449 DLOG(FATAL) << ComputeVisibleSelectionInDOMTree(); | 449 DLOG(FATAL) << ComputeVisibleSelectionInDOMTree(); |
| 450 } | 450 } |
| 451 | 451 |
| 452 // Selection has focus if it contains the focused element. | 452 // Selection has focus if it contains the focused element. |
| 453 const PositionInFlatTree& focused_position = | 453 const PositionInFlatTree& focused_position = |
| 454 PositionInFlatTree::FirstPositionInNode(focused_element); | 454 PositionInFlatTree::FirstPositionInNode(focused_element); |
| 455 if (ComputeVisibleSelectionInFlatTree().Start() <= focused_position && | 455 if (ComputeVisibleSelectionInFlatTree().Start() <= focused_position && |
| 456 ComputeVisibleSelectionInFlatTree().end() >= focused_position) | 456 ComputeVisibleSelectionInFlatTree().End() >= focused_position) |
| 457 return true; | 457 return true; |
| 458 | 458 |
| 459 bool has_editable_style = HasEditableStyle(*current); | 459 bool has_editable_style = HasEditableStyle(*current); |
| 460 do { | 460 do { |
| 461 // If the selection is within an editable sub tree and that sub tree | 461 // If the selection is within an editable sub tree and that sub tree |
| 462 // doesn't have focus, the selection doesn't have focus either. | 462 // doesn't have focus, the selection doesn't have focus either. |
| 463 if (has_editable_style && !HasEditableStyle(*current)) | 463 if (has_editable_style && !HasEditableStyle(*current)) |
| 464 return false; | 464 return false; |
| 465 | 465 |
| 466 // Selection has focus if its sub tree has focus. | 466 // Selection has focus if its sub tree has focus. |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 if (!view || layout_view.IsNull()) | 942 if (!view || layout_view.IsNull()) |
| 943 return LayoutRect(); | 943 return LayoutRect(); |
| 944 | 944 |
| 945 view->UpdateLifecycleToLayoutClean(); | 945 view->UpdateLifecycleToLayoutClean(); |
| 946 return LayoutRect(layout_selection_->SelectionBounds()); | 946 return LayoutRect(layout_selection_->SelectionBounds()); |
| 947 } | 947 } |
| 948 | 948 |
| 949 static IntRect AbsoluteSelectionBoundsOf( | 949 static IntRect AbsoluteSelectionBoundsOf( |
| 950 const VisibleSelectionInFlatTree& selection) { | 950 const VisibleSelectionInFlatTree& selection) { |
| 951 return ComputeTextRect( | 951 return ComputeTextRect( |
| 952 EphemeralRangeInFlatTree(selection.Start(), selection.end())); | 952 EphemeralRangeInFlatTree(selection.Start(), selection.End())); |
| 953 } | 953 } |
| 954 | 954 |
| 955 // TODO(editing-dev): This should be done in FlatTree world. | 955 // TODO(editing-dev): This should be done in FlatTree world. |
| 956 void FrameSelection::RevealSelection(const ScrollAlignment& alignment, | 956 void FrameSelection::RevealSelection(const ScrollAlignment& alignment, |
| 957 RevealExtentOption reveal_extent_option) { | 957 RevealExtentOption reveal_extent_option) { |
| 958 DCHECK(IsAvailable()); | 958 DCHECK(IsAvailable()); |
| 959 | 959 |
| 960 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets | 960 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets |
| 961 // needs to be audited. See http://crbug.com/590369 for more details. | 961 // needs to be audited. See http://crbug.com/590369 for more details. |
| 962 // Calculation of absolute caret bounds requires clean layout. | 962 // Calculation of absolute caret bounds requires clean layout. |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1180 } | 1180 } |
| 1181 | 1181 |
| 1182 void showTree(const blink::FrameSelection* sel) { | 1182 void showTree(const blink::FrameSelection* sel) { |
| 1183 if (sel) | 1183 if (sel) |
| 1184 sel->ShowTreeForThis(); | 1184 sel->ShowTreeForThis(); |
| 1185 else | 1185 else |
| 1186 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; | 1186 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; |
| 1187 } | 1187 } |
| 1188 | 1188 |
| 1189 #endif | 1189 #endif |
| OLD | NEW |