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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLTableCellElement.h

Issue 2518163002: [css-tables] Fix divide-by-zero resulting from 32-bit overflow (Closed)
Patch Set: with layout test Created 4 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) 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 unsigned rowSpan() const; 43 unsigned rowSpan() const;
44 44
45 void setCellIndex(int); 45 void setCellIndex(int);
46 46
47 const AtomicString& abbr() const; 47 const AtomicString& abbr() const;
48 const AtomicString& axis() const; 48 const AtomicString& axis() const;
49 void setColSpan(unsigned); 49 void setColSpan(unsigned);
50 const AtomicString& headers() const; 50 const AtomicString& headers() const;
51 void setRowSpan(unsigned); 51 void setRowSpan(unsigned);
52 52
53 // Rowspan: match Firefox's limit of 65,534. Edge has a higher limit, at
54 // least 2^17.
55 // Colspan: Firefox uses a limit of 1,000 for colspan and resets the value to
56 // 1.
57 // TODO(dgrogan): Change this to HTML's new specified behavior when
58 // https://github.com/whatwg/html/issues/1198 is resolved.
59 // C++ note: apparently we can't use static const int for these because they
60 // are passed to std::min, which takes const T& and you can't take a reference
61 // of a static variable initialized in the class declaration.
62 // Public so that HTMLColElement can use maxColSpan. maxRowSpan is only used
63 // by this class but keeping them together seems desirable.
64 enum { kMaxColSpan = 8190, kMaxRowSpan = 65534 };
65
53 private: 66 private:
54 HTMLTableCellElement(const QualifiedName&, Document&); 67 HTMLTableCellElement(const QualifiedName&, Document&);
55 68
56 void parseAttribute(const QualifiedName&, 69 void parseAttribute(const QualifiedName&,
57 const AtomicString&, 70 const AtomicString&,
58 const AtomicString&) override; 71 const AtomicString&) override;
59 bool isPresentationAttribute(const QualifiedName&) const override; 72 bool isPresentationAttribute(const QualifiedName&) const override;
60 void collectStyleForPresentationAttribute(const QualifiedName&, 73 void collectStyleForPresentationAttribute(const QualifiedName&,
61 const AtomicString&, 74 const AtomicString&,
62 MutableStylePropertySet*) override; 75 MutableStylePropertySet*) override;
63 const StylePropertySet* additionalPresentationAttributeStyle() override; 76 const StylePropertySet* additionalPresentationAttributeStyle() override;
64 77
65 bool isURLAttribute(const Attribute&) const override; 78 bool isURLAttribute(const Attribute&) const override;
66 bool hasLegalLinkAttribute(const QualifiedName&) const override; 79 bool hasLegalLinkAttribute(const QualifiedName&) const override;
67 const QualifiedName& subResourceAttributeName() const override; 80 const QualifiedName& subResourceAttributeName() const override;
68 }; 81 };
69 82
70 inline bool isHTMLTableCellElement(const HTMLElement& element) { 83 inline bool isHTMLTableCellElement(const HTMLElement& element) {
71 return element.hasTagName(HTMLNames::tdTag) || 84 return element.hasTagName(HTMLNames::tdTag) ||
72 element.hasTagName(HTMLNames::thTag); 85 element.hasTagName(HTMLNames::thTag);
73 } 86 }
74 87
75 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLTableCellElement); 88 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLTableCellElement);
76 89
77 } // namespace blink 90 } // namespace blink
78 91
79 #endif // HTMLTableCellElement_h 92 #endif // HTMLTableCellElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698