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

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

Issue 2623513005: Introduce Element::AttributeModificationParams (Closed)
Patch Set: Created 3 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
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 const QualifiedName& name, 53 const QualifiedName& name,
54 const AtomicString& value, 54 const AtomicString& value,
55 MutableStylePropertySet* style) { 55 MutableStylePropertySet* style) {
56 if (name == widthAttr) 56 if (name == widthAttr)
57 addHTMLLengthToStyle(style, CSSPropertyWidth, value); 57 addHTMLLengthToStyle(style, CSSPropertyWidth, value);
58 else 58 else
59 HTMLTablePartElement::collectStyleForPresentationAttribute(name, value, 59 HTMLTablePartElement::collectStyleForPresentationAttribute(name, value,
60 style); 60 style);
61 } 61 }
62 62
63 void HTMLTableColElement::parseAttribute(const QualifiedName& name, 63 void HTMLTableColElement::parseAttribute(
64 const AtomicString& oldValue, 64 const AttributeModificationParams& params) {
65 const AtomicString& value) { 65 if (params.name == spanAttr) {
66 if (name == spanAttr) {
67 unsigned newSpan = 0; 66 unsigned newSpan = 0;
68 if (value.isEmpty() || !parseHTMLNonNegativeInteger(value, newSpan) || 67 if (params.newValue.isEmpty() ||
69 newSpan < 1) { 68 !parseHTMLNonNegativeInteger(params.newValue, newSpan) || newSpan < 1) {
70 // If the value of span is not a valid non-negative integer greater than 69 // If the value of span is not a valid non-negative integer greater than
71 // zero, set it to 1. 70 // zero, set it to 1.
72 newSpan = 1; 71 newSpan = 1;
73 } 72 }
74 newSpan = std::min(newSpan, HTMLTableCellElement::maxColSpan()); 73 newSpan = std::min(newSpan, HTMLTableCellElement::maxColSpan());
75 m_span = newSpan; 74 m_span = newSpan;
76 if (layoutObject() && layoutObject()->isLayoutTableCol()) 75 if (layoutObject() && layoutObject()->isLayoutTableCol())
77 layoutObject()->updateFromElement(); 76 layoutObject()->updateFromElement();
78 } else if (name == widthAttr) { 77 } else if (params.name == widthAttr) {
79 if (!value.isEmpty()) { 78 if (!params.newValue.isEmpty()) {
80 if (layoutObject() && layoutObject()->isLayoutTableCol()) { 79 if (layoutObject() && layoutObject()->isLayoutTableCol()) {
81 LayoutTableCol* col = toLayoutTableCol(layoutObject()); 80 LayoutTableCol* col = toLayoutTableCol(layoutObject());
82 int newWidth = width().toInt(); 81 int newWidth = width().toInt();
83 if (newWidth != col->size().width()) 82 if (newWidth != col->size().width())
84 col->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation( 83 col->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(
85 LayoutInvalidationReason::AttributeChanged); 84 LayoutInvalidationReason::AttributeChanged);
86 } 85 }
87 } 86 }
88 } else { 87 } else {
89 HTMLTablePartElement::parseAttribute(name, oldValue, value); 88 HTMLTablePartElement::parseAttribute(params);
90 } 89 }
91 } 90 }
92 91
93 const StylePropertySet* 92 const StylePropertySet*
94 HTMLTableColElement::additionalPresentationAttributeStyle() { 93 HTMLTableColElement::additionalPresentationAttributeStyle() {
95 if (!hasTagName(colgroupTag)) 94 if (!hasTagName(colgroupTag))
96 return nullptr; 95 return nullptr;
97 if (HTMLTableElement* table = findParentTable()) 96 if (HTMLTableElement* table = findParentTable())
98 return table->additionalGroupStyle(false); 97 return table->additionalGroupStyle(false);
99 return nullptr; 98 return nullptr;
100 } 99 }
101 100
102 void HTMLTableColElement::setSpan(unsigned n) { 101 void HTMLTableColElement::setSpan(unsigned n) {
103 setUnsignedIntegralAttribute(spanAttr, n ? n : 1); 102 setUnsignedIntegralAttribute(spanAttr, n ? n : 1);
104 } 103 }
105 104
106 const AtomicString& HTMLTableColElement::width() const { 105 const AtomicString& HTMLTableColElement::width() const {
107 return getAttribute(widthAttr); 106 return getAttribute(widthAttr);
108 } 107 }
109 108
110 } // namespace blink 109 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLTableColElement.h ('k') | third_party/WebKit/Source/core/html/HTMLTableElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698