diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-07 11:22:47 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-07 11:22:47 +0100 |
commit | cfd86b747d32ac22246a1aa908eaa720c63a88c1 (patch) | |
tree | 24d68c6f61c464ecba1e05670b80390ea3b0e50c /Source/WebCore/html/HTMLOptionElement.cpp | |
parent | 69d7c744c9de19d152dbe2d8e46eb7dfd4511d1a (diff) | |
download | qtwebkit-cfd86b747d32ac22246a1aa908eaa720c63a88c1.tar.gz |
Imported WebKit commit 20271caf2e2c016d5cef40184cddeefeac4f1876 (http://svn.webkit.org/repository/webkit/trunk@133733)
New snapshot that contains all previous fixes as well as build fix for latest QtMultimedia API changes.
Diffstat (limited to 'Source/WebCore/html/HTMLOptionElement.cpp')
-rw-r--r-- | Source/WebCore/html/HTMLOptionElement.cpp | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/Source/WebCore/html/HTMLOptionElement.cpp b/Source/WebCore/html/HTMLOptionElement.cpp index 8fcc22c27..b03c7f9ad 100644 --- a/Source/WebCore/html/HTMLOptionElement.cpp +++ b/Source/WebCore/html/HTMLOptionElement.cpp @@ -55,6 +55,7 @@ HTMLOptionElement::HTMLOptionElement(const QualifiedName& tagName, Document* doc , m_isSelected(false) { ASSERT(hasTagName(optionTag)); + setHasCustomCallbacks(); } PassRefPtr<HTMLOptionElement> HTMLOptionElement::create(Document* document) @@ -90,9 +91,12 @@ PassRefPtr<HTMLOptionElement> HTMLOptionElement::createForJSConstructor(Document void HTMLOptionElement::attach() { - if (parentNode()->renderStyle()) - setRenderStyle(styleForRenderer()); HTMLElement::attach(); + // If after attaching nothing called styleForRenderer() on this node we + // manually cache the value. This happens if our parent doesn't have a + // renderer like <optgroup> or if it doesn't allow children like <select>. + if (!m_style && parentNode()->renderStyle()) + updateNonRenderStyle(); } void HTMLOptionElement::detach() @@ -305,20 +309,34 @@ void HTMLOptionElement::setLabel(const String& label) setAttribute(labelAttr, label); } -void HTMLOptionElement::setRenderStyle(PassRefPtr<RenderStyle> newStyle) +void HTMLOptionElement::updateNonRenderStyle() { - m_style = newStyle; - if (HTMLSelectElement* select = ownerSelectElement()) { - if (RenderObject* renderer = select->renderer()) - renderer->repaint(); - } + m_style = document()->styleResolver()->styleForElement(this); } -RenderStyle* HTMLOptionElement::nonRendererRenderStyle() const +RenderStyle* HTMLOptionElement::nonRendererStyle() const { return m_style.get(); } +PassRefPtr<RenderStyle> HTMLOptionElement::customStyleForRenderer() +{ + // styleForRenderer is called whenever a new style should be associated + // with an Element so now is a good time to update our cached style. + updateNonRenderStyle(); + return m_style; +} + +void HTMLOptionElement::didRecalcStyle(StyleChange) +{ + // FIXME: This is nasty, we ask our owner select to repaint even if the new + // style is exactly the same. + if (HTMLSelectElement* select = ownerSelectElement()) { + if (RenderObject* renderer = select->renderer()) + renderer->repaint(); + } +} + String HTMLOptionElement::textIndentedToRespectGroupLabel() const { ContainerNode* parent = parentNode(); |