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

Side by Side Diff: third_party/WebKit/Source/core/dom/StyleSheetCandidate.cpp

Issue 2079303002: Move preferred stylesheet set out of active sheet update. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 bool StyleSheetCandidate::isEnabledViaScript() const 75 bool StyleSheetCandidate::isEnabledViaScript() const
76 { 76 {
77 return isHTMLLink() && toHTMLLinkElement(node()).isEnabledViaScript(); 77 return isHTMLLink() && toHTMLLinkElement(node()).isEnabledViaScript();
78 } 78 }
79 79
80 bool StyleSheetCandidate::isEnabledAndLoading() const 80 bool StyleSheetCandidate::isEnabledAndLoading() const
81 { 81 {
82 return isHTMLLink() && !toHTMLLinkElement(node()).isDisabled() && toHTMLLink Element(node()).styleSheetIsLoading(); 82 return isHTMLLink() && !toHTMLLinkElement(node()).isDisabled() && toHTMLLink Element(node()).styleSheetIsLoading();
83 } 83 }
84 84
85 bool StyleSheetCandidate::hasPreferrableName() const
86 {
87 DCHECK(isEnabledAndLoading() || sheet());
88 return !isEnabledViaScript() && !title().isEmpty() && !isAlternate();
89 }
90
91 bool StyleSheetCandidate::canBeActivated(const String& currentPreferrableName) c onst 85 bool StyleSheetCandidate::canBeActivated(const String& currentPreferrableName) c onst
92 { 86 {
93 StyleSheet* sheet = this->sheet(); 87 StyleSheet* sheet = this->sheet();
94 if (!sheet || sheet->disabled() || !sheet->isCSSStyleSheet()) 88 if (!sheet || sheet->disabled() || !sheet->isCSSStyleSheet())
95 return false; 89 return false;
96 90
97 if (sheet->ownerNode() && sheet->ownerNode()->isInShadowTree()) 91 if (sheet->ownerNode() && sheet->ownerNode()->isInShadowTree())
98 return true; 92 return true;
99 93
100 const AtomicString& title = this->title(); 94 const AtomicString& title = this->title();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 return toSVGStyleElement(node()).sheet(); 133 return toSVGStyleElement(node()).sheet();
140 case Pi: 134 case Pi:
141 return toProcessingInstruction(node()).sheet(); 135 return toProcessingInstruction(node()).sheet();
142 } 136 }
143 137
144 ASSERT_NOT_REACHED(); 138 ASSERT_NOT_REACHED();
145 return 0; 139 return 0;
146 } 140 }
147 141
148 } // namespace blink 142 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleSheetCandidate.h ('k') | third_party/WebKit/Source/core/html/HTMLLinkElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698