Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 * Copyright (C) 2003, 2010 Apple Inc. All rights reserved. | 4 * Copyright (C) 2003, 2010 Apple Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| 11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
| 15 * | 15 * |
| 16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
| 17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
| 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
| 20 * | 20 * |
| 21 */ | 21 */ |
| 22 | 22 |
| 23 #include "core/html/HTMLHRElement.h" | 23 #include "core/html/HTMLHRElement.h" |
| 24 | 24 |
| 25 #include "core/CSSPropertyNames.h" | 25 #include "core/CSSPropertyNames.h" |
| 26 #include "core/CSSValueKeywords.h" | 26 #include "core/CSSValueKeywords.h" |
| 27 #include "core/HTMLNames.h" | 27 #include "core/HTMLNames.h" |
| 28 #include "core/css/CSSColorValue.h" | 28 #include "core/css/CSSColorValue.h" |
| 29 #include "core/css/StylePropertySet.h" | 29 #include "core/css/StylePropertySet.h" |
| 30 #include "core/html/HTMLOptGroupElement.h" | |
| 31 #include "core/html/HTMLSelectElement.h" | |
| 30 | 32 |
| 31 namespace blink { | 33 namespace blink { |
| 32 | 34 |
| 33 using namespace HTMLNames; | 35 using namespace HTMLNames; |
| 34 | 36 |
| 35 inline HTMLHRElement::HTMLHRElement(Document& document) | 37 inline HTMLHRElement::HTMLHRElement(Document& document) |
| 36 : HTMLElement(hrTag, document) | 38 : HTMLElement(hrTag, document) |
| 37 { | 39 { |
| 38 } | 40 } |
| 39 | 41 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 int size = si->toInt(); | 85 int size = si->toInt(); |
| 84 if (size <= 1) | 86 if (size <= 1) |
| 85 addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderBott omWidth, 0, CSSPrimitiveValue::UnitType::Pixels); | 87 addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderBott omWidth, 0, CSSPrimitiveValue::UnitType::Pixels); |
| 86 else | 88 else |
| 87 addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, si ze - 2, CSSPrimitiveValue::UnitType::Pixels); | 89 addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, si ze - 2, CSSPrimitiveValue::UnitType::Pixels); |
| 88 } else { | 90 } else { |
| 89 HTMLElement::collectStyleForPresentationAttribute(name, value, style); | 91 HTMLElement::collectStyleForPresentationAttribute(name, value, style); |
| 90 } | 92 } |
| 91 } | 93 } |
| 92 | 94 |
| 95 HTMLSelectElement* HTMLHRElement::ownerSelectElement() const | |
| 96 { | |
| 97 if (!parentNode()) | |
| 98 return nullptr; | |
| 99 if (isHTMLSelectElement(*parentNode())) | |
| 100 return toHTMLSelectElement(parentNode()); | |
| 101 if (!isHTMLOptGroupElement(*parentNode())) | |
| 102 return nullptr; | |
| 103 Node* grandParent = parentNode()->parentNode(); | |
| 104 return isHTMLSelectElement(grandParent) ? toHTMLSelectElement(grandParent) : nullptr; | |
| 105 } | |
| 106 | |
| 107 Node::InsertionNotificationRequest HTMLHRElement::insertedInto(ContainerNode* in sertionPoint) | |
| 108 { | |
| 109 HTMLElement::insertedInto(insertionPoint); | |
| 110 if (HTMLSelectElement* select = ownerSelectElement()) { | |
| 111 if (insertionPoint == select || (isHTMLOptGroupElement(*insertionPoint) && insertionPoint->parentNode() == select)) | |
|
keishi
2016/06/29 08:46:40
Isn't existence of ownerSelectElement enough? do w
tkent
2016/06/29 08:58:04
Checking only existence of ownerSelectElement isn'
| |
| 112 select->hrInsertedOrRemoved(*this); | |
| 113 } | |
| 114 return InsertionDone; | |
| 115 } | |
| 116 | |
| 117 void HTMLHRElement::removedFrom(ContainerNode* insertionPoint) | |
| 118 { | |
| 119 if (isHTMLSelectElement(*insertionPoint)) { | |
| 120 if (!parentNode() || isHTMLOptGroupElement(*parentNode())) | |
| 121 toHTMLSelectElement(insertionPoint)->hrInsertedOrRemoved(*this); | |
| 122 } else if (isHTMLOptGroupElement(*insertionPoint)) { | |
| 123 Node* parent = insertionPoint->parentNode(); | |
| 124 if (isHTMLSelectElement(parent)) | |
| 125 toHTMLSelectElement(parent)->hrInsertedOrRemoved(*this); | |
| 126 } | |
| 127 HTMLElement::removedFrom(insertionPoint); | |
| 128 } | |
| 129 | |
| 93 } // namespace blink | 130 } // namespace blink |
| OLD | NEW |