diff options
author | Sebastian Geerken <devnull@localhost> | 2014-09-08 12:11:51 +0200 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2014-09-08 12:11:51 +0200 |
commit | 323af89027eb1ffbd56a4fd918edcc1d654450e2 (patch) | |
tree | 2ec6ec377d7f2de2549f9c6503b5f56a41555eac /dw/image.cc | |
parent | be5481d52f8df319708b776a1e2a0d1db3a044a7 (diff) |
Consider 'alt' text for image extremes.
Diffstat (limited to 'dw/image.cc')
-rw-r--r-- | dw/image.cc | 15 |
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 = |