+2004-12-02 Ken Kocienda <kocienda@apple.com>
+
+ Reviewed by Chris
+
+ Fix for this bug:
+
+ <rdar://problem/3668157> REGRESSION (Mail): shift-click deselects when selection was created right-to-left
+
+ * khtml/khtml_part.cpp:
+ (KHTMLPart::handleMousePressEventSingleClick): Use RangeImpl::compareBoundaryPoints
+ to figure out which end of the selection to extend.
+
2004-12-02 David Harrison <harrison@apple.com>
Reviewed by Ken Kocienda.
#include "misc/htmlhashes.h"
#include "misc/loader.h"
#include "xml/dom2_eventsimpl.h"
+#include "xml/dom2_rangeimpl.h"
#include "xml/xml_tokenizer.h"
using namespace DOM;
sel = selection();
if (extendSelection && sel.isCaretOrRange()) {
sel.clearModifyBias();
- sel.setExtent(pos);
+
+ // See <rdar://problem/3668157> REGRESSION (Mail): shift-click deselects when selection
+ // was created right-to-left
+ Position start = sel.start();
+ short before = RangeImpl::compareBoundaryPoints(pos.node(), pos.offset(), start.node(), start.offset());
+ if (before <= 0) {
+ sel.setBaseAndExtent(pos, sel.end());
+ }
+ else {
+ sel.setBaseAndExtent(start, pos);
+ }
+
if (d->m_selectionGranularity != CHARACTER) {
sel.expandUsingGranularity(d->m_selectionGranularity);
}