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

Side by Side Diff: sky/engine/core/dom/shadow/ElementShadow.cpp

Issue 796713002: Turn StyleSharing to 11. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 return; 201 return;
202 m_needsDistributionRecalc = true; 202 m_needsDistributionRecalc = true;
203 host()->markAncestorsWithChildNeedsDistributionRecalc(); 203 host()->markAncestorsWithChildNeedsDistributionRecalc();
204 clearDistribution(); 204 clearDistribution();
205 } 205 }
206 206
207 bool ElementShadow::hasSameStyles(const ElementShadow* other) const 207 bool ElementShadow::hasSameStyles(const ElementShadow* other) const
208 { 208 {
209 ShadowRoot* root = m_shadowRoot; 209 ShadowRoot* root = m_shadowRoot;
210 ShadowRoot* otherRoot = other->shadowRoot(); 210 ShadowRoot* otherRoot = other->shadowRoot();
211 if (root || otherRoot) { 211 if (!root && !otherRoot)
212 if (!root || !otherRoot) 212 return true;
213 return false; 213 if (root && otherRoot)
214 214 return root->hasSameStyles(*otherRoot);
215 StyleSheetList* list = root->styleSheets(); 215 return false;
216 StyleSheetList* otherList = otherRoot->styleSheets();
217
218 if (list->length() != otherList->length())
219 return false;
220
221 for (size_t i = 0; i < list->length(); i++) {
222 if (list->item(i)->contents() != otherList->item(i)->contents())
223 return false;
224 }
225 }
226
227 return true;
228 } 216 }
229 217
230 const InsertionPoint* ElementShadow::finalDestinationInsertionPointFor(const Nod e* key) const 218 const InsertionPoint* ElementShadow::finalDestinationInsertionPointFor(const Nod e* key) const
231 { 219 {
232 ASSERT(key && !key->document().childNeedsDistributionRecalc()); 220 ASSERT(key && !key->document().childNeedsDistributionRecalc());
233 NodeToDestinationInsertionPoints::const_iterator it = m_nodeToInsertionPoint s.find(key); 221 NodeToDestinationInsertionPoints::const_iterator it = m_nodeToInsertionPoint s.find(key);
234 return it == m_nodeToInsertionPoints.end() ? 0: it->value.last().get(); 222 return it == m_nodeToInsertionPoints.end() ? 0: it->value.last().get();
235 } 223 }
236 224
237 const DestinationInsertionPoints* ElementShadow::destinationInsertionPointsFor(c onst Node* key) const 225 const DestinationInsertionPoints* ElementShadow::destinationInsertionPointsFor(c onst Node* key) const
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 } 292 }
305 setNeedsDistributionRecalc(); 293 setNeedsDistributionRecalc();
306 } 294 }
307 295
308 void ElementShadow::clearDistribution() 296 void ElementShadow::clearDistribution()
309 { 297 {
310 m_nodeToInsertionPoints.clear(); 298 m_nodeToInsertionPoints.clear();
311 } 299 }
312 300
313 } // namespace 301 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698