Diff
Modified: trunk/LayoutTests/ChangeLog (134773 => 134774)
--- trunk/LayoutTests/ChangeLog 2012-11-15 15:28:10 UTC (rev 134773)
+++ trunk/LayoutTests/ChangeLog 2012-11-15 15:28:52 UTC (rev 134774)
@@ -1,3 +1,15 @@
+2012-11-15 Shinya Kawanaka <shin...@chromium.org>
+
+ Changing pseudoClass (:visited) should cause distribution.
+ https://bugs.webkit.org/show_bug.cgi?id=101700
+
+ Reviewed by Dimitri Glazkov.
+
+ * fast/dom/shadow/pseudoclass-update-visited-anchor-expected.html: Added.
+ * fast/dom/shadow/pseudoclass-update-visited-anchor.html: Added.
+ * fast/dom/shadow/pseudoclass-update-visited-area-expected.html: Added.
+ * fast/dom/shadow/pseudoclass-update-visited-area.html: Added.
+
2012-11-15 Stephen Chenney <schen...@chromium.org>
[Chromium] Disable SK_IGNORE_FAST_BLURRECT
Added: trunk/LayoutTests/fast/dom/shadow/pseudoclass-update-visited-anchor-expected.html (0 => 134774)
--- trunk/LayoutTests/fast/dom/shadow/pseudoclass-update-visited-anchor-expected.html (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/pseudoclass-update-visited-anchor-expected.html 2012-11-15 15:28:52 UTC (rev 134774)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+
+<body>
+
+<p>When an anchor tag catch 'href' attribute or release 'href' attribute, distribution should happen.</p>
+
+<div><a id="anchor1" href="" 1</a></div>
+<div><a id="anchor4" href="" 4</a></div>
+
+</body>
+</html>
+
Added: trunk/LayoutTests/fast/dom/shadow/pseudoclass-update-visited-anchor.html (0 => 134774)
--- trunk/LayoutTests/fast/dom/shadow/pseudoclass-update-visited-anchor.html (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/pseudoclass-update-visited-anchor.html 2012-11-15 15:28:52 UTC (rev 134774)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+
+<body>
+
+<p>When an anchor tag catch 'href' attribute or release 'href' attribute, distribution should happen.</p>
+
+<div id="host1">
+ <a id="anchor1" href="" 1</a>
+ <a id="anchor2" href="" 2</a>
+</div>
+
+<div id="host2">
+ <a id="anchor3">Anchor 3</a>
+ <a id="anchor4">Anchor 4</a>
+</div>
+
+<script>
+if (window.testRunner)
+ testRunner.waitUntilDone();
+
+new WebKitShadowRoot(host1).innerHTML = '<content select=":visited"></content>';
+new WebKitShadowRoot(host2).innerHTML = '<content select=":visited"></content>';
+
+setTimeout(function() {
+ anchor2.removeAttribute('href');
+ anchor4.setAttribute('href', 'http://www.example.com/');
+ testRunner.notifyDone();
+}, 0);
+
+</script>
+</body>
+</html>
+
Added: trunk/LayoutTests/fast/dom/shadow/pseudoclass-update-visited-area-expected.html (0 => 134774)
--- trunk/LayoutTests/fast/dom/shadow/pseudoclass-update-visited-area-expected.html (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/pseudoclass-update-visited-area-expected.html 2012-11-15 15:28:52 UTC (rev 134774)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+
+<body>
+
+<style>
+area {
+ display: inline;
+}
+</style>
+
+<p>When an anchor tag catch 'href' attribute or release 'href' attribute, distribution should happen.</p>
+
+<div id="host1"></div>
+<div id="host2"></div>
+
+<script>
+function createArea(href, textContent)
+{
+ var area = document.createElement('area');
+ if (href)
+ area.setAttribute('href', href);
+ area.appendChild(document.createTextNode(textContent));
+
+ return area;
+}
+
+var area1 = createArea('http://www.example.com/', 'Anchor 1');
+var area4 = createArea('http://www.example.com/', 'Anchor 4');
+
+host1.appendChild(area1);
+host2.appendChild(area4);
+</script>
+</body>
+</html>
+
Added: trunk/LayoutTests/fast/dom/shadow/pseudoclass-update-visited-area.html (0 => 134774)
--- trunk/LayoutTests/fast/dom/shadow/pseudoclass-update-visited-area.html (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/pseudoclass-update-visited-area.html 2012-11-15 15:28:52 UTC (rev 134774)
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+
+<body>
+
+<style>
+area {
+ display: inline;
+}
+</style>
+
+<p>When an anchor tag catch 'href' attribute or release 'href' attribute, distribution should happen.</p>
+
+<div id="host1"></div>
+<div id="host2"></div>
+
+<script>
+if (window.testRunner)
+ testRunner.waitUntilDone();
+
+function createArea(href, textContent)
+{
+ var area = document.createElement('area');
+ if (href)
+ area.setAttribute('href', href);
+ area.appendChild(document.createTextNode(textContent));
+
+ return area;
+}
+
+var area1 = createArea('http://www.example.com/', 'Anchor 1');
+var area2 = createArea('http://www.example.com/', 'Anchor 2');
+var area3 = createArea(null, 'Anchor 3');
+var area4 = createArea(null, 'Anchor 4');
+
+host1.appendChild(area1);
+host1.appendChild(area2);
+host2.appendChild(area3);
+host2.appendChild(area4);
+
+new WebKitShadowRoot(host1).innerHTML = '<content select="area:visited"></content>';
+new WebKitShadowRoot(host2).innerHTML = '<content select="area:visited"></content>';
+
+setTimeout(function() {
+ area2.removeAttribute('href');
+ area4.setAttribute('href', 'http://www.example.com/');
+ if (testRunner)
+ testRunner.notifyDone();
+}, 0);
+
+</script>
+</body>
+</html>
+
Modified: trunk/Source/WebCore/ChangeLog (134773 => 134774)
--- trunk/Source/WebCore/ChangeLog 2012-11-15 15:28:10 UTC (rev 134773)
+++ trunk/Source/WebCore/ChangeLog 2012-11-15 15:28:52 UTC (rev 134774)
@@ -1,3 +1,27 @@
+2012-11-15 Shinya Kawanaka <shin...@chromium.org>
+
+ Changing pseudoClass (:visited) should cause distribution.
+ https://bugs.webkit.org/show_bug.cgi?id=101700
+
+ Reviewed by Dimitri Glazkov.
+
+ When href attribute of an anchor or area element is changed, we have to invalidate distribution.
+
+ Since we would like to check a few pseudoClasses at once, we make the argument of
+ SelectRuleFeatureSet::hasSelectorFor int.
+
+ Tests: fast/dom/shadow/pseudoclass-update-visited-anchor.html
+ fast/dom/shadow/pseudoclass-update-visited-area.html
+
+ * dom/ElementShadow.cpp:
+ (WebCore::invalidateParentDistributionIfNecessary):
+ * dom/ElementShadow.h:
+ (WebCore):
+ * html/HTMLAnchorElement.cpp:
+ (WebCore::HTMLAnchorElement::parseAttribute):
+ * html/shadow/SelectRuleFeatureSet.h:
+ (WebCore::SelectRuleFeatureSet::hasSelectorFor):
+
2012-11-15 Balazs Kelemen <kbal...@webkit.org>
Coordinated Graphics: support the "freeze animations" API
Modified: trunk/Source/WebCore/dom/ElementShadow.cpp (134773 => 134774)
--- trunk/Source/WebCore/dom/ElementShadow.cpp 2012-11-15 15:28:10 UTC (rev 134773)
+++ trunk/Source/WebCore/dom/ElementShadow.cpp 2012-11-15 15:28:52 UTC (rev 134774)
@@ -265,14 +265,14 @@
info.addMember(m_distributor);
}
-void invalidateParentDistributionIfNecessary(Element* element, SelectRuleFeatureSet::SelectRuleFeature updatedFeature)
+void invalidateParentDistributionIfNecessary(Element* element, SelectRuleFeatureSet::SelectRuleFeatureMask updatedFeatures)
{
ElementShadow* elementShadow = shadowOfParentForDistribution(element);
if (!elementShadow)
return;
elementShadow->ensureSelectFeatureSetCollected();
- if (elementShadow->selectRuleFeatureSet().hasSelectorFor(updatedFeature))
+ if (elementShadow->selectRuleFeatureSet().hasSelectorFor(updatedFeatures))
elementShadow->invalidateDistribution();
}
Modified: trunk/Source/WebCore/dom/ElementShadow.h (134773 => 134774)
--- trunk/Source/WebCore/dom/ElementShadow.h 2012-11-15 15:28:10 UTC (rev 134773)
+++ trunk/Source/WebCore/dom/ElementShadow.h 2012-11-15 15:28:52 UTC (rev 134774)
@@ -89,7 +89,7 @@
bool m_shouldCollectSelectFeatureSet : 1;
};
-void invalidateParentDistributionIfNecessary(Element*, SelectRuleFeatureSet::SelectRuleFeature updatedFeature);
+void invalidateParentDistributionIfNecessary(Element*, SelectRuleFeatureSet::SelectRuleFeatureMask updatedFeatures);
inline ShadowRoot* ElementShadow::youngestShadowRoot() const
{
Modified: trunk/Source/WebCore/html/HTMLAnchorElement.cpp (134773 => 134774)
--- trunk/Source/WebCore/html/HTMLAnchorElement.cpp 2012-11-15 15:28:10 UTC (rev 134773)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.cpp 2012-11-15 15:28:52 UTC (rev 134774)
@@ -221,7 +221,7 @@
setIsLink(!attribute.isNull());
if (wasLink != isLink()) {
setNeedsStyleRecalc();
- invalidateParentDistributionIfNecessary(this, SelectRuleFeatureSet::RuleFeatureLink);
+ invalidateParentDistributionIfNecessary(this, SelectRuleFeatureSet::RuleFeatureLink | SelectRuleFeatureSet::RuleFeatureVisited);
}
if (isLink()) {
String parsedURL = stripLeadingAndTrailingHTMLSpaces(attribute.value());
Modified: trunk/Source/WebCore/html/shadow/SelectRuleFeatureSet.h (134773 => 134774)
--- trunk/Source/WebCore/html/shadow/SelectRuleFeatureSet.h 2012-11-15 15:28:10 UTC (rev 134773)
+++ trunk/Source/WebCore/html/shadow/SelectRuleFeatureSet.h 2012-11-15 15:28:52 UTC (rev 134774)
@@ -64,8 +64,9 @@
RuleFeatureTarget = 1 << 5,
RuleFeatureVisited = 1 << 6
};
+ typedef int SelectRuleFeatureMask;
- bool hasSelectorFor(SelectRuleFeature feature) const { return m_featureFlags & feature; }
+ bool hasSelectorFor(SelectRuleFeatureMask features) const { return m_featureFlags & features; }
private:
void setSelectRuleFeature(SelectRuleFeature feature) { m_featureFlags |= feature; }