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

Side by Side Diff: Source/core/html/HTMLOptionElement.cpp

Issue 540533004: Use style invalidation for more pseudo classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 6 years, 3 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
« no previous file with comments | « Source/core/html/HTMLOptGroupElement.cpp ('k') | Source/core/html/HTMLProgressElement.cpp » ('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 * (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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 176
177 void HTMLOptionElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value) 177 void HTMLOptionElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value)
178 { 178 {
179 if (name == valueAttr) { 179 if (name == valueAttr) {
180 if (HTMLDataListElement* dataList = ownerDataListElement()) 180 if (HTMLDataListElement* dataList = ownerDataListElement())
181 dataList->optionElementChildrenChanged(); 181 dataList->optionElementChildrenChanged();
182 } else if (name == disabledAttr) { 182 } else if (name == disabledAttr) {
183 bool oldDisabled = m_disabled; 183 bool oldDisabled = m_disabled;
184 m_disabled = !value.isNull(); 184 m_disabled = !value.isNull();
185 if (oldDisabled != m_disabled) { 185 if (oldDisabled != m_disabled) {
186 didAffectSelector(AffectedSelectorDisabled | AffectedSelectorEnabled ); 186 pseudoStateChanged(CSSSelector::PseudoDisabled);
187 pseudoStateChanged(CSSSelector::PseudoEnabled);
187 if (renderer() && renderer()->style()->hasAppearance()) 188 if (renderer() && renderer()->style()->hasAppearance())
188 RenderTheme::theme().stateChanged(renderer(), EnabledControlStat e); 189 RenderTheme::theme().stateChanged(renderer(), EnabledControlStat e);
189 } 190 }
190 } else if (name == selectedAttr) { 191 } else if (name == selectedAttr) {
191 if (bool willBeSelected = !value.isNull()) 192 if (bool willBeSelected = !value.isNull())
192 setSelected(willBeSelected); 193 setSelected(willBeSelected);
193 } else if (name == labelAttr) { 194 } else if (name == labelAttr) {
194 updateLabel(); 195 updateLabel();
195 } else 196 } else
196 HTMLElement::parseAttribute(name, value); 197 HTMLElement::parseAttribute(name, value);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 if (HTMLSelectElement* select = ownerSelectElement()) 237 if (HTMLSelectElement* select = ownerSelectElement())
237 select->optionSelectionStateChanged(this, selected); 238 select->optionSelectionStateChanged(this, selected);
238 } 239 }
239 240
240 void HTMLOptionElement::setSelectedState(bool selected) 241 void HTMLOptionElement::setSelectedState(bool selected)
241 { 242 {
242 if (m_isSelected == selected) 243 if (m_isSelected == selected)
243 return; 244 return;
244 245
245 m_isSelected = selected; 246 m_isSelected = selected;
246 didAffectSelector(AffectedSelectorChecked); 247 pseudoStateChanged(CSSSelector::PseudoChecked);
247 248
248 if (HTMLSelectElement* select = ownerSelectElement()) 249 if (HTMLSelectElement* select = ownerSelectElement())
249 select->invalidateSelectedItems(); 250 select->invalidateSelectedItems();
250 } 251 }
251 252
252 void HTMLOptionElement::childrenChanged(const ChildrenChange& change) 253 void HTMLOptionElement::childrenChanged(const ChildrenChange& change)
253 { 254 {
254 if (HTMLDataListElement* dataList = ownerDataListElement()) 255 if (HTMLDataListElement* dataList = ownerDataListElement())
255 dataList->optionElementChildrenChanged(); 256 dataList->optionElementChildrenChanged();
256 else if (HTMLSelectElement* select = ownerSelectElement()) 257 else if (HTMLSelectElement* select = ownerSelectElement())
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 ASSERT(parent); 411 ASSERT(parent);
411 if (isHTMLOptGroupElement(*parent)) { 412 if (isHTMLOptGroupElement(*parent)) {
412 RenderStyle* parentStyle = parent->renderStyle() ? parent->renderSty le() : parent->computedStyle(); 413 RenderStyle* parentStyle = parent->renderStyle() ? parent->renderSty le() : parent->computedStyle();
413 return !parentStyle || parentStyle->display() == NONE; 414 return !parentStyle || parentStyle->display() == NONE;
414 } 415 }
415 } 416 }
416 return m_style->display() == NONE; 417 return m_style->display() == NONE;
417 } 418 }
418 419
419 } // namespace blink 420 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/HTMLOptGroupElement.cpp ('k') | Source/core/html/HTMLProgressElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698