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

Unified Diff: sky/framework/elements/sky-icon.sky

Issue 1132063007: Rationalize Dart mojo and sky package structure (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 7 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 | « sky/framework/elements/sky-element.sky ('k') | sky/framework/elements/sky-ink-splash.sky » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/elements/sky-icon.sky
diff --git a/sky/framework/elements/sky-icon.sky b/sky/framework/elements/sky-icon.sky
deleted file mode 100644
index dd2a10f7f656e64ea1ef3dc92ee892250c3662ad..0000000000000000000000000000000000000000
--- a/sky/framework/elements/sky-icon.sky
+++ /dev/null
@@ -1,57 +0,0 @@
-<!--
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
--->
-<import src="sky-element.sky" />
-
-<sky-element attributes="type:string, size:number">
-<template>
- <img />
-</template>
-<script>
-import "dart:sky";
-
-const String kAssetBase = '/sky/assets/material-design-icons';
-
-@Tagname('sky-icon')
-class SkyIcon extends SkyElement {
- Element _img;
-
- void _setSize(int size) {
- _img.style['height'] = '${size}px';
- _img.style['width'] = '${size}px';
- }
-
- void _setSrc(String type, int size) {
- List<String> parts = type.split('/');
- if (parts.length < 2)
- return;
- String category = parts[0];
- String subtype = parts[1];
- _img.src = '${kAssetBase}/${category}/2x_web/ic_${subtype}_${size}dp.png';
- }
-
- void shadowRootReady() {
- _img = shadowRoot.firstElementChild;
- int size = this.size.floor();
- _setSize(size);
- _setSrc(type, size);
- }
-
- void typeChanged(String oldValue, String newValue) {
- if (_img != null)
- _setSrc(newValue, size.floor());
- }
-
- void sizeChanged(double oldValue, double newValue) {
- if (_img != null) {
- _setSize(newValue.floor());
- _setSrc(type, newValue.floor());
- }
- }
-}
-
-_init(script) => register(script, SkyIcon);
-</script>
-</sky-element>
« no previous file with comments | « sky/framework/elements/sky-element.sky ('k') | sky/framework/elements/sky-ink-splash.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698