Title: [103192] trunk
Revision
103192
Author
an...@apple.com
Date
2011-12-18 15:47:15 -0800 (Sun, 18 Dec 2011)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=73954
REGRESSION (r97745): Transitions don't work on links

Source/WebCore: 

Reviewed by Andreas Kling.

Test: transitions/visited-link-color.html
        
Since visited link colors are now part of the RenderStyle, they need to be transitioned
along with the corresponding regular colors.

* page/animation/AnimationBase.cpp:
(WebCore::PropertyWrapperVisitedAffectedColor::PropertyWrapperVisitedAffectedColor):
(WebCore::PropertyWrapperVisitedAffectedColor::equals):
(WebCore::PropertyWrapperVisitedAffectedColor::blend):
(WebCore::AnimationBase::ensurePropertyMap):
        
    Add new wrapper class that applies both regular and visited color.
        
* rendering/style/RenderStyle.h:
(WebCore::InheritedFlags::visitedLinkColor):
(WebCore::InheritedFlags::visitedLinkBackgroundColor):
(WebCore::InheritedFlags::visitedLinkBorderLeftColor):
(WebCore::InheritedFlags::visitedLinkBorderRightColor):
(WebCore::InheritedFlags::visitedLinkBorderBottomColor):
(WebCore::InheritedFlags::visitedLinkBorderTopColor):
(WebCore::InheritedFlags::visitedLinkOutlineColor):
(WebCore::InheritedFlags::visitedLinkColumnRuleColor):
(WebCore::InheritedFlags::visitedLinkTextEmphasisColor):
(WebCore::InheritedFlags::visitedLinkTextFillColor):
(WebCore::InheritedFlags::visitedLinkTextStrokeColor):
        
    Add accessors.
        
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
        
    Opportunistic fix. Don't know how to test.

LayoutTests: 

Reviewed by Andreas Kling.
        
Unfortunately the automatic test provides code coverage only as reading back the properties
from the style always gives back non-visited values. The bug is visible running the test
manually.

* transitions/visited-link-color-expected.txt: Added.
* transitions/visited-link-color.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (103191 => 103192)


--- trunk/LayoutTests/ChangeLog	2011-12-18 22:28:49 UTC (rev 103191)
+++ trunk/LayoutTests/ChangeLog	2011-12-18 23:47:15 UTC (rev 103192)
@@ -1,3 +1,17 @@
+2011-12-18  Antti Koivisto  <an...@apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=73954
+        REGRESSION (r97745): Transitions don't work on links
+
+        Reviewed by Andreas Kling.
+        
+        Unfortunately the automatic test provides code coverage only as reading back the properties
+        from the style always gives back non-visited values. The bug is visible running the test
+        manually.
+
+        * transitions/visited-link-color-expected.txt: Added.
+        * transitions/visited-link-color.html: Added.
+
 2011-12-18  Andreas Kling  <kl...@webkit.org>
 
         HTMLAllCollection: Get rid of stateful namedItem traversal.

Added: trunk/LayoutTests/transitions/visited-link-color-expected.txt (0 => 103192)


--- trunk/LayoutTests/transitions/visited-link-color-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/transitions/visited-link-color-expected.txt	2011-12-18 23:47:15 UTC (rev 103192)
@@ -0,0 +1,15 @@
+All the colors of the link below should be animating:
+
+link 
+
+PASS - "color" property for "link" element at 0.5s saw something close to: 127,127,0
+PASS - "background-color" property for "link" element at 0.5s saw something close to: 0,127,127
+PASS - "border-left-color" property for "link" element at 0.5s saw something close to: 127,0,127
+PASS - "border-right-color" property for "link" element at 0.5s saw something close to: 127,0,127
+PASS - "border-top-color" property for "link" element at 0.5s saw something close to: 127,0,127
+PASS - "border-bottom-color" property for "link" element at 0.5s saw something close to: 127,0,127
+PASS - "outline-color" property for "link" element at 0.5s saw something close to: 127,127,0
+PASS - "-webkit-column-rule-color" property for "link" element at 0.5s saw something close to: 127,127,0
+PASS - "-webkit-text-stroke-color" property for "link" element at 0.5s saw something close to: 127,127,0
+PASS - "-webkit-text-fill-color" property for "link" element at 0.5s saw something close to: 0,127,127
+

Added: trunk/LayoutTests/transitions/visited-link-color.html (0 => 103192)


--- trunk/LayoutTests/transitions/visited-link-color.html	                        (rev 0)
+++ trunk/LayoutTests/transitions/visited-link-color.html	2011-12-18 23:47:15 UTC (rev 103192)
@@ -0,0 +1,60 @@
+<html>
+<head>
+<style>
+a {
+    font-size: 300%;
+    -webkit-transition: all 1s linear;
+    background-color: #00F;
+    border: 8px solid #F00;
+    color: #0F0;
+    outline: 8px solid #0F0;
+    -webkit-column-rule-color: #0F0;
+    -webkit-text-stroke-color: #0F0;
+    -webkit-text-fill-color: #0F0;
+}
+.changed {
+    background-color: #0F0;
+    border: 8px solid #00F;
+    color: #F00;
+    outline: 8px solid #F00;
+    -webkit-column-rule-color: #F00;
+    -webkit-text-stroke-color: #F00;
+    -webkit-text-fill-color: #00F;
+}
+</style>
+<script src=""
+<script>
+    const expectedValues = [
+    // [time, element-id, property, expected-value, tolerance, post-completion callback, should-be-transitioning]
+    [0.5, 'link', 'color', [127, 127, 0], 10, null, shouldBeTransitioning],
+    [0.5, 'link', 'background-color', [0, 127, 127], 10, null, shouldBeTransitioning],
+    [0.5, 'link', 'border-left-color', [127, 0, 127], 10, null, shouldBeTransitioning],
+    [0.5, 'link', 'border-right-color', [127, 0, 127], 10, null, shouldBeTransitioning],
+    [0.5, 'link', 'border-top-color', [127, 0, 127], 10, null, shouldBeTransitioning],
+    [0.5, 'link', 'border-bottom-color', [127, 0, 127], 10, null, shouldBeTransitioning],
+    [0.5, 'link', 'outline-color', [127, 127, 0], 10, null, shouldBeTransitioning],
+    [0.5, 'link', '-webkit-column-rule-color', [127, 127, 0], 10, null, shouldBeTransitioning],
+    [0.5, 'link', '-webkit-text-stroke-color', [127, 127, 0], 10, null, shouldBeTransitioning],
+    [0.5, 'link', '-webkit-text-fill-color', [0, 127, 127], 10, null, shouldBeTransitioning],
+    ];
+    function setupTest()
+    {
+        document.getElementById('link').className = 'changed';
+    }
+    runTransitionTest(expectedValues, setupTest, usePauseAPI);
+</script>
+</head>
+<body>
+All the colors of the link below should be animating:
+<div>
+<br>
+<a id="link" href=""
+   link
+</a>
+<br>
+<br>
+</div>
+<div id="result">
+</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (103191 => 103192)


--- trunk/Source/WebCore/ChangeLog	2011-12-18 22:28:49 UTC (rev 103191)
+++ trunk/Source/WebCore/ChangeLog	2011-12-18 23:47:15 UTC (rev 103192)
@@ -1,3 +1,43 @@
+2011-12-18  Antti Koivisto  <an...@apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=73954
+        REGRESSION (r97745): Transitions don't work on links
+
+        Reviewed by Andreas Kling.
+
+        Test: transitions/visited-link-color.html
+        
+        Since visited link colors are now part of the RenderStyle, they need to be transitioned
+        along with the corresponding regular colors.
+
+        * page/animation/AnimationBase.cpp:
+        (WebCore::PropertyWrapperVisitedAffectedColor::PropertyWrapperVisitedAffectedColor):
+        (WebCore::PropertyWrapperVisitedAffectedColor::equals):
+        (WebCore::PropertyWrapperVisitedAffectedColor::blend):
+        (WebCore::AnimationBase::ensurePropertyMap):
+        
+            Add new wrapper class that applies both regular and visited color.
+        
+        * rendering/style/RenderStyle.h:
+        (WebCore::InheritedFlags::visitedLinkColor):
+        (WebCore::InheritedFlags::visitedLinkBackgroundColor):
+        (WebCore::InheritedFlags::visitedLinkBorderLeftColor):
+        (WebCore::InheritedFlags::visitedLinkBorderRightColor):
+        (WebCore::InheritedFlags::visitedLinkBorderBottomColor):
+        (WebCore::InheritedFlags::visitedLinkBorderTopColor):
+        (WebCore::InheritedFlags::visitedLinkOutlineColor):
+        (WebCore::InheritedFlags::visitedLinkColumnRuleColor):
+        (WebCore::InheritedFlags::visitedLinkTextEmphasisColor):
+        (WebCore::InheritedFlags::visitedLinkTextFillColor):
+        (WebCore::InheritedFlags::visitedLinkTextStrokeColor):
+        
+            Add accessors.
+        
+        * rendering/style/StyleRareNonInheritedData.cpp:
+        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
+        
+            Opportunistic fix. Don't know how to test.
+
 2011-12-18  Anders Carlsson  <ander...@apple.com>
 
         Set the main frame view scroll position asynchronously

Modified: trunk/Source/WebCore/page/animation/AnimationBase.cpp (103191 => 103192)


--- trunk/Source/WebCore/page/animation/AnimationBase.cpp	2011-12-18 22:28:49 UTC (rev 103191)
+++ trunk/Source/WebCore/page/animation/AnimationBase.cpp	2011-12-18 23:47:15 UTC (rev 103192)
@@ -631,6 +631,38 @@
     void (RenderStyle::*m_setter)(const Color&);
 };
 
+enum MaybeInvalidColorTag { MaybeInvalidColor };
+class PropertyWrapperVisitedAffectedColor : public PropertyWrapperBase {
+public:
+    PropertyWrapperVisitedAffectedColor(int prop, const Color& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&), 
+                                        const Color& (RenderStyle::*visitedGetter)() const, void (RenderStyle::*visitedSetter)(const Color&))
+        : PropertyWrapperBase(prop)
+        , m_wrapper(adoptPtr(new PropertyWrapper<const Color&>(prop, getter, setter)))
+        , m_visitedWrapper(adoptPtr(new PropertyWrapper<const Color&>(prop, visitedGetter, visitedSetter)))
+    {
+    }
+    PropertyWrapperVisitedAffectedColor(int prop, MaybeInvalidColorTag, const Color& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&), 
+                                        const Color& (RenderStyle::*visitedGetter)() const, void (RenderStyle::*visitedSetter)(const Color&))
+        : PropertyWrapperBase(prop)
+        , m_wrapper(adoptPtr(new PropertyWrapperMaybeInvalidColor(prop, getter, setter)))
+        , m_visitedWrapper(adoptPtr(new PropertyWrapperMaybeInvalidColor(prop, visitedGetter, visitedSetter)))
+    {
+    }
+    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
+    {
+        return m_wrapper->equals(a, b) && m_visitedWrapper->equals(a, b);
+    }
+    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
+    {
+        m_wrapper->blend(anim, dst, a, b, progress);
+        m_visitedWrapper->blend(anim, dst, a, b, progress);
+    }
+    
+private:
+    OwnPtr<PropertyWrapperBase> m_wrapper;
+    OwnPtr<PropertyWrapperBase> m_visitedWrapper;
+};
+
 // Wrapper base class for an animatable property in a FillLayer
 class FillLayerPropertyWrapperBase {
 public:
@@ -930,9 +962,9 @@
         gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingRight, &RenderStyle::paddingRight, &RenderStyle::setPaddingRight));
         gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingTop, &RenderStyle::paddingTop, &RenderStyle::setPaddingTop));
         gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingBottom, &RenderStyle::paddingBottom, &RenderStyle::setPaddingBottom));
-        gPropertyWrappers->append(new PropertyWrapper<const Color&>(CSSPropertyColor, &RenderStyle::color, &RenderStyle::setColor));
+        gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyColor, &RenderStyle::color, &RenderStyle::setColor, &RenderStyle::visitedLinkColor, &RenderStyle::setVisitedLinkColor));
 
-        gPropertyWrappers->append(new PropertyWrapper<const Color&>(CSSPropertyBackgroundColor, &RenderStyle::backgroundColor, &RenderStyle::setBackgroundColor));
+        gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyBackgroundColor, &RenderStyle::backgroundColor, &RenderStyle::setBackgroundColor, &RenderStyle::visitedLinkBackgroundColor, &RenderStyle::setVisitedLinkBackgroundColor));
 
         gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroundImage, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers));
         gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyListStyleImage, &RenderStyle::listStyleImage, &RenderStyle::setListStyleImage));
@@ -995,14 +1027,14 @@
         gPropertyWrappers->append(new PropertyWrapper<const FilterOperations&>(CSSPropertyWebkitFilter, &RenderStyle::filter, &RenderStyle::setFilter));
 #endif
 
-        gPropertyWrappers->append(new PropertyWrapperMaybeInvalidColor(CSSPropertyWebkitColumnRuleColor, &RenderStyle::columnRuleColor, &RenderStyle::setColumnRuleColor));
-        gPropertyWrappers->append(new PropertyWrapperMaybeInvalidColor(CSSPropertyWebkitTextStrokeColor, &RenderStyle::textStrokeColor, &RenderStyle::setTextStrokeColor));
-        gPropertyWrappers->append(new PropertyWrapperMaybeInvalidColor(CSSPropertyWebkitTextFillColor, &RenderStyle::textFillColor, &RenderStyle::setTextFillColor));
-        gPropertyWrappers->append(new PropertyWrapperMaybeInvalidColor(CSSPropertyBorderLeftColor, &RenderStyle::borderLeftColor, &RenderStyle::setBorderLeftColor));
-        gPropertyWrappers->append(new PropertyWrapperMaybeInvalidColor(CSSPropertyBorderRightColor, &RenderStyle::borderRightColor, &RenderStyle::setBorderRightColor));
-        gPropertyWrappers->append(new PropertyWrapperMaybeInvalidColor(CSSPropertyBorderTopColor, &RenderStyle::borderTopColor, &RenderStyle::setBorderTopColor));
-        gPropertyWrappers->append(new PropertyWrapperMaybeInvalidColor(CSSPropertyBorderBottomColor, &RenderStyle::borderBottomColor, &RenderStyle::setBorderBottomColor));
-        gPropertyWrappers->append(new PropertyWrapperMaybeInvalidColor(CSSPropertyOutlineColor, &RenderStyle::outlineColor, &RenderStyle::setOutlineColor));
+        gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyWebkitColumnRuleColor, MaybeInvalidColor, &RenderStyle::columnRuleColor, &RenderStyle::setColumnRuleColor, &RenderStyle::visitedLinkColumnRuleColor, &RenderStyle::setVisitedLinkColumnRuleColor));
+        gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyWebkitTextStrokeColor, MaybeInvalidColor, &RenderStyle::textStrokeColor, &RenderStyle::setTextStrokeColor, &RenderStyle::visitedLinkTextStrokeColor, &RenderStyle::setVisitedLinkTextStrokeColor));
+        gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyWebkitTextFillColor, MaybeInvalidColor, &RenderStyle::textFillColor, &RenderStyle::setTextFillColor, &RenderStyle::visitedLinkTextFillColor, &RenderStyle::setVisitedLinkTextFillColor));
+        gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyBorderLeftColor, MaybeInvalidColor, &RenderStyle::borderLeftColor, &RenderStyle::setBorderLeftColor, &RenderStyle::visitedLinkBorderLeftColor, &RenderStyle::setVisitedLinkBorderLeftColor));
+        gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyBorderRightColor, MaybeInvalidColor, &RenderStyle::borderRightColor, &RenderStyle::setBorderRightColor, &RenderStyle::visitedLinkBorderRightColor, &RenderStyle::setVisitedLinkBorderRightColor));
+        gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyBorderTopColor, MaybeInvalidColor, &RenderStyle::borderTopColor, &RenderStyle::setBorderTopColor, &RenderStyle::visitedLinkBorderTopColor, &RenderStyle::setVisitedLinkBorderTopColor));
+        gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyBorderBottomColor, MaybeInvalidColor, &RenderStyle::borderBottomColor, &RenderStyle::setBorderBottomColor, &RenderStyle::visitedLinkBorderBottomColor, &RenderStyle::setVisitedLinkBorderBottomColor));
+        gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyOutlineColor, MaybeInvalidColor, &RenderStyle::outlineColor, &RenderStyle::setOutlineColor, &RenderStyle::visitedLinkOutlineColor, &RenderStyle::setVisitedLinkOutlineColor));
 
         gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyBoxShadow, &RenderStyle::boxShadow, &RenderStyle::setBoxShadow));
         gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyWebkitBoxShadow, &RenderStyle::boxShadow, &RenderStyle::setBoxShadow));

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (103191 => 103192)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2011-12-18 22:28:49 UTC (rev 103191)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2011-12-18 23:47:15 UTC (rev 103192)
@@ -1635,7 +1635,18 @@
     const Color& textEmphasisColor() const { return rareInheritedData->textEmphasisColor; }
     const Color& textFillColor() const { return rareInheritedData->textFillColor; }
     const Color& textStrokeColor() const { return rareInheritedData->textStrokeColor; }
-    
+    const Color& visitedLinkColor() const { return inherited->visitedLinkColor; }
+    const Color& visitedLinkBackgroundColor() const { return rareNonInheritedData->m_visitedLinkBackgroundColor; }
+    const Color& visitedLinkBorderLeftColor() const { return rareNonInheritedData->m_visitedLinkBorderLeftColor; }
+    const Color& visitedLinkBorderRightColor() const { return rareNonInheritedData->m_visitedLinkBorderRightColor; }
+    const Color& visitedLinkBorderBottomColor() const { return rareNonInheritedData->m_visitedLinkBorderBottomColor; }
+    const Color& visitedLinkBorderTopColor() const { return rareNonInheritedData->m_visitedLinkBorderTopColor; }
+    const Color& visitedLinkOutlineColor() const { return rareNonInheritedData->m_visitedLinkOutlineColor; }
+    const Color& visitedLinkColumnRuleColor() const { return rareNonInheritedData->m_multiCol->m_visitedLinkColumnRuleColor; }
+    const Color& visitedLinkTextEmphasisColor() const { return rareInheritedData->visitedLinkTextEmphasisColor; }
+    const Color& visitedLinkTextFillColor() const { return rareInheritedData->visitedLinkTextFillColor; }
+    const Color& visitedLinkTextStrokeColor() const { return rareInheritedData->visitedLinkTextStrokeColor; }
+
     Color colorIncludingFallback(int colorProperty, bool visitedLink) const;
 
 #if ENABLE(SVG)

Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp (103191 => 103192)


--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp	2011-12-18 22:28:49 UTC (rev 103191)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp	2011-12-18 23:47:15 UTC (rev 103192)
@@ -113,7 +113,7 @@
     , m_wrapMargin(o.m_wrapMargin)
     , m_wrapPadding(o.m_wrapPadding)
     , m_visitedLinkBackgroundColor(o.m_visitedLinkBackgroundColor)
-    , m_visitedLinkOutlineColor(o.m_visitedLinkBackgroundColor)
+    , m_visitedLinkOutlineColor(o.m_visitedLinkOutlineColor)
     , m_visitedLinkBorderLeftColor(o.m_visitedLinkBorderLeftColor)
     , m_visitedLinkBorderRightColor(o.m_visitedLinkBorderRightColor)
     , m_visitedLinkBorderTopColor(o.m_visitedLinkBorderTopColor)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to