From 3050913d21e5d759ec2f88d8d44d44ff12058ccc Mon Sep 17 00:00:00 2001 From: David Rosca Date: Mon, 5 Oct 2015 20:29:26 +0200 Subject: [PATCH] WebHitTestResult: Fix isContentSelected Was returning always true on right click --- src/lib/webengine/webhittestresult.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/webengine/webhittestresult.cpp b/src/lib/webengine/webhittestresult.cpp index ca8fbb6a5..57736226d 100644 --- a/src/lib/webengine/webhittestresult.cpp +++ b/src/lib/webengine/webhittestresult.cpp @@ -40,12 +40,18 @@ WebHitTestResult::WebHitTestResult(const WebPage *page, const QPoint &pos) " return e.getAttribute('readonly') != 'readonly';" " return false;" "}" + "function isSelected(e) {" + " var selection = window.getSelection();" + " if (selection.type != 'Range')" + " return false;" + " return window.getSelection().containsNode(e, true);" + "}" "var res = {" " alternateText: e.getAttribute('alt')," " boundingRect: ''," " imageUrl: ''," " contentEditable: isEditableElement(e)," - " contentSelected: window.getSelection().containsNode(e, true)," + " contentSelected: isSelected(e)," " linkTitle: ''," " linkUrl: ''," " mediaUrl: '',"