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

Side by Side Diff: Source/WebCore/dom/DocumentStyleSheetCollection.cpp

Issue 13771002: Recalc styles on resize if we have viewport units. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 7 years, 8 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 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 , m_injectedStyleSheetCacheValid(false) 61 , m_injectedStyleSheetCacheValid(false)
62 , m_hadActiveLoadingStylesheet(false) 62 , m_hadActiveLoadingStylesheet(false)
63 , m_needsUpdateActiveStylesheetsOnStyleRecalc(false) 63 , m_needsUpdateActiveStylesheetsOnStyleRecalc(false)
64 , m_usesSiblingRules(false) 64 , m_usesSiblingRules(false)
65 , m_usesSiblingRulesOverride(false) 65 , m_usesSiblingRulesOverride(false)
66 , m_usesFirstLineRules(false) 66 , m_usesFirstLineRules(false)
67 , m_usesFirstLetterRules(false) 67 , m_usesFirstLetterRules(false)
68 , m_usesBeforeAfterRules(false) 68 , m_usesBeforeAfterRules(false)
69 , m_usesBeforeAfterRulesOverride(false) 69 , m_usesBeforeAfterRulesOverride(false)
70 , m_usesRemUnits(false) 70 , m_usesRemUnits(false)
71 , m_usesViewportUnits(false)
71 { 72 {
72 } 73 }
73 74
74 DocumentStyleSheetCollection::~DocumentStyleSheetCollection() 75 DocumentStyleSheetCollection::~DocumentStyleSheetCollection()
75 { 76 {
76 if (m_pageUserSheet) 77 if (m_pageUserSheet)
77 m_pageUserSheet->clearOwnerNode(); 78 m_pageUserSheet->clearOwnerNode();
78 for (unsigned i = 0; i < m_injectedUserStyleSheets.size(); ++i) 79 for (unsigned i = 0; i < m_injectedUserStyleSheets.size(); ++i)
79 m_injectedUserStyleSheets[i]->clearOwnerNode(); 80 m_injectedUserStyleSheets[i]->clearOwnerNode();
80 for (unsigned i = 0; i < m_injectedAuthorStyleSheets.size(); ++i) 81 for (unsigned i = 0; i < m_injectedAuthorStyleSheets.size(); ++i)
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 421
421 static bool styleSheetsUseRemUnits(const Vector<RefPtr<CSSStyleSheet> >& sheets) 422 static bool styleSheetsUseRemUnits(const Vector<RefPtr<CSSStyleSheet> >& sheets)
422 { 423 {
423 for (unsigned i = 0; i < sheets.size(); ++i) { 424 for (unsigned i = 0; i < sheets.size(); ++i) {
424 if (sheets[i]->contents()->usesRemUnits()) 425 if (sheets[i]->contents()->usesRemUnits())
425 return true; 426 return true;
426 } 427 }
427 return false; 428 return false;
428 } 429 }
429 430
431 static bool styleSheetsUseViewportUnits(const Vector<RefPtr<CSSStyleSheet> >& sh eets)
432 {
433 for (unsigned i = 0; i < sheets.size(); ++i) {
434 if (sheets[i]->contents()->usesViewportUnits())
435 return true;
436 }
437 return false;
438 }
439
430 static void filterEnabledCSSStyleSheets(Vector<RefPtr<CSSStyleSheet> >& result, const Vector<RefPtr<StyleSheet> >& sheets) 440 static void filterEnabledCSSStyleSheets(Vector<RefPtr<CSSStyleSheet> >& result, const Vector<RefPtr<StyleSheet> >& sheets)
431 { 441 {
432 for (unsigned i = 0; i < sheets.size(); ++i) { 442 for (unsigned i = 0; i < sheets.size(); ++i) {
433 if (!sheets[i]->isCSSStyleSheet()) 443 if (!sheets[i]->isCSSStyleSheet())
434 continue; 444 continue;
435 if (sheets[i]->disabled()) 445 if (sheets[i]->disabled())
436 continue; 446 continue;
437 result.append(static_cast<CSSStyleSheet*>(sheets[i].get())); 447 result.append(static_cast<CSSStyleSheet*>(sheets[i].get()));
438 } 448 }
439 } 449 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 } else { 493 } else {
484 ASSERT(styleResolverUpdateType == Additive); 494 ASSERT(styleResolverUpdateType == Additive);
485 styleResolver->appendAuthorStyleSheets(m_activeAuthorStyleSheets.siz e(), activeCSSStyleSheets); 495 styleResolver->appendAuthorStyleSheets(m_activeAuthorStyleSheets.siz e(), activeCSSStyleSheets);
486 } 496 }
487 resetCSSFeatureFlags(); 497 resetCSSFeatureFlags();
488 } 498 }
489 m_activeAuthorStyleSheets.swap(activeCSSStyleSheets); 499 m_activeAuthorStyleSheets.swap(activeCSSStyleSheets);
490 m_styleSheetsForStyleSheetList.swap(activeStyleSheets); 500 m_styleSheetsForStyleSheetList.swap(activeStyleSheets);
491 501
492 m_usesRemUnits = styleSheetsUseRemUnits(m_activeAuthorStyleSheets); 502 m_usesRemUnits = styleSheetsUseRemUnits(m_activeAuthorStyleSheets);
503 m_usesViewportUnits = styleSheetsUseViewportUnits(m_activeAuthorStyleSheets) ;
493 m_needsUpdateActiveStylesheetsOnStyleRecalc = false; 504 m_needsUpdateActiveStylesheetsOnStyleRecalc = false;
494 505
495 m_document->notifySeamlessChildDocumentsOfStylesheetUpdate(); 506 m_document->notifySeamlessChildDocumentsOfStylesheetUpdate();
496 507
497 return requiresFullStyleRecalc; 508 return requiresFullStyleRecalc;
498 } 509 }
499 510
500 void DocumentStyleSheetCollection::reportMemoryUsage(MemoryObjectInfo* memoryObj ectInfo) const 511 void DocumentStyleSheetCollection::reportMemoryUsage(MemoryObjectInfo* memoryObj ectInfo) const
501 { 512 {
502 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); 513 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
503 info.addMember(m_pageUserSheet, "pageUserSheet"); 514 info.addMember(m_pageUserSheet, "pageUserSheet");
504 info.addMember(m_injectedUserStyleSheets, "injectedUserStyleSheets"); 515 info.addMember(m_injectedUserStyleSheets, "injectedUserStyleSheets");
505 info.addMember(m_injectedAuthorStyleSheets, "injectedAuthorStyleSheets"); 516 info.addMember(m_injectedAuthorStyleSheets, "injectedAuthorStyleSheets");
506 info.addMember(m_userStyleSheets, "userStyleSheets"); 517 info.addMember(m_userStyleSheets, "userStyleSheets");
507 info.addMember(m_authorStyleSheets, "authorStyleSheets"); 518 info.addMember(m_authorStyleSheets, "authorStyleSheets");
508 info.addMember(m_activeAuthorStyleSheets, "activeAuthorStyleSheets"); 519 info.addMember(m_activeAuthorStyleSheets, "activeAuthorStyleSheets");
509 info.addMember(m_styleSheetsForStyleSheetList, "styleSheetsForStyleSheetList "); 520 info.addMember(m_styleSheetsForStyleSheetList, "styleSheetsForStyleSheetList ");
510 info.addMember(m_styleSheetCandidateNodes, "styleSheetCandidateNodes"); 521 info.addMember(m_styleSheetCandidateNodes, "styleSheetCandidateNodes");
511 info.addMember(m_preferredStylesheetSetName, "preferredStylesheetSetName"); 522 info.addMember(m_preferredStylesheetSetName, "preferredStylesheetSetName");
512 info.addMember(m_selectedStylesheetSetName, "selectedStylesheetSetName"); 523 info.addMember(m_selectedStylesheetSetName, "selectedStylesheetSetName");
513 info.addMember(m_document, "document"); 524 info.addMember(m_document, "document");
514 } 525 }
515 526
516 } 527 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698