mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-04 22:37:29 +09:00
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
This commit is contained in:
parent
1ee66d0a5f
commit
be1f68f39e
17 changed files with 381 additions and 143 deletions
|
|
@ -470,6 +470,17 @@ CSS_PROP_DISPLAY(
|
|||
kAppearanceKTable,
|
||||
CSS_PROP_NO_OFFSET,
|
||||
eStyleAnimType_Discrete)
|
||||
CSS_PROP_POSITION(
|
||||
aspect-ratio,
|
||||
aspect_ratio,
|
||||
AspectRatio,
|
||||
CSS_PROPERTY_INTERNAL |
|
||||
CSS_PROPERTY_PARSE_INACCESSIBLE,
|
||||
"",
|
||||
VARIANT_NUMBER,
|
||||
nullptr,
|
||||
offsetof(nsStylePosition, mAspectRatio),
|
||||
eStyleAnimType_None)
|
||||
CSS_PROP_DISPLAY(
|
||||
backface-visibility,
|
||||
backface_visibility,
|
||||
|
|
|
|||
|
|
@ -8544,6 +8544,12 @@ nsRuleNode::ComputePositionData(void* aStartStruct,
|
|||
SETCOORD_UNSET_INITIAL,
|
||||
aContext, mPresContext, conditions);
|
||||
|
||||
// aspect-ratio: float, initial
|
||||
SetFactor(*aRuleData->ValueForAspectRatio(),
|
||||
pos->mAspectRatio, conditions,
|
||||
parentPos->mAspectRatio, 0.0f,
|
||||
SETFCT_UNSET_INITIAL | SETFCT_POSITIVE | SETFCT_NONE);
|
||||
|
||||
// box-sizing: enum, inherit, initial
|
||||
SetValue(*aRuleData->ValueForBoxSizing(),
|
||||
pos->mBoxSizing, conditions,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1815,6 +1815,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStylePosition
|
|||
nsStyleCoord mGridAutoColumnsMax; // [reset] coord, percent, enum, calc, flex
|
||||
nsStyleCoord mGridAutoRowsMin; // [reset] coord, percent, enum, calc, flex
|
||||
nsStyleCoord mGridAutoRowsMax; // [reset] coord, percent, enum, calc, flex
|
||||
float mAspectRatio; // [reset] float
|
||||
uint8_t mGridAutoFlow; // [reset] enumerated. See nsStyleConsts.h
|
||||
mozilla::StyleBoxSizing mBoxSizing; // [reset] see nsStyleConsts.h
|
||||
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ const char *gInaccessibleProperties[] = {
|
|||
"-x-span",
|
||||
"-x-system-font",
|
||||
"-x-text-zoom",
|
||||
"aspect-ratio", // for now.
|
||||
"-moz-control-character-visibility",
|
||||
"-moz-script-level", // parsed by UA sheets only
|
||||
"-moz-script-size-multiplier",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue