Bug 1818432 - Provide intrinsic size from theme for xul images that are themed but don't have any images. r=tnikkel,layout-reviewers
This restores previous behavior of <xul:image>. Differential Revision: https://phabricator.services.mozilla.com/D170743
This commit is contained in:
@@ -475,11 +475,18 @@ void nsImageFrame::DidSetComputedStyle(ComputedStyle* aOldStyle) {
|
||||
//
|
||||
// TODO(emilio): We might want to do the same for regular list-style-image or
|
||||
// even simple content: url() changes.
|
||||
if (mKind == Kind::XULImage &&
|
||||
!mContent->AsElement()->HasAttr(nsGkAtoms::src) && aOldStyle &&
|
||||
aOldStyle->StyleList()->mListStyleImage != StyleList()->mListStyleImage) {
|
||||
if (mKind == Kind::XULImage) {
|
||||
if (!mContent->AsElement()->HasAttr(nsGkAtoms::src) && aOldStyle &&
|
||||
aOldStyle->StyleList()->mListStyleImage !=
|
||||
StyleList()->mListStyleImage) {
|
||||
UpdateXULImage();
|
||||
}
|
||||
if (!mOwnedRequest && aOldStyle &&
|
||||
aOldStyle->StyleDisplay()->EffectiveAppearance() !=
|
||||
StyleDisplay()->EffectiveAppearance()) {
|
||||
UpdateIntrinsicSize();
|
||||
}
|
||||
}
|
||||
|
||||
// We need to update our orientation either if we had no ComputedStyle before
|
||||
// because this is the first time it's been set, or if the image-orientation
|
||||
@@ -778,6 +785,17 @@ static IntrinsicSize ComputeIntrinsicSize(imgIContainer* aImage,
|
||||
IntrinsicSize(defaultLength, defaultLength), aFrame);
|
||||
}
|
||||
|
||||
if (aKind == nsImageFrame::Kind::XULImage && aFrame.IsThemed()) {
|
||||
nsPresContext* pc = aFrame.PresContext();
|
||||
// FIXME: const_cast here is a bit evil but IsThemed and so does the same.
|
||||
const auto widgetSize = pc->Theme()->GetMinimumWidgetSize(
|
||||
pc, const_cast<nsImageFrame*>(&aFrame),
|
||||
aFrame.StyleDisplay()->EffectiveAppearance());
|
||||
const IntrinsicSize intrinsicSize(
|
||||
LayoutDeviceIntSize::ToAppUnits(widgetSize, pc->AppUnitsPerDevPixel()));
|
||||
return containAxes.ContainIntrinsicSize(intrinsicSize, aFrame);
|
||||
}
|
||||
|
||||
if (aFrame.ShouldShowBrokenImageIcon()) {
|
||||
nscoord edgeLengthToUse = nsPresContext::CSSPixelsToAppUnits(
|
||||
ICON_SIZE + (2 * (ICON_PADDING + ALT_BORDER_WIDTH)));
|
||||
|
||||
@@ -95,7 +95,7 @@ div div { background: blue; display: inline; float: left; }
|
||||
src="image4x3.png" style="box-sizing: border-box; width: 96px; height: 76px; padding: 8px;"/><html:img
|
||||
src="image4x3.png" style="box-sizing: border-box; width: 112px; height: 88px; padding: 8px;"/><html:img
|
||||
width="0" height="0" style="border: 1px solid green" /><html:img
|
||||
width="0" height="0" style="border: 1px solid green" />
|
||||
width="0" height="0" style="border: 1px solid green" /><html:span style="display: inline-block; -moz-default-appearance: checkbox; appearance: auto" />
|
||||
</html:div>
|
||||
|
||||
</window>
|
||||
|
||||
@@ -92,6 +92,7 @@
|
||||
<image src="image4x3.png" style="min-width: 112px; min-height: 76px; padding: 8px;"/>
|
||||
<image id="dyn-1" src="image4x3.png" style="border: 1px solid green"/>
|
||||
<image id="dyn-2" style="list-style-image: url(image4x3.png); border: 1px solid green"/>
|
||||
<image style="-moz-default-appearance: checkbox; appearance: auto"/>
|
||||
</hbox>
|
||||
<script>
|
||||
window.addEventListener("load", function() {
|
||||
|
||||
Reference in New Issue
Block a user