https://bugs.webkit.org/show_bug.cgi?id=69966
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Oct 2011 19:49:07 +0000 (19:49 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Oct 2011 19:49:07 +0000 (19:49 +0000)
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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@97638 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/CSSStyleApplyProperty.cpp
Source/WebCore/css/CSSStyleSelector.cpp
Source/WebCore/css/CSSStyleSelector.h
Source/WebCore/css/SVGCSSStyleSelector.cpp
Source/WebCore/dom/Element.cpp
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/RenderStyleConstants.h
Source/WebCore/rendering/style/SVGRenderStyle.h
Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp
Source/WebCore/rendering/style/SVGRenderStyleDefs.h
Source/WebCore/rendering/style/StyleInheritedData.cpp
Source/WebCore/rendering/style/StyleInheritedData.h
Source/WebCore/rendering/style/StyleMultiColData.cpp
Source/WebCore/rendering/style/StyleMultiColData.h
Source/WebCore/rendering/style/StyleRareInheritedData.cpp
Source/WebCore/rendering/style/StyleRareInheritedData.h
Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
Source/WebCore/rendering/style/StyleRareNonInheritedData.h
Source/WebCore/rendering/svg/RenderSVGResource.cpp

index fd29f24..f77002e 100644 (file)
@@ -1,3 +1,97 @@
+2011-10-17  Antti Koivisto  <antti@apple.com>
+
+        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):
+
 2011-10-17  Eric Carlson  <eric.carlson@apple.com>
 
         Cues should be loaded by the cached resource loader
 2011-10-17  Eric Carlson  <eric.carlson@apple.com>
 
         Cues should be loaded by the cached resource loader
index 6f01b47..fbb23ac 100644 (file)
@@ -224,9 +224,10 @@ public:
     typedef const Color& (RenderStyle::*DefaultFunction)() const;
     typedef Color (*InitialFunction)();
 
     typedef const Color& (RenderStyle::*DefaultFunction)() const;
     typedef Color (*InitialFunction)();
 
-    ApplyPropertyColor(GetterFunction getter, SetterFunction setter, DefaultFunction defaultFunction, InitialFunction initialFunction = 0)
+    ApplyPropertyColor(GetterFunction getter, SetterFunction setter, SetterFunction visitedLinkSetter, DefaultFunction defaultFunction, InitialFunction initialFunction = 0)
         : m_getter(getter)
         , m_setter(setter)
         : m_getter(getter)
         , m_setter(setter)
+        , m_visitedLinkSetter(visitedLinkSetter)
         , m_default(defaultFunction)
         , m_initial(initialFunction)
     {
         , m_default(defaultFunction)
         , m_initial(initialFunction)
     {
@@ -235,16 +236,17 @@ public:
 private:
     virtual void applyInheritValue(CSSStyleSelector* selector) const
     {
 private:
     virtual void applyInheritValue(CSSStyleSelector* selector) const
     {
+        // Visited link style can never explicitly inherit from parent visited link style so no separate getters are needed.
         const Color& color = (selector->parentStyle()->*m_getter)();
         if (m_default && !color.isValid())
         const Color& color = (selector->parentStyle()->*m_getter)();
         if (m_default && !color.isValid())
-            (selector->style()->*m_setter)((selector->parentStyle()->*m_default)());
+            applyColorValue(selector, (selector->parentStyle()->*m_default)());
         else
         else
-            (selector->style()->*m_setter)(color);
+            applyColorValue(selector, color);
     }
 
     virtual void applyInitialValue(CSSStyleSelector* selector) const
     {
     }
 
     virtual void applyInitialValue(CSSStyleSelector* selector) const
     {
-        (selector->style()->*m_setter)(m_initial ? m_initial() : Color());
+        applyColorValue(selector, m_initial ? m_initial() : Color());
     }
 
     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
     }
 
     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
@@ -255,12 +257,25 @@ private:
         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
         if (inheritColorFromParent && primitiveValue->getIdent() == CSSValueCurrentcolor)
             applyInheritValue(selector);
         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
         if (inheritColorFromParent && primitiveValue->getIdent() == CSSValueCurrentcolor)
             applyInheritValue(selector);
-        else
-            (selector->style()->*m_setter)(selector->getColorFromPrimitiveValue(primitiveValue));
+        else {
+            if (selector->applyPropertyToRegularStyle())
+                (selector->style()->*m_setter)(selector->getColorFromPrimitiveValue(primitiveValue, false));
+            if (selector->applyPropertyToVisitedLinkStyle() && m_visitedLinkSetter)
+                (selector->style()->*m_visitedLinkSetter)(selector->getColorFromPrimitiveValue(primitiveValue, true));
+        }
+    }
+    
+    void applyColorValue(CSSStyleSelector* selector, const Color& color) const
+    {
+        if (selector->applyPropertyToRegularStyle())
+            (selector->style()->*m_setter)(color);
+        if (selector->applyPropertyToVisitedLinkStyle() && m_visitedLinkSetter)
+            (selector->style()->*m_visitedLinkSetter)(color);
     }
 
     GetterFunction m_getter;
     SetterFunction m_setter;
     }
 
     GetterFunction m_getter;
     SetterFunction m_setter;
+    SetterFunction m_visitedLinkSetter;
     DefaultFunction m_default;
     InitialFunction m_initial;
 };
     DefaultFunction m_default;
     InitialFunction m_initial;
 };
@@ -893,7 +908,7 @@ CSSStyleApplyProperty::CSSStyleApplyProperty()
     for (int i = 0; i < numCSSProperties; ++i)
        m_propertyMap[i] = 0;
 
     for (int i = 0; i < numCSSProperties; ++i)
        m_propertyMap[i] = 0;
 
-    setPropertyHandler(CSSPropertyColor, new ApplyPropertyColor<InheritFromParent>(&RenderStyle::color, &RenderStyle::setColor, 0, RenderStyle::initialColor));
+    setPropertyHandler(CSSPropertyColor, new ApplyPropertyColor<InheritFromParent>(&RenderStyle::color, &RenderStyle::setColor,  &RenderStyle::setVisitedLinkColor, 0, RenderStyle::initialColor));
     setPropertyHandler(CSSPropertyDirection, new ApplyPropertyDirection(&RenderStyle::direction, &RenderStyle::setDirection, RenderStyle::initialDirection));
 
     setPropertyHandler(CSSPropertyBackgroundAttachment, new ApplyPropertyFillLayer<EFillAttachment>(CSSPropertyBackgroundAttachment, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
     setPropertyHandler(CSSPropertyDirection, new ApplyPropertyDirection(&RenderStyle::direction, &RenderStyle::setDirection, RenderStyle::initialDirection));
 
     setPropertyHandler(CSSPropertyBackgroundAttachment, new ApplyPropertyFillLayer<EFillAttachment>(CSSPropertyBackgroundAttachment, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
@@ -954,11 +969,11 @@ CSSStyleApplyProperty::CSSStyleApplyProperty()
                     &FillLayer::isRepeatYSet, &FillLayer::repeatY, &FillLayer::setRepeatY, &FillLayer::clearRepeatY, &FillLayer::initialFillRepeatY, &CSSStyleSelector::mapFillRepeatY));
     setPropertyHandler(CSSPropertyWebkitMaskRepeat, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBackgroundRepeatX), propertyHandler(CSSPropertyBackgroundRepeatY)));
 
                     &FillLayer::isRepeatYSet, &FillLayer::repeatY, &FillLayer::setRepeatY, &FillLayer::clearRepeatY, &FillLayer::initialFillRepeatY, &CSSStyleSelector::mapFillRepeatY));
     setPropertyHandler(CSSPropertyWebkitMaskRepeat, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBackgroundRepeatX), propertyHandler(CSSPropertyBackgroundRepeatY)));
 
-    setPropertyHandler(CSSPropertyBackgroundColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::backgroundColor, &RenderStyle::setBackgroundColor, 0));
-    setPropertyHandler(CSSPropertyBorderBottomColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::borderBottomColor, &RenderStyle::setBorderBottomColor, &RenderStyle::color));
-    setPropertyHandler(CSSPropertyBorderLeftColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::borderLeftColor, &RenderStyle::setBorderLeftColor, &RenderStyle::color));
-    setPropertyHandler(CSSPropertyBorderRightColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::borderRightColor, &RenderStyle::setBorderRightColor, &RenderStyle::color));
-    setPropertyHandler(CSSPropertyBorderTopColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::borderTopColor, &RenderStyle::setBorderTopColor, &RenderStyle::color));
+    setPropertyHandler(CSSPropertyBackgroundColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::backgroundColor, &RenderStyle::setBackgroundColor, &RenderStyle::setVisitedLinkBackgroundColor, 0));
+    setPropertyHandler(CSSPropertyBorderBottomColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::borderBottomColor, &RenderStyle::setBorderBottomColor, &RenderStyle::setVisitedLinkBorderBottomColor, &RenderStyle::color));
+    setPropertyHandler(CSSPropertyBorderLeftColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::borderLeftColor, &RenderStyle::setBorderLeftColor, &RenderStyle::setVisitedLinkBorderLeftColor, &RenderStyle::color));
+    setPropertyHandler(CSSPropertyBorderRightColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::borderRightColor, &RenderStyle::setBorderRightColor, &RenderStyle::setVisitedLinkBorderRightColor, &RenderStyle::color));
+    setPropertyHandler(CSSPropertyBorderTopColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::borderTopColor, &RenderStyle::setBorderTopColor, &RenderStyle::setVisitedLinkBorderTopColor, &RenderStyle::color));
 
     setPropertyHandler(CSSPropertyBorderTopStyle, new ApplyPropertyDefault<EBorderStyle>(&RenderStyle::borderTopStyle, &RenderStyle::setBorderTopStyle, &RenderStyle::initialBorderStyle));
     setPropertyHandler(CSSPropertyBorderRightStyle, new ApplyPropertyDefault<EBorderStyle>(&RenderStyle::borderRightStyle, &RenderStyle::setBorderRightStyle, &RenderStyle::initialBorderStyle));
 
     setPropertyHandler(CSSPropertyBorderTopStyle, new ApplyPropertyDefault<EBorderStyle>(&RenderStyle::borderTopStyle, &RenderStyle::setBorderTopStyle, &RenderStyle::initialBorderStyle));
     setPropertyHandler(CSSPropertyBorderRightStyle, new ApplyPropertyDefault<EBorderStyle>(&RenderStyle::borderRightStyle, &RenderStyle::setBorderRightStyle, &RenderStyle::initialBorderStyle));
@@ -1016,17 +1031,17 @@ CSSStyleApplyProperty::CSSStyleApplyProperty()
     setPropertyHandler(CSSPropertyFontWeight, new ApplyPropertyFontWeight());
 
     setPropertyHandler(CSSPropertyOutlineStyle, new ApplyPropertyExpanding<ExpandValue>(new ApplyPropertyDefault<OutlineIsAuto>(&RenderStyle::outlineStyleIsAuto, &RenderStyle::setOutlineStyleIsAuto, &RenderStyle::initialOutlineStyleIsAuto), new ApplyPropertyDefault<EBorderStyle>(&RenderStyle::outlineStyle, &RenderStyle::setOutlineStyle, &RenderStyle::initialBorderStyle)));
     setPropertyHandler(CSSPropertyFontWeight, new ApplyPropertyFontWeight());
 
     setPropertyHandler(CSSPropertyOutlineStyle, new ApplyPropertyExpanding<ExpandValue>(new ApplyPropertyDefault<OutlineIsAuto>(&RenderStyle::outlineStyleIsAuto, &RenderStyle::setOutlineStyleIsAuto, &RenderStyle::initialOutlineStyleIsAuto), new ApplyPropertyDefault<EBorderStyle>(&RenderStyle::outlineStyle, &RenderStyle::setOutlineStyle, &RenderStyle::initialBorderStyle)));
-    setPropertyHandler(CSSPropertyOutlineColor, new ApplyPropertyColor<InheritFromParent>(&RenderStyle::outlineColor, &RenderStyle::setOutlineColor, &RenderStyle::color));
+    setPropertyHandler(CSSPropertyOutlineColor, new ApplyPropertyColor<InheritFromParent>(&RenderStyle::outlineColor, &RenderStyle::setOutlineColor, &RenderStyle::setVisitedLinkOutlineColor, &RenderStyle::color));
     setPropertyHandler(CSSPropertyOutlineOffset, new ApplyPropertyComputeLength<int>(&RenderStyle::outlineOffset, &RenderStyle::setOutlineOffset, &RenderStyle::initialOutlineOffset));
 
     setPropertyHandler(CSSPropertyOverflowX, new ApplyPropertyDefault<EOverflow>(&RenderStyle::overflowX, &RenderStyle::setOverflowX, &RenderStyle::initialOverflowX));
     setPropertyHandler(CSSPropertyOverflowY, new ApplyPropertyDefault<EOverflow>(&RenderStyle::overflowY, &RenderStyle::setOverflowY, &RenderStyle::initialOverflowY));
     setPropertyHandler(CSSPropertyOverflow, new ApplyPropertyExpanding<ExpandValue>(propertyHandler(CSSPropertyOverflowX), propertyHandler(CSSPropertyOverflowY)));
 
     setPropertyHandler(CSSPropertyOutlineOffset, new ApplyPropertyComputeLength<int>(&RenderStyle::outlineOffset, &RenderStyle::setOutlineOffset, &RenderStyle::initialOutlineOffset));
 
     setPropertyHandler(CSSPropertyOverflowX, new ApplyPropertyDefault<EOverflow>(&RenderStyle::overflowX, &RenderStyle::setOverflowX, &RenderStyle::initialOverflowX));
     setPropertyHandler(CSSPropertyOverflowY, new ApplyPropertyDefault<EOverflow>(&RenderStyle::overflowY, &RenderStyle::setOverflowY, &RenderStyle::initialOverflowY));
     setPropertyHandler(CSSPropertyOverflow, new ApplyPropertyExpanding<ExpandValue>(propertyHandler(CSSPropertyOverflowX), propertyHandler(CSSPropertyOverflowY)));
 
-    setPropertyHandler(CSSPropertyWebkitColumnRuleColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::columnRuleColor, &RenderStyle::setColumnRuleColor, &RenderStyle::color));
-    setPropertyHandler(CSSPropertyWebkitTextEmphasisColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::textEmphasisColor, &RenderStyle::setTextEmphasisColor, &RenderStyle::color));
-    setPropertyHandler(CSSPropertyWebkitTextFillColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::textFillColor, &RenderStyle::setTextFillColor, &RenderStyle::color));
-    setPropertyHandler(CSSPropertyWebkitTextStrokeColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::textStrokeColor, &RenderStyle::setTextStrokeColor, &RenderStyle::color));
+    setPropertyHandler(CSSPropertyWebkitColumnRuleColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::columnRuleColor, &RenderStyle::setColumnRuleColor, &RenderStyle::setVisitedLinkColumnRuleColor,  &RenderStyle::color));
+    setPropertyHandler(CSSPropertyWebkitTextEmphasisColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::textEmphasisColor, &RenderStyle::setTextEmphasisColor, &RenderStyle::setVisitedLinkTextEmphasisColor, &RenderStyle::color));
+    setPropertyHandler(CSSPropertyWebkitTextFillColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::textFillColor, &RenderStyle::setTextFillColor, &RenderStyle::setVisitedLinkTextFillColor, &RenderStyle::color));
+    setPropertyHandler(CSSPropertyWebkitTextStrokeColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::textStrokeColor, &RenderStyle::setTextStrokeColor, &RenderStyle::setVisitedLinkTextStrokeColor, &RenderStyle::color));
 
     setPropertyHandler(CSSPropertyTop, new ApplyPropertyLength<AutoEnabled>(&RenderStyle::top, &RenderStyle::setTop, &RenderStyle::initialOffset));
     setPropertyHandler(CSSPropertyRight, new ApplyPropertyLength<AutoEnabled>(&RenderStyle::right, &RenderStyle::setRight, &RenderStyle::initialOffset));
 
     setPropertyHandler(CSSPropertyTop, new ApplyPropertyLength<AutoEnabled>(&RenderStyle::top, &RenderStyle::setTop, &RenderStyle::initialOffset));
     setPropertyHandler(CSSPropertyRight, new ApplyPropertyLength<AutoEnabled>(&RenderStyle::right, &RenderStyle::setRight, &RenderStyle::initialOffset));
index bf1d20c..5e0522c 100644 (file)
@@ -345,6 +345,8 @@ CSSStyleSelector::CSSStyleSelector(Document* document, StyleSheetList* styleShee
     , m_matchAuthorAndUserStyles(matchAuthorAndUserStyles)
     , m_sameOriginOnly(false)
     , m_fontSelector(CSSFontSelector::create(document))
     , m_matchAuthorAndUserStyles(matchAuthorAndUserStyles)
     , m_sameOriginOnly(false)
     , m_fontSelector(CSSFontSelector::create(document))
+    , m_applyPropertyToRegularStyle(true)
+    , m_applyPropertyToVisitedLinkStyle(false)
     , m_applyProperty(CSSStyleApplyProperty::sharedCSSStyleApplyProperty())
 {
     Element* root = document->documentElement();
     , m_applyProperty(CSSStyleApplyProperty::sharedCSSStyleApplyProperty())
 {
     Element* root = document->documentElement();
@@ -1085,22 +1087,9 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl
 
     m_style = RenderStyle::create();
 
 
     m_style = RenderStyle::create();
 
-    if (m_parentStyle) {
+    if (m_parentStyle)
         m_style->inheritFrom(m_parentStyle);
         m_style->inheritFrom(m_parentStyle);
-        
-        // For links and elements inside links we compute both the regular and visited style.
-        // FIXME: Visited link style doesn't need a separate RenderStyle. The few properties allowed should be part of the regular RenderStyle instead.
-        if (e->isLink()) {
-            m_visitedLinkStyle = RenderStyle::clone(m_style.get());
-            m_visitedLinkParentStyle = m_parentStyle;
-        } else if (m_parentStyle->insideLink()) {
-            m_visitedLinkParentStyle = m_parentStyle->getCachedPseudoStyle(VISITED_LINK);
-            if (!m_visitedLinkParentStyle)
-                m_visitedLinkParentStyle = m_parentStyle;
-            m_visitedLinkStyle = RenderStyle::create();
-            m_visitedLinkStyle->inheritFrom(m_visitedLinkParentStyle);
-        }
-    } else {
+    else {
         m_parentStyle = style();
         // Make sure our fonts are initialized if we don't inherit them from our parent style.
         m_style->font().update(0);
         m_parentStyle = style();
         // Make sure our fonts are initialized if we don't inherit them from our parent style.
         m_style->font().update(0);
@@ -1286,23 +1275,6 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl
     if (m_style->hasPseudoStyle(FIRST_LETTER))
         m_style->setUnique();
 
     if (m_style->hasPseudoStyle(FIRST_LETTER))
         m_style->setUnique();
 
-    if (m_visitedLinkStyle) {
-        // Copy any pseudo bits that the visited style has to the primary style so that pseudo
-        // element styles will continue to work for pseudo elements inside :visited links.
-        for (unsigned pseudo = FIRST_PUBLIC_PSEUDOID; pseudo < FIRST_INTERNAL_PSEUDOID; ++pseudo) {
-            if (m_visitedLinkStyle->hasPseudoStyle(static_cast<PseudoId>(pseudo)))
-                m_style->setHasPseudoStyle(static_cast<PseudoId>(pseudo));
-        }
-        if (m_elementLinkState == InsideUnvisitedLink)
-            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.
-        else {
-            // Add the visited style off the main style.
-            m_visitedLinkStyle->setStyleType(VISITED_LINK);
-            m_style->addCachedPseudoStyle(m_visitedLinkStyle.release());
-        }
-        m_visitedLinkParentStyle = 0;
-    }
-
     initElement(0); // Clear out for the next resolve.
 
     // Now return the style.
     initElement(0); // Clear out for the next resolve.
 
     // Now return the style.
@@ -1424,18 +1396,8 @@ PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo,
     initForStyleResolve(e, parentStyle, pseudo);
     m_style = RenderStyle::create();
     
     initForStyleResolve(e, parentStyle, pseudo);
     m_style = RenderStyle::create();
     
-    if (m_parentStyle) {
+    if (m_parentStyle)
         m_style->inheritFrom(m_parentStyle);
         m_style->inheritFrom(m_parentStyle);
-        
-        // For links and elements inside links we compute both the regular and visited style.
-        if (m_parentStyle->insideLink()) {
-            m_visitedLinkParentStyle = m_parentStyle->getCachedPseudoStyle(VISITED_LINK);
-            if (!m_visitedLinkParentStyle)
-                m_visitedLinkParentStyle = m_parentStyle;
-            m_visitedLinkStyle = RenderStyle::create();
-            m_visitedLinkStyle->inheritFrom(m_visitedLinkParentStyle);
-        }
-    }
 
     // Since we don't use pseudo-elements in any of our quirk/print user agent rules, don't waste time walking
     // those rules.
 
     // Since we don't use pseudo-elements in any of our quirk/print user agent rules, don't waste time walking
     // those rules.
@@ -1489,13 +1451,6 @@ PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo,
 
     // Start loading images referenced by this style.
     loadPendingImages();
 
     // Start loading images referenced by this style.
     loadPendingImages();
-
-    // Hang our visited style off m_style.
-    if (m_visitedLinkStyle) {
-        m_visitedLinkStyle->setStyleType(VISITED_LINK);
-        m_style->addCachedPseudoStyle(m_visitedLinkStyle.release());
-        m_visitedLinkParentStyle = 0;
-    }
         
     // Now return the style.
     return m_style.release();
         
     // Now return the style.
     return m_style.release();
@@ -1746,7 +1701,6 @@ void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, RenderStyle* parent
 
 void CSSStyleSelector::updateFont()
 {
 
 void CSSStyleSelector::updateFont()
 {
-    ASSERT(m_style != m_visitedLinkStyle);
     if (!m_fontDirty)
         return;
 
     if (!m_fontDirty)
         return;
 
@@ -2203,8 +2157,6 @@ void CSSStyleSelector::applyDeclaration(CSSMutableStyleDeclaration* styleDeclara
                 continue;
             // we apply line-height later
             if (property == CSSPropertyLineHeight) {
                 continue;
             // we apply line-height later
             if (property == CSSPropertyLineHeight) {
-                if (m_style == m_visitedLinkStyle)
-                    continue;
                 m_lineHeightValue = current.value();
                 continue;
             }
                 m_lineHeightValue = current.value();
                 continue;
             }
@@ -2222,23 +2174,22 @@ void CSSStyleSelector::applyDeclarations(bool isImportant, int startIndex, int e
     if (startIndex == -1)
         return;
 
     if (startIndex == -1)
         return;
 
-    for (int i = startIndex; i <= endIndex; i++) {
-        CSSMutableStyleDeclaration* styleDeclaration = m_matchedDecls[i].styleDeclaration;
-        if (m_visitedLinkStyle && m_matchedDecls[i].linkMatchType & SelectorChecker::MatchVisited) {
-            // FIXME: Style should be passed to applyProperty as an argument, not as a member.
-            RefPtr<RenderStyle> savedStyle = m_style.release();
-            RenderStyle* savedParentStyle = m_parentStyle;
-            m_style = m_visitedLinkStyle;
-            m_parentStyle = m_visitedLinkParentStyle;
-            
-            applyDeclaration<applyFirst>(styleDeclaration, isImportant);
-            
-            m_style = savedStyle.release();
-            m_parentStyle = savedParentStyle;
-        }
-        if (m_matchedDecls[i].linkMatchType & SelectorChecker::MatchLink)
+    if (m_element->isLink()) {
+        for (int i = startIndex; i <= endIndex; ++i) {
+            CSSMutableStyleDeclaration* styleDeclaration = m_matchedDecls[i].styleDeclaration;
+            unsigned linkMatchType = m_matchedDecls[i].linkMatchType;
+            // FIXME: It would be nicer to pass these as arguments but that requires changes in many places.
+            m_applyPropertyToRegularStyle = linkMatchType & SelectorChecker::MatchLink;
+            m_applyPropertyToVisitedLinkStyle = linkMatchType & SelectorChecker::MatchVisited;
+
             applyDeclaration<applyFirst>(styleDeclaration, isImportant);        
             applyDeclaration<applyFirst>(styleDeclaration, isImportant);        
+        }
+        m_applyPropertyToRegularStyle = true;
+        m_applyPropertyToVisitedLinkStyle = false;
+        return;
     }
     }
+    for (int i = startIndex; i <= endIndex; ++i)        
+        applyDeclaration<applyFirst>(m_matchedDecls[i].styleDeclaration, isImportant);
 }
 
 void CSSStyleSelector::matchPageRules(RuleSet* rules, bool isLeftPage, bool isFirstPage, const String& pageName)
 }
 
 void CSSStyleSelector::matchPageRules(RuleSet* rules, bool isLeftPage, bool isFirstPage, const String& pageName)
@@ -2423,7 +2374,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
     bool isInherit = m_parentNode && valueType == CSSValue::CSS_INHERIT;
     bool isInitial = valueType == CSSValue::CSS_INITIAL || (!m_parentNode && valueType == CSSValue::CSS_INHERIT);
 
     bool isInherit = m_parentNode && valueType == CSSValue::CSS_INHERIT;
     bool isInitial = valueType == CSSValue::CSS_INITIAL || (!m_parentNode && valueType == CSSValue::CSS_INHERIT);
 
-    if (m_style == m_visitedLinkStyle && !isValidVisitedLinkProperty(id)) {
+    if (!applyPropertyToRegularStyle() && (!applyPropertyToVisitedLinkStyle() || !isValidVisitedLinkProperty(id))) {
         // Limit the properties that can be applied to only the ones honored by :visited.
         return;
     }
         // Limit the properties that can be applied to only the ones honored by :visited.
         return;
     }
@@ -4942,7 +4893,7 @@ static Color colorForCSSValue(int cssValueId)
     return RenderTheme::defaultTheme()->systemColor(cssValueId);
 }
 
     return RenderTheme::defaultTheme()->systemColor(cssValueId);
 }
 
-Color CSSStyleSelector::getColorFromPrimitiveValue(CSSPrimitiveValue* primitiveValue) const
+Color CSSStyleSelector::getColorFromPrimitiveValue(CSSPrimitiveValue* primitiveValue, bool forVisitedLink) const
 {
     Color col;
     int ident = primitiveValue->getIdent();
 {
     Color col;
     int ident = primitiveValue->getIdent();
@@ -4950,7 +4901,7 @@ Color CSSStyleSelector::getColorFromPrimitiveValue(CSSPrimitiveValue* primitiveV
         if (ident == CSSValueWebkitText)
             col = m_element->document()->textColor();
         else if (ident == CSSValueWebkitLink)
         if (ident == CSSValueWebkitText)
             col = m_element->document()->textColor();
         else if (ident == CSSValueWebkitLink)
-            col = m_element->isLink() && m_style == m_visitedLinkStyle ? m_element->document()->visitedLinkColor() : m_element->document()->linkColor();
+            col = (m_element->isLink() && forVisitedLink) ? m_element->document()->visitedLinkColor() : m_element->document()->linkColor();
         else if (ident == CSSValueWebkitActivelink)
             col = m_element->document()->activeLinkColor();
         else if (ident == CSSValueWebkitFocusRingColor)
         else if (ident == CSSValueWebkitActivelink)
             col = m_element->document()->activeLinkColor();
         else if (ident == CSSValueWebkitFocusRingColor)
index 43d891c..e4109d8 100644 (file)
@@ -173,7 +173,7 @@ private:
 public:
     bool useSVGZoomRules();
 
 public:
     bool useSVGZoomRules();
 
-    Color getColorFromPrimitiveValue(CSSPrimitiveValue*) const;
+    Color getColorFromPrimitiveValue(CSSPrimitiveValue*, bool forVisitedLink = false) const;
 
     bool hasSelectorForAttribute(const AtomicString&) const;
 
 
     bool hasSelectorForAttribute(const AtomicString&) const;
 
@@ -260,6 +260,9 @@ public:
 
     StyleImage* styleImage(CSSPropertyID, CSSValue*);
     StyleImage* cachedOrPendingFromValue(CSSPropertyID, CSSImageValue*);
 
     StyleImage* styleImage(CSSPropertyID, CSSValue*);
     StyleImage* cachedOrPendingFromValue(CSSPropertyID, CSSImageValue*);
+    
+    bool applyPropertyToRegularStyle() const { return m_applyPropertyToRegularStyle; }
+    bool applyPropertyToVisitedLinkStyle() const { return m_applyPropertyToVisitedLinkStyle; }
 
 private:
     static RenderStyle* s_styleNotYetAvailable;
 
 private:
     static RenderStyle* s_styleNotYetAvailable;
@@ -334,9 +337,7 @@ private:
     SelectorChecker m_checker;
 
     RefPtr<RenderStyle> m_style;
     SelectorChecker m_checker;
 
     RefPtr<RenderStyle> m_style;
-    RefPtr<RenderStyle> m_visitedLinkStyle;
     RenderStyle* m_parentStyle;
     RenderStyle* m_parentStyle;
-    RenderStyle* m_visitedLinkParentStyle;
     RenderStyle* m_rootElementStyle;
     Element* m_element;
     StyledElement* m_styledElement;
     RenderStyle* m_rootElementStyle;
     Element* m_element;
     StyledElement* m_styledElement;
@@ -351,6 +352,8 @@ private:
     Vector<CSSMutableStyleDeclaration*> m_additionalAttributeStyleDecls;
     Vector<MediaQueryResult*> m_viewportDependentMediaQueryResults;
 
     Vector<CSSMutableStyleDeclaration*> m_additionalAttributeStyleDecls;
     Vector<MediaQueryResult*> m_viewportDependentMediaQueryResults;
 
+    bool m_applyPropertyToRegularStyle;
+    bool m_applyPropertyToVisitedLinkStyle;
     const CSSStyleApplyProperty& m_applyProperty;
     
     friend class CSSStyleApplyProperty;
     const CSSStyleApplyProperty& m_applyProperty;
     
     friend class CSSStyleApplyProperty;
index 4f663af..87a8521 100644 (file)
@@ -226,16 +226,16 @@ void CSSStyleSelector::applySVGProperty(int id, CSSValue* value)
         {
             if (isInherit) {
                 const SVGRenderStyle* svgParentStyle = m_parentStyle->svgStyle();
         {
             if (isInherit) {
                 const SVGRenderStyle* svgParentStyle = m_parentStyle->svgStyle();
-                svgstyle->setFillPaint(svgParentStyle->fillPaintType(), svgParentStyle->fillPaintColor(), svgParentStyle->fillPaintUri());
+                svgstyle->setFillPaint(svgParentStyle->fillPaintType(), svgParentStyle->fillPaintColor(), svgParentStyle->fillPaintUri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());
                 return;
             }
             if (isInitial) {
                 return;
             }
             if (isInitial) {
-                svgstyle->setFillPaint(SVGRenderStyle::initialFillPaintType(), SVGRenderStyle::initialFillPaintColor(), SVGRenderStyle::initialFillPaintUri());
+                svgstyle->setFillPaint(SVGRenderStyle::initialFillPaintType(), SVGRenderStyle::initialFillPaintColor(), SVGRenderStyle::initialFillPaintUri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());
                 return;
             }
             if (value->isSVGPaint()) {
                 SVGPaint* svgPaint = static_cast<SVGPaint*>(value);
                 return;
             }
             if (value->isSVGPaint()) {
                 SVGPaint* svgPaint = static_cast<SVGPaint*>(value);
-                svgstyle->setFillPaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, m_style->color()), svgPaint->uri());
+                svgstyle->setFillPaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, m_style->color()), svgPaint->uri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());
             }
             break;
         }
             }
             break;
         }
@@ -243,16 +243,16 @@ void CSSStyleSelector::applySVGProperty(int id, CSSValue* value)
         {
             if (isInherit) {
                 const SVGRenderStyle* svgParentStyle = m_parentStyle->svgStyle();
         {
             if (isInherit) {
                 const SVGRenderStyle* svgParentStyle = m_parentStyle->svgStyle();
-                svgstyle->setStrokePaint(svgParentStyle->strokePaintType(), svgParentStyle->strokePaintColor(), svgParentStyle->strokePaintUri());
+                svgstyle->setStrokePaint(svgParentStyle->strokePaintType(), svgParentStyle->strokePaintColor(), svgParentStyle->strokePaintUri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());
                 return;
             }
             if (isInitial) {
                 return;
             }
             if (isInitial) {
-                svgstyle->setStrokePaint(SVGRenderStyle::initialStrokePaintType(), SVGRenderStyle::initialStrokePaintColor(), SVGRenderStyle::initialStrokePaintUri());
+                svgstyle->setStrokePaint(SVGRenderStyle::initialStrokePaintType(), SVGRenderStyle::initialStrokePaintColor(), SVGRenderStyle::initialStrokePaintUri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());
                 return;
             }
             if (value->isSVGPaint()) {
                 SVGPaint* svgPaint = static_cast<SVGPaint*>(value);
                 return;
             }
             if (value->isSVGPaint()) {
                 SVGPaint* svgPaint = static_cast<SVGPaint*>(value);
-                svgstyle->setStrokePaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, m_style->color()), svgPaint->uri());
+                svgstyle->setStrokePaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, m_style->color()), svgPaint->uri(), applyPropertyToRegularStyle(), applyPropertyToVisitedLinkStyle());
             }
             break;
         }
             }
             break;
         }
index e8033e3..c790149 100644 (file)
@@ -1017,11 +1017,7 @@ bool Element::pseudoStyleCacheIsInvalid(const RenderStyle* currentStyle, RenderS
     for (size_t i = 0; i < cacheSize; ++i) {
         RefPtr<RenderStyle> newPseudoStyle;
         PseudoId pseudoId = pseudoStyleCache->at(i)->styleType();
     for (size_t i = 0; i < cacheSize; ++i) {
         RefPtr<RenderStyle> newPseudoStyle;
         PseudoId pseudoId = pseudoStyleCache->at(i)->styleType();
-        if (pseudoId == VISITED_LINK) {
-            newPseudoStyle =  newStyle->getCachedPseudoStyle(VISITED_LINK); // This pseudo-style was aggressively computed already when we first called styleForElement on the new style.
-            if (!newPseudoStyle || *newPseudoStyle != *pseudoStyleCache->at(i))
-                return true;
-        } else if (pseudoId == FIRST_LINE || pseudoId == FIRST_LINE_INHERITED)
+        if (pseudoId == FIRST_LINE || pseudoId == FIRST_LINE_INHERITED)
             newPseudoStyle = renderer()->uncachedFirstLineStyle(newStyle);
         else
             newPseudoStyle = renderer()->getUncachedPseudoStyle(pseudoId, newStyle, newStyle);
             newPseudoStyle = renderer()->uncachedFirstLineStyle(newStyle);
         else
             newPseudoStyle = renderer()->getUncachedPseudoStyle(pseudoId, newStyle, newStyle);
index ce68798..7543f2a 100644 (file)
@@ -232,16 +232,11 @@ void RenderStyle::setHasPseudoStyle(PseudoId pseudo)
 
 RenderStyle* RenderStyle::getCachedPseudoStyle(PseudoId pid) const
 {
 
 RenderStyle* RenderStyle::getCachedPseudoStyle(PseudoId pid) const
 {
-    ASSERT(styleType() != VISITED_LINK);
-
     if (!m_cachedPseudoStyles || !m_cachedPseudoStyles->size())
         return 0;
 
     if (!m_cachedPseudoStyles || !m_cachedPseudoStyles->size())
         return 0;
 
-    if (styleType() != NOPSEUDO) {
-        if (pid == VISITED_LINK)
-            return m_cachedPseudoStyles->at(0)->styleType() == VISITED_LINK ? m_cachedPseudoStyles->at(0).get() : 0;
+    if (styleType() != NOPSEUDO) 
         return 0;
         return 0;
-    }
 
     for (size_t i = 0; i < m_cachedPseudoStyles->size(); ++i) {
         RenderStyle* pseudoStyle = m_cachedPseudoStyles->at(i).get();
 
     for (size_t i = 0; i < m_cachedPseudoStyles->size(); ++i) {
         RenderStyle* pseudoStyle = m_cachedPseudoStyles->at(i).get();
@@ -1123,46 +1118,46 @@ void RenderStyle::getShadowVerticalExtent(const ShadowData* shadow, LayoutUnit &
     }
 }
 
     }
 }
 
-Color RenderStyle::colorIncludingFallback(int colorProperty) const
+Color RenderStyle::colorIncludingFallback(int colorProperty, bool visitedLink) const
 {
     Color result;
     EBorderStyle borderStyle = BNONE;
     switch (colorProperty) {
     case CSSPropertyBackgroundColor:
 {
     Color result;
     EBorderStyle borderStyle = BNONE;
     switch (colorProperty) {
     case CSSPropertyBackgroundColor:
-        return backgroundColor(); // Background color doesn't fall back.
+        return visitedLink ? rareNonInheritedData->m_visitedLinkBackgroundColor : backgroundColor(); // Background color doesn't fall back.
     case CSSPropertyBorderLeftColor:
     case CSSPropertyBorderLeftColor:
-        result = borderLeftColor();
+        result = visitedLink ? rareNonInheritedData->m_visitedLinkBorderLeftColor : borderLeftColor();
         borderStyle = borderLeftStyle();
         break;
     case CSSPropertyBorderRightColor:
         borderStyle = borderLeftStyle();
         break;
     case CSSPropertyBorderRightColor:
-        result = borderRightColor();
+        result = visitedLink ? rareNonInheritedData->m_visitedLinkBorderRightColor : borderRightColor();
         borderStyle = borderRightStyle();
         break;
     case CSSPropertyBorderTopColor:
         borderStyle = borderRightStyle();
         break;
     case CSSPropertyBorderTopColor:
-        result = borderTopColor();
+        result = visitedLink ? rareNonInheritedData->m_visitedLinkBorderTopColor : borderTopColor();
         borderStyle = borderTopStyle();
         break;
     case CSSPropertyBorderBottomColor:
         borderStyle = borderTopStyle();
         break;
     case CSSPropertyBorderBottomColor:
-        result = borderBottomColor();
+        result = visitedLink ? rareNonInheritedData->m_visitedLinkBorderBottomColor : borderBottomColor();
         borderStyle = borderBottomStyle();
         break;
     case CSSPropertyColor:
         borderStyle = borderBottomStyle();
         break;
     case CSSPropertyColor:
-        result = color();
+        result = visitedLink ? inherited->visitedLinkColor : color();
         break;
     case CSSPropertyOutlineColor:
         break;
     case CSSPropertyOutlineColor:
-        result = outlineColor();
+        result = visitedLink ? rareNonInheritedData->m_visitedLinkOutlineColor : outlineColor();
         break;
     case CSSPropertyWebkitColumnRuleColor:
         break;
     case CSSPropertyWebkitColumnRuleColor:
-        result = columnRuleColor();
+        result = visitedLink ? rareNonInheritedData->m_multiCol->m_visitedLinkColumnRuleColor : columnRuleColor();
         break;
     case CSSPropertyWebkitTextEmphasisColor:
         break;
     case CSSPropertyWebkitTextEmphasisColor:
-        result = textEmphasisColor();
+        result = visitedLink ? rareInheritedData->visitedLinkTextEmphasisColor : textEmphasisColor();
         break;
     case CSSPropertyWebkitTextFillColor:
         break;
     case CSSPropertyWebkitTextFillColor:
-        result = textFillColor();
+        result = visitedLink ? rareInheritedData->visitedLinkTextFillColor : textFillColor();
         break;
     case CSSPropertyWebkitTextStrokeColor:
         break;
     case CSSPropertyWebkitTextStrokeColor:
-        result = textStrokeColor();
+        result = visitedLink ? rareInheritedData->visitedLinkTextStrokeColor : textStrokeColor();
         break;
     default:
         ASSERT_NOT_REACHED();
         break;
     default:
         ASSERT_NOT_REACHED();
@@ -1170,25 +1165,21 @@ Color RenderStyle::colorIncludingFallback(int colorProperty) const
     }
 
     if (!result.isValid()) {
     }
 
     if (!result.isValid()) {
-        if (borderStyle == INSET || borderStyle == OUTSET || borderStyle == RIDGE || borderStyle == GROOVE)
+        if (!visitedLink && (borderStyle == INSET || borderStyle == OUTSET || borderStyle == RIDGE || borderStyle == GROOVE))
             result.setRGB(238, 238, 238);
         else
             result.setRGB(238, 238, 238);
         else
-            result = color();
+            result = visitedLink ? inherited->visitedLinkColor : color();
     }
     }
-
     return result;
 }
 
 Color RenderStyle::visitedDependentColor(int colorProperty) const
 {
     return result;
 }
 
 Color RenderStyle::visitedDependentColor(int colorProperty) const
 {
-    Color unvisitedColor = colorIncludingFallback(colorProperty);
+    Color unvisitedColor = colorIncludingFallback(colorProperty, false);
     if (insideLink() != InsideVisitedLink)
         return unvisitedColor;
 
     if (insideLink() != InsideVisitedLink)
         return unvisitedColor;
 
-    RenderStyle* visitedStyle = getCachedPseudoStyle(VISITED_LINK);
-    if (!visitedStyle)
-        return unvisitedColor;
-    Color visitedColor = visitedStyle->colorIncludingFallback(colorProperty);
+    Color visitedColor = colorIncludingFallback(colorProperty, true);
 
     // FIXME: Technically someone could explicitly specify the color transparent, but for now we'll just
     // assume that if the background color is transparent that it wasn't set. Note that it's weird that
 
     // FIXME: Technically someone could explicitly specify the color transparent, but for now we'll just
     // assume that if the background color is transparent that it wasn't set. Note that it's weird that
index 0f7626f..e14bd92 100644 (file)
@@ -1480,6 +1480,18 @@ public:
     static const FilterOperations& initialFilter() { DEFINE_STATIC_LOCAL(FilterOperations, ops, ()); return ops; }
 #endif
 private:
     static const FilterOperations& initialFilter() { DEFINE_STATIC_LOCAL(FilterOperations, ops, ()); return ops; }
 #endif
 private:
+    void setVisitedLinkColor(const Color& v) { SET_VAR(inherited, visitedLinkColor, v) }
+    void setVisitedLinkBackgroundColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBackgroundColor, v) }
+    void setVisitedLinkBorderLeftColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderLeftColor, v) }
+    void setVisitedLinkBorderRightColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderRightColor, v) }
+    void setVisitedLinkBorderBottomColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderBottomColor, v) }
+    void setVisitedLinkBorderTopColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderTopColor, v) }
+    void setVisitedLinkOutlineColor(const Color& v) { SET_VAR(rareNonInheritedData, m_visitedLinkOutlineColor, v) }
+    void setVisitedLinkColumnRuleColor(const Color& v) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_visitedLinkColumnRuleColor, v) }
+    void setVisitedLinkTextEmphasisColor(const Color& v) { SET_VAR(rareInheritedData, visitedLinkTextEmphasisColor, v) }
+    void setVisitedLinkTextFillColor(const Color& v) { SET_VAR(rareInheritedData, visitedLinkTextFillColor, v) }
+    void setVisitedLinkTextStrokeColor(const Color& v) { SET_VAR(rareInheritedData, visitedLinkTextStrokeColor, v) }
+
     void inheritUnicodeBidiFrom(const RenderStyle* parent) { noninherited_flags._unicodeBidi = parent->noninherited_flags._unicodeBidi; }
     void getShadowExtent(const ShadowData*, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const;
     void getShadowHorizontalExtent(const ShadowData*, LayoutUnit& left, LayoutUnit& right) const;
     void inheritUnicodeBidiFrom(const RenderStyle* parent) { noninherited_flags._unicodeBidi = parent->noninherited_flags._unicodeBidi; }
     void getShadowExtent(const ShadowData*, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const;
     void getShadowHorizontalExtent(const ShadowData*, LayoutUnit& left, LayoutUnit& right) const;
@@ -1518,7 +1530,7 @@ private:
     const Color& textFillColor() const { return rareInheritedData->textFillColor; }
     const Color& textStrokeColor() const { return rareInheritedData->textStrokeColor; }
     
     const Color& textFillColor() const { return rareInheritedData->textFillColor; }
     const Color& textStrokeColor() const { return rareInheritedData->textStrokeColor; }
     
-    Color colorIncludingFallback(int colorProperty) const;
+    Color colorIncludingFallback(int colorProperty, bool visitedLink) const;
 
 #if ENABLE(SVG)
     const Color& stopColor() const { return svgStyle()->stopColor(); }
 
 #if ENABLE(SVG)
     const Color& stopColor() const { return svgStyle()->stopColor(); }
index 1de57f2..dd9a1db 100644 (file)
@@ -75,7 +75,7 @@ enum PseudoId {
     NOPSEUDO, FIRST_LINE, FIRST_LETTER, BEFORE, AFTER, SELECTION, FIRST_LINE_INHERITED, SCROLLBAR,
     // Internal IDs follow:
     SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER,
     NOPSEUDO, FIRST_LINE, FIRST_LETTER, BEFORE, AFTER, SELECTION, FIRST_LINE_INHERITED, SCROLLBAR,
     // Internal IDs follow:
     SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER,
-    INPUT_LIST_BUTTON, VISITED_LINK,
+    INPUT_LIST_BUTTON,
     AFTER_LAST_INTERNAL_PSEUDOID,
     FULL_SCREEN, FULL_SCREEN_DOCUMENT, FULL_SCREEN_ANCESTOR, ANIMATING_FULL_SCREEN_TRANSITION,
     FIRST_PUBLIC_PSEUDOID = FIRST_LINE,
     AFTER_LAST_INTERNAL_PSEUDOID,
     FULL_SCREEN, FULL_SCREEN_DOCUMENT, FULL_SCREEN_ANCESTOR, ANIMATING_FULL_SCREEN_TRANSITION,
     FIRST_PUBLIC_PSEUDOID = FIRST_LINE,
index 4aadeea..55f47b2 100644 (file)
@@ -152,14 +152,24 @@ public:
             fill.access()->opacity = obj;
     }
 
             fill.access()->opacity = obj;
     }
 
-    void setFillPaint(SVGPaint::SVGPaintType type, const Color& color, const String& uri)
+    void setFillPaint(SVGPaint::SVGPaintType type, const Color& color, const String& uri, bool applyToRegularStyle = true, bool applyToVisitedLinkStyle = false)
     {
     {
-        if (!(fill->paintType == type))
-            fill.access()->paintType = type;
-        if (!(fill->paintColor == color))
-            fill.access()->paintColor = color;
-        if (!(fill->paintUri == uri))
-            fill.access()->paintUri = uri;
+        if (applyToRegularStyle) {
+            if (!(fill->paintType == type))
+                fill.access()->paintType = type;
+            if (!(fill->paintColor == color))
+                fill.access()->paintColor = color;
+            if (!(fill->paintUri == uri))
+                fill.access()->paintUri = uri;
+        }
+        if (applyToVisitedLinkStyle) {
+            if (!(fill->paintType == type))
+                fill.access()->visitedLinkPaintType = type;
+            if (!(fill->paintColor == color))
+                fill.access()->visitedLinkPaintColor = color;
+            if (!(fill->paintUri == uri))
+                fill.access()->visitedLinkPaintUri = uri;
+        }
     }
 
     void setStrokeOpacity(float obj)
     }
 
     void setStrokeOpacity(float obj)
@@ -168,14 +178,24 @@ public:
             stroke.access()->opacity = obj;
     }
 
             stroke.access()->opacity = obj;
     }
 
-    void setStrokePaint(SVGPaint::SVGPaintType type, const Color& color, const String& uri)
+    void setStrokePaint(SVGPaint::SVGPaintType type, const Color& color, const String& uri, bool applyToRegularStyle = true, bool applyToVisitedLinkStyle = false)
     {
     {
-        if (!(stroke->paintType == type))
-            stroke.access()->paintType = type;
-        if (!(stroke->paintColor == color))
-            stroke.access()->paintColor = color;
-        if (!(stroke->paintUri == uri))
-            stroke.access()->paintUri = uri;
+        if (applyToRegularStyle) {
+            if (!(stroke->paintType == type))
+                stroke.access()->paintType = type;
+            if (!(stroke->paintColor == color))
+                stroke.access()->paintColor = color;
+            if (!(stroke->paintUri == uri))
+                stroke.access()->paintUri = uri;
+        }
+        if (applyToVisitedLinkStyle) {
+            if (!(stroke->paintType == type))
+                stroke.access()->visitedLinkPaintType = type;
+            if (!(stroke->paintColor == color))
+                stroke.access()->visitedLinkPaintColor = color;
+            if (!(stroke->paintUri == uri))
+                stroke.access()->visitedLinkPaintUri = uri;
+        }
     }
 
     void setStrokeDashArray(const Vector<SVGLength>& obj)
     }
 
     void setStrokeDashArray(const Vector<SVGLength>& obj)
@@ -327,6 +347,13 @@ public:
     String markerStartResource() const { return inheritedResources->markerStart; }
     String markerMidResource() const { return inheritedResources->markerMid; }
     String markerEndResource() const { return inheritedResources->markerEnd; }
     String markerStartResource() const { return inheritedResources->markerStart; }
     String markerMidResource() const { return inheritedResources->markerMid; }
     String markerEndResource() const { return inheritedResources->markerEnd; }
+    
+    const SVGPaint::SVGPaintType& visitedLinkFillPaintType() const { return fill->visitedLinkPaintType; }
+    const Color& visitedLinkFillPaintColor() const { return fill->visitedLinkPaintColor; }
+    const String& visitedLinkFillPaintUri() const { return fill->visitedLinkPaintUri; }
+    const SVGPaint::SVGPaintType& visitedLinkStrokePaintType() const { return stroke->visitedLinkPaintType; }
+    const Color& visitedLinkStrokePaintColor() const { return stroke->visitedLinkPaintColor; }
+    const String& visitedLinkStrokePaintUri() const { return stroke->visitedLinkPaintUri; }
 
     // convenience
     bool hasClipper() const { return !clipperResource().isEmpty(); }
 
     // convenience
     bool hasClipper() const { return !clipperResource().isEmpty(); }
index fe8ce5d..e8c8098 100644 (file)
@@ -40,6 +40,9 @@ StyleFillData::StyleFillData()
     , paintType(SVGRenderStyle::initialFillPaintType())
     , paintColor(SVGRenderStyle::initialFillPaintColor())
     , paintUri(SVGRenderStyle::initialFillPaintUri())
     , paintType(SVGRenderStyle::initialFillPaintType())
     , paintColor(SVGRenderStyle::initialFillPaintColor())
     , paintUri(SVGRenderStyle::initialFillPaintUri())
+    , visitedLinkPaintType(SVGRenderStyle::initialStrokePaintType())
+    , visitedLinkPaintColor(SVGRenderStyle::initialFillPaintColor())
+    , visitedLinkPaintUri(SVGRenderStyle::initialFillPaintUri())
 {
 }
 
 {
 }
 
@@ -49,6 +52,9 @@ StyleFillData::StyleFillData(const StyleFillData& other)
     , paintType(other.paintType)
     , paintColor(other.paintColor)
     , paintUri(other.paintUri)
     , paintType(other.paintType)
     , paintColor(other.paintColor)
     , paintUri(other.paintUri)
+    , visitedLinkPaintType(other.visitedLinkPaintType)
+    , visitedLinkPaintColor(other.visitedLinkPaintColor)
+    , visitedLinkPaintUri(other.visitedLinkPaintUri)
 {
 }
 
 {
 }
 
@@ -57,7 +63,10 @@ bool StyleFillData::operator==(const StyleFillData& other) const
     return opacity == other.opacity 
         && paintType == other.paintType
         && paintColor == other.paintColor
     return opacity == other.opacity 
         && paintType == other.paintType
         && paintColor == other.paintColor
-        && paintUri == other.paintUri;
+        && paintUri == other.paintUri
+        && visitedLinkPaintType == other.visitedLinkPaintType
+        && visitedLinkPaintColor == other.visitedLinkPaintColor
+        && visitedLinkPaintUri == other.visitedLinkPaintUri;
 }
 
 StyleStrokeData::StyleStrokeData()
 }
 
 StyleStrokeData::StyleStrokeData()
@@ -69,6 +78,9 @@ StyleStrokeData::StyleStrokeData()
     , paintType(SVGRenderStyle::initialStrokePaintType())
     , paintColor(SVGRenderStyle::initialStrokePaintColor())
     , paintUri(SVGRenderStyle::initialStrokePaintUri())
     , paintType(SVGRenderStyle::initialStrokePaintType())
     , paintColor(SVGRenderStyle::initialStrokePaintColor())
     , paintUri(SVGRenderStyle::initialStrokePaintUri())
+    , visitedLinkPaintType(SVGRenderStyle::initialStrokePaintType())
+    , visitedLinkPaintColor(SVGRenderStyle::initialStrokePaintColor())
+    , visitedLinkPaintUri(SVGRenderStyle::initialStrokePaintUri())
 {
 }
 
 {
 }
 
@@ -82,6 +94,9 @@ StyleStrokeData::StyleStrokeData(const StyleStrokeData& other)
     , paintType(other.paintType)
     , paintColor(other.paintColor)
     , paintUri(other.paintUri)
     , paintType(other.paintType)
     , paintColor(other.paintColor)
     , paintUri(other.paintUri)
+    , visitedLinkPaintType(other.visitedLinkPaintType)
+    , visitedLinkPaintColor(other.visitedLinkPaintColor)
+    , visitedLinkPaintUri(other.visitedLinkPaintUri)
 {
 }
 
 {
 }
 
@@ -94,7 +109,10 @@ bool StyleStrokeData::operator==(const StyleStrokeData& other) const
         && dashArray == other.dashArray
         && paintType == other.paintType
         && paintColor == other.paintColor
         && dashArray == other.dashArray
         && paintType == other.paintType
         && paintColor == other.paintColor
-        && paintUri == other.paintUri;
+        && paintUri == other.paintUri
+        && visitedLinkPaintType == other.visitedLinkPaintType
+        && visitedLinkPaintColor == other.visitedLinkPaintColor
+        && visitedLinkPaintUri == other.visitedLinkPaintUri;
 }
 
 StyleStopData::StyleStopData()
 }
 
 StyleStopData::StyleStopData()
index 2c33c6d..931dbe3 100644 (file)
@@ -103,6 +103,9 @@ namespace WebCore {
         SVGPaint::SVGPaintType paintType;
         Color paintColor;
         String paintUri;
         SVGPaint::SVGPaintType paintType;
         Color paintColor;
         String paintUri;
+        SVGPaint::SVGPaintType visitedLinkPaintType;
+        Color visitedLinkPaintColor;
+        String visitedLinkPaintUri;
 
     private:
         StyleFillData();
 
     private:
         StyleFillData();
@@ -130,6 +133,9 @@ namespace WebCore {
         SVGPaint::SVGPaintType paintType;
         Color paintColor;
         String paintUri;
         SVGPaint::SVGPaintType paintType;
         Color paintColor;
         String paintUri;
+        SVGPaint::SVGPaintType visitedLinkPaintType;
+        Color visitedLinkPaintColor;
+        String visitedLinkPaintUri;
 
     private:        
         StyleStrokeData();
 
     private:        
         StyleStrokeData();
index d0998c5..ad14cbb 100644 (file)
@@ -33,6 +33,7 @@ StyleInheritedData::StyleInheritedData()
     , line_height(RenderStyle::initialLineHeight())
     , list_style_image(RenderStyle::initialListStyleImage())
     , color(RenderStyle::initialColor())
     , line_height(RenderStyle::initialLineHeight())
     , list_style_image(RenderStyle::initialListStyleImage())
     , color(RenderStyle::initialColor())
+    , visitedLinkColor(RenderStyle::initialColor())
 {
 }
 
 {
 }
 
@@ -48,18 +49,19 @@ StyleInheritedData::StyleInheritedData(const StyleInheritedData& o)
     , list_style_image(o.list_style_image)
     , font(o.font)
     , color(o.color)
     , list_style_image(o.list_style_image)
     , font(o.font)
     , color(o.color)
+    , visitedLinkColor(o.visitedLinkColor)
 {
 }
 
 bool StyleInheritedData::operator==(const StyleInheritedData& o) const
 {
 {
 }
 
 bool StyleInheritedData::operator==(const StyleInheritedData& o) const
 {
-    return
-        line_height == o.line_height &&
-        StyleImage::imagesEquivalent(list_style_image.get(), o.list_style_image.get()) &&
-        font == o.font &&
-        color == o.color &&
-        horizontal_border_spacing == o.horizontal_border_spacing &&
-        vertical_border_spacing == o.vertical_border_spacing;
+    return line_height == o.line_height
+        && StyleImage::imagesEquivalent(list_style_image.get(), o.list_style_image.get())
+        && font == o.font
+        && color == o.color
+        && visitedLinkColor == o.visitedLinkColor
+        && horizontal_border_spacing == o.horizontal_border_spacing
+        && vertical_border_spacing == o.vertical_border_spacing;
 }
 
 } // namespace WebCore
 }
 
 } // namespace WebCore
index 262a659..6cb7bc5 100644 (file)
@@ -59,6 +59,7 @@ public:
 
     Font font;
     Color color;
 
     Font font;
     Color color;
+    Color visitedLinkColor;
 
 private:
     StyleInheritedData();
 
 private:
     StyleInheritedData();
index 3366e9f..66e584c 100644 (file)
@@ -46,6 +46,7 @@ StyleMultiColData::StyleMultiColData(const StyleMultiColData& o)
     , m_count(o.m_count)
     , m_gap(o.m_gap)
     , m_rule(o.m_rule)
     , m_count(o.m_count)
     , m_gap(o.m_gap)
     , m_rule(o.m_rule)
+    , m_visitedLinkColumnRuleColor(o.m_visitedLinkColumnRuleColor)
     , m_autoWidth(o.m_autoWidth)
     , m_autoCount(o.m_autoCount)
     , m_normalGap(o.m_normalGap)
     , m_autoWidth(o.m_autoWidth)
     , m_autoCount(o.m_autoCount)
     , m_normalGap(o.m_normalGap)
@@ -59,7 +60,7 @@ StyleMultiColData::StyleMultiColData(const StyleMultiColData& o)
 bool StyleMultiColData::operator==(const StyleMultiColData& o) const
 {
     return m_width == o.m_width && m_count == o.m_count && m_gap == o.m_gap
 bool StyleMultiColData::operator==(const StyleMultiColData& o) const
 {
     return m_width == o.m_width && m_count == o.m_count && m_gap == o.m_gap
-           && m_rule == o.m_rule && m_breakBefore == o.m_breakBefore
+           && m_rule == o.m_rule && m_visitedLinkColumnRuleColor == o.m_visitedLinkColumnRuleColor && m_breakBefore == o.m_breakBefore
            && m_autoWidth == o.m_autoWidth && m_autoCount == o.m_autoCount && m_normalGap == o.m_normalGap
            && m_columnSpan == o.m_columnSpan && m_breakAfter == o.m_breakAfter && m_breakInside == o.m_breakInside;
 }
            && m_autoWidth == o.m_autoWidth && m_autoCount == o.m_autoCount && m_normalGap == o.m_normalGap
            && m_columnSpan == o.m_columnSpan && m_breakAfter == o.m_breakAfter && m_breakInside == o.m_breakInside;
 }
index 9948846..854e0f9 100644 (file)
@@ -57,6 +57,7 @@ public:
     unsigned short m_count;
     float m_gap;
     BorderValue m_rule;
     unsigned short m_count;
     float m_gap;
     BorderValue m_rule;
+    Color m_visitedLinkColumnRuleColor;
 
     bool m_autoWidth : 1;
     bool m_autoCount : 1;
 
     bool m_autoWidth : 1;
     bool m_autoCount : 1;
index f9fb3a9..ac5e728 100644 (file)
@@ -68,6 +68,9 @@ StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o)
     , textStrokeWidth(o.textStrokeWidth)
     , textFillColor(o.textFillColor)
     , textEmphasisColor(o.textEmphasisColor)
     , textStrokeWidth(o.textStrokeWidth)
     , textFillColor(o.textFillColor)
     , textEmphasisColor(o.textEmphasisColor)
+    , visitedLinkTextStrokeColor(o.visitedLinkTextStrokeColor)
+    , visitedLinkTextFillColor(o.visitedLinkTextFillColor)
+    , visitedLinkTextEmphasisColor(o.visitedLinkTextEmphasisColor)
     , textShadow(o.textShadow ? adoptPtr(new ShadowData(*o.textShadow)) : nullptr)
     , highlight(o.highlight)
     , cursorData(o.cursorData)
     , textShadow(o.textShadow ? adoptPtr(new ShadowData(*o.textShadow)) : nullptr)
     , highlight(o.highlight)
     , cursorData(o.cursorData)
@@ -123,6 +126,9 @@ bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const
         && textStrokeWidth == o.textStrokeWidth
         && textFillColor == o.textFillColor
         && textEmphasisColor == o.textEmphasisColor
         && textStrokeWidth == o.textStrokeWidth
         && textFillColor == o.textFillColor
         && textEmphasisColor == o.textEmphasisColor
+        && visitedLinkTextStrokeColor == o.visitedLinkTextStrokeColor
+        && visitedLinkTextFillColor == o.visitedLinkTextFillColor
+        && visitedLinkTextEmphasisColor == o.visitedLinkTextEmphasisColor
 #if ENABLE(TOUCH_EVENTS)
         && tapHighlightColor == o.tapHighlightColor
 #endif
 #if ENABLE(TOUCH_EVENTS)
         && tapHighlightColor == o.tapHighlightColor
 #endif
index a0f3922..cfe0854 100644 (file)
@@ -57,6 +57,10 @@ public:
     float textStrokeWidth;
     Color textFillColor;
     Color textEmphasisColor;
     float textStrokeWidth;
     Color textFillColor;
     Color textEmphasisColor;
+    
+    Color visitedLinkTextStrokeColor;
+    Color visitedLinkTextFillColor;
+    Color visitedLinkTextEmphasisColor;    
 
     OwnPtr<ShadowData> textShadow; // Our text shadow information for shadowed text drawing.
     AtomicString highlight; // Apple-specific extension for custom highlight rendering.
 
     OwnPtr<ShadowData> textShadow; // Our text shadow information for shadowed text drawing.
     AtomicString highlight; // Apple-specific extension for custom highlight rendering.
index 6185347..ca31756 100644 (file)
@@ -44,6 +44,7 @@ StyleRareNonInheritedData::StyleRareNonInheritedData()
     , m_mask(FillLayer(MaskFillLayer))
     , m_pageSize()
     , m_wrapShape(RenderStyle::initialWrapShape())
     , m_mask(FillLayer(MaskFillLayer))
     , m_pageSize()
     , m_wrapShape(RenderStyle::initialWrapShape())
+    , m_visitedLinkBackgroundColor(RenderStyle::initialBackgroundColor())
     , m_flowThread(RenderStyle::initialFlowThread())
     , m_regionThread(RenderStyle::initialRegionThread())
     , m_regionOverflow(RenderStyle::initialRegionOverflow())
     , m_flowThread(RenderStyle::initialFlowThread())
     , m_regionThread(RenderStyle::initialRegionThread())
     , m_regionOverflow(RenderStyle::initialRegionOverflow())
@@ -97,6 +98,12 @@ StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInherited
     , m_maskBoxImage(o.m_maskBoxImage)
     , m_pageSize(o.m_pageSize)
     , m_wrapShape(o.m_wrapShape)
     , m_maskBoxImage(o.m_maskBoxImage)
     , m_pageSize(o.m_pageSize)
     , m_wrapShape(o.m_wrapShape)
+    , m_visitedLinkBackgroundColor(o.m_visitedLinkBackgroundColor)
+    , m_visitedLinkOutlineColor(o.m_visitedLinkBackgroundColor)
+    , m_visitedLinkBorderLeftColor(o.m_visitedLinkBorderLeftColor)
+    , m_visitedLinkBorderRightColor(o.m_visitedLinkBorderRightColor)
+    , m_visitedLinkBorderTopColor(o.m_visitedLinkBorderTopColor)
+    , m_visitedLinkBorderBottomColor(o.m_visitedLinkBorderBottomColor)
     , m_flowThread(o.m_flowThread)
     , m_regionThread(o.m_regionThread)
     , m_regionOverflow(o.m_regionOverflow)
     , m_flowThread(o.m_flowThread)
     , m_regionThread(o.m_regionThread)
     , m_regionOverflow(o.m_regionOverflow)
@@ -173,6 +180,12 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
         && (m_regionThread == o.m_regionThread)
         && (m_regionOverflow == o.m_regionOverflow)
         && (m_wrapShape == o.m_wrapShape)
         && (m_regionThread == o.m_regionThread)
         && (m_regionOverflow == o.m_regionOverflow)
         && (m_wrapShape == o.m_wrapShape)
+        && m_visitedLinkBackgroundColor == o.m_visitedLinkBackgroundColor
+        && m_visitedLinkOutlineColor == o.m_visitedLinkOutlineColor
+        && m_visitedLinkBorderLeftColor == o.m_visitedLinkBorderLeftColor
+        && m_visitedLinkBorderRightColor == o.m_visitedLinkBorderRightColor
+        && m_visitedLinkBorderTopColor == o.m_visitedLinkBorderTopColor
+        && m_visitedLinkBorderBottomColor == o.m_visitedLinkBorderBottomColor
         && (m_regionBreakAfter == o.m_regionBreakAfter)
         && (m_regionBreakBefore == o.m_regionBreakBefore)
         && (m_regionBreakInside == o.m_regionBreakInside);
         && (m_regionBreakAfter == o.m_regionBreakAfter)
         && (m_regionBreakBefore == o.m_regionBreakBefore)
         && (m_regionBreakInside == o.m_regionBreakInside);
index 37dbfc9..9e62dff 100644 (file)
@@ -129,6 +129,13 @@ public:
     LengthSize m_pageSize;
 
     RefPtr<CSSWrapShape> m_wrapShape;
     LengthSize m_pageSize;
 
     RefPtr<CSSWrapShape> m_wrapShape;
+    
+    Color m_visitedLinkBackgroundColor;
+    Color m_visitedLinkOutlineColor;
+    Color m_visitedLinkBorderLeftColor;
+    Color m_visitedLinkBorderRightColor;
+    Color m_visitedLinkBorderTopColor;
+    Color m_visitedLinkBorderBottomColor;
 
     AtomicString m_flowThread;
     AtomicString m_regionThread;
 
     AtomicString m_flowThread;
     AtomicString m_regionThread;
index 6b15a1b..a139498 100644 (file)
@@ -81,15 +81,12 @@ static inline RenderSVGResource* requestPaintingResource(RenderSVGResourceMode m
     }
 
     if (style->insideLink() == InsideVisitedLink) {
     }
 
     if (style->insideLink() == InsideVisitedLink) {
-        RenderStyle* visitedStyle = style->getCachedPseudoStyle(VISITED_LINK);
-        ASSERT(visitedStyle);
-
-        const SVGRenderStyle* svgVisitedStyle = visitedStyle->svgStyle();
-        SVGPaint::SVGPaintType visitedPaintType = applyToFill ? svgVisitedStyle->fillPaintType() : svgVisitedStyle->strokePaintType();
+        // FIXME: This code doesn't support the uri component of the visited link paint, https://bugs.webkit.org/show_bug.cgi?id=70006
+        SVGPaint::SVGPaintType visitedPaintType = applyToFill ? svgStyle->visitedLinkFillPaintType() : svgStyle->visitedLinkStrokePaintType();
 
         // For SVG_PAINTTYPE_CURRENTCOLOR, 'color' already contains the 'visitedColor'.
         if (visitedPaintType < SVGPaint::SVG_PAINTTYPE_URI_NONE && visitedPaintType != SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR) {
 
         // For SVG_PAINTTYPE_CURRENTCOLOR, 'color' already contains the 'visitedColor'.
         if (visitedPaintType < SVGPaint::SVG_PAINTTYPE_URI_NONE && visitedPaintType != SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR) {
-            const Color& visitedColor = applyToFill ? svgVisitedStyle->fillPaintColor() : svgVisitedStyle->strokePaintColor();
+            const Color& visitedColor = applyToFill ? svgStyle->visitedLinkFillPaintColor() : svgStyle->visitedLinkStrokePaintColor();
             if (visitedColor.isValid())
                 color = Color(visitedColor.red(), visitedColor.green(), visitedColor.blue(), color.alpha());
         }
             if (visitedColor.isValid())
                 color = Color(visitedColor.red(), visitedColor.green(), visitedColor.blue(), color.alpha());
         }