Skip to content

Commit 5e67d2a

Browse files
committed
Fix assertions triggered by CSS calc changes in r166860
https://bugs.webkit.org/show_bug.cgi?id=131346 Reviewed by Andrei Bucur. * css/CSSComputedStyleDeclaration.cpp: (WebCore::getBorderRadiusCornerValues): Use isPercentNotCalculated() instead of type() == Percent; no behavior change. (WebCore::getBorderRadiusCornerValue): Ditto. (WebCore::lineHeightFromStyle): Use isPercentNotCalculated() before code that calls percent(), which won't work for a calculated length. * css/DeprecatedStyleBuilder.cpp: (WebCore::ApplyPropertyBorderRadius::applyValue): Use isNegative and isZero rather than calling value() unconditionally. Should make calculated values work better. * html/HTMLPlugInImageElement.cpp: (WebCore::is100Percent): Use isPercentNotCalculated() before code that calls percent(), which won't work for a calculated length. * platform/Length.cpp: (WebCore::CalculationValueMap::deref): Use adoptRef here instead of calling deref immediately, so the deref will happen after calling remove. This makes the code work properly even if it's reentered inside the calculation value's destructor. * platform/Length.h: (WebCore::Length::percent): Change assert to isPercentNotCalculated, since the value function this calls only works for non-calculated values anyway. (WebCore::Length::isPercentNotCalculated): Added. (WebCore::Length::isPercent): Changed to call isPercentNotCalculated. (WebCore::Length::isSpecified): Changed to call isPercent. * platform/graphics/transforms/TranslateTransformOperation.h: (WebCore::TranslateTransformOperation::apply): Use isPercentNotCalculated() instead of type() == Percent; no behavior change. * rendering/AutoTableLayout.cpp: (WebCore::AutoTableLayout::recalcColumn): Use isPercentNotCalculated() before code that calls value() or percent(), which won't work for a calculated length. (WebCore::AutoTableLayout::computeIntrinsicLogicalWidths): Ditto. (WebCore::AutoTableLayout::calcEffectiveLogicalWidth): Ditto. (WebCore::AutoTableLayout::layout): Ditto. * rendering/FixedTableLayout.cpp: (WebCore::FixedTableLayout::layout): Ditto. * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::calculateImageIntrinsicDimensions): Ditto. * rendering/RenderTableSection.cpp: (WebCore::updateLogicalHeightForCell): Ditto. (WebCore::RenderTableSection::distributeExtraLogicalHeightToPercentRows): Ditto. (WebCore::RenderTableSection::distributeExtraLogicalHeightToRows): Ditto. * rendering/style/RenderStyle.cpp: (WebCore::requireTransformOrigin): Use modern for loop. Also marked function static, since it's private to this file. (WebCore::RenderStyle::applyTransform): Use isPercentNotCalculated() instead of type() == Percent; no behavior change. Also use a modern for loop and auto& to avoid a really long type name. * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::computeIntrinsicRatioInformation): Use isPercentNotCalculated() before code that calls percent(), which won't work for a calculated length. * platform/Length.h: (WebCore::Length::percent): (WebCore::Length::isPercentNotCalculated): (WebCore::Length::isPercent): (WebCore::Length::isSpecified): * platform/graphics/transforms/TranslateTransformOperation.h: (WebCore::TranslateTransformOperation::apply): * rendering/AutoTableLayout.cpp: (WebCore::AutoTableLayout::recalcColumn): (WebCore::AutoTableLayout::computeIntrinsicLogicalWidths): (WebCore::AutoTableLayout::calcEffectiveLogicalWidth): (WebCore::AutoTableLayout::layout): * rendering/FixedTableLayout.cpp: (WebCore::FixedTableLayout::layout): * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::calculateImageIntrinsicDimensions): * rendering/RenderTableSection.cpp: (WebCore::updateLogicalHeightForCell): (WebCore::RenderTableSection::distributeExtraLogicalHeightToPercentRows): (WebCore::RenderTableSection::distributeExtraLogicalHeightToRows): * rendering/style/RenderStyle.cpp: (WebCore::requireTransformOrigin): (WebCore::RenderStyle::applyTransform): * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::computeIntrinsicRatioInformation): Canonical link: https://commits.webkit.org/149405@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166920 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent b1dbca2 commit 5e67d2a

13 files changed

Lines changed: 153 additions & 62 deletions

Source/WebCore/ChangeLog

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,93 @@
1+
2014-04-08 Darin Adler <darin@apple.com>
2+
3+
Fix assertions triggered by CSS calc changes in r166860
4+
https://bugs.webkit.org/show_bug.cgi?id=131346
5+
6+
Reviewed by Andrei Bucur.
7+
8+
* css/CSSComputedStyleDeclaration.cpp:
9+
(WebCore::getBorderRadiusCornerValues): Use isPercentNotCalculated() instead of
10+
type() == Percent; no behavior change.
11+
(WebCore::getBorderRadiusCornerValue): Ditto.
12+
(WebCore::lineHeightFromStyle): Use isPercentNotCalculated() before code
13+
that calls percent(), which won't work for a calculated length.
14+
15+
* css/DeprecatedStyleBuilder.cpp:
16+
(WebCore::ApplyPropertyBorderRadius::applyValue): Use isNegative and isZero rather
17+
than calling value() unconditionally. Should make calculated values work better.
18+
19+
* html/HTMLPlugInImageElement.cpp:
20+
(WebCore::is100Percent): Use isPercentNotCalculated() before code
21+
that calls percent(), which won't work for a calculated length.
22+
23+
* platform/Length.cpp:
24+
(WebCore::CalculationValueMap::deref): Use adoptRef here instead of calling deref
25+
immediately, so the deref will happen after calling remove. This makes the code
26+
work properly even if it's reentered inside the calculation value's destructor.
27+
28+
* platform/Length.h:
29+
(WebCore::Length::percent): Change assert to isPercentNotCalculated, since the
30+
value function this calls only works for non-calculated values anyway.
31+
(WebCore::Length::isPercentNotCalculated): Added.
32+
(WebCore::Length::isPercent): Changed to call isPercentNotCalculated.
33+
(WebCore::Length::isSpecified): Changed to call isPercent.
34+
35+
* platform/graphics/transforms/TranslateTransformOperation.h:
36+
(WebCore::TranslateTransformOperation::apply): Use isPercentNotCalculated()
37+
instead of type() == Percent; no behavior change.
38+
39+
* rendering/AutoTableLayout.cpp:
40+
(WebCore::AutoTableLayout::recalcColumn): Use isPercentNotCalculated()
41+
before code that calls value() or percent(), which won't work for a calculated length.
42+
(WebCore::AutoTableLayout::computeIntrinsicLogicalWidths): Ditto.
43+
(WebCore::AutoTableLayout::calcEffectiveLogicalWidth): Ditto.
44+
(WebCore::AutoTableLayout::layout): Ditto.
45+
* rendering/FixedTableLayout.cpp:
46+
(WebCore::FixedTableLayout::layout): Ditto.
47+
* rendering/RenderBoxModelObject.cpp:
48+
(WebCore::RenderBoxModelObject::calculateImageIntrinsicDimensions): Ditto.
49+
* rendering/RenderTableSection.cpp:
50+
(WebCore::updateLogicalHeightForCell): Ditto.
51+
(WebCore::RenderTableSection::distributeExtraLogicalHeightToPercentRows): Ditto.
52+
(WebCore::RenderTableSection::distributeExtraLogicalHeightToRows): Ditto.
53+
54+
* rendering/style/RenderStyle.cpp:
55+
(WebCore::requireTransformOrigin): Use modern for loop. Also marked function static,
56+
since it's private to this file.
57+
(WebCore::RenderStyle::applyTransform): Use isPercentNotCalculated() instead of
58+
type() == Percent; no behavior change. Also use a modern for loop and auto& to avoid
59+
a really long type name.
60+
61+
* rendering/svg/RenderSVGRoot.cpp:
62+
(WebCore::RenderSVGRoot::computeIntrinsicRatioInformation): Use isPercentNotCalculated()
63+
before code that calls percent(), which won't work for a calculated length.
64+
65+
* platform/Length.h:
66+
(WebCore::Length::percent):
67+
(WebCore::Length::isPercentNotCalculated):
68+
(WebCore::Length::isPercent):
69+
(WebCore::Length::isSpecified):
70+
* platform/graphics/transforms/TranslateTransformOperation.h:
71+
(WebCore::TranslateTransformOperation::apply):
72+
* rendering/AutoTableLayout.cpp:
73+
(WebCore::AutoTableLayout::recalcColumn):
74+
(WebCore::AutoTableLayout::computeIntrinsicLogicalWidths):
75+
(WebCore::AutoTableLayout::calcEffectiveLogicalWidth):
76+
(WebCore::AutoTableLayout::layout):
77+
* rendering/FixedTableLayout.cpp:
78+
(WebCore::FixedTableLayout::layout):
79+
* rendering/RenderBoxModelObject.cpp:
80+
(WebCore::RenderBoxModelObject::calculateImageIntrinsicDimensions):
81+
* rendering/RenderTableSection.cpp:
82+
(WebCore::updateLogicalHeightForCell):
83+
(WebCore::RenderTableSection::distributeExtraLogicalHeightToPercentRows):
84+
(WebCore::RenderTableSection::distributeExtraLogicalHeightToRows):
85+
* rendering/style/RenderStyle.cpp:
86+
(WebCore::requireTransformOrigin):
87+
(WebCore::RenderStyle::applyTransform):
88+
* rendering/svg/RenderSVGRoot.cpp:
89+
(WebCore::RenderSVGRoot::computeIntrinsicRatioInformation):
90+
191
2014-04-08 Xabier Rodriguez Calvar <calvaris@igalia.com>
292

393
[GTK] Remove media controls dead code

Source/WebCore/css/CSSComputedStyleDeclaration.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -705,11 +705,11 @@ PassRefPtr<CSSPrimitiveValue> ComputedStyleExtractor::currentColorOrValidColor(R
705705
static PassRef<CSSValueList> getBorderRadiusCornerValues(const LengthSize& radius, const RenderStyle* style, RenderView* renderView)
706706
{
707707
auto list = CSSValueList::createSpaceSeparated();
708-
if (radius.width().type() == Percent)
708+
if (radius.width().isPercentNotCalculated())
709709
list.get().append(cssValuePool().createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
710710
else
711711
list.get().append(zoomAdjustedPixelValue(valueForLength(radius.width(), 0, renderView), style));
712-
if (radius.height().type() == Percent)
712+
if (radius.height().isPercentNotCalculated())
713713
list.get().append(cssValuePool().createValue(radius.height().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
714714
else
715715
list.get().append(zoomAdjustedPixelValue(valueForLength(radius.height(), 0, renderView), style));
@@ -719,7 +719,7 @@ static PassRef<CSSValueList> getBorderRadiusCornerValues(const LengthSize& radiu
719719
static PassRef<CSSValue> getBorderRadiusCornerValue(const LengthSize& radius, const RenderStyle* style, RenderView* renderView)
720720
{
721721
if (radius.width() == radius.height()) {
722-
if (radius.width().type() == Percent)
722+
if (radius.width().isPercentNotCalculated())
723723
return cssValuePool().createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
724724
return zoomAdjustedPixelValue(valueForLength(radius.width(), 0, renderView), style);
725725
}
@@ -1452,12 +1452,13 @@ static PassRef<CSSPrimitiveValue> lineHeightFromStyle(RenderStyle* style, Render
14521452
Length length = style->lineHeight();
14531453
if (length.isNegative())
14541454
return cssValuePool().createIdentifierValue(CSSValueNormal);
1455-
if (length.isPercent())
1455+
if (length.isPercentNotCalculated()) {
14561456
// This is imperfect, because it doesn't include the zoom factor and the real computation
14571457
// for how high to be in pixels does include things like minimum font size and the zoom factor.
14581458
// On the other hand, since font-size doesn't include the zoom factor, we really can't do
14591459
// that here either.
14601460
return zoomAdjustedPixelValue(static_cast<int>(length.percent() * style->fontDescription().specifiedSize()) / 100, style);
1461+
}
14611462
return zoomAdjustedPixelValue(floatValueForLength(length, 0, renderView), style);
14621463
}
14631464

@@ -2164,12 +2165,12 @@ PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propert
21642165
if (marginRight.isFixed() || !renderer || !renderer->isBox())
21652166
return zoomAdjustedPixelValueForLength(marginRight, style.get());
21662167
float value;
2167-
if (marginRight.isPercent() || marginRight.isViewportPercentage())
2168+
if (marginRight.isPercent() || marginRight.isViewportPercentage()) {
21682169
// RenderBox gives a marginRight() that is the distance between the right-edge of the child box
21692170
// and the right-edge of the containing box, when display == BLOCK. Let's calculate the absolute
21702171
// value of the specified margin-right % instead of relying on RenderBox's marginRight() value.
21712172
value = minimumValueForLength(marginRight, toRenderBox(renderer)->containingBlockLogicalWidthForContent(), m_node->document().renderView());
2172-
else
2173+
} else
21732174
value = toRenderBox(renderer)->marginRight();
21742175
return zoomAdjustedPixelValue(value, style.get());
21752176
}

Source/WebCore/css/DeprecatedStyleBuilder.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,6 @@ class ApplyPropertyBorderRadius {
443443
return;
444444

445445
Length radiusWidth;
446-
Length radiusHeight;
447446
if (pair->first()->isPercentage())
448447
radiusWidth = Length(pair->first()->getDoubleValue(), Percent);
449448
else if (pair->first()->isViewportPercentageLength())
@@ -452,6 +451,8 @@ class ApplyPropertyBorderRadius {
452451
radiusWidth = Length(pair->first()->cssCalcValue()->createCalculationValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom()));
453452
else
454453
radiusWidth = pair->first()->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
454+
455+
Length radiusHeight;
455456
if (pair->second()->isPercentage())
456457
radiusHeight = Length(pair->second()->getDoubleValue(), Percent);
457458
else if (pair->second()->isViewportPercentageLength())
@@ -460,17 +461,16 @@ class ApplyPropertyBorderRadius {
460461
radiusHeight = Length(pair->second()->cssCalcValue()->createCalculationValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom()));
461462
else
462463
radiusHeight = pair->second()->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
463-
int width = radiusWidth.value();
464-
int height = radiusHeight.value();
465-
if (width < 0 || height < 0)
464+
465+
if (radiusWidth.isNegative() || radiusHeight.isNegative())
466466
return;
467-
if (!width)
468-
radiusHeight = radiusWidth; // Null out the other value.
469-
else if (!height)
470-
radiusWidth = radiusHeight; // Null out the other value.
471467

472-
LengthSize size(radiusWidth, radiusHeight);
473-
setValue(styleResolver->style(), size);
468+
if (radiusWidth.isZero() || radiusHeight.isZero()) {
469+
radiusWidth.setValue(Fixed, 0);
470+
radiusHeight.setValue(Fixed, 0);
471+
}
472+
473+
setValue(styleResolver->style(), LengthSize(radiusWidth, radiusHeight));
474474
}
475475
static PropertyHandler createHandler()
476476
{

Source/WebCore/html/HTMLPlugInImageElement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ void HTMLPlugInImageElement::checkSizeChangeForSnapshotting()
610610

611611
static inline bool is100Percent(Length length)
612612
{
613-
return length.isPercent() && length.percent() == 100;
613+
return length.isPercentNotCalculated() && length.percent() == 100;
614614
}
615615

616616
void HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn(const URL& url)

Source/WebCore/platform/Length.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ inline unsigned CalculationValueMap::insert(PassRef<CalculationValue> value)
196196
{
197197
ASSERT(m_nextAvailableHandle);
198198

199-
// The leakRef below is balanced by the deref in the deref member function.
199+
// The leakRef below is balanced by the adoptRef in the deref member function.
200200
Entry leakedValue = value.leakRef();
201201

202202
// FIXME: This monotonically increasing handle generation scheme is potentially wasteful
@@ -231,8 +231,9 @@ inline void CalculationValueMap::deref(unsigned handle)
231231
return;
232232
}
233233

234-
// The deref below is balanced by the leakRef in the insert member function.
235-
it->value.value->deref();
234+
// The adoptRef here is balanced by the leakRef in the insert member function.
235+
Ref<CalculationValue> value { adoptRef(*it->value.value) };
236+
236237
m_map.remove(it);
237238
}
238239

Source/WebCore/platform/Length.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ struct Length {
8484
bool isFixed() const;
8585
bool isMaxContent() const;
8686
bool isMinContent() const;
87+
bool isPercentNotCalculated() const; // FIXME: Rename to isPercent.
8788
bool isRelative() const;
8889
bool isUndefined() const;
8990

@@ -97,11 +98,7 @@ struct Length {
9798
bool isPositive() const;
9899
bool isNegative() const;
99100

100-
// Returns true for both Percent and Calculated.
101-
// FIXME: Doesn't really seem OK to return true for Calculated given this function's name,
102-
// even though all calculated values are treated as percentages. Callers can tell Percent
103-
// from a Calculated already by looking at type, so this function only half-hides the distinction.
104-
bool isPercent() const;
101+
bool isPercent() const; // Returns true for both Percent and Calculated. FIXME: Find a better name for this.
105102

106103
bool isIntrinsic() const;
107104
bool isIntrinsicOrAuto() const;
@@ -262,7 +259,7 @@ inline int Length::intValue() const
262259

263260
inline float Length::percent() const
264261
{
265-
ASSERT(isPercent());
262+
ASSERT(isPercentNotCalculated());
266263
return value();
267264
}
268265

@@ -341,6 +338,11 @@ inline bool Length::isNegative() const
341338
return m_isFloat ? (m_floatValue < 0) : (m_intValue < 0);
342339
}
343340

341+
inline bool Length::isPercentNotCalculated() const
342+
{
343+
return type() == Percent;
344+
}
345+
344346
inline bool Length::isRelative() const
345347
{
346348
return type() == Relative;
@@ -353,7 +355,7 @@ inline bool Length::isUndefined() const
353355

354356
inline bool Length::isPercent() const
355357
{
356-
return type() == Percent || isCalculated();
358+
return isPercentNotCalculated() || isCalculated();
357359
}
358360

359361
inline bool Length::isPositive() const
@@ -395,7 +397,7 @@ inline bool Length::isIntrinsicOrAuto() const
395397

396398
inline bool Length::isSpecified() const
397399
{
398-
return isFixed() || type() == Percent || isCalculated() || isViewportPercentage();
400+
return isFixed() || isPercent() || isViewportPercentage();
399401
}
400402

401403
inline bool Length::isSpecifiedOrIntrinsic() const

Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class TranslateTransformOperation : public TransformOperation {
6868
virtual bool apply(TransformationMatrix& transform, const FloatSize& borderBoxSize) const
6969
{
7070
transform.translate3d(x(borderBoxSize), y(borderBoxSize), z(borderBoxSize));
71-
return m_x.type() == Percent || m_y.type() == Percent;
71+
return m_x.isPercentNotCalculated() || m_y.isPercentNotCalculated();
7272
}
7373

7474
virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);

Source/WebCore/rendering/AutoTableLayout.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void AutoTableLayout::recalcColumn(unsigned effCol)
108108
break;
109109
case Percent:
110110
m_hasPercent = true;
111-
if (cellLogicalWidth.isPositive() && (!columnLayout.logicalWidth.isPercent() || cellLogicalWidth.value() > columnLayout.logicalWidth.value()))
111+
if (cellLogicalWidth.isPositive() && (!columnLayout.logicalWidth.isPercentNotCalculated() || cellLogicalWidth.percent() > columnLayout.logicalWidth.percent()))
112112
columnLayout.logicalWidth = cellLogicalWidth;
113113
break;
114114
case Relative:
@@ -229,8 +229,8 @@ void AutoTableLayout::computeIntrinsicLogicalWidths(LayoutUnit& minWidth, Layout
229229
minWidth += m_layoutStruct[i].effectiveMinLogicalWidth;
230230
maxWidth += m_layoutStruct[i].effectiveMaxLogicalWidth;
231231
if (scaleColumns) {
232-
if (m_layoutStruct[i].effectiveLogicalWidth.isPercent()) {
233-
float percent = std::min(static_cast<float>(m_layoutStruct[i].effectiveLogicalWidth.percent()), remainingPercent);
232+
if (m_layoutStruct[i].effectiveLogicalWidth.isPercentNotCalculated()) {
233+
float percent = std::min(m_layoutStruct[i].effectiveLogicalWidth.percent(), remainingPercent);
234234
float logicalWidth = static_cast<float>(m_layoutStruct[i].effectiveMaxLogicalWidth) * 100 / std::max(percent, epsilon);
235235
maxPercent = std::max(logicalWidth, maxPercent);
236236
remainingPercent -= percent;
@@ -322,7 +322,7 @@ int AutoTableLayout::calcEffectiveLogicalWidth()
322322
// <tr><td>1</td><td colspan=2>2-3</tr>
323323
// <tr><td>1</td><td colspan=2 width=100%>2-3</td></tr>
324324
// </table>
325-
if (!columnLayout.effectiveLogicalWidth.isPercent()) {
325+
if (!columnLayout.effectiveLogicalWidth.isPercentNotCalculated()) {
326326
columnLayout.effectiveLogicalWidth = Length();
327327
allColsArePercent = false;
328328
} else
@@ -340,7 +340,7 @@ int AutoTableLayout::calcEffectiveLogicalWidth()
340340
}
341341

342342
// adjust table max width if needed
343-
if (cellLogicalWidth.isPercent()) {
343+
if (cellLogicalWidth.isPercentNotCalculated()) {
344344
if (totalPercent > cellLogicalWidth.percent() || allColsArePercent) {
345345
// can't satify this condition, treat as variable
346346
cellLogicalWidth = Length();
@@ -383,9 +383,9 @@ int AutoTableLayout::calcEffectiveLogicalWidth()
383383
int allocatedMinLogicalWidth = 0;
384384
int allocatedMaxLogicalWidth = 0;
385385
for (unsigned pos = effCol; pos < lastCol; ++pos) {
386-
ASSERT(m_layoutStruct[pos].logicalWidth.isPercent() || m_layoutStruct[pos].effectiveLogicalWidth.isPercent());
386+
ASSERT(m_layoutStruct[pos].logicalWidth.isPercentNotCalculated() || m_layoutStruct[pos].effectiveLogicalWidth.isPercentNotCalculated());
387387
// |allColsArePercent| means that either the logicalWidth *or* the effectiveLogicalWidth are percents, handle both of them here.
388-
float percent = m_layoutStruct[pos].logicalWidth.isPercent() ? m_layoutStruct[pos].logicalWidth.percent() : m_layoutStruct[pos].effectiveLogicalWidth.percent();
388+
float percent = m_layoutStruct[pos].logicalWidth.isPercentNotCalculated() ? m_layoutStruct[pos].logicalWidth.percent() : m_layoutStruct[pos].effectiveLogicalWidth.percent();
389389
int columnMinLogicalWidth = static_cast<int>(percent * cellMinLogicalWidth / totalPercent);
390390
int columnMaxLogicalWidth = static_cast<int>(percent * cellMaxLogicalWidth / totalPercent);
391391
m_layoutStruct[pos].effectiveMinLogicalWidth = std::max(m_layoutStruct[pos].effectiveMinLogicalWidth, columnMinLogicalWidth);
@@ -619,7 +619,7 @@ void AutoTableLayout::layout()
619619
if (available > 0 && m_hasPercent && totalPercent < 100) {
620620
for (size_t i = 0; i < nEffCols; ++i) {
621621
Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
622-
if (logicalWidth.isPercent()) {
622+
if (logicalWidth.isPercentNotCalculated()) {
623623
int cellLogicalWidth = available * logicalWidth.percent() / totalPercent;
624624
available -= cellLogicalWidth;
625625
totalPercent -= logicalWidth.percent();

Source/WebCore/rendering/FixedTableLayout.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ void FixedTableLayout::layout()
225225
if (m_width[i].isFixed()) {
226226
calcWidth[i] = m_width[i].value();
227227
totalFixedWidth += calcWidth[i];
228-
} else if (m_width[i].isPercent()) {
228+
} else if (m_width[i].isPercentNotCalculated()) {
229229
calcWidth[i] = valueForLength(m_width[i], tableLogicalWidth);
230230
totalPercentWidth += calcWidth[i];
231231
totalPercent += m_width[i].percent();
@@ -254,7 +254,7 @@ void FixedTableLayout::layout()
254254
if (totalPercent) {
255255
totalPercentWidth = 0;
256256
for (unsigned i = 0; i < nEffCols; i++) {
257-
if (m_width[i].isPercent()) {
257+
if (m_width[i].isPercentNotCalculated()) {
258258
calcWidth[i] = m_width[i].percent() * (tableLogicalWidth - totalFixedWidth) / totalPercent;
259259
totalPercentWidth += calcWidth[i];
260260
}

0 commit comments

Comments
 (0)