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

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

Issue 1511523002: Align HTMLImageElement relevant mutations to spec (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix removal issue when a text node is between <source> and <img> Created 5 years 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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 Node::InsertionNotificationRequest HTMLOptionElement::insertedInto(ContainerNode * insertionPoint) 380 Node::InsertionNotificationRequest HTMLOptionElement::insertedInto(ContainerNode * insertionPoint)
381 { 381 {
382 HTMLElement::insertedInto(insertionPoint); 382 HTMLElement::insertedInto(insertionPoint);
383 if (HTMLSelectElement* select = ownerSelectElement()) { 383 if (HTMLSelectElement* select = ownerSelectElement()) {
384 if (insertionPoint == select || (isHTMLOptGroupElement(*insertionPoint) && insertionPoint->parentNode() == select)) 384 if (insertionPoint == select || (isHTMLOptGroupElement(*insertionPoint) && insertionPoint->parentNode() == select))
385 select->optionInserted(*this, m_isSelected); 385 select->optionInserted(*this, m_isSelected);
386 } 386 }
387 return InsertionDone; 387 return InsertionDone;
388 } 388 }
389 389
390 void HTMLOptionElement::removedFrom(ContainerNode* insertionPoint) 390 void HTMLOptionElement::removedFrom(ContainerNode* insertionPoint, Node* next)
391 { 391 {
392 if (isHTMLSelectElement(*insertionPoint)) { 392 if (isHTMLSelectElement(*insertionPoint)) {
393 if (!parentNode() || isHTMLOptGroupElement(*parentNode())) 393 if (!parentNode() || isHTMLOptGroupElement(*parentNode()))
394 toHTMLSelectElement(insertionPoint)->optionRemoved(*this); 394 toHTMLSelectElement(insertionPoint)->optionRemoved(*this);
395 } else if (isHTMLOptGroupElement(*insertionPoint)) { 395 } else if (isHTMLOptGroupElement(*insertionPoint)) {
396 Node* parent = insertionPoint->parentNode(); 396 Node* parent = insertionPoint->parentNode();
397 if (isHTMLSelectElement(parent)) 397 if (isHTMLSelectElement(parent))
398 toHTMLSelectElement(parent)->optionRemoved(*this); 398 toHTMLSelectElement(parent)->optionRemoved(*this);
399 } 399 }
400 HTMLElement::removedFrom(insertionPoint); 400 HTMLElement::removedFrom(insertionPoint, next);
401 } 401 }
402 402
403 String HTMLOptionElement::collectOptionInnerText() const 403 String HTMLOptionElement::collectOptionInnerText() const
404 { 404 {
405 StringBuilder text; 405 StringBuilder text;
406 for (Node* node = firstChild(); node; ) { 406 for (Node* node = firstChild(); node; ) {
407 if (node->isTextNode()) 407 if (node->isTextNode())
408 text.append(node->nodeValue()); 408 text.append(node->nodeValue());
409 // Text nodes inside script elements are not part of the option text. 409 // Text nodes inside script elements are not part of the option text.
410 if (node->isElementNode() && toScriptLoaderIfPossible(toElement(node))) 410 if (node->isElementNode() && toScriptLoaderIfPossible(toElement(node)))
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 ASSERT(parent); 457 ASSERT(parent);
458 if (isHTMLOptGroupElement(*parent)) { 458 if (isHTMLOptGroupElement(*parent)) {
459 const ComputedStyle* parentStyle = parent->computedStyle() ? parent- >computedStyle() : parent->ensureComputedStyle(); 459 const ComputedStyle* parentStyle = parent->computedStyle() ? parent- >computedStyle() : parent->ensureComputedStyle();
460 return !parentStyle || parentStyle->display() == NONE; 460 return !parentStyle || parentStyle->display() == NONE;
461 } 461 }
462 } 462 }
463 return m_style->display() == NONE; 463 return m_style->display() == NONE;
464 } 464 }
465 465
466 } // namespace blink 466 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698