[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 08:19:59 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit f20125469155b475f339ece79f10c3071b263ce2
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Dec 18 23:14:44 2003 +0000
WebKit:
Fixed 3511415. We have to un-visually order visually ordered text
before passing to ATSU.
Reviewed by John.
* WebCoreSupport.subproj/WebTextRenderer.m:
(reverseCharactersInRun):
(-[WebTextRenderer _ATSU_drawHighlightForRun:style:atPoint:]):
(-[WebTextRenderer _ATSU_drawRun:style:atPoint:]):
(-[WebTextRenderer _ATSU_pointToOffset:style:position:reversed:]):
WebCore:
Fixed 3511415. We have to un-visually order visually ordered text
before passing to ATSU.
Reviewed by John.
* khtml/rendering/font.cpp:
(Font::drawHighlightForText):
(Font::drawText):
* khtml/rendering/font.h:
* khtml/rendering/render_text.cpp:
(InlineTextBox::paintSelection):
(RenderText::paintObject):
* kwq/KWQPainter.h:
* kwq/KWQPainter.mm:
(QPainter::drawText):
(QPainter::drawHighlightForText):
* kwq/WebCoreTextRenderer.h:
* kwq/WebCoreTextRendererFactory.m:
(WebCoreInitializeEmptyTextStyle):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5830 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 5b0d5c0..5f292f6 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,25 @@
+2003-12-18 Richard Williamson <rjw at apple.com>
+
+ Fixed 3511415. We have to un-visually order visually ordered text
+ before passing to ATSU.
+
+ Reviewed by John.
+
+ * khtml/rendering/font.cpp:
+ (Font::drawHighlightForText):
+ (Font::drawText):
+ * khtml/rendering/font.h:
+ * khtml/rendering/render_text.cpp:
+ (InlineTextBox::paintSelection):
+ (RenderText::paintObject):
+ * kwq/KWQPainter.h:
+ * kwq/KWQPainter.mm:
+ (QPainter::drawText):
+ (QPainter::drawHighlightForText):
+ * kwq/WebCoreTextRenderer.h:
+ * kwq/WebCoreTextRendererFactory.m:
+ (WebCoreInitializeEmptyTextStyle):
+
2003-12-17 Richard Williamson <rjw at apple.com>
Reviewed by NOBODY (OOPS!).
diff --git a/WebCore/khtml/rendering/font.cpp b/WebCore/khtml/rendering/font.cpp
index 443611e..9dbd0b9 100644
--- a/WebCore/khtml/rendering/font.cpp
+++ b/WebCore/khtml/rendering/font.cpp
@@ -41,18 +41,18 @@ using namespace khtml;
#if APPLE_CHANGES
void Font::drawHighlightForText( 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
+ int toAdd, QPainter::TextDirection d, bool visuallyOrdered, int from, int to, QColor bg ) const
{
- p->drawHighlightForText(x, y, str + pos, std::min(slen - pos, len), from, to, toAdd, bg, d,
+ p->drawHighlightForText(x, y, str + pos, std::min(slen - pos, len), from, to, toAdd, bg, d, visuallyOrdered,
letterSpacing, wordSpacing, fontDef.smallCaps);
}
#endif
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
+ int toAdd, QPainter::TextDirection d, bool visuallyOrdered, int from, int to, QColor bg ) const
{
#if APPLE_CHANGES
- p->drawText(x, y, str + pos, std::min(slen - pos, len), from, to, toAdd, bg, d,
+ p->drawText(x, y, str + pos, std::min(slen - pos, len), from, to, toAdd, bg, d, visuallyOrdered,
letterSpacing, wordSpacing, fontDef.smallCaps);
#else
QString qstr = QConstString(str, slen).string();
diff --git a/WebCore/khtml/rendering/font.h b/WebCore/khtml/rendering/font.h
index f17ec9d..608c763 100644
--- a/WebCore/khtml/rendering/font.h
+++ b/WebCore/khtml/rendering/font.h
@@ -119,16 +119,19 @@ public:
void update( QPaintDeviceMetrics *devMetrics ) const;
+#if !APPLE_CHANGES
void drawText( QPainter *p, int x, int y, QChar *str, int slen, int pos, int len, int width,
QPainter::TextDirection d, int from=-1, int to=-1, QColor bg=QColor() ) const;
-#if APPLE_CHANGES
+#else
+ void drawText( QPainter *p, int x, int y, QChar *str, int slen, int pos, int len, int width,
+ QPainter::TextDirection d, bool visuallyOrdered = false, int from=-1, int to=-1, QColor bg=QColor() ) const;
float floatWidth( QChar *str, int slen, int pos, int len ) const;
void floatCharacterWidths( QChar *str, int slen, int pos, int len, int toAdd, float *buffer) const;
bool isFixedPitch() const;
int checkSelectionPoint (QChar *s, int slen, int pos, int len, int toAdd, int x, bool reversed) const;
void drawHighlightForText( QPainter *p, int x, int y, QChar *str, int slen, int pos, int len, int width,
- QPainter::TextDirection d, int from=-1, int to=-1, QColor bg=QColor() ) const;
+ QPainter::TextDirection d, bool visuallyOrdered = false, int from=-1, int to=-1, QColor bg=QColor() ) const;
#endif
int width( QChar *str, int slen, int pos, int len ) const;
int width( QChar *str, int slen, int pos ) const;
diff --git a/WebCore/khtml/rendering/render_text.cpp b/WebCore/khtml/rendering/render_text.cpp
index 8419ecb..ff3834c 100644
--- a/WebCore/khtml/rendering/render_text.cpp
+++ b/WebCore/khtml/rendering/render_text.cpp
@@ -97,9 +97,14 @@ void InlineTextBox::paintSelection(const Font *f, RenderText *text, QPainter *p,
#endif
ty += m_baseline;
+#if APPLE_CHANGES
//kdDebug( 6040 ) << "InlineTextBox::painting(" << s.string() << ") at(" << x+_tx << "/" << y+_ty << ")" << endl;
f->drawHighlightForText(p, m_x + tx, m_y + ty, text->str->s, text->str->l, m_start, m_len,
+ m_toAdd, m_reversed ? QPainter::RTL : QPainter::LTR, style->visuallyOrdered(), startPos, endPos, c);
+#else
+ f->drawHighlightForText(p, m_x + tx, m_y + ty, text->str->s, text->str->l, m_start, m_len,
m_toAdd, m_reversed ? QPainter::RTL : QPainter::LTR, startPos, endPos, c);
+#endif
p->restore();
}
@@ -696,9 +701,15 @@ void RenderText::paintObject(QPainter *p, int /*x*/, int y, int /*w*/, int h,
}
if (!paintSelectedTextOnly && !paintSelectedTextSeparately) {
+#if APPLE_CHANGES
+ font->drawText(p, s->m_x + tx, s->m_y + ty + s->m_baseline,
+ str->s, str->l, s->m_start, s->m_len,
+ s->m_toAdd, s->m_reversed ? QPainter::RTL : QPainter::LTR, style()->visuallyOrdered());
+#else
font->drawText(p, s->m_x + tx, s->m_y + ty + s->m_baseline,
str->s, str->l, s->m_start, s->m_len,
s->m_toAdd, s->m_reversed ? QPainter::RTL : QPainter::LTR);
+#endif
}
else {
int offset = s->m_start;
@@ -706,18 +717,36 @@ void RenderText::paintObject(QPainter *p, int /*x*/, int y, int /*w*/, int h,
int ePos = QMIN( endPos - offset, s->m_len );
if (paintSelectedTextSeparately) {
if (sPos >= ePos)
+#if APPLE_CHANGES
+ font->drawText(p, s->m_x + tx, s->m_y + ty + s->m_baseline,
+ str->s, str->l, s->m_start, s->m_len,
+ s->m_toAdd, s->m_reversed ? QPainter::RTL : QPainter::LTR, style()->visuallyOrdered());
+#else
font->drawText(p, s->m_x + tx, s->m_y + ty + s->m_baseline,
str->s, str->l, s->m_start, s->m_len,
s->m_toAdd, s->m_reversed ? QPainter::RTL : QPainter::LTR);
+#endif
else {
if (sPos-1 >= 0)
+#if APPLE_CHANGES
+ font->drawText(p, s->m_x + tx, s->m_y + ty + s->m_baseline, str->s,
+ str->l, s->m_start, s->m_len,
+ s->m_toAdd, s->m_reversed ? QPainter::RTL : QPainter::LTR, style()->visuallyOrdered(), 0, sPos);
+#else
font->drawText(p, s->m_x + tx, s->m_y + ty + s->m_baseline, str->s,
str->l, s->m_start, s->m_len,
s->m_toAdd, s->m_reversed ? QPainter::RTL : QPainter::LTR, 0, sPos);
+#endif
if (ePos < s->m_start+s->m_len)
+#if APPLE_CHANGES
+ font->drawText(p, s->m_x + tx, s->m_y + ty + s->m_baseline, str->s,
+ str->l, s->m_start, s->m_len,
+ s->m_toAdd, s->m_reversed ? QPainter::RTL : QPainter::LTR, style()->visuallyOrdered(), ePos, -1);
+#else
font->drawText(p, s->m_x + tx, s->m_y + ty + s->m_baseline, str->s,
str->l, s->m_start, s->m_len,
s->m_toAdd, s->m_reversed ? QPainter::RTL : QPainter::LTR, ePos, -1);
+#endif
}
}
@@ -732,9 +761,17 @@ void RenderText::paintObject(QPainter *p, int /*x*/, int y, int /*w*/, int h,
selectionTextShadow->blur,
selectionTextShadow->color);
#endif
+
+#if APPLE_CHANGES
+ font->drawText(p, s->m_x + tx, s->m_y + ty + s->m_baseline, str->s,
+ str->l, s->m_start, s->m_len,
+ s->m_toAdd, s->m_reversed ? QPainter::RTL : QPainter::LTR, style()->visuallyOrdered(), sPos, ePos);
+#else
font->drawText(p, s->m_x + tx, s->m_y + ty + s->m_baseline, str->s,
str->l, s->m_start, s->m_len,
s->m_toAdd, s->m_reversed ? QPainter::RTL : QPainter::LTR, sPos, ePos);
+#endif
+
#if APPLE_CHANGES
if (selectionTextShadow)
p->clearShadow();
diff --git a/WebCore/kwq/KWQPainter.h b/WebCore/kwq/KWQPainter.h
index 14256fb..8febdae 100644
--- a/WebCore/kwq/KWQPainter.h
+++ b/WebCore/kwq/KWQPainter.h
@@ -95,10 +95,10 @@ public:
void drawText(int x, int y, int, int, int alignmentFlags, const QString &);
void drawHighlightForText(int x, int y, const QChar *, int length, int from, int to, int toAdd,
- const QColor& backgroundColor, QPainter::TextDirection d,
+ const QColor& backgroundColor, QPainter::TextDirection d, bool visuallyOrdered,
int letterSpacing, int wordSpacing, bool smallCaps);
void drawText(int x, int y, const QChar *, int length, int from, int to, int toAdd,
- const QColor& backgroundColor, QPainter::TextDirection d,
+ const QColor& backgroundColor, QPainter::TextDirection d, bool visuallyOrdered,
int letterSpacing, int wordSpacing, bool smallCaps);
void drawLineForText(int x, int y, int yOffset, int width);
diff --git a/WebCore/kwq/KWQPainter.mm b/WebCore/kwq/KWQPainter.mm
index f4904a1..fcd01af 100644
--- a/WebCore/kwq/KWQPainter.mm
+++ b/WebCore/kwq/KWQPainter.mm
@@ -509,7 +509,7 @@ void QPainter::drawText(int x, int y, int, int, int alignmentFlags, const QStrin
[data->textRenderer drawRun:&run style:&style atPoint:NSMakePoint(x, y)];
}
-void QPainter::drawText(int x, int y, const QChar *str, int len, int from, int to, int toAdd, const QColor &backgroundColor, QPainter::TextDirection d, int letterSpacing, int wordSpacing, bool smallCaps)
+void QPainter::drawText(int x, int y, const QChar *str, int len, int from, int to, int toAdd, const QColor &backgroundColor, QPainter::TextDirection d, bool visuallyOrdered, int letterSpacing, int wordSpacing, bool smallCaps)
{
if (data->state.paintingDisabled || len <= 0)
return;
@@ -532,6 +532,7 @@ void QPainter::drawText(int x, int y, const QChar *str, int len, int from, int t
style.textColor = data->state.pen.color().getNSColor();
style.backgroundColor = backgroundColor.isValid() ? backgroundColor.getNSColor() : nil;
style.rtl = d == RTL ? true : false;
+ style.visuallyOrdered = visuallyOrdered;
style.letterSpacing = letterSpacing;
style.wordSpacing = wordSpacing;
style.smallCaps = smallCaps;
@@ -541,7 +542,7 @@ void QPainter::drawText(int x, int y, const QChar *str, int len, int from, int t
[data->textRenderer drawRun:&run style:&style atPoint:NSMakePoint(x, y)];
}
-void QPainter::drawHighlightForText(int x, int y, const QChar *str, int len, int from, int to, int toAdd, const QColor &backgroundColor, QPainter::TextDirection d, int letterSpacing, int wordSpacing, bool smallCaps)
+void QPainter::drawHighlightForText(int x, int y, const QChar *str, int len, int from, int to, int toAdd, const QColor &backgroundColor, QPainter::TextDirection d, bool visuallyOrdered, int letterSpacing, int wordSpacing, bool smallCaps)
{
if (data->state.paintingDisabled || len <= 0)
return;
@@ -564,6 +565,7 @@ void QPainter::drawHighlightForText(int x, int y, const QChar *str, int len, int
style.textColor = data->state.pen.color().getNSColor();
style.backgroundColor = backgroundColor.isValid() ? backgroundColor.getNSColor() : nil;
style.rtl = d == RTL ? true : false;
+ style.visuallyOrdered = visuallyOrdered;
style.letterSpacing = letterSpacing;
style.wordSpacing = wordSpacing;
style.smallCaps = smallCaps;
diff --git a/WebCore/kwq/WebCoreTextRenderer.h b/WebCore/kwq/WebCoreTextRenderer.h
index 562c78e..6cbbd5c 100644
--- a/WebCore/kwq/WebCoreTextRenderer.h
+++ b/WebCore/kwq/WebCoreTextRenderer.h
@@ -39,6 +39,7 @@ struct WebCoreTextStyle
NSString **families;
unsigned smallCaps:1;
unsigned rtl:1;
+ unsigned visuallyOrdered:1;
unsigned applyRounding:1;
unsigned attemptFontSubstitution:1;
};
diff --git a/WebCore/kwq/WebCoreTextRendererFactory.m b/WebCore/kwq/WebCoreTextRendererFactory.m
index 8edddbd..5220f1f 100644
--- a/WebCore/kwq/WebCoreTextRendererFactory.m
+++ b/WebCore/kwq/WebCoreTextRendererFactory.m
@@ -42,6 +42,7 @@ inline void WebCoreInitializeEmptyTextStyle(WebCoreTextStyle *style)
style->textColor = nil;
style->backgroundColor = nil;
style->rtl = false;
+ style->visuallyOrdered = false;
style->letterSpacing = 0;
style->wordSpacing = 0;
style->smallCaps = false;
diff --git a/WebCore/kwq/WebCoreTextRendererFactory.mm b/WebCore/kwq/WebCoreTextRendererFactory.mm
index 8edddbd..5220f1f 100644
--- a/WebCore/kwq/WebCoreTextRendererFactory.mm
+++ b/WebCore/kwq/WebCoreTextRendererFactory.mm
@@ -42,6 +42,7 @@ inline void WebCoreInitializeEmptyTextStyle(WebCoreTextStyle *style)
style->textColor = nil;
style->backgroundColor = nil;
style->rtl = false;
+ style->visuallyOrdered = false;
style->letterSpacing = 0;
style->wordSpacing = 0;
style->smallCaps = false;
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 7f0cad9..57c7385 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,16 @@
+2003-12-18 Richard Williamson <rjw at apple.com>
+
+ Fixed 3511415. We have to un-visually order visually ordered text
+ before passing to ATSU.
+
+ Reviewed by John.
+
+ * WebCoreSupport.subproj/WebTextRenderer.m:
+ (reverseCharactersInRun):
+ (-[WebTextRenderer _ATSU_drawHighlightForRun:style:atPoint:]):
+ (-[WebTextRenderer _ATSU_drawRun:style:atPoint:]):
+ (-[WebTextRenderer _ATSU_pointToOffset:style:position:reversed:]):
+
2003-12-17 Richard Williamson <rjw at apple.com>
Fixed 3503011 (really, this time). Always use integer width for '-' and '?', as we do for spaces, to ensure that 'words' (as defined by out rounding hack) start on integer boundaries.
diff --git a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
index 15ea015..65e5b68 100644
--- a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
@@ -1424,6 +1424,23 @@ static const char *joiningNames[] = {
return width;
}
+// Be sure to free the run.characters allocated by this function.
+static WebCoreTextRun reverseCharactersInRun(const WebCoreTextRun *run)
+{
+ WebCoreTextRun swappedRun;
+ unsigned int i;
+
+ UniChar *swappedCharacters = (UniChar *)malloc(sizeof(UniChar)*run->length);
+ for (i = 0; i < run->length; i++) {
+ swappedCharacters[i] = run->characters[run->length-i-1];
+ }
+ swappedRun.characters = swappedCharacters;
+ swappedRun.from = run->length - (run->to == -1 ? (int)run->length : run->to);
+ swappedRun.to = run->length - (run->from == -1 ? 0 : run->from);
+ swappedRun.length = run->length;
+
+ return swappedRun;
+}
- (void)_ATSU_drawHighlightForRun:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style atPoint:(NSPoint)point
{
@@ -1432,13 +1449,21 @@ static const char *joiningNames[] = {
// _trapezoidForRun:. These are all exception-safe.
ATSUTextLayout layout;
- int from = run->from;
- int to = run->to;
+ int from, to;
float selectedLeftX;
+ const WebCoreTextRun *aRun = run;
+ WebCoreTextRun swappedRun;
if (style->backgroundColor == nil)
return;
+ if (style->visuallyOrdered) {
+ swappedRun = reverseCharactersInRun(run);
+ aRun = &swappedRun;
+ }
+
+ from = aRun->from;
+ to = aRun->to;
if (from == -1)
from = 0;
if (to == -1)
@@ -1449,9 +1474,9 @@ static const char *joiningNames[] = {
return;
}
- layout = [self _createATSUTextLayoutForRun:run];
+ layout = [self _createATSUTextLayoutForRun:aRun];
- WebCoreTextRun leadingRun = *run;
+ WebCoreTextRun leadingRun = *aRun;
leadingRun.from = 0;
leadingRun.to = run->from;
@@ -1474,9 +1499,9 @@ static const char *joiningNames[] = {
float yPos = point.y - [self ascent];
if (style->rtl){
- WebCoreTextRun completeRun = *run;
+ WebCoreTextRun completeRun = *aRun;
completeRun.from = 0;
- completeRun.to = run->length;
+ completeRun.to = aRun->length;
float completeRunWidth = [self floatWidthForRun:&completeRun style:style widths:0];
[NSBezierPath fillRect:NSMakeRect(point.x + completeRunWidth - (selectedLeftX-point.x) - backgroundWidth, yPos, backgroundWidth, [self lineSpacing])];
}
@@ -1485,6 +1510,9 @@ static const char *joiningNames[] = {
}
ATSUDisposeTextLayout (layout); // Ignore the error. Nothing we can do anyway.
+
+ if (style->visuallyOrdered)
+ free ((void *)swappedRun.characters);
}
@@ -1496,19 +1524,27 @@ static const char *joiningNames[] = {
ATSUTextLayout layout;
OSStatus status;
- int from = run->from;
- int to = run->to;
+ int from, to;
+ const WebCoreTextRun *aRun = run;
+ WebCoreTextRun swappedRun;
+ if (style->visuallyOrdered) {
+ swappedRun = reverseCharactersInRun(run);
+ aRun = &swappedRun;
+ }
+
+ from = aRun->from;
+ to = aRun->to;
if (from == -1)
from = 0;
if (to == -1)
to = run->length;
-
+
int runLength = to - from;
if (runLength <= 0)
return;
- layout = [self _createATSUTextLayoutForRun:run];
+ layout = [self _createATSUTextLayoutForRun:aRun];
if (style->backgroundColor != nil)
[self _ATSU_drawHighlightForRun:run style:style atPoint:point];
@@ -1516,7 +1552,7 @@ static const char *joiningNames[] = {
[style->textColor set];
status = ATSUDrawText(layout,
- from,
+ aRun->from,
runLength,
FloatToFixed(point.x), // these values are
FloatToFixed(point.y)); // also of type Fixed
@@ -1526,6 +1562,9 @@ static const char *joiningNames[] = {
}
ATSUDisposeTextLayout (layout); // Ignore the error. Nothing we can do anyway.
+
+ if (style->visuallyOrdered)
+ free ((void *)swappedRun.characters);
}
- (int)_ATSU_pointToOffset:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style position:(int)x reversed:(BOOL)reversed
@@ -1539,16 +1578,26 @@ static const char *joiningNames[] = {
UniCharArrayOffset secondaryOffset = 0;
OSStatus status;
Boolean isLeading;
+ const WebCoreTextRun *aRun = run;
+ WebCoreTextRun swappedRun;
+
+ if (style->visuallyOrdered) {
+ swappedRun = reverseCharactersInRun(run);
+ aRun = &swappedRun;
+ }
- layout = [self _createATSUTextLayoutForRun:run];
+ layout = [self _createATSUTextLayoutForRun:aRun];
- status = ATSUPositionToOffset(layout, FloatToFixed(x), 1, &primaryOffset, &isLeading, &secondaryOffset);
+ status = ATSUPositionToOffset(layout, FloatToFixed(x), FloatToFixed(-1), &primaryOffset, &isLeading, &secondaryOffset);
if (status == noErr){
offset = (unsigned)primaryOffset;
}
else {
// Failed to find offset! Return 0 offset.
}
+
+ if (style->visuallyOrdered)
+ free ((void *)swappedRun.characters);
return offset;
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list