[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:54:00 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 050dcb5abb8c5abc8e7621b8fe90592bac53cc06
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Jan 10 03:38:15 2002 +0000
iFinally fixed underlining, HONEST!
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@534 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 68d2027..5448470 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,14 @@
+2002-01-09 Richard Williamson <rjw at apple.com>
+
+ Re-implemented underlining. Now it REALLY works, honest.
+
+ * src/kdelibs/khtml/rendering/render_text.cpp: (TextSlave::printDecoration):
+ * src/kwq/KWQFontMetrics.mm: (+[KWQLayoutInfo
+ drawUnderlineForString:atPoint:withFont:color:]):
+ * src/kwq/KWQMetrics.h:
+ * src/kwq/KWQPainter.mm: (QPainter::drawUnderlineForText):
+ * src/kwq/qt/qpainter.h:
+
2001-12-20 Richard Williamson <rjw at apple.com>
More tweaks to text layout and underlining.
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 68d2027..5448470 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,14 @@
+2002-01-09 Richard Williamson <rjw at apple.com>
+
+ Re-implemented underlining. Now it REALLY works, honest.
+
+ * src/kdelibs/khtml/rendering/render_text.cpp: (TextSlave::printDecoration):
+ * src/kwq/KWQFontMetrics.mm: (+[KWQLayoutInfo
+ drawUnderlineForString:atPoint:withFont:color:]):
+ * src/kwq/KWQMetrics.h:
+ * src/kwq/KWQPainter.mm: (QPainter::drawUnderlineForText):
+ * src/kwq/qt/qpainter.h:
+
2001-12-20 Richard Williamson <rjw at apple.com>
More tweaks to text layout and underlining.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 68d2027..5448470 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,14 @@
+2002-01-09 Richard Williamson <rjw at apple.com>
+
+ Re-implemented underlining. Now it REALLY works, honest.
+
+ * src/kdelibs/khtml/rendering/render_text.cpp: (TextSlave::printDecoration):
+ * src/kwq/KWQFontMetrics.mm: (+[KWQLayoutInfo
+ drawUnderlineForString:atPoint:withFont:color:]):
+ * src/kwq/KWQMetrics.h:
+ * src/kwq/KWQPainter.mm: (QPainter::drawUnderlineForText):
+ * src/kwq/qt/qpainter.h:
+
2001-12-20 Richard Williamson <rjw at apple.com>
More tweaks to text layout and underlining.
diff --git a/WebCore/khtml/rendering/render_text.cpp b/WebCore/khtml/rendering/render_text.cpp
index 87508ac..193607b 100644
--- a/WebCore/khtml/rendering/render_text.cpp
+++ b/WebCore/khtml/rendering/render_text.cpp
@@ -114,7 +114,7 @@ void TextSlave::printDecoration( QPainter *pt, RenderText* p, int _tx, int _ty,
#ifdef _KWQ_
- int underlineOffset = pt->fontMetrics().baselineOffset() + 2;
+ //int underlineOffset = pt->fontMetrics().baselineOffset() + 2;
#else
int underlineOffset = ( pt->fontMetrics().height() + m_baseline ) / 2;
if(underlineOffset <= m_baseline) underlineOffset = m_baseline+1;
@@ -122,7 +122,12 @@ void TextSlave::printDecoration( QPainter *pt, RenderText* p, int _tx, int _ty,
if(deco & UNDERLINE){
//fprintf (stderr, "UNDERLINE (%d, %d) to (%d, %d)\n", _tx, _ty + underlineOffset, _tx + width, _ty + underlineOffset );
+#ifdef _KWQ_
+ QConstString s(m_text, m_len);
+ pt->drawUnderlineForText(_tx, _ty + m_baseline, s.string());
+#else
pt->drawLine(_tx, _ty + underlineOffset, _tx + width, _ty + underlineOffset );
+#endif
//pt->drawLine(_tx, _ty, _tx + width, _ty );
//pt->drawLine(_tx, _ty + pt->fontMetrics().height(), _tx + width, _ty + pt->fontMetrics().height() );
}
diff --git a/WebCore/kwq/KWQFontMetrics.mm b/WebCore/kwq/KWQFontMetrics.mm
index 556a4ba..d7d0bc5 100644
--- a/WebCore/kwq/KWQFontMetrics.mm
+++ b/WebCore/kwq/KWQFontMetrics.mm
@@ -97,6 +97,20 @@ static NSMutableDictionary *metricsCache = nil;
}
}
++ (void)drawUnderlineForString: (NSString *)string atPoint: (NSPoint)p withFont: (NSFont *)font color: (NSColor *)color
+{
+ KWQLayoutInfo *metricsCache = [KWQLayoutInfo getMetricsForFont: font];
+ NSLayoutManager *layoutManager = [metricsCache layoutManagerForString: string];
+ if (layoutManager != nil){
+ unsigned numberOfGlyphs = [layoutManager numberOfGlyphs];
+ [metricsCache setColor: color];
+ [metricsCache setFont: font];
+ [KWQTextStorage setString: string attributes: [metricsCache attributes]];
+ NSRect lineRect = [layoutManager lineFragmentRectForGlyphAtIndex: 0 effectiveRange: 0];
+ [layoutManager underlineGlyphRange:NSMakeRange (0, numberOfGlyphs) underlineType:NSSingleUnderlineStyle lineFragmentRect:lineRect lineFragmentGlyphRange:NSMakeRange (0, numberOfGlyphs) containerOrigin:p];
+ }
+}
+
+ (KWQLayoutInfo *)getMetricsForFont: (NSFont *)aFont
{
diff --git a/WebCore/kwq/KWQMetrics.h b/WebCore/kwq/KWQMetrics.h
index 7c2722e..c8f65f1 100644
--- a/WebCore/kwq/KWQMetrics.h
+++ b/WebCore/kwq/KWQMetrics.h
@@ -34,6 +34,7 @@
}
+ (void)drawString: (NSString *)string atPoint: (NSPoint)p withFont: (NSFont *)font color: (NSColor *)color;
++ (void)drawUnderlineForString: (NSString *)string atPoint: (NSPoint)p withFont: (NSFont *)font color: (NSColor *)color;
+ (KWQLayoutInfo *)getMetricsForFont: (NSFont *)aFont;
+ (void)setMetric: (KWQLayoutInfo *)info forFont: (NSFont *)aFont;
- initWithFont: (NSFont *)aFont;
diff --git a/WebCore/kwq/KWQPainter.h b/WebCore/kwq/KWQPainter.h
index 0a08ccf..5632abd 100644
--- a/WebCore/kwq/KWQPainter.h
+++ b/WebCore/kwq/KWQPainter.h
@@ -174,6 +174,10 @@ public:
// private ---------------------------------------------------------------------
+#ifdef _KWQ_
+ void drawUnderlineForText(int x, int y, const QString &, int len=-1);
+#endif
+
private:
// no copying or assignment
// note that these are "standard" (no pendantic stuff needed)
diff --git a/WebCore/kwq/KWQPainter.mm b/WebCore/kwq/KWQPainter.mm
index 8b6c93e..8fe6197 100644
--- a/WebCore/kwq/KWQPainter.mm
+++ b/WebCore/kwq/KWQPainter.mm
@@ -511,6 +511,27 @@ void QPainter::drawText(int x, int y, const QString &qstring, int len)
_unlockFocus();
}
+void QPainter::drawUnderlineForText(int x, int y, const QString &qstring, int len)
+{
+ NSString *string;
+ NSFont *font;
+
+ _lockFocus();
+
+ //font = data->qfont.data->font;
+ font = data->qfont.font;
+
+ if (len == -1)
+ string = QSTRING_TO_NSSTRING(qstring);
+ else
+ string = QSTRING_TO_NSSTRING_LENGTH(qstring,len);
+
+ y = y - (ROUND_TO_INT([font defaultLineHeightForFont]) - FLOOR_TO_INT(-[font descender]));
+ [KWQLayoutInfo drawUnderlineForString: string atPoint: NSMakePoint(x, y) withFont: font color: data->qpen.color().color];
+
+ _unlockFocus();
+}
+
void QPainter::drawText(int x, int y, int w, int h, int flags, const QString&qstring, int len,
QRect *br, char **internal)
diff --git a/WebCore/kwq/qt/qpainter.h b/WebCore/kwq/qt/qpainter.h
index 0a08ccf..5632abd 100644
--- a/WebCore/kwq/qt/qpainter.h
+++ b/WebCore/kwq/qt/qpainter.h
@@ -174,6 +174,10 @@ public:
// private ---------------------------------------------------------------------
+#ifdef _KWQ_
+ void drawUnderlineForText(int x, int y, const QString &, int len=-1);
+#endif
+
private:
// no copying or assignment
// note that these are "standard" (no pendantic stuff needed)
diff --git a/WebCore/src/kdelibs/khtml/rendering/render_text.cpp b/WebCore/src/kdelibs/khtml/rendering/render_text.cpp
index 87508ac..193607b 100644
--- a/WebCore/src/kdelibs/khtml/rendering/render_text.cpp
+++ b/WebCore/src/kdelibs/khtml/rendering/render_text.cpp
@@ -114,7 +114,7 @@ void TextSlave::printDecoration( QPainter *pt, RenderText* p, int _tx, int _ty,
#ifdef _KWQ_
- int underlineOffset = pt->fontMetrics().baselineOffset() + 2;
+ //int underlineOffset = pt->fontMetrics().baselineOffset() + 2;
#else
int underlineOffset = ( pt->fontMetrics().height() + m_baseline ) / 2;
if(underlineOffset <= m_baseline) underlineOffset = m_baseline+1;
@@ -122,7 +122,12 @@ void TextSlave::printDecoration( QPainter *pt, RenderText* p, int _tx, int _ty,
if(deco & UNDERLINE){
//fprintf (stderr, "UNDERLINE (%d, %d) to (%d, %d)\n", _tx, _ty + underlineOffset, _tx + width, _ty + underlineOffset );
+#ifdef _KWQ_
+ QConstString s(m_text, m_len);
+ pt->drawUnderlineForText(_tx, _ty + m_baseline, s.string());
+#else
pt->drawLine(_tx, _ty + underlineOffset, _tx + width, _ty + underlineOffset );
+#endif
//pt->drawLine(_tx, _ty, _tx + width, _ty );
//pt->drawLine(_tx, _ty + pt->fontMetrics().height(), _tx + width, _ty + pt->fontMetrics().height() );
}
diff --git a/WebCore/src/kwq/KWQFontMetrics.mm b/WebCore/src/kwq/KWQFontMetrics.mm
index 556a4ba..d7d0bc5 100644
--- a/WebCore/src/kwq/KWQFontMetrics.mm
+++ b/WebCore/src/kwq/KWQFontMetrics.mm
@@ -97,6 +97,20 @@ static NSMutableDictionary *metricsCache = nil;
}
}
++ (void)drawUnderlineForString: (NSString *)string atPoint: (NSPoint)p withFont: (NSFont *)font color: (NSColor *)color
+{
+ KWQLayoutInfo *metricsCache = [KWQLayoutInfo getMetricsForFont: font];
+ NSLayoutManager *layoutManager = [metricsCache layoutManagerForString: string];
+ if (layoutManager != nil){
+ unsigned numberOfGlyphs = [layoutManager numberOfGlyphs];
+ [metricsCache setColor: color];
+ [metricsCache setFont: font];
+ [KWQTextStorage setString: string attributes: [metricsCache attributes]];
+ NSRect lineRect = [layoutManager lineFragmentRectForGlyphAtIndex: 0 effectiveRange: 0];
+ [layoutManager underlineGlyphRange:NSMakeRange (0, numberOfGlyphs) underlineType:NSSingleUnderlineStyle lineFragmentRect:lineRect lineFragmentGlyphRange:NSMakeRange (0, numberOfGlyphs) containerOrigin:p];
+ }
+}
+
+ (KWQLayoutInfo *)getMetricsForFont: (NSFont *)aFont
{
diff --git a/WebCore/src/kwq/KWQMetrics.h b/WebCore/src/kwq/KWQMetrics.h
index 7c2722e..c8f65f1 100644
--- a/WebCore/src/kwq/KWQMetrics.h
+++ b/WebCore/src/kwq/KWQMetrics.h
@@ -34,6 +34,7 @@
}
+ (void)drawString: (NSString *)string atPoint: (NSPoint)p withFont: (NSFont *)font color: (NSColor *)color;
++ (void)drawUnderlineForString: (NSString *)string atPoint: (NSPoint)p withFont: (NSFont *)font color: (NSColor *)color;
+ (KWQLayoutInfo *)getMetricsForFont: (NSFont *)aFont;
+ (void)setMetric: (KWQLayoutInfo *)info forFont: (NSFont *)aFont;
- initWithFont: (NSFont *)aFont;
diff --git a/WebCore/src/kwq/KWQPainter.mm b/WebCore/src/kwq/KWQPainter.mm
index 8b6c93e..8fe6197 100644
--- a/WebCore/src/kwq/KWQPainter.mm
+++ b/WebCore/src/kwq/KWQPainter.mm
@@ -511,6 +511,27 @@ void QPainter::drawText(int x, int y, const QString &qstring, int len)
_unlockFocus();
}
+void QPainter::drawUnderlineForText(int x, int y, const QString &qstring, int len)
+{
+ NSString *string;
+ NSFont *font;
+
+ _lockFocus();
+
+ //font = data->qfont.data->font;
+ font = data->qfont.font;
+
+ if (len == -1)
+ string = QSTRING_TO_NSSTRING(qstring);
+ else
+ string = QSTRING_TO_NSSTRING_LENGTH(qstring,len);
+
+ y = y - (ROUND_TO_INT([font defaultLineHeightForFont]) - FLOOR_TO_INT(-[font descender]));
+ [KWQLayoutInfo drawUnderlineForString: string atPoint: NSMakePoint(x, y) withFont: font color: data->qpen.color().color];
+
+ _unlockFocus();
+}
+
void QPainter::drawText(int x, int y, int w, int h, int flags, const QString&qstring, int len,
QRect *br, char **internal)
diff --git a/WebCore/src/kwq/qt/qpainter.h b/WebCore/src/kwq/qt/qpainter.h
index 0a08ccf..5632abd 100644
--- a/WebCore/src/kwq/qt/qpainter.h
+++ b/WebCore/src/kwq/qt/qpainter.h
@@ -174,6 +174,10 @@ public:
// private ---------------------------------------------------------------------
+#ifdef _KWQ_
+ void drawUnderlineForText(int x, int y, const QString &, int len=-1);
+#endif
+
private:
// no copying or assignment
// note that these are "standard" (no pendantic stuff needed)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list