OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) | 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) |
3 * (C) 1997 Torben Weis (weis@kde.org) | 3 * (C) 1997 Torben Weis (weis@kde.org) |
4 * (C) 1998 Waldo Bastian (bastian@kde.org) | 4 * (C) 1998 Waldo Bastian (bastian@kde.org) |
5 * (C) 1999 Lars Knoll (knoll@kde.org) | 5 * (C) 1999 Lars Knoll (knoll@kde.org) |
6 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 6 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
7 * Copyright (C) 2003, 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
11 * License as published by the Free Software Foundation; either | 11 * License as published by the Free Software Foundation; either |
12 * version 2 of the License, or (at your option) any later version. | 12 * version 2 of the License, or (at your option) any later version. |
13 * | 13 * |
14 * This library is distributed in the hope that it will be useful, | 14 * This library is distributed in the hope that it will be useful, |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 * Library General Public License for more details. | 17 * Library General Public License for more details. |
18 * | 18 * |
19 * You should have received a copy of the GNU Library General Public License | 19 * You should have received a copy of the GNU Library General Public License |
20 * along with this library; see the file COPYING.LIB. If not, write to | 20 * along with this library; see the file COPYING.LIB. If not, write to |
21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
22 * Boston, MA 02110-1301, USA. | 22 * Boston, MA 02110-1301, USA. |
23 */ | 23 */ |
24 | 24 |
25 #include "core/html/HTMLTableColElement.h" | 25 #include "core/html/HTMLTableColElement.h" |
26 | 26 |
27 #include "core/CSSPropertyNames.h" | 27 #include "core/CSSPropertyNames.h" |
28 #include "core/HTMLNames.h" | 28 #include "core/HTMLNames.h" |
29 #include "core/html/HTMLTableCellElement.h" | |
29 #include "core/html/HTMLTableElement.h" | 30 #include "core/html/HTMLTableElement.h" |
30 #include "core/html/parser/HTMLParserIdioms.h" | 31 #include "core/html/parser/HTMLParserIdioms.h" |
31 #include "core/layout/LayoutTableCol.h" | 32 #include "core/layout/LayoutTableCol.h" |
33 #include <algorithm> | |
32 | 34 |
33 namespace blink { | 35 namespace blink { |
34 | 36 |
35 using namespace HTMLNames; | 37 using namespace HTMLNames; |
36 | 38 |
37 inline HTMLTableColElement::HTMLTableColElement(const QualifiedName& tagName, | 39 inline HTMLTableColElement::HTMLTableColElement(const QualifiedName& tagName, |
38 Document& document) | 40 Document& document) |
39 : HTMLTablePartElement(tagName, document), m_span(1) {} | 41 : HTMLTablePartElement(tagName, document), m_span(1) {} |
40 | 42 |
41 DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(HTMLTableColElement) | 43 DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(HTMLTableColElement) |
(...skipping 20 matching lines...) Expand all Loading... | |
62 const AtomicString& oldValue, | 64 const AtomicString& oldValue, |
63 const AtomicString& value) { | 65 const AtomicString& value) { |
64 if (name == spanAttr) { | 66 if (name == spanAttr) { |
65 unsigned newSpan = 0; | 67 unsigned newSpan = 0; |
66 if (value.isEmpty() || !parseHTMLNonNegativeInteger(value, newSpan) || | 68 if (value.isEmpty() || !parseHTMLNonNegativeInteger(value, newSpan) || |
67 newSpan < 1) { | 69 newSpan < 1) { |
68 // If the value of span is not a valid non-negative integer greater than | 70 // If the value of span is not a valid non-negative integer greater than |
69 // zero, set it to 1. | 71 // zero, set it to 1. |
70 newSpan = 1; | 72 newSpan = 1; |
71 } | 73 } |
74 newSpan = std::min( | |
dgrogan
2016/11/22 00:35:31
The real behavior change.
| |
75 newSpan, static_cast<unsigned>(HTMLTableCellElement::kMaxColSpan)); | |
72 m_span = newSpan; | 76 m_span = newSpan; |
73 if (layoutObject() && layoutObject()->isLayoutTableCol()) | 77 if (layoutObject() && layoutObject()->isLayoutTableCol()) |
74 layoutObject()->updateFromElement(); | 78 layoutObject()->updateFromElement(); |
75 } else if (name == widthAttr) { | 79 } else if (name == widthAttr) { |
76 if (!value.isEmpty()) { | 80 if (!value.isEmpty()) { |
77 if (layoutObject() && layoutObject()->isLayoutTableCol()) { | 81 if (layoutObject() && layoutObject()->isLayoutTableCol()) { |
78 LayoutTableCol* col = toLayoutTableCol(layoutObject()); | 82 LayoutTableCol* col = toLayoutTableCol(layoutObject()); |
79 int newWidth = width().toInt(); | 83 int newWidth = width().toInt(); |
80 if (newWidth != col->size().width()) | 84 if (newWidth != col->size().width()) |
81 col->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation( | 85 col->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation( |
(...skipping 16 matching lines...) Expand all Loading... | |
98 | 102 |
99 void HTMLTableColElement::setSpan(unsigned n) { | 103 void HTMLTableColElement::setSpan(unsigned n) { |
100 setUnsignedIntegralAttribute(spanAttr, n ? n : 1); | 104 setUnsignedIntegralAttribute(spanAttr, n ? n : 1); |
101 } | 105 } |
102 | 106 |
103 const AtomicString& HTMLTableColElement::width() const { | 107 const AtomicString& HTMLTableColElement::width() const { |
104 return getAttribute(widthAttr); | 108 return getAttribute(widthAttr); |
105 } | 109 } |
106 | 110 |
107 } // namespace blink | 111 } // namespace blink |
OLD | NEW |