Title: [90809] trunk/Source/WebCore
- Revision
- 90809
- Author
- [email protected]
- Date
- 2011-07-11 23:26:04 -0700 (Mon, 11 Jul 2011)
Log Message
Optimize HTMLInputElement::updateCheckedRadioButtons
https://bugs.webkit.org/show_bug.cgi?id=62840
Patch by Zeng Huiqing <[email protected]> on 2011-07-11
Reviewed by Kent Tamura.
No new tests.
* dom/Document.h:
(WebCore::Document::getFormElements):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::updateCheckedRadioButtons):
(WebCore::HTMLInputElement::setChecked):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (90808 => 90809)
--- trunk/Source/WebCore/ChangeLog 2011-07-12 05:58:21 UTC (rev 90808)
+++ trunk/Source/WebCore/ChangeLog 2011-07-12 06:26:04 UTC (rev 90809)
@@ -1,3 +1,18 @@
+2011-07-11 Zeng Huiqing <[email protected]>
+
+ Optimize HTMLInputElement::updateCheckedRadioButtons
+ https://bugs.webkit.org/show_bug.cgi?id=62840
+
+ Reviewed by Kent Tamura.
+
+ No new tests.
+
+ * dom/Document.h:
+ (WebCore::Document::getFormElements):
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::updateCheckedRadioButtons):
+ (WebCore::HTMLInputElement::setChecked):
+
2011-06-23 Pratik Solanki <[email protected]>
Reviewed by David Kilzer.
Modified: trunk/Source/WebCore/dom/Document.h (90808 => 90809)
--- trunk/Source/WebCore/dom/Document.h 2011-07-12 05:58:21 UTC (rev 90808)
+++ trunk/Source/WebCore/dom/Document.h 2011-07-12 06:26:04 UTC (rev 90809)
@@ -218,6 +218,9 @@
}
virtual ~Document();
+ typedef ListHashSet<Element*, 64> FormElementListHashSet;
+ const FormElementListHashSet* getFormElements() const { return &m_formElementsWithState; }
+
MediaQueryMatcher* mediaQueryMatcher();
using TreeScope::ref;
@@ -1226,7 +1229,6 @@
typedef ListHashSet<Node*, 32> StyleSheetCandidateListHashSet;
StyleSheetCandidateListHashSet m_styleSheetCandidateNodes; // All of the nodes that could potentially provide stylesheets to the document (<link>, <style>, <?xml-stylesheet>)
- typedef ListHashSet<Element*, 64> FormElementListHashSet;
FormElementListHashSet m_formElementsWithState;
typedef ListHashSet<RefPtr<FormAssociatedElement>, 32> FormAssociatedElementListHashSet;
FormAssociatedElementListHashSet m_formElementsWithFormAttribute;
Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (90808 => 90809)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2011-07-12 05:58:21 UTC (rev 90808)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2011-07-12 06:26:04 UTC (rev 90809)
@@ -189,11 +189,10 @@
control->setNeedsValidityCheck();
}
} else {
- // FIXME: Traversing the document is inefficient.
- for (Node* node = document()->body(); node; node = node->traverseNextNode()) {
- if (!node->isElementNode())
- continue;
- Element* element = static_cast<Element*>(node);
+ typedef Document::FormElementListHashSet::const_iterator Iterator;
+ Iterator end = document()->getFormElements()->end();
+ for (Iterator it = document()->getFormElements()->begin(); it != end; ++it) {
+ Element* element = *it;
if (element->formControlName() != name())
continue;
if (element->formControlType() != type())
@@ -888,8 +887,8 @@
m_reflectsCheckedAttribute = false;
m_isChecked = nowChecked;
setNeedsStyleRecalc();
-
- updateCheckedRadioButtons();
+ if (isRadioButton())
+ updateCheckedRadioButtons();
setNeedsValidityCheck();
// Ideally we'd do this from the render tree (matching
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes