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

Unified Diff: Source/core/dom/ContainerNode.h

Issue 395633007: Call ContainerNode::checkForSiblingStyleChanges() for Element insertion / removal only (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase and fix nit Created 6 years, 5 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 | « no previous file | Source/core/dom/ContainerNode.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ContainerNode.h
diff --git a/Source/core/dom/ContainerNode.h b/Source/core/dom/ContainerNode.h
index 2ee8c1921f52e46671849fc552adc1a1f31a094e..0cfb5e5722a5519aa9424a01db6a899b96d3a57c 100644
--- a/Source/core/dom/ContainerNode.h
+++ b/Source/core/dom/ContainerNode.h
@@ -145,7 +145,7 @@ public:
// FIXME: These methods should all be renamed to something better than "check",
// since it's not clear that they alter the style bits of siblings and children.
void checkForChildrenAdjacentRuleChanges();
- enum SiblingCheckType { FinishedParsingChildren, SiblingRemoved, Other };
+ enum SiblingCheckType { FinishedParsingChildren, SiblingElementInserted, SiblingElementRemoved };
void checkForSiblingStyleChanges(SiblingCheckType, Node* nodeBeforeChange, Node* nodeAfterChange);
bool childrenSupportStyleSharing() const { return !hasRestyleFlags(); }
@@ -153,11 +153,37 @@ public:
// -----------------------------------------------------------------------------
// Notification of document structure changes (see core/dom/Node.h for more notification methods)
- enum ChildrenChangeType { ChildInserted, ChildRemoved, AllChildrenRemoved, TextChanged };
+ enum ChildrenChangeType { ElementInserted, NonElementInserted, ElementRemoved, NonElementRemoved, AllChildrenRemoved, TextChanged };
enum ChildrenChangeSource { ChildrenChangeSourceAPI, ChildrenChangeSourceParser };
struct ChildrenChange {
STACK_ALLOCATED();
public:
+ static ChildrenChange forInsertion(Node& node, ChildrenChangeSource byParser)
+ {
+ ChildrenChange change = {
+ node.isElementNode() ? ElementInserted : NonElementInserted,
+ node.previousSibling(),
+ node.nextSibling(),
+ byParser
+ };
+ return change;
+ }
+
+ static ChildrenChange forRemoval(Node& node, Node* previousSibling, Node* nextSibling, ChildrenChangeSource byParser)
+ {
+ ChildrenChange change = {
+ node.isElementNode() ? ElementRemoved : NonElementRemoved,
+ previousSibling,
+ nextSibling,
+ byParser
+ };
+ return change;
+ }
+
+ bool isChildInsertion() const { return type == ElementInserted || type == NonElementInserted; }
+ bool isChildRemoval() const { return type == ElementRemoved || type == NonElementRemoved; }
+ bool isChildElementChange() const { return type == ElementInserted || type == ElementRemoved; }
+
ChildrenChangeType type;
RawPtrWillBeMember<Node> siblingBeforeChange;
RawPtrWillBeMember<Node> siblingAfterChange;
« no previous file with comments | « no previous file | Source/core/dom/ContainerNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698