summaryrefslogtreecommitdiffstats
path: root/layout/style/nsStyleStruct.cpp
diff options
context:
space:
mode:
authorAndy <webmaster@RealityRipple.com>2020-08-04 13:54:01 -0700
committerAndy <webmaster@RealityRipple.com>2020-08-04 13:56:45 -0700
commit3ed884a6adff46cb5871508612832ab8691752ac (patch)
tree8325a71298a455591729769b2c6d015e2af77748 /layout/style/nsStyleStruct.cpp
parent267d32f4f3360bb583486391d3d9cb620458c5f0 (diff)
downloadUXP-3ed884a6adff46cb5871508612832ab8691752ac.tar
UXP-3ed884a6adff46cb5871508612832ab8691752ac.tar.gz
UXP-3ed884a6adff46cb5871508612832ab8691752ac.tar.lz
UXP-3ed884a6adff46cb5871508612832ab8691752ac.tar.xz
UXP-3ed884a6adff46cb5871508612832ab8691752ac.zip
Issue #1620 - Use Intrinsic Aspect Ratio for Images
https://bugzilla.mozilla.org/show_bug.cgi?id=1547231 https://bugzilla.mozilla.org/show_bug.cgi?id=1559094 https://bugzilla.mozilla.org/show_bug.cgi?id=1633434 https://bugzilla.mozilla.org/show_bug.cgi?id=1565690 https://bugzilla.mozilla.org/show_bug.cgi?id=1602047 Make use of Aspect Ratios in Image frames before Images are loaded. - Check for width and height HTML properties and create a ratio with them. - Overwrite HTML size values with actual image dimensions on load. - Collapse any frames with srcless images. Comments: dom/html/nsGenericHTMLElement.cpp:1483 layout/generic/nsImageFrame.cpp:289
Diffstat (limited to 'layout/style/nsStyleStruct.cpp')
-rw-r--r--layout/style/nsStyleStruct.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp
index 9270f2960..3b19a4418 100644
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -1408,6 +1408,7 @@ nsStylePosition::nsStylePosition(StyleStructContext aContext)
, mGridAutoColumnsMax(eStyleUnit_Auto)
, mGridAutoRowsMin(eStyleUnit_Auto)
, mGridAutoRowsMax(eStyleUnit_Auto)
+ , mAspectRatio(0.0f)
, mGridAutoFlow(NS_STYLE_GRID_AUTO_FLOW_ROW)
, mBoxSizing(StyleBoxSizing::Content)
, mAlignContent(NS_STYLE_ALIGN_NORMAL)
@@ -1466,6 +1467,7 @@ nsStylePosition::nsStylePosition(const nsStylePosition& aSource)
, mGridAutoColumnsMax(aSource.mGridAutoColumnsMax)
, mGridAutoRowsMin(aSource.mGridAutoRowsMin)
, mGridAutoRowsMax(aSource.mGridAutoRowsMax)
+ , mAspectRatio(aSource.mAspectRatio)
, mGridAutoFlow(aSource.mGridAutoFlow)
, mBoxSizing(aSource.mBoxSizing)
, mAlignContent(aSource.mAlignContent)
@@ -1636,6 +1638,11 @@ nsStylePosition::CalcDifference(const nsStylePosition& aNewData,
if (isVertical ? heightChanged : widthChanged) {
hint |= nsChangeHint_ReflowHintsForISizeChange;
}
+
+ if (mAspectRatio != aNewData.mAspectRatio) {
+ hint |= nsChangeHint_ReflowHintsForISizeChange |
+ nsChangeHint_ReflowHintsForBSizeChange;
+ }
} else {
if (widthChanged || heightChanged) {
hint |= nsChangeHint_NeutralChange;