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

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

Issue 63383003: Remove mediawiki stylesheet hack (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 // If we're loading a stylesheet cross-origin, and the MIME type is not stan dard, require the CSS 286 // If we're loading a stylesheet cross-origin, and the MIME type is not stan dard, require the CSS
287 // to at least start with a syntactically valid CSS rule. 287 // to at least start with a syntactically valid CSS rule.
288 // This prevents an attacker playing games by injecting CSS strings into HTM L, XML, JSON, etc. etc. 288 // This prevents an attacker playing games by injecting CSS strings into HTM L, XML, JSON, etc. etc.
289 if (!hasValidMIMEType && !hasSyntacticallyValidCSSHeader()) { 289 if (!hasValidMIMEType && !hasSyntacticallyValidCSSHeader()) {
290 bool isCrossOriginCSS = !securityOrigin || !securityOrigin->canRequest(b aseURL()); 290 bool isCrossOriginCSS = !securityOrigin || !securityOrigin->canRequest(b aseURL());
291 if (isCrossOriginCSS) { 291 if (isCrossOriginCSS) {
292 clearRules(); 292 clearRules();
293 return; 293 return;
294 } 294 }
295 } 295 }
296 if (!quirksMode && m_parserContext.needsSiteSpecificQuirks) {
297 // Work around <https://bugs.webkit.org/show_bug.cgi?id=28350>.
298 DEFINE_STATIC_LOCAL(const String, mediaWikiKHTMLFixesStyleSheet, ("/* KH TML fix stylesheet */\n/* work around the horizontal scrollbars */\n#column-cont ent { margin-left: 0; }\n\n"));
299 // There are two variants of KHTMLFixes.css. One is equal to mediaWikiKH TMLFixesStyleSheet,
300 // while the other lacks the second trailing newline.
301 if (baseURL().string().endsWith("/KHTMLFixes.css") && !sheetText.isNull( ) && mediaWikiKHTMLFixesStyleSheet.startsWith(sheetText)
302 && sheetText.length() >= mediaWikiKHTMLFixesStyleSheet.length() - 1)
303 clearRules();
304 }
305 } 296 }
306 297
307 bool StyleSheetContents::parseString(const String& sheetText) 298 bool StyleSheetContents::parseString(const String& sheetText)
308 { 299 {
309 return parseStringAtPosition(sheetText, TextPosition::minimumPosition(), fal se); 300 return parseStringAtPosition(sheetText, TextPosition::minimumPosition(), fal se);
310 } 301 }
311 302
312 bool StyleSheetContents::parseStringAtPosition(const String& sheetText, const Te xtPosition& startPosition, bool createdByParser) 303 bool StyleSheetContents::parseStringAtPosition(const String& sheetText, const Te xtPosition& startPosition, bool createdByParser)
313 { 304 {
314 CSSParser p(parserContext(), UseCounter::getFrom(this)); 305 CSSParser p(parserContext(), UseCounter::getFrom(this));
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 m_isInMemoryCache = false; 495 m_isInMemoryCache = false;
505 } 496 }
506 497
507 void StyleSheetContents::shrinkToFit() 498 void StyleSheetContents::shrinkToFit()
508 { 499 {
509 m_importRules.shrinkToFit(); 500 m_importRules.shrinkToFit();
510 m_childRules.shrinkToFit(); 501 m_childRules.shrinkToFit();
511 } 502 }
512 503
513 } 504 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698