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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLLinkElement.cpp

Issue 2239353002: Ignored title in shadow should cause StyleSheet.title = null. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
6 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com) 6 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com)
7 * Copyright (C) 2011 Google Inc. All rights reserved. 7 * Copyright (C) 2011 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 DEFINE_STATIC_LOCAL(EnumerationHistogram, restoredCachedStyleSheet2Histogram , ("Blink.RestoredCachedStyleSheet2", StyleSheetCacheStatusCount)); 465 DEFINE_STATIC_LOCAL(EnumerationHistogram, restoredCachedStyleSheet2Histogram , ("Blink.RestoredCachedStyleSheet2", StyleSheetCacheStatusCount));
466 466
467 if (StyleSheetContents* restoredSheet = const_cast<CSSStyleSheetResource*>(c achedStyleSheet)->restoreParsedStyleSheet(parserContext)) { 467 if (StyleSheetContents* restoredSheet = const_cast<CSSStyleSheetResource*>(c achedStyleSheet)->restoreParsedStyleSheet(parserContext)) {
468 ASSERT(restoredSheet->isCacheableForResource()); 468 ASSERT(restoredSheet->isCacheableForResource());
469 ASSERT(!restoredSheet->isLoading()); 469 ASSERT(!restoredSheet->isLoading());
470 470
471 if (m_sheet) 471 if (m_sheet)
472 clearSheet(); 472 clearSheet();
473 m_sheet = CSSStyleSheet::create(restoredSheet, m_owner); 473 m_sheet = CSSStyleSheet::create(restoredSheet, m_owner);
474 m_sheet->setMediaQueries(MediaQuerySet::create(m_owner->media())); 474 m_sheet->setMediaQueries(MediaQuerySet::create(m_owner->media()));
475 m_sheet->setTitle(m_owner->title()); 475 if (m_owner->isInDocumentTree())
476 m_sheet->setTitle(m_owner->title());
476 setCrossOriginStylesheetStatus(m_sheet.get()); 477 setCrossOriginStylesheetStatus(m_sheet.get());
477 478
478 m_loading = false; 479 m_loading = false;
479 restoredSheet->checkLoaded(); 480 restoredSheet->checkLoaded();
480 481
481 restoredCachedStyleSheetHistogram.count(true); 482 restoredCachedStyleSheetHistogram.count(true);
482 restoredCachedStyleSheet2Histogram.count(StyleSheetInMemoryCache); 483 restoredCachedStyleSheet2Histogram.count(StyleSheetInMemoryCache);
483 return; 484 return;
484 } 485 }
485 restoredCachedStyleSheetHistogram.count(false); 486 restoredCachedStyleSheetHistogram.count(false);
486 StyleSheetCacheStatus cacheStatus = cachedStyleSheet->response().wasCached() ? StyleSheetInDiskCache : StyleSheetNewEntry; 487 StyleSheetCacheStatus cacheStatus = cachedStyleSheet->response().wasCached() ? StyleSheetInDiskCache : StyleSheetNewEntry;
487 restoredCachedStyleSheet2Histogram.count(cacheStatus); 488 restoredCachedStyleSheet2Histogram.count(cacheStatus);
488 489
489 StyleSheetContents* styleSheet = StyleSheetContents::create(href, parserCont ext); 490 StyleSheetContents* styleSheet = StyleSheetContents::create(href, parserCont ext);
490 491
491 if (m_sheet) 492 if (m_sheet)
492 clearSheet(); 493 clearSheet();
493 494
494 m_sheet = CSSStyleSheet::create(styleSheet, m_owner); 495 m_sheet = CSSStyleSheet::create(styleSheet, m_owner);
495 m_sheet->setMediaQueries(MediaQuerySet::create(m_owner->media())); 496 m_sheet->setMediaQueries(MediaQuerySet::create(m_owner->media()));
496 m_sheet->setTitle(m_owner->title()); 497 if (m_owner->isInDocumentTree())
498 m_sheet->setTitle(m_owner->title());
497 setCrossOriginStylesheetStatus(m_sheet.get()); 499 setCrossOriginStylesheetStatus(m_sheet.get());
498 500
499 styleSheet->parseAuthorStyleSheet(cachedStyleSheet, m_owner->document().getS ecurityOrigin()); 501 styleSheet->parseAuthorStyleSheet(cachedStyleSheet, m_owner->document().getS ecurityOrigin());
500 502
501 m_loading = false; 503 m_loading = false;
502 styleSheet->notifyLoadedSheet(cachedStyleSheet); 504 styleSheet->notifyLoadedSheet(cachedStyleSheet);
503 styleSheet->checkLoaded(); 505 styleSheet->checkLoaded();
504 506
505 if (styleSheet->isCacheableForResource()) 507 if (styleSheet->isCacheableForResource())
506 const_cast<CSSStyleSheetResource*>(cachedStyleSheet)->saveParsedStyleShe et(styleSheet); 508 const_cast<CSSStyleSheetResource*>(cachedStyleSheet)->saveParsedStyleShe et(styleSheet);
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 } else if (m_sheet) { 704 } else if (m_sheet) {
703 // we no longer contain a stylesheet, e.g. perhaps rel or type was chang ed 705 // we no longer contain a stylesheet, e.g. perhaps rel or type was chang ed
704 StyleSheet* removedSheet = m_sheet.get(); 706 StyleSheet* removedSheet = m_sheet.get();
705 clearSheet(); 707 clearSheet();
706 document().styleEngine().setNeedsActiveStyleUpdate(removedSheet, FullSty leUpdate); 708 document().styleEngine().setNeedsActiveStyleUpdate(removedSheet, FullSty leUpdate);
707 } 709 }
708 } 710 }
709 711
710 void LinkStyle::setSheetTitle(const String& title) 712 void LinkStyle::setSheetTitle(const String& title)
711 { 713 {
712 if (m_sheet) 714 if (m_sheet && m_owner->isInDocumentTree())
713 m_sheet->setTitle(title); 715 m_sheet->setTitle(title);
714 } 716 }
715 717
716 void LinkStyle::ownerRemoved() 718 void LinkStyle::ownerRemoved()
717 { 719 {
718 if (m_sheet) 720 if (m_sheet)
719 clearSheet(); 721 clearSheet();
720 722
721 if (styleSheetIsLoading()) 723 if (styleSheetIsLoading())
722 removePendingSheet(); 724 removePendingSheet();
723 } 725 }
724 726
725 DEFINE_TRACE(LinkStyle) 727 DEFINE_TRACE(LinkStyle)
726 { 728 {
727 visitor->trace(m_sheet); 729 visitor->trace(m_sheet);
728 LinkResource::trace(visitor); 730 LinkResource::trace(visitor);
729 ResourceOwner<StyleSheetResource>::trace(visitor); 731 ResourceOwner<StyleSheetResource>::trace(visitor);
730 } 732 }
731 733
732 } // namespace blink 734 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.cpp ('k') | third_party/WebKit/Source/core/html/HTMLStyleElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698