Title: [226666] trunk/Source/WebCore
Revision
226666
Author
[email protected]
Date
2018-01-09 16:05:46 -0800 (Tue, 09 Jan 2018)

Log Message

Clean up Marquee-related enums
https://bugs.webkit.org/show_bug.cgi?id=181347

Reviewed by Anders Carlsson.

Modernize EMarqueeBehavior and EMarqueeDirection enums. Stop using the weird negative
values in the MarqueeDirection and do manual reverse direction mapping.

Make some member functions of RenderMarquee private.

Stop using bitfields in RenderMarquee because the memory saving is not worth it, and doing so
allows us to use modern initialization.

No behavior change.

* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator MarqueeBehavior const):
(WebCore::CSSPrimitiveValue::operator MarqueeDirection const):
(WebCore::CSSPrimitiveValue::operator EMarqueeBehavior const): Deleted.
(WebCore::CSSPrimitiveValue::operator EMarqueeDirection const): Deleted.
* css/StyleResolver.cpp:
(WebCore::StyleResolver::adjustRenderStyle):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::sizesLogicalWidthToFitContent const):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects const):
* rendering/RenderMarquee.cpp:
(WebCore::RenderMarquee::RenderMarquee):
(WebCore::reverseDirection):
(WebCore::RenderMarquee::direction const):
(WebCore::RenderMarquee::isHorizontal const):
(WebCore::RenderMarquee::computePosition):
(WebCore::RenderMarquee::start):
(WebCore::RenderMarquee::updateMarqueePosition):
(WebCore::RenderMarquee::updateMarqueeStyle):
(WebCore::RenderMarquee::timerFired):
* rendering/RenderMarquee.h:
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::marqueeBehavior const):
(WebCore::RenderStyle::marqueeDirection const):
(WebCore::RenderStyle::setMarqueeDirection):
(WebCore::RenderStyle::setMarqueeBehavior):
(WebCore::RenderStyle::initialMarqueeBehavior):
(WebCore::RenderStyle::initialMarqueeDirection):
* rendering/style/RenderStyleConstants.h:
* rendering/style/StyleMarqueeData.cpp:
(WebCore::StyleMarqueeData::StyleMarqueeData):
* rendering/style/StyleMarqueeData.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (226665 => 226666)


--- trunk/Source/WebCore/ChangeLog	2018-01-09 23:54:35 UTC (rev 226665)
+++ trunk/Source/WebCore/ChangeLog	2018-01-10 00:05:46 UTC (rev 226666)
@@ -1,3 +1,55 @@
+2018-01-08  Simon Fraser  <[email protected]>
+
+        Clean up Marquee-related enums
+        https://bugs.webkit.org/show_bug.cgi?id=181347
+
+        Reviewed by Anders Carlsson.
+
+        Modernize EMarqueeBehavior and EMarqueeDirection enums. Stop using the weird negative
+        values in the MarqueeDirection and do manual reverse direction mapping.
+
+        Make some member functions of RenderMarquee private.
+
+        Stop using bitfields in RenderMarquee because the memory saving is not worth it, and doing so
+        allows us to use modern initialization.
+
+        No behavior change.
+
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::operator MarqueeBehavior const):
+        (WebCore::CSSPrimitiveValue::operator MarqueeDirection const):
+        (WebCore::CSSPrimitiveValue::operator EMarqueeBehavior const): Deleted.
+        (WebCore::CSSPrimitiveValue::operator EMarqueeDirection const): Deleted.
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::adjustRenderStyle):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::sizesLogicalWidthToFitContent const):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::calculateClipRects const):
+        * rendering/RenderMarquee.cpp:
+        (WebCore::RenderMarquee::RenderMarquee):
+        (WebCore::reverseDirection):
+        (WebCore::RenderMarquee::direction const):
+        (WebCore::RenderMarquee::isHorizontal const):
+        (WebCore::RenderMarquee::computePosition):
+        (WebCore::RenderMarquee::start):
+        (WebCore::RenderMarquee::updateMarqueePosition):
+        (WebCore::RenderMarquee::updateMarqueeStyle):
+        (WebCore::RenderMarquee::timerFired):
+        * rendering/RenderMarquee.h:
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::marqueeBehavior const):
+        (WebCore::RenderStyle::marqueeDirection const):
+        (WebCore::RenderStyle::setMarqueeDirection):
+        (WebCore::RenderStyle::setMarqueeBehavior):
+        (WebCore::RenderStyle::initialMarqueeBehavior):
+        (WebCore::RenderStyle::initialMarqueeDirection):
+        * rendering/style/RenderStyleConstants.h:
+        * rendering/style/StyleMarqueeData.cpp:
+        (WebCore::StyleMarqueeData::StyleMarqueeData):
+        * rendering/style/StyleMarqueeData.h:
+
 2018-01-09  Jer Noble  <[email protected]>
 
         Many CVDisplayLink threads created and destroyed while watching a YouTube video

Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (226665 => 226666)


--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2018-01-09 23:54:35 UTC (rev 226665)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2018-01-10 00:05:46 UTC (rev 226666)
@@ -2011,103 +2011,103 @@
     return MCOLLAPSE;
 }
 
-template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarqueeBehavior e)
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(MarqueeBehavior e)
     : CSSValue(PrimitiveClass)
 {
     m_primitiveUnitType = CSS_VALUE_ID;
     switch (e) {
-    case MNONE:
+    case MarqueeBehavior::None:
         m_value.valueID = CSSValueNone;
         break;
-    case MSCROLL:
+    case MarqueeBehavior::Scroll:
         m_value.valueID = CSSValueScroll;
         break;
-    case MSLIDE:
+    case MarqueeBehavior::Slide:
         m_value.valueID = CSSValueSlide;
         break;
-    case MALTERNATE:
+    case MarqueeBehavior::Alternate:
         m_value.valueID = CSSValueAlternate;
         break;
     }
 }
 
-template<> inline CSSPrimitiveValue::operator EMarqueeBehavior() const
+template<> inline CSSPrimitiveValue::operator MarqueeBehavior() const
 {
     ASSERT(isValueID());
 
     switch (m_value.valueID) {
     case CSSValueNone:
-        return MNONE;
+        return MarqueeBehavior::None;
     case CSSValueScroll:
-        return MSCROLL;
+        return MarqueeBehavior::Scroll;
     case CSSValueSlide:
-        return MSLIDE;
+        return MarqueeBehavior::Slide;
     case CSSValueAlternate:
-        return MALTERNATE;
+        return MarqueeBehavior::Alternate;
     default:
         break;
     }
 
     ASSERT_NOT_REACHED();
-    return MNONE;
+    return MarqueeBehavior::None;
 }
 
-template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarqueeDirection e)
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(MarqueeDirection direction)
     : CSSValue(PrimitiveClass)
 {
     m_primitiveUnitType = CSS_VALUE_ID;
-    switch (e) {
-    case MFORWARD:
+    switch (direction) {
+    case MarqueeDirection::Forward:
         m_value.valueID = CSSValueForwards;
         break;
-    case MBACKWARD:
+    case MarqueeDirection::Backward:
         m_value.valueID = CSSValueBackwards;
         break;
-    case MAUTO:
+    case MarqueeDirection::Auto:
         m_value.valueID = CSSValueAuto;
         break;
-    case MUP:
+    case MarqueeDirection::Up:
         m_value.valueID = CSSValueUp;
         break;
-    case MDOWN:
+    case MarqueeDirection::Down:
         m_value.valueID = CSSValueDown;
         break;
-    case MLEFT:
+    case MarqueeDirection::Left:
         m_value.valueID = CSSValueLeft;
         break;
-    case MRIGHT:
+    case MarqueeDirection::Right:
         m_value.valueID = CSSValueRight;
         break;
     }
 }
 
-template<> inline CSSPrimitiveValue::operator EMarqueeDirection() const
+template<> inline CSSPrimitiveValue::operator MarqueeDirection() const
 {
     ASSERT(isValueID());
 
     switch (m_value.valueID) {
     case CSSValueForwards:
-        return MFORWARD;
+        return MarqueeDirection::Forward;
     case CSSValueBackwards:
-        return MBACKWARD;
+        return MarqueeDirection::Backward;
     case CSSValueAuto:
-        return MAUTO;
+        return MarqueeDirection::Auto;
     case CSSValueAhead:
     case CSSValueUp: // We don't support vertical languages, so AHEAD just maps to UP.
-        return MUP;
+        return MarqueeDirection::Up;
     case CSSValueReverse:
     case CSSValueDown: // REVERSE just maps to DOWN, since we don't do vertical text.
-        return MDOWN;
+        return MarqueeDirection::Down;
     case CSSValueLeft:
-        return MLEFT;
+        return MarqueeDirection::Left;
     case CSSValueRight:
-        return MRIGHT;
+        return MarqueeDirection::Right;
     default:
         break;
     }
 
     ASSERT_NOT_REACHED();
-    return MAUTO;
+    return MarqueeDirection::Auto;
 }
 
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ENBSPMode e)

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (226665 => 226666)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2018-01-09 23:54:35 UTC (rev 226665)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2018-01-10 00:05:46 UTC (rev 226666)
@@ -957,7 +957,7 @@
             style.setOverflowX(OHIDDEN);
             style.setOverflowY(OHIDDEN);
 
-            bool isVertical = style.marqueeDirection() == MUP || style.marqueeDirection() == MDOWN;
+            bool isVertical = style.marqueeDirection() == MarqueeDirection::Up || style.marqueeDirection() == MarqueeDirection::Down;
             // Make horizontal marquees not wrap.
             if (!isVertical) {
                 style.setWhiteSpace(NOWRAP);

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (226665 => 226666)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2018-01-09 23:54:35 UTC (rev 226665)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2018-01-10 00:05:46 UTC (rev 226666)
@@ -2508,13 +2508,13 @@
         return true;
 
     // Children of a horizontal marquee do not fill the container by default.
-    // FIXME: Need to deal with MAUTO value properly.  It could be vertical.
+    // FIXME: Need to deal with MarqueeDirection::Auto value properly. It could be vertical.
     // FIXME: Think about block-flow here.  Need to find out how marquee direction relates to
     // block-flow (as well as how marquee overflow should relate to block flow).
     // https://bugs.webkit.org/show_bug.cgi?id=46472
     if (parent()->isHTMLMarquee()) {
-        EMarqueeDirection dir = parent()->style().marqueeDirection();
-        if (dir == MAUTO || dir == MFORWARD || dir == MBACKWARD || dir == MLEFT || dir == MRIGHT)
+        MarqueeDirection dir = parent()->style().marqueeDirection();
+        if (dir == MarqueeDirection::Auto || dir == MarqueeDirection::Forward || dir == MarqueeDirection::Backward || dir == MarqueeDirection::Left || dir == MarqueeDirection::Right)
             return true;
     }
 

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (226665 => 226666)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2018-01-09 23:54:35 UTC (rev 226665)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2018-01-10 00:05:46 UTC (rev 226666)
@@ -6663,7 +6663,7 @@
         dirtyStackingContainerZOrderLists();
     }
 
-    if (renderer().isHTMLMarquee() && renderer().style().marqueeBehavior() != MNONE && renderer().isBox()) {
+    if (renderer().isHTMLMarquee() && renderer().style().marqueeBehavior() != MarqueeBehavior::None && renderer().isBox()) {
         if (!m_marquee)
             m_marquee = std::make_unique<RenderMarquee>(this);
         m_marquee->updateMarqueeStyle();

Modified: trunk/Source/WebCore/rendering/RenderMarquee.cpp (226665 => 226666)


--- trunk/Source/WebCore/rendering/RenderMarquee.cpp	2018-01-09 23:54:35 UTC (rev 226665)
+++ trunk/Source/WebCore/rendering/RenderMarquee.cpp	2018-01-10 00:05:46 UTC (rev 226666)
@@ -56,15 +56,11 @@
 
 using namespace HTMLNames;
 
-RenderMarquee::RenderMarquee(RenderLayer* l)
-    : m_layer(l)
+RenderMarquee::RenderMarquee(RenderLayer* layer)
+    : m_layer(layer)
     , m_timer(*this, &RenderMarquee::timerFired)
-    , m_reset(false)
-    , m_suspended(false)
-    , m_stopped(false)
-    , m_direction(MAUTO)
 {
-    l->setConstrainsScrollingToContentEdge(false);
+    layer->setConstrainsScrollingToContentEdge(false);
 }
 
 RenderMarquee::~RenderMarquee() = default;
@@ -78,24 +74,45 @@
     return result;
 }
 
-EMarqueeDirection RenderMarquee::direction() const
+static MarqueeDirection reverseDirection(MarqueeDirection direction)
 {
+    switch (direction) {
+    case MarqueeDirection::Auto:
+        return MarqueeDirection::Auto;
+    case MarqueeDirection::Left:
+        return MarqueeDirection::Right;
+    case MarqueeDirection::Right:
+        return MarqueeDirection::Left;
+    case MarqueeDirection::Up:
+        return MarqueeDirection::Down;
+    case MarqueeDirection::Down:
+        return MarqueeDirection::Up;
+    case MarqueeDirection::Backward:
+        return MarqueeDirection::Forward;
+    case MarqueeDirection::Forward:
+        return MarqueeDirection::Backward;
+    }
+    return MarqueeDirection::Auto;
+}
+
+MarqueeDirection RenderMarquee::direction() const
+{
     // FIXME: Support the CSS3 "auto" value for determining the direction of the marquee.
-    // For now just map MAUTO to MBACKWARD
-    EMarqueeDirection result = m_layer->renderer().style().marqueeDirection();
+    // For now just map MarqueeDirection::Auto to MarqueeDirection::Backward
+    MarqueeDirection result = m_layer->renderer().style().marqueeDirection();
     TextDirection dir = m_layer->renderer().style().direction();
-    if (result == MAUTO)
-        result = MBACKWARD;
-    if (result == MFORWARD)
-        result = (dir == LTR) ? MRIGHT : MLEFT;
-    if (result == MBACKWARD)
-        result = (dir == LTR) ? MLEFT : MRIGHT;
+    if (result == MarqueeDirection::Auto)
+        result = MarqueeDirection::Backward;
+    if (result == MarqueeDirection::Forward)
+        result = (dir == LTR) ? MarqueeDirection::Right : MarqueeDirection::Left;
+    if (result == MarqueeDirection::Backward)
+        result = (dir == LTR) ? MarqueeDirection::Left : MarqueeDirection::Right;
     
     // Now we have the real direction.  Next we check to see if the increment is negative.
     // If so, then we reverse the direction.
     Length increment = m_layer->renderer().style().marqueeIncrement();
     if (increment.isNegative())
-        result = static_cast<EMarqueeDirection>(-result);
+        result = reverseDirection(result);
     
     return result;
 }
@@ -102,10 +119,10 @@
 
 bool RenderMarquee::isHorizontal() const
 {
-    return direction() == MLEFT || direction() == MRIGHT;
+    return direction() == MarqueeDirection::Left || direction() == MarqueeDirection::Right;
 }
 
-int RenderMarquee::computePosition(EMarqueeDirection dir, bool stopAtContentEdge)
+int RenderMarquee::computePosition(MarqueeDirection dir, bool stopAtContentEdge)
 {
     RenderBox* box = m_layer->renderBox();
     ASSERT(box);
@@ -120,35 +137,33 @@
             contentWidth = box->width() - contentWidth;
             contentWidth += (box->paddingLeft() - box->borderRight());
         }
-        if (dir == MRIGHT) {
+        if (dir == MarqueeDirection::Right) {
             if (stopAtContentEdge)
                 return std::max<LayoutUnit>(0, ltr ? (contentWidth - clientWidth) : (clientWidth - contentWidth));
-            else
-                return ltr ? contentWidth : clientWidth;
+
+            return ltr ? contentWidth : clientWidth;
         }
-        else {
-            if (stopAtContentEdge)
-                return std::min<LayoutUnit>(0, ltr ? (contentWidth - clientWidth) : (clientWidth - contentWidth));
-            else
-                return ltr ? -clientWidth : -contentWidth;
-        }
+
+        if (stopAtContentEdge)
+            return std::min<LayoutUnit>(0, ltr ? (contentWidth - clientWidth) : (clientWidth - contentWidth));
+
+        return ltr ? -clientWidth : -contentWidth;
     }
-    else {
-        int contentHeight = box->layoutOverflowRect().maxY() - box->borderTop() + box->paddingBottom();
-        int clientHeight = roundToInt(box->clientHeight());
-        if (dir == MUP) {
-            if (stopAtContentEdge)
-                 return std::min(contentHeight - clientHeight, 0);
-            else
-                return -clientHeight;
-        }
-        else {
-            if (stopAtContentEdge)
-                return std::max(contentHeight - clientHeight, 0);
-            else 
-                return contentHeight;
-        }
-    }    
+
+    // Vertical
+    int contentHeight = box->layoutOverflowRect().maxY() - box->borderTop() + box->paddingBottom();
+    int clientHeight = roundToInt(box->clientHeight());
+    if (dir == MarqueeDirection::Up) {
+        if (stopAtContentEdge)
+            return std::min(contentHeight - clientHeight, 0);
+
+        return -clientHeight;
+    }
+
+    if (stopAtContentEdge)
+        return std::max(contentHeight - clientHeight, 0);
+
+    return contentHeight;
 }
 
 void RenderMarquee::start()
@@ -161,8 +176,7 @@
             m_layer->scrollToOffset(ScrollOffset(m_start, 0), ScrollClamping::Unclamped);
         else
             m_layer->scrollToOffset(ScrollOffset(0, m_start), ScrollClamping::Unclamped);
-    }
-    else {
+    } else {
         m_suspended = false;
         m_stopped = false;
     }
@@ -186,9 +200,9 @@
 {
     bool activate = (m_totalLoops <= 0 || m_currentLoop < m_totalLoops);
     if (activate) {
-        EMarqueeBehavior behavior = m_layer->renderer().style().marqueeBehavior();
-        m_start = computePosition(direction(), behavior == MALTERNATE);
-        m_end = computePosition(reverseDirection(), behavior == MALTERNATE || behavior == MSLIDE);
+        MarqueeBehavior behavior = m_layer->renderer().style().marqueeBehavior();
+        m_start = computePosition(direction(), behavior == MarqueeBehavior::Alternate);
+        m_end = computePosition(reverseDirection(direction()), behavior == MarqueeBehavior::Alternate || behavior == MarqueeBehavior::Slide);
         if (!m_stopped)
             start();
     }
@@ -207,7 +221,7 @@
     if (m_layer->renderer().isHTMLMarquee()) {
         // Hack for WinIE.  In WinIE, a value of 0 or lower for the loop count for SLIDE means to only do
         // one loop.
-        if (m_totalLoops <= 0 && style.marqueeBehavior() == MSLIDE)
+        if (m_totalLoops <= 0 && style.marqueeBehavior() == MarqueeBehavior::Slide)
             m_totalLoops = 1;
     }
     
@@ -247,8 +261,8 @@
     if (range == 0)
         newPos = m_end;
     else {  
-        bool addIncrement = direction() == MUP || direction() == MLEFT;
-        bool isReversed = style.marqueeBehavior() == MALTERNATE && m_currentLoop % 2;
+        bool addIncrement = direction() == MarqueeDirection::Up || direction() == MarqueeDirection::Left;
+        bool isReversed = style.marqueeBehavior() == MarqueeBehavior::Alternate && m_currentLoop % 2;
         if (isReversed) {
             // We're going in the reverse direction.
             endPoint = m_start;
@@ -270,7 +284,7 @@
         m_currentLoop++;
         if (m_totalLoops > 0 && m_currentLoop >= m_totalLoops)
             m_timer.stop();
-        else if (style.marqueeBehavior() != MALTERNATE)
+        else if (style.marqueeBehavior() != MarqueeBehavior::Alternate)
             m_reset = true;
     }
     

Modified: trunk/Source/WebCore/rendering/RenderMarquee.h (226665 => 226666)


--- trunk/Source/WebCore/rendering/RenderMarquee.h	2018-01-09 23:54:35 UTC (rev 226665)
+++ trunk/Source/WebCore/rendering/RenderMarquee.h	2018-01-10 00:05:46 UTC (rev 226666)
@@ -58,18 +58,8 @@
     explicit RenderMarquee(RenderLayer*);
     ~RenderMarquee();
 
-    int speed() const { return m_speed; }
-    int marqueeSpeed() const;
-
-    EMarqueeDirection reverseDirection() const { return static_cast<EMarqueeDirection>(-direction()); }
-    EMarqueeDirection direction() const;
-
     bool isHorizontal() const;
 
-    int computePosition(EMarqueeDirection, bool stopAtClientEdge);
-
-    void setEnd(int end) { m_end = end; }
-    
     void start();
     void suspend();
     void stop();
@@ -78,6 +68,16 @@
     void updateMarqueePosition();
 
 private:
+
+    int speed() const { return m_speed; }
+    int marqueeSpeed() const;
+
+    MarqueeDirection direction() const;
+
+    int computePosition(MarqueeDirection, bool stopAtClientEdge);
+
+    void setEnd(int end) { m_end = end; }
+
     void timerFired();
 
     RenderLayer* m_layer;
@@ -88,10 +88,10 @@
     int m_end { 0 };
     int m_speed { 0 };
     Length m_height;
-    bool m_reset: 1;
-    bool m_suspended : 1;
-    bool m_stopped : 1;
-    EMarqueeDirection m_direction : 4; // Not unsigned because EMarqueeDirection has negative values
+    MarqueeDirection m_direction { MarqueeDirection::Auto };
+    bool m_reset { false };
+    bool m_suspended { false };
+    bool m_stopped { false };
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (226665 => 226666)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2018-01-09 23:54:35 UTC (rev 226665)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2018-01-10 00:05:46 UTC (rev 226666)
@@ -575,8 +575,8 @@
     const Length& marqueeIncrement() const { return m_rareNonInheritedData->marquee->increment; }
     int marqueeSpeed() const { return m_rareNonInheritedData->marquee->speed; }
     int marqueeLoopCount() const { return m_rareNonInheritedData->marquee->loops; }
-    EMarqueeBehavior marqueeBehavior() const { return static_cast<EMarqueeBehavior>(m_rareNonInheritedData->marquee->behavior); }
-    EMarqueeDirection marqueeDirection() const { return static_cast<EMarqueeDirection>(m_rareNonInheritedData->marquee->direction); }
+    MarqueeBehavior marqueeBehavior() const { return static_cast<MarqueeBehavior>(m_rareNonInheritedData->marquee->behavior); }
+    MarqueeDirection marqueeDirection() const { return static_cast<MarqueeDirection>(m_rareNonInheritedData->marquee->direction); }
     EUserModify userModify() const { return static_cast<EUserModify>(m_rareInheritedData->userModify); }
     EUserDrag userDrag() const { return static_cast<EUserDrag>(m_rareNonInheritedData->userDrag); }
     EUserSelect userSelect() const { return static_cast<EUserSelect>(m_rareInheritedData->userSelect); }
@@ -1100,8 +1100,8 @@
 
     void setMarqueeIncrement(Length&& length) { SET_NESTED_VAR(m_rareNonInheritedData, marquee, increment, WTFMove(length)); }
     void setMarqueeSpeed(int f) { SET_NESTED_VAR(m_rareNonInheritedData, marquee, speed, f); }
-    void setMarqueeDirection(EMarqueeDirection d) { SET_NESTED_VAR(m_rareNonInheritedData, marquee, direction, d); }
-    void setMarqueeBehavior(EMarqueeBehavior b) { SET_NESTED_VAR(m_rareNonInheritedData, marquee, behavior, b); }
+    void setMarqueeDirection(MarqueeDirection d) { SET_NESTED_VAR(m_rareNonInheritedData, marquee, direction, static_cast<unsigned>(d)); }
+    void setMarqueeBehavior(MarqueeBehavior b) { SET_NESTED_VAR(m_rareNonInheritedData, marquee, behavior, static_cast<unsigned>(b)); }
     void setMarqueeLoopCount(int i) { SET_NESTED_VAR(m_rareNonInheritedData, marquee, loops, i); }
     void setUserModify(EUserModify u) { SET_VAR(m_rareInheritedData, userModify, u); }
     void setUserDrag(EUserDrag d) { SET_VAR(m_rareNonInheritedData, userDrag, d); }
@@ -1502,8 +1502,8 @@
     static int initialMarqueeLoopCount() { return -1; }
     static int initialMarqueeSpeed() { return 85; }
     static Length initialMarqueeIncrement() { return Length(6, Fixed); }
-    static EMarqueeBehavior initialMarqueeBehavior() { return MSCROLL; }
-    static EMarqueeDirection initialMarqueeDirection() { return MAUTO; }
+    static MarqueeBehavior initialMarqueeBehavior() { return MarqueeBehavior::Scroll; }
+    static MarqueeDirection initialMarqueeDirection() { return MarqueeDirection::Auto; }
     static EUserModify initialUserModify() { return READ_ONLY; }
     static EUserDrag initialUserDrag() { return DRAG_AUTO; }
     static EUserSelect initialUserSelect() { return SELECT_TEXT; }

Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.h (226665 => 226666)


--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2018-01-09 23:54:35 UTC (rev 226665)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2018-01-10 00:05:46 UTC (rev 226666)
@@ -239,9 +239,20 @@
 
 // CSS3 Marquee Properties
 
-enum EMarqueeBehavior { MNONE, MSCROLL, MSLIDE, MALTERNATE };
-enum EMarqueeDirection { MAUTO = 0, MLEFT = 1, MRIGHT = -1, MUP = 2, MDOWN = -2, MFORWARD = 3, MBACKWARD = -3 };
+enum class MarqueeBehavior {
+    None, Scroll, Slide, Alternate
+};
 
+enum class MarqueeDirection {
+    Auto,
+    Left,
+    Right,
+    Up,
+    Down,
+    Forward,
+    Backward
+};
+
 // Deprecated Flexible Box Properties
 
 enum EBoxPack { Start, Center, End, Justify };

Modified: trunk/Source/WebCore/rendering/style/StyleMarqueeData.cpp (226665 => 226666)


--- trunk/Source/WebCore/rendering/style/StyleMarqueeData.cpp	2018-01-09 23:54:35 UTC (rev 226665)
+++ trunk/Source/WebCore/rendering/style/StyleMarqueeData.cpp	2018-01-10 00:05:46 UTC (rev 226666)
@@ -30,8 +30,8 @@
     : increment(RenderStyle::initialMarqueeIncrement())
     , speed(RenderStyle::initialMarqueeSpeed())
     , loops(RenderStyle::initialMarqueeLoopCount())
-    , behavior(RenderStyle::initialMarqueeBehavior())
-    , direction(RenderStyle::initialMarqueeDirection())
+    , behavior(static_cast<unsigned>(RenderStyle::initialMarqueeBehavior()))
+    , direction(static_cast<unsigned>(RenderStyle::initialMarqueeDirection()))
 {
 }
 

Modified: trunk/Source/WebCore/rendering/style/StyleMarqueeData.h (226665 => 226666)


--- trunk/Source/WebCore/rendering/style/StyleMarqueeData.h	2018-01-09 23:54:35 UTC (rev 226665)
+++ trunk/Source/WebCore/rendering/style/StyleMarqueeData.h	2018-01-10 00:05:46 UTC (rev 226666)
@@ -47,8 +47,8 @@
 
     int loops; // -1 means infinite.
 
-    unsigned behavior : 2; // EMarqueeBehavior 
-    EMarqueeDirection direction : 3; // not unsigned because EMarqueeDirection has negative values
+    unsigned behavior : 2; // MarqueeBehavior 
+    unsigned direction : 3; // MarqueeDirection
 
 private:
     StyleMarqueeData();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to