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

Unified Diff: sky/framework/elements/sky-input.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-ink-splash.sky ('k') | sky/framework/elements/sky-menu-divider.sky » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/elements/sky-input.sky
diff --git a/sky/framework/elements/sky-input.sky b/sky/framework/elements/sky-input.sky
deleted file mode 100644
index abc63113c2e26dd9296a91d207f055890b4def4e..0000000000000000000000000000000000000000
--- a/sky/framework/elements/sky-input.sky
+++ /dev/null
@@ -1,79 +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 name="sky-input" attributes="value:string">
-<template>
- <style>
- :host {
- display: flex;
- flex-direction: row;
- }
- #control {
- margin: 8px;
- padding: 8px;
- border-bottom: 1px solid #E7E7E7;
- flex: 1;
- align-self: center;
- height: 1.2em;
- white-space: nowrap;
- overflow: hidden;
- }
- #control.focused {
- padding-bottom: 7px;
- border-bottom: 2px solid #009cf3;
- }
- </style>
- <div id="control" contenteditable />
-</template>
-<script>
-import "dart:sky";
-
-// TODO(abarth): Connect to the mojo:keyboard service.
-
-@Tagname('sky-input')
-class SkyInput extends SkyElement {
- Element _control;
-
- static String _textForValue(String value) => value == null ? '' : value;
-
- shadowRootReady() {
- _control = shadowRoot.getElementById('control');
- _control.setChild(new Text(_textForValue(getAttribute('text'))));
- _control.addEventListener('focus', _handleFocus);
- _control.addEventListener('blur', _handleBlur);
- _control.addEventListener('keydown', _handleKeyDown);
- }
-
- String get text => _control == null ? null : _control.textContent;
-
- void textChanged(String oldValue, String newValue) {
- if (_control != null)
- _control.setChild(new Text(_textForValue(newValue)));
- }
-
- void _handleKeyDown(KeyboardEvent event) {
- // TODO(abarth): You can still get newlines if the user pastes them.
- if (event.key == 0xD)
- event.preventDefault();
- }
-
- void _handleFocus(_) {
- if (_control)
- _control.setAttribute('class', 'focused');
- // TODO(abarth): Show the keyboard.
- }
-
- void _handleBlur(_) {
- if (_control)
- _control.removeAttribute('class');
- // TODO(abarth): Hide the keyboard.
- }
-}
-
-_init(script) => register(script, SkyInput);
-</script>
-</sky-element>
« no previous file with comments | « sky/framework/elements/sky-ink-splash.sky ('k') | sky/framework/elements/sky-menu-divider.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698