Bug 1485581 - Makes nsImageFrame::GetMinISize and nsImageFrame::GetPrefISize "writing-mode responsive" r?dholbert
MozReview-Commit-ID: G3S4sfW6j9r
--- a/layout/generic/nsFrame.h
+++ b/layout/generic/nsFrame.h
@@ -849,18 +849,24 @@ public:
};
#define DISPLAY_REFLOW(dr_pres_context, dr_frame, dr_rf_state, dr_rf_metrics, dr_rf_status) \
DR_cookie dr_cookie(dr_pres_context, dr_frame, dr_rf_state, dr_rf_metrics, dr_rf_status);
#define DISPLAY_REFLOW_CHANGE() \
dr_cookie.Change();
#define DISPLAY_LAYOUT(dr_frame) \
DR_layout_cookie dr_cookie(dr_frame);
+// FIXME This macro(as well as the struct in the macro content) should go
+// through a renaming refactoring to reflect the fact that it's actually
+// displaying a minimum inline size, not a minimum width.
#define DISPLAY_MIN_WIDTH(dr_frame, dr_result) \
DR_intrinsic_width_cookie dr_cookie(dr_frame, "Min", dr_result)
+// FIXME This macro(as well as the struct in the macro content) should go
+// through a renaming refactoring to reflect the fact that it's actually
+// displaying a preferred inline size, not a preferred width.
#define DISPLAY_PREF_WIDTH(dr_frame, dr_result) \
DR_intrinsic_width_cookie dr_cookie(dr_frame, "Pref", dr_result)
#define DISPLAY_PREF_SIZE(dr_frame, dr_result) \
DR_intrinsic_size_cookie dr_cookie(dr_frame, "Pref", dr_result)
#define DISPLAY_MIN_SIZE(dr_frame, dr_result) \
DR_intrinsic_size_cookie dr_cookie(dr_frame, "Min", dr_result)
#define DISPLAY_MAX_SIZE(dr_frame, dr_result) \
DR_intrinsic_size_cookie dr_cookie(dr_frame, "Max", dr_result)
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -1029,36 +1029,36 @@ nsImageFrame::GetContinuationOffset() co
}
NS_ASSERTION(offset >= 0, "bogus GetContentRect");
return offset;
}
/* virtual */ nscoord
nsImageFrame::GetMinISize(gfxContext *aRenderingContext)
{
- // XXX The caller doesn't account for constraints of the height,
- // min-height, and max-height properties.
DebugOnly<nscoord> result;
DISPLAY_MIN_WIDTH(this, result);
EnsureIntrinsicSizeAndRatio();
- return mIntrinsicSize.width.GetUnit() == eStyleUnit_Coord ?
- mIntrinsicSize.width.GetCoordValue() : 0;
+ MOZ_ASSERT(this->GetParent());
+ const nsStyleCoord& iSize = this->GetParent()->GetWritingMode().IsVertical() ?
+ mIntrinsicSize.height : mIntrinsicSize.width;
+ return iSize.GetUnit() == eStyleUnit_Coord ? iSize.GetCoordValue() : 0;
}
/* virtual */ nscoord
nsImageFrame::GetPrefISize(gfxContext *aRenderingContext)
{
- // XXX The caller doesn't account for constraints of the height,
- // min-height, and max-height properties.
DebugOnly<nscoord> result;
DISPLAY_PREF_WIDTH(this, result);
EnsureIntrinsicSizeAndRatio();
+ MOZ_ASSERT(this->GetParent());
+ const nsStyleCoord& iSize = this->GetParent()->GetWritingMode().IsVertical() ?
+ mIntrinsicSize.height : mIntrinsicSize.width;
// convert from normal twips to scaled twips (printing...)
- return mIntrinsicSize.width.GetUnit() == eStyleUnit_Coord ?
- mIntrinsicSize.width.GetCoordValue() : 0;
+ return iSize.GetUnit() == eStyleUnit_Coord ? iSize.GetCoordValue() : 0;
}
/* virtual */ IntrinsicSize
nsImageFrame::GetIntrinsicSize()
{
return mIntrinsicSize;
}