diff options
author | Steve Block <steveblock@google.com> | 2010-09-29 17:32:26 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-09-29 17:35:08 +0100 |
commit | 68513a70bcd92384395513322f1b801e7bf9c729 (patch) | |
tree | 161b50f75a5921d61731bb25e730005994fcec85 /WebCore/rendering/style | |
parent | fd5c6425ce58eb75211be7718d5dee960842a37e (diff) | |
download | external_webkit-68513a70bcd92384395513322f1b801e7bf9c729.zip external_webkit-68513a70bcd92384395513322f1b801e7bf9c729.tar.gz external_webkit-68513a70bcd92384395513322f1b801e7bf9c729.tar.bz2 |
Merge WebKit at r67908: Initial merge by Git
Change-Id: I43a553e7b3299b28cb6ee8aa035ed70fe342b972
Diffstat (limited to 'WebCore/rendering/style')
-rw-r--r-- | WebCore/rendering/style/RenderStyle.cpp | 184 | ||||
-rw-r--r-- | WebCore/rendering/style/RenderStyle.h | 48 | ||||
-rw-r--r-- | WebCore/rendering/style/RenderStyleConstants.h | 5 |
3 files changed, 236 insertions, 1 deletions
diff --git a/WebCore/rendering/style/RenderStyle.cpp b/WebCore/rendering/style/RenderStyle.cpp index 93cd8de..4b77d6b 100644 --- a/WebCore/rendering/style/RenderStyle.cpp +++ b/WebCore/rendering/style/RenderStyle.cpp @@ -441,6 +441,10 @@ StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon noninherited_flags._clear != other->noninherited_flags._clear) return StyleDifferenceLayout; + // Check block flow direction. + if (inherited_flags._blockFlow != other->inherited_flags._blockFlow) + return StyleDifferenceLayout; + // Overflow returns a layout hint. if (noninherited_flags._overflowX != other->noninherited_flags._overflowX || noninherited_flags._overflowY != other->noninherited_flags._overflowY) @@ -1060,4 +1064,184 @@ const Color RenderStyle::visitedDependentColor(int colorProperty) const return Color(visitedColor.red(), visitedColor.green(), visitedColor.blue(), unvisitedColor.alpha()); } +Length RenderStyle::logicalWidth() const +{ + if (isVerticalBlockFlow()) + return width(); + return height(); +} + +Length RenderStyle::logicalHeight() const +{ + if (isVerticalBlockFlow()) + return height(); + return width(); +} + +Length RenderStyle::logicalMinWidth() const +{ + if (isVerticalBlockFlow()) + return minWidth(); + return minHeight(); +} + +Length RenderStyle::logicalMaxWidth() const +{ + if (isVerticalBlockFlow()) + return maxWidth(); + return maxHeight(); +} + +Length RenderStyle::logicalMinHeight() const +{ + if (isVerticalBlockFlow()) + return minHeight(); + return minWidth(); +} + +Length RenderStyle::logicalMaxHeight() const +{ + if (isVerticalBlockFlow()) + return maxHeight(); + return maxWidth(); +} + +unsigned short RenderStyle::borderBeforeWidth() const +{ + switch (blockFlow()) { + case TopToBottomBlockFlow: + return borderTopWidth(); + case BottomToTopBlockFlow: + return borderBottomWidth(); + case LeftToRightBlockFlow: + return borderLeftWidth(); + case RightToLeftBlockFlow: + return borderRightWidth(); + } + ASSERT_NOT_REACHED(); + return borderTopWidth(); +} + +unsigned short RenderStyle::borderAfterWidth() const +{ + switch (blockFlow()) { + case TopToBottomBlockFlow: + return borderBottomWidth(); + case BottomToTopBlockFlow: + return borderTopWidth(); + case LeftToRightBlockFlow: + return borderRightWidth(); + case RightToLeftBlockFlow: + return borderLeftWidth(); + } + ASSERT_NOT_REACHED(); + return borderBottomWidth(); +} + +unsigned short RenderStyle::borderStartWidth() const +{ + if (isVerticalBlockFlow()) + return direction() == LTR ? borderLeftWidth() : borderRightWidth(); + return direction() == LTR ? borderTopWidth() : borderBottomWidth(); +} + +unsigned short RenderStyle::borderEndWidth() const +{ + if (isVerticalBlockFlow()) + return direction() == LTR ? borderRightWidth() : borderLeftWidth(); + return direction() == LTR ? borderBottomWidth() : borderTopWidth(); +} + +Length RenderStyle::marginBefore() const +{ + switch (blockFlow()) { + case TopToBottomBlockFlow: + return marginTop(); + case BottomToTopBlockFlow: + return marginBottom(); + case LeftToRightBlockFlow: + return marginLeft(); + case RightToLeftBlockFlow: + return marginRight(); + } + ASSERT_NOT_REACHED(); + return marginTop(); +} + +Length RenderStyle::marginAfter() const +{ + switch (blockFlow()) { + case TopToBottomBlockFlow: + return marginBottom(); + case BottomToTopBlockFlow: + return marginTop(); + case LeftToRightBlockFlow: + return marginRight(); + case RightToLeftBlockFlow: + return marginLeft(); + } + ASSERT_NOT_REACHED(); + return marginBottom(); +} + +Length RenderStyle::marginStart() const +{ + if (isVerticalBlockFlow()) + return direction() == LTR ? marginLeft() : marginRight(); + return direction() == LTR ? marginTop() : marginBottom(); +} + +Length RenderStyle::marginEnd() const +{ + if (isVerticalBlockFlow()) + return direction() == LTR ? marginRight() : marginLeft(); + return direction() == LTR ? marginBottom() : marginTop(); +} + +Length RenderStyle::paddingBefore() const +{ + switch (blockFlow()) { + case TopToBottomBlockFlow: + return paddingTop(); + case BottomToTopBlockFlow: + return paddingBottom(); + case LeftToRightBlockFlow: + return paddingLeft(); + case RightToLeftBlockFlow: + return paddingRight(); + } + ASSERT_NOT_REACHED(); + return paddingTop(); +} + +Length RenderStyle::paddingAfter() const +{ + switch (blockFlow()) { + case TopToBottomBlockFlow: + return paddingBottom(); + case BottomToTopBlockFlow: + return paddingTop(); + case LeftToRightBlockFlow: + return paddingRight(); + case RightToLeftBlockFlow: + return paddingLeft(); + } + ASSERT_NOT_REACHED(); + return paddingBottom(); +} + +Length RenderStyle::paddingStart() const +{ + if (isVerticalBlockFlow()) + return direction() == LTR ? paddingLeft() : paddingRight(); + return direction() == LTR ? paddingTop() : paddingBottom(); +} + +Length RenderStyle::paddingEnd() const +{ + if (isVerticalBlockFlow()) + return direction() == LTR ? paddingRight() : paddingLeft(); + return direction() == LTR ? paddingBottom() : paddingTop(); +} + } // namespace WebCore diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h index e696735..e287ab9 100644 --- a/WebCore/rendering/style/RenderStyle.h +++ b/WebCore/rendering/style/RenderStyle.h @@ -178,7 +178,8 @@ protected: (_visuallyOrdered == other._visuallyOrdered) && (_force_backgrounds_to_white == other._force_backgrounds_to_white) && (_pointerEvents == other._pointerEvents) && - (_insideLink == other._insideLink); + (_insideLink == other._insideLink) && + (_blockFlow == other._blockFlow); } bool operator!=(const InheritedFlags& other) const { return !(*this == other); } @@ -204,6 +205,10 @@ protected: unsigned _pointerEvents : 4; // EPointerEvents unsigned _insideLink : 2; // EInsideLink // 43 bits + + // CSS Text Layout Module Level 3: Vertical writing support + unsigned _blockFlow : 2; // EBlockFlowDirection + // 45 bits } inherited_flags; // don't inherit @@ -279,6 +284,7 @@ protected: inherited_flags._force_backgrounds_to_white = false; inherited_flags._pointerEvents = initialPointerEvents(); inherited_flags._insideLink = NotInsideLink; + inherited_flags._blockFlow = initialBlockFlow(); noninherited_flags._effectiveDisplay = noninherited_flags._originalDisplay = initialDisplay(); noninherited_flags._overflowX = initialOverflowX(); @@ -384,6 +390,13 @@ public: Length maxWidth() const { return m_box->maxWidth(); } Length minHeight() const { return m_box->minHeight(); } Length maxHeight() const { return m_box->maxHeight(); } + + Length logicalWidth() const; + Length logicalHeight() const; + Length logicalMinWidth() const; + Length logicalMaxWidth() const; + Length logicalMinHeight() const; + Length logicalMaxHeight() const; const BorderData& border() const { return surround->border; } const BorderValue& borderLeft() const { return surround->border.left(); } @@ -411,6 +424,11 @@ public: unsigned short borderBottomWidth() const { return surround->border.borderBottomWidth(); } EBorderStyle borderBottomStyle() const { return surround->border.bottom().style(); } bool borderBottomIsTransparent() const { return surround->border.bottom().isTransparent(); } + + unsigned short borderBeforeWidth() const; + unsigned short borderAfterWidth() const; + unsigned short borderStartWidth() const; + unsigned short borderEndWidth() const; unsigned short outlineSize() const { return max(0, outlineWidth() + outlineOffset()); } unsigned short outlineWidth() const @@ -576,12 +594,20 @@ public: Length marginBottom() const { return surround->margin.bottom(); } Length marginLeft() const { return surround->margin.left(); } Length marginRight() const { return surround->margin.right(); } + Length marginBefore() const; + Length marginAfter() const; + Length marginStart() const; + Length marginEnd() const; LengthBox paddingBox() const { return surround->padding; } Length paddingTop() const { return surround->padding.top(); } Length paddingBottom() const { return surround->padding.bottom(); } Length paddingLeft() const { return surround->padding.left(); } Length paddingRight() const { return surround->padding.right(); } + Length paddingBefore() const; + Length paddingAfter() const; + Length paddingStart() const; + Length paddingEnd() const; ECursor cursor() const { return static_cast<ECursor>(inherited_flags._cursor_style); } @@ -712,6 +738,7 @@ public: bool textSizeAdjust() const { return rareInheritedData->textSizeAdjust; } ETextSecurity textSecurity() const { return static_cast<ETextSecurity>(rareInheritedData->textSecurity); } +<<<<<<< HEAD #ifdef ANDROID_CSS_RING // called when building nav cache to determine if the ring data is unchanged const void* ringData() const { return reinterpret_cast<const void*>(rareInheritedData.get()); } @@ -728,6 +755,10 @@ public: #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR Color tapHighlightColor() const { return rareInheritedData->tapHighlightColor; } #endif +======= + EBlockFlowDirection blockFlow() const { return static_cast<EBlockFlowDirection>(inherited_flags._blockFlow); } + bool isVerticalBlockFlow() const { return blockFlow() == TopToBottomBlockFlow || blockFlow() == BottomToTopBlockFlow; } +>>>>>>> webkit.org at r67908 // attribute setter methods @@ -1123,6 +1154,8 @@ public: originalDisplay() == INLINE_BOX || originalDisplay() == INLINE_TABLE; } + void setBlockFlow(EBlockFlowDirection v) { inherited_flags._blockFlow = v; } + // To tell if this style matched attribute selectors. This makes it impossible to share. bool affectedByAttributeSelectors() const { return m_affectedByAttributeSelectors; } void setAffectedByAttributeSelectors() { m_affectedByAttributeSelectors = true; } @@ -1162,6 +1195,7 @@ public: static ECaptionSide initialCaptionSide() { return CAPTOP; } static EClear initialClear() { return CNONE; } static TextDirection initialDirection() { return LTR; } + static EBlockFlowDirection initialBlockFlow() { return TopToBottomBlockFlow; } static EDisplay initialDisplay() { return INLINE; } static EEmptyCell initialEmptyCells() { return SHOW; } static EFloat initialFloating() { return FNONE; } @@ -1290,6 +1324,18 @@ private: ContentData* prepareToSetContent(StringImpl*, bool add); }; +inline int adjustForAbsoluteZoom(int value, const RenderStyle* style) +{ + double zoomFactor = style->effectiveZoom(); + if (zoomFactor == 1) + return value; + // Needed because computeLengthInt truncates (rather than rounds) when scaling up. + if (zoomFactor > 1) + value++; + + return roundForImpreciseConversion<int, INT_MAX, INT_MIN>(value / zoomFactor); +} + } // namespace WebCore #endif // RenderStyle_h diff --git a/WebCore/rendering/style/RenderStyleConstants.h b/WebCore/rendering/style/RenderStyleConstants.h index a78321f..94d30d5 100644 --- a/WebCore/rendering/style/RenderStyleConstants.h +++ b/WebCore/rendering/style/RenderStyleConstants.h @@ -128,6 +128,11 @@ enum EUnicodeBidi { UBNormal, Embed, Override }; +// CSS Text Layout Module Level 3: Vertical writing support +enum EBlockFlowDirection { + TopToBottomBlockFlow, RightToLeftBlockFlow, LeftToRightBlockFlow, BottomToTopBlockFlow +}; + enum EFillAttachment { ScrollBackgroundAttachment, LocalBackgroundAttachment, FixedBackgroundAttachment }; |