| 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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 } else if (state.m_dragType == DragSourceActionLink) { | 1143 } else if (state.m_dragType == DragSourceActionLink) { |
| 1144 if (linkURL.isEmpty()) | 1144 if (linkURL.isEmpty()) |
| 1145 return false; | 1145 return false; |
| 1146 if (src->selection() | 1146 if (src->selection() |
| 1147 .computeVisibleSelectionInDOMTreeDeprecated() | 1147 .computeVisibleSelectionInDOMTreeDeprecated() |
| 1148 .isCaret() && | 1148 .isCaret() && |
| 1149 src->selection().isContentEditable()) { | 1149 src->selection().isContentEditable()) { |
| 1150 // a user can initiate a drag on a link without having any text | 1150 // a user can initiate a drag on a link without having any text |
| 1151 // selected. In this case, we should expand the selection to | 1151 // selected. In this case, we should expand the selection to |
| 1152 // the enclosing anchor element | 1152 // the enclosing anchor element |
| 1153 if (Node* node = enclosingAnchorElement(src->selection().base())) { | 1153 if (Node* node = enclosingAnchorElement( |
| 1154 src->selection() |
| 1155 .computeVisibleSelectionInDOMTreeDeprecated() |
| 1156 .base())) { |
| 1154 src->selection().setSelection( | 1157 src->selection().setSelection( |
| 1155 SelectionInDOMTree::Builder().selectAllChildren(*node).build()); | 1158 SelectionInDOMTree::Builder().selectAllChildren(*node).build()); |
| 1156 } | 1159 } |
| 1157 } | 1160 } |
| 1158 | 1161 |
| 1159 if (!dragImage) { | 1162 if (!dragImage) { |
| 1160 DCHECK(src->page()); | 1163 DCHECK(src->page()); |
| 1161 float screenDeviceScaleFactor = | 1164 float screenDeviceScaleFactor = |
| 1162 src->page()->chromeClient().screenInfo().deviceScaleFactor; | 1165 src->page()->chromeClient().screenInfo().deviceScaleFactor; |
| 1163 dragImage = dragImageForLink(linkURL, hitTestResult.textContent(), | 1166 dragImage = dragImageForLink(linkURL, hitTestResult.textContent(), |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1244 | 1247 |
| 1245 DEFINE_TRACE(DragController) { | 1248 DEFINE_TRACE(DragController) { |
| 1246 visitor->trace(m_page); | 1249 visitor->trace(m_page); |
| 1247 visitor->trace(m_documentUnderMouse); | 1250 visitor->trace(m_documentUnderMouse); |
| 1248 visitor->trace(m_dragInitiator); | 1251 visitor->trace(m_dragInitiator); |
| 1249 visitor->trace(m_dragState); | 1252 visitor->trace(m_dragState); |
| 1250 visitor->trace(m_fileInputElementUnderMouse); | 1253 visitor->trace(m_fileInputElementUnderMouse); |
| 1251 } | 1254 } |
| 1252 | 1255 |
| 1253 } // namespace blink | 1256 } // namespace blink |
| OLD | NEW |