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, 2008, 2010, 2011 Apple Inc. All rights reserved. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2010, 2011 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 16 matching lines...) Expand all Loading... | |
27 | 27 |
28 #include "CSSPropertyNames.h" | 28 #include "CSSPropertyNames.h" |
29 #include "CSSValueKeywords.h" | 29 #include "CSSValueKeywords.h" |
30 #include "HTMLNames.h" | 30 #include "HTMLNames.h" |
31 #include "bindings/v8/ExceptionState.h" | 31 #include "bindings/v8/ExceptionState.h" |
32 #include "bindings/v8/ExceptionStatePlaceholder.h" | 32 #include "bindings/v8/ExceptionStatePlaceholder.h" |
33 #include "core/css/CSSImageValue.h" | 33 #include "core/css/CSSImageValue.h" |
34 #include "core/css/CSSValuePool.h" | 34 #include "core/css/CSSValuePool.h" |
35 #include "core/css/StylePropertySet.h" | 35 #include "core/css/StylePropertySet.h" |
36 #include "core/dom/Attribute.h" | 36 #include "core/dom/Attribute.h" |
37 #include "core/dom/ElementTraversal.h" | |
37 #include "core/dom/ExceptionCode.h" | 38 #include "core/dom/ExceptionCode.h" |
38 #include "core/html/HTMLTableCaptionElement.h" | 39 #include "core/html/HTMLTableCaptionElement.h" |
39 #include "core/html/HTMLTableRowElement.h" | 40 #include "core/html/HTMLTableRowElement.h" |
40 #include "core/html/HTMLTableRowsCollection.h" | 41 #include "core/html/HTMLTableRowsCollection.h" |
41 #include "core/html/HTMLTableSectionElement.h" | 42 #include "core/html/HTMLTableSectionElement.h" |
42 #include "core/html/parser/HTMLParserIdioms.h" | 43 #include "core/html/parser/HTMLParserIdioms.h" |
43 #include "core/rendering/RenderTable.h" | 44 #include "core/rendering/RenderTable.h" |
44 #include "wtf/StdLibExtras.h" | 45 #include "wtf/StdLibExtras.h" |
45 | 46 |
46 namespace WebCore { | 47 namespace WebCore { |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 break; | 245 break; |
245 } | 246 } |
246 } | 247 } |
247 if (!row) { | 248 if (!row) { |
248 exceptionState.throwDOMException(IndexSizeError, "The index provided (" + String::number(index) + ") is greater than the number of rows in the table (" + String::number(i) + ")."); | 249 exceptionState.throwDOMException(IndexSizeError, "The index provided (" + String::number(index) + ") is greater than the number of rows in the table (" + String::number(i) + ")."); |
249 return; | 250 return; |
250 } | 251 } |
251 row->remove(exceptionState); | 252 row->remove(exceptionState); |
252 } | 253 } |
253 | 254 |
254 static inline bool isTableCellAncestor(Node* n) | 255 static inline bool isTableCellAncestor(Element* e) |
255 { | 256 { |
256 return n->hasTagName(theadTag) || n->hasTagName(tbodyTag) || | 257 return e->hasTagName(theadTag) || e->hasTagName(tbodyTag) || e->hasTagName(t footTag) |
257 n->hasTagName(tfootTag) || n->hasTagName(trTag) || | 258 || e->hasTagName(trTag) || e->hasTagName(thTag); |
mstensho (USE GERRIT)
2014/02/10 10:02:06
This looks wrong (both before and after the change
rune
2014/02/18 10:53:06
Yes, indeed. It was saved by enough SubtreeStyleCh
| |
258 n->hasTagName(thTag); | |
259 } | 259 } |
260 | 260 |
261 static bool setTableCellsChanged(Node* n) | 261 void HTMLTableElement::setCellsNeedStyleRecalc() const |
262 { | 262 { |
263 ASSERT(n); | 263 Element* element = ElementTraversal::next(*this, this); |
264 bool cellChanged = false; | 264 while (element) { |
265 | 265 if (element->hasTagName(tdTag)) { |
mstensho (USE GERRIT)
2014/02/10 10:02:06
Not that it was explicitly taken care of before yo
rune
2014/02/18 10:53:06
Done.
| |
266 if (n->hasTagName(tdTag)) | 266 element->setNeedsStyleRecalc(LocalStyleChange); |
267 cellChanged = true; | 267 } else if (isTableCellAncestor(element)) { |
268 else if (isTableCellAncestor(n)) { | 268 element = ElementTraversal::next(*element, this); |
269 for (Node* child = n->firstChild(); child; child = child->nextSibling()) | 269 continue; |
270 cellChanged |= setTableCellsChanged(child); | 270 } |
271 element = ElementTraversal::nextSkippingChildren(*element, this); | |
271 } | 272 } |
272 | |
273 if (cellChanged) | |
274 n->setNeedsStyleRecalc(SubtreeStyleChange); | |
275 | |
276 return cellChanged; | |
277 } | 273 } |
278 | 274 |
279 static bool getBordersFromFrameAttributeValue(const AtomicString& value, bool& b orderTop, bool& borderRight, bool& borderBottom, bool& borderLeft) | 275 static bool getBordersFromFrameAttributeValue(const AtomicString& value, bool& b orderTop, bool& borderRight, bool& borderBottom, bool& borderLeft) |
280 { | 276 { |
281 borderTop = false; | 277 borderTop = false; |
282 borderRight = false; | 278 borderRight = false; |
283 borderBottom = false; | 279 borderBottom = false; |
284 borderLeft = false; | 280 borderLeft = false; |
285 | 281 |
286 if (equalIgnoringCase(value, "above")) | 282 if (equalIgnoringCase(value, "above")) |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
400 m_padding = max(0, value.toInt()); | 396 m_padding = max(0, value.toInt()); |
401 else | 397 else |
402 m_padding = 1; | 398 m_padding = 1; |
403 } else if (name == colsAttr) { | 399 } else if (name == colsAttr) { |
404 // ### | 400 // ### |
405 } else | 401 } else |
406 HTMLElement::parseAttribute(name, value); | 402 HTMLElement::parseAttribute(name, value); |
407 | 403 |
408 if (bordersBefore != cellBorders() || oldPadding != m_padding) { | 404 if (bordersBefore != cellBorders() || oldPadding != m_padding) { |
409 m_sharedCellStyle = 0; | 405 m_sharedCellStyle = 0; |
410 bool cellChanged = false; | 406 setCellsNeedStyleRecalc(); |
mstensho (USE GERRIT)
2014/02/10 10:02:06
It looks like table columns, column groups and row
rune
2014/02/18 10:53:06
Done.
| |
411 for (Node* child = firstChild(); child; child = child->nextSibling()) | |
412 cellChanged |= setTableCellsChanged(child); | |
413 if (cellChanged) | |
414 setNeedsStyleRecalc(SubtreeStyleChange); | |
415 } | 407 } |
416 } | 408 } |
417 | 409 |
418 static PassRefPtr<StylePropertySet> createBorderStyle(CSSValueID value) | 410 static PassRefPtr<StylePropertySet> createBorderStyle(CSSValueID value) |
419 { | 411 { |
420 RefPtr<MutableStylePropertySet> style = MutableStylePropertySet::create(); | 412 RefPtr<MutableStylePropertySet> style = MutableStylePropertySet::create(); |
421 style->setProperty(CSSPropertyBorderTopStyle, value); | 413 style->setProperty(CSSPropertyBorderTopStyle, value); |
422 style->setProperty(CSSPropertyBorderBottomStyle, value); | 414 style->setProperty(CSSPropertyBorderBottomStyle, value); |
423 style->setProperty(CSSPropertyBorderLeftStyle, value); | 415 style->setProperty(CSSPropertyBorderLeftStyle, value); |
424 style->setProperty(CSSPropertyBorderRightStyle, value); | 416 style->setProperty(CSSPropertyBorderRightStyle, value); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
567 { | 559 { |
568 return getAttribute(rulesAttr); | 560 return getAttribute(rulesAttr); |
569 } | 561 } |
570 | 562 |
571 const AtomicString& HTMLTableElement::summary() const | 563 const AtomicString& HTMLTableElement::summary() const |
572 { | 564 { |
573 return getAttribute(summaryAttr); | 565 return getAttribute(summaryAttr); |
574 } | 566 } |
575 | 567 |
576 } | 568 } |
OLD | NEW |