OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Google Inc. | 3 * Copyright (C) 2008 Google Inc. |
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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 false); | 1092 false); |
1093 } else if (state.m_dragType == DragSourceActionLink) { | 1093 } else if (state.m_dragType == DragSourceActionLink) { |
1094 if (linkURL.isEmpty()) | 1094 if (linkURL.isEmpty()) |
1095 return false; | 1095 return false; |
1096 if (src->selection().isCaret() && src->selection().isContentEditable()) { | 1096 if (src->selection().isCaret() && src->selection().isContentEditable()) { |
1097 // a user can initiate a drag on a link without having any text | 1097 // a user can initiate a drag on a link without having any text |
1098 // selected. In this case, we should expand the selection to | 1098 // selected. In this case, we should expand the selection to |
1099 // the enclosing anchor element | 1099 // the enclosing anchor element |
1100 if (Node* node = enclosingAnchorElement(src->selection().base())) { | 1100 if (Node* node = enclosingAnchorElement(src->selection().base())) { |
1101 src->selection().setSelection( | 1101 src->selection().setSelection( |
1102 VisibleSelection::selectionFromContentsOfNode(node)); | 1102 SelectionInDOMTree::Builder().selectAllChildren(*node).build()); |
1103 } | 1103 } |
1104 } | 1104 } |
1105 | 1105 |
1106 if (!dragImage) { | 1106 if (!dragImage) { |
1107 DCHECK(src->page()); | 1107 DCHECK(src->page()); |
1108 float screenDeviceScaleFactor = | 1108 float screenDeviceScaleFactor = |
1109 src->page()->chromeClient().screenInfo().deviceScaleFactor; | 1109 src->page()->chromeClient().screenInfo().deviceScaleFactor; |
1110 dragImage = dragImageForLink(linkURL, hitTestResult.textContent(), | 1110 dragImage = dragImageForLink(linkURL, hitTestResult.textContent(), |
1111 screenDeviceScaleFactor, mouseDraggedPoint, | 1111 screenDeviceScaleFactor, mouseDraggedPoint, |
1112 dragLocation); | 1112 dragLocation); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 } | 1187 } |
1188 | 1188 |
1189 DEFINE_TRACE(DragController) { | 1189 DEFINE_TRACE(DragController) { |
1190 visitor->trace(m_page); | 1190 visitor->trace(m_page); |
1191 visitor->trace(m_documentUnderMouse); | 1191 visitor->trace(m_documentUnderMouse); |
1192 visitor->trace(m_dragInitiator); | 1192 visitor->trace(m_dragInitiator); |
1193 visitor->trace(m_fileInputElementUnderMouse); | 1193 visitor->trace(m_fileInputElementUnderMouse); |
1194 } | 1194 } |
1195 | 1195 |
1196 } // namespace blink | 1196 } // namespace blink |
OLD | NEW |