Commit a091dd9f authored by rjw's avatar rjw

Lots of changes for DHTML.

    Bugs fixes, and fixes to regressions.

    Changes to support additional DHTML events.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1190 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4db3738c
2002-05-21 Richard J. Williamson <rjw@apple.com>
Lots of changes for DHTML.
Bugs fixes, and fixes to regressions.
* khtml/misc/decoder.cpp:
(Decoder::decode):
* khtml/rendering/render_flow.cpp:
(RenderFlow::print):
(RenderFlow::layout):
* khtml/rendering/render_text.cpp:
(RenderText::print):
* kwq/KWQKHTMLPart.mm:
(KHTMLPart::urlSelected):
* kwq/qt/qevent.h:
* kwq/qt/qstring.h:
* libwebcore.exp:
2002-05-21 Kenneth Kocienda <kocienda@apple.com>
Fix for this bug:
......
2002-05-21 Richard J. Williamson <rjw@apple.com>
Lots of changes for DHTML.
Bugs fixes, and fixes to regressions.
* khtml/misc/decoder.cpp:
(Decoder::decode):
* khtml/rendering/render_flow.cpp:
(RenderFlow::print):
(RenderFlow::layout):
* khtml/rendering/render_text.cpp:
(RenderText::print):
* kwq/KWQKHTMLPart.mm:
(KHTMLPart::urlSelected):
* kwq/qt/qevent.h:
* kwq/qt/qstring.h:
* libwebcore.exp:
2002-05-21 Kenneth Kocienda <kocienda@apple.com>
Fix for this bug:
......
2002-05-21 Richard J. Williamson <rjw@apple.com>
Lots of changes for DHTML.
Bugs fixes, and fixes to regressions.
* khtml/misc/decoder.cpp:
(Decoder::decode):
* khtml/rendering/render_flow.cpp:
(RenderFlow::print):
(RenderFlow::layout):
* khtml/rendering/render_text.cpp:
(RenderText::print):
* kwq/KWQKHTMLPart.mm:
(KHTMLPart::urlSelected):
* kwq/qt/qevent.h:
* kwq/qt/qstring.h:
* libwebcore.exp:
2002-05-21 Kenneth Kocienda <kocienda@apple.com>
Fix for this bug:
......
......@@ -522,9 +522,15 @@ QString Decoder::decode(const char *data, int len)
out = m_decoder->toUnicode(data, len);
}
if (out.isNull()){
fprintf (stderr, "ERROR: decoded string is null\n");
}
else if (out.length() == 0){
fprintf (stderr, "ERROR: decoded string length == 0\n");
}
// the hell knows, why the output does sometimes have a QChar::null at
// the end...
if(out[out.length()-1] == QChar::null)
else if(out[out.length()-1] == QChar::null)
out.truncate(out.length() - 1);
return out;
}
......
......@@ -127,9 +127,9 @@ void RenderFlow::print(QPainter *p, int _x, int _y, int _w, int _h,
if((_ty > _y + _h) || (_ty + h < _y))
{
//kdDebug( 6040 ) << "cut!" << endl;
#ifndef APPLE_CHANGES
//#ifndef APPLE_CHANGES
return;
#endif /* APPLE_CHANGES not defined */
//#endif /* APPLE_CHANGES not defined */
}
}
......@@ -268,9 +268,9 @@ void RenderFlow::layout()
// kdDebug( 6040 ) << "childrenInline()=" << childrenInline() << endl;
if(childrenInline()) {
// ### make bidi resumeable so that we can get rid of this ugly hack
#ifndef APPLE_CHANGES
//#ifndef APPLE_CHANGES
if (!m_blockBidi)
#endif
//#endif
layoutInlineChildren();
}
else
......
......@@ -610,9 +610,9 @@ void RenderText::printObject( QPainter *p, int /*x*/, int y, int /*w*/, int h,
void RenderText::print( QPainter *p, int x, int y, int w, int h,
int tx, int ty)
{
#ifndef APPLE_CHANGES
//#ifndef APPLE_CHANGES
if (style()->visibility() != VISIBLE) return;
#endif /* APPLE_CHANGES not defined */
//#endif /* APPLE_CHANGES not defined */
int s = m_lines.count() - 1;
if ( s < 0 ) return;
......
......@@ -207,7 +207,7 @@ public:
QKeyEvent() {}
#endif
QKeyEvent(Type, int, int, int, const QString &textVal = QString::null, bool autoRepeat = FALSE, ushort countVal = 1);
QKeyEvent(Type type, int key, int ascii, int buttonState, const QString &textVal = QString::null, bool autoRepeat = FALSE, ushort countVal = 1);
// add no-op destructor
#ifdef _KWQ_PEDANTIC_
......
......@@ -411,6 +411,12 @@ void KHTMLPart::urlSelected( const QString &url, int button, int state, const QS
IFWebFrame *frame;
KURL refLess(clickedURL);
if ( url.find( QString::fromLatin1( "javascript:" ), 0, false ) == 0 )
{
executeScript( url.right( url.length() - 11) );
return;
}
m_url.setRef ("");
refLess.setRef ("");
if (refLess.url() == m_url.url()){
......@@ -919,28 +925,28 @@ void KHTMLPart::khtmlMouseMoveEvent( khtml::MouseMoveEvent *event )
}
void KHTMLPart::khtmlMouseReleaseEvent( khtml::MouseReleaseEvent *event )
{
DOM::Node innerNode = event->innerNode();
d->m_mousePressNode = DOM::Node();
if ( d->m_bMousePressed )
{
DOM::Node innerNode = event->innerNode();
d->m_mousePressNode = DOM::Node();
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;
// HACK! FIXME!
if (d->m_strSelectedURL != QString::null) {
urlSelected(d->m_strSelectedURL, 0,0, event->target().string());
urlSelected(d->m_strSelectedURL, 0,0, event->target().string());
}
#ifndef _KWQ_
#define QT_NO_CLIPBOARD 1
#ifndef QT_NO_CLIPBOARD
QMouseEvent *_mouse = event->qmouseEvent();
if ((_mouse->button() == MidButton) && (event->url().isNull()))
{
#ifndef _KWQ_
#define QT_NO_CLIPBOARD 1
#ifndef QT_NO_CLIPBOARD
QMouseEvent *_mouse = event->qmouseEvent();
if ((_mouse->button() == MidButton) && (event->url().isNull()))
{
QClipboard *cb = QApplication::clipboard();
cb->setSelectionMode( true );
QCString plain("plain");
......@@ -967,18 +973,18 @@ void KHTMLPart::khtmlMouseReleaseEvent( khtml::MouseReleaseEvent *event )
urlSelected(url, 0,0, "_top");
d->m_referrer = savedReferrer; // Restore original referrer.
}
}
#endif
#ifndef KHTML_NO_SELECTION
// delete selection in case start and end position are at the same point
if(d->m_selectionStart == d->m_selectionEnd && d->m_startOffset == d->m_endOffset) {
}
#endif
#ifndef KHTML_NO_SELECTION
// delete selection in case start and end position are at the same point
if(d->m_selectionStart == d->m_selectionEnd && d->m_startOffset == d->m_endOffset) {
d->m_selectionStart = 0;
d->m_selectionEnd = 0;
d->m_startOffset = 0;
d->m_endOffset = 0;
//emitSelectionChanged();
} else {
} else {
// we have to get to know if end is before start or not...
DOM::Node n = d->m_selectionStart;
d->m_startBeforeEnd = false;
......@@ -1011,21 +1017,21 @@ void KHTMLPart::khtmlMouseReleaseEvent( khtml::MouseReleaseEvent *event )
d->m_startBeforeEnd = true;
}
// get selected text and paste to the clipboard
#ifndef QT_NO_CLIPBOARD
#ifndef QT_NO_CLIPBOARD
QString text = selectedText();
text.replace(QRegExp(QChar(0xa0)), " ");
QClipboard *cb = QApplication::clipboard();
cb->setSelectionMode( true );
cb->setText(text);
cb->setSelectionMode( false );
#endif
#endif
//kdDebug( 6000 ) << "selectedText = " << text << endl;
//emitSelectionChanged();
}
#endif
#endif
}
}
#endif
#endif
}
void KHTMLPart::khtmlDrawContentsEvent( khtml::DrawContentsEvent * )
{
......
......@@ -411,6 +411,12 @@ void KHTMLPart::urlSelected( const QString &url, int button, int state, const QS
IFWebFrame *frame;
KURL refLess(clickedURL);
if ( url.find( QString::fromLatin1( "javascript:" ), 0, false ) == 0 )
{
executeScript( url.right( url.length() - 11) );
return;
}
m_url.setRef ("");
refLess.setRef ("");
if (refLess.url() == m_url.url()){
......@@ -919,28 +925,28 @@ void KHTMLPart::khtmlMouseMoveEvent( khtml::MouseMoveEvent *event )
}
void KHTMLPart::khtmlMouseReleaseEvent( khtml::MouseReleaseEvent *event )
{
DOM::Node innerNode = event->innerNode();
d->m_mousePressNode = DOM::Node();
if ( d->m_bMousePressed )
{
DOM::Node innerNode = event->innerNode();
d->m_mousePressNode = DOM::Node();
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;
// HACK! FIXME!
if (d->m_strSelectedURL != QString::null) {
urlSelected(d->m_strSelectedURL, 0,0, event->target().string());
urlSelected(d->m_strSelectedURL, 0,0, event->target().string());
}
#ifndef _KWQ_
#define QT_NO_CLIPBOARD 1
#ifndef QT_NO_CLIPBOARD
QMouseEvent *_mouse = event->qmouseEvent();
if ((_mouse->button() == MidButton) && (event->url().isNull()))
{
#ifndef _KWQ_
#define QT_NO_CLIPBOARD 1
#ifndef QT_NO_CLIPBOARD
QMouseEvent *_mouse = event->qmouseEvent();
if ((_mouse->button() == MidButton) && (event->url().isNull()))
{
QClipboard *cb = QApplication::clipboard();
cb->setSelectionMode( true );
QCString plain("plain");
......@@ -967,18 +973,18 @@ void KHTMLPart::khtmlMouseReleaseEvent( khtml::MouseReleaseEvent *event )
urlSelected(url, 0,0, "_top");
d->m_referrer = savedReferrer; // Restore original referrer.
}
}
#endif
#ifndef KHTML_NO_SELECTION
// delete selection in case start and end position are at the same point
if(d->m_selectionStart == d->m_selectionEnd && d->m_startOffset == d->m_endOffset) {
}
#endif
#ifndef KHTML_NO_SELECTION
// delete selection in case start and end position are at the same point
if(d->m_selectionStart == d->m_selectionEnd && d->m_startOffset == d->m_endOffset) {
d->m_selectionStart = 0;
d->m_selectionEnd = 0;
d->m_startOffset = 0;
d->m_endOffset = 0;
//emitSelectionChanged();
} else {
} else {
// we have to get to know if end is before start or not...
DOM::Node n = d->m_selectionStart;
d->m_startBeforeEnd = false;
......@@ -1011,21 +1017,21 @@ void KHTMLPart::khtmlMouseReleaseEvent( khtml::MouseReleaseEvent *event )
d->m_startBeforeEnd = true;
}
// get selected text and paste to the clipboard
#ifndef QT_NO_CLIPBOARD
#ifndef QT_NO_CLIPBOARD
QString text = selectedText();
text.replace(QRegExp(QChar(0xa0)), " ");
QClipboard *cb = QApplication::clipboard();
cb->setSelectionMode( true );
cb->setText(text);
cb->setSelectionMode( false );
#endif
#endif
//kdDebug( 6000 ) << "selectedText = " << text << endl;
//emitSelectionChanged();
}
#endif
#endif
}
}
#endif
#endif
}
void KHTMLPart::khtmlDrawContentsEvent( khtml::DrawContentsEvent * )
{
......
......@@ -34,7 +34,7 @@
#define QT_VERSION 300
#define _FAST_QSTRING_TO_NSSTRING(aString) (aString).getNSString()
#define QSTRING_TO_NSSTRING(aString) (aString).getNSString()
#define QSTRING_TO_NSSTRING(aString) [[(aString).getNSString() retain] autorelease]
#define QSTRING_TO_NSSTRING_LENGTH(aString,l) \
[[[(aString).getNSString() substringToIndex: l] retain] autorelease]
#define NSSTRING_TO_QSTRING(aString) QString::fromNSString(aString)
......
......@@ -207,7 +207,7 @@ public:
QKeyEvent() {}
#endif
QKeyEvent(Type, int, int, int, const QString &textVal = QString::null, bool autoRepeat = FALSE, ushort countVal = 1);
QKeyEvent(Type type, int key, int ascii, int buttonState, const QString &textVal = QString::null, bool autoRepeat = FALSE, ushort countVal = 1);
// add no-op destructor
#ifdef _KWQ_PEDANTIC_
......
......@@ -34,7 +34,7 @@
#define QT_VERSION 300
#define _FAST_QSTRING_TO_NSSTRING(aString) (aString).getNSString()
#define QSTRING_TO_NSSTRING(aString) (aString).getNSString()
#define QSTRING_TO_NSSTRING(aString) [[(aString).getNSString() retain] autorelease]
#define QSTRING_TO_NSSTRING_LENGTH(aString,l) \
[[[(aString).getNSString() substringToIndex: l] retain] autorelease]
#define NSSTRING_TO_QSTRING(aString) QString::fromNSString(aString)
......
......@@ -33,4 +33,5 @@ __ZNK7QWidget7getViewEv
__ZNK9KHTMLPart10xmlDocImplEv
__ZNK9KHTMLPart14documentSourceEv
__Z28WCSetIFWebDataSourceMakeFuncPFP11objc_objectPvS1_jE
__ZN7QString12fromNSStringEP8NSString
__ZN9QKeyEventC1EN6QEvent4TypeEiiiRK7QStringbt
2002-05-21 Richard J. Williamson <rjw@apple.com>
Changes to support additional DHTML events.
* WebView.subproj/IFWebView.mm:
(-[IFWebView keyDown:]):
(-[IFWebView keyUp:]):
* WebView.subproj/IFWebViewPrivate.mm:
(+[IFWebView _nodeHTML:DOM::]):
2002-05-21 Chris Blumenberg <cblu@apple.com>
Content policy can now be sent at a later time to avoid blocking.
......
2002-05-21 Richard J. Williamson <rjw@apple.com>
Changes to support additional DHTML events.
* WebView.subproj/IFWebView.mm:
(-[IFWebView keyDown:]):
(-[IFWebView keyUp:]):
* WebView.subproj/IFWebViewPrivate.mm:
(+[IFWebView _nodeHTML:DOM::]):
2002-05-21 Chris Blumenberg <cblu@apple.com>
Content policy can now be sent at a later time to avoid blocking.
......
......@@ -545,4 +545,44 @@
//WebKitDebugAtLevel (WEBKIT_LOG_EVENTS, "mouseDragged %f, %f\n", p.x, p.y);
}
- (void)keyDown: (NSEvent *)event
{
NSLog (@"keyDown: %@\n", event);
int state = 0;
if ([event modifierFlags] & NSControlKeyMask)
state |= Qt::ControlButton;
if ([event modifierFlags] & NSShiftKeyMask)
state |= Qt::ShiftButton;
if ([event modifierFlags] & NSAlternateKeyMask)
state |= Qt::AltButton;
QKeyEvent kEvent(QEvent::KeyPress, 0, 0, state, NSSTRING_TO_QSTRING([event characters]), [event isARepeat], 1);
KHTMLView *widget = _private->widget;
if (widget != 0l)
widget->keyPressEvent(&kEvent);
}
- (void)keyUp: (NSEvent *)event
{
NSLog (@"keyUp: %@\n", event);
int state = 0;
if ([event modifierFlags] & NSControlKeyMask)
state |= Qt::ControlButton;
if ([event modifierFlags] & NSShiftKeyMask)
state |= Qt::ShiftButton;
if ([event modifierFlags] & NSAlternateKeyMask)
state |= Qt::AltButton;
QKeyEvent kEvent(QEvent::KeyPress, 0, 0, state, NSSTRING_TO_QSTRING([event characters]), [event isARepeat], 1);
KHTMLView *widget = _private->widget;
if (widget != 0l)
widget->keyReleaseEvent(&kEvent);
}
@end
......@@ -92,7 +92,8 @@
+ (NSString *)_nodeHTML: (DOM::NodeImpl *)node
{
return QSTRING_TO_NSSTRING(node->recursive_toHTML(1));
NSString *string = QSTRING_TO_NSSTRING(node->recursive_toHTML(1));
return string;
}
- (khtml::RenderObject *)_renderRoot
......
......@@ -545,4 +545,44 @@ - (void)mouseDragged: (NSEvent *)event
//WebKitDebugAtLevel (WEBKIT_LOG_EVENTS, "mouseDragged %f, %f\n", p.x, p.y);
}
- (void)keyDown: (NSEvent *)event
{
NSLog (@"keyDown: %@\n", event);
int state = 0;
if ([event modifierFlags] & NSControlKeyMask)
state |= Qt::ControlButton;
if ([event modifierFlags] & NSShiftKeyMask)
state |= Qt::ShiftButton;
if ([event modifierFlags] & NSAlternateKeyMask)
state |= Qt::AltButton;
QKeyEvent kEvent(QEvent::KeyPress, 0, 0, state, NSSTRING_TO_QSTRING([event characters]), [event isARepeat], 1);
KHTMLView *widget = _private->widget;
if (widget != 0l)
widget->keyPressEvent(&kEvent);
}
- (void)keyUp: (NSEvent *)event
{
NSLog (@"keyUp: %@\n", event);
int state = 0;
if ([event modifierFlags] & NSControlKeyMask)
state |= Qt::ControlButton;
if ([event modifierFlags] & NSShiftKeyMask)
state |= Qt::ShiftButton;
if ([event modifierFlags] & NSAlternateKeyMask)
state |= Qt::AltButton;
QKeyEvent kEvent(QEvent::KeyPress, 0, 0, state, NSSTRING_TO_QSTRING([event characters]), [event isARepeat], 1);
KHTMLView *widget = _private->widget;
if (widget != 0l)
widget->keyReleaseEvent(&kEvent);
}
@end
......@@ -92,7 +92,8 @@ + (NSString *)_nodeValue: (DOM::NodeImpl *)node
+ (NSString *)_nodeHTML: (DOM::NodeImpl *)node
{
return QSTRING_TO_NSSTRING(node->recursive_toHTML(1));
NSString *string = QSTRING_TO_NSSTRING(node->recursive_toHTML(1));
return string;
}
- (khtml::RenderObject *)_renderRoot
......
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