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

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

Issue 18970003: Introduce isHTMLOptGroupElement and toHTMLOptGroupElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 5 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.h ('k') | Source/core/html/HTMLSelectElement.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 16 matching lines...) Expand all
27 #include "config.h" 27 #include "config.h"
28 #include "core/html/HTMLOptionElement.h" 28 #include "core/html/HTMLOptionElement.h"
29 29
30 #include "HTMLNames.h" 30 #include "HTMLNames.h"
31 #include "core/dom/Document.h" 31 #include "core/dom/Document.h"
32 #include "core/dom/NodeRenderStyle.h" 32 #include "core/dom/NodeRenderStyle.h"
33 #include "core/dom/NodeTraversal.h" 33 #include "core/dom/NodeTraversal.h"
34 #include "core/dom/ScriptLoader.h" 34 #include "core/dom/ScriptLoader.h"
35 #include "core/dom/Text.h" 35 #include "core/dom/Text.h"
36 #include "core/html/HTMLDataListElement.h" 36 #include "core/html/HTMLDataListElement.h"
37 #include "core/html/HTMLOptGroupElement.h"
37 #include "core/html/HTMLSelectElement.h" 38 #include "core/html/HTMLSelectElement.h"
38 #include "core/html/parser/HTMLParserIdioms.h" 39 #include "core/html/parser/HTMLParserIdioms.h"
39 #include "core/rendering/RenderTheme.h" 40 #include "core/rendering/RenderTheme.h"
40 #include "wtf/Vector.h" 41 #include "wtf/Vector.h"
41 #include "wtf/text/StringBuilder.h" 42 #include "wtf/text/StringBuilder.h"
42 43
43 namespace WebCore { 44 namespace WebCore {
44 45
45 using namespace HTMLNames; 46 using namespace HTMLNames;
46 47
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 // style is exactly the same. 327 // style is exactly the same.
327 if (HTMLSelectElement* select = ownerSelectElement()) { 328 if (HTMLSelectElement* select = ownerSelectElement()) {
328 if (RenderObject* renderer = select->renderer()) 329 if (RenderObject* renderer = select->renderer())
329 renderer->repaint(); 330 renderer->repaint();
330 } 331 }
331 } 332 }
332 333
333 String HTMLOptionElement::textIndentedToRespectGroupLabel() const 334 String HTMLOptionElement::textIndentedToRespectGroupLabel() const
334 { 335 {
335 ContainerNode* parent = parentNode(); 336 ContainerNode* parent = parentNode();
336 if (parent && parent->hasTagName(optgroupTag)) 337 if (parent && isHTMLOptGroupElement(parent))
337 return " " + text(); 338 return " " + text();
338 return text(); 339 return text();
339 } 340 }
340 341
341 bool HTMLOptionElement::isDisabledFormControl() const 342 bool HTMLOptionElement::isDisabledFormControl() const
342 { 343 {
343 if (ownElementDisabled()) 344 if (ownElementDisabled())
344 return true; 345 return true;
345 if (Element* parent = parentElement()) 346 if (Element* parent = parentElement())
346 return parent->hasTagName(optgroupTag) && parent->isDisabledFormControl( ); 347 return isHTMLOptGroupElement(parent) && parent->isDisabledFormControl();
347 return false; 348 return false;
348 } 349 }
349 350
350 Node::InsertionNotificationRequest HTMLOptionElement::insertedInto(ContainerNode * insertionPoint) 351 Node::InsertionNotificationRequest HTMLOptionElement::insertedInto(ContainerNode * insertionPoint)
351 { 352 {
352 if (HTMLSelectElement* select = ownerSelectElement()) { 353 if (HTMLSelectElement* select = ownerSelectElement()) {
353 select->setRecalcListItems(); 354 select->setRecalcListItems();
354 // Do not call selected() since calling updateListItemSelectedStates() 355 // Do not call selected() since calling updateListItemSelectedStates()
355 // at this time won't do the right thing. (Why, exactly?) 356 // at this time won't do the right thing. (Why, exactly?)
356 // FIXME: Might be better to call this unconditionally, always passing m _isSelected, 357 // FIXME: Might be better to call this unconditionally, always passing m _isSelected,
(...skipping 15 matching lines...) Expand all
372 // Text nodes inside script elements are not part of the option text. 373 // Text nodes inside script elements are not part of the option text.
373 if (node->isElementNode() && toScriptLoaderIfPossible(toElement(node))) 374 if (node->isElementNode() && toScriptLoaderIfPossible(toElement(node)))
374 node = NodeTraversal::nextSkippingChildren(node, this); 375 node = NodeTraversal::nextSkippingChildren(node, this);
375 else 376 else
376 node = NodeTraversal::next(node, this); 377 node = NodeTraversal::next(node, this);
377 } 378 }
378 return text.toString(); 379 return text.toString();
379 } 380 }
380 381
381 } // namespace WebCore 382 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/HTMLOptGroupElement.h ('k') | Source/core/html/HTMLSelectElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698