Commit c7cde739 authored by darin's avatar darin

top level:

        * Tests/kde/kurl-test.cpp: (main): Add a lot of new tests.
	One of them demonstrates the issue underlying bug 3004818.
	The others are taken straight from the URI RFC (2396).
        * Tests/kde/kurl-test.chk: Expected results for new tests.

        * autogen.sh: Add the new WebCore timestamp file.

WebCore:

	Changes require a make clean because of the Project Builder bug.
	So I added the "make clean timestamp" hackery.

        * .cvsignore: Ignore the new clean timestamp.
        * force-clean-timestamp: Added.
        * Makefile.am: Add rules for making clean happen.

        * khtml/html/html_formimpl.cpp:
        (HTMLGenericFormElementImpl::defaultEventHandler): Fix NULL dereference
	bug in here that I ran into. Code later down in the same function has
	the check for NULL, so clearly this is just a bug.

        * khtml/rendering/font.cpp:
        (Font::drawText): Simplify by using new drawText that takes a QChar array,
	no need to make a QConstString.
        * khtml/rendering/render_text.cpp:
        (TextSlave::printDecoration): Simplify by using new drawUnderlineForText that
	takes a QChar array, no need to make a QConstString.

        * kwq/WebCoreTextRenderer.h: Change underline-drawing to use a UniChar array.

        * kwq/qt/qpainter.h:
        * kwq/KWQPainter.mm:
        (QPainter::drawText): Change to take QChar array instead of a QString, but
	also discovered a bizarre overloading thing that was happening before and
	dealt with that by adding a new drawText that still does take a QString.
        (QPainter::drawUnderlineForText): Change to take QChar array.

        * kwq/qt/qcolor.h: Mark constructor explicit, so we don't get subtle strangess
	like where the string to draw was being converted to a QColor.

        * khtml/css/cssstyleselector.cpp: No need for APPLE_CHANGES for
	this change any more.

        * kwq/kdecore/kcharsets.h:
        * kwq/KWQKCharsets.mm: Remove unused functions.

        * kwq/khtml/khtml_settings.h:
        * kwq/KWQKHTMLSettings.mm: Remove unused functions.

        * kwq/qt/qfont.h:
        * kwq/KWQFont.mm: Simplify.

        * kwq/KWQPaintDeviceMetrics.mm: Simplify.

        * kwq/qt/qtextcodec.h:
        * kwq/KWQtextcodec.mm: (QTextCodec::codecForName): Remove unused parameter.

WebKit:

        * WebCoreSupport.subproj/WebTextRenderer.m:
        (-[WebTextRenderer drawUnderlineForCharacters:stringLength:atPoint:withColor:]):
	Change API to take character array instead of a string.

        * WebKit.pbproj/project.pbxproj: Took "subproj" off the names of some groups.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1638 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 84d4035d
Makefile
Makefile.in
WebCore-combined.exp
previous-clean-timestamp
2002-07-23 Darin Adler <darin@apple.com>
Changes require a make clean because of the Project Builder bug.
So I added the "make clean timestamp" hackery.
* .cvsignore: Ignore the new clean timestamp.
* force-clean-timestamp: Added.
* Makefile.am: Add rules for making clean happen.
* khtml/html/html_formimpl.cpp:
(HTMLGenericFormElementImpl::defaultEventHandler): Fix NULL dereference
bug in here that I ran into. Code later down in the same function has
the check for NULL, so clearly this is just a bug.
* khtml/rendering/font.cpp:
(Font::drawText): Simplify by using new drawText that takes a QChar array,
no need to make a QConstString.
* khtml/rendering/render_text.cpp:
(TextSlave::printDecoration): Simplify by using new drawUnderlineForText that
takes a QChar array, no need to make a QConstString.
* kwq/WebCoreTextRenderer.h: Change underline-drawing to use a UniChar array.
* kwq/qt/qpainter.h:
* kwq/KWQPainter.mm:
(QPainter::drawText): Change to take QChar array instead of a QString, but
also discovered a bizarre overloading thing that was happening before and
dealt with that by adding a new drawText that still does take a QString.
(QPainter::drawUnderlineForText): Change to take QChar array.
* kwq/qt/qcolor.h: Mark constructor explicit, so we don't get subtle strangess
like where the string to draw was being converted to a QColor.
* khtml/css/cssstyleselector.cpp: No need for APPLE_CHANGES for
this change any more.
* kwq/kdecore/kcharsets.h:
* kwq/KWQKCharsets.mm: Remove unused functions.
* kwq/khtml/khtml_settings.h:
* kwq/KWQKHTMLSettings.mm: Remove unused functions.
* kwq/qt/qfont.h:
* kwq/KWQFont.mm: Simplify.
* kwq/KWQPaintDeviceMetrics.mm: Simplify.
* kwq/qt/qtextcodec.h:
* kwq/KWQtextcodec.mm: (QTextCodec::codecForName): Remove unused parameter.
2002-07-23 David Hyatt <hyatt@apple.com>
The STYLE element was ignoring both the media and type
......
2002-07-23 Darin Adler <darin@apple.com>
Changes require a make clean because of the Project Builder bug.
So I added the "make clean timestamp" hackery.
* .cvsignore: Ignore the new clean timestamp.
* force-clean-timestamp: Added.
* Makefile.am: Add rules for making clean happen.
* khtml/html/html_formimpl.cpp:
(HTMLGenericFormElementImpl::defaultEventHandler): Fix NULL dereference
bug in here that I ran into. Code later down in the same function has
the check for NULL, so clearly this is just a bug.
* khtml/rendering/font.cpp:
(Font::drawText): Simplify by using new drawText that takes a QChar array,
no need to make a QConstString.
* khtml/rendering/render_text.cpp:
(TextSlave::printDecoration): Simplify by using new drawUnderlineForText that
takes a QChar array, no need to make a QConstString.
* kwq/WebCoreTextRenderer.h: Change underline-drawing to use a UniChar array.
* kwq/qt/qpainter.h:
* kwq/KWQPainter.mm:
(QPainter::drawText): Change to take QChar array instead of a QString, but
also discovered a bizarre overloading thing that was happening before and
dealt with that by adding a new drawText that still does take a QString.
(QPainter::drawUnderlineForText): Change to take QChar array.
* kwq/qt/qcolor.h: Mark constructor explicit, so we don't get subtle strangess
like where the string to draw was being converted to a QColor.
* khtml/css/cssstyleselector.cpp: No need for APPLE_CHANGES for
this change any more.
* kwq/kdecore/kcharsets.h:
* kwq/KWQKCharsets.mm: Remove unused functions.
* kwq/khtml/khtml_settings.h:
* kwq/KWQKHTMLSettings.mm: Remove unused functions.
* kwq/qt/qfont.h:
* kwq/KWQFont.mm: Simplify.
* kwq/KWQPaintDeviceMetrics.mm: Simplify.
* kwq/qt/qtextcodec.h:
* kwq/KWQtextcodec.mm: (QTextCodec::codecForName): Remove unused parameter.
2002-07-23 David Hyatt <hyatt@apple.com>
The STYLE element was ignoring both the media and type
......
2002-07-23 Darin Adler <darin@apple.com>
Changes require a make clean because of the Project Builder bug.
So I added the "make clean timestamp" hackery.
* .cvsignore: Ignore the new clean timestamp.
* force-clean-timestamp: Added.
* Makefile.am: Add rules for making clean happen.
* khtml/html/html_formimpl.cpp:
(HTMLGenericFormElementImpl::defaultEventHandler): Fix NULL dereference
bug in here that I ran into. Code later down in the same function has
the check for NULL, so clearly this is just a bug.
* khtml/rendering/font.cpp:
(Font::drawText): Simplify by using new drawText that takes a QChar array,
no need to make a QConstString.
* khtml/rendering/render_text.cpp:
(TextSlave::printDecoration): Simplify by using new drawUnderlineForText that
takes a QChar array, no need to make a QConstString.
* kwq/WebCoreTextRenderer.h: Change underline-drawing to use a UniChar array.
* kwq/qt/qpainter.h:
* kwq/KWQPainter.mm:
(QPainter::drawText): Change to take QChar array instead of a QString, but
also discovered a bizarre overloading thing that was happening before and
dealt with that by adding a new drawText that still does take a QString.
(QPainter::drawUnderlineForText): Change to take QChar array.
* kwq/qt/qcolor.h: Mark constructor explicit, so we don't get subtle strangess
like where the string to draw was being converted to a QColor.
* khtml/css/cssstyleselector.cpp: No need for APPLE_CHANGES for
this change any more.
* kwq/kdecore/kcharsets.h:
* kwq/KWQKCharsets.mm: Remove unused functions.
* kwq/khtml/khtml_settings.h:
* kwq/KWQKHTMLSettings.mm: Remove unused functions.
* kwq/qt/qfont.h:
* kwq/KWQFont.mm: Simplify.
* kwq/KWQPaintDeviceMetrics.mm: Simplify.
* kwq/qt/qtextcodec.h:
* kwq/KWQtextcodec.mm: (QTextCodec::codecForName): Remove unused parameter.
2002-07-23 David Hyatt <hyatt@apple.com>
The STYLE element was ignoring both the media and type
......
SUBDIRS = khtml kwq
all-am:
all-am: previous-clean-timestamp
pbxbuild -buildstyle $(BUILDSTYLE)
clean-am:
pbxbuild clean
......@@ -14,3 +14,6 @@ WebCore-combined.exp: WebCore.exp WebCore-tests.exp
noinst_DATA = WebCore-combined.exp
BUILT_SOURCES = $(noinst_DATA)
CLEANFILES = $(BUILT_SOURCES)
previous-clean-timestamp: force-clean-timestamp
make clean && touch $@
QFont change 7/23 (and Project Builder bug 3005427)
\ No newline at end of file
......@@ -2231,11 +2231,6 @@ void CSSStyleSelector::applyRule( DOM::CSSProperty *prop )
float size = 0;
int minFontSize = settings->minFontSize();
#ifndef APPLE_CHANGES
float toPix = paintDeviceMetrics->logicalDpiY()/72.;
if (toPix < 96./72.) toPix = 96./72.;
#endif
if(parentNode) {
oldSize = parentStyle->font().pixelSize();
} else
......
......@@ -662,7 +662,7 @@ void HTMLGenericFormElementImpl::defaultEventHandler(EventImpl *evt)
{
// Report focus in/out changes to the browser extension (editable widgets only)
KHTMLView *view = getDocument()->view();
if (evt->id()==EventImpl::DOMFOCUSIN_EVENT && isEditable() && m_render->isWidget()) {
if (evt->id()==EventImpl::DOMFOCUSIN_EVENT && isEditable() && m_render && m_render->isWidget()) {
KHTMLPartBrowserExtension *ext = static_cast<KHTMLPartBrowserExtension *>(view->part()->browserExtension());
QWidget *widget = static_cast<RenderWidget*>(m_render)->widget();
if (ext)
......
......@@ -38,19 +38,12 @@ using namespace khtml;
void Font::drawText( QPainter *p, int x, int y, QChar *str, int slen, int pos, int len,
int toAdd, QPainter::TextDirection d, int from, int to, QColor bg ) const
{
#ifdef APPLE_CHANGES
p->drawText(x, y, str + pos, std::min(slen - pos, len), from, to, bg);
#else
QString qstr = QConstString(str, slen).string();
//fprintf (stdout, "x %d, y %d, pos %d, qstr.length() %d, len %d, toAdd %d, from %d, to %d, str \"%s\"\n", x, y, pos, qstr.length(), len, toAdd, from, to, qstr.ascii());
#ifdef APPLE_CHANGES
if (pos != 0)
p->drawText(x, y, qstr.mid(pos, len), from, to, bg);
else if (len < slen) {
qstr.truncate(len);
p->drawText(x, y, qstr, from, to, bg);
}
else
p->drawText(x, y, qstr, from, to, bg);
#else
// hack for fonts that don't have a welldefined nbsp
if ( !fontDef.hasNbsp ) {
// str.setLength() always does a deep copy, so the replacement code below is safe.
......@@ -105,8 +98,8 @@ void Font::drawText( QPainter *p, int x, int y, QChar *str, int slen, int pos, i
#endif
}
#ifdef APPLE_CHANGES
float Font::floatWidth( QChar *chs, int slen, int pos, int len ) const
{
return fm.floatWidth(chs, slen, pos, len);
......@@ -117,8 +110,8 @@ float Font::floatCharacterWidth( QChar *chs, int slen, int pos) const
{
return fm.floatCharacterWidth(chs, slen, pos);
}
#endif
#endif
int Font::width( QChar *chs, int slen, int pos, int len ) const
{
......@@ -227,6 +220,7 @@ void Font::update( QPaintDeviceMetrics* devMetrics ) const
#endif
fm = QFontMetrics( f );
#ifndef APPLE_CHANGES
fontDef.hasNbsp = fm.inFont( 0xa0 );
#endif
......
......@@ -50,7 +50,7 @@ void TextSlave::printSelection(const Font *f, RenderText *text, QPainter *p, Ren
QColor c = QPainter::selectedTextBackgroundColor();
if (textColor == c)
c = QColor(0xff - c.red(), 0xff - c.green(), 0xff - c.blue());
p->setPen(style->color());
p->setPen(textColor);
#else
QColor c = style->color();
p->setPen(QColor(0xff-c.red(),0xff-c.green(),0xff-c.blue()));
......@@ -78,10 +78,8 @@ void TextSlave::printDecoration( QPainter *pt, RenderText* p, int _tx, int _ty,
#ifdef APPLE_CHANGES
// Use a special function for underlines to get the positioning exactly right.
if(deco & UNDERLINE) {
QConstString s(p->str->s + m_start, m_len);
pt->drawUnderlineForText(_tx, _ty + m_baseline, s.string());
}
if(deco & UNDERLINE)
pt->drawUnderlineForText(_tx, _ty + m_baseline, p->str->s + m_start, m_len);
#else
int underlineOffset = ( pt->fontMetrics().height() + m_baseline ) / 2;
if(underlineOffset <= m_baseline) underlineOffset = m_baseline+1;
......
......@@ -43,8 +43,8 @@ class QColor {
public:
QColor();
QColor(int,int,int);
QColor(const QString &);
QColor(const char *);
explicit QColor(const QString &);
QColor(const char *); // can't be explicit because of helper.cpp
QColor(const QColor &);
~QColor();
......
......@@ -27,7 +27,6 @@
#define QFONT_H_
class QString;
class QPainter;
#ifdef __OBJC__
@class NSString;
......@@ -37,26 +36,23 @@ class NSString;
class QFont {
public:
enum CharSet { Latin1, Unicode };
enum Weight { Normal = 50, Bold = 63 };
QFont();
QFont(const QFont &);
QFont &operator=(const QFont &);
~QFont();
int pixelSize() const;
QString family() const;
void setFamily(const QString &);
void setPixelSize(int);
QString family() const;
void setWeight(int);
int weight() const;
bool setItalic(bool);
bool italic() const;
bool bold() const;
void setItalic(bool);
bool italic() const;
void setPixelSize(float s) { _size = s; }
int pixelSize() const { return (int)_size; }
bool operator==(const QFont &x) const;
bool operator!=(const QFont &x) const { return !(*this == x); }
......@@ -68,7 +64,6 @@ private:
NSString *_family;
int _trait;
float _size;
};
#endif
......@@ -35,22 +35,6 @@ QFont::QFont()
{
}
QFont::QFont(const QFont &copyFrom)
: _family(copyFrom._family)
, _trait(copyFrom._trait)
, _size(copyFrom._size)
{
}
QFont::~QFont()
{
}
int QFont::pixelSize() const
{
return (int)_size;
}
QString QFont::family() const
{
return QString::fromNSString(_family);
......@@ -72,17 +56,11 @@ void QFont::setFamily(const QString &qfamilyName)
}
}
void QFont::setPixelSize(int sz)
{
_size = sz;
}
void QFont::setWeight(int weight)
{
if (weight == Bold) {
_trait |= NSBoldFontMask;
}
else if (weight == Normal) {
} else if (weight == Normal) {
_trait &= ~NSBoldFontMask;
}
}
......@@ -92,15 +70,13 @@ int QFont::weight() const
return bold() ? Bold : Normal;
}
bool QFont::setItalic(bool flag)
void QFont::setItalic(bool flag)
{
if (flag) {
_trait |= NSItalicFontMask;
}
else {
} else {
_trait &= ~NSItalicFontMask;
}
return false;
}
bool QFont::italic() const
......@@ -113,14 +89,6 @@ bool QFont::bold() const
return _trait & NSBoldFontMask;
}
QFont &QFont::operator=(const QFont &assignFrom)
{
_family = assignFrom._family;
_trait = assignFrom._trait;
_size = assignFrom._size;
return *this;
}
bool QFont::operator==(const QFont &compareFont) const
{
return _family == compareFont._family
......
......@@ -35,18 +35,6 @@ class KCharsets {
public:
QTextCodec *codecForName(const QString &) const;
QTextCodec *codecForName(const QString &, bool &) const;
QFont::CharSet charsetForEncoding(const QString &) const;
QFont::CharSet charsetForEncoding(const QString &, bool) const;
void setQFont(QFont &, QFont::CharSet) const { }
void setQFont(QFont &, QString) const { }
QString name(QFont::CharSet);
QString xCharsetName(QFont::CharSet) const;
bool supportsScript(const QFont &, QFont::CharSet);
};
#endif
......@@ -25,7 +25,6 @@
#import <kcharsets.h>
#import <qtextcodec.h>
#import <kwqdebug.h>
QTextCodec *KCharsets::codecForName(const QString &qs) const
{
......@@ -41,41 +40,5 @@ QTextCodec *KCharsets::codecForName(const QString &qs, bool &ok) const
} else {
ok = true;
}
return codec;
}
QFont::CharSet KCharsets::charsetForEncoding(const QString &) const
{
// FIXME: need real implementation here
_logPartiallyImplemented();
return QFont::Unicode;
}
QFont::CharSet KCharsets::charsetForEncoding(const QString &, bool) const
{
// FIXME: need real implementation here
_logPartiallyImplemented();
return QFont::Unicode;
}
QString KCharsets::name(QFont::CharSet)
{
// FIXME: need real implementation here
_logPartiallyImplemented();
return QString();
}
QString KCharsets::xCharsetName(QFont::CharSet) const
{
// FIXME: do we need a real implementation here?
_logPartiallyImplemented();
return QString();
}
bool KCharsets::supportsScript(const QFont &, QFont::CharSet)
{
// FIXME: do we need a real implementation here?
_logPartiallyImplemented();
return true;
}
......@@ -39,8 +39,6 @@ public:
KAnimationLoopOnce,
KAnimationEnabled
};
KHTMLSettings();
void init() { }
......@@ -62,9 +60,6 @@ public:
int minFontSize() const;
int mediumFontSize() const;
QFont::CharSet script() const;
void setScript( QFont::CharSet c );
bool changeCursor() const;
bool isFormCompletionEnabled() const;
......@@ -82,9 +77,6 @@ public:
bool isPluginsEnabled(const QString &host) const;
QString userStyleSheet() const;
private:
QFont::CharSet m_charSet;
};
#endif
/*
* Copyright (C) 2001 Apple Computer, Inc. All rights reserved.
* Copyright (C) 2001, 2002 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -22,50 +22,40 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import <kwqdebug.h>
#import <khtml_settings.h>
KHTMLSettings::KHTMLSettings()
{
m_charSet = QFont::Latin1;
}
#import <khtml_settings.h>
#import <kwqdebug.h>
QString KHTMLSettings::stdFontName() const
{
return QString::fromNSString([[NSUserDefaults standardUserDefaults] objectForKey:@"WebKitStandardFont"]);
}
QString KHTMLSettings::fixedFontName() const
{
return QString::fromNSString([[NSUserDefaults standardUserDefaults] objectForKey:@"WebKitFixedFont"]);
}
QString KHTMLSettings::serifFontName() const
{
return QString::fromNSString([[NSUserDefaults standardUserDefaults] objectForKey:@"WebKitSerifFont"]);
}
QString KHTMLSettings::sansSerifFontName() const
{
return QString::fromNSString([[NSUserDefaults standardUserDefaults] objectForKey:@"WebKitSansSerifFont"]);
}
QString KHTMLSettings::cursiveFontName() const
{
return QString::fromNSString([[NSUserDefaults standardUserDefaults] objectForKey:@"WebKitCursiveFont"]);
}
QString KHTMLSettings::fantasyFontName() const
{
return QString::fromNSString([[NSUserDefaults standardUserDefaults] objectForKey:@"WebKitFantasyFont"]);
}
QString KHTMLSettings::settingsToCSS() const
{
_logNotYetImplemented();
......@@ -75,12 +65,9 @@ QString KHTMLSettings::settingsToCSS() const
const QString &KHTMLSettings::encoding() const
{
// FIXME: remove this hack
static const QString *DEFAULT_ENCODING = NULL;
_logNotYetImplemented();
if (DEFAULT_ENCODING == NULL) {
DEFAULT_ENCODING = new QString(QString::fromNSString(@"NSISOLatin1StringEncoding"));
}
return *DEFAULT_ENCODING;
static const QString e(QString::fromNSString(@"NSISOLatin1StringEncoding"));
return e;
}
int KHTMLSettings::minFontSize() const
......@@ -93,16 +80,6 @@ int KHTMLSettings::mediumFontSize() const
return [[NSUserDefaults standardUserDefaults] integerForKey:@"WebKitMediumFontSize"];
}
QFont::CharSet KHTMLSettings::script() const
{
return m_charSet;
}
void KHTMLSettings::setScript(QFont::CharSet c)
{
m_charSet = c;
}
bool KHTMLSettings::changeCursor() const
{
return true;
......@@ -110,13 +87,11 @@ bool KHTMLSettings::changeCursor() const
bool KHTMLSettings::isFormCompletionEnabled() const
{
_logNotYetImplemented();
return FALSE;
return false;
}
int KHTMLSettings::maxFormCompletionItems() const
{
_logNotYetImplemented();
return 0;
}
......
......@@ -33,7 +33,6 @@ QPaintDeviceMetrics::QPaintDeviceMetrics(const QPaintDevice *)
int QPaintDeviceMetrics::logicalDpiY() const
{
//_logPartiallyImplemented();
return 96;
}
......
......@@ -91,8 +91,9 @@ public:
RasterOp rasterOp() const;
void setRasterOp(RasterOp);
void drawText(int x, int y, const QString &, int from, int to, const QColor& backgroundColor);
void drawUnderlineForText(int x, int y, const QString &);
void drawText(int x, int y, int, int, int alignmentFlags, const QString &);
void drawText(int x, int y, const QChar *, int length, int from, int to, const QColor& backgroundColor);
void drawUnderlineForText(int x, int y, const QChar *, int length);
static QColor selectedTextBackgroundColor();
void setPaintingDisabled(bool f);
......
......@@ -344,7 +344,7 @@ void QPainter::drawTiledPixmap( int x, int y, int w, int h,
[pixmap.imageRenderer tileInRect:NSMakeRect(x, y, w, h) fromPoint:NSMakePoint(sx, sy)];