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

Side by Side Diff: sky/engine/core/css/CSSStyleSheet.cpp

Issue 799073004: Remove dead code from StyleSheetContents and CSSStyleSheet. (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/CSSStyleSheet.h ('k') | sky/engine/core/css/CSSTestHelper.cpp » ('j') | 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 * (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 25 matching lines...) Expand all
36 // clearOwnerNode() when moved out of document. 36 // clearOwnerNode() when moved out of document.
37 // Destruction of the style sheet counts as being "moved out of the 37 // Destruction of the style sheet counts as being "moved out of the
38 // document", but only in the non-oilpan version of blink. I.e. don't call 38 // document", but only in the non-oilpan version of blink. I.e. don't call
39 // clearOwnerNode() in the owner's destructor in oilpan. 39 // clearOwnerNode() in the owner's destructor in oilpan.
40 return !parentNode 40 return !parentNode
41 || parentNode->isDocumentNode() 41 || parentNode->isDocumentNode()
42 || isHTMLStyleElement(*parentNode); 42 || isHTMLStyleElement(*parentNode);
43 } 43 }
44 #endif 44 #endif
45 45
46 PassRefPtr<CSSStyleSheet> CSSStyleSheet::createInline(PassRefPtr<StyleSheetConte nts> sheet, Node* ownerNode, const TextPosition& startPosition) 46 PassRefPtr<CSSStyleSheet> CSSStyleSheet::create(PassRefPtr<StyleSheetContents> s heet, Node* ownerNode)
47 { 47 {
48 ASSERT(sheet); 48 ASSERT(sheet);
49 return adoptRef(new CSSStyleSheet(sheet, ownerNode, true, startPosition)); 49 return adoptRef(new CSSStyleSheet(sheet, ownerNode));
50 } 50 }
51 51
52 PassRefPtr<CSSStyleSheet> CSSStyleSheet::createInline(Node* ownerNode, const KUR L& baseURL, const TextPosition& startPosition) 52 PassRefPtr<CSSStyleSheet> CSSStyleSheet::create(Node* ownerNode, const KURL& bas eURL)
53 { 53 {
54 CSSParserContext parserContext(ownerNode->document(), 0, baseURL); 54 CSSParserContext parserContext(ownerNode->document(), 0, baseURL);
55 RefPtr<StyleSheetContents> sheet = StyleSheetContents::create(baseURL.string (), parserContext); 55 RefPtr<StyleSheetContents> sheet = StyleSheetContents::create(parserContext) ;
56 return adoptRef(new CSSStyleSheet(sheet.release(), ownerNode, true, startPos ition)); 56 return adoptRef(new CSSStyleSheet(sheet.release(), ownerNode));
57 } 57 }
58 58
59 CSSStyleSheet::CSSStyleSheet(PassRefPtr<StyleSheetContents> contents) 59 CSSStyleSheet::CSSStyleSheet(PassRefPtr<StyleSheetContents> contents, Node* owne rNode)
60 : m_contents(contents) 60 : m_contents(contents)
61 , m_isInlineStylesheet(false)
62 , m_ownerNode(nullptr)
63 , m_startPosition(TextPosition::minimumPosition())
64 {
65 m_contents->registerClient(this);
66 }
67
68 CSSStyleSheet::CSSStyleSheet(PassRefPtr<StyleSheetContents> contents, Node* owne rNode, bool isInlineStylesheet, const TextPosition& startPosition)
69 : m_contents(contents)
70 , m_isInlineStylesheet(isInlineStylesheet)
71 , m_ownerNode(ownerNode) 61 , m_ownerNode(ownerNode)
72 , m_startPosition(startPosition)
73 { 62 {
74 ASSERT(isAcceptableCSSStyleSheetParent(ownerNode)); 63 ASSERT(isAcceptableCSSStyleSheetParent(ownerNode));
75 m_contents->registerClient(this); 64 m_contents->registerClient(this);
76 } 65 }
77 66
78 CSSStyleSheet::~CSSStyleSheet() 67 CSSStyleSheet::~CSSStyleSheet()
79 { 68 {
80 m_contents->unregisterClient(this); 69 m_contents->unregisterClient(this);
81 } 70 }
82 71
(...skipping 12 matching lines...) Expand all
95 84
96 void CSSStyleSheet::clearOwnerNode() 85 void CSSStyleSheet::clearOwnerNode()
97 { 86 {
98 if (Document* owner = ownerDocument()) 87 if (Document* owner = ownerDocument())
99 owner->modifiedStyleSheet(this); 88 owner->modifiedStyleSheet(this);
100 if (m_ownerNode) 89 if (m_ownerNode)
101 m_contents->unregisterClient(this); 90 m_contents->unregisterClient(this);
102 m_ownerNode = nullptr; 91 m_ownerNode = nullptr;
103 } 92 }
104 93
105 KURL CSSStyleSheet::baseURL() const
106 {
107 return m_contents->baseURL();
108 }
109
110 Document* CSSStyleSheet::ownerDocument() const 94 Document* CSSStyleSheet::ownerDocument() const
111 { 95 {
112 return ownerNode() ? &ownerNode()->document() : 0; 96 return ownerNode() ? &ownerNode()->document() : 0;
113 } 97 }
114 98
115 } // namespace blink 99 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/css/CSSStyleSheet.h ('k') | sky/engine/core/css/CSSTestHelper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698