Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 return toElement(node()).getAttribute(relAttr).contains("alternate"); | 72 return toElement(node()).getAttribute(relAttr).contains("alternate"); |
| 73 } | 73 } |
| 74 | 74 |
| 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 if (isHTMLLink()) |
| 83 return !toHTMLLinkElement(node()).isDisabled() && toHTMLLinkElement(node ()).styleSheetIsLoading(); | |
| 84 | |
| 85 StyleSheet* sheet = this->sheet(); | |
|
esprehn
2016/04/06 21:03:17
hmm, can we not make this->sheet() and sheet->disa
rune
2016/04/06 22:01:46
Sheet is null while top-level css is loading for <
| |
| 86 return sheet && !sheet->disabled() && sheet->isLoading(); | |
| 83 } | 87 } |
| 84 | 88 |
| 85 bool StyleSheetCandidate::hasPreferrableName() const | 89 bool StyleSheetCandidate::hasPreferrableName() const |
| 86 { | 90 { |
| 87 ASSERT(isEnabledAndLoading() || sheet()); | 91 ASSERT(isEnabledAndLoading() || sheet()); |
| 88 return !isEnabledViaScript() && !title().isEmpty() && !isAlternate(); | 92 return !isEnabledViaScript() && !title().isEmpty() && !isAlternate(); |
| 89 } | 93 } |
| 90 | 94 |
| 91 bool StyleSheetCandidate::canBeActivated(const String& currentPreferrableName) c onst | 95 bool StyleSheetCandidate::canBeActivated(const String& currentPreferrableName) c onst |
| 92 { | 96 { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 return toSVGStyleElement(node()).sheet(); | 143 return toSVGStyleElement(node()).sheet(); |
| 140 case Pi: | 144 case Pi: |
| 141 return toProcessingInstruction(node()).sheet(); | 145 return toProcessingInstruction(node()).sheet(); |
| 142 } | 146 } |
| 143 | 147 |
| 144 ASSERT_NOT_REACHED(); | 148 ASSERT_NOT_REACHED(); |
| 145 return 0; | 149 return 0; |
| 146 } | 150 } |
| 147 | 151 |
| 148 } // namespace blink | 152 } // namespace blink |
| OLD | NEW |