Commit 2da8a2a4 authored by darin's avatar darin
Browse files

WebCore:

        Reviewed by Maciej.

	- fixed 3125504 -- REGRESSION: Selection not working correctly for text area on http://glish.com/css/7.asp

        * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::khtmlMousePressEvent): Call makeFirstResponder here explicitly,
	since we are disabling the makeFirstResponder that normally happens during window event dispatching
	in WebKit.

        * kwq/KWQScrollView.h: Define getDocumentView().
        * kwq/KWQScrollView.mm: Use getDocumentView() everywhere.
        (QScrollView::getDocumentView): Define it here.

WebKit:

        Reviewed by Maciej.

	- fixed 3125504 -- REGRESSION: Selection not working correctly for text area on http://glish.com/css/7.asp

	The problem is that the text area lost its first responder status because WebHTMLView took the click,
	and NSWindow wanted WebHTMLView to become first responder too.

        * WebView.subproj/WebHTMLView.m: (-[WebHTMLView acceptsFirstResponder]):
	Don't allow the NSWindow to make this the first responder during the early part of mouseDown event
	handling. But do allow anyone else to make this the first responder, for example from keyboard events,
	or from calls back from WebCore once we begin mouse-down event handling.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3017 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c9a8d22b
2002-12-12 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fixed 3125504 -- REGRESSION: Selection not working correctly for text area on http://glish.com/css/7.asp
* kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::khtmlMousePressEvent): Call makeFirstResponder here explicitly,
since we are disabling the makeFirstResponder that normally happens during window event dispatching
in WebKit.
* kwq/KWQScrollView.h: Define getDocumentView().
* kwq/KWQScrollView.mm: Use getDocumentView() everywhere.
(QScrollView::getDocumentView): Define it here.
2002-12-12 Darin Adler <darin@apple.com>
Reviewed by Maciej and Richard.
......
2002-12-12 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fixed 3125504 -- REGRESSION: Selection not working correctly for text area on http://glish.com/css/7.asp
* kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::khtmlMousePressEvent): Call makeFirstResponder here explicitly,
since we are disabling the makeFirstResponder that normally happens during window event dispatching
in WebKit.
* kwq/KWQScrollView.h: Define getDocumentView().
* kwq/KWQScrollView.mm: Use getDocumentView() everywhere.
(QScrollView::getDocumentView): Define it here.
2002-12-12 Darin Adler <darin@apple.com>
Reviewed by Maciej and Richard.
......
......@@ -722,6 +722,11 @@ bool KWQKHTMLPart::closeURL()
void KWQKHTMLPart::khtmlMousePressEvent(MousePressEvent *event)
{
if (!passWidgetMouseDownEventToWidget(event)) {
// We don't do this at the start of mouse down handling, because we don't want to do it until
// we know we didn't hit a widget.
NSView *documentView = view()->getDocumentView();
[[documentView window] makeFirstResponder:documentView];
KHTMLPart::khtmlMousePressEvent(event);
}
}
......
......@@ -77,7 +77,7 @@ public:
void ensureVisible(int,int);
void ensureVisible(int,int,int,int);
NSView *getDocumentView();
NSView *getDocumentView() const;
};
#endif
......@@ -44,7 +44,6 @@
@interface NSView (KWQExtensions)
- (BOOL)_KWQ_isScrollView;
- (NSView *)_KWQ_getDocumentView;
@end
@implementation NSView (KWQExtensions)
......@@ -54,15 +53,6 @@
return [self isKindOfClass:[NSScrollView class]];
}
- (NSView *)_KWQ_getDocumentView
{
if ([self respondsToSelector: @selector(documentView)]) {
NSScrollView *sv = (NSScrollView *)self; // Compiler complains about in-line cast.
return [sv documentView];
}
return nil;
}
@end
QWidget* QScrollView::viewport() const
......@@ -100,7 +90,7 @@ int QScrollView::visibleHeight() const
int QScrollView::contentsWidth() const
{
NSView *docView, *view = getView();
docView = [view _KWQ_getDocumentView];
docView = getDocumentView();
if (docView)
return (int)[docView bounds].size.width;
return (int)[view bounds].size.width;
......@@ -109,7 +99,7 @@ int QScrollView::contentsWidth() const
int QScrollView::contentsHeight() const
{
NSView *docView, *view = getView();
docView = [view _KWQ_getDocumentView];
docView = getDocumentView();
if (docView)
return (int)[docView bounds].size.height;
return (int)[view bounds].size.height;
......@@ -159,7 +149,7 @@ void QScrollView::scrollBy(int dx, int dy)
void QScrollView::setContentsPos(int x, int y)
{
NSView *docView, *view = getView();
docView = [view _KWQ_getDocumentView];
docView = getDocumentView();
if (docView)
view = docView;
......@@ -189,7 +179,7 @@ void QScrollView::addChild(QWidget* child, int x, int y)
child->move(x, y);
thisView = getView();
thisDocView = [thisView _KWQ_getDocumentView];
thisDocView = getDocumentView();
if (thisDocView)
thisView = thisDocView;
......@@ -217,7 +207,7 @@ void QScrollView::resizeContents(int w, int h)
LOG(Frames, "%p %@ at w %d h %d\n", getView(), [[getView() class] className], w, h);
NSView *view = getView();
if ([view _KWQ_isScrollView]){
view = [view _KWQ_getDocumentView];
view = getDocumentView();
LOG(Frames, "%p %@ at w %d h %d\n", view, [[view class] className], w, h);
if (w < 0)
......@@ -240,7 +230,7 @@ void QScrollView::updateContents(const QRect &rect, bool now)
NSView *view = getView();
if ([view _KWQ_isScrollView])
view = [view _KWQ_getDocumentView];
view = getDocumentView();
if (now)
[view displayRect: rect];
......@@ -264,7 +254,7 @@ void QScrollView::contentsToViewport(int x, int y, int& vx, int& vy)
{
NSView *docView, *view = getView();
docView = [view _KWQ_getDocumentView];
docView = getDocumentView();
if (docView)
view = docView;
......@@ -278,7 +268,7 @@ void QScrollView::viewportToContents(int vx, int vy, int& x, int& y)
{
NSView *docView, *view = getView();
docView = [view _KWQ_getDocumentView];
docView = getDocumentView();
if (docView)
view = docView;
......@@ -308,3 +298,9 @@ void QScrollView::ensureVisible(int,int,int,int)
{
LOG(NotYetImplemented, "not yet implemented");
}
NSView *QScrollView::getDocumentView() const
{
id view = getView();
return [view respondsToSelector:@selector(documentView)] ? [view documentView] : nil;
}
2002-12-12 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fixed 3125504 -- REGRESSION: Selection not working correctly for text area on http://glish.com/css/7.asp
The problem is that the text area lost its first responder status because WebHTMLView took the click,
and NSWindow wanted WebHTMLView to become first responder too.
* WebView.subproj/WebHTMLView.m: (-[WebHTMLView acceptsFirstResponder]):
Don't allow the NSWindow to make this the first responder during the early part of mouseDown event
handling. But do allow anyone else to make this the first responder, for example from keyboard events,
or from calls back from WebCore once we begin mouse-down event handling.
2002-12-12 Darin Adler <darin@apple.com>
Reviewed by Maciej and Richard.
......
......@@ -146,6 +146,14 @@ - (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString *)retu
- (BOOL)acceptsFirstResponder
{
// Don't accept first responder when we first click on this view.
// We have to pass the event down through WebCore first to be sure we don't hit a subview.
// Do accept first responder at any other time, for example from keyboard events,
// or from calls back from WebCore once we begin mouse-down event handling.
NSEvent *event = [NSApp currentEvent];
if ([event type] == NSLeftMouseDown && event != _private->mouseDownEvent) {
return NO;
}
return YES;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment