Changeset 73219 in webkit


Ignore:
Timestamp:
Dec 2, 2010, 4:36:15 PM (15 years ago)
Author:
mitz@apple.com
Message:

WebCore: CSS support for the text-emphasis properties
https://bugs.webkit.org/show_bug.cgi?id=48539

Reviewed by Dave Hyatt.

Test: fast/css/parsing-text-emphasis.html

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Added text-emphasis-color,
text-emphasis-position and text-emphasis-style. Left the text-emphasis shorthand unsupported.

  • css/CSSParser.cpp:

(WebCore::CSSParser::parseValue): Parse the properties.
(WebCore::CSSParser::parseTextEmphasisStyle): Added.

  • css/CSSParser.h:
  • css/CSSPrimitiveValueMappings.h:

(WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Added TextEmphasisPosition, TextEmphasisFill
and TextEmphasisMark mappings.
(WebCore::CSSPrimitiveValue::operator TextEmphasisPosition): Added.
(WebCore::CSSPrimitiveValue::operator TextEmphasisFill): Added.
(WebCore::CSSPrimitiveValue::operator TextEmphasisMark): Added.

  • css/CSSPropertyLonghand.cpp:

(WebCore::initShorthandMap): Added the text-emphasis shorthand.

  • css/CSSPropertyNames.in: Added -webkit-text-emphasis, -webkit-text-emphasis-color,

-webkit-text-emphasis-position, and -webkit-text-emphasis-style.

  • css/CSSStyleSelector.cpp:

(WebCore::isValidVisitedLinkProperty): Added text-emphasis-color.
(WebCore::CSSStyleSelector::applyProperty): Handle the properties.

  • css/CSSValueKeywords.in: Added 'over' and 'under' for text-emphasis-position. Added 'dot',

'double-circle', 'triangle', 'sesame', 'filled' and 'open' for text-emphasis-style.

  • rendering/style/RenderStyle.cpp:

(WebCore::RenderStyle::colorIncludingFallback): Handle text-emphasis-color.
(WebCore::RenderStyle::textEmphasisMark): Added. Maps the fake 'auto' value to 'dot' or
'sesame' based on writing direction.

  • rendering/style/RenderStyle.h: Added accessors.

(WebCore::InheritedFlags::textEmphasisFill):
(WebCore::InheritedFlags::textEmphasisCustomMark):
(WebCore::InheritedFlags::textEmphasisPosition):
(WebCore::InheritedFlags::setTextEmphasisColor):
(WebCore::InheritedFlags::setTextEmphasisFill):
(WebCore::InheritedFlags::setTextEmphasisMark):
(WebCore::InheritedFlags::setTextEmphasisCustomMark):
(WebCore::InheritedFlags::setTextEmphasisPosition):
(WebCore::InheritedFlags::initialTextEmphasisColor):
(WebCore::InheritedFlags::initialTextEmphasisFill):
(WebCore::InheritedFlags::initialTextEmphasisMark):
(WebCore::InheritedFlags::initialTextEmphasisCustomMark):
(WebCore::InheritedFlags::initialTextEmphasisPosition):
(WebCore::InheritedFlags::textEmphasisColor):

  • rendering/style/RenderStyleConstants.h:
  • rendering/style/StyleRareInheritedData.cpp:

(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator==):

  • rendering/style/StyleRareInheritedData.h:

LayoutTests: Test parsing of the text-emphasis CSS properties
https://bugs.webkit.org/show_bug.cgi?id=48539

Reviewed by Dave Hyatt.

  • fast/css/parsing-text-emphasis-expected.txt: Added.
  • fast/css/parsing-text-emphasis.html: Added.
Location:
trunk
Files:
2 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r73218 r73219  
     12010-12-02  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Dave Hyatt.
     4
     5        Test parsing of the text-emphasis CSS properties
     6        https://bugs.webkit.org/show_bug.cgi?id=48539
     7
     8        * fast/css/parsing-text-emphasis-expected.txt: Added.
     9        * fast/css/parsing-text-emphasis.html: Added.
     10
    1112010-12-02  Victor Wang  <victorw@chromium.org>
    212
  • trunk/WebCore/ChangeLog

    r73217 r73219  
     12010-12-02  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Dave Hyatt.
     4
     5        CSS support for the text-emphasis properties
     6        https://bugs.webkit.org/show_bug.cgi?id=48539
     7
     8        Test: fast/css/parsing-text-emphasis.html
     9
     10        * css/CSSComputedStyleDeclaration.cpp:
     11        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Added text-emphasis-color,
     12        text-emphasis-position and text-emphasis-style. Left the text-emphasis shorthand unsupported.
     13        * css/CSSParser.cpp:
     14        (WebCore::CSSParser::parseValue): Parse the properties.
     15        (WebCore::CSSParser::parseTextEmphasisStyle): Added.
     16        * css/CSSParser.h:
     17        * css/CSSPrimitiveValueMappings.h:
     18        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Added TextEmphasisPosition, TextEmphasisFill
     19        and TextEmphasisMark mappings.
     20        (WebCore::CSSPrimitiveValue::operator TextEmphasisPosition): Added.
     21        (WebCore::CSSPrimitiveValue::operator TextEmphasisFill): Added.
     22        (WebCore::CSSPrimitiveValue::operator TextEmphasisMark): Added.
     23        * css/CSSPropertyLonghand.cpp:
     24        (WebCore::initShorthandMap): Added the text-emphasis shorthand.
     25        * css/CSSPropertyNames.in: Added -webkit-text-emphasis, -webkit-text-emphasis-color,
     26        -webkit-text-emphasis-position, and -webkit-text-emphasis-style.
     27        * css/CSSStyleSelector.cpp:
     28        (WebCore::isValidVisitedLinkProperty): Added text-emphasis-color.
     29        (WebCore::CSSStyleSelector::applyProperty): Handle the properties.
     30        * css/CSSValueKeywords.in: Added 'over' and 'under' for text-emphasis-position. Added 'dot',
     31        'double-circle', 'triangle', 'sesame', 'filled' and 'open' for text-emphasis-style.
     32        * rendering/style/RenderStyle.cpp:
     33        (WebCore::RenderStyle::colorIncludingFallback): Handle text-emphasis-color.
     34        (WebCore::RenderStyle::textEmphasisMark): Added. Maps the fake 'auto' value to 'dot' or
     35        'sesame' based on writing direction.
     36        * rendering/style/RenderStyle.h: Added accessors.
     37        (WebCore::InheritedFlags::textEmphasisFill):
     38        (WebCore::InheritedFlags::textEmphasisCustomMark):
     39        (WebCore::InheritedFlags::textEmphasisPosition):
     40        (WebCore::InheritedFlags::setTextEmphasisColor):
     41        (WebCore::InheritedFlags::setTextEmphasisFill):
     42        (WebCore::InheritedFlags::setTextEmphasisMark):
     43        (WebCore::InheritedFlags::setTextEmphasisCustomMark):
     44        (WebCore::InheritedFlags::setTextEmphasisPosition):
     45        (WebCore::InheritedFlags::initialTextEmphasisColor):
     46        (WebCore::InheritedFlags::initialTextEmphasisFill):
     47        (WebCore::InheritedFlags::initialTextEmphasisMark):
     48        (WebCore::InheritedFlags::initialTextEmphasisCustomMark):
     49        (WebCore::InheritedFlags::initialTextEmphasisPosition):
     50        (WebCore::InheritedFlags::textEmphasisColor):
     51        * rendering/style/RenderStyleConstants.h:
     52        * rendering/style/StyleRareInheritedData.cpp:
     53        (WebCore::StyleRareInheritedData::StyleRareInheritedData):
     54        (WebCore::StyleRareInheritedData::operator==):
     55        * rendering/style/StyleRareInheritedData.h:
     56
    1572010-12-02  Chris Marrin  <cmarrin@apple.com>
    258
  • trunk/WebCore/css/CSSComputedStyleDeclaration.cpp

    r72500 r73219  
    12191219        case CSSPropertyWebkitTextFillColor:
    12201220            return currentColorOrValidColor(style.get(), style->textFillColor());
     1221        case CSSPropertyWebkitTextEmphasisColor:
     1222            return currentColorOrValidColor(style.get(), style->textEmphasisColor());
     1223        case CSSPropertyWebkitTextEmphasisPosition:
     1224            return CSSPrimitiveValue::create(style->textEmphasisPosition());
     1225        case CSSPropertyWebkitTextEmphasisStyle:
     1226            switch (style->textEmphasisMark()) {
     1227            case TextEmphasisMarkNone:
     1228                return CSSPrimitiveValue::createIdentifier(CSSValueNone);
     1229            case TextEmphasisMarkCustom:
     1230                return CSSPrimitiveValue::create(style->textEmphasisCustomMark(), CSSPrimitiveValue::CSS_STRING);
     1231            case TextEmphasisMarkAuto:
     1232                ASSERT_NOT_REACHED();
     1233                // Fall through
     1234            case TextEmphasisMarkDot:
     1235            case TextEmphasisMarkCircle:
     1236            case TextEmphasisMarkDoubleCircle:
     1237            case TextEmphasisMarkTriangle:
     1238            case TextEmphasisMarkSesame: {
     1239                RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
     1240                list->append(CSSPrimitiveValue::create(style->textEmphasisFill()));
     1241                list->append(CSSPrimitiveValue::create(style->textEmphasisMark()));
     1242                return list.release();
     1243            }
     1244            }
    12211245        case CSSPropertyTextIndent:
    12221246            return CSSPrimitiveValue::create(style->textIndent());
     
    15561580
    15571581        /* Unimplemented CSS 3 properties (including CSS3 shorthand properties) */
     1582        case CSSPropertyWebkitTextEmphasis:
    15581583        case CSSPropertyTextLineThrough:
    15591584        case CSSPropertyTextLineThroughColor:
  • trunk/WebCore/css/CSSParser.cpp

    r72776 r73219  
    828828    case CSSPropertyTextOverlineColor:
    829829    case CSSPropertyWebkitColumnRuleColor:
     830    case CSSPropertyWebkitTextEmphasisColor:
    830831    case CSSPropertyWebkitTextFillColor:
    831832    case CSSPropertyWebkitTextStrokeColor:
     
    17821783            validPrimitive = true;
    17831784        break;
     1785
     1786    case CSSPropertyWebkitTextEmphasis: {
     1787        const int properties[] = { CSSPropertyWebkitTextEmphasisStyle, CSSPropertyWebkitTextEmphasisColor };
     1788        return parseShorthand(propId, properties, WTF_ARRAY_LENGTH(properties), important);
     1789    }
     1790
     1791    case CSSPropertyWebkitTextEmphasisPosition:
     1792        if (id == CSSValueOver || id == CSSValueUnder)
     1793            validPrimitive = true;
     1794        break;
     1795
     1796    case CSSPropertyWebkitTextEmphasisStyle:
     1797        return parseTextEmphasisStyle(important);
    17841798
    17851799#if ENABLE(SVG)
     
    50815095}
    50825096
     5097bool CSSParser::parseTextEmphasisStyle(bool important)
     5098{
     5099    unsigned valueListSize = m_valueList->size();
     5100
     5101    RefPtr<CSSPrimitiveValue> fill;
     5102    RefPtr<CSSPrimitiveValue> shape;
     5103
     5104    for (CSSParserValue* value = m_valueList->current(); value; value = m_valueList->next()) {
     5105        if (value->unit == CSSPrimitiveValue::CSS_STRING) {
     5106            if (fill || shape || (valueListSize != 1 && !inShorthand()))
     5107                return false;
     5108            addProperty(CSSPropertyWebkitTextEmphasisStyle, CSSPrimitiveValue::create(value->string, CSSPrimitiveValue::CSS_STRING), important);
     5109            m_valueList->next();
     5110            return true;
     5111        }
     5112
     5113        if (value->id == CSSValueNone) {
     5114            if (fill || shape || (valueListSize != 1 && !inShorthand()))
     5115                return false;
     5116            addProperty(CSSPropertyWebkitTextEmphasisStyle, CSSPrimitiveValue::createIdentifier(CSSValueNone), important);
     5117            m_valueList->next();
     5118            return true;
     5119        }
     5120
     5121        if (value->id == CSSValueOpen || value->id == CSSValueFilled) {
     5122            if (fill)
     5123                return false;
     5124            fill = CSSPrimitiveValue::createIdentifier(value->id);
     5125        } else if (value->id == CSSValueDot || value->id == CSSValueCircle || value->id == CSSValueDoubleCircle || value->id == CSSValueTriangle || value->id == CSSValueSesame) {
     5126            if (shape)
     5127                return false;
     5128            shape = CSSPrimitiveValue::createIdentifier(value->id);
     5129        } else if (!inShorthand())
     5130            return false;
     5131        else
     5132            break;
     5133    }
     5134
     5135    if (fill && shape) {
     5136        RefPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSeparated();
     5137        parsedValues->append(fill.release());
     5138        parsedValues->append(shape.release());
     5139        addProperty(CSSPropertyWebkitTextEmphasisStyle, parsedValues.release(), important);
     5140        return true;
     5141    }
     5142    if (fill) {
     5143        addProperty(CSSPropertyWebkitTextEmphasisStyle, fill.release(), important);
     5144        return true;
     5145    }
     5146    if (shape) {
     5147        addProperty(CSSPropertyWebkitTextEmphasisStyle, shape.release(), important);
     5148        return true;
     5149    }
     5150
     5151    return false;
     5152}
     5153
    50835154static inline int yyerror(const char*) { return 1; }
    50845155
  • trunk/WebCore/css/CSSParser.h

    r72776 r73219  
    162162        bool parsePerspectiveOrigin(int propId, int& propId1, int& propId2,  RefPtr<CSSValue>&, RefPtr<CSSValue>&);
    163163
     164        bool parseTextEmphasisStyle(bool important);
     165
    164166        int yyparse();
    165167
  • trunk/WebCore/css/CSSPrimitiveValueMappings.h

    r71218 r73219  
    20732073}
    20742074
     2075template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisPosition position)
     2076    : m_type(CSS_IDENT)
     2077    , m_hasCachedCSSText(false)
     2078{
     2079    switch (position) {
     2080    case TextEmphasisPositionOver:
     2081        m_value.ident = CSSValueOver;
     2082        break;
     2083    case TextEmphasisPositionUnder:
     2084        m_value.ident = CSSValueUnder;
     2085        break;
     2086    }
     2087}
     2088
     2089template<> inline CSSPrimitiveValue::operator TextEmphasisPosition() const
     2090{
     2091    switch (m_value.ident) {
     2092    case CSSValueOver:
     2093        return TextEmphasisPositionOver;
     2094    case CSSValueUnder:
     2095        return TextEmphasisPositionUnder;
     2096    default:
     2097        ASSERT_NOT_REACHED();
     2098        return TextEmphasisPositionOver;
     2099    }
     2100}
     2101
     2102template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisFill fill)
     2103    : m_type(CSS_IDENT)
     2104    , m_hasCachedCSSText(false)
     2105{
     2106    switch (fill) {
     2107    case TextEmphasisFillFilled:
     2108        m_value.ident = CSSValueFilled;
     2109        break;
     2110    case TextEmphasisFillOpen:
     2111        m_value.ident = CSSValueOpen;
     2112        break;
     2113    }
     2114}
     2115
     2116template<> inline CSSPrimitiveValue::operator TextEmphasisFill() const
     2117{
     2118    switch (m_value.ident) {
     2119    case CSSValueFilled:
     2120        return TextEmphasisFillFilled;
     2121    case CSSValueOpen:
     2122        return TextEmphasisFillOpen;
     2123    default:
     2124        ASSERT_NOT_REACHED();
     2125        return TextEmphasisFillFilled;
     2126    }
     2127}
     2128
     2129template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisMark mark)
     2130    : m_type(CSS_IDENT)
     2131    , m_hasCachedCSSText(false)
     2132{
     2133    switch (mark) {
     2134    case TextEmphasisMarkDot:
     2135        m_value.ident = CSSValueDot;
     2136        break;
     2137    case TextEmphasisMarkCircle:
     2138        m_value.ident = CSSValueCircle;
     2139        break;
     2140    case TextEmphasisMarkDoubleCircle:
     2141        m_value.ident = CSSValueDoubleCircle;
     2142        break;
     2143    case TextEmphasisMarkTriangle:
     2144        m_value.ident = CSSValueTriangle;
     2145        break;
     2146    case TextEmphasisMarkSesame:
     2147        m_value.ident = CSSValueSesame;
     2148        break;
     2149    case TextEmphasisMarkNone:
     2150    case TextEmphasisMarkAuto:
     2151    case TextEmphasisMarkCustom:
     2152        ASSERT_NOT_REACHED();
     2153        m_value.ident = CSSValueNone;
     2154        break;
     2155    }
     2156}
     2157
     2158template<> inline CSSPrimitiveValue::operator TextEmphasisMark() const
     2159{
     2160    switch (m_value.ident) {
     2161    case CSSValueNone:
     2162        return TextEmphasisMarkNone;
     2163    case CSSValueDot:
     2164        return TextEmphasisMarkDot;
     2165    case CSSValueCircle:
     2166        return TextEmphasisMarkCircle;
     2167    case CSSValueDoubleCircle:
     2168        return TextEmphasisMarkDoubleCircle;
     2169    case CSSValueTriangle:
     2170        return TextEmphasisMarkTriangle;
     2171    case CSSValueSesame:
     2172        return TextEmphasisMarkSesame;
     2173    default:
     2174        ASSERT_NOT_REACHED();
     2175        return TextEmphasisMarkNone;
     2176    }
     2177}
     2178
    20752179template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPointerEvents e)
    20762180    : m_type(CSS_IDENT)
  • trunk/WebCore/css/CSSPropertyLonghand.cpp

    r72500 r73219  
    208208    SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSSPropertyWebkitTransformOrigin, transformOriginProperties);
    209209   
     210    static const int textEmphasisProperties[] = {
     211        CSSPropertyWebkitTextEmphasisColor,
     212        CSSPropertyWebkitTextEmphasisStyle
     213    };
     214    SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSSPropertyWebkitTextEmphasis, textEmphasisProperties);
     215   
    210216    #undef SET_SHORTHAND_MAP_ENTRY
    211217}
  • trunk/WebCore/css/CSSPropertyNames.in

    r72116 r73219  
    279279-webkit-text-combine
    280280-webkit-text-decorations-in-effect
     281-webkit-text-emphasis
     282-webkit-text-emphasis-color
     283-webkit-text-emphasis-position
     284-webkit-text-emphasis-style
    281285-webkit-text-fill-color
    282286-webkit-text-security
  • trunk/WebCore/css/CSSStyleSelector.cpp

    r72814 r73219  
    30353035        case CSSPropertyOutlineColor:
    30363036        case CSSPropertyWebkitColumnRuleColor:
     3037        case CSSPropertyWebkitTextEmphasisColor:
    30373038        case CSSPropertyWebkitTextFillColor:
    30383039        case CSSPropertyWebkitTextStrokeColor:
     
    35123513    case CSSPropertyWebkitColumnRuleColor:
    35133514    case CSSPropertyWebkitTextStrokeColor:
     3515    case CSSPropertyWebkitTextEmphasisColor:
    35143516    case CSSPropertyWebkitTextFillColor: {
    35153517        Color col;
     
    35243526            HANDLE_INHERIT_COND_WITH_BACKUP(CSSPropertyWebkitColumnRuleColor, columnRuleColor, color, ColumnRuleColor)
    35253527            HANDLE_INHERIT_COND_WITH_BACKUP(CSSPropertyWebkitTextStrokeColor, textStrokeColor, color, TextStrokeColor)
     3528            HANDLE_INHERIT_COND_WITH_BACKUP(CSSPropertyWebkitTextEmphasisColor, textEmphasisColor, color, TextEmphasisColor)
    35263529            HANDLE_INHERIT_COND_WITH_BACKUP(CSSPropertyWebkitTextFillColor, textFillColor, color, TextFillColor)
    35273530            return;
     
    35663569        case CSSPropertyWebkitTextStrokeColor:
    35673570            m_style->setTextStrokeColor(col);
     3571            break;
     3572        case CSSPropertyWebkitTextEmphasisColor:
     3573            m_style->setTextEmphasisColor(col);
    35683574            break;
    35693575        case CSSPropertyWebkitTextFillColor:
     
    55235529    case CSSPropertyWebkitTextDecorationsInEffect:
    55245530    case CSSPropertyWebkitTextStroke:
     5531    case CSSPropertyWebkitTextEmphasis:
    55255532        return;
    55265533#if ENABLE(WCSS)
     
    55555562    case CSSPropertyWebkitTextCombine:
    55565563        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(textCombine, TextCombine)
     5564        return;
     5565
     5566    case CSSPropertyWebkitTextEmphasisPosition:
     5567        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(textEmphasisPosition, TextEmphasisPosition)
     5568        return;
     5569
     5570    case CSSPropertyWebkitTextEmphasisStyle:
     5571        HANDLE_INHERIT_AND_INITIAL(textEmphasisFill, TextEmphasisFill)
     5572        HANDLE_INHERIT_AND_INITIAL(textEmphasisMark, TextEmphasisMark)
     5573        HANDLE_INHERIT_AND_INITIAL(textEmphasisCustomMark, TextEmphasisCustomMark)
     5574        if (isInherit || isInitial)
     5575            return;
     5576
     5577        if (value->isValueList()) {
     5578            CSSValueList* list = static_cast<CSSValueList*>(value);
     5579            ASSERT(list->length() == 2);
     5580            if (list->length() != 2)
     5581                return;
     5582            for (unsigned i = 0; i < 2; ++i) {
     5583                ASSERT(list->itemWithoutBoundsCheck(i)->isPrimitiveValue());
     5584                CSSPrimitiveValue* value = static_cast<CSSPrimitiveValue*>(list->itemWithoutBoundsCheck(i));
     5585                if (value->getIdent() == CSSValueFilled || value->getIdent() == CSSValueOpen)
     5586                    m_style->setTextEmphasisFill(*value);
     5587                else
     5588                    m_style->setTextEmphasisMark(*value);
     5589            }
     5590            m_style->setTextEmphasisCustomMark(nullAtom);
     5591            return;
     5592        }
     5593
     5594        if (!primitiveValue)
     5595            return;
     5596
     5597        if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_STRING) {
     5598            m_style->setTextEmphasisFill(TextEmphasisFillFilled);
     5599            m_style->setTextEmphasisMark(TextEmphasisMarkCustom);
     5600            m_style->setTextEmphasisCustomMark(primitiveValue->getStringValue());
     5601            return;
     5602        }
     5603
     5604        m_style->setTextEmphasisCustomMark(nullAtom);
     5605
     5606        if (primitiveValue->getIdent() == CSSValueFilled || primitiveValue->getIdent() == CSSValueOpen) {
     5607            m_style->setTextEmphasisFill(*primitiveValue);
     5608            m_style->setTextEmphasisMark(TextEmphasisMarkAuto);
     5609        } else {
     5610            m_style->setTextEmphasisFill(TextEmphasisFillFilled);
     5611            m_style->setTextEmphasisMark(*primitiveValue);
     5612        }
     5613
    55575614        return;
    55585615
  • trunk/WebCore/css/CSSValueKeywords.in

    r71218 r73219  
    769769cluster
    770770upright
     771
     772# -webkit-text-emphasis-position
     773over
     774under
     775
     776# -webkit-text-emphasis-style
     777filled
     778open
     779dot
     780# circle
     781double-circle
     782triangle
     783sesame
  • trunk/WebCore/rendering/style/RenderStyle.cpp

    r71700 r73219  
    403403            rareInheritedData->hyphens != other->rareInheritedData->hyphens ||
    404404            rareInheritedData->hyphenationString != other->rareInheritedData->hyphenationString ||
    405             rareInheritedData->hyphenationLocale != other->rareInheritedData->hyphenationLocale)
     405            rareInheritedData->hyphenationLocale != other->rareInheritedData->hyphenationLocale ||
     406            rareInheritedData->textEmphasisMark != other->rareInheritedData->textEmphasisMark ||
     407            rareInheritedData->textEmphasisPosition != other->rareInheritedData->textEmphasisPosition ||
     408            rareInheritedData->textEmphasisCustomMark != other->rareInheritedData->textEmphasisCustomMark)
    406409            return StyleDifferenceLayout;
    407410
     
    554557        rareNonInheritedData->m_borderFit != other->rareNonInheritedData->m_borderFit ||
    555558        rareInheritedData->textFillColor != other->rareInheritedData->textFillColor ||
    556         rareInheritedData->textStrokeColor != other->rareInheritedData->textStrokeColor)
     559        rareInheritedData->textStrokeColor != other->rareInheritedData->textStrokeColor ||
     560        rareInheritedData->textEmphasisColor != other->rareInheritedData->textEmphasisColor ||
     561        rareInheritedData->textEmphasisFill != other->rareInheritedData->textEmphasisFill)
    557562        return StyleDifferenceRepaint;
    558563
     
    10681073        result = columnRuleColor();
    10691074        break;
     1075    case CSSPropertyWebkitTextEmphasisColor:
     1076        result = textEmphasisColor();
     1077        break;
    10701078    case CSSPropertyWebkitTextFillColor:
    10711079        result = textFillColor();
     
    14091417}
    14101418
     1419TextEmphasisMark RenderStyle::textEmphasisMark() const
     1420{
     1421    TextEmphasisMark mark = static_cast<TextEmphasisMark>(rareInheritedData->textEmphasisMark);
     1422    if (mark != TextEmphasisMarkAuto)
     1423        return mark;
     1424
     1425    if (isHorizontalWritingMode())
     1426        return TextEmphasisMarkDot;
     1427
     1428    return TextEmphasisMarkSesame;
     1429}
     1430
    14111431} // namespace WebCore
  • trunk/WebCore/rendering/style/RenderStyle.h

    r73189 r73219  
    714714    float transformOriginZ() const { return rareNonInheritedData->m_transform->m_z; }
    715715    bool hasTransform() const { return !rareNonInheritedData->m_transform->m_operations.operations().isEmpty(); }
     716
     717    TextEmphasisFill textEmphasisFill() const { return static_cast<TextEmphasisFill>(rareInheritedData->textEmphasisFill); }
     718    TextEmphasisMark textEmphasisMark() const;
     719    const AtomicString& textEmphasisCustomMark() const { return rareInheritedData->textEmphasisCustomMark; }
     720    TextEmphasisPosition textEmphasisPosition() const { return static_cast<TextEmphasisPosition>(rareInheritedData->textEmphasisPosition); }
    716721   
    717722    // Return true if any transform related property (currently transform, transformStyle3D or perspective)
     
    10651070    void setSpeak(ESpeak s) { SET_VAR(rareInheritedData, speak, s); }
    10661071    void setTextCombine(TextCombine v) { SET_VAR(rareNonInheritedData, m_textCombine, v); }
     1072    void setTextEmphasisColor(const Color& c) { SET_VAR(rareInheritedData, textEmphasisColor, c) }
     1073    void setTextEmphasisFill(TextEmphasisFill fill) { SET_VAR(rareInheritedData, textEmphasisFill, fill); }
     1074    void setTextEmphasisMark(TextEmphasisMark mark) { SET_VAR(rareInheritedData, textEmphasisMark, mark); }
     1075    void setTextEmphasisCustomMark(const AtomicString& mark) { SET_VAR(rareInheritedData, textEmphasisCustomMark, mark); }
     1076    void setTextEmphasisPosition(TextEmphasisPosition position) { SET_VAR(rareInheritedData, textEmphasisPosition, position); }
    10671077    // End CSS3 Setters
    10681078
     
    12771287    static Length initialPerspectiveOriginY() { return Length(50.0, Percent); }
    12781288    static Color initialBackgroundColor() { return Color::transparent; }
     1289    static Color initialTextEmphasisColor() { return TextEmphasisFillFilled; }
     1290    static TextEmphasisFill initialTextEmphasisFill() { return TextEmphasisFillFilled; }
     1291    static TextEmphasisMark initialTextEmphasisMark() { return TextEmphasisMarkNone; }
     1292    static const AtomicString& initialTextEmphasisCustomMark() { return nullAtom; }
     1293    static TextEmphasisPosition initialTextEmphasisPosition() { return TextEmphasisPositionOver; }
    12791294
    12801295    // Keep these at the end.
     
    13091324    const Color& columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color(); }
    13101325    const Color& outlineColor() const { return m_background->outline().color(); }
     1326    const Color& textEmphasisColor() const { return rareInheritedData->textEmphasisColor; }
    13111327    const Color& textFillColor() const { return rareInheritedData->textFillColor; }
    13121328    const Color& textStrokeColor() const { return rareInheritedData->textStrokeColor; }
  • trunk/WebCore/rendering/style/RenderStyleConstants.h

    r71218 r73219  
    421421
    422422enum ESpeak { SpeakNone, SpeakNormal, SpeakSpellOut, SpeakDigits, SpeakLiteralPunctuation, SpeakNoPunctuation };
    423    
     423
     424enum TextEmphasisFill { TextEmphasisFillFilled, TextEmphasisFillOpen };
     425
     426enum TextEmphasisMark { TextEmphasisMarkNone, TextEmphasisMarkAuto, TextEmphasisMarkDot, TextEmphasisMarkCircle, TextEmphasisMarkDoubleCircle, TextEmphasisMarkTriangle, TextEmphasisMarkSesame, TextEmphasisMarkCustom };
     427
     428enum TextEmphasisPosition { TextEmphasisPositionOver, TextEmphasisPositionUnder };
     429
    424430} // namespace WebCore
    425431
  • trunk/WebCore/rendering/style/StyleRareInheritedData.cpp

    r70143 r73219  
    4747    , speak(SpeakNormal)
    4848    , hyphens(HyphensManual)
     49    , textEmphasisFill(TextEmphasisFillFilled)
     50    , textEmphasisMark(TextEmphasisMarkNone)
     51    , textEmphasisPosition(TextEmphasisPositionOver)
    4952{
    5053}
     
    5558    , textStrokeWidth(o.textStrokeWidth)
    5659    , textFillColor(o.textFillColor)
     60    , textEmphasisColor(o.textEmphasisColor)
    5761    , textShadow(o.textShadow ? new ShadowData(*o.textShadow) : 0)
    5862    , highlight(o.highlight)
     
    7478    , speak(o.speak)
    7579    , hyphens(o.hyphens)
     80    , textEmphasisFill(o.textEmphasisFill)
     81    , textEmphasisMark(o.textEmphasisMark)
     82    , textEmphasisPosition(o.textEmphasisPosition)
    7683    , hyphenationString(o.hyphenationString)
    7784    , hyphenationLocale(o.hyphenationLocale)
     85    , textEmphasisCustomMark(o.textEmphasisCustomMark)
    7886{
    7987}
     
    98106        && textStrokeWidth == o.textStrokeWidth
    99107        && textFillColor == o.textFillColor
     108        && textEmphasisColor == o.textEmphasisColor
    100109        && shadowDataEquivalent(o)
    101110        && highlight == o.highlight
     
    117126        && speak == o.speak
    118127        && hyphens == o.hyphens
     128        && textEmphasisFill == o.textEmphasisFill
     129        && textEmphasisMark == o.textEmphasisMark
     130        && textEmphasisPosition == o.textEmphasisPosition
    119131        && hyphenationString == o.hyphenationString
    120         && hyphenationLocale == o.hyphenationLocale;
     132        && hyphenationLocale == o.hyphenationLocale
     133        && textEmphasisCustomMark == o.textEmphasisCustomMark;
    121134}
    122135
  • trunk/WebCore/rendering/style/StyleRareInheritedData.h

    r68680 r73219  
    5656    float textStrokeWidth;
    5757    Color textFillColor;
     58    Color textEmphasisColor;
    5859
    5960    ShadowData* textShadow; // Our text shadow information for shadowed text drawing.
     
    8081    unsigned speak : 3; // ESpeak
    8182    unsigned hyphens : 2; // Hyphens
     83    unsigned textEmphasisFill : 1; // TextEmphasisFill
     84    unsigned textEmphasisMark : 3; // TextEmphasisMark
     85    unsigned textEmphasisPosition : 1; // TextEmphasisPosition
    8286
    8387    AtomicString hyphenationString;
    8488    AtomicString hyphenationLocale;
     89
     90    AtomicString textEmphasisCustomMark;
    8591
    8692private:
Note: See TracChangeset for help on using the changeset viewer.