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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 } | 307 } |
308 | 308 |
309 // This can return null if an empty document is loaded. | 309 // This can return null if an empty document is loaded. |
310 static Element* elementUnderMouse(Document* documentUnderMouse, const IntPoint&
p) | 310 static Element* elementUnderMouse(Document* documentUnderMouse, const IntPoint&
p) |
311 { | 311 { |
312 LocalFrame* frame = documentUnderMouse->frame(); | 312 LocalFrame* frame = documentUnderMouse->frame(); |
313 float zoomFactor = frame ? frame->pageZoomFactor() : 1; | 313 float zoomFactor = frame ? frame->pageZoomFactor() : 1; |
314 LayoutPoint point = roundedLayoutPoint(FloatPoint(p.x() * zoomFactor, p.y()
* zoomFactor)); | 314 LayoutPoint point = roundedLayoutPoint(FloatPoint(p.x() * zoomFactor, p.y()
* zoomFactor)); |
315 | 315 |
316 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active); | 316 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active); |
317 HitTestResult result(point); | 317 HitTestResult result(request, point); |
318 documentUnderMouse->layoutView()->hitTest(request, result); | 318 documentUnderMouse->layoutView()->hitTest(result); |
319 | 319 |
320 Node* n = result.innerNode(); | 320 Node* n = result.innerNode(); |
321 while (n && !n->isElementNode()) | 321 while (n && !n->isElementNode()) |
322 n = n->parentOrShadowHostNode(); | 322 n = n->parentOrShadowHostNode(); |
323 if (n && n->isInShadowTree()) | 323 if (n && n->isInShadowTree()) |
324 n = n->shadowHost(); | 324 n = n->shadowHost(); |
325 | 325 |
326 return toElement(n); | 326 return toElement(n); |
327 } | 327 } |
328 | 328 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 } | 534 } |
535 | 535 |
536 bool DragController::canProcessDrag(DragData* dragData) | 536 bool DragController::canProcessDrag(DragData* dragData) |
537 { | 537 { |
538 ASSERT(dragData); | 538 ASSERT(dragData); |
539 | 539 |
540 if (!dragData->containsCompatibleContent()) | 540 if (!dragData->containsCompatibleContent()) |
541 return false; | 541 return false; |
542 | 542 |
543 IntPoint point = m_page->deprecatedLocalMainFrame()->view()->rootFrameToCont
ents(dragData->clientPosition()); | 543 IntPoint point = m_page->deprecatedLocalMainFrame()->view()->rootFrameToCont
ents(dragData->clientPosition()); |
544 HitTestResult result = HitTestResult(point); | |
545 if (!m_page->deprecatedLocalMainFrame()->contentRenderer()) | 544 if (!m_page->deprecatedLocalMainFrame()->contentRenderer()) |
546 return false; | 545 return false; |
547 | 546 |
548 result = m_page->deprecatedLocalMainFrame()->eventHandler().hitTestResultAtP
oint(point); | 547 HitTestResult result = m_page->deprecatedLocalMainFrame()->eventHandler().hi
tTestResultAtPoint(point); |
549 | 548 |
550 if (!result.innerNonSharedNode()) | 549 if (!result.innerNonSharedNode()) |
551 return false; | 550 return false; |
552 | 551 |
553 if (dragData->containsFiles() && asFileInput(result.innerNonSharedNode())) | 552 if (dragData->containsFiles() && asFileInput(result.innerNonSharedNode())) |
554 return true; | 553 return true; |
555 | 554 |
556 if (isHTMLPlugInElement(*result.innerNonSharedNode())) { | 555 if (isHTMLPlugInElement(*result.innerNonSharedNode())) { |
557 HTMLPlugInElement* plugin = toHTMLPlugInElement(result.innerNonSharedNod
e()); | 556 HTMLPlugInElement* plugin = toHTMLPlugInElement(result.innerNonSharedNod
e()); |
558 if (!plugin->canProcessDrag() && !result.innerNonSharedNode()->hasEditab
leStyle()) | 557 if (!plugin->canProcessDrag() && !result.innerNonSharedNode()->hasEditab
leStyle()) |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 | 964 |
966 DEFINE_TRACE(DragController) | 965 DEFINE_TRACE(DragController) |
967 { | 966 { |
968 visitor->trace(m_page); | 967 visitor->trace(m_page); |
969 visitor->trace(m_documentUnderMouse); | 968 visitor->trace(m_documentUnderMouse); |
970 visitor->trace(m_dragInitiator); | 969 visitor->trace(m_dragInitiator); |
971 visitor->trace(m_fileInputElementUnderMouse); | 970 visitor->trace(m_fileInputElementUnderMouse); |
972 } | 971 } |
973 | 972 |
974 } // namespace blink | 973 } // namespace blink |
OLD | NEW |