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

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

Issue 2723793002: De-Element ScriptLoader (Closed)
Patch Set: Address comments Created 3 years, 9 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
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 14 matching lines...) Expand all
25 */ 25 */
26 26
27 #include "core/html/HTMLOptionElement.h" 27 #include "core/html/HTMLOptionElement.h"
28 28
29 #include "bindings/core/v8/ExceptionState.h" 29 #include "bindings/core/v8/ExceptionState.h"
30 #include "core/HTMLNames.h" 30 #include "core/HTMLNames.h"
31 #include "core/dom/AXObjectCache.h" 31 #include "core/dom/AXObjectCache.h"
32 #include "core/dom/Document.h" 32 #include "core/dom/Document.h"
33 #include "core/dom/NodeComputedStyle.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"
36 #include "core/dom/Text.h" 35 #include "core/dom/Text.h"
37 #include "core/dom/shadow/ShadowRoot.h" 36 #include "core/dom/shadow/ShadowRoot.h"
38 #include "core/html/HTMLDataListElement.h" 37 #include "core/html/HTMLDataListElement.h"
39 #include "core/html/HTMLOptGroupElement.h" 38 #include "core/html/HTMLOptGroupElement.h"
40 #include "core/html/HTMLSelectElement.h" 39 #include "core/html/HTMLSelectElement.h"
41 #include "core/html/parser/HTMLParserIdioms.h" 40 #include "core/html/parser/HTMLParserIdioms.h"
42 #include "core/layout/LayoutTheme.h" 41 #include "core/layout/LayoutTheme.h"
43 #include "core/style/ComputedStyle.h" 42 #include "core/style/ComputedStyle.h"
44 #include "wtf/Vector.h" 43 #include "wtf/Vector.h"
45 #include "wtf/text/StringBuilder.h" 44 #include "wtf/text/StringBuilder.h"
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 } 375 }
377 HTMLElement::removedFrom(insertionPoint); 376 HTMLElement::removedFrom(insertionPoint);
378 } 377 }
379 378
380 String HTMLOptionElement::collectOptionInnerText() const { 379 String HTMLOptionElement::collectOptionInnerText() const {
381 StringBuilder text; 380 StringBuilder text;
382 for (Node* node = firstChild(); node;) { 381 for (Node* node = firstChild(); node;) {
383 if (node->isTextNode()) 382 if (node->isTextNode())
384 text.append(node->nodeValue()); 383 text.append(node->nodeValue());
385 // Text nodes inside script elements are not part of the option text. 384 // Text nodes inside script elements are not part of the option text.
386 if (node->isElementNode() && toScriptLoaderIfPossible(toElement(node))) 385 if (node->isElementNode() && toElement(node)->isScriptElement())
387 node = NodeTraversal::nextSkippingChildren(*node, this); 386 node = NodeTraversal::nextSkippingChildren(*node, this);
388 else 387 else
389 node = NodeTraversal::next(*node, this); 388 node = NodeTraversal::next(*node, this);
390 } 389 }
391 return text.toString(); 390 return text.toString();
392 } 391 }
393 392
394 HTMLFormElement* HTMLOptionElement::form() const { 393 HTMLFormElement* HTMLOptionElement::form() const {
395 if (HTMLSelectElement* selectElement = ownerSelectElement()) 394 if (HTMLSelectElement* selectElement = ownerSelectElement())
396 return selectElement->formOwner(); 395 return selectElement->formOwner();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 } 437 }
439 438
440 String HTMLOptionElement::innerText() { 439 String HTMLOptionElement::innerText() {
441 // A workaround for crbug.com/424578. We add ShadowRoot to an OPTION, but 440 // A workaround for crbug.com/424578. We add ShadowRoot to an OPTION, but
442 // innerText behavior for Shadow DOM is unclear. We just return the same 441 // innerText behavior for Shadow DOM is unclear. We just return the same
443 // string before adding ShadowRoot. 442 // string before adding ShadowRoot.
444 return textContent(); 443 return textContent();
445 } 444 }
446 445
447 } // namespace blink 446 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698