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

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

Issue 165433002: Recalc OPTION and OPTGROUP from recalcOwnStyle. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Removed unnecessary branch. Created 6 years, 10 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/HTMLOptionElement.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/HTMLOptionElement.cpp
diff --git a/Source/core/html/HTMLOptionElement.cpp b/Source/core/html/HTMLOptionElement.cpp
index 7b5bc1ff0043e6e5f1a0c07259eb15684654972e..cf346f448327afaa8d97e56c1f5127b743feb2fb 100644
--- a/Source/core/html/HTMLOptionElement.cpp
+++ b/Source/core/html/HTMLOptionElement.cpp
@@ -81,8 +81,15 @@ PassRefPtr<HTMLOptionElement> HTMLOptionElement::createForJSConstructor(Document
void HTMLOptionElement::attach(const AttachContext& context)
{
- updateNonRenderStyle();
- HTMLElement::attach(context);
+ AttachContext optionContext(context);
+ if (context.resolvedStyle) {
+ ASSERT(!m_style || m_style == context.resolvedStyle);
+ m_style = context.resolvedStyle;
+ } else {
+ updateNonRenderStyle();
+ optionContext.resolvedStyle = m_style.get();
+ }
+ HTMLElement::attach(optionContext);
}
void HTMLOptionElement::detach(const AttachContext& context)
@@ -296,19 +303,16 @@ RenderStyle* HTMLOptionElement::nonRendererStyle() const
PassRefPtr<RenderStyle> HTMLOptionElement::customStyleForRenderer()
{
+ updateNonRenderStyle();
return m_style;
}
-void HTMLOptionElement::willRecalcStyle(StyleRecalcChange change)
+void HTMLOptionElement::didRecalcStyle(StyleRecalcChange change)
{
- if (!needsAttach() && (needsStyleRecalc() || change >= Inherit))
- updateNonRenderStyle();
-}
+ if (change == NoChange)
+ return;
-void HTMLOptionElement::didRecalcStyle(StyleRecalcChange)
-{
- // FIXME: This is nasty, we ask our owner select to repaint even if the new
- // style is exactly the same.
+ // FIXME: We ask our owner select to repaint regardless of which property changed.
if (HTMLSelectElement* select = ownerSelectElement()) {
if (RenderObject* renderer = select->renderer())
renderer->repaint();
« no previous file with comments | « Source/core/html/HTMLOptionElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698