aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dw/image.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/dw/image.cc b/dw/image.cc
index d302d362..d753a0f2 100644
--- a/dw/image.cc
+++ b/dw/image.cc
@@ -199,14 +199,19 @@ void Image::sizeRequestImpl (core::Requisition *requisition)
// TODO Check again possible overflows. (Aren't buffer
// dimensions limited to 2^15?)
- if (getStyle()->width == core::style::LENGTH_AUTO &&
- getStyle()->height != core::style::LENGTH_AUTO) {
+ bool widthSpecified = getStyle()->width != core::style::LENGTH_AUTO ||
+ getStyle()->minWidth != core::style::LENGTH_AUTO ||
+ getStyle()->maxWidth != core::style::LENGTH_AUTO;
+ bool heightSpecified = getStyle()->height != core::style::LENGTH_AUTO ||
+ getStyle()->minHeight != core::style::LENGTH_AUTO ||
+ getStyle()->maxHeight != core::style::LENGTH_AUTO;
+
+ if (!widthSpecified && heightSpecified)
requisition->width =
(requisition->ascent + requisition->descent - boxDiffHeight ())
* buffer->getRootWidth () / buffer->getRootHeight ()
+ boxDiffWidth ();
- } else if (getStyle()->width != core::style::LENGTH_AUTO &&
- getStyle()->height == core::style::LENGTH_AUTO) {
+ else if (widthSpecified && !heightSpecified) {
requisition->ascent = (requisition->width + boxDiffWidth ())
* buffer->getRootHeight () / buffer->getRootWidth ()
+ boxOffsetY ();