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

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

Issue 189573002: Convert HTMLFrameOwnerElement and FocusController to use Frame. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Missed a null check Created 6 years, 9 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 | « Source/core/inspector/InspectorDOMAgent.cpp ('k') | Source/core/page/FocusController.h » ('j') | 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 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 1714 matching lines...) Expand 10 before | Expand all | Expand 10 after
1725 // There is something of a webcompat angle to this well, as highlighted by 1725 // There is something of a webcompat angle to this well, as highlighted by
1726 // crbug.com/14608. Pages can clear text boxes 'onclick' and, if we paste on 1726 // crbug.com/14608. Pages can clear text boxes 'onclick' and, if we paste on
1727 // down then the text is pasted just before the onclick handler runs and 1727 // down then the text is pasted just before the onclick handler runs and
1728 // clears the text box. So it's important this happens after the event 1728 // clears the text box. So it's important this happens after the event
1729 // handlers have been fired. 1729 // handlers have been fired.
1730 if (mouseEvent.type() != PlatformEvent::MouseReleased) 1730 if (mouseEvent.type() != PlatformEvent::MouseReleased)
1731 return false; 1731 return false;
1732 1732
1733 if (!m_frame->page()) 1733 if (!m_frame->page())
1734 return false; 1734 return false;
1735 LocalFrame* focusFrame = m_frame->page()->focusController().focusedOrMainFra me(); 1735 Frame* focusFrame = m_frame->page()->focusController().focusedOrMainFrame();
1736 // Do not paste here if the focus was moved somewhere else. 1736 // Do not paste here if the focus was moved somewhere else.
1737 if (m_frame == focusFrame && m_frame->editor().behavior().supportsGlobalSele ction()) 1737 if (m_frame == focusFrame && m_frame->editor().behavior().supportsGlobalSele ction())
1738 return m_frame->editor().command("PasteGlobalSelection").execute(); 1738 return m_frame->editor().command("PasteGlobalSelection").execute();
1739 1739
1740 return false; 1740 return false;
1741 } 1741 }
1742 1742
1743 1743
1744 bool EventHandler::dispatchDragEvent(const AtomicString& eventType, Node* dragTa rget, const PlatformMouseEvent& event, Clipboard* clipboard) 1744 bool EventHandler::dispatchDragEvent(const AtomicString& eventType, Node* dragTa rget, const PlatformMouseEvent& event, Clipboard* clipboard)
1745 { 1745 {
(...skipping 12 matching lines...) Expand all
1758 1758
1759 dragTarget->dispatchEvent(me.get(), IGNORE_EXCEPTION); 1759 dragTarget->dispatchEvent(me.get(), IGNORE_EXCEPTION);
1760 return me->defaultPrevented(); 1760 return me->defaultPrevented();
1761 } 1761 }
1762 1762
1763 static bool targetIsFrame(Node* target, LocalFrame*& frame) 1763 static bool targetIsFrame(Node* target, LocalFrame*& frame)
1764 { 1764 {
1765 if (!isHTMLFrameElementBase(target)) 1765 if (!isHTMLFrameElementBase(target))
1766 return false; 1766 return false;
1767 1767
1768 frame = toHTMLFrameElementBase(target)->contentFrame(); 1768 // Cross-process drag and drop is not yet supported.
1769 if (toHTMLFrameElementBase(target)->contentFrame() && !toHTMLFrameElementBas e(target)->contentFrame()->isLocalFrame())
1770 return false;
1771
1772 frame = toLocalFrame(toHTMLFrameElementBase(target)->contentFrame());
1769 return true; 1773 return true;
1770 } 1774 }
1771 1775
1772 static bool findDropZone(Node* target, Clipboard* clipboard) 1776 static bool findDropZone(Node* target, Clipboard* clipboard)
1773 { 1777 {
1774 Element* element = target->isElementNode() ? toElement(target) : target->par entElement(); 1778 Element* element = target->isElementNode() ? toElement(target) : target->par entElement();
1775 for (; element; element = element->parentElement()) { 1779 for (; element; element = element->parentElement()) {
1776 bool matched = false; 1780 bool matched = false;
1777 AtomicString dropZoneStr = element->fastGetAttribute(webkitdropzoneAttr) ; 1781 AtomicString dropZoneStr = element->fastGetAttribute(webkitdropzoneAttr) ;
1778 1782
(...skipping 2259 matching lines...) Expand 10 before | Expand all | Expand 10 after
4038 unsigned EventHandler::accessKeyModifiers() 4042 unsigned EventHandler::accessKeyModifiers()
4039 { 4043 {
4040 #if OS(MACOSX) 4044 #if OS(MACOSX)
4041 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 4045 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
4042 #else 4046 #else
4043 return PlatformEvent::AltKey; 4047 return PlatformEvent::AltKey;
4044 #endif 4048 #endif
4045 } 4049 }
4046 4050
4047 } // namespace WebCore 4051 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorDOMAgent.cpp ('k') | Source/core/page/FocusController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698