1
1
/*
2
2
* Copyright (C) 1999 Lars Knoll ([email protected] )
3
3
* (C) 1999 Antti Koivisto ([email protected] )
4
- * Copyright (C) 2003-2023 Apple Inc. All rights reserved.
4
+ * Copyright (C) 2003-2024 Apple Inc. All rights reserved.
5
5
*
6
6
* This library is free software; you can redistribute it and/or
7
7
* modify it under the terms of the GNU Library General Public
@@ -143,8 +143,8 @@ static LayoutUnit marginWidthForChild(RenderBox* child)
143
143
// A margin basically has three types: fixed, percentage, and auto (variable).
144
144
// Auto and percentage margins simply become 0 when computing min/max width.
145
145
// Fixed margins can be added in as is.
146
- Length marginLeft = child->style ().marginLeft ();
147
- Length marginRight = child->style ().marginRight ();
146
+ auto & marginLeft = child->style ().marginLeft ();
147
+ auto & marginRight = child->style ().marginRight ();
148
148
LayoutUnit margin;
149
149
if (marginLeft.isFixed ())
150
150
margin += marginLeft.value ();
@@ -1088,11 +1088,12 @@ LayoutUnit RenderDeprecatedFlexibleBox::allowedChildFlex(RenderBox* child, bool
1088
1088
// FIXME: For now just handle fixed values.
1089
1089
LayoutUnit maxWidth = LayoutUnit::max ();
1090
1090
LayoutUnit width = contentWidthForChild (child);
1091
- if (!child->style ().maxWidth ().isUndefined () && child->style ().maxWidth ().isFixed ())
1092
- maxWidth = child->style ().maxWidth ().value ();
1093
- else if (child->style ().maxWidth ().type () == LengthType::Intrinsic)
1091
+ auto & maxWidthLength = child->style ().maxWidth ();
1092
+ if (!maxWidthLength.isUndefined () && maxWidthLength.isFixed ())
1093
+ maxWidth = maxWidthLength.value ();
1094
+ else if (maxWidthLength.type () == LengthType::Intrinsic)
1094
1095
maxWidth = child->maxPreferredLogicalWidth ();
1095
- else if (child-> style (). maxWidth () .isMinIntrinsic ())
1096
+ else if (maxWidthLength .isMinIntrinsic ())
1096
1097
maxWidth = child->minPreferredLogicalWidth ();
1097
1098
if (maxWidth == LayoutUnit::max ())
1098
1099
return maxWidth;
@@ -1101,8 +1102,9 @@ LayoutUnit RenderDeprecatedFlexibleBox::allowedChildFlex(RenderBox* child, bool
1101
1102
// FIXME: For now just handle fixed values.
1102
1103
LayoutUnit maxHeight = LayoutUnit::max ();
1103
1104
LayoutUnit height = contentHeightForChild (child);
1104
- if (!child->style ().maxHeight ().isUndefined () && child->style ().maxHeight ().isFixed ())
1105
- maxHeight = child->style ().maxHeight ().value ();
1105
+ auto & maxHeigthLength = child->style ().maxHeight ();
1106
+ if (!maxHeigthLength.isUndefined () && maxHeigthLength.isFixed ())
1107
+ maxHeight = maxHeigthLength.value ();
1106
1108
if (maxHeight == LayoutUnit::max ())
1107
1109
return maxHeight;
1108
1110
return std::max<LayoutUnit>(0 , maxHeight - height);
@@ -1113,19 +1115,20 @@ LayoutUnit RenderDeprecatedFlexibleBox::allowedChildFlex(RenderBox* child, bool
1113
1115
if (isHorizontal ()) {
1114
1116
LayoutUnit minWidth = child->minPreferredLogicalWidth ();
1115
1117
LayoutUnit width = contentWidthForChild (child);
1116
- if (child->style ().minWidth ().isFixed ())
1117
- minWidth = child->style ().minWidth ().value ();
1118
- else if (child->style ().minWidth ().type () == LengthType::Intrinsic)
1118
+ auto & minWidthLength = child->style ().minWidth ();
1119
+ if (minWidthLength.isFixed ())
1120
+ minWidth = minWidthLength.value ();
1121
+ else if (minWidthLength.type () == LengthType::Intrinsic)
1119
1122
minWidth = child->maxPreferredLogicalWidth ();
1120
- else if (child-> style (). minWidth () .isMinIntrinsic ())
1123
+ else if (minWidthLength .isMinIntrinsic ())
1121
1124
minWidth = child->minPreferredLogicalWidth ();
1122
- else if (child-> style (). minWidth () .isAuto ())
1125
+ else if (minWidthLength .isAuto ())
1123
1126
minWidth = 0 ;
1124
1127
1125
1128
LayoutUnit allowedShrinkage = std::min<LayoutUnit>(0 , minWidth - width);
1126
1129
return allowedShrinkage;
1127
1130
} else {
1128
- Length minHeight = child->style ().minHeight ();
1131
+ auto & minHeight = child->style ().minHeight ();
1129
1132
if (minHeight.isFixed () || minHeight.isAuto ()) {
1130
1133
LayoutUnit minHeight { child->style ().minHeight ().value () };
1131
1134
LayoutUnit height = contentHeightForChild (child);
0 commit comments