<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[196473] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/196473">196473</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-02-12 07:49:24 -0800 (Fri, 12 Feb 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/196470">r196470</a>.
https://bugs.webkit.org/show_bug.cgi?id=154167

Broke some tests (Requested by anttik on #webkit).

Reverted changeset:

&quot;Factor class change style invalidation code into a class&quot;
https://bugs.webkit.org/show_bug.cgi?id=154163
http://trac.webkit.org/changeset/196470</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxproj">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoredomElementcpp">trunk/Source/WebCore/dom/Element.cpp</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorestyleClassChangeInvalidationcpp">trunk/Source/WebCore/style/ClassChangeInvalidation.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleClassChangeInvalidationh">trunk/Source/WebCore/style/ClassChangeInvalidation.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (196472 => 196473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2016-02-12 15:37:33 UTC (rev 196472)
+++ trunk/Source/WebCore/CMakeLists.txt        2016-02-12 15:49:24 UTC (rev 196473)
</span><span class="lines">@@ -2621,7 +2621,6 @@
</span><span class="cx">     storage/StorageMap.cpp
</span><span class="cx">     storage/StorageNamespaceProvider.cpp
</span><span class="cx"> 
</span><del>-    style/ClassChangeInvalidation.cpp
</del><span class="cx">     style/InlineTextBoxStyle.cpp
</span><span class="cx">     style/RenderTreePosition.cpp
</span><span class="cx">     style/StyleChange.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (196472 => 196473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-02-12 15:37:33 UTC (rev 196472)
+++ trunk/Source/WebCore/ChangeLog        2016-02-12 15:49:24 UTC (rev 196473)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-02-12  Commit Queue  &lt;commit-queue@webkit.org&gt;
+
+        Unreviewed, rolling out r196470.
+        https://bugs.webkit.org/show_bug.cgi?id=154167
+
+        Broke some tests (Requested by anttik on #webkit).
+
+        Reverted changeset:
+
+        &quot;Factor class change style invalidation code into a class&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=154163
+        http://trac.webkit.org/changeset/196470
+
</ins><span class="cx"> 2016-02-12  Antti Koivisto  &lt;antti@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Factor class change style invalidation code into a class
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (196472 => 196473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2016-02-12 15:37:33 UTC (rev 196472)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2016-02-12 15:49:24 UTC (rev 196473)
</span><span class="lines">@@ -19225,7 +19225,6 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;..\storage\StorageEventDispatcher.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\storage\StorageMap.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\storage\StorageNamespaceProvider.cpp&quot; /&gt;
</span><del>-    &lt;ClCompile Include=&quot;..\style\ClassChangeInvalidation.cpp&quot; /&gt;
</del><span class="cx">     &lt;ClCompile Include=&quot;..\style\InlineTextBoxStyle.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\style\RenderTreePosition.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\style\StyleChange.cpp&quot; /&gt;
</span><span class="lines">@@ -22792,7 +22791,6 @@
</span><span class="cx">     &lt;ClInclude Include=&quot;..\storage\StorageMap.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\storage\StorageNamespace.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\storage\StorageNamespaceProvider.h&quot; /&gt;
</span><del>-    &lt;ClInclude Include=&quot;..\style\ClassChangeInvalidation.h&quot; /&gt;
</del><span class="cx">     &lt;ClInclude Include=&quot;..\style\InlineTextBoxStyle.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\style\RenderTreePosition.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\style\StyleChange.h&quot; /&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (196472 => 196473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-02-12 15:37:33 UTC (rev 196472)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-02-12 15:49:24 UTC (rev 196473)
</span><span class="lines">@@ -6617,8 +6617,6 @@
</span><span class="cx">                 E49BDA0B131FD3E5003C56F0 /* CSSValuePool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E49BDA0A131FD3E5003C56F0 /* CSSValuePool.cpp */; };
</span><span class="cx">                 E4A007831B820EC8002C5A6E /* DataURLDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A007821B820EC8002C5A6E /* DataURLDecoder.h */; };
</span><span class="cx">                 E4A007851B820ED3002C5A6E /* DataURLDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4A007841B820ED3002C5A6E /* DataURLDecoder.cpp */; };
</span><del>-                E4A814D41C6DEC4000BF85AC /* ClassChangeInvalidation.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A814D31C6DEC4000BF85AC /* ClassChangeInvalidation.h */; };
-                E4A814D61C6DEE8D00BF85AC /* ClassChangeInvalidation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4A814D51C6DEE8D00BF85AC /* ClassChangeInvalidation.cpp */; };
</del><span class="cx">                 E4AE7C1617D1BB950009FB31 /* ElementIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AE7C1517D1BB950009FB31 /* ElementIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 E4AE7C1A17D232350009FB31 /* ElementAncestorIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AE7C1917D232350009FB31 /* ElementAncestorIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 E4AFCFA50DAF29A300F5F55C /* UnitBezier.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AFCFA40DAF29A300F5F55C /* UnitBezier.h */; };
</span><span class="lines">@@ -14603,8 +14601,6 @@
</span><span class="cx">                 E49BDA0A131FD3E5003C56F0 /* CSSValuePool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSValuePool.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E4A007821B820EC8002C5A6E /* DataURLDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataURLDecoder.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E4A007841B820ED3002C5A6E /* DataURLDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DataURLDecoder.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                E4A814D31C6DEC4000BF85AC /* ClassChangeInvalidation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClassChangeInvalidation.h; sourceTree = &quot;&lt;group&gt;&quot;; };
-                E4A814D51C6DEE8D00BF85AC /* ClassChangeInvalidation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ClassChangeInvalidation.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 E4AE7C1517D1BB950009FB31 /* ElementIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementIterator.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E4AE7C1917D232350009FB31 /* ElementAncestorIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementAncestorIterator.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E4AFCFA40DAF29A300F5F55C /* UnitBezier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnitBezier.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -23381,8 +23377,6 @@
</span><span class="cx">                 E4763D4A17B2704900D35206 /* style */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><del>-                                E4A814D51C6DEE8D00BF85AC /* ClassChangeInvalidation.cpp */,
-                                E4A814D31C6DEC4000BF85AC /* ClassChangeInvalidation.h */,
</del><span class="cx">                                 1C0106FE192594DF008A4201 /* InlineTextBoxStyle.cpp */,
</span><span class="cx">                                 1C0106FF192594DF008A4201 /* InlineTextBoxStyle.h */,
</span><span class="cx">                                 5824ABA81AE849C8009074B7 /* RenderTreePosition.cpp */,
</span><span class="lines">@@ -25934,7 +25928,6 @@
</span><span class="cx">                                 B2C3DA6C0D006CD600EF6F26 /* GlyphBuffer.h in Headers */,
</span><span class="cx">                                 C5D4AA7A116BAFB60069CA93 /* GlyphMetricsMap.h in Headers */,
</span><span class="cx">                                 0873B86B136064EA00A522C2 /* GlyphPage.h in Headers */,
</span><del>-                                E4A814D41C6DEC4000BF85AC /* ClassChangeInvalidation.h in Headers */,
</del><span class="cx">                                 BC53C5F50DA56B920021EB5D /* Gradient.h in Headers */,
</span><span class="cx">                                 B22279640D00BF220071B782 /* GradientAttributes.h in Headers */,
</span><span class="cx">                                 2D481F04146B5C6B00AA7834 /* GradientImage.h in Headers */,
</span><span class="lines">@@ -30209,7 +30202,6 @@
</span><span class="cx">                                 511EF2C717F0FD3500E4FA16 /* JSIDBObjectStore.cpp in Sources */,
</span><span class="cx">                                 511EF2D117F0FDF100E4FA16 /* JSIDBObjectStoreCustom.cpp in Sources */,
</span><span class="cx">                                 511EF2C817F0FD3500E4FA16 /* JSIDBOpenDBRequest.cpp in Sources */,
</span><del>-                                E4A814D61C6DEE8D00BF85AC /* ClassChangeInvalidation.cpp in Sources */,
</del><span class="cx">                                 511EF2C917F0FD3500E4FA16 /* JSIDBRequest.cpp in Sources */,
</span><span class="cx">                                 511EF2CA17F0FD3500E4FA16 /* JSIDBTransaction.cpp in Sources */,
</span><span class="cx">                                 511EF2CB17F0FD3500E4FA16 /* JSIDBVersionChangeEvent.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.cpp (196472 => 196473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.cpp        2016-02-12 15:37:33 UTC (rev 196472)
+++ trunk/Source/WebCore/dom/Element.cpp        2016-02-12 15:49:24 UTC (rev 196473)
</span><span class="lines">@@ -31,7 +31,6 @@
</span><span class="cx"> #include &quot;CSSParser.h&quot;
</span><span class="cx"> #include &quot;Chrome.h&quot;
</span><span class="cx"> #include &quot;ChromeClient.h&quot;
</span><del>-#include &quot;ClassChangeInvalidation.h&quot;
</del><span class="cx"> #include &quot;ClientRect.h&quot;
</span><span class="cx"> #include &quot;ClientRectList.h&quot;
</span><span class="cx"> #include &quot;ComposedTreeAncestorIterator.h&quot;
</span><span class="lines">@@ -77,6 +76,7 @@
</span><span class="cx"> #include &quot;ScrollLatchingState.h&quot;
</span><span class="cx"> #include &quot;SelectorQuery.h&quot;
</span><span class="cx"> #include &quot;Settings.h&quot;
</span><ins>+#include &quot;StyleInvalidationAnalysis.h&quot;
</ins><span class="cx"> #include &quot;StyleProperties.h&quot;
</span><span class="cx"> #include &quot;StyleResolver.h&quot;
</span><span class="cx"> #include &quot;StyleTreeResolver.h&quot;
</span><span class="lines">@@ -1299,6 +1299,91 @@
</span><span class="cx">     return classStringHasClassName(newClassString.characters16(), length);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static Vector&lt;AtomicStringImpl*, 4&gt; collectClasses(const SpaceSplitString&amp; classes)
+{
+    Vector&lt;AtomicStringImpl*, 4&gt; result;
+    result.reserveCapacity(classes.size());
+    for (unsigned i = 0; i &lt; classes.size(); ++i)
+        result.uncheckedAppend(classes[i].impl());
+    return result;
+}
+
+struct ClassChange {
+    Vector&lt;AtomicStringImpl*, 4&gt; added;
+    Vector&lt;AtomicStringImpl*, 4&gt; removed;
+};
+
+static ClassChange computeClassChange(const SpaceSplitString&amp; oldClasses, const SpaceSplitString&amp; newClasses)
+{
+    ClassChange classChange;
+
+    unsigned oldSize = oldClasses.size();
+    unsigned newSize = newClasses.size();
+
+    if (!oldSize) {
+        classChange.added = collectClasses(newClasses);
+        return classChange;
+    }
+    if (!newSize) {
+        classChange.removed = collectClasses(oldClasses);
+        return classChange;
+    }
+
+    BitVector remainingClassBits;
+    remainingClassBits.ensureSize(oldSize);
+    // Class vectors tend to be very short. This is faster than using a hash table.
+    for (unsigned i = 0; i &lt; newSize; ++i) {
+        bool foundFromBoth = false;
+        for (unsigned j = 0; j &lt; oldSize; ++j) {
+            if (newClasses[i] == oldClasses[j]) {
+                remainingClassBits.quickSet(j);
+                foundFromBoth = true;
+            }
+        }
+        if (foundFromBoth)
+            continue;
+        classChange.added.append(newClasses[i].impl());
+    }
+    for (unsigned i = 0; i &lt; oldSize; ++i) {
+        // If the bit is not set the the corresponding class has been removed.
+        if (remainingClassBits.quickGet(i))
+            continue;
+        classChange.removed.append(oldClasses[i].impl());
+    }
+
+    return classChange;
+}
+
+static void invalidateStyleForClassChange(Element&amp; element, const Vector&lt;AtomicStringImpl*, 4&gt;&amp; changedClasses, const DocumentRuleSets&amp; ruleSets)
+{
+    Vector&lt;AtomicStringImpl*, 4&gt; changedClassesAffectingStyle;
+    for (auto* changedClass : changedClasses) {
+        if (ruleSets.features().classesInRules.contains(changedClass))
+            changedClassesAffectingStyle.append(changedClass);
+    };
+
+    if (changedClassesAffectingStyle.isEmpty())
+        return;
+
+    if (element.shadowRoot() &amp;&amp; ruleSets.authorStyle()-&gt;hasShadowPseudoElementRules()) {
+        element.setNeedsStyleRecalc(FullStyleChange);
+        return;
+    }
+
+    element.setNeedsStyleRecalc(InlineStyleChange);
+
+    if (!element.firstElementChild())
+        return;
+
+    for (auto* changedClass : changedClassesAffectingStyle) {
+        auto* ancestorClassRules = ruleSets.ancestorClassRules(changedClass);
+        if (!ancestorClassRules)
+            continue;
+        StyleInvalidationAnalysis invalidationAnalysis(*ancestorClassRules);
+        invalidationAnalysis.invalidateStyle(element);
+    }
+}
+
</ins><span class="cx"> void Element::classAttributeChanged(const AtomicString&amp; newClassString)
</span><span class="cx"> {
</span><span class="cx">     // Note: We'll need ElementData, but it doesn't have to be UniqueElementData.
</span><span class="lines">@@ -1310,11 +1395,24 @@
</span><span class="cx"> 
</span><span class="cx">     auto oldClassNames = elementData()-&gt;classNames();
</span><span class="cx">     auto newClassNames = newStringHasClasses ? SpaceSplitString(newClassString, shouldFoldCase) : SpaceSplitString();
</span><del>-    {
-        Style::ClassChangeInvalidation styleInvalidation(*this, oldClassNames, newClassNames);
-        elementData()-&gt;setClassNames(newClassNames);
</del><ins>+
+    StyleResolver* styleResolver = document().styleResolverIfExists();
+    bool shouldInvalidateStyle = inRenderedDocument() &amp;&amp; styleResolver &amp;&amp; styleChangeType() &lt; FullStyleChange;
+
+    ClassChange classChange;
+    if (shouldInvalidateStyle) {
+        classChange = computeClassChange(oldClassNames, newClassNames);
+        if (!classChange.removed.isEmpty())
+            invalidateStyleForClassChange(*this, classChange.removed, styleResolver-&gt;ruleSets());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    elementData()-&gt;setClassNames(newClassNames);
+
+    if (shouldInvalidateStyle) {
+        if (!classChange.added.isEmpty())
+            invalidateStyleForClassChange(*this, classChange.added, styleResolver-&gt;ruleSets());
+    }
+
</ins><span class="cx">     if (hasRareData()) {
</span><span class="cx">         if (auto* classList = elementRareData()-&gt;classList())
</span><span class="cx">             classList-&gt;attributeValueChanged(newClassString);
</span></span></pre></div>
<a id="trunkSourceWebCorestyleClassChangeInvalidationcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/style/ClassChangeInvalidation.cpp (196472 => 196473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/ClassChangeInvalidation.cpp        2016-02-12 15:37:33 UTC (rev 196472)
+++ trunk/Source/WebCore/style/ClassChangeInvalidation.cpp        2016-02-12 15:49:24 UTC (rev 196473)
</span><span class="lines">@@ -1,116 +0,0 @@
</span><del>-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include &quot;config.h&quot;
-#include &quot;ClassChangeInvalidation.h&quot;
-
-#include &quot;DocumentRuleSets.h&quot;
-#include &quot;ElementChildIterator.h&quot;
-#include &quot;SpaceSplitString.h&quot;
-#include &quot;StyleInvalidationAnalysis.h&quot;
-
-namespace WebCore {
-namespace Style {
-
-auto ClassChangeInvalidation::collectClasses(const SpaceSplitString&amp; classes) -&gt; ClassChangeVector
-{
-    ClassChangeVector result;
-    result.reserveCapacity(classes.size());
-    for (unsigned i = 0; i &lt; classes.size(); ++i)
-        result.uncheckedAppend(classes[i].impl());
-    return result;
-}
-
-void ClassChangeInvalidation::computeClassChange(const SpaceSplitString&amp; oldClasses, const SpaceSplitString&amp; newClasses)
-{
-    unsigned oldSize = oldClasses.size();
-    unsigned newSize = newClasses.size();
-
-    if (!oldSize) {
-        m_addedClasses = collectClasses(newClasses);
-        return;
-    }
-    if (!newSize) {
-        m_removedClasses = collectClasses(oldClasses);
-        return;
-    }
-
-    BitVector remainingClassBits;
-    remainingClassBits.ensureSize(oldSize);
-    // Class vectors tend to be very short. This is faster than using a hash table.
-    for (unsigned i = 0; i &lt; newSize; ++i) {
-        bool foundFromBoth = false;
-        for (unsigned j = 0; j &lt; oldSize; ++j) {
-            if (newClasses[i] == oldClasses[j]) {
-                remainingClassBits.quickSet(j);
-                foundFromBoth = true;
-            }
-        }
-        if (foundFromBoth)
-            continue;
-        m_addedClasses.append(newClasses[i].impl());
-    }
-    for (unsigned i = 0; i &lt; oldSize; ++i) {
-        // If the bit is not set the the corresponding class has been removed.
-        if (remainingClassBits.quickGet(i))
-            continue;
-        m_removedClasses.append(oldClasses[i].impl());
-    }
-}
-
-void ClassChangeInvalidation::invalidateStyle(const ClassChangeVector&amp; changedClasses)
-{
-    auto&amp; ruleSets = m_element.styleResolver().ruleSets();
-
-    Vector&lt;AtomicStringImpl*, 4&gt; changedClassesAffectingStyle;
-    for (auto* changedClass : changedClasses) {
-        if (ruleSets.features().classesInRules.contains(changedClass))
-            changedClassesAffectingStyle.append(changedClass);
-    };
-
-    if (changedClassesAffectingStyle.isEmpty())
-        return;
-
-    if (m_element.shadowRoot() &amp;&amp; ruleSets.authorStyle()-&gt;hasShadowPseudoElementRules()) {
-        m_element.setNeedsStyleRecalc(FullStyleChange);
-        return;
-    }
-
-    m_element.setNeedsStyleRecalc(InlineStyleChange);
-
-    if (!childrenOfType&lt;Element&gt;(m_element).first())
-        return;
-
-    for (auto* changedClass : changedClassesAffectingStyle) {
-        auto* ancestorClassRules = ruleSets.ancestorClassRules(changedClass);
-        if (!ancestorClassRules)
-            continue;
-        StyleInvalidationAnalysis invalidationAnalysis(*ancestorClassRules);
-        invalidationAnalysis.invalidateStyle(m_element);
-    }
-}
-
-}
-}
</del></span></pre></div>
<a id="trunkSourceWebCorestyleClassChangeInvalidationh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/style/ClassChangeInvalidation.h (196472 => 196473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/ClassChangeInvalidation.h        2016-02-12 15:37:33 UTC (rev 196472)
+++ trunk/Source/WebCore/style/ClassChangeInvalidation.h        2016-02-12 15:49:24 UTC (rev 196473)
</span><span class="lines">@@ -1,95 +0,0 @@
</span><del>-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ClassChangeInvalidation_h
-#define ClassChangeInvalidation_h
-
-#include &quot;Document.h&quot;
-#include &quot;Element.h&quot;
-#include &quot;StyleResolver.h&quot;
-#include &lt;wtf/Vector.h&gt;
-
-namespace WebCore {
-
-class DocumentRuleSets;
-class SpaceSplitString;
-
-namespace Style {
-
-class ClassChangeInvalidation {
-public:
-    ClassChangeInvalidation(Element&amp;, const SpaceSplitString&amp; oldClasses, const SpaceSplitString&amp; newClasses);
-    ~ClassChangeInvalidation();
-
-private:
-    using ClassChangeVector = Vector&lt;AtomicStringImpl*, 4&gt;;
-
-    static bool needsInvalidation(const Element&amp;);
-    void computeClassChange(const SpaceSplitString&amp; oldClasses, const SpaceSplitString&amp; newClasses);
-    void invalidateStyle(const ClassChangeVector&amp;);
-
-    static ClassChangeVector collectClasses(const SpaceSplitString&amp;);
-
-    const bool m_isEnabled;
-    Element&amp; m_element;
-
-    ClassChangeVector m_addedClasses;
-    ClassChangeVector m_removedClasses;
-};
-
-inline bool ClassChangeInvalidation::needsInvalidation(const Element&amp; element)
-{
-    if (!element.inRenderedDocument())
-        return false;
-    if (element.styleChangeType() &gt;= FullStyleChange)
-        return false;
-    if (!element.document().styleResolverIfExists() &amp;&amp; &amp;element.treeScope() == &amp;element.document())
-        return false;
-    return true;
-}
-
-inline ClassChangeInvalidation::ClassChangeInvalidation(Element&amp; element, const SpaceSplitString&amp; oldClasses, const SpaceSplitString&amp; newClasses)
-    : m_isEnabled(needsInvalidation(element))
-    , m_element(element)
-
-{
-    if (!m_isEnabled)
-        return;
-    computeClassChange(oldClasses, newClasses);
-    invalidateStyle(m_removedClasses);
-}
-
-inline ClassChangeInvalidation::~ClassChangeInvalidation()
-{
-    if (!m_isEnabled)
-        return;
-    invalidateStyle(m_addedClasses);
-}
-    
-}
-}
-
-#endif
-
</del></span></pre>
</div>
</div>

</body>
</html>