aboutsummaryrefslogtreecommitdiff
path: root/dw/image.cc
diff options
context:
space:
mode:
Diffstat (limited to 'dw/image.cc')
-rw-r--r--dw/image.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/dw/image.cc b/dw/image.cc
index ded8d205..20460f33 100644
--- a/dw/image.cc
+++ b/dw/image.cc
@@ -239,7 +239,20 @@ void Image::sizeRequestImpl (core::Requisition *requisition)
void Image::getExtremesImpl (core::Extremes *extremes)
{
- int width = (buffer ? buffer->getRootWidth () : 0) + boxDiffWidth ();
+ int contentWidth;
+ if (buffer)
+ contentWidth =buffer->getRootWidth ();
+ else {
+ if (altText && altText[0]) {
+ if (altTextWidth == -1)
+ altTextWidth =
+ layout->textWidth (getStyle()->font, altText, strlen (altText));
+ contentWidth = altTextWidth;
+ } else
+ contentWidth = 0;
+ }
+
+ int width = contentWidth + + boxDiffWidth ();
// With percentage width, the image may be narrower than the buffer.
extremes->minWidth =