Bug 1223653 patch 2 - Use an enum class for NS_STYLE_BOX_SIZING_*. r=heycam

The casts in nsCSSProps.cpp (defining kBoxSizingKTable) and in
nsComputedDOMStyle::DoGetBoxSizing (using
nsCSSProps::ValueToKeywordEnum) are a little bit annoying, though aren't
a net reduction in typesafety.

The casts in nsRuleNode.cpp (SetDiscrete) are a little more annoying,
though the change in this patch should be sufficient for converting all
properties -- but that may also mean reducing typesafety a bit for all
properties.

I'd like to find something better to do about them, but I think I'm ok
landing this before doing that.  Bug 1224918 covers doing better.
This commit is contained in:
L. David Baron
2015-11-19 18:09:29 -08:00
parent a7c0008991
commit cab615e8d5
15 changed files with 84 additions and 55 deletions

View File

@@ -121,16 +121,15 @@ GetISizeInfo(nsRenderingContext *aRenderingContext,
}
else {
switch (stylePos->mBoxSizing) {
case NS_STYLE_BOX_SIZING_CONTENT:
case StyleBoxSizing::Content:
boxSizingToBorderEdge = offsets.hPadding + offsets.hBorder;
break;
case NS_STYLE_BOX_SIZING_PADDING:
case StyleBoxSizing::Padding:
minCoord += offsets.hPadding;
prefCoord += offsets.hPadding;
boxSizingToBorderEdge = offsets.hBorder;
break;
default:
// NS_STYLE_BOX_SIZING_BORDER
case StyleBoxSizing::Border:
minCoord += offsets.hPadding + offsets.hBorder;
prefCoord += offsets.hPadding + offsets.hBorder;
break;