author | Daniel Holbert <dholbert@cs.stanford.edu> |
Thu, 17 Jul 2014 13:39:00 +0200 | |
changeset 194806 | ea66bf9982ffd35f43b5517ce7fe9651577aa943 |
parent 194805 | f701b67c24051bce8d22a14008310d36b953dd53 |
child 194807 | c7494103b4c7c01548243a743168b6f3e1c1d553 |
push id | 46443 |
push user | cbook@mozilla.com |
push date | Fri, 18 Jul 2014 09:00:40 +0000 |
treeherder | mozilla-inbound@ea66bf9982ff [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | dbaron |
bugs | 1039796 |
milestone | 33.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -3660,16 +3660,18 @@ GetIntrinsicCoord(const nsStyleCoord& aS } #undef DEBUG_INTRINSIC_WIDTH #ifdef DEBUG_INTRINSIC_WIDTH static int32_t gNoiseIndent = 0; #endif +#define MULDIV(a,b,c) (nscoord(int64_t(a) * int64_t(b) / int64_t(c))) + /* static */ nscoord nsLayoutUtils::IntrinsicForContainer(nsRenderingContext *aRenderingContext, nsIFrame *aFrame, IntrinsicWidthType aType, uint32_t aFlags) { NS_PRECONDITION(aFrame, "null frame"); NS_PRECONDITION(aType == MIN_WIDTH || aType == PREF_WIDTH, "bad type"); @@ -3781,34 +3783,31 @@ nsLayoutUtils::IntrinsicForContainer(nsR default: break; } nscoord h; if (GetAbsoluteCoord(styleHeight, h) || GetPercentHeight(styleHeight, aFrame, h)) { h = std::max(0, h - heightTakenByBoxSizing); - result = - NSToCoordRound(h * (float(ratio.width) / float(ratio.height))); + result = MULDIV(h, ratio.width, ratio.height); } if (GetAbsoluteCoord(styleMaxHeight, h) || GetPercentHeight(styleMaxHeight, aFrame, h)) { h = std::max(0, h - heightTakenByBoxSizing); - nscoord maxWidth = - NSToCoordRound(h * (float(ratio.width) / float(ratio.height))); + nscoord maxWidth = MULDIV(h, ratio.width, ratio.height); if (maxWidth < result) result = maxWidth; } if (GetAbsoluteCoord(styleMinHeight, h) || GetPercentHeight(styleMinHeight, aFrame, h)) { h = std::max(0, h - heightTakenByBoxSizing); - nscoord minWidth = - NSToCoordRound(h * (float(ratio.width) / float(ratio.height))); + nscoord minWidth = MULDIV(h, ratio.width, ratio.height); if (minWidth > result) result = minWidth; } } } } if (aFrame->GetType() == nsGkAtoms::tableFrame) { @@ -4078,18 +4077,16 @@ nsLayoutUtils::MarkDescendantsDirty(nsIF nsIFrame* kid = childFrames.get(); stack.AppendElement(kid); } } } while (stack.Length() != 0); } while (subtrees.Length() != 0); } -#define MULDIV(a,b,c) (nscoord(int64_t(a) * int64_t(b) / int64_t(c))) - /* static */ nsSize nsLayoutUtils::ComputeSizeWithIntrinsicDimensions( nsRenderingContext* aRenderingContext, nsIFrame* aFrame, const IntrinsicSize& aIntrinsicSize, nsSize aIntrinsicRatio, nsSize aCBSize, nsSize aMargin, nsSize aBorder, nsSize aPadding) { const nsStylePosition* stylePos = aFrame->StylePosition();