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

Unified Diff: Source/core/html/HTMLTableElement.cpp

Issue 157383004: Use LocalStyleChange when changing TD presentation attributes. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLTableElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLTableElement.cpp
diff --git a/Source/core/html/HTMLTableElement.cpp b/Source/core/html/HTMLTableElement.cpp
index e1c901485d1c1a1b958ae9e4bae3e44f1f2a4438..80ff4554298534cb79a8a294c47f2c0e27c4aefe 100644
--- a/Source/core/html/HTMLTableElement.cpp
+++ b/Source/core/html/HTMLTableElement.cpp
@@ -34,6 +34,7 @@
#include "core/css/CSSValuePool.h"
#include "core/css/StylePropertySet.h"
#include "core/dom/Attribute.h"
+#include "core/dom/ElementTraversal.h"
#include "core/dom/ExceptionCode.h"
#include "core/html/HTMLTableCaptionElement.h"
#include "core/html/HTMLTableRowElement.h"
@@ -251,29 +252,24 @@ void HTMLTableElement::deleteRow(int index, ExceptionState& exceptionState)
row->remove(exceptionState);
}
-static inline bool isTableCellAncestor(Node* n)
+static inline bool isTableCellAncestor(Element* e)
{
- return n->hasTagName(theadTag) || n->hasTagName(tbodyTag) ||
- n->hasTagName(tfootTag) || n->hasTagName(trTag) ||
- n->hasTagName(thTag);
+ return e->hasTagName(theadTag) || e->hasTagName(tbodyTag) || e->hasTagName(tfootTag)
+ || 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
}
-static bool setTableCellsChanged(Node* n)
+void HTMLTableElement::setCellsNeedStyleRecalc() const
{
- ASSERT(n);
- bool cellChanged = false;
-
- if (n->hasTagName(tdTag))
- cellChanged = true;
- else if (isTableCellAncestor(n)) {
- for (Node* child = n->firstChild(); child; child = child->nextSibling())
- cellChanged |= setTableCellsChanged(child);
+ Element* element = ElementTraversal::next(*this, this);
+ while (element) {
+ 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.
+ element->setNeedsStyleRecalc(LocalStyleChange);
+ } else if (isTableCellAncestor(element)) {
+ element = ElementTraversal::next(*element, this);
+ continue;
+ }
+ element = ElementTraversal::nextSkippingChildren(*element, this);
}
-
- if (cellChanged)
- n->setNeedsStyleRecalc(SubtreeStyleChange);
-
- return cellChanged;
}
static bool getBordersFromFrameAttributeValue(const AtomicString& value, bool& borderTop, bool& borderRight, bool& borderBottom, bool& borderLeft)
@@ -407,11 +403,7 @@ void HTMLTableElement::parseAttribute(const QualifiedName& name, const AtomicStr
if (bordersBefore != cellBorders() || oldPadding != m_padding) {
m_sharedCellStyle = 0;
- bool cellChanged = false;
- for (Node* child = firstChild(); child; child = child->nextSibling())
- cellChanged |= setTableCellsChanged(child);
- if (cellChanged)
- setNeedsStyleRecalc(SubtreeStyleChange);
+ 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.
}
}
« no previous file with comments | « Source/core/html/HTMLTableElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698