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

Side by Side Diff: sky/engine/core/dom/TreeScope.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) 2011 Google Inc. All Rights Reserved. 2 * Copyright (C) 2011 Google Inc. All Rights Reserved.
3 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 10 matching lines...) Expand all
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #include "sky/engine/config.h" 27 #include "sky/engine/config.h"
28 #include "sky/engine/core/dom/TreeScope.h" 28 #include "sky/engine/core/dom/TreeScope.h"
29 29
30 #include "gen/sky/core/HTMLNames.h" 30 #include "gen/sky/core/HTMLNames.h"
31 #include "sky/engine/core/css/StyleSheetList.h"
31 #include "sky/engine/core/css/resolver/ScopedStyleResolver.h" 32 #include "sky/engine/core/css/resolver/ScopedStyleResolver.h"
32 #include "sky/engine/core/dom/ContainerNode.h" 33 #include "sky/engine/core/dom/ContainerNode.h"
33 #include "sky/engine/core/dom/Document.h" 34 #include "sky/engine/core/dom/Document.h"
34 #include "sky/engine/core/dom/Element.h" 35 #include "sky/engine/core/dom/Element.h"
35 #include "sky/engine/core/dom/ElementTraversal.h" 36 #include "sky/engine/core/dom/ElementTraversal.h"
36 #include "sky/engine/core/dom/NodeRenderStyle.h" 37 #include "sky/engine/core/dom/NodeRenderStyle.h"
37 #include "sky/engine/core/dom/TreeScopeAdopter.h" 38 #include "sky/engine/core/dom/TreeScopeAdopter.h"
38 #include "sky/engine/core/dom/shadow/ElementShadow.h" 39 #include "sky/engine/core/dom/shadow/ElementShadow.h"
39 #include "sky/engine/core/dom/shadow/ShadowRoot.h" 40 #include "sky/engine/core/dom/shadow/ShadowRoot.h"
40 #include "sky/engine/core/editing/DOMSelection.h" 41 #include "sky/engine/core/editing/DOMSelection.h"
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 { 414 {
414 for (Element* element = ElementTraversal::firstWithin(rootNode()); element; element = ElementTraversal::next(*element)) { 415 for (Element* element = ElementTraversal::firstWithin(rootNode()); element; element = ElementTraversal::next(*element)) {
415 if (ShadowRoot* root = element->shadowRoot()) 416 if (ShadowRoot* root = element->shadowRoot())
416 root->setNeedsStyleRecalcForViewportUnits(); 417 root->setNeedsStyleRecalcForViewportUnits();
417 RenderStyle* style = element->renderStyle(); 418 RenderStyle* style = element->renderStyle();
418 if (style && style->hasViewportUnits()) 419 if (style && style->hasViewportUnits())
419 element->setNeedsStyleRecalc(LocalStyleChange); 420 element->setNeedsStyleRecalc(LocalStyleChange);
420 } 421 }
421 } 422 }
422 423
424 bool TreeScope::hasSameStyles(TreeScope& other)
425 {
426 if (this == &other)
427 return true;
428 const Vector<RefPtr<blink::CSSStyleSheet> >& list = document().styleEngine() ->styleSheetsForStyleSheetList(*this);
429 const Vector<RefPtr<blink::CSSStyleSheet> >& otherList = document().styleEng ine()->styleSheetsForStyleSheetList(other);
430
431 if (list.size() != otherList.size())
432 return false;
433
434 for (size_t i = 0; i < list.size(); i++) {
435 if (list[i]->contents() != otherList[i]->contents())
436 return false;
437 }
438
439 return true;
440 }
441
423 } // namespace blink 442 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698