Title: [92243] trunk/Source/WebCore
Revision
92243
Author
[email protected]
Date
2011-08-02 16:15:27 -0700 (Tue, 02 Aug 2011)

Log Message

Implement CSSPropertyWebkitTextCombine, CSSPropertyWebkitTextEmphasisPosition and CSSPropertyWebkitTextEmphasisStyle in CSSStyleApplyProperty.
https://bugs.webkit.org/show_bug.cgi?id=65517

Reviewed by Dimitri Glazkov.

No new tests. Just refactoring and moving code around.

* css/CSSStyleApplyProperty.cpp:
Added class ApplyPropertyTextEmphasisStyle to handle the special TextEmphasisStyle logic.
(WebCore::ApplyPropertyTextEmphasisStyle::applyInheritValue):
(WebCore::ApplyPropertyTextEmphasisStyle::applyInitialValue):
(WebCore::ApplyPropertyTextEmphasisStyle::applyValue):
(WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):
Added initializations for CSSPropertyWebkitTextCombine, CSSPropertyWebkitTextEmphasisPosition, CSSPropertyWebkitTextEmphasisStyle.
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applyProperty):
Remove existing implementations.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (92242 => 92243)


--- trunk/Source/WebCore/ChangeLog	2011-08-02 22:47:08 UTC (rev 92242)
+++ trunk/Source/WebCore/ChangeLog	2011-08-02 23:15:27 UTC (rev 92243)
@@ -1,3 +1,23 @@
+2011-08-02  Luke Macpherson   <[email protected]>
+
+        Implement CSSPropertyWebkitTextCombine, CSSPropertyWebkitTextEmphasisPosition and CSSPropertyWebkitTextEmphasisStyle in CSSStyleApplyProperty.
+        https://bugs.webkit.org/show_bug.cgi?id=65517
+
+        Reviewed by Dimitri Glazkov.
+
+        No new tests. Just refactoring and moving code around.
+
+        * css/CSSStyleApplyProperty.cpp:
+        Added class ApplyPropertyTextEmphasisStyle to handle the special TextEmphasisStyle logic.
+        (WebCore::ApplyPropertyTextEmphasisStyle::applyInheritValue):
+        (WebCore::ApplyPropertyTextEmphasisStyle::applyInitialValue):
+        (WebCore::ApplyPropertyTextEmphasisStyle::applyValue):
+        (WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):
+        Added initializations for CSSPropertyWebkitTextCombine, CSSPropertyWebkitTextEmphasisPosition, CSSPropertyWebkitTextEmphasisStyle.
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::applyProperty):
+        Remove existing implementations.
+
 2011-08-02  Mark Pilgrim  <[email protected]>
 
         Remove LegacyDefaultOptionalArguments flag from SpeechInputResultList.idl

Modified: trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp (92242 => 92243)


--- trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp	2011-08-02 22:47:08 UTC (rev 92242)
+++ trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp	2011-08-02 23:15:27 UTC (rev 92243)
@@ -685,6 +685,68 @@
     }
 };
 
+class ApplyPropertyTextEmphasisStyle : public ApplyPropertyBase {
+private:
+    virtual void applyInheritValue(CSSStyleSelector* selector) const
+    {
+        selector->style()->setTextEmphasisFill(selector->parentStyle()->textEmphasisFill());
+        selector->style()->setTextEmphasisMark(selector->parentStyle()->textEmphasisMark());
+        selector->style()->setTextEmphasisCustomMark(selector->parentStyle()->textEmphasisCustomMark());
+    }
+
+    virtual void applyInitialValue(CSSStyleSelector* selector) const
+    {
+        selector->style()->setTextEmphasisFill(RenderStyle::initialTextEmphasisFill());
+        selector->style()->setTextEmphasisMark(RenderStyle::initialTextEmphasisMark());
+        selector->style()->setTextEmphasisCustomMark(RenderStyle::initialTextEmphasisCustomMark());
+    }
+
+    virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
+    {
+        if (value->isValueList()) {
+            CSSValueList* list = static_cast<CSSValueList*>(value);
+            ASSERT(list->length() == 2);
+            if (list->length() != 2)
+                return;
+            for (unsigned i = 0; i < 2; ++i) {
+                CSSValue* item = list->itemWithoutBoundsCheck(i);
+                if (!item->isPrimitiveValue())
+                    continue;
+
+                CSSPrimitiveValue* value = static_cast<CSSPrimitiveValue*>(item);
+                if (value->getIdent() == CSSValueFilled || value->getIdent() == CSSValueOpen)
+                    selector->style()->setTextEmphasisFill(*value);
+                else
+                    selector->style()->setTextEmphasisMark(*value);
+            }
+            selector->style()->setTextEmphasisCustomMark(nullAtom);
+            return;
+        }
+
+        if (!value->isPrimitiveValue())
+            return;
+        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+
+        if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_STRING) {
+            selector->style()->setTextEmphasisFill(TextEmphasisFillFilled);
+            selector->style()->setTextEmphasisMark(TextEmphasisMarkCustom);
+            selector->style()->setTextEmphasisCustomMark(primitiveValue->getStringValue());
+            return;
+        }
+
+        selector->style()->setTextEmphasisCustomMark(nullAtom);
+
+        if (primitiveValue->getIdent() == CSSValueFilled || primitiveValue->getIdent() == CSSValueOpen) {
+            selector->style()->setTextEmphasisFill(*primitiveValue);
+            selector->style()->setTextEmphasisMark(TextEmphasisMarkAuto);
+        } else {
+            selector->style()->setTextEmphasisFill(TextEmphasisFillFilled);
+            selector->style()->setTextEmphasisMark(*primitiveValue);
+        }
+
+    }
+};
+
 const CSSStyleApplyProperty& CSSStyleApplyProperty::sharedCSSStyleApplyProperty()
 {
     DEFINE_STATIC_LOCAL(CSSStyleApplyProperty, cssStyleApplyPropertyInstance, ());
@@ -868,6 +930,11 @@
     setPropertyHandler(CSSPropertyWebkitColumnCount, new ApplyPropertyAuto<unsigned short>(&RenderStyle::columnCount, &RenderStyle::setColumnCount, &RenderStyle::hasAutoColumnCount, &RenderStyle::setHasAutoColumnCount));
     setPropertyHandler(CSSPropertyWebkitColumnGap, new ApplyPropertyAuto<float, ComputeLength, CSSValueNormal>(&RenderStyle::columnGap, &RenderStyle::setColumnGap, &RenderStyle::hasNormalColumnGap, &RenderStyle::setHasNormalColumnGap));
     setPropertyHandler(CSSPropertyWebkitColumnWidth, new ApplyPropertyAuto<float, ComputeLength>(&RenderStyle::columnWidth, &RenderStyle::setColumnWidth, &RenderStyle::hasAutoColumnWidth, &RenderStyle::setHasAutoColumnWidth));
+
+    setPropertyHandler(CSSPropertyWebkitTextCombine, new ApplyPropertyDefault<TextCombine>(&RenderStyle::textCombine, &RenderStyle::setTextCombine, &RenderStyle::initialTextCombine));
+    setPropertyHandler(CSSPropertyWebkitTextEmphasisPosition, new ApplyPropertyDefault<TextEmphasisPosition>(&RenderStyle::textEmphasisPosition, &RenderStyle::setTextEmphasisPosition, &RenderStyle::initialTextEmphasisPosition));
+    setPropertyHandler(CSSPropertyWebkitTextEmphasisStyle, new ApplyPropertyTextEmphasisStyle());
+
     setPropertyHandler(CSSPropertyZIndex, new ApplyPropertyAuto<int>(&RenderStyle::zIndex, &RenderStyle::setZIndex, &RenderStyle::hasAutoZIndex, &RenderStyle::setHasAutoZIndex));
 }
 

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (92242 => 92243)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-08-02 22:47:08 UTC (rev 92242)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-08-02 23:15:27 UTC (rev 92243)
@@ -5059,62 +5059,6 @@
         return;
     }
 
-    case CSSPropertyWebkitTextCombine:
-        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(textCombine, TextCombine)
-        return;
-
-    case CSSPropertyWebkitTextEmphasisPosition:
-        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(textEmphasisPosition, TextEmphasisPosition)
-        return;
-
-    case CSSPropertyWebkitTextEmphasisStyle:
-        HANDLE_INHERIT_AND_INITIAL(textEmphasisFill, TextEmphasisFill)
-        HANDLE_INHERIT_AND_INITIAL(textEmphasisMark, TextEmphasisMark)
-        HANDLE_INHERIT_AND_INITIAL(textEmphasisCustomMark, TextEmphasisCustomMark)
-        if (isInherit || isInitial)
-            return;
-
-        if (value->isValueList()) {
-            CSSValueList* list = static_cast<CSSValueList*>(value);
-            ASSERT(list->length() == 2);
-            if (list->length() != 2)
-                return;
-            for (unsigned i = 0; i < 2; ++i) {
-                CSSValue* item = list->itemWithoutBoundsCheck(i);
-                if (!item->isPrimitiveValue())
-                    continue;
-
-                CSSPrimitiveValue* value = static_cast<CSSPrimitiveValue*>(item);
-                if (value->getIdent() == CSSValueFilled || value->getIdent() == CSSValueOpen)
-                    m_style->setTextEmphasisFill(*value);
-                else
-                    m_style->setTextEmphasisMark(*value);
-            }
-            m_style->setTextEmphasisCustomMark(nullAtom);
-            return;
-        }
-
-        if (!primitiveValue)
-            return;
-
-        if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_STRING) {
-            m_style->setTextEmphasisFill(TextEmphasisFillFilled);
-            m_style->setTextEmphasisMark(TextEmphasisMarkCustom);
-            m_style->setTextEmphasisCustomMark(primitiveValue->getStringValue());
-            return;
-        }
-
-        m_style->setTextEmphasisCustomMark(nullAtom);
-
-        if (primitiveValue->getIdent() == CSSValueFilled || primitiveValue->getIdent() == CSSValueOpen) {
-            m_style->setTextEmphasisFill(*primitiveValue);
-            m_style->setTextEmphasisMark(TextEmphasisMarkAuto);
-        } else {
-            m_style->setTextEmphasisFill(TextEmphasisFillFilled);
-            m_style->setTextEmphasisMark(*primitiveValue);
-        }
-
-        return;
     case CSSPropertyWebkitLineBoxContain: {
         HANDLE_INHERIT_AND_INITIAL(lineBoxContain, LineBoxContain)
         if (primitiveValue && primitiveValue->getIdent() == CSSValueNone) {
@@ -5258,6 +5202,9 @@
     case CSSPropertyWebkitColumnCount:
     case CSSPropertyWebkitColumnGap:
     case CSSPropertyWebkitColumnWidth:
+    case CSSPropertyWebkitTextCombine:
+    case CSSPropertyWebkitTextEmphasisPosition:
+    case CSSPropertyWebkitTextEmphasisStyle:
     case CSSPropertyZIndex:
         ASSERT_NOT_REACHED();
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to