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

Side by Side Diff: sky/engine/core/dom/StyleEngine.cpp

Issue 800083003: Remove hasSyntacticallyValidCSSHeader. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « sky/engine/core/css/parser/BisonCSSParser-in.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 m_dirtyTreeScopes.add(&scope); 369 m_dirtyTreeScopes.add(&scope);
370 } 370 }
371 371
372 void StyleEngine::markDocumentDirty() 372 void StyleEngine::markDocumentDirty()
373 { 373 {
374 m_documentScopeDirty = true; 374 m_documentScopeDirty = true;
375 if (document().importLoader()) 375 if (document().importLoader())
376 document().importsController()->master()->styleEngine()->markDocumentDir ty(); 376 document().importsController()->master()->styleEngine()->markDocumentDir ty();
377 } 377 }
378 378
379 static bool isCacheableForStyleElement(const StyleSheetContents& contents)
380 {
381 if (!contents.hasSyntacticallyValidCSSHeader())
382 return false;
383 return true;
384 }
385
386 PassRefPtr<CSSStyleSheet> StyleEngine::createSheet(Element* e, const String& tex t) 379 PassRefPtr<CSSStyleSheet> StyleEngine::createSheet(Element* e, const String& tex t)
387 { 380 {
388 RefPtr<CSSStyleSheet> styleSheet; 381 RefPtr<CSSStyleSheet> styleSheet;
389 AtomicString textContent(text); 382 AtomicString textContent(text);
390 383
391 HashMap<AtomicString, RawPtr<StyleSheetContents> >::AddResult result = m_tex tToSheetCache.add(textContent, nullptr); 384 HashMap<AtomicString, RawPtr<StyleSheetContents> >::AddResult result = m_tex tToSheetCache.add(textContent, nullptr);
392 if (result.isNewEntry || !result.storedValue->value) { 385 if (result.isNewEntry || !result.storedValue->value) {
393 styleSheet = CSSStyleSheet::createInline(e, KURL()); 386 styleSheet = CSSStyleSheet::createInline(e, KURL());
394 styleSheet->contents()->parseString(text); 387 styleSheet->contents()->parseString(text);
395 if (result.isNewEntry && isCacheableForStyleElement(*styleSheet->content s())) { 388 if (result.isNewEntry) {
396 result.storedValue->value = styleSheet->contents(); 389 result.storedValue->value = styleSheet->contents();
397 m_sheetToTextCache.add(styleSheet->contents(), textContent); 390 m_sheetToTextCache.add(styleSheet->contents(), textContent);
398 } 391 }
399 } else { 392 } else {
400 StyleSheetContents* contents = result.storedValue->value; 393 StyleSheetContents* contents = result.storedValue->value;
401 ASSERT(contents); 394 ASSERT(contents);
402 ASSERT(isCacheableForStyleElement(*contents));
403 ASSERT(contents->singleOwnerDocument() == e->document()); 395 ASSERT(contents->singleOwnerDocument() == e->document());
404 styleSheet = CSSStyleSheet::createInline(contents, e); 396 styleSheet = CSSStyleSheet::createInline(contents, e);
405 } 397 }
406 398
407 ASSERT(styleSheet); 399 ASSERT(styleSheet);
408 return styleSheet; 400 return styleSheet;
409 } 401 }
410 402
411 void StyleEngine::removeSheet(StyleSheetContents* contents) 403 void StyleEngine::removeSheet(StyleSheetContents* contents)
412 { 404 {
(...skipping 16 matching lines...) Expand all
429 { 421 {
430 if (!document().isActive()) 422 if (!document().isActive())
431 return; 423 return;
432 424
433 if (m_resolver) 425 if (m_resolver)
434 m_resolver->invalidateMatchedPropertiesCache(); 426 m_resolver->invalidateMatchedPropertiesCache();
435 document().setNeedsStyleRecalc(SubtreeStyleChange); 427 document().setNeedsStyleRecalc(SubtreeStyleChange);
436 } 428 }
437 429
438 } 430 }
OLDNEW
« no previous file with comments | « sky/engine/core/css/parser/BisonCSSParser-in.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698