| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 DCHECK(GetFrame()); | 100 DCHECK(GetFrame()); |
| 101 const SelectionInDOMTree& selection = | 101 const SelectionInDOMTree& selection = |
| 102 GetFrame()->Selection().GetSelectionInDOMTree(); | 102 GetFrame()->Selection().GetSelectionInDOMTree(); |
| 103 return selection.Base() <= selection.Extent(); | 103 return selection.Base() <= selection.Extent(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 // TODO(tkent): Following four functions based on VisibleSelection should be | 106 // TODO(tkent): Following four functions based on VisibleSelection should be |
| 107 // removed. | 107 // removed. |
| 108 static Position AnchorPosition(const VisibleSelection& selection) { | 108 static Position AnchorPosition(const VisibleSelection& selection) { |
| 109 Position anchor = | 109 Position anchor = |
| 110 selection.IsBaseFirst() ? selection.Start() : selection.end(); | 110 selection.IsBaseFirst() ? selection.Start() : selection.End(); |
| 111 return anchor.ParentAnchoredEquivalent(); | 111 return anchor.ParentAnchoredEquivalent(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 static Position FocusPosition(const VisibleSelection& selection) { | 114 static Position FocusPosition(const VisibleSelection& selection) { |
| 115 Position focus = | 115 Position focus = |
| 116 selection.IsBaseFirst() ? selection.end() : selection.Start(); | 116 selection.IsBaseFirst() ? selection.End() : selection.Start(); |
| 117 return focus.ParentAnchoredEquivalent(); | 117 return focus.ParentAnchoredEquivalent(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 static Position BasePosition(const VisibleSelection& selection) { | 120 static Position BasePosition(const VisibleSelection& selection) { |
| 121 return selection.Base().ParentAnchoredEquivalent(); | 121 return selection.Base().ParentAnchoredEquivalent(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 static Position ExtentPosition(const VisibleSelection& selection) { | 124 static Position ExtentPosition(const VisibleSelection& selection) { |
| 125 return selection.Extent().ParentAnchoredEquivalent(); | 125 return selection.Extent().ParentAnchoredEquivalent(); |
| 126 } | 126 } |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 tree_scope_->GetDocument().AddConsoleMessage( | 841 tree_scope_->GetDocument().AddConsoleMessage( |
| 842 ConsoleMessage::Create(kJSMessageSource, kErrorMessageLevel, message)); | 842 ConsoleMessage::Create(kJSMessageSource, kErrorMessageLevel, message)); |
| 843 } | 843 } |
| 844 | 844 |
| 845 DEFINE_TRACE(DOMSelection) { | 845 DEFINE_TRACE(DOMSelection) { |
| 846 visitor->Trace(tree_scope_); | 846 visitor->Trace(tree_scope_); |
| 847 ContextClient::Trace(visitor); | 847 ContextClient::Trace(visitor); |
| 848 } | 848 } |
| 849 | 849 |
| 850 } // namespace blink | 850 } // namespace blink |
| OLD | NEW |