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

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: 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 ASSERT(sheet->isCachable());
85 return adoptRef(new CSSStyleSheet(sheet, ownerNode, true, startPosition));
86 }
87
81 PassRefPtr<CSSStyleSheet> CSSStyleSheet::createInline(Node* ownerNode, const KUR L& baseURL, const TextPosition& startPosition, const String& encoding) 88 PassRefPtr<CSSStyleSheet> CSSStyleSheet::createInline(Node* ownerNode, const KUR L& baseURL, const TextPosition& startPosition, const String& encoding)
82 { 89 {
83 CSSParserContext parserContext(ownerNode->document(), baseURL, encoding); 90 CSSParserContext parserContext(ownerNode->document(), baseURL, encoding);
84 RefPtr<StyleSheetContents> sheet = StyleSheetContents::create(baseURL.string (), parserContext); 91 RefPtr<StyleSheetContents> sheet = StyleSheetContents::create(baseURL.string (), parserContext);
85 return adoptRef(new CSSStyleSheet(sheet.release(), ownerNode, true, startPos ition)); 92 return adoptRef(new CSSStyleSheet(sheet.release(), ownerNode, true, startPos ition));
86 } 93 }
87 94
88 CSSStyleSheet::CSSStyleSheet(PassRefPtr<StyleSheetContents> contents, CSSImportR ule* ownerRule) 95 CSSStyleSheet::CSSStyleSheet(PassRefPtr<StyleSheetContents> contents, CSSImportR ule* ownerRule)
89 : m_contents(contents) 96 : m_contents(contents)
90 , m_isInlineStylesheet(false) 97 , m_isInlineStylesheet(false)
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 root = root->parentStyleSheet(); 366 root = root->parentStyleSheet();
360 return root->ownerNode() ? &root->ownerNode()->document() : 0; 367 return root->ownerNode() ? &root->ownerNode()->document() : 0;
361 } 368 }
362 369
363 void CSSStyleSheet::clearChildRuleCSSOMWrappers() 370 void CSSStyleSheet::clearChildRuleCSSOMWrappers()
364 { 371 {
365 m_childRuleCSSOMWrappers.clear(); 372 m_childRuleCSSOMWrappers.clear();
366 } 373 }
367 374
368 } 375 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698