From effdf28e1116df577371517b4c099dfe3493ffb9 Mon Sep 17 00:00:00 2001 From: Ojan Vafai Date: Fri, 6 Feb 2015 12:46:04 +1100 Subject: [PATCH] Remove position:relative. The use-cases we care about are met better by translate2d. Remove the parsing so that people writing on sky don't depend on it. Followup patches will remove the functionality. R=esprehn@chromium.org Review URL: https://codereview.chromium.org/904613005 --- engine/core/css/CSSPrimitiveValueMappings.h | 5 ----- engine/core/css/CSSValueKeywords.in | 1 - engine/core/css/parser/BisonCSSParser-in.cpp | 4 ++-- engine/core/rendering/RenderBlock.cpp | 4 ---- engine/core/rendering/RenderLayerClipper.cpp | 5 +---- engine/core/rendering/RenderObject.h | 8 ++++---- engine/core/rendering/style/RenderStyle.h | 5 +++-- engine/core/rendering/style/RenderStyleConstants.h | 3 +-- 8 files changed, 11 insertions(+), 24 deletions(-) diff --git a/engine/core/css/CSSPrimitiveValueMappings.h b/engine/core/css/CSSPrimitiveValueMappings.h index ab1bde7c254..8707e743f1d 100644 --- a/engine/core/css/CSSPrimitiveValueMappings.h +++ b/engine/core/css/CSSPrimitiveValueMappings.h @@ -1528,9 +1528,6 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPosition e) case StaticPosition: m_value.valueID = CSSValueStatic; break; - case RelativePosition: - m_value.valueID = CSSValueRelative; - break; case AbsolutePosition: m_value.valueID = CSSValueAbsolute; break; @@ -1543,8 +1540,6 @@ template<> inline CSSPrimitiveValue::operator EPosition() const switch (m_value.valueID) { case CSSValueStatic: return StaticPosition; - case CSSValueRelative: - return RelativePosition; case CSSValueAbsolute: return AbsolutePosition; default: diff --git a/engine/core/css/CSSValueKeywords.in b/engine/core/css/CSSValueKeywords.in index 0f80874992e..22e1342d653 100644 --- a/engine/core/css/CSSValueKeywords.in +++ b/engine/core/css/CSSValueKeywords.in @@ -365,7 +365,6 @@ portrait pre pre-line pre-wrap -relative separate show static diff --git a/engine/core/css/parser/BisonCSSParser-in.cpp b/engine/core/css/parser/BisonCSSParser-in.cpp index 34431d248b7..ae8665480d5 100644 --- a/engine/core/css/parser/BisonCSSParser-in.cpp +++ b/engine/core/css/parser/BisonCSSParser-in.cpp @@ -376,8 +376,8 @@ bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, CSSValueID valueID // none | visiblePainted | visibleFill | visibleStroke | visible | // painted | fill | stroke | auto | all | bounding-box return valueID == CSSValueVisible || valueID == CSSValueNone || valueID == CSSValueAll || valueID == CSSValueAuto || (valueID >= CSSValueVisiblepainted && valueID <= CSSValueBoundingBox); - case CSSPropertyPosition: // static | relative | absolute | fixed - return valueID == CSSValueStatic || valueID == CSSValueRelative || valueID == CSSValueAbsolute || valueID == CSSValueFixed; + case CSSPropertyPosition: // static | absolute + return valueID == CSSValueStatic || valueID == CSSValueAbsolute; case CSSPropertySpeak: // none | normal | spell-out | digits | literal-punctuation | no-punctuation return valueID == CSSValueNone || valueID == CSSValueNormal || valueID == CSSValueSpellOut || valueID == CSSValueDigits || valueID == CSSValueLiteralPunctuation || valueID == CSSValueNoPunctuation; case CSSPropertyTableLayout: // auto | fixed diff --git a/engine/core/rendering/RenderBlock.cpp b/engine/core/rendering/RenderBlock.cpp index f250c2e5d50..312db465e1c 100644 --- a/engine/core/rendering/RenderBlock.cpp +++ b/engine/core/rendering/RenderBlock.cpp @@ -177,10 +177,6 @@ void RenderBlock::styleWillChange(StyleDifference diff, const RenderStyle& newSt // They will be inserted into our positioned objects list during layout. RenderObject* cb = parent(); while (cb && (cb->style()->position() == StaticPosition || (cb->isInline() && !cb->isReplaced())) && !cb->isRenderView()) { - if (cb->style()->position() == RelativePosition && cb->isInline() && !cb->isReplaced()) { - cb = cb->containingBlock(); - break; - } cb = cb->parent(); } diff --git a/engine/core/rendering/RenderLayerClipper.cpp b/engine/core/rendering/RenderLayerClipper.cpp index 9446f25b347..2eb5e099bed 100644 --- a/engine/core/rendering/RenderLayerClipper.cpp +++ b/engine/core/rendering/RenderLayerClipper.cpp @@ -51,10 +51,7 @@ namespace blink { static void adjustClipRectsForChildren(const RenderObject& renderer, ClipRects& clipRects) { - EPosition position = renderer.style()->position(); - if (position == RelativePosition) { - clipRects.setPosClipRect(clipRects.overflowClipRect()); - } else if (position == AbsolutePosition) { + if (renderer.style()->position() == AbsolutePosition) { clipRects.setOverflowClipRect(clipRects.posClipRect()); } } diff --git a/engine/core/rendering/RenderObject.h b/engine/core/rendering/RenderObject.h index f61cf9b829c..6164a8caa55 100644 --- a/engine/core/rendering/RenderObject.h +++ b/engine/core/rendering/RenderObject.h @@ -726,8 +726,7 @@ private: // FIXME(sky): Remove this enum and just use EPosition directly. enum PositionedState { IsStaticallyPositioned = 0, - IsRelativelyPositioned = 1, - IsOutOfFlowPositioned = 2, + IsOutOfFlowPositioned = 1, }; public: @@ -791,12 +790,13 @@ private: ADD_BOOLEAN_BITFIELD(alwaysCreateLineBoxesForRenderInline, AlwaysCreateLineBoxesForRenderInline); private: - unsigned m_positionedState : 2; // PositionedState + unsigned m_positionedState : 1; // PositionedState unsigned m_selectionState : 3; // SelectionState public: bool isOutOfFlowPositioned() const { return m_positionedState == IsOutOfFlowPositioned; } - bool isRelPositioned() const { return m_positionedState == IsRelativelyPositioned; } + // FIXME(sky): Remove + bool isRelPositioned() const { return false; } bool isPositioned() const { return m_positionedState != IsStaticallyPositioned; } void setPositionedState(int positionState) diff --git a/engine/core/rendering/style/RenderStyle.h b/engine/core/rendering/style/RenderStyle.h index 27a5100e1d2..2a74039b6d8 100644 --- a/engine/core/rendering/style/RenderStyle.h +++ b/engine/core/rendering/style/RenderStyle.h @@ -199,7 +199,7 @@ protected: unsigned overflowX : 3; // EOverflow unsigned overflowY : 3; // EOverflow unsigned verticalAlign : 4; // EVerticalAlign - unsigned position : 3; // EPosition + unsigned position : 1; // EPosition unsigned tableLayout : 1; // ETableLayout unsigned unicodeBidi : 3; // EUnicodeBidi @@ -374,7 +374,8 @@ public: EPosition position() const { return static_cast(noninherited_flags.position); } bool hasOutOfFlowPosition() const { return position() == AbsolutePosition; } - bool hasInFlowPosition() const { return position() == RelativePosition; } + // FIXME(sky): Remove + bool hasInFlowPosition() const { return false; } const Length& width() const { return m_box->width(); } const Length& height() const { return m_box->height(); } diff --git a/engine/core/rendering/style/RenderStyleConstants.h b/engine/core/rendering/style/RenderStyleConstants.h index 0eb142fd9dc..aaad3f0ab49 100644 --- a/engine/core/rendering/style/RenderStyleConstants.h +++ b/engine/core/rendering/style/RenderStyleConstants.h @@ -49,8 +49,7 @@ enum OutlineIsAuto { AUTO_OFF = 0, AUTO_ON }; enum EPosition { StaticPosition = 0, - RelativePosition = 1, - AbsolutePosition = 2, + AbsolutePosition = 1, }; // Box decoration attributes. Not inherited.