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

Unified Diff: pkg/shadow_dom/lib/src/platform/patches-shadow-css.js

Issue 34873005: use ShadowCSS directly (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/shadow_dom/lib/src/platform/ShadowCSS.js ('k') | pkg/shadow_dom/tool/build.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/shadow_dom/lib/src/platform/patches-shadow-css.js
diff --git a/pkg/shadow_dom/lib/src/platform/patches-shadow-css.js b/pkg/shadow_dom/lib/src/platform/patches-shadow-css.js
deleted file mode 100644
index 952557070a4aaeed351b9f937c48fb1ae5a3064b..0000000000000000000000000000000000000000
--- a/pkg/shadow_dom/lib/src/platform/patches-shadow-css.js
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-(function(scope) {
- // TODO(terry): Remove shimShadowDOMStyling2 until wrap/unwrap from a
- // dart:html Element to a JS DOM node is available.
- /**
- * Given the content of a STYLE tag and the name of a component shim the CSS
- * and return the new scoped CSS to replace the STYLE's content. The content
- * is replaced in Dart's implementation of PolymerElement.
- */
- function shimShadowDOMStyling2(styleContent, name) {
- if (window.ShadowDOMPolyfill) {
- var content = this.convertPolyfillDirectives(styleContent, name);
-
- // applyShimming calls shimAtHost and shipScoping
- // shimAtHost code:
- var r = '', l=0, matches;
- while (matches = hostRuleRe.exec(content)) {
- r += content.substring(l, matches.index);
- r += this.scopeHostCss(matches[1], name);
- l = hostRuleRe.lastIndex;
- }
- r += content.substring(l, content.length);
- var re = new RegExp('^' + name + selectorReSuffix, 'm');
- var atHostCssText = rulesToCss(this.findAtHostRules(cssToRules(r), re));
-
- // shimScoping code:
- // strip comments for easier processing
- content = content.replace(cssCommentRe, '');
-
- content = this.convertPseudos(content);
- var rules = cssToRules(content);
- var cssText = this.scopeRules(rules, name);
-
- return atHostCssText + cssText;
- }
- }
-
- // Minimal copied code from ShadowCSS, that is not exposed in
- // PlatForm.ShadowCSS (local code).
- var hostRuleRe = /@host[^{]*{(([^}]*?{[^{]*?}[\s\S]*?)+)}/gim,
- cssCommentRe = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,
- selectorReSuffix = '([>\\s~+\[.,{:][\\s\\S]*)?$';
-
- function cssToRules(cssText) {
- var style = document.createElement('style');
- style.textContent = cssText;
- document.head.appendChild(style);
- var rules = style.sheet.cssRules;
- style.parentNode.removeChild(style);
- return rules;
- }
-
- function rulesToCss(cssRules) {
- for (var i=0, css=[]; i < cssRules.length; i++) {
- css.push(cssRules[i].cssText);
- }
- return css.join('\n\n');
- }
-
- // exports
- scope.ShadowCSS.shimShadowDOMStyling2 = shimShadowDOMStyling2;
-})(window.Platform);
« no previous file with comments | « pkg/shadow_dom/lib/src/platform/ShadowCSS.js ('k') | pkg/shadow_dom/tool/build.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698