| 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 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 float scale = newSize.width() / (float)originalSize.width(); | 824 float scale = newSize.width() / (float)originalSize.width(); |
| 825 float dx = origin.x() - dragOrigin.x(); | 825 float dx = origin.x() - dragOrigin.x(); |
| 826 dx *= scale; | 826 dx *= scale; |
| 827 origin.setX((int)(dx + 0.5)); | 827 origin.setX((int)(dx + 0.5)); |
| 828 float dy = origin.y() - dragOrigin.y(); | 828 float dy = origin.y() - dragOrigin.y(); |
| 829 dy *= scale; | 829 dy *= scale; |
| 830 origin.setY((int)(dy + 0.5)); | 830 origin.setY((int)(dy + 0.5)); |
| 831 } | 831 } |
| 832 | 832 |
| 833 dragLocation = dragOrigin + origin; | 833 dragLocation = dragOrigin + origin; |
| 834 return dragImage.release(); | 834 return dragImage; |
| 835 } | 835 } |
| 836 | 836 |
| 837 static PassOwnPtr<DragImage> dragImageForLink(const KURL& linkURL, const String&
linkText, float deviceScaleFactor, const IntPoint& mouseDraggedPoint, IntPoint&
dragLoc) | 837 static PassOwnPtr<DragImage> dragImageForLink(const KURL& linkURL, const String&
linkText, float deviceScaleFactor, const IntPoint& mouseDraggedPoint, IntPoint&
dragLoc) |
| 838 { | 838 { |
| 839 FontDescription fontDescription; | 839 FontDescription fontDescription; |
| 840 LayoutTheme::theme().systemFont(blink::CSSValueNone, fontDescription); | 840 LayoutTheme::theme().systemFont(blink::CSSValueNone, fontDescription); |
| 841 OwnPtr<DragImage> dragImage = DragImage::create(linkURL, linkText, fontDescr
iption, deviceScaleFactor); | 841 OwnPtr<DragImage> dragImage = DragImage::create(linkURL, linkText, fontDescr
iption, deviceScaleFactor); |
| 842 | 842 |
| 843 IntSize size = dragImage ? dragImage->size() : IntSize(); | 843 IntSize size = dragImage ? dragImage->size() : IntSize(); |
| 844 IntPoint dragImageOffset(-size.width() / 2, -LinkDragBorderInset); | 844 IntPoint dragImageOffset(-size.width() / 2, -LinkDragBorderInset); |
| 845 dragLoc = IntPoint(mouseDraggedPoint.x() + dragImageOffset.x(), mouseDragged
Point.y() + dragImageOffset.y()); | 845 dragLoc = IntPoint(mouseDraggedPoint.x() + dragImageOffset.x(), mouseDragged
Point.y() + dragImageOffset.y()); |
| 846 | 846 |
| 847 return dragImage.release(); | 847 return dragImage; |
| 848 } | 848 } |
| 849 | 849 |
| 850 bool DragController::startDrag(LocalFrame* src, const DragState& state, const Pl
atformMouseEvent& dragEvent, const IntPoint& dragOrigin) | 850 bool DragController::startDrag(LocalFrame* src, const DragState& state, const Pl
atformMouseEvent& dragEvent, const IntPoint& dragOrigin) |
| 851 { | 851 { |
| 852 ASSERT(dragTypeIsValid(state.m_dragType)); | 852 ASSERT(dragTypeIsValid(state.m_dragType)); |
| 853 ASSERT(src); | 853 ASSERT(src); |
| 854 if (!src->view() || src->contentLayoutItem().isNull()) | 854 if (!src->view() || src->contentLayoutItem().isNull()) |
| 855 return false; | 855 return false; |
| 856 | 856 |
| 857 HitTestResult hitTestResult = src->eventHandler().hitTestResultAtPoint(dragO
rigin); | 857 HitTestResult hitTestResult = src->eventHandler().hitTestResultAtPoint(dragO
rigin); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 | 992 |
| 993 DEFINE_TRACE(DragController) | 993 DEFINE_TRACE(DragController) |
| 994 { | 994 { |
| 995 visitor->trace(m_page); | 995 visitor->trace(m_page); |
| 996 visitor->trace(m_documentUnderMouse); | 996 visitor->trace(m_documentUnderMouse); |
| 997 visitor->trace(m_dragInitiator); | 997 visitor->trace(m_dragInitiator); |
| 998 visitor->trace(m_fileInputElementUnderMouse); | 998 visitor->trace(m_fileInputElementUnderMouse); |
| 999 } | 999 } |
| 1000 | 1000 |
| 1001 } // namespace blink | 1001 } // namespace blink |
| OLD | NEW |