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

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

Issue 1033943002: Rename LayoutStyle to papayawhip (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ensureComputedStyle Created 5 years, 8 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') | Source/core/html/HTMLPlugInElement.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 * (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 12 matching lines...) Expand all
23 * Boston, MA 02110-1301, USA. 23 * Boston, MA 02110-1301, USA.
24 * 24 *
25 */ 25 */
26 26
27 #include "config.h" 27 #include "config.h"
28 #include "core/html/HTMLOptionElement.h" 28 #include "core/html/HTMLOptionElement.h"
29 29
30 #include "bindings/core/v8/ExceptionState.h" 30 #include "bindings/core/v8/ExceptionState.h"
31 #include "core/HTMLNames.h" 31 #include "core/HTMLNames.h"
32 #include "core/dom/Document.h" 32 #include "core/dom/Document.h"
33 #include "core/dom/NodeLayoutStyle.h" 33 #include "core/dom/NodeComputedStyle.h"
34 #include "core/dom/NodeTraversal.h" 34 #include "core/dom/NodeTraversal.h"
35 #include "core/dom/ScriptLoader.h" 35 #include "core/dom/ScriptLoader.h"
36 #include "core/dom/Text.h" 36 #include "core/dom/Text.h"
37 #include "core/dom/shadow/ShadowRoot.h" 37 #include "core/dom/shadow/ShadowRoot.h"
38 #include "core/html/HTMLDataListElement.h" 38 #include "core/html/HTMLDataListElement.h"
39 #include "core/html/HTMLOptGroupElement.h" 39 #include "core/html/HTMLOptGroupElement.h"
40 #include "core/html/HTMLSelectElement.h" 40 #include "core/html/HTMLSelectElement.h"
41 #include "core/html/parser/HTMLParserIdioms.h" 41 #include "core/html/parser/HTMLParserIdioms.h"
42 #include "core/layout/LayoutTheme.h" 42 #include "core/layout/LayoutTheme.h"
43 #include "wtf/Vector.h" 43 #include "wtf/Vector.h"
44 #include "wtf/text/StringBuilder.h" 44 #include "wtf/text/StringBuilder.h"
45 45
46 namespace blink { 46 namespace blink {
47 47
48 using namespace HTMLNames; 48 using namespace HTMLNames;
49 49
50 HTMLOptionElement::HTMLOptionElement(Document& document) 50 HTMLOptionElement::HTMLOptionElement(Document& document)
51 : HTMLElement(optionTag, document) 51 : HTMLElement(optionTag, document)
52 , m_disabled(false) 52 , m_disabled(false)
53 , m_isSelected(false) 53 , m_isSelected(false)
54 { 54 {
55 setHasCustomStyleCallbacks(); 55 setHasCustomStyleCallbacks();
56 } 56 }
57 57
58 // An explicit empty destructor should be in HTMLOptionElement.cpp, because 58 // An explicit empty destructor should be in HTMLOptionElement.cpp, because
59 // if an implicit destructor is used or an empty destructor is defined in 59 // if an implicit destructor is used or an empty destructor is defined in
60 // HTMLOptionElement.h, when including HTMLOptionElement.h, 60 // HTMLOptionElement.h, when including HTMLOptionElement.h,
61 // msvc tries to expand the destructor and causes 61 // msvc tries to expand the destructor and causes
62 // a compile error because of lack of LayoutStyle definition. 62 // a compile error because of lack of ComputedStyle definition.
63 HTMLOptionElement::~HTMLOptionElement() 63 HTMLOptionElement::~HTMLOptionElement()
64 { 64 {
65 } 65 }
66 66
67 PassRefPtrWillBeRawPtr<HTMLOptionElement> HTMLOptionElement::create(Document& do cument) 67 PassRefPtrWillBeRawPtr<HTMLOptionElement> HTMLOptionElement::create(Document& do cument)
68 { 68 {
69 RefPtrWillBeRawPtr<HTMLOptionElement> option = adoptRefWillBeNoop(new HTMLOp tionElement(document)); 69 RefPtrWillBeRawPtr<HTMLOptionElement> option = adoptRefWillBeNoop(new HTMLOp tionElement(document));
70 option->ensureClosedShadowRoot(); 70 option->ensureClosedShadowRoot();
71 return option.release(); 71 return option.release();
72 } 72 }
(...skipping 16 matching lines...) Expand all
89 return element.release(); 89 return element.release();
90 } 90 }
91 91
92 void HTMLOptionElement::attach(const AttachContext& context) 92 void HTMLOptionElement::attach(const AttachContext& context)
93 { 93 {
94 AttachContext optionContext(context); 94 AttachContext optionContext(context);
95 if (context.resolvedStyle) { 95 if (context.resolvedStyle) {
96 ASSERT(!m_style || m_style == context.resolvedStyle); 96 ASSERT(!m_style || m_style == context.resolvedStyle);
97 m_style = context.resolvedStyle; 97 m_style = context.resolvedStyle;
98 } else { 98 } else {
99 updateNonLayoutStyle(); 99 updateNonComputedStyle();
100 optionContext.resolvedStyle = m_style.get(); 100 optionContext.resolvedStyle = m_style.get();
101 } 101 }
102 HTMLElement::attach(optionContext); 102 HTMLElement::attach(optionContext);
103 } 103 }
104 104
105 void HTMLOptionElement::detach(const AttachContext& context) 105 void HTMLOptionElement::detach(const AttachContext& context)
106 { 106 {
107 m_style.clear(); 107 m_style.clear();
108 HTMLElement::detach(context); 108 HTMLElement::detach(context);
109 } 109 }
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 if (!label.isNull()) 294 if (!label.isNull())
295 return label; 295 return label;
296 return collectOptionInnerText().stripWhiteSpace(isHTMLSpace<UChar>).simplify WhiteSpace(isHTMLSpace<UChar>); 296 return collectOptionInnerText().stripWhiteSpace(isHTMLSpace<UChar>).simplify WhiteSpace(isHTMLSpace<UChar>);
297 } 297 }
298 298
299 void HTMLOptionElement::setLabel(const AtomicString& label) 299 void HTMLOptionElement::setLabel(const AtomicString& label)
300 { 300 {
301 setAttribute(labelAttr, label); 301 setAttribute(labelAttr, label);
302 } 302 }
303 303
304 void HTMLOptionElement::updateNonLayoutStyle() 304 void HTMLOptionElement::updateNonComputedStyle()
305 { 305 {
306 m_style = originalStyleForLayoutObject(); 306 m_style = originalStyleForLayoutObject();
307 if (HTMLSelectElement* select = ownerSelectElement()) 307 if (HTMLSelectElement* select = ownerSelectElement())
308 select->updateListOnRenderer(); 308 select->updateListOnRenderer();
309 } 309 }
310 310
311 LayoutStyle* HTMLOptionElement::nonRendererStyle() const 311 ComputedStyle* HTMLOptionElement::nonLayoutObjectComputedStyle() const
312 { 312 {
313 return m_style.get(); 313 return m_style.get();
314 } 314 }
315 315
316 PassRefPtr<LayoutStyle> HTMLOptionElement::customStyleForLayoutObject() 316 PassRefPtr<ComputedStyle> HTMLOptionElement::customStyleForLayoutObject()
317 { 317 {
318 updateNonLayoutStyle(); 318 updateNonComputedStyle();
319 return m_style; 319 return m_style;
320 } 320 }
321 321
322 void HTMLOptionElement::didRecalcStyle(StyleRecalcChange change) 322 void HTMLOptionElement::didRecalcStyle(StyleRecalcChange change)
323 { 323 {
324 if (change == NoChange) 324 if (change == NoChange)
325 return; 325 return;
326 326
327 // FIXME: We ask our owner select to repaint regardless of which property ch anged. 327 // FIXME: We ask our owner select to repaint regardless of which property ch anged.
328 if (HTMLSelectElement* select = ownerSelectElement()) { 328 if (HTMLSelectElement* select = ownerSelectElement()) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 { 417 {
418 // If m_style is not set, then the node is still unattached. 418 // If m_style is not set, then the node is still unattached.
419 // We have to wait till it gets attached to read the display property. 419 // We have to wait till it gets attached to read the display property.
420 if (!m_style) 420 if (!m_style)
421 return false; 421 return false;
422 422
423 if (m_style->display() != NONE) { 423 if (m_style->display() != NONE) {
424 Element* parent = parentElement(); 424 Element* parent = parentElement();
425 ASSERT(parent); 425 ASSERT(parent);
426 if (isHTMLOptGroupElement(*parent)) { 426 if (isHTMLOptGroupElement(*parent)) {
427 const LayoutStyle* parentStyle = parent->layoutStyle() ? parent->lay outStyle() : parent->computedStyle(); 427 const ComputedStyle* parentStyle = parent->computedStyle() ? parent- >computedStyle() : parent->ensureComputedStyle();
428 return !parentStyle || parentStyle->display() == NONE; 428 return !parentStyle || parentStyle->display() == NONE;
429 } 429 }
430 } 430 }
431 return m_style->display() == NONE; 431 return m_style->display() == NONE;
432 } 432 }
433 433
434 } // namespace blink 434 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/HTMLOptionElement.h ('k') | Source/core/html/HTMLPlugInElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698