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

Side by Side Diff: Source/core/html/HTMLTableColElement.cpp

Issue 802103006: Stricter parsing for span attribute on col element (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add a test Created 5 years, 11 months 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
« no previous file with comments | « LayoutTests/fast/dom/HTMLTableColElement/span-attribute-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 10 matching lines...) Expand all
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 "config.h" 25 #include "config.h"
26 #include "core/html/HTMLTableColElement.h" 26 #include "core/html/HTMLTableColElement.h"
27 27
28 #include "core/CSSPropertyNames.h" 28 #include "core/CSSPropertyNames.h"
29 #include "core/HTMLNames.h" 29 #include "core/HTMLNames.h"
30 #include "core/html/HTMLTableElement.h" 30 #include "core/html/HTMLTableElement.h"
31 #include "core/html/parser/HTMLParserIdioms.h"
31 #include "core/rendering/RenderTableCol.h" 32 #include "core/rendering/RenderTableCol.h"
32 33
33 namespace blink { 34 namespace blink {
34 35
35 using namespace HTMLNames; 36 using namespace HTMLNames;
36 37
37 inline HTMLTableColElement::HTMLTableColElement(const QualifiedName& tagName, Do cument& document) 38 inline HTMLTableColElement::HTMLTableColElement(const QualifiedName& tagName, Do cument& document)
38 : HTMLTablePartElement(tagName, document) 39 : HTMLTablePartElement(tagName, document)
39 , m_span(1) 40 , m_span(1)
40 { 41 {
(...skipping 12 matching lines...) Expand all
53 { 54 {
54 if (name == widthAttr) 55 if (name == widthAttr)
55 addHTMLLengthToStyle(style, CSSPropertyWidth, value); 56 addHTMLLengthToStyle(style, CSSPropertyWidth, value);
56 else 57 else
57 HTMLTablePartElement::collectStyleForPresentationAttribute(name, value, style); 58 HTMLTablePartElement::collectStyleForPresentationAttribute(name, value, style);
58 } 59 }
59 60
60 void HTMLTableColElement::parseAttribute(const QualifiedName& name, const Atomic String& value) 61 void HTMLTableColElement::parseAttribute(const QualifiedName& name, const Atomic String& value)
61 { 62 {
62 if (name == spanAttr) { 63 if (name == spanAttr) {
63 int newSpan = value.toInt(); 64 int newSpan = 0;
64 // If the value of span is not a valid non-negative integer greater than zero, 65 if (value.isEmpty() || !parseHTMLInteger(value, newSpan) || newSpan < 1) {
65 // set it to 1. 66 // If the value of span is not a valid non-negative integer greater than zero,
66 m_span = newSpan ? newSpan : 1; 67 // set it to 1.
68 newSpan = 1;
69 }
70 m_span = newSpan;
67 if (renderer() && renderer()->isRenderTableCol()) 71 if (renderer() && renderer()->isRenderTableCol())
68 renderer()->updateFromElement(); 72 renderer()->updateFromElement();
69 } else if (name == widthAttr) { 73 } else if (name == widthAttr) {
70 if (!value.isEmpty()) { 74 if (!value.isEmpty()) {
71 if (renderer() && renderer()->isRenderTableCol()) { 75 if (renderer() && renderer()->isRenderTableCol()) {
72 RenderTableCol* col = toRenderTableCol(renderer()); 76 RenderTableCol* col = toRenderTableCol(renderer());
73 int newWidth = width().toInt(); 77 int newWidth = width().toInt();
74 if (newWidth != col->size().width()) 78 if (newWidth != col->size().width())
75 col->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidati on(); 79 col->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidati on();
76 } 80 }
(...skipping 15 matching lines...) Expand all
92 { 96 {
93 setIntegralAttribute(spanAttr, n); 97 setIntegralAttribute(spanAttr, n);
94 } 98 }
95 99
96 const AtomicString& HTMLTableColElement::width() const 100 const AtomicString& HTMLTableColElement::width() const
97 { 101 {
98 return getAttribute(widthAttr); 102 return getAttribute(widthAttr);
99 } 103 }
100 104
101 } 105 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/HTMLTableColElement/span-attribute-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698