aboutsummaryrefslogtreecommitdiff
path: root/dw/image.cc
diff options
context:
space:
mode:
Diffstat (limited to 'dw/image.cc')
-rw-r--r--dw/image.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/dw/image.cc b/dw/image.cc
index 9dc6d6ee..df8b6e83 100644
--- a/dw/image.cc
+++ b/dw/image.cc
@@ -217,8 +217,18 @@ void Image::sizeRequestImpl (core::Requisition *requisition)
void Image::getExtremesImpl (core::Extremes *extremes)
{
- extremes->minWidth = extremes->maxWidth =
- (buffer ? buffer->getRootWidth () : 0) + boxDiffWidth ();
+ int width = (buffer ? buffer->getRootWidth () : 0) + boxDiffWidth ();
+
+ // With percentage width, the image may be narrower than the buffer.
+ extremes->minWidth =
+ core::style::isPerLength (getStyle()->width) ? boxDiffWidth () : width;
+
+ // (We ignore the same effect for the maximal width.)
+ extremes->maxWidth = width;
+
+ extremes->minWidthIntrinsic = extremes->minWidth;
+ extremes->maxWidthIntrinsic = extremes->maxWidth;
+
correctExtremes (extremes);
}