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

Side by Side Diff: Source/core/css/CSSStyleSheet.cpp

Issue 28553005: Avoid parsing css text if there are identical inline style blocks. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added StyleSheetContentsCache class Created 7 years, 2 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 | Annotate | Revision Log
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 PassRefPtr<CSSStyleSheet> CSSStyleSheet::create(PassRefPtr<StyleSheetContents> s heet, CSSImportRule* ownerRule) 71 PassRefPtr<CSSStyleSheet> CSSStyleSheet::create(PassRefPtr<StyleSheetContents> s heet, CSSImportRule* ownerRule)
72 { 72 {
73 return adoptRef(new CSSStyleSheet(sheet, ownerRule)); 73 return adoptRef(new CSSStyleSheet(sheet, ownerRule));
74 } 74 }
75 75
76 PassRefPtr<CSSStyleSheet> CSSStyleSheet::create(PassRefPtr<StyleSheetContents> s heet, Node* ownerNode) 76 PassRefPtr<CSSStyleSheet> CSSStyleSheet::create(PassRefPtr<StyleSheetContents> s heet, Node* ownerNode)
77 { 77 {
78 return adoptRef(new CSSStyleSheet(sheet, ownerNode, false, TextPosition::min imumPosition())); 78 return adoptRef(new CSSStyleSheet(sheet, ownerNode, false, TextPosition::min imumPosition()));
79 } 79 }
80 80
81 PassRefPtr<CSSStyleSheet> CSSStyleSheet::createInline(PassRefPtr<StyleSheetConte nts> sheet, Node* ownerNode, const TextPosition& startPosition)
82 {
83 ASSERT(sheet);
84 return adoptRef(new CSSStyleSheet(sheet, ownerNode, true, startPosition));
85 }
86
81 PassRefPtr<CSSStyleSheet> CSSStyleSheet::createInline(Node* ownerNode, const KUR L& baseURL, const TextPosition& startPosition, const String& encoding) 87 PassRefPtr<CSSStyleSheet> CSSStyleSheet::createInline(Node* ownerNode, const KUR L& baseURL, const TextPosition& startPosition, const String& encoding)
82 { 88 {
83 CSSParserContext parserContext(ownerNode->document(), baseURL, encoding); 89 CSSParserContext parserContext(ownerNode->document(), baseURL, encoding);
84 RefPtr<StyleSheetContents> sheet = StyleSheetContents::create(baseURL.string (), parserContext); 90 RefPtr<StyleSheetContents> sheet = StyleSheetContents::create(baseURL.string (), parserContext);
85 return adoptRef(new CSSStyleSheet(sheet.release(), ownerNode, true, startPos ition)); 91 return adoptRef(new CSSStyleSheet(sheet.release(), ownerNode, true, startPos ition));
86 } 92 }
87 93
88 CSSStyleSheet::CSSStyleSheet(PassRefPtr<StyleSheetContents> contents, CSSImportR ule* ownerRule) 94 CSSStyleSheet::CSSStyleSheet(PassRefPtr<StyleSheetContents> contents, CSSImportR ule* ownerRule)
89 : m_contents(contents) 95 : m_contents(contents)
90 , m_isInlineStylesheet(false) 96 , m_isInlineStylesheet(false)
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 root = root->parentStyleSheet(); 369 root = root->parentStyleSheet();
364 return root->ownerNode() ? &root->ownerNode()->document() : 0; 370 return root->ownerNode() ? &root->ownerNode()->document() : 0;
365 } 371 }
366 372
367 void CSSStyleSheet::clearChildRuleCSSOMWrappers() 373 void CSSStyleSheet::clearChildRuleCSSOMWrappers()
368 { 374 {
369 m_childRuleCSSOMWrappers.clear(); 375 m_childRuleCSSOMWrappers.clear();
370 } 376 }
371 377
372 } 378 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698