[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
hyatt
hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:51:53 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit be5f16abbe9cd54de84451152a30c584d0a6587a
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Jul 20 21:54:13 2004 +0000
Fix for alt text not working on images.
Reviewed by john
* khtml/rendering/render_image.cpp:
(RenderImage::RenderImage):
(RenderImage::setPixmap):
(RenderImage::paint):
(RenderImage::calcReplacedWidth):
(RenderImage::calcReplacedHeight):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@7069 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 8bcdfaa..77164e7 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,16 @@
+2004-07-20 David Hyatt <hyatt at apple.com>
+
+ Fix for alt text not working on images.
+
+ Reviewed by john
+
+ * khtml/rendering/render_image.cpp:
+ (RenderImage::RenderImage):
+ (RenderImage::setPixmap):
+ (RenderImage::paint):
+ (RenderImage::calcReplacedWidth):
+ (RenderImage::calcReplacedHeight):
+
2004-07-20 Maciej Stachowiak <mjs at apple.com>
Reviewed by Dave.
diff --git a/WebCore/khtml/rendering/render_image.cpp b/WebCore/khtml/rendering/render_image.cpp
index c89c128..db232cd 100644
--- a/WebCore/khtml/rendering/render_image.cpp
+++ b/WebCore/khtml/rendering/render_image.cpp
@@ -58,6 +58,8 @@ RenderImage::RenderImage(NodeImpl *_node)
setIntrinsicWidth( 0 );
setIntrinsicHeight( 0 );
+ if (element())
+ updateAltText();
}
RenderImage::~RenderImage()
@@ -101,11 +103,11 @@ void RenderImage::setPixmap( const QPixmap &p, const QRect& r, CachedImage *o)
bool iwchanged = false;
if(o->isErrorImage()) {
- int iw = p.width() + 8;
- int ih = p.height() + 8;
+ int iw = p.width() + 4;
+ int ih = p.height() + 4;
// we have an alt and the user meant it (its not a text we invented)
- if ( element() && !alt.isEmpty() && !element()->getAttribute( ATTR_ALT ).isNull()) {
+ if (!alt.isEmpty()) {
const QFontMetrics &fm = style()->fontMetrics();
QRect br = fm.boundingRect ( 0, 0, 1024, 256, Qt::AlignAuto|Qt::WordBreak, alt.string() );
if ( br.width() > iw )
@@ -278,11 +280,10 @@ void RenderImage::paint(PaintInfo& i, int _tx, int _ty)
bool errorPictureDrawn = false;
int imageX = 0, imageY = 0;
- int usableWidth = cWidth - leftBorder - borderRight() - leftPad - paddingRight();
- int usableHeight = cHeight - topBorder - borderBottom() - topPad - paddingBottom();
+ int usableWidth = cWidth;
+ int usableHeight = cHeight;
- if(berrorPic && !pix.isNull() && (usableWidth >= pix.width()) && (usableHeight >= pix.height()) )
- {
+ if (berrorPic && !pix.isNull() && (usableWidth >= pix.width()) && (usableHeight >= pix.height())) {
// Center the error image, accounting for border and padding.
int centerX = (usableWidth - pix.width())/2;
if (centerX < 0)
@@ -292,11 +293,11 @@ void RenderImage::paint(PaintInfo& i, int _tx, int _ty)
centerY = 0;
imageX = leftBorder + leftPad + centerX;
imageY = topBorder + topPad + centerY;
- p->drawPixmap( QPoint(_tx + imageX, _ty + imageY), pix, pix.rect() );
+ p->drawPixmap(QPoint(_tx + imageX, _ty + imageY), pix, pix.rect());
errorPictureDrawn = true;
}
- if(!alt.isEmpty()) {
+ if (!alt.isEmpty()) {
QString text = alt.string();
text.replace('\\', backslashAsCurrencySymbol());
p->setFont (style()->font());
@@ -309,11 +310,11 @@ void RenderImage::paint(PaintInfo& i, int _tx, int _ty)
// Only draw the alt text if it'll fit within the content box,
// and only if it fits above the error image.
int textWidth = fm.width (text, text.length());
- if (errorPictureDrawn){
- if (usableWidth > textWidth && fm.height() <= imageY)
+ if (errorPictureDrawn) {
+ if (usableWidth >= textWidth && fm.height() <= imageY)
p->drawText(ax, ay+ascent, 0 /* ignored */, 0 /* ignored */, Qt::WordBreak /* not supported */, text );
}
- else if (usableWidth >= textWidth && cHeight>=fm.height())
+ else if (usableWidth >= textWidth && cHeight >= fm.height())
p->drawText(ax, ay+ascent, 0 /* ignored */, 0 /* ignored */, Qt::WordBreak /* not supported */, text );
}
#else /* not APPLE_CHANGES */
@@ -605,9 +606,10 @@ int RenderImage::calcReplacedWidth() const
{
// If height is specified and not width, preserve aspect ratio.
if (isHeightSpecified() && !isWidthSpecified()) {
- if (intrinsicHeight() == 0){
+ if (intrinsicHeight() == 0)
return 0;
- }
+ if (!image || image->isErrorImage())
+ return intrinsicWidth(); // Don't bother scaling.
return calcReplacedHeight() * intrinsicWidth() / intrinsicHeight();
}
return RenderReplaced::calcReplacedWidth();
@@ -617,9 +619,10 @@ int RenderImage::calcReplacedHeight() const
{
// If width is specified and not height, preserve aspect ratio.
if (isWidthSpecified() && !isHeightSpecified()) {
- if (intrinsicWidth() == 0){
+ if (intrinsicWidth() == 0)
return 0;
- }
+ if (!image || image->isErrorImage())
+ return intrinsicHeight(); // Don't bother scaling.
return calcReplacedWidth() * intrinsicHeight() / intrinsicWidth();
}
return RenderReplaced::calcReplacedHeight();
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list