Skip to content

Instantly share code, notes, and snippets.

@darrnshn
Created March 13, 2017 04:58
Show Gist options
  • Save darrnshn/2a3770b1721a7354110633a5ea6fcec1 to your computer and use it in GitHub Desktop.
Save darrnshn/2a3770b1721a7354110633a5ea6fcec1 to your computer and use it in GitHub Desktop.
// 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_bitfields[3];
};
// 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_textTransform = inheritParent.m_textTransform;
m_visibility = inheritParent.m_visibility;
m_writingMode = inheritParent.m_writingMode;
m_borderCollapse = inheritParent.m_borderCollapse;
m_boxDirection = inheritParent.m_boxDirection;
m_direction = inheritParent.m_direction;
m_emptyCells = inheritParent.m_emptyCells;
m_listStylePosition = inheritParent.m_listStylePosition;
m_printColorAdjust = inheritParent.m_printColorAdjust;
m_rtlOrdering = inheritParent.m_rtlOrdering;
}
void ComputedStyleBase::copyNonInheritedFromCached(
const ComputedStyleBase& other) {
m_breakAfter = other.m_breakAfter;
m_breakBefore = other.m_breakBefore;
m_overflowX = other.m_overflowX;
m_overflowY = other.m_overflowY;
m_position = other.m_position;
m_unicodeBidi = other.m_unicodeBidi;
m_breakInside = other.m_breakInside;
m_clear = other.m_clear;
m_floating = other.m_floating;
m_overflowAnchor = other.m_overflowAnchor;
m_borderCollapseIsInherited = other.m_borderCollapseIsInherited;
m_boxDirectionIsInherited = other.m_boxDirectionIsInherited;
m_captionSideIsInherited = other.m_captionSideIsInherited;
m_emptyCellsIsInherited = other.m_emptyCellsIsInherited;
m_listStylePositionIsInherited = other.m_listStylePositionIsInherited;
m_pointerEventsIsInherited = other.m_pointerEventsIsInherited;
m_printColorAdjustIsInherited = other.m_printColorAdjustIsInherited;
m_rtlOrderingIsInherited = other.m_rtlOrderingIsInherited;
m_tableLayout = other.m_tableLayout;
m_textAlignIsInherited = other.m_textAlignIsInherited;
m_textTransformIsInherited = other.m_textTransformIsInherited;
m_visibilityIsInherited = other.m_visibilityIsInherited;
m_whiteSpaceIsInherited = other.m_whiteSpaceIsInherited;
}
void ComputedStyleBase::propagateIndependentInheritedProperties(
const ComputedStyleBase& parentStyle) {
if (pointerEventsIsInherited())
setPointerEvents(parentStyle.pointerEvents());
if (textAlignIsInherited())
setTextAlign(parentStyle.textAlign());
if (whiteSpaceIsInherited())
setWhiteSpace(parentStyle.whiteSpace());
if (captionSideIsInherited())
setCaptionSide(parentStyle.captionSide());
if (textTransformIsInherited())
setTextTransform(parentStyle.textTransform());
if (visibilityIsInherited())
setVisibility(parentStyle.visibility());
if (borderCollapseIsInherited())
setBorderCollapse(parentStyle.borderCollapse());
if (boxDirectionIsInherited())
setBoxDirection(parentStyle.boxDirection());
if (emptyCellsIsInherited())
setEmptyCells(parentStyle.emptyCells());
if (listStylePositionIsInherited())
setListStylePosition(parentStyle.listStylePosition());
if (printColorAdjustIsInherited())
setPrintColorAdjust(parentStyle.printColorAdjust());
if (rtlOrderingIsInherited())
setRtlOrdering(parentStyle.rtlOrdering());
}
} // namespace blink
// 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/ComputedStyleBaseConstants.h"
#include "core/CoreExport.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:
ALWAYS_INLINE ComputedStyleBase() :
m_cursor(static_cast<unsigned>(ECursor::kAuto)),
m_listStyleType(static_cast<unsigned>(EListStyleType::kDisc)),
m_breakAfter(static_cast<unsigned>(EBreakBetween::kAuto)),
m_breakBefore(static_cast<unsigned>(EBreakBetween::kAuto)),
m_pointerEvents(static_cast<unsigned>(EPointerEvents::kAuto)),
m_textAlign(static_cast<unsigned>(ETextAlign::kStart)),
m_overflowX(static_cast<unsigned>(EOverflow::kVisible)),
m_affectedByActive(static_cast<unsigned>(false)),
m_overflowY(static_cast<unsigned>(EOverflow::kVisible)),
m_position(static_cast<unsigned>(EPosition::kStatic)),
m_unicodeBidi(static_cast<unsigned>(UnicodeBidi::kNormal)),
m_whiteSpace(static_cast<unsigned>(EWhiteSpace::kNormal)),
m_breakInside(static_cast<unsigned>(EBreakInside::kAuto)),
m_captionSide(static_cast<unsigned>(ECaptionSide::kTop)),
m_clear(static_cast<unsigned>(EClear::kNone)),
m_floating(static_cast<unsigned>(EFloat::kNone)),
m_overflowAnchor(static_cast<unsigned>(EOverflowAnchor::kAuto)),
m_textTransform(static_cast<unsigned>(ETextTransform::kNone)),
m_visibility(static_cast<unsigned>(EVisibility::kVisible)),
m_writingMode(static_cast<unsigned>(WritingMode::kHorizontalTb)),
m_affectedByDrag(static_cast<unsigned>(false)),
m_affectedByFocus(static_cast<unsigned>(false)),
m_affectedByHover(static_cast<unsigned>(false)),
m_borderCollapse(static_cast<unsigned>(EBorderCollapse::kSeparate)),
m_borderCollapseIsInherited(static_cast<unsigned>(true)),
m_boxDirection(static_cast<unsigned>(EBoxDirection::kNormal)),
m_boxDirectionIsInherited(static_cast<unsigned>(true)),
m_captionSideIsInherited(static_cast<unsigned>(true)),
m_direction(static_cast<unsigned>(TextDirection::kLtr)),
m_emptyCells(static_cast<unsigned>(EEmptyCells::kShow)),
m_emptyCellsIsInherited(static_cast<unsigned>(true)),
m_hasExplicitlyInheritedProperties(static_cast<unsigned>(false)),
m_hasVariableReferenceFromNonInheritedProperty(static_cast<unsigned>(false)),
m_listStylePosition(static_cast<unsigned>(EListStylePosition::kOutside)),
m_listStylePositionIsInherited(static_cast<unsigned>(true)),
m_pointerEventsIsInherited(static_cast<unsigned>(true)),
m_printColorAdjust(static_cast<unsigned>(EPrintColorAdjust::kEconomy)),
m_printColorAdjustIsInherited(static_cast<unsigned>(true)),
m_rtlOrdering(static_cast<unsigned>(EOrder::kLogical)),
m_rtlOrderingIsInherited(static_cast<unsigned>(true)),
m_tableLayout(static_cast<unsigned>(ETableLayout::kAuto)),
m_textAlignIsInherited(static_cast<unsigned>(true)),
m_textTransformIsInherited(static_cast<unsigned>(true)),
m_unique(static_cast<unsigned>(false)),
m_visibilityIsInherited(static_cast<unsigned>(true)),
m_whiteSpaceIsInherited(static_cast<unsigned>(true))
{}
~ComputedStyleBase() {}
ALWAYS_INLINE ComputedStyleBase(const ComputedStyleBase& o) :
m_cursor(o.m_cursor),
m_listStyleType(o.m_listStyleType),
m_breakAfter(o.m_breakAfter),
m_breakBefore(o.m_breakBefore),
m_pointerEvents(o.m_pointerEvents),
m_textAlign(o.m_textAlign),
m_overflowX(o.m_overflowX),
m_affectedByActive(o.m_affectedByActive),
m_overflowY(o.m_overflowY),
m_position(o.m_position),
m_unicodeBidi(o.m_unicodeBidi),
m_whiteSpace(o.m_whiteSpace),
m_breakInside(o.m_breakInside),
m_captionSide(o.m_captionSide),
m_clear(o.m_clear),
m_floating(o.m_floating),
m_overflowAnchor(o.m_overflowAnchor),
m_textTransform(o.m_textTransform),
m_visibility(o.m_visibility),
m_writingMode(o.m_writingMode),
m_affectedByDrag(o.m_affectedByDrag),
m_affectedByFocus(o.m_affectedByFocus),
m_affectedByHover(o.m_affectedByHover),
m_borderCollapse(o.m_borderCollapse),
m_borderCollapseIsInherited(o.m_borderCollapseIsInherited),
m_boxDirection(o.m_boxDirection),
m_boxDirectionIsInherited(o.m_boxDirectionIsInherited),
m_captionSideIsInherited(o.m_captionSideIsInherited),
m_direction(o.m_direction),
m_emptyCells(o.m_emptyCells),
m_emptyCellsIsInherited(o.m_emptyCellsIsInherited),
m_hasExplicitlyInheritedProperties(o.m_hasExplicitlyInheritedProperties),
m_hasVariableReferenceFromNonInheritedProperty(o.m_hasVariableReferenceFromNonInheritedProperty),
m_listStylePosition(o.m_listStylePosition),
m_listStylePositionIsInherited(o.m_listStylePositionIsInherited),
m_pointerEventsIsInherited(o.m_pointerEventsIsInherited),
m_printColorAdjust(o.m_printColorAdjust),
m_printColorAdjustIsInherited(o.m_printColorAdjustIsInherited),
m_rtlOrdering(o.m_rtlOrdering),
m_rtlOrderingIsInherited(o.m_rtlOrderingIsInherited),
m_tableLayout(o.m_tableLayout),
m_textAlignIsInherited(o.m_textAlignIsInherited),
m_textTransformIsInherited(o.m_textTransformIsInherited),
m_unique(o.m_unique),
m_visibilityIsInherited(o.m_visibilityIsInherited),
m_whiteSpaceIsInherited(o.m_whiteSpaceIsInherited)
{}
inline bool inheritedEqual(const ComputedStyleBase& o) const {
return (
m_cursor == o.m_cursor &&
m_listStyleType == o.m_listStyleType &&
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_writingMode == o.m_writingMode &&
m_borderCollapse == o.m_borderCollapse &&
m_boxDirection == o.m_boxDirection &&
m_direction == o.m_direction &&
m_emptyCells == o.m_emptyCells &&
m_listStylePosition == o.m_listStylePosition &&
m_printColorAdjust == o.m_printColorAdjust &&
m_rtlOrdering == o.m_rtlOrdering
);
}
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_borderCollapse == o.m_borderCollapse &&
m_boxDirection == o.m_boxDirection &&
m_emptyCells == o.m_emptyCells &&
m_listStylePosition == o.m_listStylePosition &&
m_printColorAdjust == o.m_printColorAdjust &&
m_rtlOrdering == o.m_rtlOrdering
);
}
inline bool nonIndependentInheritedEqual(const ComputedStyleBase& o) const {
return (
m_cursor == o.m_cursor &&
m_listStyleType == o.m_listStyleType &&
m_writingMode == o.m_writingMode &&
m_direction == o.m_direction
);
}
inline bool nonInheritedEqual(const ComputedStyleBase& o) const {
return (
m_breakAfter == o.m_breakAfter &&
m_breakBefore == o.m_breakBefore &&
m_overflowX == o.m_overflowX &&
m_overflowY == o.m_overflowY &&
m_position == o.m_position &&
m_unicodeBidi == o.m_unicodeBidi &&
m_breakInside == o.m_breakInside &&
m_clear == o.m_clear &&
m_floating == o.m_floating &&
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.
// cursor
inline static ECursor initialCursor() {
return ECursor::kAuto;
}
ECursor cursor() const {
return static_cast<ECursor>(m_cursor);
}
void setCursor(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(EListStyleType v) {
m_listStyleType = static_cast<unsigned>(v);
}
inline void resetListStyleType() {
m_listStyleType = static_cast<unsigned>(EListStyleType::kDisc);
}
// break-after
inline static EBreakBetween initialBreakAfter() {
return EBreakBetween::kAuto;
}
EBreakBetween breakAfter() const {
return static_cast<EBreakBetween>(m_breakAfter);
}
void setBreakAfter(EBreakBetween v) {
m_breakAfter = static_cast<unsigned>(v);
}
inline void resetBreakAfter() {
m_breakAfter = static_cast<unsigned>(EBreakBetween::kAuto);
}
// break-before
inline static EBreakBetween initialBreakBefore() {
return EBreakBetween::kAuto;
}
EBreakBetween breakBefore() const {
return static_cast<EBreakBetween>(m_breakBefore);
}
void setBreakBefore(EBreakBetween v) {
m_breakBefore = static_cast<unsigned>(v);
}
inline void resetBreakBefore() {
m_breakBefore = 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(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(ETextAlign v) {
m_textAlign = static_cast<unsigned>(v);
}
inline void resetTextAlign() {
m_textAlign = static_cast<unsigned>(ETextAlign::kStart);
}
// overflow-x
inline static EOverflow initialOverflowX() {
return EOverflow::kVisible;
}
EOverflow overflowX() const {
return static_cast<EOverflow>(m_overflowX);
}
void setOverflowX(EOverflow v) {
m_overflowX = static_cast<unsigned>(v);
}
inline void resetOverflowX() {
m_overflowX = static_cast<unsigned>(EOverflow::kVisible);
}
// affectedByActive
bool affectedByActive() const {
return m_affectedByActive;
}
void setAffectedByActive() {
m_affectedByActive = static_cast<unsigned>(true);
}
// overflow-y
inline static EOverflow initialOverflowY() {
return EOverflow::kVisible;
}
EOverflow overflowY() const {
return static_cast<EOverflow>(m_overflowY);
}
void setOverflowY(EOverflow v) {
m_overflowY = static_cast<unsigned>(v);
}
inline void resetOverflowY() {
m_overflowY = static_cast<unsigned>(EOverflow::kVisible);
}
// position
inline static EPosition initialPosition() {
return EPosition::kStatic;
}
EPosition position() const {
return static_cast<EPosition>(m_position);
}
void setPosition(EPosition v) {
m_position = static_cast<unsigned>(v);
}
inline void resetPosition() {
m_position = static_cast<unsigned>(EPosition::kStatic);
}
// unicode-bidi
inline static UnicodeBidi initialUnicodeBidi() {
return UnicodeBidi::kNormal;
}
UnicodeBidi getUnicodeBidi() const {
return static_cast<UnicodeBidi>(m_unicodeBidi);
}
void setUnicodeBidi(UnicodeBidi v) {
m_unicodeBidi = static_cast<unsigned>(v);
}
inline void resetUnicodeBidi() {
m_unicodeBidi = static_cast<unsigned>(UnicodeBidi::kNormal);
}
// white-space
inline static EWhiteSpace initialWhiteSpace() {
return EWhiteSpace::kNormal;
}
EWhiteSpace whiteSpace() const {
return static_cast<EWhiteSpace>(m_whiteSpace);
}
void setWhiteSpace(EWhiteSpace v) {
m_whiteSpace = static_cast<unsigned>(v);
}
inline void resetWhiteSpace() {
m_whiteSpace = static_cast<unsigned>(EWhiteSpace::kNormal);
}
// break-inside
inline static EBreakInside initialBreakInside() {
return EBreakInside::kAuto;
}
EBreakInside breakInside() const {
return static_cast<EBreakInside>(m_breakInside);
}
void setBreakInside(EBreakInside v) {
m_breakInside = static_cast<unsigned>(v);
}
inline void resetBreakInside() {
m_breakInside = static_cast<unsigned>(EBreakInside::kAuto);
}
// caption-side
inline static ECaptionSide initialCaptionSide() {
return ECaptionSide::kTop;
}
ECaptionSide captionSide() const {
return static_cast<ECaptionSide>(m_captionSide);
}
void setCaptionSide(ECaptionSide v) {
m_captionSide = static_cast<unsigned>(v);
}
inline void resetCaptionSide() {
m_captionSide = static_cast<unsigned>(ECaptionSide::kTop);
}
// clear
inline static EClear initialClear() {
return EClear::kNone;
}
EClear clear() const {
return static_cast<EClear>(m_clear);
}
void setClear(EClear v) {
m_clear = static_cast<unsigned>(v);
}
inline void resetClear() {
m_clear = static_cast<unsigned>(EClear::kNone);
}
// float
inline static EFloat initialFloating() {
return EFloat::kNone;
}
EFloat floating() const {
return static_cast<EFloat>(m_floating);
}
void setFloating(EFloat v) {
m_floating = static_cast<unsigned>(v);
}
inline void resetFloating() {
m_floating = static_cast<unsigned>(EFloat::kNone);
}
// overflow-anchor
inline static EOverflowAnchor initialOverflowAnchor() {
return EOverflowAnchor::kAuto;
}
EOverflowAnchor overflowAnchor() const {
return static_cast<EOverflowAnchor>(m_overflowAnchor);
}
void setOverflowAnchor(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(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(EVisibility v) {
m_visibility = static_cast<unsigned>(v);
}
inline void resetVisibility() {
m_visibility = static_cast<unsigned>(EVisibility::kVisible);
}
// writing-mode
inline static WritingMode initialWritingMode() {
return WritingMode::kHorizontalTb;
}
WritingMode getWritingMode() const {
return static_cast<WritingMode>(m_writingMode);
}
void setWritingMode(WritingMode v) {
m_writingMode = static_cast<unsigned>(v);
}
inline void resetWritingMode() {
m_writingMode = static_cast<unsigned>(WritingMode::kHorizontalTb);
}
// affectedByDrag
bool affectedByDrag() const {
return m_affectedByDrag;
}
void setAffectedByDrag() {
m_affectedByDrag = 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);
}
// border-collapse
inline static EBorderCollapse initialBorderCollapse() {
return EBorderCollapse::kSeparate;
}
EBorderCollapse borderCollapse() const {
return static_cast<EBorderCollapse>(m_borderCollapse);
}
void setBorderCollapse(EBorderCollapse v) {
m_borderCollapse = static_cast<unsigned>(v);
}
inline void resetBorderCollapse() {
m_borderCollapse = static_cast<unsigned>(EBorderCollapse::kSeparate);
}
// border-collapse
inline static bool initialBorderCollapseIsInherited() {
return true;
}
bool borderCollapseIsInherited() const {
return static_cast<bool>(m_borderCollapseIsInherited);
}
void setBorderCollapseIsInherited(bool v) {
m_borderCollapseIsInherited = static_cast<unsigned>(v);
}
inline void resetBorderCollapseIsInherited() {
m_borderCollapseIsInherited = static_cast<unsigned>(true);
}
// -webkit-box-direction
inline static EBoxDirection initialBoxDirection() {
return EBoxDirection::kNormal;
}
EBoxDirection boxDirection() const {
return static_cast<EBoxDirection>(m_boxDirection);
}
void setBoxDirection(EBoxDirection v) {
m_boxDirection = static_cast<unsigned>(v);
}
inline void resetBoxDirection() {
m_boxDirection = static_cast<unsigned>(EBoxDirection::kNormal);
}
// -webkit-box-direction
inline static bool initialBoxDirectionIsInherited() {
return true;
}
bool boxDirectionIsInherited() const {
return static_cast<bool>(m_boxDirectionIsInherited);
}
void setBoxDirectionIsInherited(bool v) {
m_boxDirectionIsInherited = static_cast<unsigned>(v);
}
inline void resetBoxDirectionIsInherited() {
m_boxDirectionIsInherited = static_cast<unsigned>(true);
}
// caption-side
inline static bool initialCaptionSideIsInherited() {
return true;
}
bool captionSideIsInherited() const {
return static_cast<bool>(m_captionSideIsInherited);
}
void setCaptionSideIsInherited(bool v) {
m_captionSideIsInherited = static_cast<unsigned>(v);
}
inline void resetCaptionSideIsInherited() {
m_captionSideIsInherited = static_cast<unsigned>(true);
}
// direction
inline static TextDirection initialDirection() {
return TextDirection::kLtr;
}
TextDirection direction() const {
return static_cast<TextDirection>(m_direction);
}
void setDirection(TextDirection v) {
m_direction = static_cast<unsigned>(v);
}
inline void resetDirection() {
m_direction = static_cast<unsigned>(TextDirection::kLtr);
}
// empty-cells
inline static EEmptyCells initialEmptyCells() {
return EEmptyCells::kShow;
}
EEmptyCells emptyCells() const {
return static_cast<EEmptyCells>(m_emptyCells);
}
void setEmptyCells(EEmptyCells v) {
m_emptyCells = static_cast<unsigned>(v);
}
inline void resetEmptyCells() {
m_emptyCells = static_cast<unsigned>(EEmptyCells::kShow);
}
// empty-cells
inline static bool initialEmptyCellsIsInherited() {
return true;
}
bool emptyCellsIsInherited() const {
return static_cast<bool>(m_emptyCellsIsInherited);
}
void setEmptyCellsIsInherited(bool v) {
m_emptyCellsIsInherited = static_cast<unsigned>(v);
}
inline void resetEmptyCellsIsInherited() {
m_emptyCellsIsInherited = static_cast<unsigned>(true);
}
// hasExplicitlyInheritedProperties
bool hasExplicitlyInheritedProperties() const {
return m_hasExplicitlyInheritedProperties;
}
void setHasExplicitlyInheritedProperties() {
m_hasExplicitlyInheritedProperties = static_cast<unsigned>(true);
}
// hasVariableReferenceFromNonInheritedProperty
bool hasVariableReferenceFromNonInheritedProperty() const {
return m_hasVariableReferenceFromNonInheritedProperty;
}
void setHasVariableReferenceFromNonInheritedProperty() {
m_hasVariableReferenceFromNonInheritedProperty = 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(EListStylePosition v) {
m_listStylePosition = static_cast<unsigned>(v);
}
inline void resetListStylePosition() {
m_listStylePosition = static_cast<unsigned>(EListStylePosition::kOutside);
}
// list-style-position
inline static bool initialListStylePositionIsInherited() {
return true;
}
bool listStylePositionIsInherited() const {
return static_cast<bool>(m_listStylePositionIsInherited);
}
void setListStylePositionIsInherited(bool v) {
m_listStylePositionIsInherited = static_cast<unsigned>(v);
}
inline void resetListStylePositionIsInherited() {
m_listStylePositionIsInherited = static_cast<unsigned>(true);
}
// pointer-events
inline static bool initialPointerEventsIsInherited() {
return true;
}
bool pointerEventsIsInherited() const {
return static_cast<bool>(m_pointerEventsIsInherited);
}
void setPointerEventsIsInherited(bool v) {
m_pointerEventsIsInherited = static_cast<unsigned>(v);
}
inline void resetPointerEventsIsInherited() {
m_pointerEventsIsInherited = 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(EPrintColorAdjust v) {
m_printColorAdjust = static_cast<unsigned>(v);
}
inline void resetPrintColorAdjust() {
m_printColorAdjust = static_cast<unsigned>(EPrintColorAdjust::kEconomy);
}
// -webkit-print-color-adjust
inline static bool initialPrintColorAdjustIsInherited() {
return true;
}
bool printColorAdjustIsInherited() const {
return static_cast<bool>(m_printColorAdjustIsInherited);
}
void setPrintColorAdjustIsInherited(bool v) {
m_printColorAdjustIsInherited = static_cast<unsigned>(v);
}
inline void resetPrintColorAdjustIsInherited() {
m_printColorAdjustIsInherited = 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(EOrder v) {
m_rtlOrdering = static_cast<unsigned>(v);
}
inline void resetRtlOrdering() {
m_rtlOrdering = static_cast<unsigned>(EOrder::kLogical);
}
// -webkit-rtl-ordering
inline static bool initialRtlOrderingIsInherited() {
return true;
}
bool rtlOrderingIsInherited() const {
return static_cast<bool>(m_rtlOrderingIsInherited);
}
void setRtlOrderingIsInherited(bool v) {
m_rtlOrderingIsInherited = static_cast<unsigned>(v);
}
inline void resetRtlOrderingIsInherited() {
m_rtlOrderingIsInherited = static_cast<unsigned>(true);
}
// table-layout
inline static ETableLayout initialTableLayout() {
return ETableLayout::kAuto;
}
ETableLayout tableLayout() const {
return static_cast<ETableLayout>(m_tableLayout);
}
void setTableLayout(ETableLayout v) {
m_tableLayout = static_cast<unsigned>(v);
}
inline void resetTableLayout() {
m_tableLayout = static_cast<unsigned>(ETableLayout::kAuto);
}
// text-align
inline static bool initialTextAlignIsInherited() {
return true;
}
bool textAlignIsInherited() const {
return static_cast<bool>(m_textAlignIsInherited);
}
void setTextAlignIsInherited(bool v) {
m_textAlignIsInherited = static_cast<unsigned>(v);
}
inline void resetTextAlignIsInherited() {
m_textAlignIsInherited = static_cast<unsigned>(true);
}
// text-transform
inline static bool initialTextTransformIsInherited() {
return true;
}
bool textTransformIsInherited() const {
return static_cast<bool>(m_textTransformIsInherited);
}
void setTextTransformIsInherited(bool v) {
m_textTransformIsInherited = static_cast<unsigned>(v);
}
inline void resetTextTransformIsInherited() {
m_textTransformIsInherited = static_cast<unsigned>(true);
}
// unique
bool unique() const {
return m_unique;
}
void setUnique() {
m_unique = static_cast<unsigned>(true);
}
// visibility
inline static bool initialVisibilityIsInherited() {
return true;
}
bool visibilityIsInherited() const {
return static_cast<bool>(m_visibilityIsInherited);
}
void setVisibilityIsInherited(bool v) {
m_visibilityIsInherited = static_cast<unsigned>(v);
}
inline void resetVisibilityIsInherited() {
m_visibilityIsInherited = static_cast<unsigned>(true);
}
// white-space
inline static bool initialWhiteSpaceIsInherited() {
return true;
}
bool whiteSpaceIsInherited() const {
return static_cast<bool>(m_whiteSpaceIsInherited);
}
void setWhiteSpaceIsInherited(bool v) {
m_whiteSpaceIsInherited = static_cast<unsigned>(v);
}
inline void resetWhiteSpaceIsInherited() {
m_whiteSpaceIsInherited = static_cast<unsigned>(true);
}
protected:
// Storage.
unsigned m_cursor : 6; // ECursor
unsigned m_listStyleType : 6; // EListStyleType
unsigned m_breakAfter : 4; // EBreakBetween
unsigned m_breakBefore : 4; // EBreakBetween
unsigned m_pointerEvents : 4; // EPointerEvents
unsigned m_textAlign : 4; // ETextAlign
unsigned m_overflowX : 3; // EOverflow
unsigned m_affectedByActive : 1; // bool
unsigned m_overflowY : 3; // EOverflow
unsigned m_position : 3; // EPosition
unsigned m_unicodeBidi : 3; // UnicodeBidi
unsigned m_whiteSpace : 3; // EWhiteSpace
unsigned m_breakInside : 2; // EBreakInside
unsigned m_captionSide : 2; // ECaptionSide
unsigned m_clear : 2; // EClear
unsigned m_floating : 2; // EFloat
unsigned m_overflowAnchor : 2; // EOverflowAnchor
unsigned m_textTransform : 2; // ETextTransform
unsigned m_visibility : 2; // EVisibility
unsigned m_writingMode : 2; // WritingMode
unsigned m_affectedByDrag : 1; // bool
unsigned m_affectedByFocus : 1; // bool
unsigned m_affectedByHover : 1; // bool
unsigned m_borderCollapse : 1; // EBorderCollapse
unsigned m_borderCollapseIsInherited : 1; // bool
unsigned m_boxDirection : 1; // EBoxDirection
unsigned m_boxDirectionIsInherited : 1; // bool
unsigned m_captionSideIsInherited : 1; // bool
unsigned m_direction : 1; // TextDirection
unsigned m_emptyCells : 1; // EEmptyCells
unsigned m_emptyCellsIsInherited : 1; // bool
unsigned m_hasExplicitlyInheritedProperties : 1; // bool
unsigned m_hasVariableReferenceFromNonInheritedProperty : 1; // bool
unsigned m_listStylePosition : 1; // EListStylePosition
unsigned m_listStylePositionIsInherited : 1; // bool
unsigned m_pointerEventsIsInherited : 1; // bool
unsigned m_printColorAdjust : 1; // EPrintColorAdjust
unsigned m_printColorAdjustIsInherited : 1; // bool
unsigned m_rtlOrdering : 1; // EOrder
unsigned m_rtlOrderingIsInherited : 1; // bool
unsigned m_tableLayout : 1; // ETableLayout
unsigned m_textAlignIsInherited : 1; // bool
unsigned m_textTransformIsInherited : 1; // bool
unsigned m_unique : 1; // bool
unsigned m_visibilityIsInherited : 1; // bool
unsigned m_whiteSpaceIsInherited : 1; // bool
};
} // namespace blink
#endif // ComputedStyleBase_h
// 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 ComputedStyleBaseConstants_h
#define ComputedStyleBaseConstants_h
namespace blink {
// TODO(sashab): Move these enums to their own namespace, or add a CSS prefix,
// for consistency and to prevent name conflicts.
enum class EBorderCollapse : unsigned {
kCollapse,
kSeparate,
};
enum class EBoxDirection : unsigned {
kNormal,
kReverse,
};
enum class EBreakBetween : unsigned {
kAuto,
kAvoid,
kAvoidColumn,
kAvoidPage,
kColumn,
kLeft,
kPage,
kRecto,
kRight,
kVerso,
};
enum class EBreakInside : unsigned {
kAuto,
kAvoid,
kAvoidColumn,
kAvoidPage,
};
enum class ECaptionSide : unsigned {
kBottom,
kLeft,
kRight,
kTop,
};
enum class EClear : unsigned {
kBoth,
kLeft,
kNone,
kRight,
};
enum class ECursor : unsigned {
kAlias,
kAllScroll,
kAuto,
kCell,
kColResize,
kContextMenu,
kCopy,
kCrosshair,
kDefault,
kEResize,
kEwResize,
kHelp,
kMove,
kNResize,
kNeResize,
kNeswResize,
kNoDrop,
kNone,
kNotAllowed,
kNsResize,
kNwResize,
kNwseResize,
kPointer,
kProgress,
kRowResize,
kSResize,
kSeResize,
kSwResize,
kText,
kVerticalText,
kWResize,
kWait,
kWebkitGrab,
kWebkitGrabbing,
kZoomIn,
kZoomOut,
};
enum class EEmptyCells : unsigned {
kHide,
kShow,
};
enum class EFloat : unsigned {
kLeft,
kNone,
kRight,
};
enum class EListStylePosition : unsigned {
kInside,
kOutside,
};
enum class EListStyleType : unsigned {
kArabicIndic,
kArmenian,
kBengali,
kCambodian,
kCircle,
kCjkEarthlyBranch,
kCjkHeavenlyStem,
kCjkIdeographic,
kDecimal,
kDecimalLeadingZero,
kDevanagari,
kDisc,
kEthiopicHalehame,
kEthiopicHalehameAm,
kEthiopicHalehameTiEr,
kEthiopicHalehameTiEt,
kGeorgian,
kGujarati,
kGurmukhi,
kHangul,
kHangulConsonant,
kHebrew,
kHiragana,
kHiraganaIroha,
kKannada,
kKatakana,
kKatakanaIroha,
kKhmer,
kKoreanHangulFormal,
kKoreanHanjaFormal,
kKoreanHanjaInformal,
kLao,
kLowerAlpha,
kLowerArmenian,
kLowerGreek,
kLowerLatin,
kLowerRoman,
kMalayalam,
kMongolian,
kMyanmar,
kNone,
kOriya,
kPersian,
kSimpChineseFormal,
kSimpChineseInformal,
kSquare,
kTelugu,
kThai,
kTibetan,
kTradChineseFormal,
kTradChineseInformal,
kUpperAlpha,
kUpperArmenian,
kUpperLatin,
kUpperRoman,
kUrdu,
};
enum class EOrder : unsigned {
kLogical,
kVisual,
};
enum class EOverflow : unsigned {
kAuto,
kHidden,
kOverlay,
kScroll,
kVisible,
kWebkitPagedX,
kWebkitPagedY,
};
enum class EOverflowAnchor : unsigned {
kAuto,
kNone,
kVisible,
};
enum class EPointerEvents : unsigned {
kAll,
kAuto,
kBoundingBox,
kFill,
kNone,
kPainted,
kStroke,
kVisible,
kVisibleFill,
kVisiblePainted,
kVisibleStroke,
};
enum class EPosition : unsigned {
kAbsolute,
kFixed,
kRelative,
kStatic,
kSticky,
};
enum class EPrintColorAdjust : unsigned {
kEconomy,
kExact,
};
enum class ETableLayout : unsigned {
kAuto,
kFixed,
};
enum class ETextAlign : unsigned {
kCenter,
kEnd,
kJustify,
kLeft,
kRight,
kStart,
kWebkitCenter,
kWebkitLeft,
kWebkitRight,
};
enum class ETextTransform : unsigned {
kCapitalize,
kLowercase,
kNone,
kUppercase,
};
enum class EVisibility : unsigned {
kCollapse,
kHidden,
kVisible,
};
enum class EWhiteSpace : unsigned {
kNormal,
kNowrap,
kPre,
kPreLine,
kPreWrap,
kWebkitNowrap,
};
} // namespace blink
#endif // ComputedStyleBaseConstants_h
// Copyright 2016 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/css/cssom/CSSOMKeywords.h"
#include "core/css/CSSPropertyIDTemplates.h"
#include "core/css/cssom/CSSKeywordValue.h"
#include "wtf/HashMap.h"
namespace blink {
namespace {
using KeywordTable = HashMap<CSSPropertyID, Vector<CSSValueID>>;
KeywordTable createKeywordTable() {
KeywordTable table;
{
Vector<CSSValueID> borderBottomStyleKeywords;
borderBottomStyleKeywords.push_back(CSSValueNone);
table.set(CSSPropertyBorderBottomStyle, borderBottomStyleKeywords);
}
{
Vector<CSSValueID> heightKeywords;
heightKeywords.push_back(CSSValueAuto);
heightKeywords.push_back(CSSValueFitContent);
heightKeywords.push_back(CSSValueMinContent);
heightKeywords.push_back(CSSValueMaxContent);
table.set(CSSPropertyHeight, heightKeywords);
}
{
Vector<CSSValueID> borderImageSourceKeywords;
borderImageSourceKeywords.push_back(CSSValueNone);
table.set(CSSPropertyBorderImageSource, borderImageSourceKeywords);
}
{
Vector<CSSValueID> breakBeforeKeywords;
breakBeforeKeywords.push_back(CSSValueAuto);
breakBeforeKeywords.push_back(CSSValueAvoid);
breakBeforeKeywords.push_back(CSSValueAvoidColumn);
breakBeforeKeywords.push_back(CSSValueAvoidPage);
breakBeforeKeywords.push_back(CSSValueColumn);
breakBeforeKeywords.push_back(CSSValueLeft);
breakBeforeKeywords.push_back(CSSValuePage);
breakBeforeKeywords.push_back(CSSValueRecto);
breakBeforeKeywords.push_back(CSSValueRight);
breakBeforeKeywords.push_back(CSSValueVerso);
table.set(CSSPropertyBreakBefore, breakBeforeKeywords);
}
{
Vector<CSSValueID> webkitBoxDirectionKeywords;
webkitBoxDirectionKeywords.push_back(CSSValueNormal);
webkitBoxDirectionKeywords.push_back(CSSValueReverse);
table.set(CSSPropertyWebkitBoxDirection, webkitBoxDirectionKeywords);
}
{
Vector<CSSValueID> breakAfterKeywords;
breakAfterKeywords.push_back(CSSValueAuto);
breakAfterKeywords.push_back(CSSValueAvoid);
breakAfterKeywords.push_back(CSSValueAvoidColumn);
breakAfterKeywords.push_back(CSSValueAvoidPage);
breakAfterKeywords.push_back(CSSValueColumn);
breakAfterKeywords.push_back(CSSValueLeft);
breakAfterKeywords.push_back(CSSValuePage);
breakAfterKeywords.push_back(CSSValueRecto);
breakAfterKeywords.push_back(CSSValueRight);
breakAfterKeywords.push_back(CSSValueVerso);
table.set(CSSPropertyBreakAfter, breakAfterKeywords);
}
{
Vector<CSSValueID> clearKeywords;
clearKeywords.push_back(CSSValueNone);
clearKeywords.push_back(CSSValueLeft);
clearKeywords.push_back(CSSValueRight);
clearKeywords.push_back(CSSValueBoth);
table.set(CSSPropertyClear, clearKeywords);
}
{
Vector<CSSValueID> captionSideKeywords;
captionSideKeywords.push_back(CSSValueTop);
captionSideKeywords.push_back(CSSValueBottom);
captionSideKeywords.push_back(CSSValueLeft);
captionSideKeywords.push_back(CSSValueRight);
table.set(CSSPropertyCaptionSide, captionSideKeywords);
}
{
Vector<CSSValueID> webkitPrintColorAdjustKeywords;
webkitPrintColorAdjustKeywords.push_back(CSSValueEconomy);
webkitPrintColorAdjustKeywords.push_back(CSSValueExact);
table.set(CSSPropertyWebkitPrintColorAdjust, webkitPrintColorAdjustKeywords);
}
{
Vector<CSSValueID> transformKeywords;
transformKeywords.push_back(CSSValueNone);
table.set(CSSPropertyTransform, transformKeywords);
}
{
Vector<CSSValueID> borderRightWidthKeywords;
borderRightWidthKeywords.push_back(CSSValueThin);
borderRightWidthKeywords.push_back(CSSValueMedium);
borderRightWidthKeywords.push_back(CSSValueThick);
table.set(CSSPropertyBorderRightWidth, borderRightWidthKeywords);
}
{
Vector<CSSValueID> writingModeKeywords;
writingModeKeywords.push_back(CSSValueHorizontalTb);
writingModeKeywords.push_back(CSSValueVerticalRl);
writingModeKeywords.push_back(CSSValueVerticalLr);
table.set(CSSPropertyWritingMode, writingModeKeywords);
}
{
Vector<CSSValueID> borderLeftWidthKeywords;
borderLeftWidthKeywords.push_back(CSSValueThin);
borderLeftWidthKeywords.push_back(CSSValueMedium);
borderLeftWidthKeywords.push_back(CSSValueThick);
table.set(CSSPropertyBorderLeftWidth, borderLeftWidthKeywords);
}
{
Vector<CSSValueID> backgroundImageKeywords;
backgroundImageKeywords.push_back(CSSValueAuto);
backgroundImageKeywords.push_back(CSSValueNone);
table.set(CSSPropertyBackgroundImage, backgroundImageKeywords);
}
{
Vector<CSSValueID> borderTopWidthKeywords;
borderTopWidthKeywords.push_back(CSSValueThin);
borderTopWidthKeywords.push_back(CSSValueMedium);
borderTopWidthKeywords.push_back(CSSValueThick);
table.set(CSSPropertyBorderTopWidth, borderTopWidthKeywords);
}
{
Vector<CSSValueID> bottomKeywords;
bottomKeywords.push_back(CSSValueAuto);
table.set(CSSPropertyBottom, bottomKeywords);
}
{
Vector<CSSValueID> borderCollapseKeywords;
borderCollapseKeywords.push_back(CSSValueSeparate);
borderCollapseKeywords.push_back(CSSValueCollapse);
table.set(CSSPropertyBorderCollapse, borderCollapseKeywords);
}
{
Vector<CSSValueID> topKeywords;
topKeywords.push_back(CSSValueAuto);
table.set(CSSPropertyTop, topKeywords);
}
{
Vector<CSSValueID> unicodeBidiKeywords;
unicodeBidiKeywords.push_back(CSSValueNormal);
unicodeBidiKeywords.push_back(CSSValueEmbed);
unicodeBidiKeywords.push_back(CSSValueBidiOverride);
unicodeBidiKeywords.push_back(CSSValueIsolate);
unicodeBidiKeywords.push_back(CSSValuePlaintext);
unicodeBidiKeywords.push_back(CSSValueIsolateOverride);
table.set(CSSPropertyUnicodeBidi, unicodeBidiKeywords);
}
{
Vector<CSSValueID> animationIterationCountKeywords;
animationIterationCountKeywords.push_back(CSSValueInfinite);
table.set(CSSPropertyAnimationIterationCount, animationIterationCountKeywords);
}
{
Vector<CSSValueID> floatKeywords;
floatKeywords.push_back(CSSValueNone);
floatKeywords.push_back(CSSValueLeft);
floatKeywords.push_back(CSSValueRight);
table.set(CSSPropertyFloat, floatKeywords);
}
{
Vector<CSSValueID> webkitRtlOrderingKeywords;
webkitRtlOrderingKeywords.push_back(CSSValueLogical);
webkitRtlOrderingKeywords.push_back(CSSValueVisual);
table.set(CSSPropertyWebkitRtlOrdering, webkitRtlOrderingKeywords);
}
{
Vector<CSSValueID> overflowXKeywords;
overflowXKeywords.push_back(CSSValueVisible);
overflowXKeywords.push_back(CSSValueHidden);
overflowXKeywords.push_back(CSSValueScroll);
overflowXKeywords.push_back(CSSValueAuto);
overflowXKeywords.push_back(CSSValueOverlay);
overflowXKeywords.push_back(CSSValueWebkitPagedX);
overflowXKeywords.push_back(CSSValueWebkitPagedY);
table.set(CSSPropertyOverflowX, overflowXKeywords);
}
{
Vector<CSSValueID> overflowYKeywords;
overflowYKeywords.push_back(CSSValueVisible);
overflowYKeywords.push_back(CSSValueHidden);
overflowYKeywords.push_back(CSSValueScroll);
overflowYKeywords.push_back(CSSValueAuto);
overflowYKeywords.push_back(CSSValueOverlay);
overflowYKeywords.push_back(CSSValueWebkitPagedX);
overflowYKeywords.push_back(CSSValueWebkitPagedY);
table.set(CSSPropertyOverflowY, overflowYKeywords);
}
{
Vector<CSSValueID> positionKeywords;
positionKeywords.push_back(CSSValueStatic);
positionKeywords.push_back(CSSValueRelative);
positionKeywords.push_back(CSSValueAbsolute);
positionKeywords.push_back(CSSValueFixed);
positionKeywords.push_back(CSSValueSticky);
table.set(CSSPropertyPosition, positionKeywords);
}
{
Vector<CSSValueID> whiteSpaceKeywords;
whiteSpaceKeywords.push_back(CSSValueNormal);
whiteSpaceKeywords.push_back(CSSValuePre);
whiteSpaceKeywords.push_back(CSSValuePreWrap);
whiteSpaceKeywords.push_back(CSSValuePreLine);
whiteSpaceKeywords.push_back(CSSValueNowrap);
whiteSpaceKeywords.push_back(CSSValueWebkitNowrap);
table.set(CSSPropertyWhiteSpace, whiteSpaceKeywords);
}
{
Vector<CSSValueID> tableLayoutKeywords;
tableLayoutKeywords.push_back(CSSValueAuto);
tableLayoutKeywords.push_back(CSSValueFixed);
table.set(CSSPropertyTableLayout, tableLayoutKeywords);
}
{
Vector<CSSValueID> borderRightStyleKeywords;
borderRightStyleKeywords.push_back(CSSValueNone);
table.set(CSSPropertyBorderRightStyle, borderRightStyleKeywords);
}
{
Vector<CSSValueID> leftKeywords;
leftKeywords.push_back(CSSValueAuto);
table.set(CSSPropertyLeft, leftKeywords);
}
{
Vector<CSSValueID> widthKeywords;
widthKeywords.push_back(CSSValueAuto);
widthKeywords.push_back(CSSValueFitContent);
widthKeywords.push_back(CSSValueMinContent);
widthKeywords.push_back(CSSValueMaxContent);
table.set(CSSPropertyWidth, widthKeywords);
}
{
Vector<CSSValueID> breakInsideKeywords;
breakInsideKeywords.push_back(CSSValueAuto);
breakInsideKeywords.push_back(CSSValueAvoid);
breakInsideKeywords.push_back(CSSValueAvoidColumn);
breakInsideKeywords.push_back(CSSValueAvoidPage);
table.set(CSSPropertyBreakInside, breakInsideKeywords);
}
{
Vector<CSSValueID> overflowAnchorKeywords;
overflowAnchorKeywords.push_back(CSSValueVisible);
overflowAnchorKeywords.push_back(CSSValueNone);
overflowAnchorKeywords.push_back(CSSValueAuto);
table.set(CSSPropertyOverflowAnchor, overflowAnchorKeywords);
}
{
Vector<CSSValueID> listStylePositionKeywords;
listStylePositionKeywords.push_back(CSSValueOutside);
listStylePositionKeywords.push_back(CSSValueInside);
table.set(CSSPropertyListStylePosition, listStylePositionKeywords);
}
{
Vector<CSSValueID> pointerEventsKeywords;
pointerEventsKeywords.push_back(CSSValueNone);
pointerEventsKeywords.push_back(CSSValueAuto);
pointerEventsKeywords.push_back(CSSValueStroke);
pointerEventsKeywords.push_back(CSSValueFill);
pointerEventsKeywords.push_back(CSSValuePainted);
pointerEventsKeywords.push_back(CSSValueVisible);
pointerEventsKeywords.push_back(CSSValueVisibleStroke);
pointerEventsKeywords.push_back(CSSValueVisibleFill);
pointerEventsKeywords.push_back(CSSValueVisiblePainted);
pointerEventsKeywords.push_back(CSSValueBoundingBox);
pointerEventsKeywords.push_back(CSSValueAll);
table.set(CSSPropertyPointerEvents, pointerEventsKeywords);
}
{
Vector<CSSValueID> borderLeftStyleKeywords;
borderLeftStyleKeywords.push_back(CSSValueNone);
table.set(CSSPropertyBorderLeftStyle, borderLeftStyleKeywords);
}
{
Vector<CSSValueID> animationDirectionKeywords;
animationDirectionKeywords.push_back(CSSValueNormal);
animationDirectionKeywords.push_back(CSSValueReverse);
animationDirectionKeywords.push_back(CSSValueAlternate);
animationDirectionKeywords.push_back(CSSValueAlternateReverse);
table.set(CSSPropertyAnimationDirection, animationDirectionKeywords);
}
{
Vector<CSSValueID> textTransformKeywords;
textTransformKeywords.push_back(CSSValueCapitalize);
textTransformKeywords.push_back(CSSValueUppercase);
textTransformKeywords.push_back(CSSValueLowercase);
textTransformKeywords.push_back(CSSValueNone);
table.set(CSSPropertyTextTransform, textTransformKeywords);
}
{
Vector<CSSValueID> rightKeywords;
rightKeywords.push_back(CSSValueAuto);
table.set(CSSPropertyRight, rightKeywords);
}
{
Vector<CSSValueID> directionKeywords;
directionKeywords.push_back(CSSValueLtr);
directionKeywords.push_back(CSSValueRtl);
table.set(CSSPropertyDirection, directionKeywords);
}
{
Vector<CSSValueID> borderStyleKeywords;
borderStyleKeywords.push_back(CSSValueNone);
table.set(CSSPropertyBorderStyle, borderStyleKeywords);
}
{
Vector<CSSValueID> cursorKeywords;
cursorKeywords.push_back(CSSValueAuto);
cursorKeywords.push_back(CSSValueDefault);
cursorKeywords.push_back(CSSValueNone);
cursorKeywords.push_back(CSSValueContextMenu);
cursorKeywords.push_back(CSSValueHelp);
cursorKeywords.push_back(CSSValuePointer);
cursorKeywords.push_back(CSSValueProgress);
cursorKeywords.push_back(CSSValueWait);
cursorKeywords.push_back(CSSValueCell);
cursorKeywords.push_back(CSSValueCrosshair);
cursorKeywords.push_back(CSSValueText);
cursorKeywords.push_back(CSSValueVerticalText);
cursorKeywords.push_back(CSSValueAlias);
cursorKeywords.push_back(CSSValueCopy);
cursorKeywords.push_back(CSSValueMove);
cursorKeywords.push_back(CSSValueNoDrop);
cursorKeywords.push_back(CSSValueNotAllowed);
cursorKeywords.push_back(CSSValueEResize);
cursorKeywords.push_back(CSSValueNResize);
cursorKeywords.push_back(CSSValueNeResize);
cursorKeywords.push_back(CSSValueNwResize);
cursorKeywords.push_back(CSSValueSResize);
cursorKeywords.push_back(CSSValueSeResize);
cursorKeywords.push_back(CSSValueSwResize);
cursorKeywords.push_back(CSSValueWResize);
cursorKeywords.push_back(CSSValueEwResize);
cursorKeywords.push_back(CSSValueNsResize);
cursorKeywords.push_back(CSSValueNeswResize);
cursorKeywords.push_back(CSSValueNwseResize);
cursorKeywords.push_back(CSSValueColResize);
cursorKeywords.push_back(CSSValueRowResize);
cursorKeywords.push_back(CSSValueAllScroll);
cursorKeywords.push_back(CSSValueZoomIn);
cursorKeywords.push_back(CSSValueZoomOut);
cursorKeywords.push_back(CSSValueWebkitGrab);
cursorKeywords.push_back(CSSValueWebkitGrabbing);
table.set(CSSPropertyCursor, cursorKeywords);
}
{
Vector<CSSValueID> borderBottomWidthKeywords;
borderBottomWidthKeywords.push_back(CSSValueThin);
borderBottomWidthKeywords.push_back(CSSValueMedium);
borderBottomWidthKeywords.push_back(CSSValueThick);
table.set(CSSPropertyBorderBottomWidth, borderBottomWidthKeywords);
}
{
Vector<CSSValueID> emptyCellsKeywords;
emptyCellsKeywords.push_back(CSSValueShow);
emptyCellsKeywords.push_back(CSSValueHide);
table.set(CSSPropertyEmptyCells, emptyCellsKeywords);
}
{
Vector<CSSValueID> borderTopStyleKeywords;
borderTopStyleKeywords.push_back(CSSValueNone);
table.set(CSSPropertyBorderTopStyle, borderTopStyleKeywords);
}
{
Vector<CSSValueID> listStyleTypeKeywords;
listStyleTypeKeywords.push_back(CSSValueDisc);
listStyleTypeKeywords.push_back(CSSValueCircle);
listStyleTypeKeywords.push_back(CSSValueSquare);
listStyleTypeKeywords.push_back(CSSValueDecimal);
listStyleTypeKeywords.push_back(CSSValueDecimalLeadingZero);
listStyleTypeKeywords.push_back(CSSValueArabicIndic);
listStyleTypeKeywords.push_back(CSSValueBengali);
listStyleTypeKeywords.push_back(CSSValueCambodian);
listStyleTypeKeywords.push_back(CSSValueKhmer);
listStyleTypeKeywords.push_back(CSSValueDevanagari);
listStyleTypeKeywords.push_back(CSSValueGujarati);
listStyleTypeKeywords.push_back(CSSValueGurmukhi);
listStyleTypeKeywords.push_back(CSSValueKannada);
listStyleTypeKeywords.push_back(CSSValueLao);
listStyleTypeKeywords.push_back(CSSValueMalayalam);
listStyleTypeKeywords.push_back(CSSValueMongolian);
listStyleTypeKeywords.push_back(CSSValueMyanmar);
listStyleTypeKeywords.push_back(CSSValueOriya);
listStyleTypeKeywords.push_back(CSSValuePersian);
listStyleTypeKeywords.push_back(CSSValueUrdu);
listStyleTypeKeywords.push_back(CSSValueTelugu);
listStyleTypeKeywords.push_back(CSSValueTibetan);
listStyleTypeKeywords.push_back(CSSValueThai);
listStyleTypeKeywords.push_back(CSSValueLowerRoman);
listStyleTypeKeywords.push_back(CSSValueUpperRoman);
listStyleTypeKeywords.push_back(CSSValueLowerGreek);
listStyleTypeKeywords.push_back(CSSValueLowerAlpha);
listStyleTypeKeywords.push_back(CSSValueLowerLatin);
listStyleTypeKeywords.push_back(CSSValueUpperAlpha);
listStyleTypeKeywords.push_back(CSSValueUpperLatin);
listStyleTypeKeywords.push_back(CSSValueCjkEarthlyBranch);
listStyleTypeKeywords.push_back(CSSValueCjkHeavenlyStem);
listStyleTypeKeywords.push_back(CSSValueEthiopicHalehame);
listStyleTypeKeywords.push_back(CSSValueEthiopicHalehameAm);
listStyleTypeKeywords.push_back(CSSValueEthiopicHalehameTiEr);
listStyleTypeKeywords.push_back(CSSValueEthiopicHalehameTiEt);
listStyleTypeKeywords.push_back(CSSValueHangul);
listStyleTypeKeywords.push_back(CSSValueHangulConsonant);
listStyleTypeKeywords.push_back(CSSValueKoreanHangulFormal);
listStyleTypeKeywords.push_back(CSSValueKoreanHanjaFormal);
listStyleTypeKeywords.push_back(CSSValueKoreanHanjaInformal);
listStyleTypeKeywords.push_back(CSSValueHebrew);
listStyleTypeKeywords.push_back(CSSValueArmenian);
listStyleTypeKeywords.push_back(CSSValueLowerArmenian);
listStyleTypeKeywords.push_back(CSSValueUpperArmenian);
listStyleTypeKeywords.push_back(CSSValueGeorgian);
listStyleTypeKeywords.push_back(CSSValueCjkIdeographic);
listStyleTypeKeywords.push_back(CSSValueSimpChineseFormal);
listStyleTypeKeywords.push_back(CSSValueSimpChineseInformal);
listStyleTypeKeywords.push_back(CSSValueTradChineseFormal);
listStyleTypeKeywords.push_back(CSSValueTradChineseInformal);
listStyleTypeKeywords.push_back(CSSValueHiragana);
listStyleTypeKeywords.push_back(CSSValueKatakana);
listStyleTypeKeywords.push_back(CSSValueHiraganaIroha);
listStyleTypeKeywords.push_back(CSSValueKatakanaIroha);
listStyleTypeKeywords.push_back(CSSValueNone);
table.set(CSSPropertyListStyleType, listStyleTypeKeywords);
}
{
Vector<CSSValueID> textAlignKeywords;
textAlignKeywords.push_back(CSSValueLeft);
textAlignKeywords.push_back(CSSValueRight);
textAlignKeywords.push_back(CSSValueCenter);
textAlignKeywords.push_back(CSSValueJustify);
textAlignKeywords.push_back(CSSValueWebkitLeft);
textAlignKeywords.push_back(CSSValueWebkitRight);
textAlignKeywords.push_back(CSSValueWebkitCenter);
textAlignKeywords.push_back(CSSValueStart);
textAlignKeywords.push_back(CSSValueEnd);
table.set(CSSPropertyTextAlign, textAlignKeywords);
}
{
Vector<CSSValueID> visibilityKeywords;
visibilityKeywords.push_back(CSSValueVisible);
visibilityKeywords.push_back(CSSValueHidden);
visibilityKeywords.push_back(CSSValueCollapse);
table.set(CSSPropertyVisibility, visibilityKeywords);
}
return table;
}
KeywordTable& keywordTable() {
DEFINE_STATIC_LOCAL(KeywordTable, keywordTable, (createKeywordTable()));
return keywordTable;
}
} // namespace
bool CSSOMKeywords::validKeywordForProperty(CSSPropertyID id,
const CSSKeywordValue& keyword) {
CSSValueID valueID = keyword.keywordValueID();
if (valueID == CSSValueInvalid) {
return false;
}
if (valueID == CSSValueInherit || valueID == CSSValueInitial ||
valueID == CSSValueUnset) {
// These are css-wide keywords that are valid for all properties.
return true;
}
const KeywordTable::iterator tableIterator = keywordTable().find(id);
if (tableIterator == keywordTable().end()) {
return false;
}
return tableIterator->value.contains(valueID);
}
} // namespace blink
// 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 "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 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