Chromium Code Reviews| 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 void HTMLTableElement::setNeedsTableStyleRecalc() const |
| 255 { | 256 { |
| 256 return n->hasTagName(theadTag) || n->hasTagName(tbodyTag) || | 257 Element* element = ElementTraversal::next(*this, this); |
| 257 n->hasTagName(tfootTag) || n->hasTagName(trTag) || | 258 while (element) { |
| 258 n->hasTagName(thTag); | 259 element->setNeedsStyleRecalc(LocalStyleChange); |
| 259 } | 260 if (element->hasTagName(tdTag) || element->hasTagName(thTag)) |
| 260 | 261 element = ElementTraversal::nextSkippingChildren(*element, this); |
| 261 static bool setTableCellsChanged(Node* n) | 262 else |
| 262 { | 263 element = ElementTraversal::next(*element, this); |
|
mstensho (USE GERRIT)
2014/02/18 13:48:46
I wonder what happens here if a TR has a DIV table
| |
| 263 ASSERT(n); | |
| 264 bool cellChanged = false; | |
| 265 | |
| 266 if (n->hasTagName(tdTag)) | |
| 267 cellChanged = true; | |
| 268 else if (isTableCellAncestor(n)) { | |
| 269 for (Node* child = n->firstChild(); child; child = child->nextSibling()) | |
| 270 cellChanged |= setTableCellsChanged(child); | |
| 271 } | 264 } |
| 272 | |
| 273 if (cellChanged) | |
| 274 n->setNeedsStyleRecalc(SubtreeStyleChange); | |
| 275 | |
| 276 return cellChanged; | |
| 277 } | 265 } |
| 278 | 266 |
| 279 static bool getBordersFromFrameAttributeValue(const AtomicString& value, bool& b orderTop, bool& borderRight, bool& borderBottom, bool& borderLeft) | 267 static bool getBordersFromFrameAttributeValue(const AtomicString& value, bool& b orderTop, bool& borderRight, bool& borderBottom, bool& borderLeft) |
| 280 { | 268 { |
| 281 borderTop = false; | 269 borderTop = false; |
| 282 borderRight = false; | 270 borderRight = false; |
| 283 borderBottom = false; | 271 borderBottom = false; |
| 284 borderLeft = false; | 272 borderLeft = false; |
| 285 | 273 |
| 286 if (equalIgnoringCase(value, "above")) | 274 if (equalIgnoringCase(value, "above")) |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 m_padding = max(0, value.toInt()); | 388 m_padding = max(0, value.toInt()); |
| 401 else | 389 else |
| 402 m_padding = 1; | 390 m_padding = 1; |
| 403 } else if (name == colsAttr) { | 391 } else if (name == colsAttr) { |
| 404 // ### | 392 // ### |
| 405 } else | 393 } else |
| 406 HTMLElement::parseAttribute(name, value); | 394 HTMLElement::parseAttribute(name, value); |
| 407 | 395 |
| 408 if (bordersBefore != cellBorders() || oldPadding != m_padding) { | 396 if (bordersBefore != cellBorders() || oldPadding != m_padding) { |
| 409 m_sharedCellStyle = 0; | 397 m_sharedCellStyle = 0; |
| 410 bool cellChanged = false; | 398 setNeedsTableStyleRecalc(); |
| 411 for (Node* child = firstChild(); child; child = child->nextSibling()) | |
| 412 cellChanged |= setTableCellsChanged(child); | |
| 413 if (cellChanged) | |
| 414 setNeedsStyleRecalc(SubtreeStyleChange); | |
| 415 } | 399 } |
| 416 } | 400 } |
| 417 | 401 |
| 418 static PassRefPtr<StylePropertySet> createBorderStyle(CSSValueID value) | 402 static PassRefPtr<StylePropertySet> createBorderStyle(CSSValueID value) |
| 419 { | 403 { |
| 420 RefPtr<MutableStylePropertySet> style = MutableStylePropertySet::create(); | 404 RefPtr<MutableStylePropertySet> style = MutableStylePropertySet::create(); |
| 421 style->setProperty(CSSPropertyBorderTopStyle, value); | 405 style->setProperty(CSSPropertyBorderTopStyle, value); |
| 422 style->setProperty(CSSPropertyBorderBottomStyle, value); | 406 style->setProperty(CSSPropertyBorderBottomStyle, value); |
| 423 style->setProperty(CSSPropertyBorderLeftStyle, value); | 407 style->setProperty(CSSPropertyBorderLeftStyle, value); |
| 424 style->setProperty(CSSPropertyBorderRightStyle, value); | 408 style->setProperty(CSSPropertyBorderRightStyle, value); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 567 { | 551 { |
| 568 return getAttribute(rulesAttr); | 552 return getAttribute(rulesAttr); |
| 569 } | 553 } |
| 570 | 554 |
| 571 const AtomicString& HTMLTableElement::summary() const | 555 const AtomicString& HTMLTableElement::summary() const |
| 572 { | 556 { |
| 573 return getAttribute(summaryAttr); | 557 return getAttribute(summaryAttr); |
| 574 } | 558 } |
| 575 | 559 |
| 576 } | 560 } |
| OLD | NEW |