Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(947)

Unified Diff: Source/core/html/HTMLSelectElement.cpp

Issue 1181183004: Recalc list items for <select> before updating style for the select. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: comments. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLSelectElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLSelectElement.cpp
diff --git a/Source/core/html/HTMLSelectElement.cpp b/Source/core/html/HTMLSelectElement.cpp
index 40e693be924001375294aac11ae0a0f410e5de77..18573bc13df42da499b5ef18332daa5d216d5883 100644
--- a/Source/core/html/HTMLSelectElement.cpp
+++ b/Source/core/html/HTMLSelectElement.cpp
@@ -85,6 +85,7 @@ HTMLSelectElement::HTMLSelectElement(Document& document, HTMLFormElement* form)
, m_suggestedIndex(-1)
, m_isAutofilledByPreview(false)
{
+ setHasCustomStyleCallbacks();
}
PassRefPtrWillBeRawPtr<HTMLSelectElement> HTMLSelectElement::create(Document& document)
@@ -1751,6 +1752,16 @@ DEFINE_TRACE(HTMLSelectElement)
HTMLFormControlElementWithState::trace(visitor);
}
+void HTMLSelectElement::willRecalcStyle(StyleRecalcChange change)
+{
+ // recalcListItems will update the selected state of the <option> elements
+ // in this <select> so we need to do it before we recalc their style so they
+ // match the right selectors (ex. :checked).
+ // TODO(esprehn): Find a way to avoid needing a willRecalcStyle callback.
+ if (m_shouldRecalcListItems)
+ recalcListItems();
+}
+
void HTMLSelectElement::didAddUserAgentShadowRoot(ShadowRoot& root)
{
RefPtrWillBeRawPtr<HTMLContentElement> content = HTMLContentElement::create(document());
« no previous file with comments | « Source/core/html/HTMLSelectElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698