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

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

Issue 1616423003: Fix selector namespace prefix resolution. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed review issues Created 4 years, 11 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 if (prefix.isNull()) { 306 if (prefix.isNull()) {
307 m_defaultNamespace = uri; 307 m_defaultNamespace = uri;
308 return; 308 return;
309 } 309 }
310 PrefixNamespaceURIMap::AddResult result = m_namespaces.add(prefix, uri); 310 PrefixNamespaceURIMap::AddResult result = m_namespaces.add(prefix, uri);
311 if (result.isNewEntry) 311 if (result.isNewEntry)
312 return; 312 return;
313 result.storedValue->value = uri; 313 result.storedValue->value = uri;
314 } 314 }
315 315
316 const AtomicString& StyleSheetContents::determineNamespace(const AtomicString& p refix) 316 const AtomicString& StyleSheetContents::namespaceURIFromPrefix(const AtomicStrin g& prefix)
317 { 317 {
318 if (prefix.isNull())
319 return defaultNamespace();
320 if (prefix.isEmpty())
321 return emptyAtom; // No namespace. If an element/attribute has a namespa ce, we won't match it.
322 if (prefix == starAtom)
323 return starAtom; // We'll match any namespace.
324 return m_namespaces.get(prefix); 318 return m_namespaces.get(prefix);
325 } 319 }
326 320
327 void StyleSheetContents::parseAuthorStyleSheet(const CSSStyleSheetResource* cach edStyleSheet, const SecurityOrigin* securityOrigin) 321 void StyleSheetContents::parseAuthorStyleSheet(const CSSStyleSheetResource* cach edStyleSheet, const SecurityOrigin* securityOrigin)
328 { 322 {
329 TRACE_EVENT1("blink,devtools.timeline", "ParseAuthorStyleSheet", "data", Ins pectorParseAuthorStyleSheetEvent::data(cachedStyleSheet)); 323 TRACE_EVENT1("blink,devtools.timeline", "ParseAuthorStyleSheet", "data", Ins pectorParseAuthorStyleSheetEvent::data(cachedStyleSheet));
330 324
331 bool isSameOriginRequest = securityOrigin && securityOrigin->canRequest(base URL()); 325 bool isSameOriginRequest = securityOrigin && securityOrigin->canRequest(base URL());
332 CSSStyleSheetResource::MIMETypeCheck mimeTypeCheck = isQuirksModeBehavior(m_ parserContext.mode()) && isSameOriginRequest ? CSSStyleSheetResource::MIMETypeCh eck::Lax : CSSStyleSheetResource::MIMETypeCheck::Strict; 326 CSSStyleSheetResource::MIMETypeCheck mimeTypeCheck = isQuirksModeBehavior(m_ parserContext.mode()) && isSameOriginRequest ? CSSStyleSheetResource::MIMETypeCh eck::Lax : CSSStyleSheetResource::MIMETypeCheck::Strict;
333 String sheetText = cachedStyleSheet->sheetText(mimeTypeCheck); 327 String sheetText = cachedStyleSheet->sheetText(mimeTypeCheck);
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 visitor->trace(m_importRules); 669 visitor->trace(m_importRules);
676 visitor->trace(m_namespaceRules); 670 visitor->trace(m_namespaceRules);
677 visitor->trace(m_childRules); 671 visitor->trace(m_childRules);
678 visitor->trace(m_loadingClients); 672 visitor->trace(m_loadingClients);
679 visitor->trace(m_completedClients); 673 visitor->trace(m_completedClients);
680 visitor->trace(m_ruleSet); 674 visitor->trace(m_ruleSet);
681 #endif 675 #endif
682 } 676 }
683 677
684 } 678 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/StyleSheetContents.h ('k') | third_party/WebKit/Source/core/css/parser/CSSParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698