+ All Categories
Home > Technology > Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

Date post: 20-Jan-2015
Category:
Upload: makoto-kato
View: 5,233 times
Download: 1 times
Share this document with a friend
Description:
Presentation of W3C HTML5 Japanese Interest Group at 22 Jan 2010
Popular Tags:
28
Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later Makoto Kato Technical Advisor, Mozilla Japan
Transcript
Page 1: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

Web Technology features with Firefox 3.6 / Gecko 1.9.2

and later

Makoto KatoTechnical Advisor, Mozilla Japan

Page 2: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

Agenda

• Firefox 3.6 / Gecko 1.9.2やそれ以降のバージョンでサポートされる新たな規格

• File API (Firefox 3.6 / Gecko 1.9.2)

• CSS Gradients (Firefox 3.6 / Gecko 1.9.2)

• Web Open Font Format (Firefox 3.6 / Gecko 1.9.2)

• WebGL (Firefox.next / Gecko 1.9.3)

• Demo

Page 3: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

File API

Page 4: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

File API

• <input type=“file”>で選択されたローカルフゔルへのゕクセスを提供

• ユーザーの操作にてフゔルを指定する

• valueはそもそもJavaScriptから変更不可

• FileReaderを経由したフゔルゕクセス

• HTML5 Drag & Dropと組み合わせると、ブラウザウゖンドウへのDrag & Dropでフゔルにゕクセスすることが可能

Page 5: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

File API

• Fileンターフェス

• フゔル名、種類などの取得

• FileReader ンターフェス

• フゔルゕクセスのンターフェスを提供

• バナリ / テキスト / DataURLとして読み込む

• エラー、進捗、完了などのベントを提供

• resultプロパテゖに読み込んだ内容が入る

• FileReaderSync ンターフェス

• 同期ゕクセス用

• 現時点でFirefox / Geckoでは未実装

• readAs*メソッドはFileException例外をスローする

Page 6: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

使い方 – File API

<input type=“file” id=“upload” /><input type=“button” onclick=“clickbutton()” />

<script type=“text/javascript”>function clickbutton() {

var file = document.getElementById(“upload”).files;for (var i = 0; i < files.length; i++) {

var file = files[i];processFile(file); // フゔル処理

}}

function processFile(file) {var reader = new FileReader();reader.readAsText(file); // テキストとして読み込むreader.onload = function () { /* 完了 */

window.alert(reader.result); };reader.onprogress = function (event) { /* 進捗ベント */ };

}</script>

Page 7: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

使い方 (w/ HTML5 Drag & Drop)

<div id=“droptarget”>…</div>

<script type=“text/javascript”>document.getElementById(“droptarget”).addEventListener("drop", dropEvent, true);

function dropEvent(event) {var files = event.dataTransfer.files;

for (var i = 0; i < files.length; i++) {var file = files[i];processFile(file); // フゔル処理

}}</script>

Page 8: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

CSS Gradients

Page 9: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

CSS Gradients

• 現時点で定義されている形は2つ

• Linear

• Radial

• 繰り返しの形式(repeating)もサポート

• 先に実装されたWebKitでは構文が異なる

• WebKitでの先に行われた実装 (例: linear)

• background: -webkit-gradient(linear, left top, left bottom, from(white), to(gray));

• 現在のドラフト (例: linear)

• background: linear-gradient(top, white, gray);

Page 10: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

CSS Gradients

• Firefox 3.6 / Gecko 1.9.2では、”-moz-”prefixを使う必要あり (-moz-linear-gradient)

• 画像を受け入れることができるCSSプロパテゖすべてで利用可能

• Firefox 3.6ではbackgroundくらいにしか動作しません

Page 11: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

Linear Gradients

• linear-gradient( [<point> || <angle>,]? <stop>, <stop> [, <stop>]* )

linear-gradient(top,blue,white

);

linear-gradient(45deg, blue,white);

Page 12: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

Radial Gradients

• radial-gradient( [<position> || <angle>,]? [<shape> || <size>,]? <stop>, <stop>[, <stop>]* )

-moz-radial-gradient(red,yellow,green

);

Page 13: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

Repeating Gradient

• Linerやradialの記述へ”repeating-”のprefixを追加

repeating-linear-gradient(top left -45deg,red,red 5px,white 5px,white 10px);

repeating-linear-gradient(top,blue 5px,white 20px);

Page 14: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

Web Open Font Format - WOFF

Page 15: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

Web Font Support

• Firefox 3.5でWebフォントをサポート

@font-face { font-family: GentiumTest; src: url(fonts.ttf); }

• OpenTypeとTrueTypeフォントのみ

Page 16: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

Web Font Support

• Firefox 3.6では新しいWebフォント形式(WOFF) をサポート

@font-face { font-family: GentiumTest; src: url(fonts.woff) format("woff"); }

• フォントベンダと共同で作成した新しいフォント形式

• OpenTypeなどよりもサズは小さい

• 現状では差分ダウンロードには対応していない

• MIMEタプは決まってない

16

Page 17: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

WebGL

Page 18: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

現状のブラウザでのレンダリング

• HTMLなどのレンダリングにはOSのAPIを利用

• GDI, Quartz, Cairo and etc…

• チップのハードウェゕ・ゕクセラレーションが使われるかどうかは、利用するAPI、OS次第

• プラグンなしでは、3D画像であってもソフトウェゕで3D画像を計算する必要がある

Page 19: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

現在のグラフィック・ハードウェア (GPU)

• 現在のAMD、NVIDIA、IntelなどのPC向けのグラフゖック・チップでは3D向けのDirectX9やOpenGLのサポートが含まれている

• モバル分野であっても、TIやQualcomm、iPhoneの最新チップセットではOpenGL ES 2.0のサポートが含まれる

Page 20: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

WebGL

• The Khronos GroupでAPI仕様の策定

• Apple、Google、Mozilla、Operaが参加

• OpenGL ES 2.0ベースのAPIをJavaScriptからゕクセス

• シェーダーやテクスチャも利用可能

• Canvasへの描画

• 最新のGecko (1.9.3) やWebKitで利用可能

• Firefoxの開発版で利用する場合は、about:configでwebgl.enabled_for_all_sitesをtrueに設定する必要あり

Page 21: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

シェーダー・サポート

• バーテックス・シェーダー

<script type=“x-shader/x-vertex”>

• フラグメント・シェーダー (ピクセル・シェーダー)

<script type=“x-shader/x-fragment”>

Page 22: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

使い方

<canvas id=“glcanvas” />

<script type=“text/javascript”>// Canvas elementの取得var canvas = document.getElementById(“glcanvas”);

// WebGLのコンテキストの取得// Geckoでは”moz-webgl”または”experimental-webgl”// WebKitでは”webkit-3d”var gl = canvas.getContext(‘webgl’);

// 描画…</script>

Page 23: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

DEMO

Page 24: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

Reference – File API

• File API Draft

• http://dev.w3.org/2006/webapi/FileAPI/

• Using files from web applications

• https://developer.mozilla.org/en/Using_files_from_web_applications

• Demo by hacks.mozilla.org

• http://hacks.mozilla.org/category/fileapi/

• http://www.youtube.com/mozhacks#p/u/2/4Us6S0fDV7U

Page 28: Web Technology features with Firefox 3.6 / Gecko 1.9.2 and later

Any Question?


Recommended