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 |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 #include "core/CSSPropertyNames.h" | 27 #include "core/CSSPropertyNames.h" |
28 #include "core/CSSValueKeywords.h" | 28 #include "core/CSSValueKeywords.h" |
29 #include "core/HTMLNames.h" | 29 #include "core/HTMLNames.h" |
30 #include "core/dom/Attribute.h" | 30 #include "core/dom/Attribute.h" |
31 #include "core/dom/ElementTraversal.h" | 31 #include "core/dom/ElementTraversal.h" |
32 #include "core/html/HTMLTableElement.h" | 32 #include "core/html/HTMLTableElement.h" |
33 #include "core/html/parser/HTMLParserIdioms.h" | 33 #include "core/html/parser/HTMLParserIdioms.h" |
34 #include "core/layout/LayoutTableCell.h" | 34 #include "core/layout/LayoutTableCell.h" |
35 | 35 |
36 using namespace std; | |
37 | |
38 namespace blink { | 36 namespace blink { |
39 | 37 |
40 using namespace HTMLNames; | 38 using namespace HTMLNames; |
41 | 39 |
42 inline HTMLTableCellElement::HTMLTableCellElement(const QualifiedName& tagName, | 40 inline HTMLTableCellElement::HTMLTableCellElement(const QualifiedName& tagName, |
43 Document& document) | 41 Document& document) |
44 : HTMLTablePartElement(tagName, document) {} | 42 : HTMLTablePartElement(tagName, document) {} |
45 | 43 |
46 DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(HTMLTableCellElement) | 44 DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(HTMLTableCellElement) |
47 | 45 |
48 unsigned HTMLTableCellElement::colSpan() const { | 46 unsigned HTMLTableCellElement::colSpan() const { |
49 const AtomicString& colSpanValue = fastGetAttribute(colspanAttr); | 47 const AtomicString& colSpanValue = fastGetAttribute(colspanAttr); |
50 unsigned value = 0; | 48 unsigned value = 0; |
51 if (colSpanValue.isEmpty() || | 49 if (colSpanValue.isEmpty() || |
52 !parseHTMLNonNegativeInteger(colSpanValue, value)) | 50 !parseHTMLNonNegativeInteger(colSpanValue, value)) |
53 return 1; | 51 return 1; |
54 // Counting for https://github.com/whatwg/html/issues/1198 | 52 // Counting for https://github.com/whatwg/html/issues/1198 |
55 UseCounter::count(document(), UseCounter::HTMLTableCellElementColspan); | 53 UseCounter::count(document(), UseCounter::HTMLTableCellElementColspan); |
56 if (value > 8190) { | 54 if (value > 8190) { |
57 UseCounter::count(document(), | 55 UseCounter::count(document(), |
58 UseCounter::HTMLTableCellElementColspanGreaterThan8190); | 56 UseCounter::HTMLTableCellElementColspanGreaterThan8190); |
59 } else if (value > 1000) { | 57 } else if (value > 1000) { |
60 UseCounter::count(document(), | 58 UseCounter::count(document(), |
61 UseCounter::HTMLTableCellElementColspanGreaterThan1000); | 59 UseCounter::HTMLTableCellElementColspanGreaterThan1000); |
62 } | 60 } |
63 return max(1u, min(value, maxColSpan())); | 61 return std::max(1u, std::min(value, maxColSpan())); |
64 } | 62 } |
65 | 63 |
66 unsigned HTMLTableCellElement::rowSpan() const { | 64 unsigned HTMLTableCellElement::rowSpan() const { |
67 const AtomicString& rowSpanValue = fastGetAttribute(rowspanAttr); | 65 const AtomicString& rowSpanValue = fastGetAttribute(rowspanAttr); |
68 unsigned value = 0; | 66 unsigned value = 0; |
69 if (rowSpanValue.isEmpty() || | 67 if (rowSpanValue.isEmpty() || |
70 !parseHTMLNonNegativeInteger(rowSpanValue, value)) | 68 !parseHTMLNonNegativeInteger(rowSpanValue, value)) |
71 return 1; | 69 return 1; |
72 return max(1u, min(value, maxRowSpan())); | 70 return std::max(1u, std::min(value, maxRowSpan())); |
73 } | 71 } |
74 | 72 |
75 int HTMLTableCellElement::cellIndex() const { | 73 int HTMLTableCellElement::cellIndex() const { |
76 if (!isHTMLTableRowElement(parentElement())) | 74 if (!isHTMLTableRowElement(parentElement())) |
77 return -1; | 75 return -1; |
78 | 76 |
79 int index = 0; | 77 int index = 0; |
80 for (const HTMLTableCellElement* element = | 78 for (const HTMLTableCellElement* element = |
81 Traversal<HTMLTableCellElement>::previousSibling(*this); | 79 Traversal<HTMLTableCellElement>::previousSibling(*this); |
82 element; | 80 element; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 163 |
166 const AtomicString& HTMLTableCellElement::headers() const { | 164 const AtomicString& HTMLTableCellElement::headers() const { |
167 return fastGetAttribute(headersAttr); | 165 return fastGetAttribute(headersAttr); |
168 } | 166 } |
169 | 167 |
170 void HTMLTableCellElement::setRowSpan(unsigned n) { | 168 void HTMLTableCellElement::setRowSpan(unsigned n) { |
171 setUnsignedIntegralAttribute(rowspanAttr, n); | 169 setUnsignedIntegralAttribute(rowspanAttr, n); |
172 } | 170 } |
173 | 171 |
174 } // namespace blink | 172 } // namespace blink |
OLD | NEW |