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

Unified Diff: third_party/WebKit/Source/core/html/LinkStyle.cpp

Issue 2553023002: Style fix in LinkStyle.cpp (Closed)
Patch Set: a Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/LinkStyle.cpp
diff --git a/third_party/WebKit/Source/core/html/LinkStyle.cpp b/third_party/WebKit/Source/core/html/LinkStyle.cpp
index 4a3297d1c4fea51b953efa142e0df9dac0edd0a3..c9c542849811bd9969d2136de8510203b9ec8519 100644
--- a/third_party/WebKit/Source/core/html/LinkStyle.cpp
+++ b/third_party/WebKit/Source/core/html/LinkStyle.cpp
@@ -236,40 +236,41 @@ void LinkStyle::removePendingSheet() {
void LinkStyle::setDisabledState(bool disabled) {
LinkStyle::DisabledState oldDisabledState = m_disabledState;
m_disabledState = disabled ? Disabled : EnabledViaScript;
- if (oldDisabledState != m_disabledState) {
- // If we change the disabled state while the sheet is still loading, then we
- // have to perform three checks:
- if (styleSheetIsLoading()) {
- // Check #1: The sheet becomes disabled while loading.
- if (m_disabledState == Disabled)
- removePendingSheet();
-
- // Check #2: An alternate sheet becomes enabled while it is still loading.
- if (m_owner->relAttribute().isAlternate() &&
- m_disabledState == EnabledViaScript)
- addPendingSheet(Blocking);
-
- // Check #3: A main sheet becomes enabled while it was still loading and
- // after it was disabled via script. It takes really terrible code to make
- // this happen (a double toggle for no reason essentially). This happens
- // on virtualplastic.net, which manages to do about 12 enable/disables on
- // only 3 sheets. :)
- if (!m_owner->relAttribute().isAlternate() &&
- m_disabledState == EnabledViaScript && oldDisabledState == Disabled)
- addPendingSheet(Blocking);
-
- // If the sheet is already loading just bail.
- return;
- }
+ if (oldDisabledState == m_disabledState)
+ return;
- if (m_sheet) {
- m_sheet->setDisabled(disabled);
- return;
- }
+ // If we change the disabled state while the sheet is still loading, then we
+ // have to perform three checks:
+ if (styleSheetIsLoading()) {
+ // Check #1: The sheet becomes disabled while loading.
+ if (m_disabledState == Disabled)
+ removePendingSheet();
- if (m_disabledState == EnabledViaScript && m_owner->shouldProcessStyle())
- process();
+ // Check #2: An alternate sheet becomes enabled while it is still loading.
+ if (m_owner->relAttribute().isAlternate() &&
+ m_disabledState == EnabledViaScript)
+ addPendingSheet(Blocking);
+
+ // Check #3: A main sheet becomes enabled while it was still loading and
+ // after it was disabled via script. It takes really terrible code to make
+ // this happen (a double toggle for no reason essentially). This happens
+ // on virtualplastic.net, which manages to do about 12 enable/disables on
+ // only 3 sheets. :)
+ if (!m_owner->relAttribute().isAlternate() &&
+ m_disabledState == EnabledViaScript && oldDisabledState == Disabled)
+ addPendingSheet(Blocking);
+
+ // If the sheet is already loading just bail.
+ return;
}
+
+ if (m_sheet) {
+ m_sheet->setDisabled(disabled);
+ return;
+ }
+
+ if (m_disabledState == EnabledViaScript && m_owner->shouldProcessStyle())
+ process();
}
void LinkStyle::setCrossOriginStylesheetStatus(CSSStyleSheet* sheet) {
@@ -406,7 +407,7 @@ void LinkStyle::setSheetTitle(
if (title.isEmpty() || !isUnset() || m_owner->isAlternate())
return;
- KURL href = m_owner->getNonEmptyURLAttribute(hrefAttr);
+ const KURL& href = m_owner->getNonEmptyURLAttribute(hrefAttr);
if (href.isValid() && !href.isEmpty()) {
document().styleEngine().setPreferredStylesheetSetNameIfNotSet(
title, updateActiveSheets);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698