[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
rjw
rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 05:57:16 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 84678405eecdeda5c5371ec4c4dc7cd52e7d1497
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Mar 9 01:25:36 2002 +0000
Re-implemented KWQFont to lazily request font from NSFontManager instead of
user converFont:. I did this after sampling loads of http://www.apple.com/retail/theater
and found that converting fonts was very expensive.
Fixed scroll bar recursion problems.
Took a long time to find a stupid typo bug in [IFBaseWebController _frameForDataSource:fromFrame:]
that overwrote an input parameter that should been a local variable. This caused a crash the
second time a page that contained an iframe was loaded.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@723 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 37ac4bb..9d7c03f 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,5 +1,21 @@
2002-03-08 Richard Williamson <rjw at apple.com>
+Re-implemented KWQFont to lazily request font from NSFontManager instead of
+user converFont:. I did this after sampling loads of http://www.apple.com/retail/theater
+and found that converting fonts was very expensive.
+
+ * src/kwq/KWQFont.mm: (QFont::defaultNSFont), (QFont::_initializeWithFont),
+ (QFont::QFont), (QFont::_free), (QFont::getFont), (QFont::pixelSize),
+ (QFont::family), (QFont::setFamily), (QFont::setPixelSizeFloat),
+ (QFont::setWeight), (QFont::weight), (QFont::setItalic), (QFont::italic),
+ (QFont::bold), (QFont::operator!=):
+ * src/kwq/KWQFontMetrics.mm: (QFontMetrics::QFontMetrics):
+ * src/kwq/KWQKHTMLPart.mm: (KHTMLPart::requestFrame):
+ * src/kwq/KWQPainter.mm: (QPainter::drawText), (QPainter::drawUnderlineForText):
+ * src/kwq/qt/qfont.h:
+
+2002-03-08 Richard Williamson <rjw at apple.com>
+
Instrumentation of the text fragment metrics cache.
Added _FAST_QSTRING_TO_NSSTRING.
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 37ac4bb..9d7c03f 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,5 +1,21 @@
2002-03-08 Richard Williamson <rjw at apple.com>
+Re-implemented KWQFont to lazily request font from NSFontManager instead of
+user converFont:. I did this after sampling loads of http://www.apple.com/retail/theater
+and found that converting fonts was very expensive.
+
+ * src/kwq/KWQFont.mm: (QFont::defaultNSFont), (QFont::_initializeWithFont),
+ (QFont::QFont), (QFont::_free), (QFont::getFont), (QFont::pixelSize),
+ (QFont::family), (QFont::setFamily), (QFont::setPixelSizeFloat),
+ (QFont::setWeight), (QFont::weight), (QFont::setItalic), (QFont::italic),
+ (QFont::bold), (QFont::operator!=):
+ * src/kwq/KWQFontMetrics.mm: (QFontMetrics::QFontMetrics):
+ * src/kwq/KWQKHTMLPart.mm: (KHTMLPart::requestFrame):
+ * src/kwq/KWQPainter.mm: (QPainter::drawText), (QPainter::drawUnderlineForText):
+ * src/kwq/qt/qfont.h:
+
+2002-03-08 Richard Williamson <rjw at apple.com>
+
Instrumentation of the text fragment metrics cache.
Added _FAST_QSTRING_TO_NSSTRING.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 37ac4bb..9d7c03f 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,21 @@
2002-03-08 Richard Williamson <rjw at apple.com>
+Re-implemented KWQFont to lazily request font from NSFontManager instead of
+user converFont:. I did this after sampling loads of http://www.apple.com/retail/theater
+and found that converting fonts was very expensive.
+
+ * src/kwq/KWQFont.mm: (QFont::defaultNSFont), (QFont::_initializeWithFont),
+ (QFont::QFont), (QFont::_free), (QFont::getFont), (QFont::pixelSize),
+ (QFont::family), (QFont::setFamily), (QFont::setPixelSizeFloat),
+ (QFont::setWeight), (QFont::weight), (QFont::setItalic), (QFont::italic),
+ (QFont::bold), (QFont::operator!=):
+ * src/kwq/KWQFontMetrics.mm: (QFontMetrics::QFontMetrics):
+ * src/kwq/KWQKHTMLPart.mm: (KHTMLPart::requestFrame):
+ * src/kwq/KWQPainter.mm: (QPainter::drawText), (QPainter::drawUnderlineForText):
+ * src/kwq/qt/qfont.h:
+
+2002-03-08 Richard Williamson <rjw at apple.com>
+
Instrumentation of the text fragment metrics cache.
Added _FAST_QSTRING_TO_NSSTRING.
diff --git a/WebCore/kwq/KWQFont.h b/WebCore/kwq/KWQFont.h
index 618b6ae..ef36774 100644
--- a/WebCore/kwq/KWQFont.h
+++ b/WebCore/kwq/KWQFont.h
@@ -31,6 +31,7 @@
#endif
class QString;
+class QPainter;
#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
#define Fixed MacFixed
@@ -45,7 +46,6 @@ class QString;
// class QFont =================================================================
class QFont {
-friend class QPainter;
public:
// typedefs ----------------------------------------------------------------
@@ -88,8 +88,15 @@ public:
#endif
#endif
+#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
+ NSFont *getFont();
+#else
+ void *getFont();
+#endif
+
// protected -------------------------------------------------------------------
// private ---------------------------------------------------------------------
+private:
#ifdef _KWQ_
void _initialize();
void _initializeWithFont(const QFont *);
@@ -100,8 +107,14 @@ public:
#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
NSFont *font;
+ NSString *_family;
+ int _trait;
+ float _size;
#else
void *font;
+ void *_family;
+ int _trait;
+ float _size;
#endif
#endif
diff --git a/WebCore/kwq/KWQFont.mm b/WebCore/kwq/KWQFont.mm
index 4f00f67..e0ad7a7 100644
--- a/WebCore/kwq/KWQFont.mm
+++ b/WebCore/kwq/KWQFont.mm
@@ -43,26 +43,35 @@ void QFont::_initialize()
_initializeWithFont (0);
}
+static NSFont *_defaultNSFont = 0;
+
NSFont *QFont::defaultNSFont()
{
- return [NSFont userFontOfSize: (float)12.0];
+ if (_defaultNSFont == 0)
+ _defaultNSFont = [[NSFont userFontOfSize: (float)12.0] retain];
+ return _defaultNSFont;
}
void QFont::_initializeWithFont (const QFont *withFont)
{
- if (withFont == 0)
- // Hmm... What size should we use as a default font?
- font = [defaultNSFont() retain];
- else
+ if (withFont){
font = [withFont->font retain];
+ _family = [withFont->_family retain];
+ _size = withFont->_size;
+ _trait = withFont->_trait;
+ }
+ else {
+ font = [defaultNSFont() retain];
+ _family = [[font familyName] retain];
+ _size = [font pointSize];
+ _trait = [[NSFontManager sharedFontManager] traitsOfFont: font] & (NSBoldFontMask | NSItalicFontMask);
+ }
}
QFont::QFont(const QFont ©From)
{
_initializeWithFont(©From);
- // FIXME: why were we freeing here?
- //_free();
}
@@ -72,6 +81,7 @@ QFont::~QFont()
}
void QFont::_free(){
+ [_family release];
[font autorelease];
font = 0;
}
@@ -79,52 +89,67 @@ void QFont::_free(){
// member functions --------------------------------------------------------
+NSFont *QFont::getFont()
+{
+ if (font == nil)
+ font = [[[NSFontManager sharedFontManager] fontWithFamily:_family traits:_trait weight:5 size:_size] retain];
+ return font;
+}
+
+
int QFont::pixelSize() const
{
- return (int)[font pointSize];
+ return (int)_size;
}
QString QFont::family() const
{
- return NSSTRING_TO_QSTRING([font familyName]);
+ return NSSTRING_TO_QSTRING(_family);
}
void QFont::setFamily(const QString &qfamilyName)
{
- NSString *familyName;
- NSFont *oldFont = font;
-
- familyName = QSTRING_TO_NSSTRING(qfamilyName);
- font = [[[NSFontManager sharedFontManager] convertFont: oldFont toFamily: familyName] retain];
-
- [oldFont release];
+ [_family release];
+ _family = [_FAST_QSTRING_TO_NSSTRING(qfamilyName) retain];
+ [font release];
+ font = nil;
}
void QFont::setPixelSizeFloat(float sz)
{
- NSFont *oldFont = font;
-
- font = [[[NSFontManager sharedFontManager] convertFont: oldFont toSize: sz] retain];
-
- [oldFont release];
+ if (sz != _size){
+ _size = sz;
+ [font release];
+ font = nil;
+ }
}
void QFont::setWeight(int weight)
{
- if (weight == Bold)
- _setTrait (NSBoldFontMask);
- else if (weight == Normal)
- _setTrait (NSUnboldFontMask);
+ if (weight == Bold){
+ if (!bold()){
+ [font release];
+ font = nil;
+ }
+ _trait |= NSBoldFontMask;
+ }
+ else if (weight == Normal){
+ if (bold()){
+ [font release];
+ font = nil;
+ }
+ _trait = _trait & (~NSBoldFontMask);
+ }
}
int QFont::weight() const
{
- if ([[NSFontManager sharedFontManager] traitsOfFont: font] & NSBoldFontMask)
+ if (_trait == NSBoldFontMask)
return Bold;
return Normal;
}
@@ -132,30 +157,34 @@ int QFont::weight() const
bool QFont::setItalic(bool flag)
{
- if (flag) {
- _setTrait (NSItalicFontMask);
- return TRUE;
+ if (flag){
+ if (!italic()){
+ [font release];
+ font = nil;
+ }
+ _trait |= NSItalicFontMask;
+ return true;
}
- else {
- _setTrait (NSUnitalicFontMask);
- return FALSE;
+ else{
+ if (italic()){
+ [font release];
+ font = nil;
+ }
+ _trait = _trait & (~NSItalicFontMask);
+ return false;
}
}
bool QFont::italic() const
{
- if ([[NSFontManager sharedFontManager] traitsOfFont: font] & NSItalicFontMask)
- return TRUE;
- return FALSE;
+ return _trait & NSItalicFontMask ? TRUE : FALSE;
}
bool QFont::bold() const
{
- if ([[NSFontManager sharedFontManager] traitsOfFont: font] & NSItalicFontMask)
- return TRUE;
- return FALSE;
+ return _trait & NSBoldFontMask ? TRUE : FALSE;
}
@@ -179,13 +208,3 @@ bool QFont::operator!=(const QFont &compareFont) const
{
return !(operator==( compareFont ));
}
-
-
-void QFont::_setTrait (NSFontTraitMask mask)
-{
- NSFont *oldFont = font;
-
- font = [[[NSFontManager sharedFontManager] convertFont: oldFont toHaveTrait: mask] retain];
-
- [oldFont release];
-}
diff --git a/WebCore/kwq/KWQFontMetrics.mm b/WebCore/kwq/KWQFontMetrics.mm
index 9e4e531..e64bbc0 100644
--- a/WebCore/kwq/KWQFontMetrics.mm
+++ b/WebCore/kwq/KWQFontMetrics.mm
@@ -306,7 +306,7 @@ QFontMetrics::QFontMetrics()
QFontMetrics::QFontMetrics(const QFont &withFont)
{
- _initializeWithFont (withFont.font);
+ _initializeWithFont (((QFont)withFont).getFont());
}
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index e0b2d5a..4a575b9 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -1699,11 +1699,13 @@ bool KHTMLPart::requestFrame( khtml::RenderPart *frame, const QString &url, cons
IFWebFrame *newFrame;
id <IFWebController> controller;
- fprintf (stdout, "0x%08x requestFrame(): part = 0x%08x creating frame\n", (unsigned int)this, (unsigned int)frame);
childURL = [NSURL URLWithString: QSTRING_TO_NSSTRING (completeURL( url ).url() )];
oldDataSource = getDataSource();
controller = [oldDataSource controller];
+
+ fprintf (stdout, "0x%08x requestFrame(): part = 0x%08x, oldDataSource = 0x%08x, [oldDataSource frame] = 0x%08x\n", (unsigned int)this, (unsigned int)frame, (unsigned int)oldDataSource, (unsigned int)[oldDataSource frame]);
+
newFrame = [controller createFrameNamed: nsframeName for: nil inParent: oldDataSource];
if (newFrame == nil){
// Controller return NO to location change, now what?
diff --git a/WebCore/kwq/KWQKHTMLPartImpl.mm b/WebCore/kwq/KWQKHTMLPartImpl.mm
index e0b2d5a..4a575b9 100644
--- a/WebCore/kwq/KWQKHTMLPartImpl.mm
+++ b/WebCore/kwq/KWQKHTMLPartImpl.mm
@@ -1699,11 +1699,13 @@ bool KHTMLPart::requestFrame( khtml::RenderPart *frame, const QString &url, cons
IFWebFrame *newFrame;
id <IFWebController> controller;
- fprintf (stdout, "0x%08x requestFrame(): part = 0x%08x creating frame\n", (unsigned int)this, (unsigned int)frame);
childURL = [NSURL URLWithString: QSTRING_TO_NSSTRING (completeURL( url ).url() )];
oldDataSource = getDataSource();
controller = [oldDataSource controller];
+
+ fprintf (stdout, "0x%08x requestFrame(): part = 0x%08x, oldDataSource = 0x%08x, [oldDataSource frame] = 0x%08x\n", (unsigned int)this, (unsigned int)frame, (unsigned int)oldDataSource, (unsigned int)[oldDataSource frame]);
+
newFrame = [controller createFrameNamed: nsframeName for: nil inParent: oldDataSource];
if (newFrame == nil){
// Controller return NO to location change, now what?
diff --git a/WebCore/kwq/KWQPainter.mm b/WebCore/kwq/KWQPainter.mm
index 8fe6197..3714e2e 100644
--- a/WebCore/kwq/KWQPainter.mm
+++ b/WebCore/kwq/KWQPainter.mm
@@ -463,7 +463,7 @@ void QPainter::drawText(int x, int y, const QString &qstring, int len)
_lockFocus();
//font = data->qfont.data->font;
- font = data->qfont.font;
+ font = data->qfont.getFont();
if (len == -1)
string = QSTRING_TO_NSSTRING(qstring);
@@ -518,8 +518,7 @@ void QPainter::drawUnderlineForText(int x, int y, const QString &qstring, int le
_lockFocus();
- //font = data->qfont.data->font;
- font = data->qfont.font;
+ font = data->qfont.getFont();
if (len == -1)
string = QSTRING_TO_NSSTRING(qstring);
@@ -543,7 +542,7 @@ void QPainter::drawText(int x, int y, int w, int h, int flags, const QString&qst
_lockFocus();
//font = data->qfont.data->font;
- font = data->qfont.font;
+ font = data->qfont.getFont();
if (len == -1)
string = QSTRING_TO_NSSTRING(qstring);
diff --git a/WebCore/kwq/qt/qfont.h b/WebCore/kwq/qt/qfont.h
index 618b6ae..ef36774 100644
--- a/WebCore/kwq/qt/qfont.h
+++ b/WebCore/kwq/qt/qfont.h
@@ -31,6 +31,7 @@
#endif
class QString;
+class QPainter;
#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
#define Fixed MacFixed
@@ -45,7 +46,6 @@ class QString;
// class QFont =================================================================
class QFont {
-friend class QPainter;
public:
// typedefs ----------------------------------------------------------------
@@ -88,8 +88,15 @@ public:
#endif
#endif
+#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
+ NSFont *getFont();
+#else
+ void *getFont();
+#endif
+
// protected -------------------------------------------------------------------
// private ---------------------------------------------------------------------
+private:
#ifdef _KWQ_
void _initialize();
void _initializeWithFont(const QFont *);
@@ -100,8 +107,14 @@ public:
#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
NSFont *font;
+ NSString *_family;
+ int _trait;
+ float _size;
#else
void *font;
+ void *_family;
+ int _trait;
+ float _size;
#endif
#endif
diff --git a/WebCore/src/kwq/KWQFont.mm b/WebCore/src/kwq/KWQFont.mm
index 4f00f67..e0ad7a7 100644
--- a/WebCore/src/kwq/KWQFont.mm
+++ b/WebCore/src/kwq/KWQFont.mm
@@ -43,26 +43,35 @@ void QFont::_initialize()
_initializeWithFont (0);
}
+static NSFont *_defaultNSFont = 0;
+
NSFont *QFont::defaultNSFont()
{
- return [NSFont userFontOfSize: (float)12.0];
+ if (_defaultNSFont == 0)
+ _defaultNSFont = [[NSFont userFontOfSize: (float)12.0] retain];
+ return _defaultNSFont;
}
void QFont::_initializeWithFont (const QFont *withFont)
{
- if (withFont == 0)
- // Hmm... What size should we use as a default font?
- font = [defaultNSFont() retain];
- else
+ if (withFont){
font = [withFont->font retain];
+ _family = [withFont->_family retain];
+ _size = withFont->_size;
+ _trait = withFont->_trait;
+ }
+ else {
+ font = [defaultNSFont() retain];
+ _family = [[font familyName] retain];
+ _size = [font pointSize];
+ _trait = [[NSFontManager sharedFontManager] traitsOfFont: font] & (NSBoldFontMask | NSItalicFontMask);
+ }
}
QFont::QFont(const QFont ©From)
{
_initializeWithFont(©From);
- // FIXME: why were we freeing here?
- //_free();
}
@@ -72,6 +81,7 @@ QFont::~QFont()
}
void QFont::_free(){
+ [_family release];
[font autorelease];
font = 0;
}
@@ -79,52 +89,67 @@ void QFont::_free(){
// member functions --------------------------------------------------------
+NSFont *QFont::getFont()
+{
+ if (font == nil)
+ font = [[[NSFontManager sharedFontManager] fontWithFamily:_family traits:_trait weight:5 size:_size] retain];
+ return font;
+}
+
+
int QFont::pixelSize() const
{
- return (int)[font pointSize];
+ return (int)_size;
}
QString QFont::family() const
{
- return NSSTRING_TO_QSTRING([font familyName]);
+ return NSSTRING_TO_QSTRING(_family);
}
void QFont::setFamily(const QString &qfamilyName)
{
- NSString *familyName;
- NSFont *oldFont = font;
-
- familyName = QSTRING_TO_NSSTRING(qfamilyName);
- font = [[[NSFontManager sharedFontManager] convertFont: oldFont toFamily: familyName] retain];
-
- [oldFont release];
+ [_family release];
+ _family = [_FAST_QSTRING_TO_NSSTRING(qfamilyName) retain];
+ [font release];
+ font = nil;
}
void QFont::setPixelSizeFloat(float sz)
{
- NSFont *oldFont = font;
-
- font = [[[NSFontManager sharedFontManager] convertFont: oldFont toSize: sz] retain];
-
- [oldFont release];
+ if (sz != _size){
+ _size = sz;
+ [font release];
+ font = nil;
+ }
}
void QFont::setWeight(int weight)
{
- if (weight == Bold)
- _setTrait (NSBoldFontMask);
- else if (weight == Normal)
- _setTrait (NSUnboldFontMask);
+ if (weight == Bold){
+ if (!bold()){
+ [font release];
+ font = nil;
+ }
+ _trait |= NSBoldFontMask;
+ }
+ else if (weight == Normal){
+ if (bold()){
+ [font release];
+ font = nil;
+ }
+ _trait = _trait & (~NSBoldFontMask);
+ }
}
int QFont::weight() const
{
- if ([[NSFontManager sharedFontManager] traitsOfFont: font] & NSBoldFontMask)
+ if (_trait == NSBoldFontMask)
return Bold;
return Normal;
}
@@ -132,30 +157,34 @@ int QFont::weight() const
bool QFont::setItalic(bool flag)
{
- if (flag) {
- _setTrait (NSItalicFontMask);
- return TRUE;
+ if (flag){
+ if (!italic()){
+ [font release];
+ font = nil;
+ }
+ _trait |= NSItalicFontMask;
+ return true;
}
- else {
- _setTrait (NSUnitalicFontMask);
- return FALSE;
+ else{
+ if (italic()){
+ [font release];
+ font = nil;
+ }
+ _trait = _trait & (~NSItalicFontMask);
+ return false;
}
}
bool QFont::italic() const
{
- if ([[NSFontManager sharedFontManager] traitsOfFont: font] & NSItalicFontMask)
- return TRUE;
- return FALSE;
+ return _trait & NSItalicFontMask ? TRUE : FALSE;
}
bool QFont::bold() const
{
- if ([[NSFontManager sharedFontManager] traitsOfFont: font] & NSItalicFontMask)
- return TRUE;
- return FALSE;
+ return _trait & NSBoldFontMask ? TRUE : FALSE;
}
@@ -179,13 +208,3 @@ bool QFont::operator!=(const QFont &compareFont) const
{
return !(operator==( compareFont ));
}
-
-
-void QFont::_setTrait (NSFontTraitMask mask)
-{
- NSFont *oldFont = font;
-
- font = [[[NSFontManager sharedFontManager] convertFont: oldFont toHaveTrait: mask] retain];
-
- [oldFont release];
-}
diff --git a/WebCore/src/kwq/KWQFontMetrics.mm b/WebCore/src/kwq/KWQFontMetrics.mm
index 9e4e531..e64bbc0 100644
--- a/WebCore/src/kwq/KWQFontMetrics.mm
+++ b/WebCore/src/kwq/KWQFontMetrics.mm
@@ -306,7 +306,7 @@ QFontMetrics::QFontMetrics()
QFontMetrics::QFontMetrics(const QFont &withFont)
{
- _initializeWithFont (withFont.font);
+ _initializeWithFont (((QFont)withFont).getFont());
}
diff --git a/WebCore/src/kwq/KWQKHTMLPart.mm b/WebCore/src/kwq/KWQKHTMLPart.mm
index e0b2d5a..4a575b9 100644
--- a/WebCore/src/kwq/KWQKHTMLPart.mm
+++ b/WebCore/src/kwq/KWQKHTMLPart.mm
@@ -1699,11 +1699,13 @@ bool KHTMLPart::requestFrame( khtml::RenderPart *frame, const QString &url, cons
IFWebFrame *newFrame;
id <IFWebController> controller;
- fprintf (stdout, "0x%08x requestFrame(): part = 0x%08x creating frame\n", (unsigned int)this, (unsigned int)frame);
childURL = [NSURL URLWithString: QSTRING_TO_NSSTRING (completeURL( url ).url() )];
oldDataSource = getDataSource();
controller = [oldDataSource controller];
+
+ fprintf (stdout, "0x%08x requestFrame(): part = 0x%08x, oldDataSource = 0x%08x, [oldDataSource frame] = 0x%08x\n", (unsigned int)this, (unsigned int)frame, (unsigned int)oldDataSource, (unsigned int)[oldDataSource frame]);
+
newFrame = [controller createFrameNamed: nsframeName for: nil inParent: oldDataSource];
if (newFrame == nil){
// Controller return NO to location change, now what?
diff --git a/WebCore/src/kwq/KWQPainter.mm b/WebCore/src/kwq/KWQPainter.mm
index 8fe6197..3714e2e 100644
--- a/WebCore/src/kwq/KWQPainter.mm
+++ b/WebCore/src/kwq/KWQPainter.mm
@@ -463,7 +463,7 @@ void QPainter::drawText(int x, int y, const QString &qstring, int len)
_lockFocus();
//font = data->qfont.data->font;
- font = data->qfont.font;
+ font = data->qfont.getFont();
if (len == -1)
string = QSTRING_TO_NSSTRING(qstring);
@@ -518,8 +518,7 @@ void QPainter::drawUnderlineForText(int x, int y, const QString &qstring, int le
_lockFocus();
- //font = data->qfont.data->font;
- font = data->qfont.font;
+ font = data->qfont.getFont();
if (len == -1)
string = QSTRING_TO_NSSTRING(qstring);
@@ -543,7 +542,7 @@ void QPainter::drawText(int x, int y, int w, int h, int flags, const QString&qst
_lockFocus();
//font = data->qfont.data->font;
- font = data->qfont.font;
+ font = data->qfont.getFont();
if (len == -1)
string = QSTRING_TO_NSSTRING(qstring);
diff --git a/WebCore/src/kwq/qt/qfont.h b/WebCore/src/kwq/qt/qfont.h
index 618b6ae..ef36774 100644
--- a/WebCore/src/kwq/qt/qfont.h
+++ b/WebCore/src/kwq/qt/qfont.h
@@ -31,6 +31,7 @@
#endif
class QString;
+class QPainter;
#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
#define Fixed MacFixed
@@ -45,7 +46,6 @@ class QString;
// class QFont =================================================================
class QFont {
-friend class QPainter;
public:
// typedefs ----------------------------------------------------------------
@@ -88,8 +88,15 @@ public:
#endif
#endif
+#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
+ NSFont *getFont();
+#else
+ void *getFont();
+#endif
+
// protected -------------------------------------------------------------------
// private ---------------------------------------------------------------------
+private:
#ifdef _KWQ_
void _initialize();
void _initializeWithFont(const QFont *);
@@ -100,8 +107,14 @@ public:
#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
NSFont *font;
+ NSString *_family;
+ int _trait;
+ float _size;
#else
void *font;
+ void *_family;
+ int _trait;
+ float _size;
#endif
#endif
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 4694fab..96fe13c 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,21 @@
+2002-03-08 Richard Williamson <rjw at apple.com>
+
+ Fixed scroll bar recursion problems.
+Took a long time to find a stupid typo bug in [IFBaseWebController _frameForDataSource:fromFrame:]
+that overwrote an input parameter that should been a local variable. This caused a crash the
+second time a page that contained an iframe was loaded.
+
+ * WebView.subproj/IFBaseWebController.mm: (-[IFBaseWebController
+ createFrameNamed:for:inParent:]), (-[IFBaseWebController
+ _frameForDataSource:fromFrame:]):
+ * WebView.subproj/IFDynamicScrollBarsView.m: (-[IFDynamicScrollBarsView
+ reflectScrolledClipView:]):
+ * WebView.subproj/IFWebFramePrivate.mm: (-[IFWebFrame _checkLoadComplete:]):
+ * WebView.subproj/IFWebView.mm: (-[IFWebView layout]):
+ * WebView.subproj/IFWebViewPrivate.h:
+ * WebView.subproj/IFWebViewPrivate.mm: (-[IFWebView _setFrameScrollView:]),
+ (-[IFWebView _frameScrollView]), (-[IFWebView _setupScrollers]):
+
2002-03-07 John Sullivan <sullivan at apple.com>
* Misc.subproj/IFError.m: (-[IFError errorDescription]):
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 4694fab..96fe13c 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,21 @@
+2002-03-08 Richard Williamson <rjw at apple.com>
+
+ Fixed scroll bar recursion problems.
+Took a long time to find a stupid typo bug in [IFBaseWebController _frameForDataSource:fromFrame:]
+that overwrote an input parameter that should been a local variable. This caused a crash the
+second time a page that contained an iframe was loaded.
+
+ * WebView.subproj/IFBaseWebController.mm: (-[IFBaseWebController
+ createFrameNamed:for:inParent:]), (-[IFBaseWebController
+ _frameForDataSource:fromFrame:]):
+ * WebView.subproj/IFDynamicScrollBarsView.m: (-[IFDynamicScrollBarsView
+ reflectScrolledClipView:]):
+ * WebView.subproj/IFWebFramePrivate.mm: (-[IFWebFrame _checkLoadComplete:]):
+ * WebView.subproj/IFWebView.mm: (-[IFWebView layout]):
+ * WebView.subproj/IFWebViewPrivate.h:
+ * WebView.subproj/IFWebViewPrivate.mm: (-[IFWebView _setFrameScrollView:]),
+ (-[IFWebView _frameScrollView]), (-[IFWebView _setupScrollers]):
+
2002-03-07 John Sullivan <sullivan at apple.com>
* Misc.subproj/IFError.m: (-[IFError errorDescription]):
diff --git a/WebKit/WebView.subproj/IFBaseWebController.mm b/WebKit/WebView.subproj/IFBaseWebController.mm
index 9fae7a7..0517caa 100644
--- a/WebKit/WebView.subproj/IFBaseWebController.mm
+++ b/WebKit/WebView.subproj/IFBaseWebController.mm
@@ -134,7 +134,7 @@ static id IFLoadProgressMake()
{
IFWebView *childView;
IFWebFrame *newFrame;
- IFDynamicScrollBarsView *scrollView;
+ NSScrollView *scrollView;
childView = [[[IFWebView alloc] initWithFrame: NSMakeRect (0,0,0,0)] autorelease];
@@ -145,7 +145,7 @@ static id IFLoadProgressMake()
[childView _setController: self];
[childDataSource _setController: self];
- scrollView = [[[IFDynamicScrollBarsView alloc] initWithFrame: NSMakeRect(0,0,0,0)] autorelease];
+ scrollView = [[[NSScrollView alloc] initWithFrame: NSMakeRect(0,0,0,0)] autorelease];
[childView _setFrameScrollView: scrollView];
return newFrame;
@@ -244,7 +244,7 @@ static id IFLoadProgressMake()
{
NSArray *frames;
int i, count;
- IFWebFrame *result;
+ IFWebFrame *result, *aFrame;
if ([frame dataSource] == dataSource)
return frame;
@@ -255,8 +255,8 @@ static id IFLoadProgressMake()
frames = [[frame dataSource] children];
count = [frames count];
for (i = 0; i < count; i++){
- frame = [frames objectAtIndex: i];
- result = [self _frameForDataSource: dataSource fromFrame: frame];
+ aFrame = [frames objectAtIndex: i];
+ result = [self _frameForDataSource: dataSource fromFrame: aFrame];
if (result)
return result;
}
@@ -264,8 +264,8 @@ static id IFLoadProgressMake()
frames = [[frame provisionalDataSource] children];
count = [frames count];
for (i = 0; i < count; i++){
- frame = [frames objectAtIndex: i];
- result = [self _frameForDataSource: dataSource fromFrame: frame];
+ aFrame = [frames objectAtIndex: i];
+ result = [self _frameForDataSource: dataSource fromFrame: aFrame];
if (result)
return result;
}
diff --git a/WebKit/WebView.subproj/IFDynamicScrollBarsView.m b/WebKit/WebView.subproj/IFDynamicScrollBarsView.m
index bd2555d..73e17dc 100644
--- a/WebKit/WebView.subproj/IFDynamicScrollBarsView.m
+++ b/WebKit/WebView.subproj/IFDynamicScrollBarsView.m
@@ -12,31 +12,20 @@
#import <WebKit/WebKitDebug.h>
- at interface IFWebView (_IFPrivate)
-- (void *)_provisionalWidget;
- at end
-
@implementation IFDynamicScrollBarsView
// make the horizontal and vertical scroll bars come and go as needed
- (void) reflectScrolledClipView: (NSClipView*)clipView
{
- id cview = [self documentView];
+ id dview = [self documentView];
- // Do nothing if the web view is in the provisional state.
- if ([cview isKindOfClass: NSClassFromString (@"IFWebView")]){
- if ([cview _provisionalWidget] != 0){
- return;
- }
- }
-
if( clipView == [self contentView] ) {
BOOL scrollsVertically;
BOOL scrollsHorizontally;
-
- scrollsVertically = [[self documentView] bounds].size.height > [self frame].size.height;
- scrollsHorizontally = [[self documentView] bounds].size.width > [self frame].size.width;
-
+
+ scrollsVertically = [dview bounds].size.height > [self frame].size.height;
+ scrollsHorizontally = [dview bounds].size.width > [self frame].size.width;
+
[self setHasVerticalScroller: scrollsVertically];
[self setHasHorizontalScroller: scrollsHorizontally];
}
diff --git a/WebKit/WebView.subproj/IFWebFramePrivate.mm b/WebKit/WebView.subproj/IFWebFramePrivate.mm
index 18cc404..5ccc60d 100644
--- a/WebKit/WebView.subproj/IFWebFramePrivate.mm
+++ b/WebKit/WebView.subproj/IFWebFramePrivate.mm
@@ -172,10 +172,6 @@
[[self dataSource] _part]->end();
if ([[self controller] mainFrame] == self){
- if ([[[[self view] superview] superview] isKindOfClass: NSClassFromString (@"NSScrollView")]){
- [[[[self view] superview] superview] reflectScrolledClipView: [[self view] superview]];
- }
-
[[self view] setNeedsLayout: YES];
[[self view] layout];
[[self view] display];
diff --git a/WebKit/WebView.subproj/IFWebView.mm b/WebKit/WebView.subproj/IFWebView.mm
index c3e25a3..40e2f42 100644
--- a/WebKit/WebView.subproj/IFWebView.mm
+++ b/WebKit/WebView.subproj/IFWebView.mm
@@ -6,7 +6,6 @@
#import <WebKit/IFWebDataSource.h>
#import <WebKit/IFWebDataSourcePrivate.h>
#import <WebKit/IFBaseWebController.h>
-#import <WebKit/IFDynamicScrollBarsView.h>
#import <WebKit/IFException.h>
#import <WebKit/WebKitDebug.h>
@@ -118,6 +117,8 @@
widget->layout(TRUE);
//WebKitDebugAtLevel (WEBKIT_LOG_TIMING, "layout time %e\n", CFAbsoluteTimeGetCurrent() - start);
((IFWebViewPrivate *)_viewPrivate)->needsLayout = NO;
+ if ([self _frameScrollView])
+ [self _setupScrollers];
}
}
diff --git a/WebKit/WebView.subproj/IFWebViewPrivate.h b/WebKit/WebView.subproj/IFWebViewPrivate.h
index a33ee55..10947b3 100644
--- a/WebKit/WebView.subproj/IFWebViewPrivate.h
+++ b/WebKit/WebView.subproj/IFWebViewPrivate.h
@@ -20,7 +20,7 @@ class KHTMLView;
id <IFWebController>controller;
KHTMLView *widget;
KHTMLView *provisionalWidget;
- IFDynamicScrollBarsView *frameScrollView;
+ NSScrollView *frameScrollView;
bool isFlipped;
bool needsLayout;
}
@@ -34,6 +34,7 @@ class KHTMLView;
- (KHTMLView *)_provisionalWidget;
- (void)_stopPlugins;
- (void)_removeSubviews;
-- (void)_setFrameScrollView: (IFDynamicScrollBarsView *)sv;
-- (IFDynamicScrollBarsView *)_frameScrollView;
+- (void)_setFrameScrollView: (NSScrollView *)sv;
+- (NSScrollView *)_frameScrollView;
+- (void)_setupScrollers;
@end
diff --git a/WebKit/WebView.subproj/IFWebViewPrivate.mm b/WebKit/WebView.subproj/IFWebViewPrivate.mm
index f169861..8184364 100644
--- a/WebKit/WebView.subproj/IFWebViewPrivate.mm
+++ b/WebKit/WebView.subproj/IFWebViewPrivate.mm
@@ -104,7 +104,7 @@
}
-- (void)_setFrameScrollView: (IFDynamicScrollBarsView *)sv
+- (void)_setFrameScrollView: (NSScrollView *)sv
{
((IFWebViewPrivate *)_viewPrivate)->frameScrollView = [sv retain];
//[sv setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
@@ -114,9 +114,23 @@
[sv setDocumentView: self];
}
-- (IFDynamicScrollBarsView *)_frameScrollView
+- (NSScrollView *)_frameScrollView
{
return ((IFWebViewPrivate *)_viewPrivate)->frameScrollView;
}
+- (void)_setupScrollers
+{
+ BOOL scrollsVertically;
+ BOOL scrollsHorizontally;
+
+ scrollsVertically = [self bounds].size.height > [[self _frameScrollView] frame].size.height;
+ scrollsHorizontally = [self bounds].size.width > [[self _frameScrollView] frame].size.width;
+
+ [[self _frameScrollView] setHasVerticalScroller: scrollsVertically];
+ [[self _frameScrollView] setHasHorizontalScroller: scrollsHorizontally];
+}
+
+
+
@end
diff --git a/WebKit/WebView.subproj/WebDynamicScrollBarsView.m b/WebKit/WebView.subproj/WebDynamicScrollBarsView.m
index bd2555d..73e17dc 100644
--- a/WebKit/WebView.subproj/WebDynamicScrollBarsView.m
+++ b/WebKit/WebView.subproj/WebDynamicScrollBarsView.m
@@ -12,31 +12,20 @@
#import <WebKit/WebKitDebug.h>
- at interface IFWebView (_IFPrivate)
-- (void *)_provisionalWidget;
- at end
-
@implementation IFDynamicScrollBarsView
// make the horizontal and vertical scroll bars come and go as needed
- (void) reflectScrolledClipView: (NSClipView*)clipView
{
- id cview = [self documentView];
+ id dview = [self documentView];
- // Do nothing if the web view is in the provisional state.
- if ([cview isKindOfClass: NSClassFromString (@"IFWebView")]){
- if ([cview _provisionalWidget] != 0){
- return;
- }
- }
-
if( clipView == [self contentView] ) {
BOOL scrollsVertically;
BOOL scrollsHorizontally;
-
- scrollsVertically = [[self documentView] bounds].size.height > [self frame].size.height;
- scrollsHorizontally = [[self documentView] bounds].size.width > [self frame].size.width;
-
+
+ scrollsVertically = [dview bounds].size.height > [self frame].size.height;
+ scrollsHorizontally = [dview bounds].size.width > [self frame].size.width;
+
[self setHasVerticalScroller: scrollsVertically];
[self setHasHorizontalScroller: scrollsHorizontally];
}
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index 18cc404..5ccc60d 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -172,10 +172,6 @@
[[self dataSource] _part]->end();
if ([[self controller] mainFrame] == self){
- if ([[[[self view] superview] superview] isKindOfClass: NSClassFromString (@"NSScrollView")]){
- [[[[self view] superview] superview] reflectScrolledClipView: [[self view] superview]];
- }
-
[[self view] setNeedsLayout: YES];
[[self view] layout];
[[self view] display];
diff --git a/WebKit/WebView.subproj/WebFrameView.m b/WebKit/WebView.subproj/WebFrameView.m
index c3e25a3..40e2f42 100644
--- a/WebKit/WebView.subproj/WebFrameView.m
+++ b/WebKit/WebView.subproj/WebFrameView.m
@@ -6,7 +6,6 @@
#import <WebKit/IFWebDataSource.h>
#import <WebKit/IFWebDataSourcePrivate.h>
#import <WebKit/IFBaseWebController.h>
-#import <WebKit/IFDynamicScrollBarsView.h>
#import <WebKit/IFException.h>
#import <WebKit/WebKitDebug.h>
@@ -118,6 +117,8 @@
widget->layout(TRUE);
//WebKitDebugAtLevel (WEBKIT_LOG_TIMING, "layout time %e\n", CFAbsoluteTimeGetCurrent() - start);
((IFWebViewPrivate *)_viewPrivate)->needsLayout = NO;
+ if ([self _frameScrollView])
+ [self _setupScrollers];
}
}
diff --git a/WebKit/WebView.subproj/WebFrameViewInternal.h b/WebKit/WebView.subproj/WebFrameViewInternal.h
index a33ee55..10947b3 100644
--- a/WebKit/WebView.subproj/WebFrameViewInternal.h
+++ b/WebKit/WebView.subproj/WebFrameViewInternal.h
@@ -20,7 +20,7 @@ class KHTMLView;
id <IFWebController>controller;
KHTMLView *widget;
KHTMLView *provisionalWidget;
- IFDynamicScrollBarsView *frameScrollView;
+ NSScrollView *frameScrollView;
bool isFlipped;
bool needsLayout;
}
@@ -34,6 +34,7 @@ class KHTMLView;
- (KHTMLView *)_provisionalWidget;
- (void)_stopPlugins;
- (void)_removeSubviews;
-- (void)_setFrameScrollView: (IFDynamicScrollBarsView *)sv;
-- (IFDynamicScrollBarsView *)_frameScrollView;
+- (void)_setFrameScrollView: (NSScrollView *)sv;
+- (NSScrollView *)_frameScrollView;
+- (void)_setupScrollers;
@end
diff --git a/WebKit/WebView.subproj/WebFrameViewPrivate.h b/WebKit/WebView.subproj/WebFrameViewPrivate.h
index a33ee55..10947b3 100644
--- a/WebKit/WebView.subproj/WebFrameViewPrivate.h
+++ b/WebKit/WebView.subproj/WebFrameViewPrivate.h
@@ -20,7 +20,7 @@ class KHTMLView;
id <IFWebController>controller;
KHTMLView *widget;
KHTMLView *provisionalWidget;
- IFDynamicScrollBarsView *frameScrollView;
+ NSScrollView *frameScrollView;
bool isFlipped;
bool needsLayout;
}
@@ -34,6 +34,7 @@ class KHTMLView;
- (KHTMLView *)_provisionalWidget;
- (void)_stopPlugins;
- (void)_removeSubviews;
-- (void)_setFrameScrollView: (IFDynamicScrollBarsView *)sv;
-- (IFDynamicScrollBarsView *)_frameScrollView;
+- (void)_setFrameScrollView: (NSScrollView *)sv;
+- (NSScrollView *)_frameScrollView;
+- (void)_setupScrollers;
@end
diff --git a/WebKit/WebView.subproj/WebFrameViewPrivate.m b/WebKit/WebView.subproj/WebFrameViewPrivate.m
index f169861..8184364 100644
--- a/WebKit/WebView.subproj/WebFrameViewPrivate.m
+++ b/WebKit/WebView.subproj/WebFrameViewPrivate.m
@@ -104,7 +104,7 @@
}
-- (void)_setFrameScrollView: (IFDynamicScrollBarsView *)sv
+- (void)_setFrameScrollView: (NSScrollView *)sv
{
((IFWebViewPrivate *)_viewPrivate)->frameScrollView = [sv retain];
//[sv setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
@@ -114,9 +114,23 @@
[sv setDocumentView: self];
}
-- (IFDynamicScrollBarsView *)_frameScrollView
+- (NSScrollView *)_frameScrollView
{
return ((IFWebViewPrivate *)_viewPrivate)->frameScrollView;
}
+- (void)_setupScrollers
+{
+ BOOL scrollsVertically;
+ BOOL scrollsHorizontally;
+
+ scrollsVertically = [self bounds].size.height > [[self _frameScrollView] frame].size.height;
+ scrollsHorizontally = [self bounds].size.width > [[self _frameScrollView] frame].size.width;
+
+ [[self _frameScrollView] setHasVerticalScroller: scrollsVertically];
+ [[self _frameScrollView] setHasHorizontalScroller: scrollsHorizontally];
+}
+
+
+
@end
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list