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

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

Issue 25490002: Refactoring: Change the order of conditions to avoid computing rendererIsEditable() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed unrelated changes Created 7 years, 2 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/dom/Position.cpp ('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 * 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 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 // press and it's not a context menu click. We do this so when clicking 821 // press and it's not a context menu click. We do this so when clicking
822 // on the selection, the selection goes away. However, if we are 822 // on the selection, the selection goes away. However, if we are
823 // editing, place the caret. 823 // editing, place the caret.
824 if (m_mouseDownWasSingleClickInSelection && m_selectionInitiationState != Ex tendedSelection 824 if (m_mouseDownWasSingleClickInSelection && m_selectionInitiationState != Ex tendedSelection
825 && m_dragStartPos == event.event().position() 825 && m_dragStartPos == event.event().position()
826 && m_frame->selection().isRange() 826 && m_frame->selection().isRange()
827 && event.event().button() != RightButton) { 827 && event.event().button() != RightButton) {
828 VisibleSelection newSelection; 828 VisibleSelection newSelection;
829 Node* node = event.targetNode(); 829 Node* node = event.targetNode();
830 bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBr owsingEnabled(); 830 bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBr owsingEnabled();
831 if (node && (caretBrowsing || node->rendererIsEditable()) && node->rende rer()) { 831 if (node && node->renderer() && (caretBrowsing || node->rendererIsEditab le())) {
832 VisiblePosition pos = VisiblePosition(node->renderer()->positionForP oint(event.localPoint())); 832 VisiblePosition pos = VisiblePosition(node->renderer()->positionForP oint(event.localPoint()));
833 newSelection = VisibleSelection(pos); 833 newSelection = VisibleSelection(pos);
834 } 834 }
835 835
836 setSelectionIfNeeded(m_frame->selection(), newSelection); 836 setSelectionIfNeeded(m_frame->selection(), newSelection);
837 837
838 handled = true; 838 handled = true;
839 } 839 }
840 840
841 m_frame->selection().notifyRendererOfSelectionChange(UserTriggered); 841 m_frame->selection().notifyRendererOfSelectionChange(UserTriggered);
(...skipping 2996 matching lines...) Expand 10 before | Expand all | Expand 10 after
3838 unsigned EventHandler::accessKeyModifiers() 3838 unsigned EventHandler::accessKeyModifiers()
3839 { 3839 {
3840 #if OS(MACOSX) 3840 #if OS(MACOSX)
3841 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3841 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3842 #else 3842 #else
3843 return PlatformEvent::AltKey; 3843 return PlatformEvent::AltKey;
3844 #endif 3844 #endif
3845 } 3845 }
3846 3846
3847 } // namespace WebCore 3847 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Position.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698