Created
March 30, 2017 05:03
-
-
Save darrnshn/62fcf57ebdd86dffa2502cb9e2cbfd15 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
| // Use of this source code is governed by a BSD-style license that can be | |
| // found in the LICENSE file. | |
| #include "core/ComputedStyleBase.h" | |
| #include "wtf/SizeAssertions.h" | |
| namespace blink { | |
| /* | |
| struct SameSizeAsComputedStyleBase { | |
| unsigned m_bit_fields[]; | |
| }; | |
| // If this fails, the packing algorithm in make_computed_style_base.py has | |
| // failed to produce the optimal packed size. To fix, update the algorithm to | |
| // ensure that the buckets are placed so that each takes up at most 1 word. | |
| ASSERT_SIZE(ComputedStyleBase, SameSizeAsComputedStyleBase); | |
| */ | |
| void ComputedStyleBase::inheritFrom(const ComputedStyleBase& inheritParent, | |
| IsAtShadowBoundary isAtShadowBoundary) { | |
| m_cursor = inheritParent.m_cursor; | |
| m_listStyleType = inheritParent.m_listStyleType; | |
| m_pointerEvents = inheritParent.m_pointerEvents; | |
| m_textAlign = inheritParent.m_textAlign; | |
| m_whiteSpace = inheritParent.m_whiteSpace; | |
| m_captionSide = inheritParent.m_captionSide; | |
| m_writingMode = inheritParent.m_writingMode; | |
| m_textTransform = inheritParent.m_textTransform; | |
| m_visibility = inheritParent.m_visibility; | |
| m_insideLink = inheritParent.m_insideLink; | |
| m_boxDirection = inheritParent.m_boxDirection; | |
| m_printColorAdjust = inheritParent.m_printColorAdjust; | |
| m_borderCollapse = inheritParent.m_borderCollapse; | |
| m_rtlOrdering = inheritParent.m_rtlOrdering; | |
| m_listStylePosition = inheritParent.m_listStylePosition; | |
| m_direction = inheritParent.m_direction; | |
| m_emptyCells = inheritParent.m_emptyCells; | |
| m_hasSimpleUnderline = inheritParent.m_hasSimpleUnderline; | |
| } | |
| void ComputedStyleBase::copyNonInheritedFromCached( | |
| const ComputedStyleBase& other) { | |
| m_surround.access()->m_bottom = other.m_surround->m_bottom; | |
| m_surround.access()->m_top = other.m_surround->m_top; | |
| m_surround.access()->m_padding = other.m_surround->m_padding; | |
| m_surround.access()->m_left = other.m_surround->m_left; | |
| m_surround.access()->m_margin = other.m_surround->m_margin; | |
| m_surround.access()->m_right = other.m_surround->m_right; | |
| m_surround.access()->m_border = other.m_surround->m_border; | |
| m_display = other.m_display; | |
| m_boxDirectionIsInherited = other.m_boxDirectionIsInherited; | |
| m_breakBefore = other.m_breakBefore; | |
| m_breakAfter = other.m_breakAfter; | |
| m_unicodeBidi = other.m_unicodeBidi; | |
| m_overflowX = other.m_overflowX; | |
| m_overflowY = other.m_overflowY; | |
| m_clear = other.m_clear; | |
| m_position = other.m_position; | |
| m_floating = other.m_floating; | |
| m_breakInside = other.m_breakInside; | |
| m_overflowAnchor = other.m_overflowAnchor; | |
| m_captionSideIsInherited = other.m_captionSideIsInherited; | |
| m_printColorAdjustIsInherited = other.m_printColorAdjustIsInherited; | |
| m_borderCollapseIsInherited = other.m_borderCollapseIsInherited; | |
| m_rtlOrderingIsInherited = other.m_rtlOrderingIsInherited; | |
| m_whiteSpaceIsInherited = other.m_whiteSpaceIsInherited; | |
| m_tableLayout = other.m_tableLayout; | |
| m_listStylePositionIsInherited = other.m_listStylePositionIsInherited; | |
| m_pointerEventsIsInherited = other.m_pointerEventsIsInherited; | |
| m_textTransformIsInherited = other.m_textTransformIsInherited; | |
| m_emptyCellsIsInherited = other.m_emptyCellsIsInherited; | |
| m_textAlignIsInherited = other.m_textAlignIsInherited; | |
| m_visibilityIsInherited = other.m_visibilityIsInherited; | |
| } | |
| void ComputedStyleBase::propagateIndependentInheritedProperties( | |
| const ComputedStyleBase& parentStyle) { | |
| if (pointerEventsIsInherited()) | |
| m_pointerEvents = parentStyle.m_pointerEvents; | |
| if (textAlignIsInherited()) | |
| m_textAlign = parentStyle.m_textAlign; | |
| if (whiteSpaceIsInherited()) | |
| m_whiteSpace = parentStyle.m_whiteSpace; | |
| if (captionSideIsInherited()) | |
| m_captionSide = parentStyle.m_captionSide; | |
| if (textTransformIsInherited()) | |
| m_textTransform = parentStyle.m_textTransform; | |
| if (visibilityIsInherited()) | |
| m_visibility = parentStyle.m_visibility; | |
| if (boxDirectionIsInherited()) | |
| m_boxDirection = parentStyle.m_boxDirection; | |
| if (printColorAdjustIsInherited()) | |
| m_printColorAdjust = parentStyle.m_printColorAdjust; | |
| if (borderCollapseIsInherited()) | |
| m_borderCollapse = parentStyle.m_borderCollapse; | |
| if (rtlOrderingIsInherited()) | |
| m_rtlOrdering = parentStyle.m_rtlOrdering; | |
| if (listStylePositionIsInherited()) | |
| m_listStylePosition = parentStyle.m_listStylePosition; | |
| if (emptyCellsIsInherited()) | |
| m_emptyCells = parentStyle.m_emptyCells; | |
| } | |
| } // namespace blink |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
| // Use of this source code is governed by a BSD-style license that can be | |
| // found in the LICENSE file. | |
| #ifndef ComputedStyleBase_h | |
| #define ComputedStyleBase_h | |
| #include "core/style/ComputedStyleConstants.h" | |
| #include "core/CoreExport.h" | |
| #include "core/style/DataRef.h" | |
| #include "core/style/BorderData.h" | |
| #include "platform/Length.h" | |
| #include "platform/LengthBox.h" | |
| #include "platform/text/TextDirection.h" | |
| #include "platform/text/UnicodeBidi.h" | |
| #include "platform/text/WritingMode.h" | |
| namespace blink { | |
| // The generated portion of ComputedStyle. For more info, see the header comment | |
| // in ComputedStyle.h. | |
| class CORE_EXPORT ComputedStyleBase { | |
| public: | |
| inline bool independentInheritedEqual(const ComputedStyleBase& o) const { | |
| return ( | |
| m_pointerEvents == o.m_pointerEvents && | |
| m_textAlign == o.m_textAlign && | |
| m_whiteSpace == o.m_whiteSpace && | |
| m_captionSide == o.m_captionSide && | |
| m_textTransform == o.m_textTransform && | |
| m_visibility == o.m_visibility && | |
| m_boxDirection == o.m_boxDirection && | |
| m_printColorAdjust == o.m_printColorAdjust && | |
| m_borderCollapse == o.m_borderCollapse && | |
| m_rtlOrdering == o.m_rtlOrdering && | |
| m_listStylePosition == o.m_listStylePosition && | |
| m_emptyCells == o.m_emptyCells | |
| ); | |
| } | |
| inline bool nonIndependentInheritedEqual(const ComputedStyleBase& o) const { | |
| return ( | |
| m_cursor == o.m_cursor && | |
| m_listStyleType == o.m_listStyleType && | |
| m_writingMode == o.m_writingMode && | |
| m_insideLink == o.m_insideLink && | |
| m_direction == o.m_direction && | |
| m_hasSimpleUnderline == o.m_hasSimpleUnderline | |
| ); | |
| } | |
| inline bool inheritedEqual(const ComputedStyleBase& o) const { | |
| return independentInheritedEqual(o) && nonIndependentInheritedEqual(o); | |
| } | |
| inline bool nonInheritedEqual(const ComputedStyleBase& o) const { | |
| return ( | |
| m_display == o.m_display && | |
| m_breakBefore == o.m_breakBefore && | |
| m_breakAfter == o.m_breakAfter && | |
| m_unicodeBidi == o.m_unicodeBidi && | |
| m_overflowX == o.m_overflowX && | |
| m_overflowY == o.m_overflowY && | |
| m_clear == o.m_clear && | |
| m_position == o.m_position && | |
| m_floating == o.m_floating && | |
| m_breakInside == o.m_breakInside && | |
| m_overflowAnchor == o.m_overflowAnchor && | |
| m_tableLayout == o.m_tableLayout | |
| ); | |
| } | |
| enum IsAtShadowBoundary { | |
| AtShadowBoundary, | |
| NotAtShadowBoundary, | |
| }; | |
| void inheritFrom(const ComputedStyleBase& inheritParent, | |
| IsAtShadowBoundary isAtShadowBoundary = NotAtShadowBoundary); | |
| void copyNonInheritedFromCached(const ComputedStyleBase& other); | |
| // Copies the values of any independent inherited properties from the parent | |
| // style that are marked as inherited by this style. | |
| void propagateIndependentInheritedProperties( | |
| const ComputedStyleBase& parentStyle); | |
| // Fields. | |
| // TODO(sashab): Remove initialFoo() static methods and update callers to | |
| // use resetFoo(), which can be more efficient. | |
| // bottom | |
| inline static Length initialBottom() { | |
| return Length(); | |
| } | |
| const Length& bottom() const { | |
| return m_surround->m_bottom; | |
| } | |
| void setBottom(const Length& v) { | |
| m_surround.access()->m_bottom = v; | |
| } | |
| inline void resetBottom() { | |
| m_surround.access()->m_bottom = Length(); | |
| } | |
| void setBottom(Length&& v) { | |
| m_surround.access()->m_bottom = std::move(v); | |
| } | |
| // top | |
| inline static Length initialTop() { | |
| return Length(); | |
| } | |
| const Length& top() const { | |
| return m_surround->m_top; | |
| } | |
| void setTop(const Length& v) { | |
| m_surround.access()->m_top = v; | |
| } | |
| inline void resetTop() { | |
| m_surround.access()->m_top = Length(); | |
| } | |
| void setTop(Length&& v) { | |
| m_surround.access()->m_top = std::move(v); | |
| } | |
| // padding | |
| inline static LengthBox initialPadding() { | |
| return LengthBox(Fixed); | |
| } | |
| const LengthBox& padding() const { | |
| return m_surround->m_padding; | |
| } | |
| void setPadding(const LengthBox& v) { | |
| m_surround.access()->m_padding = v; | |
| } | |
| inline void resetPadding() { | |
| m_surround.access()->m_padding = LengthBox(Fixed); | |
| } | |
| void setPadding(LengthBox&& v) { | |
| m_surround.access()->m_padding = std::move(v); | |
| } | |
| // left | |
| inline static Length initialLeft() { | |
| return Length(); | |
| } | |
| const Length& left() const { | |
| return m_surround->m_left; | |
| } | |
| void setLeft(const Length& v) { | |
| m_surround.access()->m_left = v; | |
| } | |
| inline void resetLeft() { | |
| m_surround.access()->m_left = Length(); | |
| } | |
| void setLeft(Length&& v) { | |
| m_surround.access()->m_left = std::move(v); | |
| } | |
| // margin | |
| inline static LengthBox initialMargin() { | |
| return LengthBox(Fixed); | |
| } | |
| const LengthBox& margin() const { | |
| return m_surround->m_margin; | |
| } | |
| void setMargin(const LengthBox& v) { | |
| m_surround.access()->m_margin = v; | |
| } | |
| inline void resetMargin() { | |
| m_surround.access()->m_margin = LengthBox(Fixed); | |
| } | |
| void setMargin(LengthBox&& v) { | |
| m_surround.access()->m_margin = std::move(v); | |
| } | |
| // right | |
| inline static Length initialRight() { | |
| return Length(); | |
| } | |
| const Length& right() const { | |
| return m_surround->m_right; | |
| } | |
| void setRight(const Length& v) { | |
| m_surround.access()->m_right = v; | |
| } | |
| inline void resetRight() { | |
| m_surround.access()->m_right = Length(); | |
| } | |
| void setRight(Length&& v) { | |
| m_surround.access()->m_right = std::move(v); | |
| } | |
| // border | |
| inline static BorderData initialBorder() { | |
| return BorderData(); | |
| } | |
| const BorderData& border() const { | |
| return m_surround->m_border; | |
| } | |
| void setBorder(const BorderData& v) { | |
| m_surround.access()->m_border = v; | |
| } | |
| inline void resetBorder() { | |
| m_surround.access()->m_border = BorderData(); | |
| } | |
| void setBorder(BorderData&& v) { | |
| m_surround.access()->m_border = std::move(v); | |
| } | |
| // PseudoBits | |
| // Getters and setters not generated | |
| // cursor | |
| inline static ECursor initialCursor() { | |
| return ECursor::kAuto; | |
| } | |
| ECursor cursor() const { | |
| return static_cast<ECursor>(m_cursor); | |
| } | |
| void setCursor(const ECursor& v) { | |
| m_cursor = static_cast<unsigned>(v); | |
| } | |
| inline void resetCursor() { | |
| m_cursor = static_cast<unsigned>(ECursor::kAuto); | |
| } | |
| // list-style-type | |
| inline static EListStyleType initialListStyleType() { | |
| return EListStyleType::kDisc; | |
| } | |
| EListStyleType listStyleType() const { | |
| return static_cast<EListStyleType>(m_listStyleType); | |
| } | |
| void setListStyleType(const EListStyleType& v) { | |
| m_listStyleType = static_cast<unsigned>(v); | |
| } | |
| inline void resetListStyleType() { | |
| m_listStyleType = static_cast<unsigned>(EListStyleType::kDisc); | |
| } | |
| // StyleType | |
| // Getters and setters not generated | |
| // display | |
| inline static EDisplay initialDisplay() { | |
| return EDisplay::kInline; | |
| } | |
| EDisplay display() const { | |
| return static_cast<EDisplay>(m_display); | |
| } | |
| void setDisplay(const EDisplay& v) { | |
| m_display = static_cast<unsigned>(v); | |
| } | |
| inline void resetDisplay() { | |
| m_display = static_cast<unsigned>(EDisplay::kInline); | |
| } | |
| // -webkit-box-direction | |
| inline static bool initialBoxDirectionIsInherited() { | |
| return true; | |
| } | |
| bool boxDirectionIsInherited() const { | |
| return static_cast<bool>(m_boxDirectionIsInherited); | |
| } | |
| void setBoxDirectionIsInherited(const bool& v) { | |
| m_boxDirectionIsInherited = static_cast<unsigned>(v); | |
| } | |
| inline void resetBoxDirectionIsInherited() { | |
| m_boxDirectionIsInherited = static_cast<unsigned>(true); | |
| } | |
| // OriginalDisplay | |
| inline static EDisplay initialOriginalDisplay() { | |
| return EDisplay::kInline; | |
| } | |
| EDisplay originalDisplay() const { | |
| return static_cast<EDisplay>(m_originalDisplay); | |
| } | |
| void setOriginalDisplay(const EDisplay& v) { | |
| m_originalDisplay = static_cast<unsigned>(v); | |
| } | |
| inline void resetOriginalDisplay() { | |
| m_originalDisplay = static_cast<unsigned>(EDisplay::kInline); | |
| } | |
| // break-before | |
| inline static EBreakBetween initialBreakBefore() { | |
| return EBreakBetween::kAuto; | |
| } | |
| EBreakBetween breakBefore() const { | |
| return static_cast<EBreakBetween>(m_breakBefore); | |
| } | |
| void setBreakBefore(const EBreakBetween& v) { | |
| m_breakBefore = static_cast<unsigned>(v); | |
| } | |
| inline void resetBreakBefore() { | |
| m_breakBefore = static_cast<unsigned>(EBreakBetween::kAuto); | |
| } | |
| // break-after | |
| inline static EBreakBetween initialBreakAfter() { | |
| return EBreakBetween::kAuto; | |
| } | |
| EBreakBetween breakAfter() const { | |
| return static_cast<EBreakBetween>(m_breakAfter); | |
| } | |
| void setBreakAfter(const EBreakBetween& v) { | |
| m_breakAfter = static_cast<unsigned>(v); | |
| } | |
| inline void resetBreakAfter() { | |
| m_breakAfter = static_cast<unsigned>(EBreakBetween::kAuto); | |
| } | |
| // pointer-events | |
| inline static EPointerEvents initialPointerEvents() { | |
| return EPointerEvents::kAuto; | |
| } | |
| EPointerEvents pointerEvents() const { | |
| return static_cast<EPointerEvents>(m_pointerEvents); | |
| } | |
| void setPointerEvents(const EPointerEvents& v) { | |
| m_pointerEvents = static_cast<unsigned>(v); | |
| } | |
| inline void resetPointerEvents() { | |
| m_pointerEvents = static_cast<unsigned>(EPointerEvents::kAuto); | |
| } | |
| // text-align | |
| inline static ETextAlign initialTextAlign() { | |
| return ETextAlign::kStart; | |
| } | |
| ETextAlign textAlign() const { | |
| return static_cast<ETextAlign>(m_textAlign); | |
| } | |
| void setTextAlign(const ETextAlign& v) { | |
| m_textAlign = static_cast<unsigned>(v); | |
| } | |
| inline void resetTextAlign() { | |
| m_textAlign = static_cast<unsigned>(ETextAlign::kStart); | |
| } | |
| // unicode-bidi | |
| inline static UnicodeBidi initialUnicodeBidi() { | |
| return UnicodeBidi::kNormal; | |
| } | |
| UnicodeBidi getUnicodeBidi() const { | |
| return static_cast<UnicodeBidi>(m_unicodeBidi); | |
| } | |
| void setUnicodeBidi(const UnicodeBidi& v) { | |
| m_unicodeBidi = static_cast<unsigned>(v); | |
| } | |
| inline void resetUnicodeBidi() { | |
| m_unicodeBidi = static_cast<unsigned>(UnicodeBidi::kNormal); | |
| } | |
| // overflow-x | |
| inline static EOverflow initialOverflowX() { | |
| return EOverflow::kVisible; | |
| } | |
| EOverflow overflowX() const { | |
| return static_cast<EOverflow>(m_overflowX); | |
| } | |
| void setOverflowX(const EOverflow& v) { | |
| m_overflowX = static_cast<unsigned>(v); | |
| } | |
| inline void resetOverflowX() { | |
| m_overflowX = static_cast<unsigned>(EOverflow::kVisible); | |
| } | |
| // overflow-y | |
| inline static EOverflow initialOverflowY() { | |
| return EOverflow::kVisible; | |
| } | |
| EOverflow overflowY() const { | |
| return static_cast<EOverflow>(m_overflowY); | |
| } | |
| void setOverflowY(const EOverflow& v) { | |
| m_overflowY = static_cast<unsigned>(v); | |
| } | |
| inline void resetOverflowY() { | |
| m_overflowY = static_cast<unsigned>(EOverflow::kVisible); | |
| } | |
| // clear | |
| inline static EClear initialClear() { | |
| return EClear::kNone; | |
| } | |
| EClear clear() const { | |
| return static_cast<EClear>(m_clear); | |
| } | |
| void setClear(const EClear& v) { | |
| m_clear = static_cast<unsigned>(v); | |
| } | |
| inline void resetClear() { | |
| m_clear = static_cast<unsigned>(EClear::kNone); | |
| } | |
| // position | |
| inline static EPosition initialPosition() { | |
| return EPosition::kStatic; | |
| } | |
| EPosition position() const { | |
| return static_cast<EPosition>(m_position); | |
| } | |
| void setPosition(const EPosition& v) { | |
| m_position = static_cast<unsigned>(v); | |
| } | |
| inline void resetPosition() { | |
| m_position = static_cast<unsigned>(EPosition::kStatic); | |
| } | |
| // white-space | |
| inline static EWhiteSpace initialWhiteSpace() { | |
| return EWhiteSpace::kNormal; | |
| } | |
| EWhiteSpace whiteSpace() const { | |
| return static_cast<EWhiteSpace>(m_whiteSpace); | |
| } | |
| void setWhiteSpace(const EWhiteSpace& v) { | |
| m_whiteSpace = static_cast<unsigned>(v); | |
| } | |
| inline void resetWhiteSpace() { | |
| m_whiteSpace = static_cast<unsigned>(EWhiteSpace::kNormal); | |
| } | |
| // caption-side | |
| inline static ECaptionSide initialCaptionSide() { | |
| return ECaptionSide::kTop; | |
| } | |
| ECaptionSide captionSide() const { | |
| return static_cast<ECaptionSide>(m_captionSide); | |
| } | |
| void setCaptionSide(const ECaptionSide& v) { | |
| m_captionSide = static_cast<unsigned>(v); | |
| } | |
| inline void resetCaptionSide() { | |
| m_captionSide = static_cast<unsigned>(ECaptionSide::kTop); | |
| } | |
| // writing-mode | |
| inline static WritingMode initialWritingMode() { | |
| return WritingMode::kHorizontalTb; | |
| } | |
| WritingMode getWritingMode() const { | |
| return static_cast<WritingMode>(m_writingMode); | |
| } | |
| void setWritingMode(const WritingMode& v) { | |
| m_writingMode = static_cast<unsigned>(v); | |
| } | |
| inline void resetWritingMode() { | |
| m_writingMode = static_cast<unsigned>(WritingMode::kHorizontalTb); | |
| } | |
| // float | |
| inline static EFloat initialFloating() { | |
| return EFloat::kNone; | |
| } | |
| EFloat floating() const { | |
| return static_cast<EFloat>(m_floating); | |
| } | |
| void setFloating(const EFloat& v) { | |
| m_floating = static_cast<unsigned>(v); | |
| } | |
| inline void resetFloating() { | |
| m_floating = static_cast<unsigned>(EFloat::kNone); | |
| } | |
| // break-inside | |
| inline static EBreakInside initialBreakInside() { | |
| return EBreakInside::kAuto; | |
| } | |
| EBreakInside breakInside() const { | |
| return static_cast<EBreakInside>(m_breakInside); | |
| } | |
| void setBreakInside(const EBreakInside& v) { | |
| m_breakInside = static_cast<unsigned>(v); | |
| } | |
| inline void resetBreakInside() { | |
| m_breakInside = static_cast<unsigned>(EBreakInside::kAuto); | |
| } | |
| // overflow-anchor | |
| inline static EOverflowAnchor initialOverflowAnchor() { | |
| return EOverflowAnchor::kAuto; | |
| } | |
| EOverflowAnchor overflowAnchor() const { | |
| return static_cast<EOverflowAnchor>(m_overflowAnchor); | |
| } | |
| void setOverflowAnchor(const EOverflowAnchor& v) { | |
| m_overflowAnchor = static_cast<unsigned>(v); | |
| } | |
| inline void resetOverflowAnchor() { | |
| m_overflowAnchor = static_cast<unsigned>(EOverflowAnchor::kAuto); | |
| } | |
| // text-transform | |
| inline static ETextTransform initialTextTransform() { | |
| return ETextTransform::kNone; | |
| } | |
| ETextTransform textTransform() const { | |
| return static_cast<ETextTransform>(m_textTransform); | |
| } | |
| void setTextTransform(const ETextTransform& v) { | |
| m_textTransform = static_cast<unsigned>(v); | |
| } | |
| inline void resetTextTransform() { | |
| m_textTransform = static_cast<unsigned>(ETextTransform::kNone); | |
| } | |
| // visibility | |
| inline static EVisibility initialVisibility() { | |
| return EVisibility::kVisible; | |
| } | |
| EVisibility visibility() const { | |
| return static_cast<EVisibility>(m_visibility); | |
| } | |
| void setVisibility(const EVisibility& v) { | |
| m_visibility = static_cast<unsigned>(v); | |
| } | |
| inline void resetVisibility() { | |
| m_visibility = static_cast<unsigned>(EVisibility::kVisible); | |
| } | |
| // InsideLink | |
| inline static EInsideLink initialInsideLink() { | |
| return EInsideLink::kNotInsideLink; | |
| } | |
| EInsideLink insideLink() const { | |
| return static_cast<EInsideLink>(m_insideLink); | |
| } | |
| void setInsideLink(const EInsideLink& v) { | |
| m_insideLink = static_cast<unsigned>(v); | |
| } | |
| inline void resetInsideLink() { | |
| m_insideLink = static_cast<unsigned>(EInsideLink::kNotInsideLink); | |
| } | |
| // -webkit-box-direction | |
| inline static EBoxDirection initialBoxDirection() { | |
| return EBoxDirection::kNormal; | |
| } | |
| EBoxDirection boxDirection() const { | |
| return static_cast<EBoxDirection>(m_boxDirection); | |
| } | |
| void setBoxDirection(const EBoxDirection& v) { | |
| m_boxDirection = static_cast<unsigned>(v); | |
| } | |
| inline void resetBoxDirection() { | |
| m_boxDirection = static_cast<unsigned>(EBoxDirection::kNormal); | |
| } | |
| // caption-side | |
| inline static bool initialCaptionSideIsInherited() { | |
| return true; | |
| } | |
| bool captionSideIsInherited() const { | |
| return static_cast<bool>(m_captionSideIsInherited); | |
| } | |
| void setCaptionSideIsInherited(const bool& v) { | |
| m_captionSideIsInherited = static_cast<unsigned>(v); | |
| } | |
| inline void resetCaptionSideIsInherited() { | |
| m_captionSideIsInherited = static_cast<unsigned>(true); | |
| } | |
| // -webkit-print-color-adjust | |
| inline static bool initialPrintColorAdjustIsInherited() { | |
| return true; | |
| } | |
| bool printColorAdjustIsInherited() const { | |
| return static_cast<bool>(m_printColorAdjustIsInherited); | |
| } | |
| void setPrintColorAdjustIsInherited(const bool& v) { | |
| m_printColorAdjustIsInherited = static_cast<unsigned>(v); | |
| } | |
| inline void resetPrintColorAdjustIsInherited() { | |
| m_printColorAdjustIsInherited = static_cast<unsigned>(true); | |
| } | |
| // -webkit-print-color-adjust | |
| inline static EPrintColorAdjust initialPrintColorAdjust() { | |
| return EPrintColorAdjust::kEconomy; | |
| } | |
| EPrintColorAdjust printColorAdjust() const { | |
| return static_cast<EPrintColorAdjust>(m_printColorAdjust); | |
| } | |
| void setPrintColorAdjust(const EPrintColorAdjust& v) { | |
| m_printColorAdjust = static_cast<unsigned>(v); | |
| } | |
| inline void resetPrintColorAdjust() { | |
| m_printColorAdjust = static_cast<unsigned>(EPrintColorAdjust::kEconomy); | |
| } | |
| // border-collapse | |
| inline static bool initialBorderCollapseIsInherited() { | |
| return true; | |
| } | |
| bool borderCollapseIsInherited() const { | |
| return static_cast<bool>(m_borderCollapseIsInherited); | |
| } | |
| void setBorderCollapseIsInherited(const bool& v) { | |
| m_borderCollapseIsInherited = static_cast<unsigned>(v); | |
| } | |
| inline void resetBorderCollapseIsInherited() { | |
| m_borderCollapseIsInherited = static_cast<unsigned>(true); | |
| } | |
| // border-collapse | |
| inline static EBorderCollapse initialBorderCollapse() { | |
| return EBorderCollapse::kSeparate; | |
| } | |
| EBorderCollapse borderCollapse() const { | |
| return static_cast<EBorderCollapse>(m_borderCollapse); | |
| } | |
| void setBorderCollapse(const EBorderCollapse& v) { | |
| m_borderCollapse = static_cast<unsigned>(v); | |
| } | |
| inline void resetBorderCollapse() { | |
| m_borderCollapse = static_cast<unsigned>(EBorderCollapse::kSeparate); | |
| } | |
| // -webkit-rtl-ordering | |
| inline static bool initialRtlOrderingIsInherited() { | |
| return true; | |
| } | |
| bool rtlOrderingIsInherited() const { | |
| return static_cast<bool>(m_rtlOrderingIsInherited); | |
| } | |
| void setRtlOrderingIsInherited(const bool& v) { | |
| m_rtlOrderingIsInherited = static_cast<unsigned>(v); | |
| } | |
| inline void resetRtlOrderingIsInherited() { | |
| m_rtlOrderingIsInherited = static_cast<unsigned>(true); | |
| } | |
| // -webkit-rtl-ordering | |
| inline static EOrder initialRtlOrdering() { | |
| return EOrder::kLogical; | |
| } | |
| EOrder rtlOrdering() const { | |
| return static_cast<EOrder>(m_rtlOrdering); | |
| } | |
| void setRtlOrdering(const EOrder& v) { | |
| m_rtlOrdering = static_cast<unsigned>(v); | |
| } | |
| inline void resetRtlOrdering() { | |
| m_rtlOrdering = static_cast<unsigned>(EOrder::kLogical); | |
| } | |
| // white-space | |
| inline static bool initialWhiteSpaceIsInherited() { | |
| return true; | |
| } | |
| bool whiteSpaceIsInherited() const { | |
| return static_cast<bool>(m_whiteSpaceIsInherited); | |
| } | |
| void setWhiteSpaceIsInherited(const bool& v) { | |
| m_whiteSpaceIsInherited = static_cast<unsigned>(v); | |
| } | |
| inline void resetWhiteSpaceIsInherited() { | |
| m_whiteSpaceIsInherited = static_cast<unsigned>(true); | |
| } | |
| // table-layout | |
| inline static ETableLayout initialTableLayout() { | |
| return ETableLayout::kAuto; | |
| } | |
| ETableLayout tableLayout() const { | |
| return static_cast<ETableLayout>(m_tableLayout); | |
| } | |
| void setTableLayout(const ETableLayout& v) { | |
| m_tableLayout = static_cast<unsigned>(v); | |
| } | |
| inline void resetTableLayout() { | |
| m_tableLayout = static_cast<unsigned>(ETableLayout::kAuto); | |
| } | |
| // list-style-position | |
| inline static bool initialListStylePositionIsInherited() { | |
| return true; | |
| } | |
| bool listStylePositionIsInherited() const { | |
| return static_cast<bool>(m_listStylePositionIsInherited); | |
| } | |
| void setListStylePositionIsInherited(const bool& v) { | |
| m_listStylePositionIsInherited = static_cast<unsigned>(v); | |
| } | |
| inline void resetListStylePositionIsInherited() { | |
| m_listStylePositionIsInherited = static_cast<unsigned>(true); | |
| } | |
| // list-style-position | |
| inline static EListStylePosition initialListStylePosition() { | |
| return EListStylePosition::kOutside; | |
| } | |
| EListStylePosition listStylePosition() const { | |
| return static_cast<EListStylePosition>(m_listStylePosition); | |
| } | |
| void setListStylePosition(const EListStylePosition& v) { | |
| m_listStylePosition = static_cast<unsigned>(v); | |
| } | |
| inline void resetListStylePosition() { | |
| m_listStylePosition = static_cast<unsigned>(EListStylePosition::kOutside); | |
| } | |
| // pointer-events | |
| inline static bool initialPointerEventsIsInherited() { | |
| return true; | |
| } | |
| bool pointerEventsIsInherited() const { | |
| return static_cast<bool>(m_pointerEventsIsInherited); | |
| } | |
| void setPointerEventsIsInherited(const bool& v) { | |
| m_pointerEventsIsInherited = static_cast<unsigned>(v); | |
| } | |
| inline void resetPointerEventsIsInherited() { | |
| m_pointerEventsIsInherited = static_cast<unsigned>(true); | |
| } | |
| // text-transform | |
| inline static bool initialTextTransformIsInherited() { | |
| return true; | |
| } | |
| bool textTransformIsInherited() const { | |
| return static_cast<bool>(m_textTransformIsInherited); | |
| } | |
| void setTextTransformIsInherited(const bool& v) { | |
| m_textTransformIsInherited = static_cast<unsigned>(v); | |
| } | |
| inline void resetTextTransformIsInherited() { | |
| m_textTransformIsInherited = static_cast<unsigned>(true); | |
| } | |
| // direction | |
| inline static TextDirection initialDirection() { | |
| return TextDirection::kLtr; | |
| } | |
| TextDirection direction() const { | |
| return static_cast<TextDirection>(m_direction); | |
| } | |
| void setDirection(const TextDirection& v) { | |
| m_direction = static_cast<unsigned>(v); | |
| } | |
| inline void resetDirection() { | |
| m_direction = static_cast<unsigned>(TextDirection::kLtr); | |
| } | |
| // empty-cells | |
| inline static bool initialEmptyCellsIsInherited() { | |
| return true; | |
| } | |
| bool emptyCellsIsInherited() const { | |
| return static_cast<bool>(m_emptyCellsIsInherited); | |
| } | |
| void setEmptyCellsIsInherited(const bool& v) { | |
| m_emptyCellsIsInherited = static_cast<unsigned>(v); | |
| } | |
| inline void resetEmptyCellsIsInherited() { | |
| m_emptyCellsIsInherited = static_cast<unsigned>(true); | |
| } | |
| // empty-cells | |
| inline static EEmptyCells initialEmptyCells() { | |
| return EEmptyCells::kShow; | |
| } | |
| EEmptyCells emptyCells() const { | |
| return static_cast<EEmptyCells>(m_emptyCells); | |
| } | |
| void setEmptyCells(const EEmptyCells& v) { | |
| m_emptyCells = static_cast<unsigned>(v); | |
| } | |
| inline void resetEmptyCells() { | |
| m_emptyCells = static_cast<unsigned>(EEmptyCells::kShow); | |
| } | |
| // text-align | |
| inline static bool initialTextAlignIsInherited() { | |
| return true; | |
| } | |
| bool textAlignIsInherited() const { | |
| return static_cast<bool>(m_textAlignIsInherited); | |
| } | |
| void setTextAlignIsInherited(const bool& v) { | |
| m_textAlignIsInherited = static_cast<unsigned>(v); | |
| } | |
| inline void resetTextAlignIsInherited() { | |
| m_textAlignIsInherited = static_cast<unsigned>(true); | |
| } | |
| // visibility | |
| inline static bool initialVisibilityIsInherited() { | |
| return true; | |
| } | |
| bool visibilityIsInherited() const { | |
| return static_cast<bool>(m_visibilityIsInherited); | |
| } | |
| void setVisibilityIsInherited(const bool& v) { | |
| m_visibilityIsInherited = static_cast<unsigned>(v); | |
| } | |
| inline void resetVisibilityIsInherited() { | |
| m_visibilityIsInherited = static_cast<unsigned>(true); | |
| } | |
| // IsLink | |
| bool isLink() const { | |
| return m_isLink; | |
| } | |
| void setIsLink() { | |
| m_isLink = static_cast<unsigned>(true); | |
| } | |
| // Unique | |
| bool unique() const { | |
| return m_unique; | |
| } | |
| void setUnique() { | |
| m_unique = static_cast<unsigned>(true); | |
| } | |
| // AffectedByFocus | |
| bool affectedByFocus() const { | |
| return m_affectedByFocus; | |
| } | |
| void setAffectedByFocus() { | |
| m_affectedByFocus = static_cast<unsigned>(true); | |
| } | |
| // AffectedByHover | |
| bool affectedByHover() const { | |
| return m_affectedByHover; | |
| } | |
| void setAffectedByHover() { | |
| m_affectedByHover = static_cast<unsigned>(true); | |
| } | |
| // AffectedByActive | |
| bool affectedByActive() const { | |
| return m_affectedByActive; | |
| } | |
| void setAffectedByActive() { | |
| m_affectedByActive = static_cast<unsigned>(true); | |
| } | |
| // AffectedByDrag | |
| bool affectedByDrag() const { | |
| return m_affectedByDrag; | |
| } | |
| void setAffectedByDrag() { | |
| m_affectedByDrag = static_cast<unsigned>(true); | |
| } | |
| // HasVariableReferenceFromNonInheritedProperty | |
| bool hasVariableReferenceFromNonInheritedProperty() const { | |
| return m_hasVariableReferenceFromNonInheritedProperty; | |
| } | |
| void setHasVariableReferenceFromNonInheritedProperty() { | |
| m_hasVariableReferenceFromNonInheritedProperty = static_cast<unsigned>(true); | |
| } | |
| // HasExplicitlyInheritedProperties | |
| bool hasExplicitlyInheritedProperties() const { | |
| return m_hasExplicitlyInheritedProperties; | |
| } | |
| void setHasExplicitlyInheritedProperties() { | |
| m_hasExplicitlyInheritedProperties = static_cast<unsigned>(true); | |
| } | |
| // EmptyState | |
| // Getters and setters not generated | |
| // HasSimpleUnderline | |
| // Getters and setters not generated | |
| private: | |
| class SurroundData : public RefCounted<SurroundData> { | |
| public: | |
| static PassRefPtr<SurroundData> create() { | |
| return adoptRef(new SurroundData); | |
| } | |
| PassRefPtr<SurroundData> copy() const { | |
| return adoptRef(new SurroundData(*this)); | |
| } | |
| bool operator==(const SurroundData& o) const { | |
| return ( | |
| m_bottom == o.m_bottom && | |
| m_top == o.m_top && | |
| m_padding == o.m_padding && | |
| m_left == o.m_left && | |
| m_margin == o.m_margin && | |
| m_right == o.m_right && | |
| m_border == o.m_border | |
| ); | |
| } | |
| bool operator!=(const SurroundData& o) const { return !(*this == o); } | |
| Length m_bottom; | |
| Length m_top; | |
| LengthBox m_padding; | |
| Length m_left; | |
| LengthBox m_margin; | |
| Length m_right; | |
| BorderData m_border; | |
| private: | |
| SurroundData() : | |
| m_bottom(Length()), | |
| m_top(Length()), | |
| m_padding(LengthBox(Fixed)), | |
| m_left(Length()), | |
| m_margin(LengthBox(Fixed)), | |
| m_right(Length()), | |
| m_border(BorderData()) | |
| {} | |
| ALWAYS_INLINE SurroundData(const SurroundData& o) : | |
| m_bottom(o.m_bottom), | |
| m_top(o.m_top), | |
| m_padding(o.m_padding), | |
| m_left(o.m_left), | |
| m_margin(o.m_margin), | |
| m_right(o.m_right), | |
| m_border(o.m_border) | |
| {} | |
| }; | |
| protected: | |
| // Constructor and destructor are protected so that only the parent class ComputedStyle | |
| // can instantiate this class. | |
| ALWAYS_INLINE ComputedStyleBase() : | |
| m_pseudoBits(static_cast<unsigned>(PseudoIdNone)), | |
| m_cursor(static_cast<unsigned>(ECursor::kAuto)), | |
| m_listStyleType(static_cast<unsigned>(EListStyleType::kDisc)), | |
| m_styleType(static_cast<unsigned>(0)), | |
| m_display(static_cast<unsigned>(EDisplay::kInline)), | |
| m_boxDirectionIsInherited(static_cast<unsigned>(true)), | |
| m_originalDisplay(static_cast<unsigned>(EDisplay::kInline)), | |
| m_breakBefore(static_cast<unsigned>(EBreakBetween::kAuto)), | |
| m_breakAfter(static_cast<unsigned>(EBreakBetween::kAuto)), | |
| m_pointerEvents(static_cast<unsigned>(EPointerEvents::kAuto)), | |
| m_textAlign(static_cast<unsigned>(ETextAlign::kStart)), | |
| m_unicodeBidi(static_cast<unsigned>(UnicodeBidi::kNormal)), | |
| m_overflowX(static_cast<unsigned>(EOverflow::kVisible)), | |
| m_overflowY(static_cast<unsigned>(EOverflow::kVisible)), | |
| m_clear(static_cast<unsigned>(EClear::kNone)), | |
| m_position(static_cast<unsigned>(EPosition::kStatic)), | |
| m_whiteSpace(static_cast<unsigned>(EWhiteSpace::kNormal)), | |
| m_captionSide(static_cast<unsigned>(ECaptionSide::kTop)), | |
| m_writingMode(static_cast<unsigned>(WritingMode::kHorizontalTb)), | |
| m_floating(static_cast<unsigned>(EFloat::kNone)), | |
| m_breakInside(static_cast<unsigned>(EBreakInside::kAuto)), | |
| m_overflowAnchor(static_cast<unsigned>(EOverflowAnchor::kAuto)), | |
| m_textTransform(static_cast<unsigned>(ETextTransform::kNone)), | |
| m_visibility(static_cast<unsigned>(EVisibility::kVisible)), | |
| m_insideLink(static_cast<unsigned>(EInsideLink::kNotInsideLink)), | |
| m_boxDirection(static_cast<unsigned>(EBoxDirection::kNormal)), | |
| m_captionSideIsInherited(static_cast<unsigned>(true)), | |
| m_printColorAdjustIsInherited(static_cast<unsigned>(true)), | |
| m_printColorAdjust(static_cast<unsigned>(EPrintColorAdjust::kEconomy)), | |
| m_borderCollapseIsInherited(static_cast<unsigned>(true)), | |
| m_borderCollapse(static_cast<unsigned>(EBorderCollapse::kSeparate)), | |
| m_rtlOrderingIsInherited(static_cast<unsigned>(true)), | |
| m_rtlOrdering(static_cast<unsigned>(EOrder::kLogical)), | |
| m_whiteSpaceIsInherited(static_cast<unsigned>(true)), | |
| m_tableLayout(static_cast<unsigned>(ETableLayout::kAuto)), | |
| m_listStylePositionIsInherited(static_cast<unsigned>(true)), | |
| m_listStylePosition(static_cast<unsigned>(EListStylePosition::kOutside)), | |
| m_pointerEventsIsInherited(static_cast<unsigned>(true)), | |
| m_textTransformIsInherited(static_cast<unsigned>(true)), | |
| m_direction(static_cast<unsigned>(TextDirection::kLtr)), | |
| m_emptyCellsIsInherited(static_cast<unsigned>(true)), | |
| m_emptyCells(static_cast<unsigned>(EEmptyCells::kShow)), | |
| m_textAlignIsInherited(static_cast<unsigned>(true)), | |
| m_visibilityIsInherited(static_cast<unsigned>(true)), | |
| m_isLink(static_cast<unsigned>(false)), | |
| m_unique(static_cast<unsigned>(false)), | |
| m_affectedByFocus(static_cast<unsigned>(false)), | |
| m_affectedByHover(static_cast<unsigned>(false)), | |
| m_affectedByActive(static_cast<unsigned>(false)), | |
| m_affectedByDrag(static_cast<unsigned>(false)), | |
| m_hasVariableReferenceFromNonInheritedProperty(static_cast<unsigned>(false)), | |
| m_hasExplicitlyInheritedProperties(static_cast<unsigned>(false)), | |
| m_emptyState(static_cast<unsigned>(false)), | |
| m_hasSimpleUnderline(static_cast<unsigned>(false)) | |
| {} | |
| // Storage. | |
| DataRef<SurroundData> m_surround; | |
| unsigned m_pseudoBits : 8; // PseudoId | |
| unsigned m_cursor : 6; // ECursor | |
| unsigned m_listStyleType : 6; // EListStyleType | |
| unsigned m_styleType : 6; // PseudoId | |
| unsigned m_display : 5; // EDisplay | |
| unsigned m_boxDirectionIsInherited : 1; // bool | |
| unsigned m_originalDisplay : 5; // EDisplay | |
| unsigned m_breakBefore : 4; // EBreakBetween | |
| unsigned m_breakAfter : 4; // EBreakBetween | |
| unsigned m_pointerEvents : 4; // EPointerEvents | |
| unsigned m_textAlign : 4; // ETextAlign | |
| unsigned m_unicodeBidi : 3; // UnicodeBidi | |
| unsigned m_overflowX : 3; // EOverflow | |
| unsigned m_overflowY : 3; // EOverflow | |
| unsigned m_clear : 2; // EClear | |
| unsigned m_position : 3; // EPosition | |
| unsigned m_whiteSpace : 3; // EWhiteSpace | |
| unsigned m_captionSide : 2; // ECaptionSide | |
| unsigned m_writingMode : 2; // WritingMode | |
| unsigned m_floating : 2; // EFloat | |
| unsigned m_breakInside : 2; // EBreakInside | |
| unsigned m_overflowAnchor : 2; // EOverflowAnchor | |
| unsigned m_textTransform : 2; // ETextTransform | |
| unsigned m_visibility : 2; // EVisibility | |
| unsigned m_insideLink : 2; // EInsideLink | |
| unsigned m_boxDirection : 1; // EBoxDirection | |
| unsigned m_captionSideIsInherited : 1; // bool | |
| unsigned m_printColorAdjustIsInherited : 1; // bool | |
| unsigned m_printColorAdjust : 1; // EPrintColorAdjust | |
| unsigned m_borderCollapseIsInherited : 1; // bool | |
| unsigned m_borderCollapse : 1; // EBorderCollapse | |
| unsigned m_rtlOrderingIsInherited : 1; // bool | |
| unsigned m_rtlOrdering : 1; // EOrder | |
| unsigned m_whiteSpaceIsInherited : 1; // bool | |
| unsigned m_tableLayout : 1; // ETableLayout | |
| unsigned m_listStylePositionIsInherited : 1; // bool | |
| unsigned m_listStylePosition : 1; // EListStylePosition | |
| unsigned m_pointerEventsIsInherited : 1; // bool | |
| unsigned m_textTransformIsInherited : 1; // bool | |
| unsigned m_direction : 1; // TextDirection | |
| unsigned m_emptyCellsIsInherited : 1; // bool | |
| unsigned m_emptyCells : 1; // EEmptyCells | |
| unsigned m_textAlignIsInherited : 1; // bool | |
| unsigned m_visibilityIsInherited : 1; // bool | |
| unsigned m_isLink : 1; // bool | |
| unsigned m_unique : 1; // bool | |
| unsigned m_affectedByFocus : 1; // bool | |
| unsigned m_affectedByHover : 1; // bool | |
| unsigned m_affectedByActive : 1; // bool | |
| unsigned m_affectedByDrag : 1; // bool | |
| unsigned m_hasVariableReferenceFromNonInheritedProperty : 1; // bool | |
| unsigned m_hasExplicitlyInheritedProperties : 1; // bool | |
| unsigned m_emptyState : 1; // bool | |
| unsigned m_hasSimpleUnderline : 1; // bool | |
| }; | |
| } // namespace blink | |
| #endif // ComputedStyleBase_h |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
| // Use of this source code is governed by a BSD-style license that can be | |
| // found in the LICENSE file. | |
| #include "base/logging.h" | |
| #include "core/CSSValueKeywords.h" | |
| #include "core/ComputedStyleBaseConstants.h" | |
| #include "core/style/BorderData.h" | |
| #include "platform/Length.h" | |
| #include "platform/LengthBox.h" | |
| #include "platform/text/TextDirection.h" | |
| #include "platform/text/UnicodeBidi.h" | |
| #include "platform/text/WritingMode.h" | |
| namespace blink { | |
| // TODO(shend): most enum values are stored contiguously so we just need | |
| // a subtraction and static_cast. This is much faster than switches. | |
| // Do not use these functions directly, use the non-generated versions | |
| // in CSSValueMappings.h | |
| namespace detail { | |
| template <class T> | |
| T cssValueIDToPlatformEnumGenerated(CSSValueID); | |
| template <> | |
| inline EVisibility cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueVisible: | |
| return EVisibility::kVisible; | |
| case CSSValueHidden: | |
| return EVisibility::kHidden; | |
| case CSSValueCollapse: | |
| return EVisibility::kCollapse; | |
| default: | |
| NOTREACHED(); | |
| return EVisibility::kVisible; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(EVisibility v) { | |
| switch (v) { | |
| case EVisibility::kVisible: | |
| return CSSValueVisible; | |
| case EVisibility::kHidden: | |
| return CSSValueHidden; | |
| case EVisibility::kCollapse: | |
| return CSSValueCollapse; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline EOverflowAnchor cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueVisible: | |
| return EOverflowAnchor::kVisible; | |
| case CSSValueNone: | |
| return EOverflowAnchor::kNone; | |
| case CSSValueAuto: | |
| return EOverflowAnchor::kAuto; | |
| default: | |
| NOTREACHED(); | |
| return EOverflowAnchor::kAuto; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(EOverflowAnchor v) { | |
| switch (v) { | |
| case EOverflowAnchor::kVisible: | |
| return CSSValueVisible; | |
| case EOverflowAnchor::kNone: | |
| return CSSValueNone; | |
| case EOverflowAnchor::kAuto: | |
| return CSSValueAuto; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline EBoxDirection cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueNormal: | |
| return EBoxDirection::kNormal; | |
| case CSSValueReverse: | |
| return EBoxDirection::kReverse; | |
| default: | |
| NOTREACHED(); | |
| return EBoxDirection::kNormal; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(EBoxDirection v) { | |
| switch (v) { | |
| case EBoxDirection::kNormal: | |
| return CSSValueNormal; | |
| case EBoxDirection::kReverse: | |
| return CSSValueReverse; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline EPointerEvents cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueNone: | |
| return EPointerEvents::kNone; | |
| case CSSValueAuto: | |
| return EPointerEvents::kAuto; | |
| case CSSValueStroke: | |
| return EPointerEvents::kStroke; | |
| case CSSValueFill: | |
| return EPointerEvents::kFill; | |
| case CSSValuePainted: | |
| return EPointerEvents::kPainted; | |
| case CSSValueVisible: | |
| return EPointerEvents::kVisible; | |
| case CSSValueVisibleStroke: | |
| return EPointerEvents::kVisibleStroke; | |
| case CSSValueVisibleFill: | |
| return EPointerEvents::kVisibleFill; | |
| case CSSValueVisiblePainted: | |
| return EPointerEvents::kVisiblePainted; | |
| case CSSValueBoundingBox: | |
| return EPointerEvents::kBoundingBox; | |
| case CSSValueAll: | |
| return EPointerEvents::kAll; | |
| default: | |
| NOTREACHED(); | |
| return EPointerEvents::kAuto; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(EPointerEvents v) { | |
| switch (v) { | |
| case EPointerEvents::kNone: | |
| return CSSValueNone; | |
| case EPointerEvents::kAuto: | |
| return CSSValueAuto; | |
| case EPointerEvents::kStroke: | |
| return CSSValueStroke; | |
| case EPointerEvents::kFill: | |
| return CSSValueFill; | |
| case EPointerEvents::kPainted: | |
| return CSSValuePainted; | |
| case EPointerEvents::kVisible: | |
| return CSSValueVisible; | |
| case EPointerEvents::kVisibleStroke: | |
| return CSSValueVisibleStroke; | |
| case EPointerEvents::kVisibleFill: | |
| return CSSValueVisibleFill; | |
| case EPointerEvents::kVisiblePainted: | |
| return CSSValueVisiblePainted; | |
| case EPointerEvents::kBoundingBox: | |
| return CSSValueBoundingBox; | |
| case EPointerEvents::kAll: | |
| return CSSValueAll; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline TextDirection cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueLtr: | |
| return TextDirection::kLtr; | |
| case CSSValueRtl: | |
| return TextDirection::kRtl; | |
| default: | |
| NOTREACHED(); | |
| return TextDirection::kLtr; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(TextDirection v) { | |
| switch (v) { | |
| case TextDirection::kLtr: | |
| return CSSValueLtr; | |
| case TextDirection::kRtl: | |
| return CSSValueRtl; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline EBreakInside cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueAuto: | |
| return EBreakInside::kAuto; | |
| case CSSValueAvoid: | |
| return EBreakInside::kAvoid; | |
| case CSSValueAvoidColumn: | |
| return EBreakInside::kAvoidColumn; | |
| case CSSValueAvoidPage: | |
| return EBreakInside::kAvoidPage; | |
| default: | |
| NOTREACHED(); | |
| return EBreakInside::kAuto; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(EBreakInside v) { | |
| switch (v) { | |
| case EBreakInside::kAuto: | |
| return CSSValueAuto; | |
| case EBreakInside::kAvoid: | |
| return CSSValueAvoid; | |
| case EBreakInside::kAvoidColumn: | |
| return CSSValueAvoidColumn; | |
| case EBreakInside::kAvoidPage: | |
| return CSSValueAvoidPage; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline EFloat cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueNone: | |
| return EFloat::kNone; | |
| case CSSValueLeft: | |
| return EFloat::kLeft; | |
| case CSSValueRight: | |
| return EFloat::kRight; | |
| default: | |
| NOTREACHED(); | |
| return EFloat::kNone; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(EFloat v) { | |
| switch (v) { | |
| case EFloat::kNone: | |
| return CSSValueNone; | |
| case EFloat::kLeft: | |
| return CSSValueLeft; | |
| case EFloat::kRight: | |
| return CSSValueRight; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline EPrintColorAdjust cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueEconomy: | |
| return EPrintColorAdjust::kEconomy; | |
| case CSSValueExact: | |
| return EPrintColorAdjust::kExact; | |
| default: | |
| NOTREACHED(); | |
| return EPrintColorAdjust::kEconomy; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(EPrintColorAdjust v) { | |
| switch (v) { | |
| case EPrintColorAdjust::kEconomy: | |
| return CSSValueEconomy; | |
| case EPrintColorAdjust::kExact: | |
| return CSSValueExact; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline EDisplay cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueInline: | |
| return EDisplay::kInline; | |
| case CSSValueBlock: | |
| return EDisplay::kBlock; | |
| case CSSValueListItem: | |
| return EDisplay::kListItem; | |
| case CSSValueInlineBlock: | |
| return EDisplay::kInlineBlock; | |
| case CSSValueTable: | |
| return EDisplay::kTable; | |
| case CSSValueInlineTable: | |
| return EDisplay::kInlineTable; | |
| case CSSValueTableRowGroup: | |
| return EDisplay::kTableRowGroup; | |
| case CSSValueTableHeaderGroup: | |
| return EDisplay::kTableHeaderGroup; | |
| case CSSValueTableFooterGroup: | |
| return EDisplay::kTableFooterGroup; | |
| case CSSValueTableRow: | |
| return EDisplay::kTableRow; | |
| case CSSValueTableColumnGroup: | |
| return EDisplay::kTableColumnGroup; | |
| case CSSValueTableColumn: | |
| return EDisplay::kTableColumn; | |
| case CSSValueTableCell: | |
| return EDisplay::kTableCell; | |
| case CSSValueTableCaption: | |
| return EDisplay::kTableCaption; | |
| case CSSValueWebkitBox: | |
| return EDisplay::kWebkitBox; | |
| case CSSValueWebkitInlineBox: | |
| return EDisplay::kWebkitInlineBox; | |
| case CSSValueFlex: | |
| return EDisplay::kFlex; | |
| case CSSValueInlineFlex: | |
| return EDisplay::kInlineFlex; | |
| case CSSValueGrid: | |
| return EDisplay::kGrid; | |
| case CSSValueInlineGrid: | |
| return EDisplay::kInlineGrid; | |
| case CSSValueContents: | |
| return EDisplay::kContents; | |
| case CSSValueFlowRoot: | |
| return EDisplay::kFlowRoot; | |
| case CSSValueNone: | |
| return EDisplay::kNone; | |
| default: | |
| NOTREACHED(); | |
| return EDisplay::kInline; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(EDisplay v) { | |
| switch (v) { | |
| case EDisplay::kInline: | |
| return CSSValueInline; | |
| case EDisplay::kBlock: | |
| return CSSValueBlock; | |
| case EDisplay::kListItem: | |
| return CSSValueListItem; | |
| case EDisplay::kInlineBlock: | |
| return CSSValueInlineBlock; | |
| case EDisplay::kTable: | |
| return CSSValueTable; | |
| case EDisplay::kInlineTable: | |
| return CSSValueInlineTable; | |
| case EDisplay::kTableRowGroup: | |
| return CSSValueTableRowGroup; | |
| case EDisplay::kTableHeaderGroup: | |
| return CSSValueTableHeaderGroup; | |
| case EDisplay::kTableFooterGroup: | |
| return CSSValueTableFooterGroup; | |
| case EDisplay::kTableRow: | |
| return CSSValueTableRow; | |
| case EDisplay::kTableColumnGroup: | |
| return CSSValueTableColumnGroup; | |
| case EDisplay::kTableColumn: | |
| return CSSValueTableColumn; | |
| case EDisplay::kTableCell: | |
| return CSSValueTableCell; | |
| case EDisplay::kTableCaption: | |
| return CSSValueTableCaption; | |
| case EDisplay::kWebkitBox: | |
| return CSSValueWebkitBox; | |
| case EDisplay::kWebkitInlineBox: | |
| return CSSValueWebkitInlineBox; | |
| case EDisplay::kFlex: | |
| return CSSValueFlex; | |
| case EDisplay::kInlineFlex: | |
| return CSSValueInlineFlex; | |
| case EDisplay::kGrid: | |
| return CSSValueGrid; | |
| case EDisplay::kInlineGrid: | |
| return CSSValueInlineGrid; | |
| case EDisplay::kContents: | |
| return CSSValueContents; | |
| case EDisplay::kFlowRoot: | |
| return CSSValueFlowRoot; | |
| case EDisplay::kNone: | |
| return CSSValueNone; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline EOrder cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueLogical: | |
| return EOrder::kLogical; | |
| case CSSValueVisual: | |
| return EOrder::kVisual; | |
| default: | |
| NOTREACHED(); | |
| return EOrder::kLogical; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(EOrder v) { | |
| switch (v) { | |
| case EOrder::kLogical: | |
| return CSSValueLogical; | |
| case EOrder::kVisual: | |
| return CSSValueVisual; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline EWhiteSpace cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueNormal: | |
| return EWhiteSpace::kNormal; | |
| case CSSValuePre: | |
| return EWhiteSpace::kPre; | |
| case CSSValuePreWrap: | |
| return EWhiteSpace::kPreWrap; | |
| case CSSValuePreLine: | |
| return EWhiteSpace::kPreLine; | |
| case CSSValueNowrap: | |
| return EWhiteSpace::kNowrap; | |
| case CSSValueWebkitNowrap: | |
| return EWhiteSpace::kWebkitNowrap; | |
| default: | |
| NOTREACHED(); | |
| return EWhiteSpace::kNormal; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(EWhiteSpace v) { | |
| switch (v) { | |
| case EWhiteSpace::kNormal: | |
| return CSSValueNormal; | |
| case EWhiteSpace::kPre: | |
| return CSSValuePre; | |
| case EWhiteSpace::kPreWrap: | |
| return CSSValuePreWrap; | |
| case EWhiteSpace::kPreLine: | |
| return CSSValuePreLine; | |
| case EWhiteSpace::kNowrap: | |
| return CSSValueNowrap; | |
| case EWhiteSpace::kWebkitNowrap: | |
| return CSSValueWebkitNowrap; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline ETextTransform cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueCapitalize: | |
| return ETextTransform::kCapitalize; | |
| case CSSValueUppercase: | |
| return ETextTransform::kUppercase; | |
| case CSSValueLowercase: | |
| return ETextTransform::kLowercase; | |
| case CSSValueNone: | |
| return ETextTransform::kNone; | |
| default: | |
| NOTREACHED(); | |
| return ETextTransform::kNone; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(ETextTransform v) { | |
| switch (v) { | |
| case ETextTransform::kCapitalize: | |
| return CSSValueCapitalize; | |
| case ETextTransform::kUppercase: | |
| return CSSValueUppercase; | |
| case ETextTransform::kLowercase: | |
| return CSSValueLowercase; | |
| case ETextTransform::kNone: | |
| return CSSValueNone; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline EBreakBetween cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueAuto: | |
| return EBreakBetween::kAuto; | |
| case CSSValueAvoid: | |
| return EBreakBetween::kAvoid; | |
| case CSSValueAvoidColumn: | |
| return EBreakBetween::kAvoidColumn; | |
| case CSSValueAvoidPage: | |
| return EBreakBetween::kAvoidPage; | |
| case CSSValueColumn: | |
| return EBreakBetween::kColumn; | |
| case CSSValueLeft: | |
| return EBreakBetween::kLeft; | |
| case CSSValuePage: | |
| return EBreakBetween::kPage; | |
| case CSSValueRecto: | |
| return EBreakBetween::kRecto; | |
| case CSSValueRight: | |
| return EBreakBetween::kRight; | |
| case CSSValueVerso: | |
| return EBreakBetween::kVerso; | |
| default: | |
| NOTREACHED(); | |
| return EBreakBetween::kAuto; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(EBreakBetween v) { | |
| switch (v) { | |
| case EBreakBetween::kAuto: | |
| return CSSValueAuto; | |
| case EBreakBetween::kAvoid: | |
| return CSSValueAvoid; | |
| case EBreakBetween::kAvoidColumn: | |
| return CSSValueAvoidColumn; | |
| case EBreakBetween::kAvoidPage: | |
| return CSSValueAvoidPage; | |
| case EBreakBetween::kColumn: | |
| return CSSValueColumn; | |
| case EBreakBetween::kLeft: | |
| return CSSValueLeft; | |
| case EBreakBetween::kPage: | |
| return CSSValuePage; | |
| case EBreakBetween::kRecto: | |
| return CSSValueRecto; | |
| case EBreakBetween::kRight: | |
| return CSSValueRight; | |
| case EBreakBetween::kVerso: | |
| return CSSValueVerso; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline EListStylePosition cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueOutside: | |
| return EListStylePosition::kOutside; | |
| case CSSValueInside: | |
| return EListStylePosition::kInside; | |
| default: | |
| NOTREACHED(); | |
| return EListStylePosition::kOutside; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(EListStylePosition v) { | |
| switch (v) { | |
| case EListStylePosition::kOutside: | |
| return CSSValueOutside; | |
| case EListStylePosition::kInside: | |
| return CSSValueInside; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline ECursor cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueAuto: | |
| return ECursor::kAuto; | |
| case CSSValueDefault: | |
| return ECursor::kDefault; | |
| case CSSValueNone: | |
| return ECursor::kNone; | |
| case CSSValueContextMenu: | |
| return ECursor::kContextMenu; | |
| case CSSValueHelp: | |
| return ECursor::kHelp; | |
| case CSSValuePointer: | |
| return ECursor::kPointer; | |
| case CSSValueProgress: | |
| return ECursor::kProgress; | |
| case CSSValueWait: | |
| return ECursor::kWait; | |
| case CSSValueCell: | |
| return ECursor::kCell; | |
| case CSSValueCrosshair: | |
| return ECursor::kCrosshair; | |
| case CSSValueText: | |
| return ECursor::kText; | |
| case CSSValueVerticalText: | |
| return ECursor::kVerticalText; | |
| case CSSValueAlias: | |
| return ECursor::kAlias; | |
| case CSSValueCopy: | |
| return ECursor::kCopy; | |
| case CSSValueMove: | |
| return ECursor::kMove; | |
| case CSSValueNoDrop: | |
| return ECursor::kNoDrop; | |
| case CSSValueNotAllowed: | |
| return ECursor::kNotAllowed; | |
| case CSSValueEResize: | |
| return ECursor::kEResize; | |
| case CSSValueNResize: | |
| return ECursor::kNResize; | |
| case CSSValueNeResize: | |
| return ECursor::kNeResize; | |
| case CSSValueNwResize: | |
| return ECursor::kNwResize; | |
| case CSSValueSResize: | |
| return ECursor::kSResize; | |
| case CSSValueSeResize: | |
| return ECursor::kSeResize; | |
| case CSSValueSwResize: | |
| return ECursor::kSwResize; | |
| case CSSValueWResize: | |
| return ECursor::kWResize; | |
| case CSSValueEwResize: | |
| return ECursor::kEwResize; | |
| case CSSValueNsResize: | |
| return ECursor::kNsResize; | |
| case CSSValueNeswResize: | |
| return ECursor::kNeswResize; | |
| case CSSValueNwseResize: | |
| return ECursor::kNwseResize; | |
| case CSSValueColResize: | |
| return ECursor::kColResize; | |
| case CSSValueRowResize: | |
| return ECursor::kRowResize; | |
| case CSSValueAllScroll: | |
| return ECursor::kAllScroll; | |
| case CSSValueZoomIn: | |
| return ECursor::kZoomIn; | |
| case CSSValueZoomOut: | |
| return ECursor::kZoomOut; | |
| case CSSValueWebkitGrab: | |
| return ECursor::kWebkitGrab; | |
| case CSSValueWebkitGrabbing: | |
| return ECursor::kWebkitGrabbing; | |
| default: | |
| NOTREACHED(); | |
| return ECursor::kAuto; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(ECursor v) { | |
| switch (v) { | |
| case ECursor::kAuto: | |
| return CSSValueAuto; | |
| case ECursor::kDefault: | |
| return CSSValueDefault; | |
| case ECursor::kNone: | |
| return CSSValueNone; | |
| case ECursor::kContextMenu: | |
| return CSSValueContextMenu; | |
| case ECursor::kHelp: | |
| return CSSValueHelp; | |
| case ECursor::kPointer: | |
| return CSSValuePointer; | |
| case ECursor::kProgress: | |
| return CSSValueProgress; | |
| case ECursor::kWait: | |
| return CSSValueWait; | |
| case ECursor::kCell: | |
| return CSSValueCell; | |
| case ECursor::kCrosshair: | |
| return CSSValueCrosshair; | |
| case ECursor::kText: | |
| return CSSValueText; | |
| case ECursor::kVerticalText: | |
| return CSSValueVerticalText; | |
| case ECursor::kAlias: | |
| return CSSValueAlias; | |
| case ECursor::kCopy: | |
| return CSSValueCopy; | |
| case ECursor::kMove: | |
| return CSSValueMove; | |
| case ECursor::kNoDrop: | |
| return CSSValueNoDrop; | |
| case ECursor::kNotAllowed: | |
| return CSSValueNotAllowed; | |
| case ECursor::kEResize: | |
| return CSSValueEResize; | |
| case ECursor::kNResize: | |
| return CSSValueNResize; | |
| case ECursor::kNeResize: | |
| return CSSValueNeResize; | |
| case ECursor::kNwResize: | |
| return CSSValueNwResize; | |
| case ECursor::kSResize: | |
| return CSSValueSResize; | |
| case ECursor::kSeResize: | |
| return CSSValueSeResize; | |
| case ECursor::kSwResize: | |
| return CSSValueSwResize; | |
| case ECursor::kWResize: | |
| return CSSValueWResize; | |
| case ECursor::kEwResize: | |
| return CSSValueEwResize; | |
| case ECursor::kNsResize: | |
| return CSSValueNsResize; | |
| case ECursor::kNeswResize: | |
| return CSSValueNeswResize; | |
| case ECursor::kNwseResize: | |
| return CSSValueNwseResize; | |
| case ECursor::kColResize: | |
| return CSSValueColResize; | |
| case ECursor::kRowResize: | |
| return CSSValueRowResize; | |
| case ECursor::kAllScroll: | |
| return CSSValueAllScroll; | |
| case ECursor::kZoomIn: | |
| return CSSValueZoomIn; | |
| case ECursor::kZoomOut: | |
| return CSSValueZoomOut; | |
| case ECursor::kWebkitGrab: | |
| return CSSValueWebkitGrab; | |
| case ECursor::kWebkitGrabbing: | |
| return CSSValueWebkitGrabbing; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline EOverflow cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueVisible: | |
| return EOverflow::kVisible; | |
| case CSSValueHidden: | |
| return EOverflow::kHidden; | |
| case CSSValueScroll: | |
| return EOverflow::kScroll; | |
| case CSSValueAuto: | |
| return EOverflow::kAuto; | |
| case CSSValueOverlay: | |
| return EOverflow::kOverlay; | |
| case CSSValueWebkitPagedX: | |
| return EOverflow::kWebkitPagedX; | |
| case CSSValueWebkitPagedY: | |
| return EOverflow::kWebkitPagedY; | |
| default: | |
| NOTREACHED(); | |
| return EOverflow::kVisible; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(EOverflow v) { | |
| switch (v) { | |
| case EOverflow::kVisible: | |
| return CSSValueVisible; | |
| case EOverflow::kHidden: | |
| return CSSValueHidden; | |
| case EOverflow::kScroll: | |
| return CSSValueScroll; | |
| case EOverflow::kAuto: | |
| return CSSValueAuto; | |
| case EOverflow::kOverlay: | |
| return CSSValueOverlay; | |
| case EOverflow::kWebkitPagedX: | |
| return CSSValueWebkitPagedX; | |
| case EOverflow::kWebkitPagedY: | |
| return CSSValueWebkitPagedY; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline ECaptionSide cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueTop: | |
| return ECaptionSide::kTop; | |
| case CSSValueBottom: | |
| return ECaptionSide::kBottom; | |
| case CSSValueLeft: | |
| return ECaptionSide::kLeft; | |
| case CSSValueRight: | |
| return ECaptionSide::kRight; | |
| default: | |
| NOTREACHED(); | |
| return ECaptionSide::kTop; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(ECaptionSide v) { | |
| switch (v) { | |
| case ECaptionSide::kTop: | |
| return CSSValueTop; | |
| case ECaptionSide::kBottom: | |
| return CSSValueBottom; | |
| case ECaptionSide::kLeft: | |
| return CSSValueLeft; | |
| case ECaptionSide::kRight: | |
| return CSSValueRight; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline WritingMode cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueHorizontalTb: | |
| return WritingMode::kHorizontalTb; | |
| case CSSValueVerticalRl: | |
| return WritingMode::kVerticalRl; | |
| case CSSValueVerticalLr: | |
| return WritingMode::kVerticalLr; | |
| default: | |
| NOTREACHED(); | |
| return WritingMode::kHorizontalTb; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(WritingMode v) { | |
| switch (v) { | |
| case WritingMode::kHorizontalTb: | |
| return CSSValueHorizontalTb; | |
| case WritingMode::kVerticalRl: | |
| return CSSValueVerticalRl; | |
| case WritingMode::kVerticalLr: | |
| return CSSValueVerticalLr; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline UnicodeBidi cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueNormal: | |
| return UnicodeBidi::kNormal; | |
| case CSSValueEmbed: | |
| return UnicodeBidi::kEmbed; | |
| case CSSValueBidiOverride: | |
| return UnicodeBidi::kBidiOverride; | |
| case CSSValueIsolate: | |
| return UnicodeBidi::kIsolate; | |
| case CSSValuePlaintext: | |
| return UnicodeBidi::kPlaintext; | |
| case CSSValueIsolateOverride: | |
| return UnicodeBidi::kIsolateOverride; | |
| default: | |
| NOTREACHED(); | |
| return UnicodeBidi::kNormal; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(UnicodeBidi v) { | |
| switch (v) { | |
| case UnicodeBidi::kNormal: | |
| return CSSValueNormal; | |
| case UnicodeBidi::kEmbed: | |
| return CSSValueEmbed; | |
| case UnicodeBidi::kBidiOverride: | |
| return CSSValueBidiOverride; | |
| case UnicodeBidi::kIsolate: | |
| return CSSValueIsolate; | |
| case UnicodeBidi::kPlaintext: | |
| return CSSValuePlaintext; | |
| case UnicodeBidi::kIsolateOverride: | |
| return CSSValueIsolateOverride; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline EPosition cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueStatic: | |
| return EPosition::kStatic; | |
| case CSSValueRelative: | |
| return EPosition::kRelative; | |
| case CSSValueAbsolute: | |
| return EPosition::kAbsolute; | |
| case CSSValueFixed: | |
| return EPosition::kFixed; | |
| case CSSValueSticky: | |
| return EPosition::kSticky; | |
| default: | |
| NOTREACHED(); | |
| return EPosition::kStatic; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(EPosition v) { | |
| switch (v) { | |
| case EPosition::kStatic: | |
| return CSSValueStatic; | |
| case EPosition::kRelative: | |
| return CSSValueRelative; | |
| case EPosition::kAbsolute: | |
| return CSSValueAbsolute; | |
| case EPosition::kFixed: | |
| return CSSValueFixed; | |
| case EPosition::kSticky: | |
| return CSSValueSticky; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline ETextAlign cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueLeft: | |
| return ETextAlign::kLeft; | |
| case CSSValueRight: | |
| return ETextAlign::kRight; | |
| case CSSValueCenter: | |
| return ETextAlign::kCenter; | |
| case CSSValueJustify: | |
| return ETextAlign::kJustify; | |
| case CSSValueWebkitLeft: | |
| return ETextAlign::kWebkitLeft; | |
| case CSSValueWebkitRight: | |
| return ETextAlign::kWebkitRight; | |
| case CSSValueWebkitCenter: | |
| return ETextAlign::kWebkitCenter; | |
| case CSSValueStart: | |
| return ETextAlign::kStart; | |
| case CSSValueEnd: | |
| return ETextAlign::kEnd; | |
| default: | |
| NOTREACHED(); | |
| return ETextAlign::kStart; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(ETextAlign v) { | |
| switch (v) { | |
| case ETextAlign::kLeft: | |
| return CSSValueLeft; | |
| case ETextAlign::kRight: | |
| return CSSValueRight; | |
| case ETextAlign::kCenter: | |
| return CSSValueCenter; | |
| case ETextAlign::kJustify: | |
| return CSSValueJustify; | |
| case ETextAlign::kWebkitLeft: | |
| return CSSValueWebkitLeft; | |
| case ETextAlign::kWebkitRight: | |
| return CSSValueWebkitRight; | |
| case ETextAlign::kWebkitCenter: | |
| return CSSValueWebkitCenter; | |
| case ETextAlign::kStart: | |
| return CSSValueStart; | |
| case ETextAlign::kEnd: | |
| return CSSValueEnd; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline ETableLayout cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueAuto: | |
| return ETableLayout::kAuto; | |
| case CSSValueFixed: | |
| return ETableLayout::kFixed; | |
| default: | |
| NOTREACHED(); | |
| return ETableLayout::kAuto; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(ETableLayout v) { | |
| switch (v) { | |
| case ETableLayout::kAuto: | |
| return CSSValueAuto; | |
| case ETableLayout::kFixed: | |
| return CSSValueFixed; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline EClear cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueNone: | |
| return EClear::kNone; | |
| case CSSValueLeft: | |
| return EClear::kLeft; | |
| case CSSValueRight: | |
| return EClear::kRight; | |
| case CSSValueBoth: | |
| return EClear::kBoth; | |
| default: | |
| NOTREACHED(); | |
| return EClear::kNone; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(EClear v) { | |
| switch (v) { | |
| case EClear::kNone: | |
| return CSSValueNone; | |
| case EClear::kLeft: | |
| return CSSValueLeft; | |
| case EClear::kRight: | |
| return CSSValueRight; | |
| case EClear::kBoth: | |
| return CSSValueBoth; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline EEmptyCells cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueShow: | |
| return EEmptyCells::kShow; | |
| case CSSValueHide: | |
| return EEmptyCells::kHide; | |
| default: | |
| NOTREACHED(); | |
| return EEmptyCells::kShow; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(EEmptyCells v) { | |
| switch (v) { | |
| case EEmptyCells::kShow: | |
| return CSSValueShow; | |
| case EEmptyCells::kHide: | |
| return CSSValueHide; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline EBorderCollapse cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueSeparate: | |
| return EBorderCollapse::kSeparate; | |
| case CSSValueCollapse: | |
| return EBorderCollapse::kCollapse; | |
| default: | |
| NOTREACHED(); | |
| return EBorderCollapse::kSeparate; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(EBorderCollapse v) { | |
| switch (v) { | |
| case EBorderCollapse::kSeparate: | |
| return CSSValueSeparate; | |
| case EBorderCollapse::kCollapse: | |
| return CSSValueCollapse; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| template <> | |
| inline EListStyleType cssValueIDToPlatformEnumGenerated(CSSValueID v) { | |
| switch (v) { | |
| case CSSValueDisc: | |
| return EListStyleType::kDisc; | |
| case CSSValueCircle: | |
| return EListStyleType::kCircle; | |
| case CSSValueSquare: | |
| return EListStyleType::kSquare; | |
| case CSSValueDecimal: | |
| return EListStyleType::kDecimal; | |
| case CSSValueDecimalLeadingZero: | |
| return EListStyleType::kDecimalLeadingZero; | |
| case CSSValueArabicIndic: | |
| return EListStyleType::kArabicIndic; | |
| case CSSValueBengali: | |
| return EListStyleType::kBengali; | |
| case CSSValueCambodian: | |
| return EListStyleType::kCambodian; | |
| case CSSValueKhmer: | |
| return EListStyleType::kKhmer; | |
| case CSSValueDevanagari: | |
| return EListStyleType::kDevanagari; | |
| case CSSValueGujarati: | |
| return EListStyleType::kGujarati; | |
| case CSSValueGurmukhi: | |
| return EListStyleType::kGurmukhi; | |
| case CSSValueKannada: | |
| return EListStyleType::kKannada; | |
| case CSSValueLao: | |
| return EListStyleType::kLao; | |
| case CSSValueMalayalam: | |
| return EListStyleType::kMalayalam; | |
| case CSSValueMongolian: | |
| return EListStyleType::kMongolian; | |
| case CSSValueMyanmar: | |
| return EListStyleType::kMyanmar; | |
| case CSSValueOriya: | |
| return EListStyleType::kOriya; | |
| case CSSValuePersian: | |
| return EListStyleType::kPersian; | |
| case CSSValueUrdu: | |
| return EListStyleType::kUrdu; | |
| case CSSValueTelugu: | |
| return EListStyleType::kTelugu; | |
| case CSSValueTibetan: | |
| return EListStyleType::kTibetan; | |
| case CSSValueThai: | |
| return EListStyleType::kThai; | |
| case CSSValueLowerRoman: | |
| return EListStyleType::kLowerRoman; | |
| case CSSValueUpperRoman: | |
| return EListStyleType::kUpperRoman; | |
| case CSSValueLowerGreek: | |
| return EListStyleType::kLowerGreek; | |
| case CSSValueLowerAlpha: | |
| return EListStyleType::kLowerAlpha; | |
| case CSSValueLowerLatin: | |
| return EListStyleType::kLowerLatin; | |
| case CSSValueUpperAlpha: | |
| return EListStyleType::kUpperAlpha; | |
| case CSSValueUpperLatin: | |
| return EListStyleType::kUpperLatin; | |
| case CSSValueCjkEarthlyBranch: | |
| return EListStyleType::kCjkEarthlyBranch; | |
| case CSSValueCjkHeavenlyStem: | |
| return EListStyleType::kCjkHeavenlyStem; | |
| case CSSValueEthiopicHalehame: | |
| return EListStyleType::kEthiopicHalehame; | |
| case CSSValueEthiopicHalehameAm: | |
| return EListStyleType::kEthiopicHalehameAm; | |
| case CSSValueEthiopicHalehameTiEr: | |
| return EListStyleType::kEthiopicHalehameTiEr; | |
| case CSSValueEthiopicHalehameTiEt: | |
| return EListStyleType::kEthiopicHalehameTiEt; | |
| case CSSValueHangul: | |
| return EListStyleType::kHangul; | |
| case CSSValueHangulConsonant: | |
| return EListStyleType::kHangulConsonant; | |
| case CSSValueKoreanHangulFormal: | |
| return EListStyleType::kKoreanHangulFormal; | |
| case CSSValueKoreanHanjaFormal: | |
| return EListStyleType::kKoreanHanjaFormal; | |
| case CSSValueKoreanHanjaInformal: | |
| return EListStyleType::kKoreanHanjaInformal; | |
| case CSSValueHebrew: | |
| return EListStyleType::kHebrew; | |
| case CSSValueArmenian: | |
| return EListStyleType::kArmenian; | |
| case CSSValueLowerArmenian: | |
| return EListStyleType::kLowerArmenian; | |
| case CSSValueUpperArmenian: | |
| return EListStyleType::kUpperArmenian; | |
| case CSSValueGeorgian: | |
| return EListStyleType::kGeorgian; | |
| case CSSValueCjkIdeographic: | |
| return EListStyleType::kCjkIdeographic; | |
| case CSSValueSimpChineseFormal: | |
| return EListStyleType::kSimpChineseFormal; | |
| case CSSValueSimpChineseInformal: | |
| return EListStyleType::kSimpChineseInformal; | |
| case CSSValueTradChineseFormal: | |
| return EListStyleType::kTradChineseFormal; | |
| case CSSValueTradChineseInformal: | |
| return EListStyleType::kTradChineseInformal; | |
| case CSSValueHiragana: | |
| return EListStyleType::kHiragana; | |
| case CSSValueKatakana: | |
| return EListStyleType::kKatakana; | |
| case CSSValueHiraganaIroha: | |
| return EListStyleType::kHiraganaIroha; | |
| case CSSValueKatakanaIroha: | |
| return EListStyleType::kKatakanaIroha; | |
| case CSSValueNone: | |
| return EListStyleType::kNone; | |
| default: | |
| NOTREACHED(); | |
| return EListStyleType::kDisc; | |
| } | |
| } | |
| inline CSSValueID platformEnumToCSSValueIDGenerated(EListStyleType v) { | |
| switch (v) { | |
| case EListStyleType::kDisc: | |
| return CSSValueDisc; | |
| case EListStyleType::kCircle: | |
| return CSSValueCircle; | |
| case EListStyleType::kSquare: | |
| return CSSValueSquare; | |
| case EListStyleType::kDecimal: | |
| return CSSValueDecimal; | |
| case EListStyleType::kDecimalLeadingZero: | |
| return CSSValueDecimalLeadingZero; | |
| case EListStyleType::kArabicIndic: | |
| return CSSValueArabicIndic; | |
| case EListStyleType::kBengali: | |
| return CSSValueBengali; | |
| case EListStyleType::kCambodian: | |
| return CSSValueCambodian; | |
| case EListStyleType::kKhmer: | |
| return CSSValueKhmer; | |
| case EListStyleType::kDevanagari: | |
| return CSSValueDevanagari; | |
| case EListStyleType::kGujarati: | |
| return CSSValueGujarati; | |
| case EListStyleType::kGurmukhi: | |
| return CSSValueGurmukhi; | |
| case EListStyleType::kKannada: | |
| return CSSValueKannada; | |
| case EListStyleType::kLao: | |
| return CSSValueLao; | |
| case EListStyleType::kMalayalam: | |
| return CSSValueMalayalam; | |
| case EListStyleType::kMongolian: | |
| return CSSValueMongolian; | |
| case EListStyleType::kMyanmar: | |
| return CSSValueMyanmar; | |
| case EListStyleType::kOriya: | |
| return CSSValueOriya; | |
| case EListStyleType::kPersian: | |
| return CSSValuePersian; | |
| case EListStyleType::kUrdu: | |
| return CSSValueUrdu; | |
| case EListStyleType::kTelugu: | |
| return CSSValueTelugu; | |
| case EListStyleType::kTibetan: | |
| return CSSValueTibetan; | |
| case EListStyleType::kThai: | |
| return CSSValueThai; | |
| case EListStyleType::kLowerRoman: | |
| return CSSValueLowerRoman; | |
| case EListStyleType::kUpperRoman: | |
| return CSSValueUpperRoman; | |
| case EListStyleType::kLowerGreek: | |
| return CSSValueLowerGreek; | |
| case EListStyleType::kLowerAlpha: | |
| return CSSValueLowerAlpha; | |
| case EListStyleType::kLowerLatin: | |
| return CSSValueLowerLatin; | |
| case EListStyleType::kUpperAlpha: | |
| return CSSValueUpperAlpha; | |
| case EListStyleType::kUpperLatin: | |
| return CSSValueUpperLatin; | |
| case EListStyleType::kCjkEarthlyBranch: | |
| return CSSValueCjkEarthlyBranch; | |
| case EListStyleType::kCjkHeavenlyStem: | |
| return CSSValueCjkHeavenlyStem; | |
| case EListStyleType::kEthiopicHalehame: | |
| return CSSValueEthiopicHalehame; | |
| case EListStyleType::kEthiopicHalehameAm: | |
| return CSSValueEthiopicHalehameAm; | |
| case EListStyleType::kEthiopicHalehameTiEr: | |
| return CSSValueEthiopicHalehameTiEr; | |
| case EListStyleType::kEthiopicHalehameTiEt: | |
| return CSSValueEthiopicHalehameTiEt; | |
| case EListStyleType::kHangul: | |
| return CSSValueHangul; | |
| case EListStyleType::kHangulConsonant: | |
| return CSSValueHangulConsonant; | |
| case EListStyleType::kKoreanHangulFormal: | |
| return CSSValueKoreanHangulFormal; | |
| case EListStyleType::kKoreanHanjaFormal: | |
| return CSSValueKoreanHanjaFormal; | |
| case EListStyleType::kKoreanHanjaInformal: | |
| return CSSValueKoreanHanjaInformal; | |
| case EListStyleType::kHebrew: | |
| return CSSValueHebrew; | |
| case EListStyleType::kArmenian: | |
| return CSSValueArmenian; | |
| case EListStyleType::kLowerArmenian: | |
| return CSSValueLowerArmenian; | |
| case EListStyleType::kUpperArmenian: | |
| return CSSValueUpperArmenian; | |
| case EListStyleType::kGeorgian: | |
| return CSSValueGeorgian; | |
| case EListStyleType::kCjkIdeographic: | |
| return CSSValueCjkIdeographic; | |
| case EListStyleType::kSimpChineseFormal: | |
| return CSSValueSimpChineseFormal; | |
| case EListStyleType::kSimpChineseInformal: | |
| return CSSValueSimpChineseInformal; | |
| case EListStyleType::kTradChineseFormal: | |
| return CSSValueTradChineseFormal; | |
| case EListStyleType::kTradChineseInformal: | |
| return CSSValueTradChineseInformal; | |
| case EListStyleType::kHiragana: | |
| return CSSValueHiragana; | |
| case EListStyleType::kKatakana: | |
| return CSSValueKatakana; | |
| case EListStyleType::kHiraganaIroha: | |
| return CSSValueHiraganaIroha; | |
| case EListStyleType::kKatakanaIroha: | |
| return CSSValueKatakanaIroha; | |
| case EListStyleType::kNone: | |
| return CSSValueNone; | |
| default: | |
| NOTREACHED(); | |
| return CSSValueNone; | |
| } | |
| } | |
| } // namespace detail | |
| } // namespace blink |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment