aboutsummaryrefslogtreecommitdiff
path: root/dw/image.cc
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2014-09-10 12:26:44 +0200
committerSebastian Geerken <devnull@localhost>2014-09-10 12:26:44 +0200
commit5b50f9e319263a730843be1aae5dfd7c549e1622 (patch)
treeec0ce2e00c11e7d6d95d187f5002219bb1b9296f /dw/image.cc
parent02a6942a42619ad31ae0ea0b2f8b4f6e17ae3272 (diff)
parentafe572a3dcac774dd90684f1328dd480bfe7db97 (diff)
Merge with main repo.
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 =