Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (221458 => 221459)
--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2017-08-31 23:44:51 UTC (rev 221458)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2017-08-31 23:55:12 UTC (rev 221459)
@@ -74,7 +74,7 @@
} m_inheritedFlags;
struct NonInheritedFlags {
- uint64_t m_flags;
+ uint64_t m_bitfields;
} m_nonInheritedFlags;
#if !ASSERT_DISABLED || ENABLE(SECURITY_ASSERTIONS)
bool deletionCheck;
@@ -81,7 +81,7 @@
#endif
};
-COMPILE_ASSERT(sizeof(RenderStyle) == sizeof(SameSizeAsRenderStyle), RenderStyle_should_stay_small);
+static_assert(sizeof(RenderStyle) == sizeof(SameSizeAsRenderStyle), "RenderStyle should stay small");
RenderStyle& RenderStyle::defaultStyle()
{
@@ -163,6 +163,32 @@
m_inheritedFlags.insideDefaultButton = false;
m_inheritedFlags.writingMode = initialWritingMode();
+ m_nonInheritedFlags.effectiveDisplay = initialDisplay();
+ m_nonInheritedFlags.originalDisplay = initialDisplay();
+ m_nonInheritedFlags.overflowX = initialOverflowX();
+ m_nonInheritedFlags.overflowY = initialOverflowY();
+ m_nonInheritedFlags.verticalAlign = initialVerticalAlign();
+ m_nonInheritedFlags.clear = initialClear();
+ m_nonInheritedFlags.position = initialPosition();
+ m_nonInheritedFlags.unicodeBidi = initialUnicodeBidi();
+ m_nonInheritedFlags.floating = initialFloating();
+ m_nonInheritedFlags.tableLayout = initialTableLayout();
+ m_nonInheritedFlags.hasExplicitlySetDirection = false;
+ m_nonInheritedFlags.hasExplicitlySetWritingMode = false;
+ m_nonInheritedFlags.hasExplicitlySetTextAlign = false;
+ m_nonInheritedFlags.hasViewportUnits = false;
+ m_nonInheritedFlags.hasExplicitlyInheritedProperties = false;
+ m_nonInheritedFlags.isUnique = false;
+ m_nonInheritedFlags.emptyState = false;
+ m_nonInheritedFlags.firstChildState = false;
+ m_nonInheritedFlags.lastChildState = false;
+ m_nonInheritedFlags.affectedByHover = false;
+ m_nonInheritedFlags.affectedByActive = false;
+ m_nonInheritedFlags.affectedByDrag = false;
+ m_nonInheritedFlags.isLink = false;
+ m_nonInheritedFlags.styleType = NOPSEUDO;
+ m_nonInheritedFlags.pseudoBits = NOPSEUDO;
+
static_assert((sizeof(InheritedFlags) <= 8), "InheritedFlags does not grow");
static_assert((sizeof(NonInheritedFlags) <= 8), "NonInheritedFlags does not grow");
}
@@ -417,8 +443,8 @@
hash ^= WTF::FloatHash<float>::hash(m_inheritedData->verticalBorderSpacing);
hash ^= m_inheritedFlags.boxDirection;
hash ^= m_inheritedFlags.rtlOrdering;
- hash ^= m_nonInheritedFlags.position();
- hash ^= m_nonInheritedFlags.floating();
+ hash ^= m_nonInheritedFlags.position;
+ hash ^= m_nonInheritedFlags.floating;
hash ^= m_rareNonInheritedData->textOverflow;
hash ^= m_rareInheritedData->textSecurity;
return hash;
@@ -441,8 +467,8 @@
&& m_inheritedData->verticalBorderSpacing == other.m_inheritedData->verticalBorderSpacing
&& m_inheritedFlags.boxDirection == other.m_inheritedFlags.boxDirection
&& m_inheritedFlags.rtlOrdering == other.m_inheritedFlags.rtlOrdering
- && m_nonInheritedFlags.position() == other.m_nonInheritedFlags.position()
- && m_nonInheritedFlags.floating() == other.m_nonInheritedFlags.floating()
+ && m_nonInheritedFlags.position == other.m_nonInheritedFlags.position
+ && m_nonInheritedFlags.floating == other.m_nonInheritedFlags.floating
&& m_rareNonInheritedData->textOverflow == other.m_rareNonInheritedData->textOverflow;
}
@@ -520,7 +546,7 @@
|| m_boxData->maxHeight() != other.m_boxData->maxHeight())
return true;
- if (m_boxData->verticalAlign() != other.m_boxData->verticalAlign() || m_nonInheritedFlags.verticalAlign() != other.m_nonInheritedFlags.verticalAlign())
+ if (m_boxData->verticalAlign() != other.m_boxData->verticalAlign() || m_nonInheritedFlags.verticalAlign != other.m_nonInheritedFlags.verticalAlign)
return true;
if (m_boxData->boxSizing() != other.m_boxData->boxSizing())
@@ -663,17 +689,17 @@
|| m_inheritedData->verticalBorderSpacing != other.m_inheritedData->verticalBorderSpacing
|| m_inheritedFlags.boxDirection != other.m_inheritedFlags.boxDirection
|| m_inheritedFlags.rtlOrdering != other.m_inheritedFlags.rtlOrdering
- || m_nonInheritedFlags.position() != other.m_nonInheritedFlags.position()
- || m_nonInheritedFlags.floating() != other.m_nonInheritedFlags.floating()
- || m_nonInheritedFlags.originalDisplay() != other.m_nonInheritedFlags.originalDisplay())
+ || m_nonInheritedFlags.position != other.m_nonInheritedFlags.position
+ || m_nonInheritedFlags.floating != other.m_nonInheritedFlags.floating
+ || m_nonInheritedFlags.originalDisplay != other.m_nonInheritedFlags.originalDisplay)
return true;
- if ((m_nonInheritedFlags.effectiveDisplay()) >= TABLE) {
+ if (m_nonInheritedFlags.effectiveDisplay >= TABLE) {
if (m_inheritedFlags.borderCollapse != other.m_inheritedFlags.borderCollapse
|| m_inheritedFlags.emptyCells != other.m_inheritedFlags.emptyCells
|| m_inheritedFlags.captionSide != other.m_inheritedFlags.captionSide
- || m_nonInheritedFlags.tableLayout() != other.m_nonInheritedFlags.tableLayout())
+ || m_nonInheritedFlags.tableLayout != other.m_nonInheritedFlags.tableLayout)
return true;
// In the collapsing border model, 'hidden' suppresses other borders, while 'none'
@@ -690,7 +716,7 @@
return true;
}
- if (m_nonInheritedFlags.effectiveDisplay() == LIST_ITEM) {
+ if (m_nonInheritedFlags.effectiveDisplay == LIST_ITEM) {
if (m_inheritedFlags.listStyleType != other.m_inheritedFlags.listStyleType
|| m_inheritedFlags.listStylePosition != other.m_inheritedFlags.listStylePosition)
return true;
@@ -700,8 +726,8 @@
|| m_inheritedFlags.textTransform != other.m_inheritedFlags.textTransform
|| m_inheritedFlags.direction != other.m_inheritedFlags.direction
|| m_inheritedFlags.whiteSpace != other.m_inheritedFlags.whiteSpace
- || m_nonInheritedFlags.clear() != other.m_nonInheritedFlags.clear()
- || m_nonInheritedFlags.unicodeBidi() != other.m_nonInheritedFlags.unicodeBidi())
+ || m_nonInheritedFlags.clear != other.m_nonInheritedFlags.clear
+ || m_nonInheritedFlags.unicodeBidi != other.m_nonInheritedFlags.unicodeBidi)
return true;
// Check block flow direction.
@@ -719,8 +745,8 @@
return true;
// Overflow returns a layout hint.
- if (m_nonInheritedFlags.overflowX() != other.m_nonInheritedFlags.overflowX()
- || m_nonInheritedFlags.overflowY() != other.m_nonInheritedFlags.overflowY())
+ if (m_nonInheritedFlags.overflowX != other.m_nonInheritedFlags.overflowX
+ || m_nonInheritedFlags.overflowY != other.m_nonInheritedFlags.overflowY)
return true;
// If our border widths change, then we need to layout. Other changes to borders
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (221458 => 221459)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2017-08-31 23:44:51 UTC (rev 221458)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2017-08-31 23:55:12 UTC (rev 221459)
@@ -169,8 +169,8 @@
StyleSelfAlignmentData resolvedJustifyItems(ItemPosition normalValueBehaviour) const;
StyleSelfAlignmentData resolvedJustifySelf(const RenderStyle* parentStyle, ItemPosition normalValueBehaviour) const;
- PseudoId styleType() const { return m_nonInheritedFlags.styleType(); }
- void setStyleType(PseudoId styleType) { m_nonInheritedFlags.setStyleType(styleType); }
+ PseudoId styleType() const { return static_cast<PseudoId>(m_nonInheritedFlags.styleType); }
+ void setStyleType(PseudoId styleType) { m_nonInheritedFlags.styleType = styleType; }
RenderStyle* getCachedPseudoStyle(PseudoId) const;
RenderStyle* addCachedPseudoStyle(std::unique_ptr<RenderStyle>);
@@ -181,20 +181,20 @@
const CustomPropertyValueMap& customProperties() const { return m_rareInheritedData->customProperties->values; }
void setCustomPropertyValue(const AtomicString& name, Ref<CSSCustomPropertyValue>&& value) { return m_rareInheritedData.access().customProperties.access().setCustomPropertyValue(name, WTFMove(value)); }
- void setHasViewportUnits(bool hasViewportUnits = true) { m_nonInheritedFlags.setHasViewportUnits(hasViewportUnits); }
- bool hasViewportUnits() const { return m_nonInheritedFlags.hasViewportUnits(); }
+ void setHasViewportUnits(bool v = true) { m_nonInheritedFlags.hasViewportUnits = v; }
+ bool hasViewportUnits() const { return m_nonInheritedFlags.hasViewportUnits; }
- bool affectedByHover() const { return m_nonInheritedFlags.affectedByHover(); }
- bool affectedByActive() const { return m_nonInheritedFlags.affectedByActive(); }
- bool affectedByDrag() const { return m_nonInheritedFlags.affectedByDrag(); }
+ bool affectedByHover() const { return m_nonInheritedFlags.affectedByHover; }
+ bool affectedByActive() const { return m_nonInheritedFlags.affectedByActive; }
+ bool affectedByDrag() const { return m_nonInheritedFlags.affectedByDrag; }
- void setAffectedByHover() { m_nonInheritedFlags.setAffectedByHover(true); }
- void setAffectedByActive() { m_nonInheritedFlags.setAffectedByActive(true); }
- void setAffectedByDrag() { m_nonInheritedFlags.setAffectedByDrag(true); }
+ void setAffectedByHover() { m_nonInheritedFlags.affectedByHover = true; }
+ void setAffectedByActive() { m_nonInheritedFlags.affectedByActive = true; }
+ void setAffectedByDrag() { m_nonInheritedFlags.affectedByDrag = true; }
void setColumnStylesFromPaginationMode(const Pagination::Mode&);
- bool isFloating() const { return m_nonInheritedFlags.isFloating(); }
+ bool isFloating() const { return m_nonInheritedFlags.floating != NoFloat; }
bool hasMargin() const { return !m_surroundData->margin.isZero(); }
bool hasBorder() const { return m_surroundData->border.hasBorder(); }
bool hasBorderFill() const { return m_surroundData->border.hasFill(); }
@@ -236,7 +236,7 @@
// attribute getter methods
- EDisplay display() const { return m_nonInheritedFlags.effectiveDisplay(); }
+ EDisplay display() const { return static_cast<EDisplay>(m_nonInheritedFlags.effectiveDisplay); }
const Length& left() const { return m_surroundData->offset.left(); }
const Length& right() const { return m_surroundData->offset.right(); }
@@ -253,11 +253,11 @@
bool hasStaticInlinePosition(bool horizontal) const { return horizontal ? hasAutoLeftAndRight() : hasAutoTopAndBottom(); }
bool hasStaticBlockPosition(bool horizontal) const { return horizontal ? hasAutoTopAndBottom() : hasAutoLeftAndRight(); }
- EPosition position() const { return m_nonInheritedFlags.position(); }
+ EPosition position() const { return static_cast<EPosition>(m_nonInheritedFlags.position); }
bool hasOutOfFlowPosition() const { return position() == AbsolutePosition || position() == FixedPosition; }
bool hasInFlowPosition() const { return position() == RelativePosition || position() == StickyPosition; }
bool hasViewportConstrainedPosition() const { return position() == FixedPosition || position() == StickyPosition; }
- EFloat floating() const { return m_nonInheritedFlags.floating(); }
+ EFloat floating() const { return static_cast<EFloat>(m_nonInheritedFlags.floating); }
const Length& width() const { return m_boxData->width(); }
const Length& height() const { return m_boxData->height(); }
@@ -322,13 +322,13 @@
OutlineIsAuto outlineStyleIsAuto() const { return static_cast<OutlineIsAuto>(m_backgroundData->outline.isAuto()); }
bool hasOutlineInVisualOverflow() const { return hasOutline() && outlineSize() > 0; }
- EOverflow overflowX() const { return m_nonInheritedFlags.overflowX(); }
- EOverflow overflowY() const { return m_nonInheritedFlags.overflowY(); }
+ EOverflow overflowX() const { return static_cast<EOverflow>(m_nonInheritedFlags.overflowX); }
+ EOverflow overflowY() const { return static_cast<EOverflow>(m_nonInheritedFlags.overflowY); }
EOverflow overflowInlineDirection() const { return isHorizontalWritingMode() ? overflowX() : overflowY(); }
EOverflow overflowBlockDirection() const { return isHorizontalWritingMode() ? overflowY() : overflowX(); }
EVisibility visibility() const { return static_cast<EVisibility>(m_inheritedFlags.visibility); }
- EVerticalAlign verticalAlign() const { return m_nonInheritedFlags.verticalAlign(); }
+ EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(m_nonInheritedFlags.verticalAlign); }
const Length& verticalAlignLength() const { return m_boxData->verticalAlign(); }
const Length& clipLeft() const { return m_visualData->clip.left(); }
@@ -338,10 +338,10 @@
const LengthBox& clip() const { return m_visualData->clip; }
bool hasClip() const { return m_visualData->hasClip; }
- EUnicodeBidi unicodeBidi() const { return m_nonInheritedFlags.unicodeBidi(); }
+ EUnicodeBidi unicodeBidi() const { return static_cast<EUnicodeBidi>(m_nonInheritedFlags.unicodeBidi); }
- EClear clear() const { return m_nonInheritedFlags.clear(); }
- ETableLayout tableLayout() const { return m_nonInheritedFlags.tableLayout(); }
+ EClear clear() const { return static_cast<EClear>(m_nonInheritedFlags.clear); }
+ ETableLayout tableLayout() const { return static_cast<ETableLayout>(m_nonInheritedFlags.tableLayout); }
WEBCORE_EXPORT const FontCascade& fontCascade() const;
WEBCORE_EXPORT const FontMetrics& fontMetrics() const;
@@ -384,7 +384,7 @@
TextDirection direction() const { return static_cast<TextDirection>(m_inheritedFlags.direction); }
bool isLeftToRightDirection() const { return direction() == LTR; }
- bool hasExplicitlySetDirection() const { return m_nonInheritedFlags.hasExplicitlySetDirection(); }
+ bool hasExplicitlySetDirection() const { return m_nonInheritedFlags.hasExplicitlySetDirection; }
const Length& specifiedLineHeight() const;
WEBCORE_EXPORT const Length& lineHeight() const;
@@ -471,7 +471,7 @@
CursorList* cursors() const { return m_rareInheritedData->cursorData.get(); }
EInsideLink insideLink() const { return static_cast<EInsideLink>(m_inheritedFlags.insideLink); }
- bool isLink() const { return m_nonInheritedFlags.isLink(); }
+ bool isLink() const { return m_nonInheritedFlags.isLink; }
bool insideDefaultButton() const { return m_inheritedFlags.insideDefaultButton; }
@@ -794,10 +794,10 @@
// attribute setter methods
- void setDisplay(EDisplay v) { m_nonInheritedFlags.setEffectiveDisplay(v); }
- void setOriginalDisplay(EDisplay v) { m_nonInheritedFlags.setOriginalDisplay(v); }
- void setPosition(EPosition v) { m_nonInheritedFlags.setPosition(v); }
- void setFloating(EFloat v) { m_nonInheritedFlags.setFloating(v); }
+ void setDisplay(EDisplay v) { m_nonInheritedFlags.effectiveDisplay = v; }
+ void setOriginalDisplay(EDisplay v) { m_nonInheritedFlags.originalDisplay = v; }
+ void setPosition(EPosition v) { m_nonInheritedFlags.position = v; }
+ void setFloating(EFloat v) { m_nonInheritedFlags.floating = v; }
void setLeft(Length&& length) { SET_VAR(m_surroundData, offset.left(), WTFMove(length)); }
void setRight(Length&& length) { SET_VAR(m_surroundData, offset.right(), WTFMove(length)); }
@@ -878,10 +878,10 @@
void setOutlineStyle(EBorderStyle v) { SET_VAR(m_backgroundData, outline.m_style, v); }
void setOutlineColor(const Color& v) { SET_BORDERVALUE_COLOR(m_backgroundData, outline, v); }
- void setOverflowX(EOverflow v) { m_nonInheritedFlags.setOverflowX(v); }
- void setOverflowY(EOverflow v) { m_nonInheritedFlags.setOverflowY(v); }
+ void setOverflowX(EOverflow v) { m_nonInheritedFlags.overflowX = v; }
+ void setOverflowY(EOverflow v) { m_nonInheritedFlags.overflowY = v; }
void setVisibility(EVisibility v) { m_inheritedFlags.visibility = v; }
- void setVerticalAlign(EVerticalAlign v) { m_nonInheritedFlags.setVerticalAlign(v); }
+ void setVerticalAlign(EVerticalAlign v) { m_nonInheritedFlags.verticalAlign = v; }
void setVerticalAlignLength(Length&& length) { setVerticalAlign(LENGTH); SET_VAR(m_boxData, m_verticalAlign, WTFMove(length)); }
void setHasClip(bool b = true) { SET_VAR(m_visualData, hasClip, b); }
@@ -892,10 +892,10 @@
void setClip(Length&& top, Length&& right, Length&& bottom, Length&& left);
void setClip(LengthBox&& box) { SET_VAR(m_visualData, clip, WTFMove(box)); }
- void setUnicodeBidi(EUnicodeBidi b) { m_nonInheritedFlags.setUnicodeBidi(b); }
+ void setUnicodeBidi(EUnicodeBidi v) { m_nonInheritedFlags.unicodeBidi = v; }
- void setClear(EClear v) { m_nonInheritedFlags.setClear(v); }
- void setTableLayout(ETableLayout v) { m_nonInheritedFlags.setTableLayout(v); }
+ void setClear(EClear v) { m_nonInheritedFlags.clear = v; }
+ void setTableLayout(ETableLayout v) { m_nonInheritedFlags.tableLayout = v; }
bool setFontDescription(const FontCascadeDescription&);
@@ -920,7 +920,7 @@
void setTextDecorationSkip(TextDecorationSkip skip) { SET_VAR(m_rareInheritedData, textDecorationSkip, skip); }
void setTextUnderlinePosition(TextUnderlinePosition v) { SET_VAR(m_rareInheritedData, textUnderlinePosition, v); }
void setDirection(TextDirection v) { m_inheritedFlags.direction = v; }
- void setHasExplicitlySetDirection(bool v) { m_nonInheritedFlags.setHasExplicitlySetDirection(v); }
+ void setHasExplicitlySetDirection(bool v) { m_nonInheritedFlags.hasExplicitlySetDirection = v; }
void setLineHeight(Length&&);
bool setZoom(float);
void setZoomWithoutReturnValue(float f) { setZoom(f); }
@@ -1012,7 +1012,7 @@
#endif
void setInsideLink(EInsideLink insideLink) { m_inheritedFlags.insideLink = insideLink; }
- void setIsLink(bool b) { m_nonInheritedFlags.setIsLink(b); }
+ void setIsLink(bool v) { m_nonInheritedFlags.isLink = v; }
void setInsideDefaultButton(bool insideDefaultButton) { m_inheritedFlags.insideDefaultButton = insideDefaultButton; }
@@ -1398,28 +1398,28 @@
bool setWritingMode(WritingMode);
- bool hasExplicitlySetWritingMode() const { return m_nonInheritedFlags.hasExplicitlySetWritingMode(); }
- void setHasExplicitlySetWritingMode(bool v) { m_nonInheritedFlags.setHasExplicitlySetWritingMode(v); }
+ bool hasExplicitlySetWritingMode() const { return m_nonInheritedFlags.hasExplicitlySetWritingMode; }
+ void setHasExplicitlySetWritingMode(bool v) { m_nonInheritedFlags.hasExplicitlySetWritingMode = v; }
- bool hasExplicitlySetTextAlign() const { return m_nonInheritedFlags.hasExplicitlySetTextAlign(); }
- void setHasExplicitlySetTextAlign(bool value) { m_nonInheritedFlags.setHasExplicitlySetTextAlign(value); }
+ bool hasExplicitlySetTextAlign() const { return m_nonInheritedFlags.hasExplicitlySetTextAlign; }
+ void setHasExplicitlySetTextAlign(bool v) { m_nonInheritedFlags.hasExplicitlySetTextAlign = v; }
// A unique style is one that has matches something that makes it impossible to share.
- bool unique() const { return m_nonInheritedFlags.isUnique(); }
- void setUnique() { m_nonInheritedFlags.setIsUnique(); }
+ bool unique() const { return m_nonInheritedFlags.isUnique; }
+ void setUnique() { m_nonInheritedFlags.isUnique = true; }
- bool emptyState() const { return m_nonInheritedFlags.emptyState(); }
- void setEmptyState(bool b) { setUnique(); m_nonInheritedFlags.setEmptyState(b); }
- bool firstChildState() const { return m_nonInheritedFlags.firstChildState(); }
- void setFirstChildState() { setUnique(); m_nonInheritedFlags.setFirstChildState(true); }
- bool lastChildState() const { return m_nonInheritedFlags.lastChildState(); }
- void setLastChildState() { setUnique(); m_nonInheritedFlags.setLastChildState(true); }
+ bool emptyState() const { return m_nonInheritedFlags.emptyState; }
+ void setEmptyState(bool v) { setUnique(); m_nonInheritedFlags.emptyState = v; }
+ bool firstChildState() const { return m_nonInheritedFlags.firstChildState; }
+ void setFirstChildState() { setUnique(); m_nonInheritedFlags.firstChildState = true; }
+ bool lastChildState() const { return m_nonInheritedFlags.lastChildState; }
+ void setLastChildState() { setUnique(); m_nonInheritedFlags.lastChildState = true; }
WEBCORE_EXPORT Color visitedDependentColor(int colorProperty) const;
bool backgroundColorEqualsToColorIgnoringVisited(const Color& color) const { return color == backgroundColor(); }
- void setHasExplicitlyInheritedProperties() { m_nonInheritedFlags.setHasExplicitlyInheritedProperties(true); }
- bool hasExplicitlyInheritedProperties() const { return m_nonInheritedFlags.hasExplicitlyInheritedProperties(); }
+ void setHasExplicitlyInheritedProperties() { m_nonInheritedFlags.hasExplicitlyInheritedProperties = true; }
+ bool hasExplicitlyInheritedProperties() const { return m_nonInheritedFlags.hasExplicitlyInheritedProperties; }
// Initial values for all the properties
static EOverflow initialOverflowX() { return OVISIBLE; }
@@ -1698,7 +1698,7 @@
void setVisitedLinkTextStrokeColor(const Color& v) { SET_VAR(m_rareInheritedData, visitedLinkTextStrokeColor, v); }
void setVisitedLinkCaretColor(const Color& v) { SET_VAR(m_rareInheritedData, visitedLinkCaretColor, v); }
- void inheritUnicodeBidiFrom(const RenderStyle* parent) { m_nonInheritedFlags.setUnicodeBidi(parent->m_nonInheritedFlags.unicodeBidi()); }
+ void inheritUnicodeBidiFrom(const RenderStyle* parent) { m_nonInheritedFlags.unicodeBidi = parent->m_nonInheritedFlags.unicodeBidi; }
void getShadowExtent(const ShadowData*, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const;
void getShadowHorizontalExtent(const ShadowData*, LayoutUnit& left, LayoutUnit& right) const;
void getShadowVerticalExtent(const ShadowData*, LayoutUnit& top, LayoutUnit& bottom) const;
@@ -1739,186 +1739,45 @@
private:
struct NonInheritedFlags {
- NonInheritedFlags();
+ bool operator==(const NonInheritedFlags&) const;
+ bool operator!=(const NonInheritedFlags& other) const { return !(*this == other); }
- bool operator==(const NonInheritedFlags& other) const { return m_flags == other.m_flags; }
- bool operator!=(const NonInheritedFlags& other) const { return m_flags != other.m_flags; }
-
void copyNonInheritedFrom(const NonInheritedFlags&);
- EOverflow overflowX() const { return static_cast<EOverflow>(getValue(overflowMask, overflowXOffset)); }
- void setOverflowX(EOverflow overflowX) { updateValue(overflowX, overflowMask, overflowXOffset); }
-
- EOverflow overflowY() const { return static_cast<EOverflow>(getValue(overflowMask, overflowYOffset)); }
- void setOverflowY(EOverflow overflowY) { updateValue(overflowY, overflowMask, overflowYOffset); }
-
- EClear clear() const { return static_cast<EClear>(getValue(clearMask, clearOffset)); }
- void setClear(EClear clear) { updateValue(clear, clearMask, clearOffset); }
-
- EDisplay effectiveDisplay() const { return static_cast<EDisplay>(getValue(displayMask, effectiveDisplayOffset)); }
- void setEffectiveDisplay(EDisplay effectiveDisplay) { updateValue(effectiveDisplay, displayMask, effectiveDisplayOffset); }
-
- EPosition position() const { return static_cast<EPosition>(getValue(positionMask, positionOffset)); }
- void setPosition(EPosition position) { updateValue(position, positionMask, positionOffset); }
-
- EDisplay originalDisplay() const { return static_cast<EDisplay>(getValue(displayMask, originalDisplayOffset)); }
- void setOriginalDisplay(EDisplay originalDisplay) { updateValue(originalDisplay, displayMask, originalDisplayOffset); }
-
- EUnicodeBidi unicodeBidi() const { return static_cast<EUnicodeBidi>(getValue(unicodeBidiMask, unicodeBidiOffset)); }
- void setUnicodeBidi(EUnicodeBidi unicodeBidi) { updateValue(unicodeBidi, unicodeBidiMask, unicodeBidiOffset); }
-
- bool hasViewportUnits() const { return getBoolean(hasViewportUnitsOffset); }
- void setHasViewportUnits(bool value) { updateBoolean(value, hasViewportUnitsOffset); }
-
- EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(getValue(verticalAlignMask, verticalAlignOffset)); }
- void setVerticalAlign(EVerticalAlign verticalAlign) { updateValue(verticalAlign, verticalAlignMask, verticalAlignOffset); }
-
- bool hasExplicitlyInheritedProperties() const { return getBoolean(explicitInheritanceOffset); }
- void setHasExplicitlyInheritedProperties(bool value) { updateBoolean(value, explicitInheritanceOffset); }
-
- bool isFloating() const { return floating() != NoFloat; }
- EFloat floating() const { return static_cast<EFloat>(getValue(floatingMask, floatingOffset)); }
- void setFloating(EFloat floating) { updateValue(floating, floatingMask, floatingOffset); }
-
- bool hasAnyPublicPseudoStyles() const { return PUBLIC_PSEUDOID_MASK & getValue(pseudoBitsMask, pseudoBitsOffset); }
+ bool hasAnyPublicPseudoStyles() const { return PUBLIC_PSEUDOID_MASK & pseudoBits; }
bool hasPseudoStyle(PseudoId) const;
void setHasPseudoStyle(PseudoId);
void setHasPseudoStyles(PseudoIdSet);
- ETableLayout tableLayout() const { return static_cast<ETableLayout>(getValue(tableLayoutBitMask, tableLayoutOffset)); }
- void setTableLayout(ETableLayout tableLayout) { updateValue(tableLayout, tableLayoutBitMask, tableLayoutOffset); }
+ unsigned effectiveDisplay : 5; // EDisplay
+ unsigned originalDisplay : 5; // EDisplay
+ unsigned overflowX : 3; // EOverflow
+ unsigned overflowY : 3; // EOverflow
+ unsigned verticalAlign : 4; // EVerticalAlign
+ unsigned clear : 2; // EClear
+ unsigned position : 3; // EPosition
+ unsigned unicodeBidi : 3; // EUnicodeBidi
+ unsigned floating : 2; // EFloat
+ unsigned tableLayout : 1; // ETableLayout
- PseudoId styleType() const { return static_cast<PseudoId>(getValue(styleTypeMask, styleTypeOffset)); }
- void setStyleType(PseudoId styleType) { updateValue(styleType, styleTypeMask, styleTypeOffset); }
+ unsigned hasExplicitlySetDirection : 1;
+ unsigned hasExplicitlySetWritingMode : 1;
+ unsigned hasExplicitlySetTextAlign : 1;
+ unsigned hasViewportUnits : 1;
+ unsigned hasExplicitlyInheritedProperties : 1; // Explicitly inherits a non-inherited property.
+ unsigned isUnique : 1; // Style cannot be shared.
+ unsigned emptyState : 1;
+ unsigned firstChildState : 1;
+ unsigned lastChildState : 1;
+ unsigned affectedByHover : 1;
+ unsigned affectedByActive : 1;
+ unsigned affectedByDrag : 1;
+ unsigned isLink : 1;
- bool isUnique() const { return getBoolean(isUniqueOffset); }
- void setIsUnique() { updateBoolean(true, isUniqueOffset); }
+ unsigned styleType : 4; // PseudoId
+ unsigned pseudoBits : (FIRST_INTERNAL_PSEUDOID - FIRST_PUBLIC_PSEUDOID);
- bool emptyState() const { return getBoolean(emptyStateOffset); }
- void setEmptyState(bool value) { updateBoolean(value, emptyStateOffset); }
-
- bool firstChildState() const { return getBoolean(firstChildStateOffset); }
- void setFirstChildState(bool value) { updateBoolean(value, firstChildStateOffset); }
-
- bool lastChildState() const { return getBoolean(lastChildStateOffset); }
- void setLastChildState(bool value) { updateBoolean(value, lastChildStateOffset); }
-
- bool affectedByHover() const { return getBoolean(affectedByHoverOffset); }
- void setAffectedByHover(bool value) { updateBoolean(value, affectedByHoverOffset); }
-
- bool affectedByActive() const { return getBoolean(affectedByActiveOffset); }
- void setAffectedByActive(bool value) { updateBoolean(value, affectedByActiveOffset); }
-
- bool affectedByDrag() const { return getBoolean(affectedByDragOffset); }
- void setAffectedByDrag(bool value) { updateBoolean(value, affectedByDragOffset); }
-
- bool isLink() const { return getBoolean(isLinkOffset); }
- void setIsLink(bool value) { updateBoolean(value, isLinkOffset); }
-
- bool hasExplicitlySetDirection() const { return getBoolean(hasExplicitlySetDirectionOffset); }
- void setHasExplicitlySetDirection(bool value) { updateBoolean(value, hasExplicitlySetDirectionOffset); }
-
- bool hasExplicitlySetWritingMode() const { return getBoolean(hasExplicitlySetWritingModeOffset); }
- void setHasExplicitlySetWritingMode(bool value) { updateBoolean(value, hasExplicitlySetWritingModeOffset); }
-
- bool hasExplicitlySetTextAlign() const { return getBoolean(hasExplicitlySetTextAlignOffset); }
- void setHasExplicitlySetTextAlign(bool value) { updateBoolean(value, hasExplicitlySetTextAlignOffset); }
-
- static ptrdiff_t flagsMemoryOffset() { return OBJECT_OFFSETOF(NonInheritedFlags, m_flags); }
- static uint64_t flagIsaffectedByActive() { return oneBitMask << affectedByActiveOffset; }
- static uint64_t flagIsaffectedByHover() { return oneBitMask << affectedByHoverOffset; }
- static uint64_t flagPseudoStyle(PseudoId pseudo) { return oneBitMask << (pseudoBitsOffset - 1 + pseudo); }
- static uint64_t setFirstChildStateFlags() { return flagFirstChildState() | flagIsUnique(); }
- static uint64_t setLastChildStateFlags() { return flagLastChildState() | flagIsUnique(); }
-
- private:
- void updateBoolean(bool, uint64_t offset);
- bool getBoolean(uint64_t offset) const;
- void updateValue(uint8_t newValue, uint64_t positionIndependentMask, uint64_t offset);
- unsigned getValue(uint64_t positionIndependentMask, uint64_t offset) const;
-
- static uint64_t flagIsUnique() { return oneBitMask << isUniqueOffset; }
- static uint64_t flagFirstChildState() { return oneBitMask << firstChildStateOffset; }
- static uint64_t flagLastChildState() { return oneBitMask << lastChildStateOffset; }
-
- // To type the bit mask properly on 64bits.
- static const uint64_t _oneBitMask_ = 0x1;
-
- // Byte 1.
- static const unsigned overflowBitCount = 3;
- static const uint64_t overflowMask = (oneBitMask << overflowBitCount) - 1;
- static const unsigned overflowXOffset = 0;
- static const unsigned overflowYOffset = overflowXOffset + overflowBitCount;
- static const unsigned clearBitCount = 2;
- static const uint64_t clearMask = (oneBitMask << clearBitCount) - 1;
- static const unsigned clearOffset = overflowYOffset + overflowBitCount;
-
- // Byte 2.
- static const unsigned displayBitCount = 5;
- static const uint64_t displayMask = (oneBitMask << displayBitCount) - 1;
- static const unsigned effectiveDisplayOffset = clearOffset + clearBitCount;
- static const unsigned positionBitCount = 3;
- static const uint64_t positionMask = (oneBitMask << positionBitCount) - 1;
- static const unsigned positionOffset = effectiveDisplayOffset + displayBitCount;
-
- // Byte 3.
- static const unsigned originalDisplayOffset = positionOffset + positionBitCount;
- static const unsigned unicodeBidiBitCount = 3;
- static const uint64_t unicodeBidiMask = (oneBitMask << unicodeBidiBitCount) - 1;
- static const unsigned unicodeBidiOffset = originalDisplayOffset + displayBitCount;
-
- // Byte 4.
- static const unsigned floatingBitCount = 2;
- static const uint64_t floatingMask = (oneBitMask << floatingBitCount) - 1;
- static const unsigned floatingOffset = unicodeBidiOffset + unicodeBidiBitCount;
- static const unsigned hasExplicitlySetDirectionBitcount = 1;
- static const unsigned hasExplicitlySetDirectionOffset = floatingOffset + floatingBitCount;
- static const unsigned hasExplicitlySetWritingModeBitcount = 1;
- static const unsigned hasExplicitlySetWritingModeOffset = hasExplicitlySetDirectionOffset + hasExplicitlySetDirectionBitcount;
-
- // Byte 5.
- static const unsigned explicitInheritanceBitCount = 1;
- static const unsigned explicitInheritanceOffset = hasExplicitlySetWritingModeOffset + hasExplicitlySetWritingModeBitcount;
- static const unsigned tableLayoutBitCount = 1;
- static const uint64_t tableLayoutBitMask = oneBitMask;
- static const unsigned tableLayoutOffset = explicitInheritanceOffset + explicitInheritanceBitCount;
- static const unsigned verticalAlignBitCount = 4;
- static const unsigned verticalAlignPadding = 2;
- static const unsigned verticalAlignAndPaddingBitCount = verticalAlignBitCount + verticalAlignPadding;
- static const uint64_t verticalAlignMask = (oneBitMask << verticalAlignBitCount) - 1;
- static const unsigned verticalAlignOffset = tableLayoutOffset + tableLayoutBitCount;
-
- // Byte 6.
- static const unsigned pseudoBitsBitCount = 7;
- static const uint64_t pseudoBitsMask = (oneBitMask << pseudoBitsBitCount) - 1;
- static const unsigned pseudoBitsOffset = verticalAlignOffset + verticalAlignBitCount;
-
- static const unsigned hasViewportUnitsBitCount = 1;
- static const uint64_t hasViewportUnitsBitMask = (oneBitMask << hasViewportUnitsBitCount) - 1;
- static const unsigned hasViewportUnitsOffset = pseudoBitsOffset + pseudoBitsBitCount;
-
- // Byte 7.
- static const unsigned hasExplicitlySetTextAlignBitCount = 1;
- static const unsigned hasExplicitlySetTextAlignOffset = hasViewportUnitsOffset + hasViewportUnitsBitCount;
- static const unsigned styleTypeBitCount = 6;
- static const unsigned styleTypePadding = 1;
- static const unsigned styleTypeAndPaddingBitCount = styleTypeBitCount + styleTypePadding;
- static const uint64_t styleTypeMask = (oneBitMask << styleTypeAndPaddingBitCount) - 1;
- static const unsigned styleTypeOffset = hasExplicitlySetTextAlignOffset + hasExplicitlySetTextAlignBitCount;
-
- // Byte 8.
- static const unsigned isUniqueOffset = styleTypeOffset + styleTypeAndPaddingBitCount;
- static const unsigned emptyStateOffset = isUniqueOffset + 1;
- static const unsigned firstChildStateOffset = emptyStateOffset + 1;
- static const unsigned lastChildStateOffset = firstChildStateOffset + 1;
- static const unsigned affectedByHoverOffset = lastChildStateOffset + 1;
- static const unsigned affectedByActiveOffset = affectedByHoverOffset + 1;
- static const unsigned affectedByDragOffset = affectedByActiveOffset + 1;
- static const unsigned isLinkOffset = affectedByDragOffset + 1;
-
- // 60 bits are assigned. There are 4 bits available currently used as padding to improve code generation.
- // If you add more style bits here, you will also need to update RenderStyle::copyNonInheritedFrom().
- uint64_t m_flags { 0 };
+ // If you add more style bits here, you will also need to update RenderStyle::NonInheritedFlags::copyNonInheritedFrom().
};
struct InheritedFlags {
@@ -1959,7 +1818,7 @@
// This constructor is used to implement the replace operation.
RenderStyle(RenderStyle&, RenderStyle&&);
- EDisplay originalDisplay() const { return m_nonInheritedFlags.originalDisplay(); }
+ EDisplay originalDisplay() const { return static_cast<EDisplay>(m_nonInheritedFlags.originalDisplay); }
bool hasAutoLeftAndRight() const { return left().isAuto() && right().isAuto(); }
bool hasAutoTopAndBottom() const { return top().isAuto() && bottom().isAuto(); }
@@ -2015,37 +1874,50 @@
bool pseudoElementRendererIsNeeded(const RenderStyle*);
-inline RenderStyle::NonInheritedFlags::NonInheritedFlags()
+inline bool RenderStyle::NonInheritedFlags::operator==(const NonInheritedFlags& other) const
{
- // All these initial values need to be zero so that zero-initializing m_flags is correct.
- ASSERT(!initialOverflowX());
- ASSERT(!initialOverflowY());
- ASSERT(!initialClear());
- ASSERT(!initialDisplay());
- ASSERT(!initialUnicodeBidi());
- ASSERT(!initialPosition());
- ASSERT(!initialVerticalAlign());
- ASSERT(!initialFloating());
- ASSERT(!initialTableLayout());
+ return effectiveDisplay == other.effectiveDisplay
+ && originalDisplay == other.originalDisplay
+ && overflowX == other.overflowX
+ && overflowY == other.overflowY
+ && verticalAlign == other.verticalAlign
+ && clear == other.clear
+ && position == other.position
+ && unicodeBidi == other.unicodeBidi
+ && floating == other.floating
+ && tableLayout == other.tableLayout
+ && hasExplicitlySetDirection == other.hasExplicitlySetDirection
+ && hasExplicitlySetWritingMode == other.hasExplicitlySetWritingMode
+ && hasExplicitlySetTextAlign == other.hasExplicitlySetTextAlign
+ && hasViewportUnits == other.hasViewportUnits
+ && hasExplicitlyInheritedProperties == other.hasExplicitlyInheritedProperties
+ && isUnique == other.isUnique
+ && emptyState == other.emptyState
+ && firstChildState == other.firstChildState
+ && lastChildState == other.lastChildState
+ && affectedByHover == other.affectedByHover
+ && affectedByActive == other.affectedByActive
+ && affectedByDrag == other.affectedByDrag
+ && isLink == other.isLink
+ && styleType == other.styleType
+ && pseudoBits == other.pseudoBits;
}
inline void RenderStyle::NonInheritedFlags::copyNonInheritedFrom(const NonInheritedFlags& other)
{
// Only a subset is copied because NonInheritedFlags contains a bunch of stuff other than real style data.
- uint64_t nonInheritedMask = overflowMask << overflowXOffset
- | overflowMask << overflowYOffset
- | clearMask << clearOffset
- | displayMask << effectiveDisplayOffset
- | positionMask << positionOffset
- | displayMask << originalDisplayOffset
- | unicodeBidiMask << unicodeBidiOffset
- | verticalAlignMask << verticalAlignOffset
- | floatingMask << floatingOffset
- | oneBitMask << explicitInheritanceOffset
- | tableLayoutBitMask << tableLayoutOffset
- | hasViewportUnitsBitMask << hasViewportUnitsOffset;
-
- m_flags = (m_flags & ~nonInheritedMask) | (other.m_flags & nonInheritedMask);
+ effectiveDisplay = other.effectiveDisplay;
+ originalDisplay = other.originalDisplay;
+ overflowX = other.overflowX;
+ overflowY = other.overflowY;
+ verticalAlign = other.verticalAlign;
+ clear = other.clear;
+ position = other.position;
+ unicodeBidi = other.unicodeBidi;
+ floating = other.floating;
+ tableLayout = other.tableLayout;
+ hasViewportUnits = other.hasViewportUnits;
+ hasExplicitlyInheritedProperties = other.hasExplicitlyInheritedProperties;
}
inline bool RenderStyle::NonInheritedFlags::hasPseudoStyle(PseudoId pseudo) const
@@ -2052,7 +1924,7 @@
{
ASSERT(pseudo > NOPSEUDO);
ASSERT(pseudo < FIRST_INTERNAL_PSEUDOID);
- return (oneBitMask << (pseudoBitsOffset - 1 + pseudo)) & m_flags;
+ return pseudoBits & (1 << (pseudo - 1 /* NOPSUEDO */));
}
inline void RenderStyle::NonInheritedFlags::setHasPseudoStyle(PseudoId pseudo)
@@ -2059,38 +1931,16 @@
{
ASSERT(pseudo > NOPSEUDO);
ASSERT(pseudo < FIRST_INTERNAL_PSEUDOID);
- m_flags |= oneBitMask << (pseudoBitsOffset - 1 + pseudo);
+ pseudoBits |= 1 << (pseudo - 1 /* NOPSUEDO */);
}
inline void RenderStyle::NonInheritedFlags::setHasPseudoStyles(PseudoIdSet pseudoIdSet)
{
ASSERT(pseudoIdSet);
- uint64_t rawPseudoIdSet = pseudoIdSet.data();
- ASSERT((rawPseudoIdSet & PUBLIC_PSEUDOID_MASK) == rawPseudoIdSet);
- static_assert(pseudoBitsOffset >= 1, "(pseudoBitsOffset - 1) should be valid.");
- m_flags |= (static_cast<uint64_t>(rawPseudoIdSet) << (pseudoBitsOffset - 1));
+ ASSERT((pseudoIdSet.data() & PUBLIC_PSEUDOID_MASK) == pseudoIdSet.data());
+ pseudoBits |= pseudoIdSet.data() >> 1; // Shift down as we do not store a bit for NOPSUEDO.
}
-inline void RenderStyle::NonInheritedFlags::updateBoolean(bool isSet, uint64_t offset)
-{
- if (isSet)
- m_flags |= (oneBitMask << offset);
- else
- m_flags &= ~(oneBitMask << offset);
-}
-
-inline bool RenderStyle::NonInheritedFlags::getBoolean(uint64_t offset) const
-{
- return m_flags & (oneBitMask << offset);
-}
-
-inline void RenderStyle::NonInheritedFlags::updateValue(uint8_t newValue, uint64_t positionIndependentMask, uint64_t offset)
-{
- ASSERT(!(newValue & ~positionIndependentMask));
- uint64_t positionDependentMask = positionIndependentMask << offset;
- m_flags = (m_flags & ~positionDependentMask) | (static_cast<uint64_t>(newValue) << offset);
-}
-
inline bool RenderStyle::InheritedFlags::operator==(const InheritedFlags& other) const
{
return emptyCells == other.emptyCells
@@ -2117,11 +1967,6 @@
&& writingMode == other.writingMode;
}
-inline unsigned RenderStyle::NonInheritedFlags::getValue(uint64_t positionIndependentMask, uint64_t offset) const
-{
- return static_cast<unsigned>((m_flags >> offset) & positionIndependentMask);
-}
-
inline int adjustForAbsoluteZoom(int value, const RenderStyle& style)
{
double zoomFactor = style.effectiveZoom();