[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
darin
darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:41:24 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 3c95357ba9a1ca7d40b42ce0580249f0cdfdd00d
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon May 24 04:45:26 2004 +0000
Reviewed by Ken.
- fixed <rdar://problem/3259919>: (Shift click should extend selection)
* khtml/khtmlpart_p.h: Renamed m_textElement to m_selectionGranularity and
m_mouseMovedSinceLastMousePress to m_beganSelectingText.
* khtml/khtml_part.cpp:
(KHTMLPart::handleMousePressEventDoubleClick): Set m_beganSelectingText if the double-click
began selecting text.
(KHTMLPart::handleMousePressEventTripleClick): Ditto.
(KHTMLPart::handleMousePressEventSingleClick): Added code to extend selection if shift is down.
(KHTMLPart::khtmlMousePressEvent): Remove code that sets the selection granularity to
"by character". We only want to do that if we start selecting with a single click.
Otherwise we want to leave the selection granularity alone.
(KHTMLPart::khtmlMouseReleaseEvent): Change the code that clears the selection on a plain old
click to check the m_beganSelectingText boolean so it won't run when you shift-click, for example.
* kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::khtmlMouseMoveEvent): Updated for m_textElement
name change.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6671 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 0f74ae5..faed693 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,24 @@
+2004-05-23 Darin Adler <darin at apple.com>
+
+ Reviewed by Ken.
+
+ - fixed <rdar://problem/3259919>: (Shift click should extend selection)
+
+ * khtml/khtmlpart_p.h: Renamed m_textElement to m_selectionGranularity and
+ m_mouseMovedSinceLastMousePress to m_beganSelectingText.
+ * khtml/khtml_part.cpp:
+ (KHTMLPart::handleMousePressEventDoubleClick): Set m_beganSelectingText if the double-click
+ began selecting text.
+ (KHTMLPart::handleMousePressEventTripleClick): Ditto.
+ (KHTMLPart::handleMousePressEventSingleClick): Added code to extend selection if shift is down.
+ (KHTMLPart::khtmlMousePressEvent): Remove code that sets the selection granularity to
+ "by character". We only want to do that if we start selecting with a single click.
+ Otherwise we want to leave the selection granularity alone.
+ (KHTMLPart::khtmlMouseReleaseEvent): Change the code that clears the selection on a plain old
+ click to check the m_beganSelectingText boolean so it won't run when you shift-click, for example.
+ * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::khtmlMouseMoveEvent): Updated for m_textElement
+ name change.
+
2004-05-22 Darin Adler <darin at apple.com>
Reviewed by Ken.
diff --git a/WebCore/khtml/khtml_part.cpp b/WebCore/khtml/khtml_part.cpp
index cbb7a60..0dfeec8 100644
--- a/WebCore/khtml/khtml_part.cpp
+++ b/WebCore/khtml/khtml_part.cpp
@@ -4314,8 +4314,6 @@ bool KHTMLPart::isPointInsideSelection(int x, int y)
return false;
}
-#if APPLE_CHANGES
-
void KHTMLPart::handleMousePressEventDoubleClick(khtml::MousePressEvent *event)
{
QMouseEvent *mouse = event->qmouseEvent();
@@ -4332,7 +4330,8 @@ void KHTMLPart::handleMousePressEventDoubleClick(khtml::MousePressEvent *event)
}
if (selection.state() != Selection::CARET) {
- d->m_textElement = Selection::WORD;
+ d->m_selectionGranularity = Selection::WORD;
+ d->m_beganSelectingText = true;
}
setSelection(selection);
@@ -4355,37 +4354,49 @@ void KHTMLPart::handleMousePressEventTripleClick(khtml::MousePressEvent *event)
}
if (selection.state() != Selection::CARET) {
- d->m_textElement = Selection::LINE;
+ d->m_selectionGranularity = Selection::LINE;
+ d->m_beganSelectingText = true;
}
setSelection(selection);
startAutoScroll();
}
-#endif // APPLE_CHANGES
-
void KHTMLPart::handleMousePressEventSingleClick(khtml::MousePressEvent *event)
{
QMouseEvent *mouse = event->qmouseEvent();
DOM::Node innerNode = event->innerNode();
if (mouse->button() == LeftButton) {
- Selection selection;
+ Selection sel;
+
if (!innerNode.isNull() && innerNode.handle()->renderer()) {
-#if APPLE_CHANGES
+ bool extendSelection = mouse->state() & ShiftButton;
+
// Don't restart the selection when the mouse is pressed on an
// existing selection so we can allow for text dragging.
- if (isPointInsideSelection(event->x(), event->y())) {
+ if (!extendSelection && isPointInsideSelection(event->x(), event->y())) {
return;
}
-#endif
Position pos(innerNode.handle()->positionForCoordinates(event->x(), event->y()));
if (pos.isEmpty())
pos = Position(innerNode.handle(), innerNode.handle()->caretMinOffset());
- selection = pos;
+
+ sel = selection();
+ if (extendSelection && sel.notEmpty()) {
+ sel.clearModifyBias();
+ sel.setExtent(pos);
+ if (d->m_selectionGranularity != Selection::CHARACTER) {
+ sel.expandUsingGranularity(d->m_selectionGranularity);
+ }
+ d->m_beganSelectingText = true;
+ } else {
+ sel = pos;
+ d->m_selectionGranularity = Selection::CHARACTER;
+ }
}
- setSelection(selection);
+ setSelection(sel);
startAutoScroll();
}
}
@@ -4420,23 +4431,19 @@ void KHTMLPart::khtmlMousePressEvent(khtml::MousePressEvent *event)
#ifdef KHTML_NO_SELECTION
d->m_dragLastPos = mouse->globalPos();
#else
-#if APPLE_CHANGES
- d->m_textElement = Selection::CHARACTER;
- d->m_mouseMovedSinceLastMousePress = false;
+ d->m_beganSelectingText = false;
- if (mouse->clickCount() == 2) {
- handleMousePressEventDoubleClick(event);
+ if (mouse->clickCount() == 2) {
+ handleMousePressEventDoubleClick(event);
return;
- }
+ }
if (mouse->clickCount() >= 3) {
- handleMousePressEventTripleClick(event);
+ handleMousePressEventTripleClick(event);
return;
}
-#endif // APPLE_CHANGES
handleMousePressEventSingleClick(event);
-
#endif // KHTML_NO_SELECTION
}
}
@@ -4445,6 +4452,8 @@ void KHTMLPart::khtmlMouseDoubleClickEvent( khtml::MouseDoubleClickEvent *event)
{
}
+#if !APPLE_CHANGES
+
bool KHTMLPart::handleMouseMoveEventDrag(khtml::MouseMoveEvent *event)
{
#ifdef QT_NO_DRAGANDDROP
@@ -4502,10 +4511,6 @@ bool KHTMLPart::handleMouseMoveEventDrag(khtml::MouseMoveEvent *event)
bool KHTMLPart::handleMouseMoveEventOver(khtml::MouseMoveEvent *event)
{
-#if APPLE_CHANGES
- return false;
-#else
-
// Mouse clicked. Do nothing.
if (d->m_bMousePressed) {
return false;
@@ -4552,130 +4557,125 @@ bool KHTMLPart::handleMouseMoveEventOver(khtml::MouseMoveEvent *event)
}
return true;
-#endif // APPLE_CHANGES
}
+#endif // APPLE_CHANGES
+
void KHTMLPart::handleMouseMoveEventSelection(khtml::MouseMoveEvent *event)
{
- // Mouse not pressed. Do nothing.
- if (!d->m_bMousePressed)
- return;
+ // Mouse not pressed. Do nothing.
+ if (!d->m_bMousePressed)
+ return;
#ifdef KHTML_NO_SELECTION
- if (d->m_doc && d->m_view) {
- QPoint diff( mouse->globalPos() - d->m_dragLastPos );
+ if (d->m_doc && d->m_view) {
+ QPoint diff( mouse->globalPos() - d->m_dragLastPos );
- if (abs(diff.x()) > 64 || abs(diff.y()) > 64) {
- d->m_view->scrollBy(-diff.x(), -diff.y());
- d->m_dragLastPos = mouse->globalPos();
- }
- }
- return;
+ if (abs(diff.x()) > 64 || abs(diff.y()) > 64) {
+ d->m_view->scrollBy(-diff.x(), -diff.y());
+ d->m_dragLastPos = mouse->globalPos();
+ }
+ }
+ return;
#else
- QMouseEvent *mouse = event->qmouseEvent();
- DOM::Node innerNode = event->innerNode();
+ QMouseEvent *mouse = event->qmouseEvent();
+ DOM::Node innerNode = event->innerNode();
if (mouse->state() != LeftButton || !innerNode.handle() || !innerNode.handle()->renderer())
return;
- // handle making selection
- Position pos(innerNode.handle()->positionForCoordinates(event->x(), event->y()));
+ // handle making selection
+ Position pos(innerNode.handle()->positionForCoordinates(event->x(), event->y()));
-#if APPLE_CHANGES
- // Don't modify the selection if we're not on a node.
- if (pos.isEmpty())
- return;
+ // Don't modify the selection if we're not on a node.
+ if (pos.isEmpty())
+ return;
- // Restart the selection if this is the first mouse move. This work is usually
- // done in khtmlMousePressEvent, but not if the mouse press was on an existing selection.
- Selection sel = selection();
+ // Restart the selection if this is the first mouse move. This work is usually
+ // done in khtmlMousePressEvent, but not if the mouse press was on an existing selection.
+ Selection sel = selection();
sel.clearModifyBias();
- if (!d->m_mouseMovedSinceLastMousePress) {
- d->m_mouseMovedSinceLastMousePress = true;
+ if (!d->m_beganSelectingText) {
+ d->m_beganSelectingText = true;
sel.moveTo(pos);
- }
-#endif
+ }
sel.setExtent(pos);
-
-#if APPLE_CHANGES
- if (d->m_textElement != Selection::CHARACTER) {
- sel.expandUsingGranularity(d->m_textElement);
+ if (d->m_selectionGranularity != Selection::CHARACTER) {
+ sel.expandUsingGranularity(d->m_selectionGranularity);
}
-#endif
-
setSelection(sel);
-
+
#endif // KHTML_NO_SELECTION
}
void KHTMLPart::khtmlMouseMoveEvent(khtml::MouseMoveEvent *event)
{
- if (handleMouseMoveEventDrag(event))
- return;
+#if !APPLE_CHANGES
+ if (handleMouseMoveEventDrag(event))
+ return;
- if (handleMouseMoveEventOver(event))
- return;
+ if (handleMouseMoveEventOver(event))
+ return;
+#endif
- handleMouseMoveEventSelection(event);
+ handleMouseMoveEventSelection(event);
}
void KHTMLPart::khtmlMouseReleaseEvent( khtml::MouseReleaseEvent *event )
{
- if (d->m_bMousePressed)
- stopAutoScroll();
+ if (d->m_bMousePressed)
+ stopAutoScroll();
- // Used to prevent mouseMoveEvent from initiating a drag before
- // the mouse is pressed again.
- d->m_bMousePressed = false;
+ // Used to prevent mouseMoveEvent from initiating a drag before
+ // the mouse is pressed again.
+ d->m_bMousePressed = false;
#ifndef QT_NO_CLIPBOARD
- QMouseEvent *_mouse = event->qmouseEvent();
- if ((d->m_guiProfile == BrowserViewGUI) && (_mouse->button() == MidButton) && (event->url().isNull())) {
- QClipboard *cb = QApplication::clipboard();
- cb->setSelectionMode(true);
- QCString plain("plain");
- QString url = cb->text(plain).stripWhiteSpace();
- KURL u(url);
- if (u.isMalformed()) {
- // some half-baked guesses for incomplete urls
- // (the same code is in libkonq/konq_dirpart.cc)
- if (url.startsWith("ftp.")) {
- url.prepend("ftp://");
- u = url;
- }
- else {
- url.prepend("http://");
- u = url;
- }
- }
- if (u.isValid()) {
- QString savedReferrer = d->m_referrer;
- d->m_referrer = QString::null; // Disable referrer.
- urlSelected(url, 0,0, "_top");
- d->m_referrer = savedReferrer; // Restore original referrer.
- }
- }
+ QMouseEvent *_mouse = event->qmouseEvent();
+ if ((d->m_guiProfile == BrowserViewGUI) && (_mouse->button() == MidButton) && (event->url().isNull())) {
+ QClipboard *cb = QApplication::clipboard();
+ cb->setSelectionMode(true);
+ QCString plain("plain");
+ QString url = cb->text(plain).stripWhiteSpace();
+ KURL u(url);
+ if (u.isMalformed()) {
+ // some half-baked guesses for incomplete urls
+ // (the same code is in libkonq/konq_dirpart.cc)
+ if (url.startsWith("ftp.")) {
+ url.prepend("ftp://");
+ u = url;
+ }
+ else {
+ url.prepend("http://");
+ u = url;
+ }
+ }
+ if (u.isValid()) {
+ QString savedReferrer = d->m_referrer;
+ d->m_referrer = QString::null; // Disable referrer.
+ urlSelected(url, 0,0, "_top");
+ d->m_referrer = savedReferrer; // Restore original referrer.
+ }
+ }
#endif
-#if APPLE_CHANGES
- // Clear the selection if the mouse didn't move after the last mouse press.
- // We do this so when clicking on the selection, the selection goes away.
- // However, if we are editing, place the caret.
- if (d->m_dragStartPos.x() == event->qmouseEvent()->x() &&
- d->m_dragStartPos.y() == event->qmouseEvent()->y() &&
- d->m_selection.state() == Selection::RANGE &&
- d->m_textElement == Selection::CHARACTER) {
- Selection selection;
- if (d->m_selection.base().node()->isContentEditable())
- selection.moveTo(d->m_selection.base().node()->positionForCoordinates(event->x(), event->y()));
- setSelection(selection);
- }
-#endif
-
#ifndef KHTML_NO_SELECTION
+ // Clear the selection if the mouse didn't move after the last mouse press.
+ // We do this so when clicking on the selection, the selection goes away.
+ // However, if we are editing, place the caret.
+ if (!d->m_beganSelectingText
+ && d->m_dragStartPos.x() == event->qmouseEvent()->x()
+ && d->m_dragStartPos.y() == event->qmouseEvent()->y()
+ && d->m_selection.state() == Selection::RANGE) {
+ Selection selection;
+ if (d->m_selection.base().node()->isContentEditable())
+ selection.moveTo(d->m_selection.base().node()->positionForCoordinates(event->x(), event->y()));
+ setSelection(selection);
+ }
+
#ifndef QT_NO_CLIPBOARD
// get selected text and paste to the clipboard
QString text = selectedText();
diff --git a/WebCore/khtml/khtmlpart_p.h b/WebCore/khtml/khtmlpart_p.h
index f07f071..13aacde 100644
--- a/WebCore/khtml/khtmlpart_p.h
+++ b/WebCore/khtml/khtmlpart_p.h
@@ -344,10 +344,8 @@ public:
bool m_bMousePressed;
DOM::Node m_mousePressNode; //node under the mouse when the mouse was pressed (set in the mouse handler)
-#if APPLE_CHANGES
- DOM::Selection::ETextGranularity m_textElement;
- bool m_mouseMovedSinceLastMousePress:1;
-#endif
+ DOM::Selection::ETextGranularity m_selectionGranularity;
+ bool m_beganSelectingText;
#if !APPLE_CHANGES
QString m_overURL;
QString m_overURLTarget;
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 9933a0b..fe4fa5c 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -1875,7 +1875,7 @@ void KWQKHTMLPart::khtmlMouseMoveEvent(MouseMoveEvent *event)
}
if (_mouseDownMayStartDrag
- && d->m_textElement == DOM::Selection::CHARACTER
+ && d->m_selectionGranularity == DOM::Selection::CHARACTER
&& [_bridge mayStartDragWithMouseDragged:_currentEvent]) {
// We are starting a text/image/url drag, so the cursor should be an arrow
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list