Convert LineBoxContain to use an OptionSet<>
https://bugs.webkit.org/show_bug.cgi?id=202890

Reviewed by Alex Christensen.

Use OptionSet<LineBoxContain>.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::createLineBoxContainValue):
* css/CSSLineBoxContainValue.cpp:
(WebCore::CSSLineBoxContainValue::CSSLineBoxContainValue):
(WebCore::CSSLineBoxContainValue::customCSSText const):
* css/CSSLineBoxContainValue.h:
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertLineBoxContain):
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeLineBoxContain):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::minLineHeightForReplacedRenderer const):
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::ascentAndDescentForBox const):
(WebCore::RootInlineBox::includeLeadingForBox const):
(WebCore::RootInlineBox::includeFontForBox const):
(WebCore::RootInlineBox::includeGlyphsForBox const):
(WebCore::RootInlineBox::includeInitialLetterForBox const):
(WebCore::RootInlineBox::includeMarginForBox const):
(WebCore::RootInlineBox::fitsToGlyphs const):
(WebCore::RootInlineBox::includesRootLineBoxFontOrLeading const):
* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::canUseForFontAndText):
(WebCore::SimpleLineLayout::canUseForStyle):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::lineBoxContain const):
(WebCore::RenderStyle::setLineBoxContain):
(WebCore::RenderStyle::initialLineBoxContain):
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
* rendering/style/StyleRareInheritedData.h:
* rendering/updating/RenderTreeBuilderFirstLetter.cpp:
(WebCore::styleForFirstLetter):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@251058 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 9eb815f..6ec6c58 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,46 @@
+2019-10-13  Simon Fraser  <simon.fraser@apple.com>
+
+        Convert LineBoxContain to use an OptionSet<>
+        https://bugs.webkit.org/show_bug.cgi?id=202890
+
+        Reviewed by Alex Christensen.
+
+        Use OptionSet<LineBoxContain>.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::createLineBoxContainValue):
+        * css/CSSLineBoxContainValue.cpp:
+        (WebCore::CSSLineBoxContainValue::CSSLineBoxContainValue):
+        (WebCore::CSSLineBoxContainValue::customCSSText const):
+        * css/CSSLineBoxContainValue.h:
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::convertLineBoxContain):
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::consumeLineBoxContain):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::minLineHeightForReplacedRenderer const):
+        * rendering/RootInlineBox.cpp:
+        (WebCore::RootInlineBox::ascentAndDescentForBox const):
+        (WebCore::RootInlineBox::includeLeadingForBox const):
+        (WebCore::RootInlineBox::includeFontForBox const):
+        (WebCore::RootInlineBox::includeGlyphsForBox const):
+        (WebCore::RootInlineBox::includeInitialLetterForBox const):
+        (WebCore::RootInlineBox::includeMarginForBox const):
+        (WebCore::RootInlineBox::fitsToGlyphs const):
+        (WebCore::RootInlineBox::includesRootLineBoxFontOrLeading const):
+        * rendering/SimpleLineLayout.cpp:
+        (WebCore::SimpleLineLayout::canUseForFontAndText):
+        (WebCore::SimpleLineLayout::canUseForStyle):
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::lineBoxContain const):
+        (WebCore::RenderStyle::setLineBoxContain):
+        (WebCore::RenderStyle::initialLineBoxContain):
+        * rendering/style/StyleRareInheritedData.cpp:
+        (WebCore::StyleRareInheritedData::StyleRareInheritedData):
+        * rendering/style/StyleRareInheritedData.h:
+        * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
+        (WebCore::styleForFirstLetter):
+
 2019-10-12  Ryosuke Niwa  <rniwa@webkit.org>
 
         [iOS] Crash in WebCore::DOMWindow::incrementScrollEventListenersCount
diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
index 721b1c3..99ca66c 100644
--- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
+++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
@@ -1693,7 +1693,7 @@
     return list;
 }
 
-static Ref<CSSValue> createLineBoxContainValue(unsigned lineBoxContain)
+static Ref<CSSValue> createLineBoxContainValue(OptionSet<LineBoxContain> lineBoxContain)
 {
     if (!lineBoxContain)
         return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
diff --git a/Source/WebCore/css/CSSLineBoxContainValue.cpp b/Source/WebCore/css/CSSLineBoxContainValue.cpp
index 19fdf8b..7145d63 100644
--- a/Source/WebCore/css/CSSLineBoxContainValue.cpp
+++ b/Source/WebCore/css/CSSLineBoxContainValue.cpp
@@ -30,7 +30,7 @@
 
 namespace WebCore {
 
-CSSLineBoxContainValue::CSSLineBoxContainValue(unsigned value)
+CSSLineBoxContainValue::CSSLineBoxContainValue(OptionSet<LineBoxContain> value)
     : CSSValue(LineBoxContainClass)
     , m_value(value)
 {
@@ -40,34 +40,35 @@
 {
     StringBuilder text;
 
-    if (m_value & LineBoxContainBlock)
+    if (m_value.contains(LineBoxContain::Block))
         text.appendLiteral("block");
-    if (m_value & LineBoxContainInline) {
+
+    if (m_value.contains(LineBoxContain::Inline)) {
         if (!text.isEmpty())
             text.append(' ');
         text.appendLiteral("inline");
     }
-    if (m_value & LineBoxContainFont) {
+    if (m_value.contains(LineBoxContain::Font)) {
         if (!text.isEmpty())
             text.append(' ');
         text.appendLiteral("font");
     }
-    if (m_value & LineBoxContainGlyphs) {
+    if (m_value.contains(LineBoxContain::Glyphs)) {
         if (!text.isEmpty())
             text.append(' ');
         text.appendLiteral("glyphs");
     }
-    if (m_value & LineBoxContainReplaced) {
+    if (m_value.contains(LineBoxContain::Replaced)) {
         if (!text.isEmpty())
             text.append(' ');
         text.appendLiteral("replaced");
     }
-    if (m_value & LineBoxContainInlineBox) {
+    if (m_value.contains(LineBoxContain::InlineBox)) {
         if (!text.isEmpty())
             text.append(' ');
         text.appendLiteral("inline-box");
     }
-    if (m_value & LineBoxContainInitialLetter) {
+    if (m_value.contains(LineBoxContain::InitialLetter)) {
         if (!text.isEmpty())
             text.append(' ');
         text.appendLiteral("initial-letter");
diff --git a/Source/WebCore/css/CSSLineBoxContainValue.h b/Source/WebCore/css/CSSLineBoxContainValue.h
index ce5f80817..ebe69b5 100644
--- a/Source/WebCore/css/CSSLineBoxContainValue.h
+++ b/Source/WebCore/css/CSSLineBoxContainValue.h
@@ -26,40 +26,39 @@
 #pragma once
 
 #include "CSSValue.h"
+#include <wtf/OptionSet.h>
 #include <wtf/Ref.h>
 
 namespace WebCore {
 
 class CSSPrimitiveValue;
 
-enum LineBoxContainFlags {
-    LineBoxContainNone = 0x0,
-    LineBoxContainBlock = 0x1,
-    LineBoxContainInline = 0x2,
-    LineBoxContainFont = 0x4,
-    LineBoxContainGlyphs = 0x8,
-    LineBoxContainReplaced = 0x10,
-    LineBoxContainInlineBox = 0x20,
-    LineBoxContainInitialLetter = 0x40
+enum class LineBoxContain {
+    Block           = 1 << 0,
+    Inline          = 1 << 1,
+    Font            = 1 << 2,
+    Glyphs          = 1 << 3,
+    Replaced        = 1 << 4,
+    InlineBox       = 1 << 5,
+    InitialLetter   = 1 << 6,
 };
-typedef unsigned LineBoxContain;
 
 // Used for text-CSSLineBoxContain and box-CSSLineBoxContain
 class CSSLineBoxContainValue final : public CSSValue {
 public:
-    static Ref<CSSLineBoxContainValue> create(LineBoxContain value)
+    static Ref<CSSLineBoxContainValue> create(OptionSet<LineBoxContain> value)
     {
         return adoptRef(*new CSSLineBoxContainValue(value));
     }
 
     String customCSSText() const;
     bool equals(const CSSLineBoxContainValue& other) const { return m_value == other.m_value; }
-    LineBoxContain value() const { return m_value; }
+    OptionSet<LineBoxContain> value() const { return m_value; }
 
 private:
-    explicit CSSLineBoxContainValue(LineBoxContain);
+    explicit CSSLineBoxContainValue(OptionSet<LineBoxContain>);
 
-    LineBoxContain m_value;
+    OptionSet<LineBoxContain> m_value;
 };
 
 } // namespace WebCore
diff --git a/Source/WebCore/css/StyleBuilderConverter.h b/Source/WebCore/css/StyleBuilderConverter.h
index c073a10..fd44a9b 100644
--- a/Source/WebCore/css/StyleBuilderConverter.h
+++ b/Source/WebCore/css/StyleBuilderConverter.h
@@ -100,7 +100,7 @@
     static RefPtr<StyleReflection> convertReflection(StyleResolver&, const CSSValue&);
     static IntSize convertInitialLetter(StyleResolver&, const CSSValue&);
     static float convertTextStrokeWidth(StyleResolver&, const CSSValue&);
-    static LineBoxContain convertLineBoxContain(StyleResolver&, const CSSValue&);
+    static OptionSet<LineBoxContain> convertLineBoxContain(StyleResolver&, const CSSValue&);
     static OptionSet<TextDecorationSkip> convertTextDecorationSkip(StyleResolver&, const CSSValue&);
     static RefPtr<ShapeValue> convertShapeValue(StyleResolver&, CSSValue&);
 #if ENABLE(CSS_SCROLL_SNAP)
@@ -805,11 +805,11 @@
     return width;
 }
 
-inline LineBoxContain StyleBuilderConverter::convertLineBoxContain(StyleResolver&, const CSSValue& value)
+inline OptionSet<LineBoxContain> StyleBuilderConverter::convertLineBoxContain(StyleResolver&, const CSSValue& value)
 {
     if (is<CSSPrimitiveValue>(value)) {
         ASSERT(downcast<CSSPrimitiveValue>(value).valueID() == CSSValueNone);
-        return LineBoxContainNone;
+        return { };
     }
 
     return downcast<CSSLineBoxContainValue>(value).value();
diff --git a/Source/WebCore/css/parser/CSSPropertyParser.cpp b/Source/WebCore/css/parser/CSSPropertyParser.cpp
index ffcb2a6..8ca4a56 100644
--- a/Source/WebCore/css/parser/CSSPropertyParser.cpp
+++ b/Source/WebCore/css/parser/CSSPropertyParser.cpp
@@ -3491,38 +3491,38 @@
     if (range.peek().id() == CSSValueNone)
         return consumeIdent(range);
 
-    LineBoxContain lineBoxContain = LineBoxContainNone;
+    OptionSet<LineBoxContain> lineBoxContain;
     
     while (range.peek().type() == IdentToken) {
         auto id = range.peek().id();
         if (id == CSSValueBlock) {
-            if (lineBoxContain & LineBoxContainBlock)
+            if (lineBoxContain.contains(LineBoxContain::Block))
                 return nullptr;
-            lineBoxContain |= LineBoxContainBlock;
+            lineBoxContain.add(LineBoxContain::Block);
         } else if (id == CSSValueInline) {
-            if (lineBoxContain & LineBoxContainInline)
+            if (lineBoxContain.contains(LineBoxContain::Inline))
                 return nullptr;
-            lineBoxContain |= LineBoxContainInline;
+            lineBoxContain.add(LineBoxContain::Inline);
         } else if (id == CSSValueFont) {
-            if (lineBoxContain & LineBoxContainFont)
+            if (lineBoxContain.contains(LineBoxContain::Font))
                 return nullptr;
-            lineBoxContain |= LineBoxContainFont;
+            lineBoxContain.add(LineBoxContain::Font);
         } else if (id == CSSValueGlyphs) {
-            if (lineBoxContain & LineBoxContainGlyphs)
+            if (lineBoxContain.contains(LineBoxContain::Glyphs))
                 return nullptr;
-            lineBoxContain |= LineBoxContainGlyphs;
+            lineBoxContain.add(LineBoxContain::Glyphs);
         } else if (id == CSSValueReplaced) {
-            if (lineBoxContain & LineBoxContainReplaced)
+            if (lineBoxContain.contains(LineBoxContain::Replaced))
                 return nullptr;
-            lineBoxContain |= LineBoxContainReplaced;
+            lineBoxContain.add(LineBoxContain::Replaced);
         } else if (id == CSSValueInlineBox) {
-            if (lineBoxContain & LineBoxContainInlineBox)
+            if (lineBoxContain.contains(LineBoxContain::InlineBox))
                 return nullptr;
-            lineBoxContain |= LineBoxContainInlineBox;
+            lineBoxContain.add(LineBoxContain::InlineBox);
         } else if (id == CSSValueInitialLetter) {
-            if (lineBoxContain & LineBoxContainInitialLetter)
+            if (lineBoxContain.contains(LineBoxContain::InitialLetter))
                 return nullptr;
-            lineBoxContain |= LineBoxContainInitialLetter;
+            lineBoxContain.add(LineBoxContain::InitialLetter);
         } else
             return nullptr;
         range.consumeIncludingWhitespace();
diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp
index 1dc304c..34e789b 100644
--- a/Source/WebCore/rendering/RenderBlock.cpp
+++ b/Source/WebCore/rendering/RenderBlock.cpp
@@ -2512,7 +2512,7 @@
         return replacedHeight;
 
     const RenderStyle& style = isFirstLine ? firstLineStyle() : this->style();
-    if (!(style.lineBoxContain() & LineBoxContainBlock))
+    if (!(style.lineBoxContain().contains(LineBoxContain::Block)))
         return 0;
 
     return std::max<LayoutUnit>(replacedHeight, lineHeight(isFirstLine, isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes));
diff --git a/Source/WebCore/rendering/RootInlineBox.cpp b/Source/WebCore/rendering/RootInlineBox.cpp
index 8194309..3cf7e68 100644
--- a/Source/WebCore/rendering/RootInlineBox.cpp
+++ b/Source/WebCore/rendering/RootInlineBox.cpp
@@ -882,7 +882,7 @@
     // Replaced boxes will return 0 for the line-height if line-box-contain says they are
     // not to be included.
     if (box.renderer().isReplaced()) {
-        if (lineStyle().lineBoxContain() & LineBoxContainReplaced) {
+        if (lineStyle().lineBoxContain().contains(LineBoxContain::Replaced)) {
             ascent = box.baselinePosition(baselineType());
             descent = box.lineHeight() - ascent;
             
@@ -1068,8 +1068,8 @@
     if (box.renderer().isReplaced() || (box.renderer().isTextOrLineBreak() && !box.behavesLikeText()))
         return false;
 
-    LineBoxContain lineBoxContain = renderer().style().lineBoxContain();
-    return (lineBoxContain & LineBoxContainInline) || (&box == this && (lineBoxContain & LineBoxContainBlock));
+    auto lineBoxContain = renderer().style().lineBoxContain();
+    return lineBoxContain.contains(LineBoxContain::Inline) || (&box == this && lineBoxContain.contains(LineBoxContain::Block));
 }
 
 bool RootInlineBox::includeFontForBox(InlineBox& box) const
@@ -1080,8 +1080,7 @@
     if (!box.behavesLikeText() && is<InlineFlowBox>(box) && !downcast<InlineFlowBox>(box).hasTextChildren())
         return false;
 
-    LineBoxContain lineBoxContain = renderer().style().lineBoxContain();
-    return (lineBoxContain & LineBoxContainFont);
+    return renderer().style().lineBoxContain().contains(LineBoxContain::Font);
 }
 
 bool RootInlineBox::includeGlyphsForBox(InlineBox& box) const
@@ -1092,8 +1091,7 @@
     if (!box.behavesLikeText() && is<InlineFlowBox>(box) && !downcast<InlineFlowBox>(box).hasTextChildren())
         return false;
 
-    LineBoxContain lineBoxContain = renderer().style().lineBoxContain();
-    return (lineBoxContain & LineBoxContainGlyphs);
+    return renderer().style().lineBoxContain().contains(LineBoxContain::Glyphs);
 }
 
 bool RootInlineBox::includeInitialLetterForBox(InlineBox& box) const
@@ -1104,8 +1102,7 @@
     if (!box.behavesLikeText() && is<InlineFlowBox>(box) && !downcast<InlineFlowBox>(box).hasTextChildren())
         return false;
 
-    LineBoxContain lineBoxContain = renderer().style().lineBoxContain();
-    return (lineBoxContain & LineBoxContainInitialLetter);
+    return renderer().style().lineBoxContain().contains(LineBoxContain::InitialLetter);
 }
 
 bool RootInlineBox::includeMarginForBox(InlineBox& box) const
@@ -1113,21 +1110,17 @@
     if (box.renderer().isReplaced() || (box.renderer().isTextOrLineBreak() && !box.behavesLikeText()))
         return false;
 
-    LineBoxContain lineBoxContain = renderer().style().lineBoxContain();
-    return lineBoxContain & LineBoxContainInlineBox;
+    return renderer().style().lineBoxContain().contains(LineBoxContain::InlineBox);
 }
 
-
 bool RootInlineBox::fitsToGlyphs() const
 {
-    LineBoxContain lineBoxContain = renderer().style().lineBoxContain();
-    return ((lineBoxContain & LineBoxContainGlyphs) || (lineBoxContain & LineBoxContainInitialLetter));
+    return renderer().style().lineBoxContain().containsAny({ LineBoxContain::Glyphs, LineBoxContain::InitialLetter });
 }
 
 bool RootInlineBox::includesRootLineBoxFontOrLeading() const
 {
-    LineBoxContain lineBoxContain = renderer().style().lineBoxContain();
-    return (lineBoxContain & LineBoxContainBlock) || (lineBoxContain & LineBoxContainInline) || (lineBoxContain & LineBoxContainFont);
+    return renderer().style().lineBoxContain().containsAny({ LineBoxContain::Block, LineBoxContain::Inline, LineBoxContain::Font });
 }
 
 Node* RootInlineBox::getLogicalStartBoxWithNode(InlineBox*& startBox) const
diff --git a/Source/WebCore/rendering/SimpleLineLayout.cpp b/Source/WebCore/rendering/SimpleLineLayout.cpp
index a53e35d..0cd4e1e 100644
--- a/Source/WebCore/rendering/SimpleLineLayout.cpp
+++ b/Source/WebCore/rendering/SimpleLineLayout.cpp
@@ -162,7 +162,7 @@
     if (fontCascade.primaryFont().isInterstitial())
         SET_REASON_AND_RETURN_IF_NEEDED(FlowIsMissingPrimaryFont, reasons, includeReasons);
     Optional<float> lineHeightConstraint;
-    if (style.lineBoxContain() & LineBoxContainGlyphs)
+    if (style.lineBoxContain().contains(LineBoxContain::Glyphs))
         lineHeightConstraint = lineHeightFromFlow(flow).toFloat();
     bool flowIsJustified = style.textAlign() == TextAlignMode::Justify;
     for (const auto& textRenderer : childrenOfType<RenderText>(flow)) {
@@ -208,7 +208,7 @@
         SET_REASON_AND_RETURN_IF_NEEDED(FlowHasOverflowNotVisible, reasons, includeReasons);
     if (!style.isLeftToRightDirection())
         SET_REASON_AND_RETURN_IF_NEEDED(FlowIsNotLTR, reasons, includeReasons);
-    if (!(style.lineBoxContain() & LineBoxContainBlock))
+    if (!(style.lineBoxContain().contains(LineBoxContain::Block)))
         SET_REASON_AND_RETURN_IF_NEEDED(FlowHasLineBoxContainProperty, reasons, includeReasons);
     if (style.writingMode() != TopToBottomWritingMode)
         SET_REASON_AND_RETURN_IF_NEEDED(FlowIsNotTopToBottom, reasons, includeReasons);
diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h
index cbf2536..c915fdb 100644
--- a/Source/WebCore/rendering/style/RenderStyle.h
+++ b/Source/WebCore/rendering/style/RenderStyle.h
@@ -693,8 +693,8 @@
     const Length& perspectiveOriginY() const { return m_rareNonInheritedData->perspectiveOriginY; }
     const LengthSize& pageSize() const { return m_rareNonInheritedData->pageSize; }
     PageSizeType pageSizeType() const { return static_cast<PageSizeType>(m_rareNonInheritedData->pageSizeType); }
-    
-    LineBoxContain lineBoxContain() const { return m_rareInheritedData->lineBoxContain; }
+
+    OptionSet<LineBoxContain> lineBoxContain() const { return OptionSet<LineBoxContain>::fromRaw(m_rareInheritedData->lineBoxContain); }
     const LineClampValue& lineClamp() const { return m_rareNonInheritedData->lineClamp; }
     const IntSize& initialLetter() const { return m_rareNonInheritedData->initialLetter; }
     int initialLetterDrop() const { return initialLetter().width(); }
@@ -1212,7 +1212,7 @@
     void setPageSizeType(PageSizeType t) { SET_VAR(m_rareNonInheritedData, pageSizeType, t); }
     void resetPageSizeType() { SET_VAR(m_rareNonInheritedData, pageSizeType, PAGE_SIZE_AUTO); }
 
-    void setLineBoxContain(LineBoxContain c) { SET_VAR(m_rareInheritedData, lineBoxContain, c); }
+    void setLineBoxContain(OptionSet<LineBoxContain> c) { SET_VAR(m_rareInheritedData, lineBoxContain, c.toRaw()); }
     void setLineClamp(LineClampValue c) { SET_VAR(m_rareNonInheritedData, lineClamp, c); }
     
     void setInitialLetter(const IntSize& size) { SET_VAR(m_rareNonInheritedData, initialLetter, size); }
@@ -1582,7 +1582,7 @@
     static const AtomString& initialTextEmphasisCustomMark() { return nullAtom(); }
     static OptionSet<TextEmphasisPosition> initialTextEmphasisPosition() { return { TextEmphasisPosition::Over, TextEmphasisPosition::Right }; }
     static RubyPosition initialRubyPosition() { return RubyPosition::Before; }
-    static LineBoxContain initialLineBoxContain() { return LineBoxContainBlock | LineBoxContainInline | LineBoxContainReplaced; }
+    static OptionSet<LineBoxContain> initialLineBoxContain() { return { LineBoxContain::Block, LineBoxContain::Inline, LineBoxContain::Replaced }; }
     static ImageOrientation initialImageOrientation() { return ImageOrientation::None; }
     static ImageRendering initialImageRendering() { return ImageRendering::Auto; }
     static ImageResolutionSource initialImageResolutionSource() { return ImageResolutionSource::Specified; }
diff --git a/Source/WebCore/rendering/style/StyleRareInheritedData.cpp b/Source/WebCore/rendering/style/StyleRareInheritedData.cpp
index 96dbba0..17a1178 100644
--- a/Source/WebCore/rendering/style/StyleRareInheritedData.cpp
+++ b/Source/WebCore/rendering/style/StyleRareInheritedData.cpp
@@ -102,7 +102,7 @@
     , textIndentLine(RenderStyle::initialTextIndentLine())
     , textIndentType(RenderStyle::initialTextIndentType())
 #endif
-    , lineBoxContain(RenderStyle::initialLineBoxContain())
+    , lineBoxContain(static_cast<unsigned>(RenderStyle::initialLineBoxContain().toRaw()))
 #if ENABLE(CSS_IMAGE_ORIENTATION)
     , imageOrientation(RenderStyle::initialImageOrientation())
 #endif
diff --git a/Source/WebCore/rendering/style/StyleRareInheritedData.h b/Source/WebCore/rendering/style/StyleRareInheritedData.h
index 3ddbbd0..cd87c37 100644
--- a/Source/WebCore/rendering/style/StyleRareInheritedData.h
+++ b/Source/WebCore/rendering/style/StyleRareInheritedData.h
@@ -118,7 +118,7 @@
     unsigned textIndentLine : 1; // TextIndentLine
     unsigned textIndentType : 1; // TextIndentType
 #endif
-    unsigned lineBoxContain: 7; // LineBoxContain
+    unsigned lineBoxContain: 7; // OptionSet<LineBoxContain>
     // CSS Image Values Level 3
 #if ENABLE(CSS_IMAGE_ORIENTATION)
     unsigned imageOrientation : 4; // ImageOrientation
diff --git a/Source/WebCore/rendering/updating/RenderTreeBuilderFirstLetter.cpp b/Source/WebCore/rendering/updating/RenderTreeBuilderFirstLetter.cpp
index af542d7..cb88b78 100644
--- a/Source/WebCore/rendering/updating/RenderTreeBuilderFirstLetter.cpp
+++ b/Source/WebCore/rendering/updating/RenderTreeBuilderFirstLetter.cpp
@@ -56,7 +56,7 @@
         // For an N-line first-letter and for alphabetic baselines, the cap-height of the first letter needs to equal (N-1)*line-height of paragraph lines + cap-height of the paragraph
         // Mathematically we can't rely on font-size, since font().height() doesn't necessarily match. For reliability, the best approach is simply to
         // compare the final measured cap-heights of the two fonts in order to get to the closest possible value.
-        firstLetterStyle.setLineBoxContain(LineBoxContainInitialLetter);
+        firstLetterStyle.setLineBoxContain({ LineBoxContain::InitialLetter });
         int lineHeight = paragraph->style().computedLineHeight();
 
         // Set the font to be one line too big and then ratchet back to get to a precise fit. We can't just set the desired font size based off font height metrics