Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Side by Side Diff: Source/WebCore/page/EventHandler.cpp

Issue 9385008: Merge 106488 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/963/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/fast/events/remove-target-with-shadow-in-drag-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
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 1813 matching lines...) Expand 10 before | Expand all | Expand 10 after
1824 { 1824 {
1825 bool accept = false; 1825 bool accept = false;
1826 1826
1827 if (!m_frame->view()) 1827 if (!m_frame->view())
1828 return false; 1828 return false;
1829 1829
1830 HitTestRequest request(HitTestRequest::ReadOnly); 1830 HitTestRequest request(HitTestRequest::ReadOnly);
1831 MouseEventWithHitTestResults mev = prepareMouseEvent(request, event); 1831 MouseEventWithHitTestResults mev = prepareMouseEvent(request, event);
1832 1832
1833 // Drag events should never go to text nodes (following IE, and proper mouse over/out dispatch) 1833 // Drag events should never go to text nodes (following IE, and proper mouse over/out dispatch)
1834 Node* newTarget = targetNode(mev); 1834 RefPtr<Node> newTarget = targetNode(mev);
1835 if (newTarget && newTarget->isTextNode()) 1835 if (newTarget && newTarget->isTextNode())
1836 newTarget = newTarget->parentNode(); 1836 newTarget = newTarget->parentNode();
1837 if (newTarget) 1837 if (newTarget)
1838 newTarget = newTarget->shadowAncestorNode(); 1838 newTarget = newTarget->shadowAncestorNode();
1839 1839
1840 if (m_dragTarget != newTarget) { 1840 if (m_dragTarget != newTarget) {
1841 // FIXME: this ordering was explicitly chosen to match WinIE. However, 1841 // FIXME: this ordering was explicitly chosen to match WinIE. However,
1842 // it is sometimes incorrect when dragging within subframes, as seen wit h 1842 // it is sometimes incorrect when dragging within subframes, as seen wit h
1843 // LayoutTests/fast/events/drag-in-frames.html. 1843 // LayoutTests/fast/events/drag-in-frames.html.
1844 // 1844 //
1845 // Moreover, this ordering conforms to section 7.9.4 of the HTML 5 spec. <http://dev.w3.org/html5/spec/Overview.html#drag-and-drop-processing-model>. 1845 // Moreover, this ordering conforms to section 7.9.4 of the HTML 5 spec. <http://dev.w3.org/html5/spec/Overview.html#drag-and-drop-processing-model>.
1846 Frame* targetFrame; 1846 Frame* targetFrame;
1847 if (targetIsFrame(newTarget, targetFrame)) { 1847 if (targetIsFrame(newTarget.get(), targetFrame)) {
1848 if (targetFrame) 1848 if (targetFrame)
1849 accept = targetFrame->eventHandler()->updateDragAndDrop(event, c lipboard); 1849 accept = targetFrame->eventHandler()->updateDragAndDrop(event, c lipboard);
1850 } else if (newTarget) { 1850 } else if (newTarget) {
1851 // As per section 7.9.4 of the HTML 5 spec., we must always fire a d rag event before firing a dragenter, dragleave, or dragover event. 1851 // As per section 7.9.4 of the HTML 5 spec., we must always fire a d rag event before firing a dragenter, dragleave, or dragover event.
1852 if (dragState().m_dragSrc && dragState().shouldDispatchEvents()) { 1852 if (dragState().m_dragSrc && dragState().shouldDispatchEvents()) {
1853 // for now we don't care if event handler cancels default behavi or, since there is none 1853 // for now we don't care if event handler cancels default behavi or, since there is none
1854 dispatchDragSrcEvent(eventNames().dragEvent, event); 1854 dispatchDragSrcEvent(eventNames().dragEvent, event);
1855 } 1855 }
1856 accept = dispatchDragEvent(eventNames().dragenterEvent, newTarget, e vent, clipboard); 1856 accept = dispatchDragEvent(eventNames().dragenterEvent, newTarget.ge t(), event, clipboard);
1857 if (!accept) 1857 if (!accept)
1858 accept = findDropZone(newTarget, clipboard); 1858 accept = findDropZone(newTarget.get(), clipboard);
1859 } 1859 }
1860 1860
1861 if (targetIsFrame(m_dragTarget.get(), targetFrame)) { 1861 if (targetIsFrame(m_dragTarget.get(), targetFrame)) {
1862 if (targetFrame) 1862 if (targetFrame)
1863 accept = targetFrame->eventHandler()->updateDragAndDrop(event, c lipboard); 1863 accept = targetFrame->eventHandler()->updateDragAndDrop(event, c lipboard);
1864 } else if (m_dragTarget) 1864 } else if (m_dragTarget)
1865 dispatchDragEvent(eventNames().dragleaveEvent, m_dragTarget.get(), e vent, clipboard); 1865 dispatchDragEvent(eventNames().dragleaveEvent, m_dragTarget.get(), e vent, clipboard);
1866 1866
1867 if (newTarget) { 1867 if (newTarget) {
1868 // We do not explicitly call dispatchDragEvent here because it could ultimately result in the appearance that 1868 // We do not explicitly call dispatchDragEvent here because it could ultimately result in the appearance that
1869 // two dragover events fired. So, we mark that we should only fire a dragover event on the next call to this function. 1869 // two dragover events fired. So, we mark that we should only fire a dragover event on the next call to this function.
1870 m_shouldOnlyFireDragOverEvent = true; 1870 m_shouldOnlyFireDragOverEvent = true;
1871 } 1871 }
1872 } else { 1872 } else {
1873 Frame* targetFrame; 1873 Frame* targetFrame;
1874 if (targetIsFrame(newTarget, targetFrame)) { 1874 if (targetIsFrame(newTarget.get(), targetFrame)) {
1875 if (targetFrame) 1875 if (targetFrame)
1876 accept = targetFrame->eventHandler()->updateDragAndDrop(event, c lipboard); 1876 accept = targetFrame->eventHandler()->updateDragAndDrop(event, c lipboard);
1877 } else if (newTarget) { 1877 } else if (newTarget) {
1878 // Note, when dealing with sub-frames, we may need to fire only a dr agover event as a drag event may have been fired earlier. 1878 // Note, when dealing with sub-frames, we may need to fire only a dr agover event as a drag event may have been fired earlier.
1879 if (!m_shouldOnlyFireDragOverEvent && dragState().m_dragSrc && dragS tate().shouldDispatchEvents()) { 1879 if (!m_shouldOnlyFireDragOverEvent && dragState().m_dragSrc && dragS tate().shouldDispatchEvents()) {
1880 // for now we don't care if event handler cancels default behavi or, since there is none 1880 // for now we don't care if event handler cancels default behavi or, since there is none
1881 dispatchDragSrcEvent(eventNames().dragEvent, event); 1881 dispatchDragSrcEvent(eventNames().dragEvent, event);
1882 } 1882 }
1883 accept = dispatchDragEvent(eventNames().dragoverEvent, newTarget, ev ent, clipboard); 1883 accept = dispatchDragEvent(eventNames().dragoverEvent, newTarget.get (), event, clipboard);
1884 if (!accept) 1884 if (!accept)
1885 accept = findDropZone(newTarget, clipboard); 1885 accept = findDropZone(newTarget.get(), clipboard);
1886 m_shouldOnlyFireDragOverEvent = false; 1886 m_shouldOnlyFireDragOverEvent = false;
1887 } 1887 }
1888 } 1888 }
1889 m_dragTarget = newTarget; 1889 m_dragTarget = newTarget;
1890 1890
1891 return accept; 1891 return accept;
1892 } 1892 }
1893 1893
1894 void EventHandler::cancelDragAndDrop(const PlatformMouseEvent& event, Clipboard* clipboard) 1894 void EventHandler::cancelDragAndDrop(const PlatformMouseEvent& event, Clipboard* clipboard)
1895 { 1895 {
(...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after
3332 } 3332 }
3333 3333
3334 return defaultPrevented; 3334 return defaultPrevented;
3335 } 3335 }
3336 3336
3337 3337
3338 3338
3339 #endif 3339 #endif
3340 3340
3341 } 3341 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/events/remove-target-with-shadow-in-drag-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698