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

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

Issue 1149373003: Remove Range.compareNode() as it is not in the spec (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: layout tests changed Created 5 years, 6 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
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 2036 matching lines...) Expand 10 before | Expand all | Expand 10 after
2047 break; 2047 break;
2048 } 2048 }
2049 ASSERT(!element || element->isMouseFocusable()); 2049 ASSERT(!element || element->isMouseFocusable());
2050 2050
2051 // To fix <rdar://problem/4895428> Can't drag selected ToDo, we don't focus 2051 // To fix <rdar://problem/4895428> Can't drag selected ToDo, we don't focus
2052 // a node on mouse down if it's selected and inside a focused node. It will 2052 // a node on mouse down if it's selected and inside a focused node. It will
2053 // be focused if the user does a mouseup over it, however, because the 2053 // be focused if the user does a mouseup over it, however, because the
2054 // mouseup will set a selection inside it, which will call 2054 // mouseup will set a selection inside it, which will call
2055 // FrameSelection::setFocusedNodeIfNeeded. 2055 // FrameSelection::setFocusedNodeIfNeeded.
2056 if (element 2056 if (element
2057 && m_frame->selection().isRange() 2057 && m_frame->selection().isRange()) {
2058 && m_frame->selection().toNormalizedRange()->compareNode(element, IGNORE _EXCEPTION) == Range::NODE_INSIDE 2058 RefPtrWillBeRawPtr<Range> selectedRange = m_frame->selection().toNormali zedRange();
2059 && element->isDescendantOf(m_frame->document()->focusedElement())) 2059 bool nodeFullySelected = Range::compareBoundaryPoints(element->parentNod e(), element->nodeIndex(), selectedRange->startContainer(), selectedRange->start Offset(), IGNORE_EXCEPTION) >= 0
2060 return false; 2060 && Range::compareBoundaryPoints(element->parentNode(), element->node Index() + 1, selectedRange->endContainer(), selectedRange->endOffset(), IGNORE_E XCEPTION) <= 0;
2061 if (nodeFullySelected && element->isDescendantOf(m_frame->document()->fo cusedElement()))
2062 return false;
2063 }
2064
2061 2065
2062 // Only change the focus when clicking scrollbars if it can transfered to a 2066 // Only change the focus when clicking scrollbars if it can transfered to a
2063 // mouse focusable node. 2067 // mouse focusable node.
2064 if (!element && targetedEvent.hitTestResult().scrollbar()) 2068 if (!element && targetedEvent.hitTestResult().scrollbar())
2065 return true; 2069 return true;
2066 2070
2067 if (Page* page = m_frame->page()) { 2071 if (Page* page = m_frame->page()) {
2068 // If focus shift is blocked, we eat the event. Note we should never 2072 // If focus shift is blocked, we eat the event. Note we should never
2069 // clear swallowEvent if the page already set it (e.g., by canceling 2073 // clear swallowEvent if the page already set it (e.g., by canceling
2070 // default behavior). 2074 // default behavior).
(...skipping 2099 matching lines...) Expand 10 before | Expand all | Expand 10 after
4170 unsigned EventHandler::accessKeyModifiers() 4174 unsigned EventHandler::accessKeyModifiers()
4171 { 4175 {
4172 #if OS(MACOSX) 4176 #if OS(MACOSX)
4173 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 4177 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
4174 #else 4178 #else
4175 return PlatformEvent::AltKey; 4179 return PlatformEvent::AltKey;
4176 #endif 4180 #endif
4177 } 4181 }
4178 4182
4179 } // namespace blink 4183 } // namespace blink
OLDNEW
« Source/core/frame/UseCounter.cpp ('K') | « Source/core/frame/UseCounter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698