Index: Source/core/input/EventHandler.cpp |
diff --git a/Source/core/input/EventHandler.cpp b/Source/core/input/EventHandler.cpp |
index ed72ddf7134747ec0f7302532c2da5e16c164a68..b4180068ef6c540f00024e60e60e36c1233f561d 100644 |
--- a/Source/core/input/EventHandler.cpp |
+++ b/Source/core/input/EventHandler.cpp |
@@ -1658,11 +1658,12 @@ bool EventHandler::handleMouseFocus(const MouseEventWithHitTestResults& targeted |
// be focused if the user does a mouseup over it, however, because the |
// mouseup will set a selection inside it, which will call |
// FrameSelection::setFocusedNodeIfNeeded. |
- if (element |
- && m_frame->selection().isRange() |
- && m_frame->selection().toNormalizedRange()->compareNode(element, IGNORE_EXCEPTION) == Range::NODE_INSIDE |
- && element->isDescendantOf(m_frame->document()->focusedElement())) |
- return false; |
+ if (element && m_frame->selection().isRange()) { |
+ if (m_frame->selection().toNormalizedRange()->isNodeFullyContained(*element, IGNORE_EXCEPTION) |
+ && element->isDescendantOf(m_frame->document()->focusedElement())) |
+ return false; |
+ } |
+ |
// Only change the focus when clicking scrollbars if it can transfered to a |
// mouse focusable node. |