- Revision
- 93195
- Author
- macpher...@chromium.org
- Date
- 2011-08-16 21:51:25 -0700 (Tue, 16 Aug 2011)
Log Message
Represent RenderStyle::textOverflow property using an enum instead of a bool.
https://bugs.webkit.org/show_bug.cgi?id=66356
Reviewed by Dan Bernstein.
No new tests - no behavioral changes.
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
Support cast from TextOverflow to CSSPrimitiveValue.
(WebCore::CSSPrimitiveValue::operator TextOverflow):
Support cast from CSSPrimitiveValue to TextOverflow.
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applyProperty):
Use HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE macro for text overflow.
* rendering/style/RenderStyle.h:
(WebCore::InheritedFlags::textOverflow):
Return TextOverflow enum.
(WebCore::InheritedFlags::setTextOverflow):
Accept TextOverflow enum parameter.
(WebCore::InheritedFlags::initialTextOverflow):
Return TextOverflowClip.
* rendering/style/RenderStyleConstants.h:
Define TextOverflow enum.
* rendering/style/StyleRareNonInheritedData.h:
Change representation of text overflow from bool to one-bit unsigned.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (93194 => 93195)
--- trunk/Source/WebCore/ChangeLog 2011-08-17 04:49:15 UTC (rev 93194)
+++ trunk/Source/WebCore/ChangeLog 2011-08-17 04:51:25 UTC (rev 93195)
@@ -1,3 +1,32 @@
+2011-08-16 Luke Macpherson <macpher...@chromium.org>
+
+ Represent RenderStyle::textOverflow property using an enum instead of a bool.
+ https://bugs.webkit.org/show_bug.cgi?id=66356
+
+ Reviewed by Dan Bernstein.
+
+ No new tests - no behavioral changes.
+
+ * css/CSSPrimitiveValueMappings.h:
+ (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+ Support cast from TextOverflow to CSSPrimitiveValue.
+ (WebCore::CSSPrimitiveValue::operator TextOverflow):
+ Support cast from CSSPrimitiveValue to TextOverflow.
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::applyProperty):
+ Use HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE macro for text overflow.
+ * rendering/style/RenderStyle.h:
+ (WebCore::InheritedFlags::textOverflow):
+ Return TextOverflow enum.
+ (WebCore::InheritedFlags::setTextOverflow):
+ Accept TextOverflow enum parameter.
+ (WebCore::InheritedFlags::initialTextOverflow):
+ Return TextOverflowClip.
+ * rendering/style/RenderStyleConstants.h:
+ Define TextOverflow enum.
+ * rendering/style/StyleRareNonInheritedData.h:
+ Change representation of text overflow from bool to one-bit unsigned.
+
2011-08-16 Jeff Miller <je...@apple.com>
Apple's Windows production build should fail to compile if AVFoundation is not enabled
Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (93194 => 93195)
--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h 2011-08-17 04:49:15 UTC (rev 93194)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h 2011-08-17 04:51:25 UTC (rev 93195)
@@ -2321,6 +2321,33 @@
}
}
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextOverflow overflow)
+ : m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
+{
+ switch (overflow) {
+ case TextOverflowClip:
+ m_value.ident = CSSValueClip;
+ break;
+ case TextOverflowEllipsis:
+ m_value.ident = CSSValueEllipsis;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator TextOverflow() const
+{
+ switch (m_value.ident) {
+ case CSSValueClip:
+ return TextOverflowClip;
+ case CSSValueEllipsis:
+ return TextOverflowEllipsis;
+ default:
+ ASSERT_NOT_REACHED();
+ return TextOverflowClip;
+ }
+}
+
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisFill fill)
: m_type(CSS_IDENT)
, m_hasCachedCSSText(false)
Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (93194 => 93195)
--- trunk/Source/WebCore/css/CSSStyleSelector.cpp 2011-08-17 04:49:15 UTC (rev 93194)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp 2011-08-17 04:51:25 UTC (rev 93195)
@@ -4698,10 +4698,7 @@
case CSSPropertyTextOverflow: {
// This property is supported by WinIE, and so we leave off the "-webkit-" in order to
// work with WinIE-specific pages that use the property.
- HANDLE_INHERIT_AND_INITIAL(textOverflow, TextOverflow)
- if (!primitiveValue || !primitiveValue->getIdent())
- return;
- m_style->setTextOverflow(primitiveValue->getIdent() == CSSValueEllipsis);
+ HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(textOverflow, TextOverflow)
return;
}
case CSSPropertyWebkitLineClamp: {
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (93194 => 93195)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2011-08-17 04:49:15 UTC (rev 93194)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2011-08-17 04:51:25 UTC (rev 93195)
@@ -695,7 +695,7 @@
EUserModify userModify() const { return static_cast<EUserModify>(rareInheritedData->userModify); }
EUserDrag userDrag() const { return static_cast<EUserDrag>(rareNonInheritedData->userDrag); }
EUserSelect userSelect() const { return static_cast<EUserSelect>(rareInheritedData->userSelect); }
- bool textOverflow() const { return rareNonInheritedData->textOverflow; }
+ TextOverflow textOverflow() const { return static_cast<TextOverflow>(rareNonInheritedData->textOverflow); }
EMarginCollapse marginBeforeCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginBeforeCollapse); }
EMarginCollapse marginAfterCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginAfterCollapse); }
EWordBreak wordBreak() const { return static_cast<EWordBreak>(rareInheritedData->wordBreak); }
@@ -1066,7 +1066,7 @@
void setUserModify(EUserModify u) { SET_VAR(rareInheritedData, userModify, u); }
void setUserDrag(EUserDrag d) { SET_VAR(rareNonInheritedData, userDrag, d); }
void setUserSelect(EUserSelect s) { SET_VAR(rareInheritedData, userSelect, s); }
- void setTextOverflow(bool b) { SET_VAR(rareNonInheritedData, textOverflow, b); }
+ void setTextOverflow(TextOverflow overflow) { SET_VAR(rareNonInheritedData, textOverflow, overflow); }
void setMarginBeforeCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginBeforeCollapse, c); }
void setMarginAfterCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginAfterCollapse, c); }
void setWordBreak(EWordBreak b) { SET_VAR(rareInheritedData, wordBreak, b); }
@@ -1316,7 +1316,7 @@
static EUserModify initialUserModify() { return READ_ONLY; }
static EUserDrag initialUserDrag() { return DRAG_AUTO; }
static EUserSelect initialUserSelect() { return SELECT_TEXT; }
- static bool initialTextOverflow() { return false; }
+ static TextOverflow initialTextOverflow() { return TextOverflowClip; }
static EMarginCollapse initialMarginBeforeCollapse() { return MCOLLAPSE; }
static EMarginCollapse initialMarginAfterCollapse() { return MCOLLAPSE; }
static EWordBreak initialWordBreak() { return NormalWordBreak; }
Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.h (93194 => 93195)
--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.h 2011-08-17 04:49:15 UTC (rev 93194)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.h 2011-08-17 04:51:25 UTC (rev 93195)
@@ -434,6 +434,8 @@
enum TextEmphasisPosition { TextEmphasisPositionOver, TextEmphasisPositionUnder };
+enum TextOverflow { TextOverflowClip = 0, TextOverflowEllipsis };
+
enum EImageRendering { ImageRenderingAuto, ImageRenderingOptimizeSpeed, ImageRenderingOptimizeQuality, ImageRenderingOptimizeContrast };
enum Order { LogicalOrder = 0, VisualOrder };
Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h (93194 => 93195)
--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h 2011-08-17 04:49:15 UTC (rev 93194)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h 2011-08-17 04:51:25 UTC (rev 93195)
@@ -103,7 +103,7 @@
OwnPtr<CounterDirectiveMap> m_counterDirectives;
unsigned userDrag : 2; // EUserDrag
- bool textOverflow : 1; // Whether or not lines that spill out should be truncated with "..."
+ unsigned textOverflow : 1; // Whether or not lines that spill out should be truncated with "..."
unsigned marginBeforeCollapse : 2; // EMarginCollapse
unsigned marginAfterCollapse : 2; // EMarginCollapse
unsigned matchNearestMailBlockquoteColor : 1; // EMatchNearestMailBlockquoteColor, FIXME: This property needs to be eliminated. It should never have been added.