Title: [97224] trunk
- Revision
- 97224
- Author
- [email protected]
- Date
- 2011-10-11 20:45:47 -0700 (Tue, 11 Oct 2011)
Log Message
Source/WebCore: :checked pseudo selector not matching selected option
https://bugs.webkit.org/show_bug.cgi?id=63192
Patch by Sameer Patil <[email protected]> on 2011-10-11
Reviewed by Kent Tamura.
Test: fast/css/checked-pseudo-selector.html
Option element selected state need to be checked in checkOneSelector,
so that it can be considered as checked on querySelectorAll(':checked').
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOneSelector):
LayoutTests: :checked pseudo selector not matching selected option
https://bugs.webkit.org/show_bug.cgi?id=63192
Patch by Sameer Patil <[email protected]> on 2011-10-11
Reviewed by Kent Tamura.
* fast/css/checked-pseudo-selector-expected.txt: Added.
* fast/css/checked-pseudo-selector.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (97223 => 97224)
--- trunk/LayoutTests/ChangeLog 2011-10-12 03:29:17 UTC (rev 97223)
+++ trunk/LayoutTests/ChangeLog 2011-10-12 03:45:47 UTC (rev 97224)
@@ -1,3 +1,13 @@
+2011-10-11 Sameer Patil <[email protected]>
+
+ :checked pseudo selector not matching selected option
+ https://bugs.webkit.org/show_bug.cgi?id=63192
+
+ Reviewed by Kent Tamura.
+
+ * fast/css/checked-pseudo-selector-expected.txt: Added.
+ * fast/css/checked-pseudo-selector.html: Added.
+
2011-10-11 Ojan Vafai <[email protected]>
margin-right is ignored with vertical writing mode
Added: trunk/LayoutTests/fast/css/checked-pseudo-selector-expected.txt (0 => 97224)
--- trunk/LayoutTests/fast/css/checked-pseudo-selector-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/checked-pseudo-selector-expected.txt 2011-10-12 03:45:47 UTC (rev 97224)
@@ -0,0 +1,10 @@
+This is a :checked pseudo selector test.
+
+
+ Radio1
+ Radio2
+ Checkbox1
+ Checkbox2
+
+PASS - expected: 5 and document.querySelectorAll got: 5
+
Added: trunk/LayoutTests/fast/css/checked-pseudo-selector.html (0 => 97224)
--- trunk/LayoutTests/fast/css/checked-pseudo-selector.html (rev 0)
+++ trunk/LayoutTests/fast/css/checked-pseudo-selector.html 2011-10-12 03:45:47 UTC (rev 97224)
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>:checked pseudo selector not matching selected option</title>
+</head>
+<body>
+
+<p>This is a :checked pseudo selector test.</p>
+<div id="console"></div>
+
+<form action=''>
+<select id='sel' name='select' multiple>
+ <option id="option1" selected>option1</option>
+ <option id="option2">option2</option>
+ <option id="option3" selected>option3</option>
+ <option id="option4">option4</option>
+</select>
+<br>
+<input id="radio1" type="radio" name="radiotest" value="radio1" /> Radio1
+<br>
+<input id="radio2" type="radio" name="radiotest" value="radio2" checked/> Radio2
+<br>
+<input id="checkbox1" type="checkbox" name="checktest" value="checkbox1" checked/> Checkbox1
+<br>
+<input id="checkbox2" type="checkbox" name="checktest" value="checkbox2" checked/> Checkbox2
+</form>
+<br>
+<script language="_javascript_" type="text/_javascript_">
+var totalChecked = 0;
+var expectedCount = 0;
+var idArray=new Array("option1","option2","option3","option4","radio1","radio2","checkbox1","checkbox2");
+
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+}
+
+function isCheckedOrSelected(id) {
+ var obj = document.getElementById(id);
+ if (obj.checked || obj.selected)
+ return true;
+}
+
+function runTest() {
+ for (var i = 0; i < idArray.length; i++) {
+ if (isCheckedOrSelected(idArray[i]))
+ expectedCount++;
+ }
+ totalChecked = document.querySelectorAll(':checked').length;
+ logResult(totalChecked,expectedCount);
+}
+
+function logResult(totalChecked, expectedCount) {
+ if (totalChecked != expectedCount)
+ document.write('FAIL - expected: ' + expectedCount + ' and document.querySelectorAll got: ' + totalChecked);
+ else
+ document.write('PASS - expected: ' + expectedCount + ' and document.querySelectorAll got: ' + totalChecked);
+ document.write('<br>');
+ }
+
+if (window.eventSender) {
+ runTest();
+ }
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (97223 => 97224)
--- trunk/Source/WebCore/ChangeLog 2011-10-12 03:29:17 UTC (rev 97223)
+++ trunk/Source/WebCore/ChangeLog 2011-10-12 03:45:47 UTC (rev 97224)
@@ -1,3 +1,18 @@
+2011-10-11 Sameer Patil <[email protected]>
+
+ :checked pseudo selector not matching selected option
+ https://bugs.webkit.org/show_bug.cgi?id=63192
+
+ Reviewed by Kent Tamura.
+
+ Test: fast/css/checked-pseudo-selector.html
+
+ Option element selected state need to be checked in checkOneSelector,
+ so that it can be considered as checked on querySelectorAll(':checked').
+
+ * css/SelectorChecker.cpp:
+ (WebCore::SelectorChecker::checkOneSelector):
+
2011-10-11 Ryuan Choi <[email protected]>
StorageAreaSync::sync needs a transaction for better performance.
Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (97223 => 97224)
--- trunk/Source/WebCore/css/SelectorChecker.cpp 2011-10-12 03:29:17 UTC (rev 97223)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp 2011-10-12 03:45:47 UTC (rev 97224)
@@ -40,6 +40,7 @@
#include "HTMLProgressElement.h"
#include "InspectorInstrumentation.h"
#include "NodeRenderStyle.h"
+#include "OptionElement.h"
#include "Page.h"
#include "PageGroup.h"
#include "RenderObject.h"
@@ -1116,6 +1117,10 @@
HTMLInputElement* inputElement = e->toInputElement();
if (inputElement && inputElement->shouldAppearChecked() && !inputElement->isIndeterminate())
return true;
+
+ OptionElement* optionElement = toOptionElement(e);
+ if (optionElement && optionElement->selected())
+ return true;
break;
}
case CSSSelector::PseudoIndeterminate:
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes