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

Side by Side Diff: third_party/WebKit/Source/core/css/StyleSheetContents.cpp

Issue 2282303002: [test] lazily parse css style rules
Patch Set: use string pool Created 4 years, 3 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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 CSSStyleSheetResource::MIMETypeCheck mimeTypeCheck = isQuirksModeBehavior(m_ parserContext.mode()) && isSameOriginRequest ? CSSStyleSheetResource::MIMETypeCh eck::Lax : CSSStyleSheetResource::MIMETypeCheck::Strict; 334 CSSStyleSheetResource::MIMETypeCheck mimeTypeCheck = isQuirksModeBehavior(m_ parserContext.mode()) && isSameOriginRequest ? CSSStyleSheetResource::MIMETypeCh eck::Lax : CSSStyleSheetResource::MIMETypeCheck::Strict;
335 String sheetText = cachedStyleSheet->sheetText(mimeTypeCheck); 335 String sheetText = cachedStyleSheet->sheetText(mimeTypeCheck);
336 336
337 const ResourceResponse& response = cachedStyleSheet->response(); 337 const ResourceResponse& response = cachedStyleSheet->response();
338 m_sourceMapURL = response.httpHeaderField(HTTPNames::SourceMap); 338 m_sourceMapURL = response.httpHeaderField(HTTPNames::SourceMap);
339 if (m_sourceMapURL.isEmpty()) { 339 if (m_sourceMapURL.isEmpty()) {
340 // Try to get deprecated header. 340 // Try to get deprecated header.
341 m_sourceMapURL = response.httpHeaderField(HTTPNames::X_SourceMap); 341 m_sourceMapURL = response.httpHeaderField(HTTPNames::X_SourceMap);
342 } 342 }
343 343
344 CSSParserContext context(parserContext(), UseCounter::getFrom(this)); 344 CSSParser::parseSheet(parserContext(), this, sheetText);
345 CSSParser::parseSheet(context, this, sheetText);
346 } 345 }
347 346
348 void StyleSheetContents::parseString(const String& sheetText) 347 void StyleSheetContents::parseString(const String& sheetText)
349 { 348 {
350 parseStringAtPosition(sheetText, TextPosition::minimumPosition()); 349 parseStringAtPosition(sheetText, TextPosition::minimumPosition());
351 } 350 }
352 351
353 void StyleSheetContents::parseStringAtPosition(const String& sheetText, const Te xtPosition& startPosition) 352 void StyleSheetContents::parseStringAtPosition(const String& sheetText, const Te xtPosition& startPosition)
354 { 353 {
355 CSSParserContext context(parserContext(), UseCounter::getFrom(this)); 354 CSSParser::parseSheet(parserContext(), this, sheetText);
356 CSSParser::parseSheet(context, this, sheetText);
357 } 355 }
358 356
359 bool StyleSheetContents::isLoading() const 357 bool StyleSheetContents::isLoading() const
360 { 358 {
361 for (unsigned i = 0; i < m_importRules.size(); ++i) { 359 for (unsigned i = 0; i < m_importRules.size(); ++i) {
362 if (m_importRules[i]->isLoading()) 360 if (m_importRules[i]->isLoading())
363 return true; 361 return true;
364 } 362 }
365 return false; 363 return false;
366 } 364 }
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 visitor->trace(m_importRules); 662 visitor->trace(m_importRules);
665 visitor->trace(m_namespaceRules); 663 visitor->trace(m_namespaceRules);
666 visitor->trace(m_childRules); 664 visitor->trace(m_childRules);
667 visitor->trace(m_loadingClients); 665 visitor->trace(m_loadingClients);
668 visitor->trace(m_completedClients); 666 visitor->trace(m_completedClients);
669 visitor->trace(m_ruleSet); 667 visitor->trace(m_ruleSet);
670 visitor->trace(m_referencedFromResource); 668 visitor->trace(m_referencedFromResource);
671 } 669 }
672 670
673 } // namespace blink 671 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/StyleSheetContents.h ('k') | third_party/WebKit/Source/core/css/parser/CSSParserImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698