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

Side by Side Diff: Source/core/dom/StyleSheetCollection.cpp

Issue 19555002: Translate viewport related meta tags into @viewport descriptors as suggested by the CSS Device Adap… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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 * 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 23 matching lines...) Expand all
34 #include "core/css/StyleInvalidationAnalysis.h" 34 #include "core/css/StyleInvalidationAnalysis.h"
35 #include "core/css/StyleSheetContents.h" 35 #include "core/css/StyleSheetContents.h"
36 #include "core/css/resolver/StyleResolver.h" 36 #include "core/css/resolver/StyleResolver.h"
37 #include "core/dom/Document.h" 37 #include "core/dom/Document.h"
38 #include "core/dom/DocumentStyleSheetCollection.h" 38 #include "core/dom/DocumentStyleSheetCollection.h"
39 #include "core/dom/Element.h" 39 #include "core/dom/Element.h"
40 #include "core/dom/ProcessingInstruction.h" 40 #include "core/dom/ProcessingInstruction.h"
41 #include "core/dom/WebCoreMemoryInstrumentation.h" 41 #include "core/dom/WebCoreMemoryInstrumentation.h"
42 #include "core/html/HTMLIFrameElement.h" 42 #include "core/html/HTMLIFrameElement.h"
43 #include "core/html/HTMLLinkElement.h" 43 #include "core/html/HTMLLinkElement.h"
44 #include "core/html/HTMLMetaElement.h"
44 #include "core/html/HTMLStyleElement.h" 45 #include "core/html/HTMLStyleElement.h"
45 #include "core/page/Page.h" 46 #include "core/page/Page.h"
46 #include "core/page/PageGroup.h" 47 #include "core/page/PageGroup.h"
47 #include "core/page/Settings.h" 48 #include "core/page/Settings.h"
48 #include "core/page/UserContentURLPattern.h" 49 #include "core/page/UserContentURLPattern.h"
49 #include "core/svg/SVGStyleElement.h" 50 #include "core/svg/SVGStyleElement.h"
50 #include "wtf/MemoryInstrumentationListHashSet.h" 51 #include "wtf/MemoryInstrumentationListHashSet.h"
51 #include "wtf/MemoryInstrumentationVector.h" 52 #include "wtf/MemoryInstrumentationVector.h"
52 53
53 namespace WebCore { 54 namespace WebCore {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 // Don't apply XSL transforms to already transformed documents -- <r dar://problem/4132806> 101 // Don't apply XSL transforms to already transformed documents -- <r dar://problem/4132806>
101 if (pi->isXSL() && !document()->transformSourceDocument()) { 102 if (pi->isXSL() && !document()->transformSourceDocument()) {
102 // Don't apply XSL transforms until loading is finished. 103 // Don't apply XSL transforms until loading is finished.
103 if (!document()->parsing()) 104 if (!document()->parsing())
104 document()->applyXSLTransform(pi); 105 document()->applyXSLTransform(pi);
105 return; 106 return;
106 } 107 }
107 sheet = pi->sheet(); 108 sheet = pi->sheet();
108 if (sheet && !sheet->disabled() && sheet->isCSSStyleSheet()) 109 if (sheet && !sheet->disabled() && sheet->isCSSStyleSheet())
109 activeSheet = static_cast<CSSStyleSheet*>(sheet); 110 activeSheet = static_cast<CSSStyleSheet*>(sheet);
110 } else if ((n->isHTMLElement() && (n->hasTagName(linkTag) || n->hasTagNa me(styleTag))) || (n->isSVGElement() && n->hasTagName(SVGNames::styleTag))) { 111 } else if ((n->isHTMLElement() && (n->hasTagName(linkTag) || n->hasTagNa me(styleTag) || n->hasTagName(metaTag))) || (n->isSVGElement() && n->hasTagName( SVGNames::styleTag))) {
111 Element* e = toElement(n); 112 Element* e = toElement(n);
112 AtomicString title = e->getAttribute(titleAttr); 113 AtomicString title = e->getAttribute(titleAttr);
113 bool enabledViaScript = false; 114 bool enabledViaScript = false;
114 if (e->hasLocalName(linkTag)) { 115 if (e->hasLocalName(linkTag)) {
115 // <LINK> element 116 // <LINK> element
116 HTMLLinkElement* linkElement = toHTMLLinkElement(n); 117 HTMLLinkElement* linkElement = toHTMLLinkElement(n);
117 enabledViaScript = linkElement->isEnabledViaScript(); 118 enabledViaScript = linkElement->isEnabledViaScript();
118 if (!linkElement->isDisabled() && linkElement->styleSheetIsLoadi ng()) { 119 if (!linkElement->isDisabled() && linkElement->styleSheetIsLoadi ng()) {
119 // it is loading but we should still decide which style shee t set to use 120 // it is loading but we should still decide which style shee t set to use
120 if (!enabledViaScript && !title.isEmpty() && collections->pr eferredStylesheetSetName().isEmpty()) { 121 if (!enabledViaScript && !title.isEmpty() && collections->pr eferredStylesheetSetName().isEmpty()) {
121 const AtomicString& rel = e->getAttribute(relAttr); 122 const AtomicString& rel = e->getAttribute(relAttr);
122 if (!rel.contains("alternate")) { 123 if (!rel.contains("alternate")) {
123 collections->setPreferredStylesheetSetName(title); 124 collections->setPreferredStylesheetSetName(title);
124 collections->setSelectedStylesheetSetName(title); 125 collections->setSelectedStylesheetSetName(title);
125 } 126 }
126 } 127 }
127 128
128 continue; 129 continue;
129 } 130 }
130 sheet = linkElement->sheet(); 131 sheet = linkElement->sheet();
131 if (!sheet) 132 if (!sheet)
132 title = nullAtom; 133 title = nullAtom;
133 } else if (n->isSVGElement() && n->hasTagName(SVGNames::styleTag)) { 134 } else if (n->isSVGElement() && n->hasTagName(SVGNames::styleTag)) {
134 sheet = static_cast<SVGStyleElement*>(n)->sheet(); 135 sheet = static_cast<SVGStyleElement*>(n)->sheet();
136 } else if (n->hasTagName(styleTag)) {
137 sheet = static_cast<HTMLStyleElement*>(n)->sheet();
135 } else { 138 } else {
136 sheet = static_cast<HTMLStyleElement*>(n)->sheet(); 139 sheet = static_cast<HTMLMetaElement*>(n)->sheet();
137 } 140 }
138 141
139 if (sheet && !sheet->disabled() && sheet->isCSSStyleSheet()) 142 if (sheet && !sheet->disabled() && sheet->isCSSStyleSheet())
140 activeSheet = static_cast<CSSStyleSheet*>(sheet); 143 activeSheet = static_cast<CSSStyleSheet*>(sheet);
141 144
142 // Check to see if this sheet belongs to a styleset 145 // Check to see if this sheet belongs to a styleset
143 // (thus making it PREFERRED or ALTERNATE rather than 146 // (thus making it PREFERRED or ALTERNATE rather than
144 // PERSISTENT). 147 // PERSISTENT).
145 AtomicString rel = e->getAttribute(relAttr); 148 AtomicString rel = e->getAttribute(relAttr);
146 if (!enabledViaScript && sheet && !title.isEmpty()) { 149 if (!enabledViaScript && sheet && !title.isEmpty()) {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 void StyleSheetCollection::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const 287 void StyleSheetCollection::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
285 { 288 {
286 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); 289 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
287 info.addMember(m_activeAuthorStyleSheets, "activeAuthorStyleSheets"); 290 info.addMember(m_activeAuthorStyleSheets, "activeAuthorStyleSheets");
288 info.addMember(m_styleSheetsForStyleSheetList, "styleSheetsForStyleSheetList "); 291 info.addMember(m_styleSheetsForStyleSheetList, "styleSheetsForStyleSheetList ");
289 info.addMember(m_styleSheetCandidateNodes, "styleSheetCandidateNodes"); 292 info.addMember(m_styleSheetCandidateNodes, "styleSheetCandidateNodes");
290 info.addMember(m_treeScope, "treeScope"); 293 info.addMember(m_treeScope, "treeScope");
291 } 294 }
292 295
293 } 296 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698