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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLOptionElement.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 5 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
6 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved.
7 * Copyright (C) 2010 Google Inc. All rights reserved. 7 * Copyright (C) 2010 Google Inc. All rights reserved.
8 * Copyright (C) 2011 Motorola Mobility, Inc. All rights reserved. 8 * Copyright (C) 2011 Motorola Mobility, Inc. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 element->setValue(value); 74 element->setValue(value);
75 if (defaultSelected) 75 if (defaultSelected)
76 element->setAttribute(selectedAttr, emptyAtom); 76 element->setAttribute(selectedAttr, emptyAtom);
77 element->setSelected(selected); 77 element->setSelected(selected);
78 78
79 return element.release(); 79 return element.release();
80 } 80 }
81 81
82 void HTMLOptionElement::attach(const AttachContext& context) 82 void HTMLOptionElement::attach(const AttachContext& context)
83 { 83 {
84 updateNonRenderStyle(); 84 AttachContext optionContext(context);
85 HTMLElement::attach(context); 85 if (context.resolvedStyle) {
86 ASSERT(!m_style || m_style == context.resolvedStyle);
87 m_style = context.resolvedStyle;
88 } else {
89 updateNonRenderStyle();
90 optionContext.resolvedStyle = m_style.get();
91 }
92 HTMLElement::attach(optionContext);
86 } 93 }
87 94
88 void HTMLOptionElement::detach(const AttachContext& context) 95 void HTMLOptionElement::detach(const AttachContext& context)
89 { 96 {
90 m_style.clear(); 97 m_style.clear();
91 HTMLElement::detach(context); 98 HTMLElement::detach(context);
92 } 99 }
93 100
94 bool HTMLOptionElement::rendererIsFocusable() const 101 bool HTMLOptionElement::rendererIsFocusable() const
95 { 102 {
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 m_style = originalStyleForRenderer(); 296 m_style = originalStyleForRenderer();
290 } 297 }
291 298
292 RenderStyle* HTMLOptionElement::nonRendererStyle() const 299 RenderStyle* HTMLOptionElement::nonRendererStyle() const
293 { 300 {
294 return m_style.get(); 301 return m_style.get();
295 } 302 }
296 303
297 PassRefPtr<RenderStyle> HTMLOptionElement::customStyleForRenderer() 304 PassRefPtr<RenderStyle> HTMLOptionElement::customStyleForRenderer()
298 { 305 {
306 updateNonRenderStyle();
299 return m_style; 307 return m_style;
300 } 308 }
301 309
302 void HTMLOptionElement::willRecalcStyle(StyleRecalcChange change) 310 void HTMLOptionElement::didRecalcStyle(StyleRecalcChange change)
303 { 311 {
304 if (!needsAttach() && (needsStyleRecalc() || change >= Inherit)) 312 if (change == NoChange)
305 updateNonRenderStyle(); 313 return;
306 }
307 314
308 void HTMLOptionElement::didRecalcStyle(StyleRecalcChange) 315 // FIXME: We ask our owner select to repaint regardless of which property ch anged.
309 {
310 // FIXME: This is nasty, we ask our owner select to repaint even if the new
311 // style is exactly the same.
312 if (HTMLSelectElement* select = ownerSelectElement()) { 316 if (HTMLSelectElement* select = ownerSelectElement()) {
313 if (RenderObject* renderer = select->renderer()) 317 if (RenderObject* renderer = select->renderer())
314 renderer->repaint(); 318 renderer->repaint();
315 } 319 }
316 } 320 }
317 321
318 String HTMLOptionElement::textIndentedToRespectGroupLabel() const 322 String HTMLOptionElement::textIndentedToRespectGroupLabel() const
319 { 323 {
320 ContainerNode* parent = parentNode(); 324 ContainerNode* parent = parentNode();
321 if (parent && parent->hasTagName(optgroupTag)) 325 if (parent && parent->hasTagName(optgroupTag))
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 369
366 HTMLFormElement* HTMLOptionElement::form() const 370 HTMLFormElement* HTMLOptionElement::form() const
367 { 371 {
368 if (HTMLSelectElement* selectElement = ownerSelectElement()) 372 if (HTMLSelectElement* selectElement = ownerSelectElement())
369 return selectElement->formOwner(); 373 return selectElement->formOwner();
370 374
371 return 0; 375 return 0;
372 } 376 }
373 377
374 } // namespace WebCore 378 } // namespace WebCore
OLDNEW
« 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