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

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: Fixed review issues and added test. 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..0dd79b1cd97652b97763899abcc78ce8554b2f1f 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,16 @@ void HTMLTableElement::deleteRow(int index, ExceptionState& exceptionState)
row->remove(exceptionState);
}
-static inline bool isTableCellAncestor(Node* n)
+void HTMLTableElement::setNeedsTableStyleRecalc() const
{
- return n->hasTagName(theadTag) || n->hasTagName(tbodyTag) ||
- n->hasTagName(tfootTag) || n->hasTagName(trTag) ||
- n->hasTagName(thTag);
-}
-
-static bool setTableCellsChanged(Node* n)
-{
- 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) {
+ element->setNeedsStyleRecalc(LocalStyleChange);
+ if (element->hasTagName(tdTag) || element->hasTagName(thTag))
+ element = ElementTraversal::nextSkippingChildren(*element, this);
+ else
+ 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
}
-
- if (cellChanged)
- n->setNeedsStyleRecalc(SubtreeStyleChange);
-
- return cellChanged;
}
static bool getBordersFromFrameAttributeValue(const AtomicString& value, bool& borderTop, bool& borderRight, bool& borderBottom, bool& borderLeft)
@@ -407,11 +395,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);
+ setNeedsTableStyleRecalc();
}
}
« 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