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

Side by Side Diff: Source/core/html/HTMLOptGroupElement.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/HTMLOptGroupElement.h ('k') | Source/core/html/HTMLOptionElement.h » ('j') | 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 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv ed.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 { 77 {
78 ContainerNode* select = parentNode(); 78 ContainerNode* select = parentNode();
79 while (select && !select->hasTagName(selectTag)) 79 while (select && !select->hasTagName(selectTag))
80 select = select->parentNode(); 80 select = select->parentNode();
81 if (select) 81 if (select)
82 toHTMLSelectElement(select)->setRecalcListItems(); 82 toHTMLSelectElement(select)->setRecalcListItems();
83 } 83 }
84 84
85 void HTMLOptGroupElement::attach(const AttachContext& context) 85 void HTMLOptGroupElement::attach(const AttachContext& context)
86 { 86 {
87 updateNonRenderStyle(); 87 if (context.resolvedStyle) {
88 ASSERT(!m_style || m_style == context.resolvedStyle);
89 m_style = context.resolvedStyle;
90 }
88 HTMLElement::attach(context); 91 HTMLElement::attach(context);
89 } 92 }
90 93
91 void HTMLOptGroupElement::detach(const AttachContext& context) 94 void HTMLOptGroupElement::detach(const AttachContext& context)
92 { 95 {
93 m_style.clear(); 96 m_style.clear();
94 HTMLElement::detach(context); 97 HTMLElement::detach(context);
95 } 98 }
96 99
97 void HTMLOptGroupElement::updateNonRenderStyle() 100 void HTMLOptGroupElement::updateNonRenderStyle()
98 { 101 {
99 m_style = originalStyleForRenderer(); 102 m_style = originalStyleForRenderer();
100 } 103 }
101 104
102 RenderStyle* HTMLOptGroupElement::nonRendererStyle() const 105 RenderStyle* HTMLOptGroupElement::nonRendererStyle() const
103 { 106 {
104 return m_style.get(); 107 return m_style.get();
105 } 108 }
106 109
107 PassRefPtr<RenderStyle> HTMLOptGroupElement::customStyleForRenderer() 110 PassRefPtr<RenderStyle> HTMLOptGroupElement::customStyleForRenderer()
108 { 111 {
112 updateNonRenderStyle();
109 return m_style; 113 return m_style;
110 } 114 }
111 115
112 void HTMLOptGroupElement::willRecalcStyle(StyleRecalcChange change)
113 {
114 if (!needsAttach() && (needsStyleRecalc() || change >= Inherit))
115 updateNonRenderStyle();
116 }
117
118 String HTMLOptGroupElement::groupLabelText() const 116 String HTMLOptGroupElement::groupLabelText() const
119 { 117 {
120 String itemText = getAttribute(labelAttr); 118 String itemText = getAttribute(labelAttr);
121 119
122 // In WinIE, leading and trailing whitespace is ignored in options and optgr oups. We match this behavior. 120 // In WinIE, leading and trailing whitespace is ignored in options and optgr oups. We match this behavior.
123 itemText = itemText.stripWhiteSpace(); 121 itemText = itemText.stripWhiteSpace();
124 // We want to collapse our whitespace too. This will match other browsers. 122 // We want to collapse our whitespace too. This will match other browsers.
125 itemText = itemText.simplifyWhiteSpace(); 123 itemText = itemText.simplifyWhiteSpace();
126 124
127 return itemText; 125 return itemText;
(...skipping 13 matching lines...) Expand all
141 139
142 void HTMLOptGroupElement::accessKeyAction(bool) 140 void HTMLOptGroupElement::accessKeyAction(bool)
143 { 141 {
144 HTMLSelectElement* select = ownerSelectElement(); 142 HTMLSelectElement* select = ownerSelectElement();
145 // send to the parent to bring focus to the list box 143 // send to the parent to bring focus to the list box
146 if (select && !select->focused()) 144 if (select && !select->focused())
147 select->accessKeyAction(false); 145 select->accessKeyAction(false);
148 } 146 }
149 147
150 } // namespace 148 } // namespace
OLDNEW
« no previous file with comments | « Source/core/html/HTMLOptGroupElement.h ('k') | Source/core/html/HTMLOptionElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698