Title: [134938] trunk
Revision
134938
Author
shin...@chromium.org
Date
2012-11-16 05:39:37 -0800 (Fri, 16 Nov 2012)

Log Message

Changing pseudoClass (:indeterminate) should cause distribution
https://bugs.webkit.org/show_bug.cgi?id=101903

Reviewed by Dimitri Glazkov.

Source/WebCore:

<progress> and <input type="checkbox"> have 'indeterminate' state. When their state is changed, we have to
invalidate distribution if necessary. To check it, we collect a feature that :invalidate is used in select attributes.

For <input>, we also have to see 'type' is changed. According to the spec, :indeterminate should match only
progress element or <input type="checkbox">. So changing 'type' might also change :indeterminate state.

Tests: fast/dom/shadow/pseudoclass-update-indeterminate-input.html
       fast/dom/shadow/pseudoclass-update-indeterminate-progress.html

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::updateType):
(WebCore::HTMLInputElement::setIndeterminate):
* html/HTMLProgressElement.cpp:
(WebCore::HTMLProgressElement::didElementStateChange):

LayoutTests:

I've used "-webkit-appearance: none" for progress element because of Bug 102459.
It prevents from testing progress element on Windows.

* fast/dom/shadow/pseudoclass-update-indeterminate-input-expected.html: Added.
* fast/dom/shadow/pseudoclass-update-indeterminate-input.html: Added.
* fast/dom/shadow/pseudoclass-update-indeterminate-progress-expected.html: Added.
* fast/dom/shadow/pseudoclass-update-indeterminate-progress.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (134937 => 134938)


--- trunk/LayoutTests/ChangeLog	2012-11-16 13:37:16 UTC (rev 134937)
+++ trunk/LayoutTests/ChangeLog	2012-11-16 13:39:37 UTC (rev 134938)
@@ -1,3 +1,18 @@
+2012-11-16  Shinya Kawanaka  <shin...@chromium.org>
+
+        Changing pseudoClass (:indeterminate) should cause distribution
+        https://bugs.webkit.org/show_bug.cgi?id=101903
+
+        Reviewed by Dimitri Glazkov.
+
+        I've used "-webkit-appearance: none" for progress element because of Bug 102459.
+        It prevents from testing progress element on Windows.
+
+        * fast/dom/shadow/pseudoclass-update-indeterminate-input-expected.html: Added.
+        * fast/dom/shadow/pseudoclass-update-indeterminate-input.html: Added.
+        * fast/dom/shadow/pseudoclass-update-indeterminate-progress-expected.html: Added.
+        * fast/dom/shadow/pseudoclass-update-indeterminate-progress.html: Added.
+
 2012-11-16  Mike West  <mk...@chromium.org>
 
         [chromium] Unreviewed gardening.

Added: trunk/LayoutTests/fast/dom/shadow/pseudoclass-update-indeterminate-input-expected.html (0 => 134938)


--- trunk/LayoutTests/fast/dom/shadow/pseudoclass-update-indeterminate-input-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/pseudoclass-update-indeterminate-input-expected.html	2012-11-16 13:39:37 UTC (rev 134938)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<body>
+
+<p>When input became 'indeterminate' state or not-'indeterminate' state, distribution should happen.</p>
+
+<div id="host"><span>separator 1</span><span>separator 2</span><input id="input3" type="checkbox" indeterminate="true"><span>separator 3</span><span>separator 4</span><input id="input5" type="checkbox" indeterminate="true"><span>separator 5</span></div>
+
+<script>
+input3.indeterminate = true;
+input5.indeterminate = true;
+</script>
+
+
+</body>
+</html>
+

Added: trunk/LayoutTests/fast/dom/shadow/pseudoclass-update-indeterminate-input.html (0 => 134938)


--- trunk/LayoutTests/fast/dom/shadow/pseudoclass-update-indeterminate-input.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/pseudoclass-update-indeterminate-input.html	2012-11-16 13:39:37 UTC (rev 134938)
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+
+<body>
+
+<p>When input became 'indeterminate' state or not-'indeterminate' state, distribution should happen.</p>
+
+<div id="host">
+    <input id="input1" type="checkbox">
+    <span>separator 1</span>
+    <input id="input2" type="checkbox">
+    <span>separator 2</span>
+    <input id="input3" type="checkbox">
+    <span>separator 3</span>
+    <input id="input4" type="text">
+    <span>separator 4</span>
+    <input id="input5" type="text">
+    <span>separator 5</span>
+    <input id="input6" type="text">
+</div>
+<script>
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+input1.indeterminate = true;
+input2.indeterminate = true;
+input4.indeterminate = true;
+input5.indeterminate = true;
+
+var shadowRoot = new WebKitShadowRoot(host);
+shadowRoot.innerHTML = '<content select="span, input:indeterminate"></content>';
+
+setTimeout(function() {
+    input1.indeterminate = false;
+    input3.indeterminate = true;
+    input4.indeterminate = false;
+    input6.indeterminate = true;
+    
+    input2.type = 'text';
+    input5.type = 'checkbox';
+    testRunner.notifyDone();
+}, 0);
+
+</script>
+</body>
+</html>
+

Added: trunk/LayoutTests/fast/dom/shadow/pseudoclass-update-indeterminate-progress-expected.html (0 => 134938)


--- trunk/LayoutTests/fast/dom/shadow/pseudoclass-update-indeterminate-progress-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/pseudoclass-update-indeterminate-progress-expected.html	2012-11-16 13:39:37 UTC (rev 134938)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+progress {
+    -webkit-appearance: none;
+}
+</style>
+</head>
+
+<body>
+
+<p>When progress became 'indeterminate' or not-'indeterminate', distribution should happen.</p>
+
+<div id="host"><progress id="progress1"></progress><span>separator</span></div>
+</body>
+</html>
+

Added: trunk/LayoutTests/fast/dom/shadow/pseudoclass-update-indeterminate-progress.html (0 => 134938)


--- trunk/LayoutTests/fast/dom/shadow/pseudoclass-update-indeterminate-progress.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/pseudoclass-update-indeterminate-progress.html	2012-11-16 13:39:37 UTC (rev 134938)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<style>
+progress {
+    -webkit-appearance: none;
+}
+</style>
+</head>
+
+<body>
+
+<p>When progress became 'indeterminate' or not-'indeterminate', distribution should happen.</p>
+
+<div id="host">
+    <progress id="progress1"></progress>
+    <span>separator</span>
+    <progress id="progress2"></progress>
+</div>
+<script>
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+var shadowRoot = new WebKitShadowRoot(host);
+shadowRoot.innerHTML = '<content select="span,progress:indeterminate"></content>';
+progress1.value = '30';
+
+setTimeout(function() {
+    progress1.removeAttribute('value');
+    progress2.value = '70';
+    testRunner.notifyDone();
+}, 0);
+
+</script>
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (134937 => 134938)


--- trunk/Source/WebCore/ChangeLog	2012-11-16 13:37:16 UTC (rev 134937)
+++ trunk/Source/WebCore/ChangeLog	2012-11-16 13:39:37 UTC (rev 134938)
@@ -1,3 +1,25 @@
+2012-11-16  Shinya Kawanaka  <shin...@chromium.org>
+
+        Changing pseudoClass (:indeterminate) should cause distribution
+        https://bugs.webkit.org/show_bug.cgi?id=101903
+
+        Reviewed by Dimitri Glazkov.
+
+        <progress> and <input type="checkbox"> have 'indeterminate' state. When their state is changed, we have to
+        invalidate distribution if necessary. To check it, we collect a feature that :invalidate is used in select attributes.
+
+        For <input>, we also have to see 'type' is changed. According to the spec, :indeterminate should match only
+        progress element or <input type="checkbox">. So changing 'type' might also change :indeterminate state.
+
+        Tests: fast/dom/shadow/pseudoclass-update-indeterminate-input.html
+               fast/dom/shadow/pseudoclass-update-indeterminate-progress.html
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::updateType):
+        (WebCore::HTMLInputElement::setIndeterminate):
+        * html/HTMLProgressElement.cpp:
+        (WebCore::HTMLProgressElement::didElementStateChange):
+
 2012-11-16  Alexis Menard  <ale...@webkit.org>
 
         Factorize the creation of primitive values with a pair into a function.

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (134937 => 134938)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2012-11-16 13:37:16 UTC (rev 134937)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2012-11-16 13:39:37 UTC (rev 134938)
@@ -51,6 +51,7 @@
 #include "HTMLParserIdioms.h"
 #include "IdTargetObserver.h"
 #include "InputType.h"
+#include "InsertionPoint.h"
 #include "KeyboardEvent.h"
 #include "Language.h"
 #include "LocalizedStrings.h"
@@ -531,6 +532,9 @@
             updateFocusAppearance(true);
     }
 
+    if (ElementShadow* elementShadow = shadowOfParentForDistribution(this))
+        elementShadow->invalidateDistribution();
+
     setChangedSinceLastFormControlChangeEvent(false);
 
     addToRadioButtonGroup();
@@ -916,6 +920,7 @@
     m_isIndeterminate = newValue;
 
     setNeedsStyleRecalc();
+    invalidateParentDistributionIfNecessary(this, SelectRuleFeatureSet::RuleFeatureIndeterminate);
 
     if (renderer() && renderer()->style()->hasAppearance())
         renderer()->theme()->stateChanged(renderer(), CheckedState);

Modified: trunk/Source/WebCore/html/HTMLProgressElement.cpp (134937 => 134938)


--- trunk/Source/WebCore/html/HTMLProgressElement.cpp	2012-11-16 13:37:16 UTC (rev 134937)
+++ trunk/Source/WebCore/html/HTMLProgressElement.cpp	2012-11-16 13:39:37 UTC (rev 134938)
@@ -31,6 +31,7 @@
 #include "HTMLParserIdioms.h"
 #include "ProgressShadowElement.h"
 #include "RenderProgress.h"
+#include "SelectRuleFeatureSet.h"
 #include "ShadowRoot.h"
 #include <wtf/StdLibExtras.h>
 
@@ -158,8 +159,10 @@
     if (RenderProgress* render = renderProgress()) {
         bool wasDeterminate = render->isDeterminate();
         render->updateFromElement();
-        if (wasDeterminate != isDeterminate())
+        if (wasDeterminate != isDeterminate()) {
             setNeedsStyleRecalc();
+            invalidateParentDistributionIfNecessary(this, SelectRuleFeatureSet::RuleFeatureIndeterminate);
+        }
     }
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to