Changeset 97638 in webkit


Ignore:
Timestamp:
Oct 17, 2011 12:49:07 PM (13 years ago)
Author:
Antti Koivisto
Message:

https://bugs.webkit.org/show_bug.cgi?id=69966
Eliminate separate RenderStyle for visited link style

Reviewed by Dave Hyatt and Nikolas Zimmermann.

There are only a few properties that can apply to visited links and they can
be part of the regular style. Many things will get simpler when the separate
RenderStyle for visited links is eliminated.

  • Add valid visited link properties as separate fields to RenderStyle. The visitedLinkColor goes to inherited, everything else goes to rare data structures.
  • Make RenderStyle::visitedDependentColor() get the visited style from the new fields.
  • As VISITED_LINK pseudo style doesn't exists anymore, remove all code dealing with it.
  • Make CSSStyleSelector and ApplyPropertyColor apply the visited link style to the newly added fields instead of a separate RenderStyle.
  • Same thing with SVGRenderStyle, SVGCSSStyleSelector.
  • Fixup the SVG visited link style code to use the new fields.

This is ~15% progression in styleForElement performance over the HTML5 spec load.

  • css/CSSStyleApplyProperty.cpp:

(WebCore::ApplyPropertyColor::ApplyPropertyColor):
(WebCore::ApplyPropertyColor::applyInheritValue):
(WebCore::ApplyPropertyColor::applyInitialValue):
(WebCore::ApplyPropertyColor::applyValue):
(WebCore::ApplyPropertyColor::applyColorValue):
(WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):

  • css/CSSStyleSelector.cpp:

(WebCore::CSSStyleSelector::CSSStyleSelector):
(WebCore::CSSStyleSelector::styleForElement):
(WebCore::CSSStyleSelector::pseudoStyleForElement):
(WebCore::CSSStyleSelector::updateFont):
(WebCore::CSSStyleSelector::applyDeclaration):
(WebCore::CSSStyleSelector::applyDeclarations):
(WebCore::CSSStyleSelector::applyProperty):
(WebCore::CSSStyleSelector::getColorFromPrimitiveValue):

  • css/CSSStyleSelector.h:

(WebCore::CSSStyleSelector::applyPropertyToRegularStyle):
(WebCore::CSSStyleSelector::applyPropertyToVisitedLinkStyle):

  • css/SVGCSSStyleSelector.cpp:

(WebCore::CSSStyleSelector::applySVGProperty):

  • dom/Element.cpp:

(WebCore::Element::pseudoStyleCacheIsInvalid):

  • rendering/style/RenderStyle.cpp:

(WebCore::RenderStyle::getCachedPseudoStyle):
(WebCore::RenderStyle::colorIncludingFallback):
(WebCore::RenderStyle::visitedDependentColor):

  • rendering/style/RenderStyle.h:

(WebCore::InheritedFlags::setVisitedLinkColor):
(WebCore::InheritedFlags::setVisitedLinkBackgroundColor):
(WebCore::InheritedFlags::setVisitedLinkBorderLeftColor):
(WebCore::InheritedFlags::setVisitedLinkBorderRightColor):
(WebCore::InheritedFlags::setVisitedLinkBorderBottomColor):
(WebCore::InheritedFlags::setVisitedLinkBorderTopColor):
(WebCore::InheritedFlags::setVisitedLinkOutlineColor):
(WebCore::InheritedFlags::setVisitedLinkColumnRuleColor):
(WebCore::InheritedFlags::setVisitedLinkTextEmphasisColor):
(WebCore::InheritedFlags::setVisitedLinkTextFillColor):
(WebCore::InheritedFlags::setVisitedLinkTextStrokeColor):

  • rendering/style/RenderStyleConstants.h:
  • rendering/style/SVGRenderStyle.h:

(WebCore::SVGRenderStyle::setVisitedLinkFillPaint):
(WebCore::SVGRenderStyle::setVisitedLinkStrokePaint):
(WebCore::SVGRenderStyle::visitedLinkFillPaintType):
(WebCore::SVGRenderStyle::visitedLinkFillPaintColor):
(WebCore::SVGRenderStyle::visitedLinkStrokePaintType):
(WebCore::SVGRenderStyle::visitedLinkStrokePaintColor):

  • rendering/style/SVGRenderStyleDefs.cpp:

(WebCore::StyleFillData::StyleFillData):
(WebCore::StyleFillData::operator==):
(WebCore::StyleStrokeData::StyleStrokeData):
(WebCore::StyleStrokeData::operator==):

  • rendering/style/SVGRenderStyleDefs.h:
  • rendering/style/StyleInheritedData.cpp:

(WebCore::StyleInheritedData::StyleInheritedData):
(WebCore::StyleInheritedData::operator==):

  • rendering/style/StyleInheritedData.h:
  • rendering/style/StyleMultiColData.cpp:

(WebCore::StyleMultiColData::StyleMultiColData):
(WebCore::StyleMultiColData::operator==):

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

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

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

(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator==):

  • rendering/style/StyleRareNonInheritedData.h:
  • rendering/svg/RenderSVGResource.cpp:

(WebCore::requestPaintingResource):

Location:
trunk/Source/WebCore
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r97637 r97638  
     12011-10-17  Antti Koivisto  <antti@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=69966
     4        Eliminate separate RenderStyle for visited link style
     5
     6        Reviewed by Dave Hyatt and Nikolas Zimmermann.
     7
     8        There are only a few properties that can apply to visited links and they can
     9        be part of the regular style. Many things will get simpler when the separate
     10        RenderStyle for visited links is eliminated.
     11       
     12        - Add valid visited link properties as separate fields to RenderStyle. The 
     13          visitedLinkColor goes to inherited, everything else goes to rare data structures.
     14        - Make RenderStyle::visitedDependentColor() get the visited style from the new fields.
     15        - As VISITED_LINK pseudo style doesn't exists anymore, remove all code dealing with it.
     16        - Make CSSStyleSelector and ApplyPropertyColor apply the visited link style to the
     17          newly added fields instead of a separate RenderStyle.
     18        - Same thing with SVGRenderStyle, SVGCSSStyleSelector.
     19        - Fixup the SVG visited link style code to use the new fields.
     20
     21        This is ~15% progression in styleForElement performance over the HTML5 spec load.
     22
     23        * css/CSSStyleApplyProperty.cpp:
     24        (WebCore::ApplyPropertyColor::ApplyPropertyColor):
     25        (WebCore::ApplyPropertyColor::applyInheritValue):
     26        (WebCore::ApplyPropertyColor::applyInitialValue):
     27        (WebCore::ApplyPropertyColor::applyValue):
     28        (WebCore::ApplyPropertyColor::applyColorValue):
     29        (WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):
     30        * css/CSSStyleSelector.cpp:
     31        (WebCore::CSSStyleSelector::CSSStyleSelector):
     32        (WebCore::CSSStyleSelector::styleForElement):
     33        (WebCore::CSSStyleSelector::pseudoStyleForElement):
     34        (WebCore::CSSStyleSelector::updateFont):
     35        (WebCore::CSSStyleSelector::applyDeclaration):
     36        (WebCore::CSSStyleSelector::applyDeclarations):
     37        (WebCore::CSSStyleSelector::applyProperty):
     38        (WebCore::CSSStyleSelector::getColorFromPrimitiveValue):
     39        * css/CSSStyleSelector.h:
     40        (WebCore::CSSStyleSelector::applyPropertyToRegularStyle):
     41        (WebCore::CSSStyleSelector::applyPropertyToVisitedLinkStyle):
     42        * css/SVGCSSStyleSelector.cpp:
     43        (WebCore::CSSStyleSelector::applySVGProperty):
     44        * dom/Element.cpp:
     45        (WebCore::Element::pseudoStyleCacheIsInvalid):
     46        * rendering/style/RenderStyle.cpp:
     47        (WebCore::RenderStyle::getCachedPseudoStyle):
     48        (WebCore::RenderStyle::colorIncludingFallback):
     49        (WebCore::RenderStyle::visitedDependentColor):
     50        * rendering/style/RenderStyle.h:
     51        (WebCore::InheritedFlags::setVisitedLinkColor):
     52        (WebCore::InheritedFlags::setVisitedLinkBackgroundColor):
     53        (WebCore::InheritedFlags::setVisitedLinkBorderLeftColor):
     54        (WebCore::InheritedFlags::setVisitedLinkBorderRightColor):
     55        (WebCore::InheritedFlags::setVisitedLinkBorderBottomColor):
     56        (WebCore::InheritedFlags::setVisitedLinkBorderTopColor):
     57        (WebCore::InheritedFlags::setVisitedLinkOutlineColor):
     58        (WebCore::InheritedFlags::setVisitedLinkColumnRuleColor):
     59        (WebCore::InheritedFlags::setVisitedLinkTextEmphasisColor):
     60        (WebCore::InheritedFlags::setVisitedLinkTextFillColor):
     61        (WebCore::InheritedFlags::setVisitedLinkTextStrokeColor):
     62        * rendering/style/RenderStyleConstants.h:
     63        * rendering/style/SVGRenderStyle.h:
     64        (WebCore::SVGRenderStyle::setVisitedLinkFillPaint):
     65        (WebCore::SVGRenderStyle::setVisitedLinkStrokePaint):
     66        (WebCore::SVGRenderStyle::visitedLinkFillPaintType):
     67        (WebCore::SVGRenderStyle::visitedLinkFillPaintColor):
     68        (WebCore::SVGRenderStyle::visitedLinkStrokePaintType):
     69        (WebCore::SVGRenderStyle::visitedLinkStrokePaintColor):
     70        * rendering/style/SVGRenderStyleDefs.cpp:
     71        (WebCore::StyleFillData::StyleFillData):
     72        (WebCore::StyleFillData::operator==):
     73        (WebCore::StyleStrokeData::StyleStrokeData):
     74        (WebCore::StyleStrokeData::operator==):
     75        * rendering/style/SVGRenderStyleDefs.h:
     76        * rendering/style/StyleInheritedData.cpp:
     77        (WebCore::StyleInheritedData::StyleInheritedData):
     78        (WebCore::StyleInheritedData::operator==):
     79        * rendering/style/StyleInheritedData.h:
     80        * rendering/style/StyleMultiColData.cpp:
     81        (WebCore::StyleMultiColData::StyleMultiColData):
     82        (WebCore::StyleMultiColData::operator==):
     83        * rendering/style/StyleMultiColData.h:
     84        * rendering/style/StyleRareInheritedData.cpp:
     85        (WebCore::StyleRareInheritedData::StyleRareInheritedData):
     86        (WebCore::StyleRareInheritedData::operator==):
     87        * rendering/style/StyleRareInheritedData.h:
     88        * rendering/style/StyleRareNonInheritedData.cpp:
     89        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
     90        (WebCore::StyleRareNonInheritedData::operator==):
     91        * rendering/style/StyleRareNonInheritedData.h:
     92        * rendering/svg/RenderSVGResource.cpp:
     93        (WebCore::requestPaintingResource):
     94
    1952011-10-17  Eric Carlson  <eric.carlson@apple.com>
    296
  • trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp

    r97046 r97638  
    225225    typedef Color (*InitialFunction)();
    226226
    227     ApplyPropertyColor(GetterFunction getter, SetterFunction setter, DefaultFunction defaultFunction, InitialFunction initialFunction = 0)
     227    ApplyPropertyColor(GetterFunction getter, SetterFunction setter, SetterFunction visitedLinkSetter, DefaultFunction defaultFunction, InitialFunction initialFunction = 0)
    228228        : m_getter(getter)
    229229        , m_setter(setter)
     230        , m_visitedLinkSetter(visitedLinkSetter)
    230231        , m_default(defaultFunction)
    231232        , m_initial(initialFunction)
     
    236237    virtual void applyInheritValue(CSSStyleSelector* selector) const
    237238    {
     239        // Visited link style can never explicitly inherit from parent visited link style so no separate getters are needed.
    238240        const Color& color = (selector->parentStyle()->*m_getter)();
    239241        if (m_default && !color.isValid())
    240             (selector->style()->*m_setter)((selector->parentStyle()->*m_default)());
     242            applyColorValue(selector, (selector->parentStyle()->*m_default)());
    241243        else
    242             (selector->style()->*m_setter)(color);
     244            applyColorValue(selector, color);
    243245    }
    244246
    245247    virtual void applyInitialValue(CSSStyleSelector* selector) const
    246248    {
    247         (selector->style()->*m_setter)(m_initial ? m_initial() : Color());
     249        applyColorValue(selector, m_initial ? m_initial() : Color());
    248250    }
    249251
     
    256258        if (inheritColorFromParent && primitiveValue->getIdent() == CSSValueCurrentcolor)
    257259            applyInheritValue(selector);
    258         else
    259             (selector->style()->*m_setter)(selector->getColorFromPrimitiveValue(primitiveValue));
     260        else {
     261            if (selector->applyPropertyToRegularStyle())
     262                (selector->style()->*m_setter)(selector->getColorFromPrimitiveValue(primitiveValue, false));
     263            if (selector->applyPropertyToVisitedLinkStyle() && m_visitedLinkSetter)
     264                (selector->style()->*m_visitedLinkSetter)(selector->getColorFromPrimitiveValue(primitiveValue, true));
     265        }
     266    }
     267   
     268    void applyColorValue(CSSStyleSelector* selector, const Color& color) const
     269    {
     270        if (selector->applyPropertyToRegularStyle())
     271            (selector->style()->*m_setter)(color);
     272        if (selector->applyPropertyToVisitedLinkStyle() && m_visitedLinkSetter)
     273            (selector->style()->*m_visitedLinkSetter)(color);
    260274    }
    261275
    262276    GetterFunction m_getter;
    263277    SetterFunction m_setter;
     278    SetterFunction m_visitedLinkSetter;
    264279    DefaultFunction m_default;
    265280    InitialFunction m_initial;
     
    894909       m_propertyMap[i] = 0;
    895910
    896     setPropertyHandler(CSSPropertyColor, new ApplyPropertyColor<InheritFromParent>(&RenderStyle::color, &RenderStyle::setColor, 0, RenderStyle::initialColor));
     911    setPropertyHandler(CSSPropertyColor, new ApplyPropertyColor<InheritFromParent>(&RenderStyle::color, &RenderStyle::setColor,  &RenderStyle::setVisitedLinkColor, 0, RenderStyle::initialColor));
    897912    setPropertyHandler(CSSPropertyDirection, new ApplyPropertyDirection(&RenderStyle::direction, &RenderStyle::setDirection, RenderStyle::initialDirection));
    898913
     
    955970    setPropertyHandler(CSSPropertyWebkitMaskRepeat, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBackgroundRepeatX), propertyHandler(CSSPropertyBackgroundRepeatY)));
    956971
    957     setPropertyHandler(CSSPropertyBackgroundColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::backgroundColor, &RenderStyle::setBackgroundColor, 0));
    958     setPropertyHandler(CSSPropertyBorderBottomColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::borderBottomColor, &RenderStyle::setBorderBottomColor, &RenderStyle::color));
    959     setPropertyHandler(CSSPropertyBorderLeftColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::borderLeftColor, &RenderStyle::setBorderLeftColor, &RenderStyle::color));
    960     setPropertyHandler(CSSPropertyBorderRightColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::borderRightColor, &RenderStyle::setBorderRightColor, &RenderStyle::color));
    961     setPropertyHandler(CSSPropertyBorderTopColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::borderTopColor, &RenderStyle::setBorderTopColor, &RenderStyle::color));
     972    setPropertyHandler(CSSPropertyBackgroundColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::backgroundColor, &RenderStyle::setBackgroundColor, &RenderStyle::setVisitedLinkBackgroundColor, 0));
     973    setPropertyHandler(CSSPropertyBorderBottomColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::borderBottomColor, &RenderStyle::setBorderBottomColor, &RenderStyle::setVisitedLinkBorderBottomColor, &RenderStyle::color));
     974    setPropertyHandler(CSSPropertyBorderLeftColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::borderLeftColor, &RenderStyle::setBorderLeftColor, &RenderStyle::setVisitedLinkBorderLeftColor, &RenderStyle::color));
     975    setPropertyHandler(CSSPropertyBorderRightColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::borderRightColor, &RenderStyle::setBorderRightColor, &RenderStyle::setVisitedLinkBorderRightColor, &RenderStyle::color));
     976    setPropertyHandler(CSSPropertyBorderTopColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::borderTopColor, &RenderStyle::setBorderTopColor, &RenderStyle::setVisitedLinkBorderTopColor, &RenderStyle::color));
    962977
    963978    setPropertyHandler(CSSPropertyBorderTopStyle, new ApplyPropertyDefault<EBorderStyle>(&RenderStyle::borderTopStyle, &RenderStyle::setBorderTopStyle, &RenderStyle::initialBorderStyle));
     
    10171032
    10181033    setPropertyHandler(CSSPropertyOutlineStyle, new ApplyPropertyExpanding<ExpandValue>(new ApplyPropertyDefault<OutlineIsAuto>(&RenderStyle::outlineStyleIsAuto, &RenderStyle::setOutlineStyleIsAuto, &RenderStyle::initialOutlineStyleIsAuto), new ApplyPropertyDefault<EBorderStyle>(&RenderStyle::outlineStyle, &RenderStyle::setOutlineStyle, &RenderStyle::initialBorderStyle)));
    1019     setPropertyHandler(CSSPropertyOutlineColor, new ApplyPropertyColor<InheritFromParent>(&RenderStyle::outlineColor, &RenderStyle::setOutlineColor, &RenderStyle::color));
     1034    setPropertyHandler(CSSPropertyOutlineColor, new ApplyPropertyColor<InheritFromParent>(&RenderStyle::outlineColor, &RenderStyle::setOutlineColor, &RenderStyle::setVisitedLinkOutlineColor, &RenderStyle::color));
    10201035    setPropertyHandler(CSSPropertyOutlineOffset, new ApplyPropertyComputeLength<int>(&RenderStyle::outlineOffset, &RenderStyle::setOutlineOffset, &RenderStyle::initialOutlineOffset));
    10211036
     
    10241039    setPropertyHandler(CSSPropertyOverflow, new ApplyPropertyExpanding<ExpandValue>(propertyHandler(CSSPropertyOverflowX), propertyHandler(CSSPropertyOverflowY)));
    10251040
    1026     setPropertyHandler(CSSPropertyWebkitColumnRuleColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::columnRuleColor, &RenderStyle::setColumnRuleColor, &RenderStyle::color));
    1027     setPropertyHandler(CSSPropertyWebkitTextEmphasisColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::textEmphasisColor, &RenderStyle::setTextEmphasisColor, &RenderStyle::color));
    1028     setPropertyHandler(CSSPropertyWebkitTextFillColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::textFillColor, &RenderStyle::setTextFillColor, &RenderStyle::color));
    1029     setPropertyHandler(CSSPropertyWebkitTextStrokeColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::textStrokeColor, &RenderStyle::setTextStrokeColor, &RenderStyle::color));
     1041    setPropertyHandler(CSSPropertyWebkitColumnRuleColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::columnRuleColor, &RenderStyle::setColumnRuleColor, &RenderStyle::setVisitedLinkColumnRuleColor,  &RenderStyle::color));
     1042    setPropertyHandler(CSSPropertyWebkitTextEmphasisColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::textEmphasisColor, &RenderStyle::setTextEmphasisColor, &RenderStyle::setVisitedLinkTextEmphasisColor, &RenderStyle::color));
     1043    setPropertyHandler(CSSPropertyWebkitTextFillColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::textFillColor, &RenderStyle::setTextFillColor, &RenderStyle::setVisitedLinkTextFillColor, &RenderStyle::color));
     1044    setPropertyHandler(CSSPropertyWebkitTextStrokeColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::textStrokeColor, &RenderStyle::setTextStrokeColor, &RenderStyle::setVisitedLinkTextStrokeColor, &RenderStyle::color));
    10301045
    10311046    setPropertyHandler(CSSPropertyTop, new ApplyPropertyLength<AutoEnabled>(&RenderStyle::top, &RenderStyle::setTop, &RenderStyle::initialOffset));
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r97502 r97638  
    346346    , m_sameOriginOnly(false)
    347347    , m_fontSelector(CSSFontSelector::create(document))
     348    , m_applyPropertyToRegularStyle(true)
     349    , m_applyPropertyToVisitedLinkStyle(false)
    348350    , m_applyProperty(CSSStyleApplyProperty::sharedCSSStyleApplyProperty())
    349351{
     
    10861088    m_style = RenderStyle::create();
    10871089
    1088     if (m_parentStyle) {
     1090    if (m_parentStyle)
    10891091        m_style->inheritFrom(m_parentStyle);
    1090        
    1091         // For links and elements inside links we compute both the regular and visited style.
    1092         // FIXME: Visited link style doesn't need a separate RenderStyle. The few properties allowed should be part of the regular RenderStyle instead.
    1093         if (e->isLink()) {
    1094             m_visitedLinkStyle = RenderStyle::clone(m_style.get());
    1095             m_visitedLinkParentStyle = m_parentStyle;
    1096         } else if (m_parentStyle->insideLink()) {
    1097             m_visitedLinkParentStyle = m_parentStyle->getCachedPseudoStyle(VISITED_LINK);
    1098             if (!m_visitedLinkParentStyle)
    1099                 m_visitedLinkParentStyle = m_parentStyle;
    1100             m_visitedLinkStyle = RenderStyle::create();
    1101             m_visitedLinkStyle->inheritFrom(m_visitedLinkParentStyle);
    1102         }
    1103     } else {
     1092    else {
    11041093        m_parentStyle = style();
    11051094        // Make sure our fonts are initialized if we don't inherit them from our parent style.
     
    12871276        m_style->setUnique();
    12881277
    1289     if (m_visitedLinkStyle) {
    1290         // Copy any pseudo bits that the visited style has to the primary style so that pseudo
    1291         // element styles will continue to work for pseudo elements inside :visited links.
    1292         for (unsigned pseudo = FIRST_PUBLIC_PSEUDOID; pseudo < FIRST_INTERNAL_PSEUDOID; ++pseudo) {
    1293             if (m_visitedLinkStyle->hasPseudoStyle(static_cast<PseudoId>(pseudo)))
    1294                 m_style->setHasPseudoStyle(static_cast<PseudoId>(pseudo));
    1295         }
    1296         if (m_elementLinkState == InsideUnvisitedLink)
    1297             m_visitedLinkStyle = 0; // We made the style to avoid timing attacks. Just throw it away now that we did that, since we don't need it.
    1298         else {
    1299             // Add the visited style off the main style.
    1300             m_visitedLinkStyle->setStyleType(VISITED_LINK);
    1301             m_style->addCachedPseudoStyle(m_visitedLinkStyle.release());
    1302         }
    1303         m_visitedLinkParentStyle = 0;
    1304     }
    1305 
    13061278    initElement(0); // Clear out for the next resolve.
    13071279
     
    14251397    m_style = RenderStyle::create();
    14261398   
    1427     if (m_parentStyle) {
     1399    if (m_parentStyle)
    14281400        m_style->inheritFrom(m_parentStyle);
    1429        
    1430         // For links and elements inside links we compute both the regular and visited style.
    1431         if (m_parentStyle->insideLink()) {
    1432             m_visitedLinkParentStyle = m_parentStyle->getCachedPseudoStyle(VISITED_LINK);
    1433             if (!m_visitedLinkParentStyle)
    1434                 m_visitedLinkParentStyle = m_parentStyle;
    1435             m_visitedLinkStyle = RenderStyle::create();
    1436             m_visitedLinkStyle->inheritFrom(m_visitedLinkParentStyle);
    1437         }
    1438     }
    14391401
    14401402    // Since we don't use pseudo-elements in any of our quirk/print user agent rules, don't waste time walking
     
    14901452    // Start loading images referenced by this style.
    14911453    loadPendingImages();
    1492 
    1493     // Hang our visited style off m_style.
    1494     if (m_visitedLinkStyle) {
    1495         m_visitedLinkStyle->setStyleType(VISITED_LINK);
    1496         m_style->addCachedPseudoStyle(m_visitedLinkStyle.release());
    1497         m_visitedLinkParentStyle = 0;
    1498     }
    14991454       
    15001455    // Now return the style.
     
    17471702void CSSStyleSelector::updateFont()
    17481703{
    1749     ASSERT(m_style != m_visitedLinkStyle);
    17501704    if (!m_fontDirty)
    17511705        return;
     
    22042158            // we apply line-height later
    22052159            if (property == CSSPropertyLineHeight) {
    2206                 if (m_style == m_visitedLinkStyle)
    2207                     continue;
    22082160                m_lineHeightValue = current.value();
    22092161                continue;
     
    22232175        return;
    22242176
    2225     for (int i = startIndex; i <= endIndex; i++) {
    2226         CSSMutableStyleDeclaration* styleDeclaration = m_matchedDecls[i].styleDeclaration;
    2227         if (m_visitedLinkStyle && m_matchedDecls[i].linkMatchType & SelectorChecker::MatchVisited) {
    2228             // FIXME: Style should be passed to applyProperty as an argument, not as a member.
    2229             RefPtr<RenderStyle> savedStyle = m_style.release();
    2230             RenderStyle* savedParentStyle = m_parentStyle;
    2231             m_style = m_visitedLinkStyle;
    2232             m_parentStyle = m_visitedLinkParentStyle;
    2233            
    2234             applyDeclaration<applyFirst>(styleDeclaration, isImportant);
    2235            
    2236             m_style = savedStyle.release();
    2237             m_parentStyle = savedParentStyle;
    2238         }
    2239         if (m_matchedDecls[i].linkMatchType & SelectorChecker::MatchLink)
     2177    if (m_element->isLink()) {
     2178        for (int i = startIndex; i <= endIndex; ++i) {
     2179            CSSMutableStyleDeclaration* styleDeclaration = m_matchedDecls[i].styleDeclaration;
     2180            unsigned linkMatchType = m_matchedDecls[i].linkMatchType;
     2181            // FIXME: It would be nicer to pass these as arguments but that requires changes in many places.
     2182            m_applyPropertyToRegularStyle = linkMatchType & SelectorChecker::MatchLink;
     2183            m_applyPropertyToVisitedLinkStyle = linkMatchType & SelectorChecker::MatchVisited;
     2184
    22402185            applyDeclaration<applyFirst>(styleDeclaration, isImportant);       
    2241     }
     2186        }
     2187        m_applyPropertyToRegularStyle = true;
     2188        m_applyPropertyToVisitedLinkStyle = false;
     2189        return;
     2190    }
     2191    for (int i = startIndex; i <= endIndex; ++i)       
     2192        applyDeclaration<applyFirst>(m_matchedDecls[i].styleDeclaration, isImportant);
    22422193}
    22432194
     
    24242375    bool isInitial = valueType == CSSValue::CSS_INITIAL || (!m_parentNode && valueType == CSSValue::CSS_INHERIT);
    24252376
    2426     if (m_style == m_visitedLinkStyle && !isValidVisitedLinkProperty(id)) {
     2377    if (!applyPropertyToRegularStyle() && (!applyPropertyToVisitedLinkStyle() || !isValidVisitedLinkProperty(id))) {
    24272378        // Limit the properties that can be applied to only the ones honored by :visited.
    24282379        return;
     
    49434894}
    49444895
    4945 Color CSSStyleSelector::getColorFromPrimitiveValue(CSSPrimitiveValue* primitiveValue) const
     4896Color CSSStyleSelector::getColorFromPrimitiveValue(CSSPrimitiveValue* primitiveValue, bool forVisitedLink) const
    49464897{
    49474898    Color col;
     
    49514902            col = m_element->document()->textColor();
    49524903        else if (ident == CSSValueWebkitLink)
    4953             col = m_element->isLink() && m_style == m_visitedLinkStyle ? m_element->document()->visitedLinkColor() : m_element->document()->linkColor();
     4904            col = (m_element->isLink() && forVisitedLink) ? m_element->document()->visitedLinkColor() : m_element->document()->linkColor();
    49544905        else if (ident == CSSValueWebkitActivelink)
    49554906            col = m_element->document()->activeLinkColor();
  • trunk/Source/WebCore/css/CSSStyleSelector.h

    r97248 r97638  
    174174    bool useSVGZoomRules();
    175175
    176     Color getColorFromPrimitiveValue(CSSPrimitiveValue*) const;
     176    Color getColorFromPrimitiveValue(CSSPrimitiveValue*, bool forVisitedLink = false) const;
    177177
    178178    bool hasSelectorForAttribute(const AtomicString&) const;
     
    261261    StyleImage* styleImage(CSSPropertyID, CSSValue*);
    262262    StyleImage* cachedOrPendingFromValue(CSSPropertyID, CSSImageValue*);
     263   
     264    bool applyPropertyToRegularStyle() const { return m_applyPropertyToRegularStyle; }
     265    bool applyPropertyToVisitedLinkStyle() const { return m_applyPropertyToVisitedLinkStyle; }
    263266
    264267private:
     
    335338
    336339    RefPtr<RenderStyle> m_style;
    337     RefPtr<RenderStyle> m_visitedLinkStyle;
    338340    RenderStyle* m_parentStyle;
    339     RenderStyle* m_visitedLinkParentStyle;
    340341    RenderStyle* m_rootElementStyle;
    341342    Element* m_element;
     
    352353    Vector<MediaQueryResult*> m_viewportDependentMediaQueryResults;
    353354
     355    bool m_applyPropertyToRegularStyle;
     356    bool m_applyPropertyToVisitedLinkStyle;
    354357    const CSSStyleApplyProperty& m_applyProperty;
    355358   
  • trunk/Source/WebCore/css/SVGCSSStyleSelector.cpp

    r92047 r97638  
    227227            if (isInherit) {
    228228                const SVGRenderStyle* svgParentStyle = m_parentStyle->svgStyle();
    229                 svgstyle->setFillPaint(svgParentStyle->fillPaintType(), svgParentStyle->fillPaintColor(), svgParentStyle->fillPaintUri());
     229                svgstyle->setFillPaint(svgParentStyle->fillPaintType(), svgParentStyle->fillPaintColor(), svgParentStyle->fillPaintUri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());
    230230                return;
    231231            }
    232232            if (isInitial) {
    233                 svgstyle->setFillPaint(SVGRenderStyle::initialFillPaintType(), SVGRenderStyle::initialFillPaintColor(), SVGRenderStyle::initialFillPaintUri());
     233                svgstyle->setFillPaint(SVGRenderStyle::initialFillPaintType(), SVGRenderStyle::initialFillPaintColor(), SVGRenderStyle::initialFillPaintUri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());
    234234                return;
    235235            }
    236236            if (value->isSVGPaint()) {
    237237                SVGPaint* svgPaint = static_cast<SVGPaint*>(value);
    238                 svgstyle->setFillPaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, m_style->color()), svgPaint->uri());
     238                svgstyle->setFillPaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, m_style->color()), svgPaint->uri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());
    239239            }
    240240            break;
     
    244244            if (isInherit) {
    245245                const SVGRenderStyle* svgParentStyle = m_parentStyle->svgStyle();
    246                 svgstyle->setStrokePaint(svgParentStyle->strokePaintType(), svgParentStyle->strokePaintColor(), svgParentStyle->strokePaintUri());
     246                svgstyle->setStrokePaint(svgParentStyle->strokePaintType(), svgParentStyle->strokePaintColor(), svgParentStyle->strokePaintUri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());
    247247                return;
    248248            }
    249249            if (isInitial) {
    250                 svgstyle->setStrokePaint(SVGRenderStyle::initialStrokePaintType(), SVGRenderStyle::initialStrokePaintColor(), SVGRenderStyle::initialStrokePaintUri());
     250                svgstyle->setStrokePaint(SVGRenderStyle::initialStrokePaintType(), SVGRenderStyle::initialStrokePaintColor(), SVGRenderStyle::initialStrokePaintUri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());
    251251                return;
    252252            }
    253253            if (value->isSVGPaint()) {
    254254                SVGPaint* svgPaint = static_cast<SVGPaint*>(value);
    255                 svgstyle->setStrokePaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, m_style->color()), svgPaint->uri());
     255                svgstyle->setStrokePaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, m_style->color()), svgPaint->uri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());
    256256            }
    257257            break;
  • trunk/Source/WebCore/dom/Element.cpp

    r96859 r97638  
    10181018        RefPtr<RenderStyle> newPseudoStyle;
    10191019        PseudoId pseudoId = pseudoStyleCache->at(i)->styleType();
    1020         if (pseudoId == VISITED_LINK) {
    1021             newPseudoStyle =  newStyle->getCachedPseudoStyle(VISITED_LINK); // This pseudo-style was aggressively computed already when we first called styleForElement on the new style.
    1022             if (!newPseudoStyle || *newPseudoStyle != *pseudoStyleCache->at(i))
    1023                 return true;
    1024         } else if (pseudoId == FIRST_LINE || pseudoId == FIRST_LINE_INHERITED)
     1020        if (pseudoId == FIRST_LINE || pseudoId == FIRST_LINE_INHERITED)
    10251021            newPseudoStyle = renderer()->uncachedFirstLineStyle(newStyle);
    10261022        else
  • trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r97248 r97638  
    233233RenderStyle* RenderStyle::getCachedPseudoStyle(PseudoId pid) const
    234234{
    235     ASSERT(styleType() != VISITED_LINK);
    236 
    237235    if (!m_cachedPseudoStyles || !m_cachedPseudoStyles->size())
    238236        return 0;
    239237
    240     if (styleType() != NOPSEUDO) {
    241         if (pid == VISITED_LINK)
    242             return m_cachedPseudoStyles->at(0)->styleType() == VISITED_LINK ? m_cachedPseudoStyles->at(0).get() : 0;
     238    if (styleType() != NOPSEUDO)
    243239        return 0;
    244     }
    245240
    246241    for (size_t i = 0; i < m_cachedPseudoStyles->size(); ++i) {
     
    11241119}
    11251120
    1126 Color RenderStyle::colorIncludingFallback(int colorProperty) const
     1121Color RenderStyle::colorIncludingFallback(int colorProperty, bool visitedLink) const
    11271122{
    11281123    Color result;
     
    11301125    switch (colorProperty) {
    11311126    case CSSPropertyBackgroundColor:
    1132         return backgroundColor(); // Background color doesn't fall back.
     1127        return visitedLink ? rareNonInheritedData->m_visitedLinkBackgroundColor : backgroundColor(); // Background color doesn't fall back.
    11331128    case CSSPropertyBorderLeftColor:
    1134         result = borderLeftColor();
     1129        result = visitedLink ? rareNonInheritedData->m_visitedLinkBorderLeftColor : borderLeftColor();
    11351130        borderStyle = borderLeftStyle();
    11361131        break;
    11371132    case CSSPropertyBorderRightColor:
    1138         result = borderRightColor();
     1133        result = visitedLink ? rareNonInheritedData->m_visitedLinkBorderRightColor : borderRightColor();
    11391134        borderStyle = borderRightStyle();
    11401135        break;
    11411136    case CSSPropertyBorderTopColor:
    1142         result = borderTopColor();
     1137        result = visitedLink ? rareNonInheritedData->m_visitedLinkBorderTopColor : borderTopColor();
    11431138        borderStyle = borderTopStyle();
    11441139        break;
    11451140    case CSSPropertyBorderBottomColor:
    1146         result = borderBottomColor();
     1141        result = visitedLink ? rareNonInheritedData->m_visitedLinkBorderBottomColor : borderBottomColor();
    11471142        borderStyle = borderBottomStyle();
    11481143        break;
    11491144    case CSSPropertyColor:
    1150         result = color();
     1145        result = visitedLink ? inherited->visitedLinkColor : color();
    11511146        break;
    11521147    case CSSPropertyOutlineColor:
    1153         result = outlineColor();
     1148        result = visitedLink ? rareNonInheritedData->m_visitedLinkOutlineColor : outlineColor();
    11541149        break;
    11551150    case CSSPropertyWebkitColumnRuleColor:
    1156         result = columnRuleColor();
     1151        result = visitedLink ? rareNonInheritedData->m_multiCol->m_visitedLinkColumnRuleColor : columnRuleColor();
    11571152        break;
    11581153    case CSSPropertyWebkitTextEmphasisColor:
    1159         result = textEmphasisColor();
     1154        result = visitedLink ? rareInheritedData->visitedLinkTextEmphasisColor : textEmphasisColor();
    11601155        break;
    11611156    case CSSPropertyWebkitTextFillColor:
    1162         result = textFillColor();
     1157        result = visitedLink ? rareInheritedData->visitedLinkTextFillColor : textFillColor();
    11631158        break;
    11641159    case CSSPropertyWebkitTextStrokeColor:
    1165         result = textStrokeColor();
     1160        result = visitedLink ? rareInheritedData->visitedLinkTextStrokeColor : textStrokeColor();
    11661161        break;
    11671162    default:
     
    11711166
    11721167    if (!result.isValid()) {
    1173         if (borderStyle == INSET || borderStyle == OUTSET || borderStyle == RIDGE || borderStyle == GROOVE)
     1168        if (!visitedLink && (borderStyle == INSET || borderStyle == OUTSET || borderStyle == RIDGE || borderStyle == GROOVE))
    11741169            result.setRGB(238, 238, 238);
    11751170        else
    1176             result = color();
    1177     }
    1178 
     1171            result = visitedLink ? inherited->visitedLinkColor : color();
     1172    }
    11791173    return result;
    11801174}
     
    11821176Color RenderStyle::visitedDependentColor(int colorProperty) const
    11831177{
    1184     Color unvisitedColor = colorIncludingFallback(colorProperty);
     1178    Color unvisitedColor = colorIncludingFallback(colorProperty, false);
    11851179    if (insideLink() != InsideVisitedLink)
    11861180        return unvisitedColor;
    11871181
    1188     RenderStyle* visitedStyle = getCachedPseudoStyle(VISITED_LINK);
    1189     if (!visitedStyle)
    1190         return unvisitedColor;
    1191     Color visitedColor = visitedStyle->colorIncludingFallback(colorProperty);
     1182    Color visitedColor = colorIncludingFallback(colorProperty, true);
    11921183
    11931184    // FIXME: Technically someone could explicitly specify the color transparent, but for now we'll just
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r97314 r97638  
    14811481#endif
    14821482private:
     1483    void setVisitedLinkColor(const Color& v) { SET_VAR(inherited, visitedLinkColor, v) }
     1484    void setVisitedLinkBackgroundColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBackgroundColor, v) }
     1485    void setVisitedLinkBorderLeftColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderLeftColor, v) }
     1486    void setVisitedLinkBorderRightColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderRightColor, v) }
     1487    void setVisitedLinkBorderBottomColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderBottomColor, v) }
     1488    void setVisitedLinkBorderTopColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderTopColor, v) }
     1489    void setVisitedLinkOutlineColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkOutlineColor, v) }
     1490    void setVisitedLinkColumnRuleColor(const Color& v) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_visitedLinkColumnRuleColor, v) }
     1491    void setVisitedLinkTextEmphasisColor(const Color& v) { SET_VAR(rareInheritedData, visitedLinkTextEmphasisColor, v) }
     1492    void setVisitedLinkTextFillColor(const Color& v) { SET_VAR(rareInheritedData, visitedLinkTextFillColor, v) }
     1493    void setVisitedLinkTextStrokeColor(const Color& v) { SET_VAR(rareInheritedData, visitedLinkTextStrokeColor, v) }
     1494
    14831495    void inheritUnicodeBidiFrom(const RenderStyle* parent) { noninherited_flags._unicodeBidi = parent->noninherited_flags._unicodeBidi; }
    14841496    void getShadowExtent(const ShadowData*, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const;
     
    15191531    const Color& textStrokeColor() const { return rareInheritedData->textStrokeColor; }
    15201532   
    1521     Color colorIncludingFallback(int colorProperty) const;
     1533    Color colorIncludingFallback(int colorProperty, bool visitedLink) const;
    15221534
    15231535#if ENABLE(SVG)
  • trunk/Source/WebCore/rendering/style/RenderStyleConstants.h

    r97314 r97638  
    7676    // Internal IDs follow:
    7777    SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER,
    78     INPUT_LIST_BUTTON, VISITED_LINK,
     78    INPUT_LIST_BUTTON,
    7979    AFTER_LAST_INTERNAL_PSEUDOID,
    8080    FULL_SCREEN, FULL_SCREEN_DOCUMENT, FULL_SCREEN_ANCESTOR, ANIMATING_FULL_SCREEN_TRANSITION,
  • trunk/Source/WebCore/rendering/style/SVGRenderStyle.h

    r93807 r97638  
    153153    }
    154154
    155     void setFillPaint(SVGPaint::SVGPaintType type, const Color& color, const String& uri)
    156     {
    157         if (!(fill->paintType == type))
    158             fill.access()->paintType = type;
    159         if (!(fill->paintColor == color))
    160             fill.access()->paintColor = color;
    161         if (!(fill->paintUri == uri))
    162             fill.access()->paintUri = uri;
     155    void setFillPaint(SVGPaint::SVGPaintType type, const Color& color, const String& uri, bool applyToRegularStyle = true, bool applyToVisitedLinkStyle = false)
     156    {
     157        if (applyToRegularStyle) {
     158            if (!(fill->paintType == type))
     159                fill.access()->paintType = type;
     160            if (!(fill->paintColor == color))
     161                fill.access()->paintColor = color;
     162            if (!(fill->paintUri == uri))
     163                fill.access()->paintUri = uri;
     164        }
     165        if (applyToVisitedLinkStyle) {
     166            if (!(fill->paintType == type))
     167                fill.access()->visitedLinkPaintType = type;
     168            if (!(fill->paintColor == color))
     169                fill.access()->visitedLinkPaintColor = color;
     170            if (!(fill->paintUri == uri))
     171                fill.access()->visitedLinkPaintUri = uri;
     172        }
    163173    }
    164174
     
    169179    }
    170180
    171     void setStrokePaint(SVGPaint::SVGPaintType type, const Color& color, const String& uri)
    172     {
    173         if (!(stroke->paintType == type))
    174             stroke.access()->paintType = type;
    175         if (!(stroke->paintColor == color))
    176             stroke.access()->paintColor = color;
    177         if (!(stroke->paintUri == uri))
    178             stroke.access()->paintUri = uri;
     181    void setStrokePaint(SVGPaint::SVGPaintType type, const Color& color, const String& uri, bool applyToRegularStyle = true, bool applyToVisitedLinkStyle = false)
     182    {
     183        if (applyToRegularStyle) {
     184            if (!(stroke->paintType == type))
     185                stroke.access()->paintType = type;
     186            if (!(stroke->paintColor == color))
     187                stroke.access()->paintColor = color;
     188            if (!(stroke->paintUri == uri))
     189                stroke.access()->paintUri = uri;
     190        }
     191        if (applyToVisitedLinkStyle) {
     192            if (!(stroke->paintType == type))
     193                stroke.access()->visitedLinkPaintType = type;
     194            if (!(stroke->paintColor == color))
     195                stroke.access()->visitedLinkPaintColor = color;
     196            if (!(stroke->paintUri == uri))
     197                stroke.access()->visitedLinkPaintUri = uri;
     198        }
    179199    }
    180200
     
    328348    String markerMidResource() const { return inheritedResources->markerMid; }
    329349    String markerEndResource() const { return inheritedResources->markerEnd; }
     350   
     351    const SVGPaint::SVGPaintType& visitedLinkFillPaintType() const { return fill->visitedLinkPaintType; }
     352    const Color& visitedLinkFillPaintColor() const { return fill->visitedLinkPaintColor; }
     353    const String& visitedLinkFillPaintUri() const { return fill->visitedLinkPaintUri; }
     354    const SVGPaint::SVGPaintType& visitedLinkStrokePaintType() const { return stroke->visitedLinkPaintType; }
     355    const Color& visitedLinkStrokePaintColor() const { return stroke->visitedLinkPaintColor; }
     356    const String& visitedLinkStrokePaintUri() const { return stroke->visitedLinkPaintUri; }
    330357
    331358    // convenience
  • trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp

    r85603 r97638  
    4141    , paintColor(SVGRenderStyle::initialFillPaintColor())
    4242    , paintUri(SVGRenderStyle::initialFillPaintUri())
     43    , visitedLinkPaintType(SVGRenderStyle::initialStrokePaintType())
     44    , visitedLinkPaintColor(SVGRenderStyle::initialFillPaintColor())
     45    , visitedLinkPaintUri(SVGRenderStyle::initialFillPaintUri())
    4346{
    4447}
     
    5053    , paintColor(other.paintColor)
    5154    , paintUri(other.paintUri)
     55    , visitedLinkPaintType(other.visitedLinkPaintType)
     56    , visitedLinkPaintColor(other.visitedLinkPaintColor)
     57    , visitedLinkPaintUri(other.visitedLinkPaintUri)
    5258{
    5359}
     
    5864        && paintType == other.paintType
    5965        && paintColor == other.paintColor
    60         && paintUri == other.paintUri;
     66        && paintUri == other.paintUri
     67        && visitedLinkPaintType == other.visitedLinkPaintType
     68        && visitedLinkPaintColor == other.visitedLinkPaintColor
     69        && visitedLinkPaintUri == other.visitedLinkPaintUri;
    6170}
    6271
     
    7079    , paintColor(SVGRenderStyle::initialStrokePaintColor())
    7180    , paintUri(SVGRenderStyle::initialStrokePaintUri())
     81    , visitedLinkPaintType(SVGRenderStyle::initialStrokePaintType())
     82    , visitedLinkPaintColor(SVGRenderStyle::initialStrokePaintColor())
     83    , visitedLinkPaintUri(SVGRenderStyle::initialStrokePaintUri())
    7284{
    7385}
     
    8395    , paintColor(other.paintColor)
    8496    , paintUri(other.paintUri)
     97    , visitedLinkPaintType(other.visitedLinkPaintType)
     98    , visitedLinkPaintColor(other.visitedLinkPaintColor)
     99    , visitedLinkPaintUri(other.visitedLinkPaintUri)
    85100{
    86101}
     
    95110        && paintType == other.paintType
    96111        && paintColor == other.paintColor
    97         && paintUri == other.paintUri;
     112        && paintUri == other.paintUri
     113        && visitedLinkPaintType == other.visitedLinkPaintType
     114        && visitedLinkPaintColor == other.visitedLinkPaintColor
     115        && visitedLinkPaintUri == other.visitedLinkPaintUri;
    98116}
    99117
  • trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.h

    r87121 r97638  
    104104        Color paintColor;
    105105        String paintUri;
     106        SVGPaint::SVGPaintType visitedLinkPaintType;
     107        Color visitedLinkPaintColor;
     108        String visitedLinkPaintUri;
    106109
    107110    private:
     
    131134        Color paintColor;
    132135        String paintUri;
     136        SVGPaint::SVGPaintType visitedLinkPaintType;
     137        Color visitedLinkPaintColor;
     138        String visitedLinkPaintUri;
    133139
    134140    private:       
  • trunk/Source/WebCore/rendering/style/StyleInheritedData.cpp

    r96935 r97638  
    3434    , list_style_image(RenderStyle::initialListStyleImage())
    3535    , color(RenderStyle::initialColor())
     36    , visitedLinkColor(RenderStyle::initialColor())
    3637{
    3738}
     
    4950    , font(o.font)
    5051    , color(o.color)
     52    , visitedLinkColor(o.visitedLinkColor)
    5153{
    5254}
     
    5456bool StyleInheritedData::operator==(const StyleInheritedData& o) const
    5557{
    56     return
    57         line_height == o.line_height &&
    58         StyleImage::imagesEquivalent(list_style_image.get(), o.list_style_image.get()) &&
    59         font == o.font &&
    60         color == o.color &&
    61         horizontal_border_spacing == o.horizontal_border_spacing &&
    62         vertical_border_spacing == o.vertical_border_spacing;
     58    return line_height == o.line_height
     59        && StyleImage::imagesEquivalent(list_style_image.get(), o.list_style_image.get())
     60        && font == o.font
     61        && color == o.color
     62        && visitedLinkColor == o.visitedLinkColor
     63        && horizontal_border_spacing == o.horizontal_border_spacing
     64        && vertical_border_spacing == o.vertical_border_spacing;
    6365}
    6466
  • trunk/Source/WebCore/rendering/style/StyleInheritedData.h

    r96935 r97638  
    6060    Font font;
    6161    Color color;
     62    Color visitedLinkColor;
    6263
    6364private:
  • trunk/Source/WebCore/rendering/style/StyleMultiColData.cpp

    r59968 r97638  
    4747    , m_gap(o.m_gap)
    4848    , m_rule(o.m_rule)
     49    , m_visitedLinkColumnRuleColor(o.m_visitedLinkColumnRuleColor)
    4950    , m_autoWidth(o.m_autoWidth)
    5051    , m_autoCount(o.m_autoCount)
     
    6061{
    6162    return m_width == o.m_width && m_count == o.m_count && m_gap == o.m_gap
    62            && m_rule == o.m_rule && m_breakBefore == o.m_breakBefore
     63           && m_rule == o.m_rule && m_visitedLinkColumnRuleColor == o.m_visitedLinkColumnRuleColor && m_breakBefore == o.m_breakBefore
    6364           && m_autoWidth == o.m_autoWidth && m_autoCount == o.m_autoCount && m_normalGap == o.m_normalGap
    6465           && m_columnSpan == o.m_columnSpan && m_breakAfter == o.m_breakAfter && m_breakInside == o.m_breakInside;
  • trunk/Source/WebCore/rendering/style/StyleMultiColData.h

    r59968 r97638  
    5858    float m_gap;
    5959    BorderValue m_rule;
     60    Color m_visitedLinkColumnRuleColor;
    6061
    6162    bool m_autoWidth : 1;
  • trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp

    r96433 r97638  
    6969    , textFillColor(o.textFillColor)
    7070    , textEmphasisColor(o.textEmphasisColor)
     71    , visitedLinkTextStrokeColor(o.visitedLinkTextStrokeColor)
     72    , visitedLinkTextFillColor(o.visitedLinkTextFillColor)
     73    , visitedLinkTextEmphasisColor(o.visitedLinkTextEmphasisColor)
    7174    , textShadow(o.textShadow ? adoptPtr(new ShadowData(*o.textShadow)) : nullptr)
    7275    , highlight(o.highlight)
     
    124127        && textFillColor == o.textFillColor
    125128        && textEmphasisColor == o.textEmphasisColor
     129        && visitedLinkTextStrokeColor == o.visitedLinkTextStrokeColor
     130        && visitedLinkTextFillColor == o.visitedLinkTextFillColor
     131        && visitedLinkTextEmphasisColor == o.visitedLinkTextEmphasisColor
    126132#if ENABLE(TOUCH_EVENTS)
    127133        && tapHighlightColor == o.tapHighlightColor
  • trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h

    r96433 r97638  
    5858    Color textFillColor;
    5959    Color textEmphasisColor;
     60   
     61    Color visitedLinkTextStrokeColor;
     62    Color visitedLinkTextFillColor;
     63    Color visitedLinkTextEmphasisColor;   
    6064
    6165    OwnPtr<ShadowData> textShadow; // Our text shadow information for shadowed text drawing.
  • trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp

    r97308 r97638  
    4545    , m_pageSize()
    4646    , m_wrapShape(RenderStyle::initialWrapShape())
     47    , m_visitedLinkBackgroundColor(RenderStyle::initialBackgroundColor())
    4748    , m_flowThread(RenderStyle::initialFlowThread())
    4849    , m_regionThread(RenderStyle::initialRegionThread())
     
    9899    , m_pageSize(o.m_pageSize)
    99100    , m_wrapShape(o.m_wrapShape)
     101    , m_visitedLinkBackgroundColor(o.m_visitedLinkBackgroundColor)
     102    , m_visitedLinkOutlineColor(o.m_visitedLinkBackgroundColor)
     103    , m_visitedLinkBorderLeftColor(o.m_visitedLinkBorderLeftColor)
     104    , m_visitedLinkBorderRightColor(o.m_visitedLinkBorderRightColor)
     105    , m_visitedLinkBorderTopColor(o.m_visitedLinkBorderTopColor)
     106    , m_visitedLinkBorderBottomColor(o.m_visitedLinkBorderBottomColor)
    100107    , m_flowThread(o.m_flowThread)
    101108    , m_regionThread(o.m_regionThread)
     
    174181        && (m_regionOverflow == o.m_regionOverflow)
    175182        && (m_wrapShape == o.m_wrapShape)
     183        && m_visitedLinkBackgroundColor == o.m_visitedLinkBackgroundColor
     184        && m_visitedLinkOutlineColor == o.m_visitedLinkOutlineColor
     185        && m_visitedLinkBorderLeftColor == o.m_visitedLinkBorderLeftColor
     186        && m_visitedLinkBorderRightColor == o.m_visitedLinkBorderRightColor
     187        && m_visitedLinkBorderTopColor == o.m_visitedLinkBorderTopColor
     188        && m_visitedLinkBorderBottomColor == o.m_visitedLinkBorderBottomColor
    176189        && (m_regionBreakAfter == o.m_regionBreakAfter)
    177190        && (m_regionBreakBefore == o.m_regionBreakBefore)
  • trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h

    r97308 r97638  
    130130
    131131    RefPtr<CSSWrapShape> m_wrapShape;
     132   
     133    Color m_visitedLinkBackgroundColor;
     134    Color m_visitedLinkOutlineColor;
     135    Color m_visitedLinkBorderLeftColor;
     136    Color m_visitedLinkBorderRightColor;
     137    Color m_visitedLinkBorderTopColor;
     138    Color m_visitedLinkBorderBottomColor;
    132139
    133140    AtomicString m_flowThread;
  • trunk/Source/WebCore/rendering/svg/RenderSVGResource.cpp

    r89490 r97638  
    8282
    8383    if (style->insideLink() == InsideVisitedLink) {
    84         RenderStyle* visitedStyle = style->getCachedPseudoStyle(VISITED_LINK);
    85         ASSERT(visitedStyle);
    86 
    87         const SVGRenderStyle* svgVisitedStyle = visitedStyle->svgStyle();
    88         SVGPaint::SVGPaintType visitedPaintType = applyToFill ? svgVisitedStyle->fillPaintType() : svgVisitedStyle->strokePaintType();
     84        // FIXME: This code doesn't support the uri component of the visited link paint, https://bugs.webkit.org/show_bug.cgi?id=70006
     85        SVGPaint::SVGPaintType visitedPaintType = applyToFill ? svgStyle->visitedLinkFillPaintType() : svgStyle->visitedLinkStrokePaintType();
    8986
    9087        // For SVG_PAINTTYPE_CURRENTCOLOR, 'color' already contains the 'visitedColor'.
    9188        if (visitedPaintType < SVGPaint::SVG_PAINTTYPE_URI_NONE && visitedPaintType != SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR) {
    92             const Color& visitedColor = applyToFill ? svgVisitedStyle->fillPaintColor() : svgVisitedStyle->strokePaintColor();
     89            const Color& visitedColor = applyToFill ? svgStyle->visitedLinkFillPaintColor() : svgStyle->visitedLinkStrokePaintColor();
    9390            if (visitedColor.isValid())
    9491                color = Color(visitedColor.red(), visitedColor.green(), visitedColor.blue(), color.alpha());
Note: See TracChangeset for help on using the changeset viewer.