diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-01-04 14:17:57 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-01-05 10:05:06 +0000 |
commit | 39d357e3248f80abea0159765ff39554affb40db (patch) | |
tree | aba0e6bfb76de0244bba0f5fdbd64b830dd6e621 /chromium/third_party/catapult/third_party/polymer/components/paper-ripple | |
parent | 87778abf5a1f89266f37d1321b92a21851d8244d (diff) | |
download | qtwebengine-chromium-39d357e3248f80abea0159765ff39554affb40db.tar.gz |
BASELINE: Update Chromium to 55.0.2883.105
And updates ninja to 1.7.2
Change-Id: I20d43c737f82764d857ada9a55586901b18b9243
Reviewed-by: Michael Brüning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/catapult/third_party/polymer/components/paper-ripple')
9 files changed, 1500 insertions, 0 deletions
diff --git a/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/.bower.json b/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/.bower.json new file mode 100644 index 00000000000..fc0feff6497 --- /dev/null +++ b/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/.bower.json @@ -0,0 +1,45 @@ +{ + "name": "paper-ripple", + "version": "1.0.8", + "license": "http://polymer.github.io/LICENSE.txt", + "description": "Adds a material design ripple to any container", + "private": true, + "authors": [ + "The Polymer Authors" + ], + "keywords": [ + "web-components", + "polymer", + "ripple" + ], + "repository": { + "type": "git", + "url": "git://github.com/PolymerElements/paper-ripple.git" + }, + "main": "paper-ripple.html", + "dependencies": { + "iron-a11y-keys-behavior": "polymerelements/iron-a11y-keys-behavior#^1.1.5", + "polymer": "Polymer/polymer#^1.1.0" + }, + "devDependencies": { + "iron-component-page": "polymerelements/iron-component-page#^1.0.0", + "iron-icon": "polymerelements/iron-icon#^1.0.0", + "iron-icons": "polymerelements/iron-icons#^1.0.0", + "iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0", + "paper-styles": "polymerelements/paper-styles#^1.0.0", + "test-fixture": "polymerelements/test-fixture#^1.0.0", + "web-component-tester": "^4.0.0", + "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" + }, + "ignore": [], + "homepage": "https://github.com/PolymerElements/paper-ripple", + "_release": "1.0.8", + "_resolution": { + "type": "version", + "tag": "v1.0.8", + "commit": "eb1c01cac162b7ce7e78760d5c0df61c9a5c2974" + }, + "_source": "git://github.com/PolymerElements/paper-ripple.git", + "_target": "^1.0.0", + "_originalSource": "PolymerElements/paper-ripple" +}
\ No newline at end of file diff --git a/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/.travis.yml b/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/.travis.yml new file mode 100644 index 00000000000..c4c91b4e018 --- /dev/null +++ b/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/.travis.yml @@ -0,0 +1,23 @@ +language: node_js +sudo: required +before_script: + - npm install -g bower polylint web-component-tester + - bower install + - polylint +env: + global: + - secure: YrC5bTrJwlszZQWfnRwDbLaZNLf+KnWXTAfzvul7eij21W3/v+E0wp9pFTLQj/G3bZWgOEZSsoXxASNcNu1JUmJRyLXpJgTps25IlS/VJTRHoK7jUjt5pJG1CbcgTixQblyOVtPqT6j0V23V0d3mhQ3H2xFBbcl87iYO1w+6nmQ= + - secure: NZv74uwtibMbmarEOWRUNkEwjz/2akWEIe2JDxglag2JUECWrcAKJIQUqYsO0KNUIg09xJEqWLWED4fN73p3z27Jl/z99ssVMvPQt8duoxwZ6UwcjVWUQNjgXKN6JDZCf+3hJsmU51Lp6mpzj0Y5m8nCjhh7/bBnJahH+VRm7bA= +node_js: stable +addons: + firefox: '46.0' + apt: + sources: + - google-chrome + packages: + - google-chrome-stable + sauce_connect: true +script: + - xvfb-run wct + - "if [ \"${TRAVIS_PULL_REQUEST}\" = \"false\" ]; then wct -s 'default'; fi" +dist: trusty diff --git a/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/CONTRIBUTING.md b/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/CONTRIBUTING.md new file mode 100644 index 00000000000..093090d4354 --- /dev/null +++ b/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/CONTRIBUTING.md @@ -0,0 +1,77 @@ +<!-- +This file is autogenerated based on +https://github.com/PolymerElements/ContributionGuide/blob/master/CONTRIBUTING.md + +If you edit that file, it will get updated everywhere else. +If you edit this file, your changes will get overridden :) + +You can however override the jsbin link with one that's customized to this +specific element: + +jsbin=https://jsbin.com/cagaye/edit?html,output +--> + +# Polymer Elements +## Guide for Contributors + +Polymer Elements are built in the open, and the Polymer authors eagerly encourage any and all forms of community contribution. When contributing, please follow these guidelines: + +### Filing Issues + +**If you are filing an issue to request a feature**, please provide a clear description of the feature. It can be helpful to describe answers to the following questions: + + 1. **Who will use the feature?** _“As someone filling out a form…”_ + 2. **When will they use the feature?** _“When I enter an invalid value…”_ + 3. **What is the user’s goal?** _“I want to be visually notified that the value needs to be corrected…”_ + +**If you are filing an issue to report a bug**, please provide: + + 1. **A clear description of the bug and related expectations.** Consider using the following example template for reporting a bug: + + ```markdown + The `paper-foo` element causes the page to turn pink when clicked. + + ## Expected outcome + + The page stays the same color. + + ## Actual outcome + + The page turns pink. + + ## Steps to reproduce + + 1. Put a `paper-foo` element in the page. + 2. Open the page in a web browser. + 3. Click the `paper-foo` element. + ``` + + 2. **A reduced test case that demonstrates the problem.** If possible, please include the test case as a JSBin. Start with this template to easily import and use relevant Polymer Elements: [https://jsbin.com/cagaye/edit?html,output](https://jsbin.com/cagaye/edit?html,output). + + 3. **A list of browsers where the problem occurs.** This can be skipped if the problem is the same across all browsers. + +### Submitting Pull Requests + +**Before creating a pull request**, please ensure that an issue exists for the corresponding change in the pull request that you intend to make. **If an issue does not exist, please create one per the guidelines above**. The goal is to discuss the design and necessity of the proposed change with Polymer authors and community before diving into a pull request. + +When submitting pull requests, please provide: + + 1. **A reference to the corresponding issue** or issues that will be closed by the pull request. Please refer to these issues in the pull request description using the following syntax: + + ```markdown + (For a single issue) + Fixes #20 + + (For multiple issues) + Fixes #32, fixes #40 + ``` + + 2. **A succinct description of the design** used to fix any related issues. For example: + + ```markdown + This fixes #20 by removing styles that leaked which would cause the page to turn pink whenever `paper-foo` is clicked. + ``` + + 3. **At least one test for each bug fixed or feature added** as part of the pull request. Pull requests that fix bugs or add features without accompanying tests will not be considered. + +If a proposed change contains multiple commits, please [squash commits](https://www.google.com/url?q=http://blog.steveklabnik.com/posts/2012-11-08-how-to-squash-commits-in-a-github-pull-request) to as few as is necessary to succinctly express the change. A Polymer author can help you squash commits, so don’t be afraid to ask us if you need help with that! diff --git a/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/README.md b/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/README.md new file mode 100644 index 00000000000..359b131959a --- /dev/null +++ b/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/README.md @@ -0,0 +1,90 @@ + +<!--- + +This README is automatically generated from the comments in these files: +paper-ripple.html + +Edit those files, and our readme bot will duplicate them over here! +Edit this file, and the bot will squash your changes :) + +The bot does some handling of markdown. Please file a bug if it does the wrong +thing! https://github.com/PolymerLabs/tedium/issues + +--> + +[![Build status](https://travis-ci.org/PolymerElements/paper-ripple.svg?branch=master)](https://travis-ci.org/PolymerElements/paper-ripple) + +_[Demo and API docs](https://elements.polymer-project.org/elements/paper-ripple)_ + + +##<paper-ripple> + +Material design: [Surface reaction](https://www.google.com/design/spec/animation/responsive-interaction.html#responsive-interaction-surface-reaction) + +`paper-ripple` provides a visual effect that other paper elements can +use to simulate a rippling effect emanating from the point of contact. The +effect can be visualized as a concentric circle with motion. + +Example: + +```html +<div style="position:relative"> + <paper-ripple></paper-ripple> +</div> +``` + +Note, it's important that the parent container of the ripple be relative position, otherwise +the ripple will emanate outside of the desired container. + +`paper-ripple` listens to "mousedown" and "mouseup" events so it would display ripple +effect when touches on it. You can also defeat the default behavior and +manually route the down and up actions to the ripple element. Note that it is +important if you call `downAction()` you will have to make sure to call +`upAction()` so that `paper-ripple` would end the animation loop. + +Example: + +```html +<paper-ripple id="ripple" style="pointer-events: none;"></paper-ripple> +... +downAction: function(e) { + this.$.ripple.downAction({detail: {x: e.x, y: e.y}}); +}, +upAction: function(e) { + this.$.ripple.upAction(); +} +``` + +Styling ripple effect: + + Use CSS color property to style the ripple: + +```css +paper-ripple { + color: #4285f4; +} +``` + + Note that CSS color property is inherited so it is not required to set it on + the `paper-ripple` element directly. + +By default, the ripple is centered on the point of contact. Apply the `recenters` +attribute to have the ripple grow toward the center of its container. + +```html +<paper-ripple recenters></paper-ripple> +``` + +You can also center the ripple inside its container from the start. + +```html +<paper-ripple center></paper-ripple> +``` + +Apply `circle` class to make the rippling effect within a circle. + +```html +<paper-ripple class="circle"></paper-ripple> +``` + + diff --git a/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/bower.json b/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/bower.json new file mode 100644 index 00000000000..1fce5584770 --- /dev/null +++ b/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/bower.json @@ -0,0 +1,35 @@ +{ + "name": "paper-ripple", + "version": "1.0.8", + "license": "http://polymer.github.io/LICENSE.txt", + "description": "Adds a material design ripple to any container", + "private": true, + "authors": [ + "The Polymer Authors" + ], + "keywords": [ + "web-components", + "polymer", + "ripple" + ], + "repository": { + "type": "git", + "url": "git://github.com/PolymerElements/paper-ripple.git" + }, + "main": "paper-ripple.html", + "dependencies": { + "iron-a11y-keys-behavior": "polymerelements/iron-a11y-keys-behavior#^1.1.5", + "polymer": "Polymer/polymer#^1.1.0" + }, + "devDependencies": { + "iron-component-page": "polymerelements/iron-component-page#^1.0.0", + "iron-icon": "polymerelements/iron-icon#^1.0.0", + "iron-icons": "polymerelements/iron-icons#^1.0.0", + "iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0", + "paper-styles": "polymerelements/paper-styles#^1.0.0", + "test-fixture": "polymerelements/test-fixture#^1.0.0", + "web-component-tester": "^4.0.0", + "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" + }, + "ignore": [] +} diff --git a/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/demo/index.html b/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/demo/index.html new file mode 100644 index 00000000000..e12cde5c080 --- /dev/null +++ b/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/demo/index.html @@ -0,0 +1,415 @@ +<!-- +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt +Code distributed by Google as part of the polymer project is also +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt +--> +<!doctype html> +<html> +<head> + <title>paper-ripple demo</title> + + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> + <meta name="mobile-web-app-capable" content="yes"> + <meta name="apple-mobile-web-app-capable" content="yes"> + + <script src="../../webcomponentsjs/webcomponents-lite.js"></script> + + <link rel="import" href="../../iron-icons/iron-icons.html"> + <link rel="import" href="../paper-ripple.html"> + <link rel="import" href="../../paper-styles/typography.html"> + <link rel="import" href="../../iron-icon/iron-icon.html"> + + <style> + + body { + background-color: #f9f9f9; + font-family: RobotoDraft, 'Helvetica Neue', Helvetica, Arial; + -webkit-tap-highlight-color: rgba(0,0,0,0); + -webkit-touch-callout: none; + } + + section { + padding: 30px 25px; + } + + section > * { + margin: 10px + } + + /* Button */ + .button { + display: inline-block; + position: relative; + width: 120px; + height: 32px; + line-height: 32px; + border-radius: 2px; + font-size: 0.9em; + background-color: #fff; + color: #646464; + } + + .button > paper-ripple { + border-radius: 2px; + overflow: hidden; + } + + .button.narrow { + width: 60px; + } + + .button.grey { + background-color: #eee; + } + + .button.blue { + background-color: #4285f4; + color: #fff; + } + + .button.green { + background-color: #0f9d58; + color: #fff; + } + + .button.raised { + transition: box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1); + transition-delay: 0.2s; + box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26); + } + + .button.raised:active { + box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2); + transition-delay: 0s; + } + + /* Icon Button */ + .icon-button { + position: relative; + display: inline-block; + width: 56px; + height: 56px; + } + + .icon-button > iron-icon { + margin: 16px; + transition: -webkit-transform 0.2s cubic-bezier(0.4, 0, 0.2, 1); + transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1); + } + + .icon-button:hover > iron-icon { + -webkit-transform: scale(1.2); + transform: scale(1.2); + } + + .icon-button > paper-ripple { + overflow: hidden; + color: #646464; + } + + .icon-button.red > iron-icon::shadow path { + fill: #db4437; + } + + .icon-button.red > paper-ripple { + color: #db4437; + } + + .icon-button.blue > iron-icon::shadow path { + fill: #4285f4; + } + + .icon-button.blue > paper-ripple { + color: #4285f4; + } + + /* FAB */ + .fab { + position: relative; + display: inline-block; + width: 56px; + height: 56px; + border-radius: 50%; + color: #fff; + overflow: hidden; + transition: box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1); + transition-delay: 0.2s; + box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26); + } + + .fab.red { + background-color: #d23f31; + } + + .fab.blue { + background-color: #4285f4; + } + + .fab.green { + background-color: #0f9d58; + } + + .fab:active { + box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2); + transition-delay: 0s; + } + + .fab > iron-icon { + margin: 16px; + } + + .fab > iron-icon::shadow path { + fill: #fff; + } + + /* Menu */ + .menu { + display: inline-block; + width: 180px; + background-color: #fff; + box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2); + } + + .item { + position: relative; + height: 48px; + line-height: 48px; + color: #646464; + font-size: 0.9em; + } + + .menu.blue > .item { + color: #4285f4; + } + + /* Card, Dialog */ + .card, .dialog { + position: relative; + display: inline-block; + width: 300px; + height: 240px; + vertical-align: top; + background-color: #fff; + box-shadow: 0 12px 15px 0 rgba(0, 0, 0, 0.24); + } + + .dialog { + box-sizing: border-box; + padding: 16px; + } + + .dialog > .content { + height: 170px; + font-size: 0.9em; + } + + .dialog > .content > .title { + font-size: 1.3em; + } + + .dialog > .button { + width: 90px; + float: right; + } + + .card.image { + background: url(http://lorempixel.com/300/240/nature/); + color: #fff; + } + + /* Misc */ + .center { + text-align: center; + } + + .label { + padding: 0 16px; + } + + .label-blue { + color: #4285f4; + } + + .label-red { + color: #d23f31; + } + + </style> + +</head> +<body> + + <section> + + <div class="button raised"> + <div class="center" fit tabindex="1">SUBMIT</div> + <paper-ripple></paper-ripple> + </div> + + <div class="button raised" noink> + <div class="center" fit tabindex="1">NO INK</div> + <paper-ripple noink></paper-ripple> + </div> + + <div class="button raised grey"> + <div class="center" fit tabindex="1">CANCEL</div> + <paper-ripple></paper-ripple> + </div> + + <div class="button raised blue"> + <div class="center" fit tabindex="1">COMPOSE</div> + <paper-ripple></paper-ripple> + </div> + + <div class="button raised green"> + <div class="center" fit tabindex="1">OK</div> + <paper-ripple></paper-ripple> + </div> + + </section> + + <section> + + <div class="button raised grey narrow"> + <div class="center" fit tabindex="1">+1</div> + <paper-ripple></paper-ripple> + </div> + + <div class="button raised grey narrow label-blue"> + <div class="center" fit tabindex="1">+1</div> + <paper-ripple></paper-ripple> + </div> + + <div class="button raised grey narrow label-red"> + <div class="center" fit tabindex="1">+1</div> + <paper-ripple></paper-ripple> + </div> + + </section> + + <section> + + <div class="icon-button"> + <iron-icon icon="menu" tabindex="1"></iron-icon> + <paper-ripple class="circle" recenters></paper-ripple> + </div> + + <div class="icon-button"> + <iron-icon icon="more-vert" tabindex="1"></iron-icon> + <paper-ripple class="circle" recenters></paper-ripple> + </div> + + <div class="icon-button red"> + <iron-icon icon="delete" tabindex="1"></iron-icon> + <paper-ripple class="circle" recenters></paper-ripple> + </div> + + <div class="icon-button blue"> + <iron-icon icon="account-box" tabindex="1"></iron-icon> + <paper-ripple class="circle" recenters></paper-ripple> + </div> + + </section> + + <section> + + <div class="fab red"> + <iron-icon icon="add" tabindex="1"></iron-icon> + <paper-ripple class="circle" recenters></paper-ripple> + </div> + + <div class="fab blue"> + <iron-icon icon="mail" tabindex="1"></iron-icon> + <paper-ripple class="circle" recenters></paper-ripple> + </div> + + <div class="fab green"> + <iron-icon icon="create" tabindex="1"></iron-icon> + <paper-ripple class="circle" recenters></paper-ripple> + </div> + + </section> + + <section> + + <div class="menu"> + + <div class="item"> + <div class="label" fit tabindex="1">Mark as unread</div> + <paper-ripple></paper-ripple> + </div> + <div class="item"> + <div class="label" fit tabindex="1">Mark as important</div> + <paper-ripple></paper-ripple> + </div> + <div class="item"> + <div class="label" fit tabindex="1">Add to Tasks</div> + <paper-ripple></paper-ripple> + </div> + <div class="item"> + <div class="label" fit tabindex="1">Create event</div> + <paper-ripple></paper-ripple> + </div> + + </div> + + <div class="menu blue"> + + <div class="item"> + <div class="label" fit tabindex="1">Import</div> + <paper-ripple></paper-ripple> + </div> + <div class="item"> + <div class="label" fit tabindex="1">Export</div> + <paper-ripple></paper-ripple> + </div> + <div class="item"> + <div class="label" fit tabindex="1">Print</div> + <paper-ripple></paper-ripple> + </div> + <div class="item"> + <div class="label" fit tabindex="1">Restore contacts</div> + <paper-ripple></paper-ripple> + </div> + + </div> + + </section> + + <section> + + <div class="dialog"> + + <div class="content"> + <div class="title">Permission</div><br> + <div>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.</div> + </div> + + <div class="button label-blue"> + <div class="center" fit tabindex="1">ACCEPT</div> + <paper-ripple></paper-ripple> + </div> + + <div class="button"> + <div class="center" fit tabindex="1">DECLINE</div> + <paper-ripple></paper-ripple> + </div> + + </div> + + <div class="card" tabindex="1"> + <paper-ripple recenters></paper-ripple> + </div> + + <div class="card image" tabindex="1"> + <paper-ripple recenters></paper-ripple> + </div> + + </section> + +</body> +</html> diff --git a/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/hero.svg b/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/hero.svg new file mode 100755 index 00000000000..f8a872f1e63 --- /dev/null +++ b/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/hero.svg @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + viewBox="0 0 225 126" enable-background="new 0 0 225 126" xml:space="preserve"> +<g id="background" display="none"> + <rect display="inline" fill="#B0BEC5" width="225" height="126"/> +</g> +<g id="label"> +</g> +<g id="art"> + <path d="M175,81H49V45h126V81z M51,79h122V47H51V79z"/> + <g> + <defs> + <rect id="SVGID_5_" x="50" y="46" width="124" height="34"/> + </defs> + <clipPath id="SVGID_2_"> + <use xlink:href="#SVGID_5_" overflow="visible"/> + </clipPath> + <circle opacity="0.5" clip-path="url(#SVGID_2_)" cx="84.4" cy="62.7" r="41.9"/> + <circle opacity="0.6" clip-path="url(#SVGID_2_)" cx="84.4" cy="62.7" r="26.3"/> + <circle opacity="0.6" clip-path="url(#SVGID_2_)" cx="66.4" cy="62.7" r="26.3"/> + </g> + <circle cx="50" cy="80" r="4"/> + <g id="ic_x5F_add_x0D_"> + </g> +</g> +<g id="Guides"> +</g> +</svg> diff --git a/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/index.html b/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/index.html new file mode 100644 index 00000000000..e552b0bb955 --- /dev/null +++ b/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/index.html @@ -0,0 +1,27 @@ +<!doctype html> +<!-- +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt +Code distributed by Google as part of the polymer project is also +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt +--> +<html> +<head> + + <title>paper-ripple</title> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"> + + <script src="../webcomponentsjs/webcomponents-lite.js"></script> + <link rel="import" href="../iron-component-page/iron-component-page.html"> + +</head> +<body> + + <iron-component-page></iron-component-page> + +</body> +</html> diff --git a/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/paper-ripple.html b/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/paper-ripple.html new file mode 100644 index 00000000000..c0d74e6e916 --- /dev/null +++ b/chromium/third_party/catapult/third_party/polymer/components/paper-ripple/paper-ripple.html @@ -0,0 +1,758 @@ +<!-- +@license +Copyright (c) 2014 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt +Code distributed by Google as part of the polymer project is also +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt +--> + +<link rel="import" href="../polymer/polymer.html"> +<link rel="import" href="../iron-a11y-keys-behavior/iron-a11y-keys-behavior.html"> + +<!-- +Material design: [Surface reaction](https://www.google.com/design/spec/animation/responsive-interaction.html#responsive-interaction-surface-reaction) + +`paper-ripple` provides a visual effect that other paper elements can +use to simulate a rippling effect emanating from the point of contact. The +effect can be visualized as a concentric circle with motion. + +Example: + + <div style="position:relative"> + <paper-ripple></paper-ripple> + </div> + +Note, it's important that the parent container of the ripple be relative position, otherwise +the ripple will emanate outside of the desired container. + +`paper-ripple` listens to "mousedown" and "mouseup" events so it would display ripple +effect when touches on it. You can also defeat the default behavior and +manually route the down and up actions to the ripple element. Note that it is +important if you call `downAction()` you will have to make sure to call +`upAction()` so that `paper-ripple` would end the animation loop. + +Example: + + <paper-ripple id="ripple" style="pointer-events: none;"></paper-ripple> + ... + downAction: function(e) { + this.$.ripple.downAction({detail: {x: e.x, y: e.y}}); + }, + upAction: function(e) { + this.$.ripple.upAction(); + } + +Styling ripple effect: + + Use CSS color property to style the ripple: + + paper-ripple { + color: #4285f4; + } + + Note that CSS color property is inherited so it is not required to set it on + the `paper-ripple` element directly. + +By default, the ripple is centered on the point of contact. Apply the `recenters` +attribute to have the ripple grow toward the center of its container. + + <paper-ripple recenters></paper-ripple> + +You can also center the ripple inside its container from the start. + + <paper-ripple center></paper-ripple> + +Apply `circle` class to make the rippling effect within a circle. + + <paper-ripple class="circle"></paper-ripple> + +@group Paper Elements +@element paper-ripple +@hero hero.svg +@demo demo/index.html +--> + +<dom-module id="paper-ripple"> + + <template> + <style> + :host { + display: block; + position: absolute; + border-radius: inherit; + overflow: hidden; + top: 0; + left: 0; + right: 0; + bottom: 0; + + /* See PolymerElements/paper-behaviors/issues/34. On non-Chrome browsers, + * creating a node (with a position:absolute) in the middle of an event + * handler "interrupts" that event handler (which happens when the + * ripple is created on demand) */ + pointer-events: none; + } + + :host([animating]) { + /* This resolves a rendering issue in Chrome (as of 40) where the + ripple is not properly clipped by its parent (which may have + rounded corners). See: http://jsbin.com/temexa/4 + + Note: We only apply this style conditionally. Otherwise, the browser + will create a new compositing layer for every ripple element on the + page, and that would be bad. */ + -webkit-transform: translate(0, 0); + transform: translate3d(0, 0, 0); + } + + #background, + #waves, + .wave-container, + .wave { + pointer-events: none; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + } + + #background, + .wave { + opacity: 0; + } + + #waves, + .wave { + overflow: hidden; + } + + .wave-container, + .wave { + border-radius: 50%; + } + + :host(.circle) #background, + :host(.circle) #waves { + border-radius: 50%; + } + + :host(.circle) .wave-container { + overflow: hidden; + } + </style> + + <div id="background"></div> + <div id="waves"></div> + </template> +</dom-module> +<script> + (function() { + var Utility = { + distance: function(x1, y1, x2, y2) { + var xDelta = (x1 - x2); + var yDelta = (y1 - y2); + + return Math.sqrt(xDelta * xDelta + yDelta * yDelta); + }, + + now: window.performance && window.performance.now ? + window.performance.now.bind(window.performance) : Date.now + }; + + /** + * @param {HTMLElement} element + * @constructor + */ + function ElementMetrics(element) { + this.element = element; + this.width = this.boundingRect.width; + this.height = this.boundingRect.height; + + this.size = Math.max(this.width, this.height); + } + + ElementMetrics.prototype = { + get boundingRect () { + return this.element.getBoundingClientRect(); + }, + + furthestCornerDistanceFrom: function(x, y) { + var topLeft = Utility.distance(x, y, 0, 0); + var topRight = Utility.distance(x, y, this.width, 0); + var bottomLeft = Utility.distance(x, y, 0, this.height); + var bottomRight = Utility.distance(x, y, this.width, this.height); + + return Math.max(topLeft, topRight, bottomLeft, bottomRight); + } + }; + + /** + * @param {HTMLElement} element + * @constructor + */ + function Ripple(element) { + this.element = element; + this.color = window.getComputedStyle(element).color; + + this.wave = document.createElement('div'); + this.waveContainer = document.createElement('div'); + this.wave.style.backgroundColor = this.color; + this.wave.classList.add('wave'); + this.waveContainer.classList.add('wave-container'); + Polymer.dom(this.waveContainer).appendChild(this.wave); + + this.resetInteractionState(); + } + + Ripple.MAX_RADIUS = 300; + + Ripple.prototype = { + get recenters() { + return this.element.recenters; + }, + + get center() { + return this.element.center; + }, + + get mouseDownElapsed() { + var elapsed; + + if (!this.mouseDownStart) { + return 0; + } + + elapsed = Utility.now() - this.mouseDownStart; + + if (this.mouseUpStart) { + elapsed -= this.mouseUpElapsed; + } + + return elapsed; + }, + + get mouseUpElapsed() { + return this.mouseUpStart ? + Utility.now () - this.mouseUpStart : 0; + }, + + get mouseDownElapsedSeconds() { + return this.mouseDownElapsed / 1000; + }, + + get mouseUpElapsedSeconds() { + return this.mouseUpElapsed / 1000; + }, + + get mouseInteractionSeconds() { + return this.mouseDownElapsedSeconds + this.mouseUpElapsedSeconds; + }, + + get initialOpacity() { + return this.element.initialOpacity; + }, + + get opacityDecayVelocity() { + return this.element.opacityDecayVelocity; + }, + + get radius() { + var width2 = this.containerMetrics.width * this.containerMetrics.width; + var height2 = this.containerMetrics.height * this.containerMetrics.height; + var waveRadius = Math.min( + Math.sqrt(width2 + height2), + Ripple.MAX_RADIUS + ) * 1.1 + 5; + + var duration = 1.1 - 0.2 * (waveRadius / Ripple.MAX_RADIUS); + var timeNow = this.mouseInteractionSeconds / duration; + var size = waveRadius * (1 - Math.pow(80, -timeNow)); + + return Math.abs(size); + }, + + get opacity() { + if (!this.mouseUpStart) { + return this.initialOpacity; + } + + return Math.max( + 0, + this.initialOpacity - this.mouseUpElapsedSeconds * this.opacityDecayVelocity + ); + }, + + get outerOpacity() { + // Linear increase in background opacity, capped at the opacity + // of the wavefront (waveOpacity). + var outerOpacity = this.mouseUpElapsedSeconds * 0.3; + var waveOpacity = this.opacity; + + return Math.max( + 0, + Math.min(outerOpacity, waveOpacity) + ); + }, + + get isOpacityFullyDecayed() { + return this.opacity < 0.01 && + this.radius >= Math.min(this.maxRadius, Ripple.MAX_RADIUS); + }, + + get isRestingAtMaxRadius() { + return this.opacity >= this.initialOpacity && + this.radius >= Math.min(this.maxRadius, Ripple.MAX_RADIUS); + }, + + get isAnimationComplete() { + return this.mouseUpStart ? + this.isOpacityFullyDecayed : this.isRestingAtMaxRadius; + }, + + get translationFraction() { + return Math.min( + 1, + this.radius / this.containerMetrics.size * 2 / Math.sqrt(2) + ); + }, + + get xNow() { + if (this.xEnd) { + return this.xStart + this.translationFraction * (this.xEnd - this.xStart); + } + + return this.xStart; + }, + + get yNow() { + if (this.yEnd) { + return this.yStart + this.translationFraction * (this.yEnd - this.yStart); + } + + return this.yStart; + }, + + get isMouseDown() { + return this.mouseDownStart && !this.mouseUpStart; + }, + + resetInteractionState: function() { + this.maxRadius = 0; + this.mouseDownStart = 0; + this.mouseUpStart = 0; + + this.xStart = 0; + this.yStart = 0; + this.xEnd = 0; + this.yEnd = 0; + this.slideDistance = 0; + + this.containerMetrics = new ElementMetrics(this.element); + }, + + draw: function() { + var scale; + var translateString; + var dx; + var dy; + + this.wave.style.opacity = this.opacity; + + scale = this.radius / (this.containerMetrics.size / 2); + dx = this.xNow - (this.containerMetrics.width / 2); + dy = this.yNow - (this.containerMetrics.height / 2); + + + // 2d transform for safari because of border-radius and overflow:hidden clipping bug. + // https://bugs.webkit.org/show_bug.cgi?id=98538 + this.waveContainer.style.webkitTransform = 'translate(' + dx + 'px, ' + dy + 'px)'; + this.waveContainer.style.transform = 'translate3d(' + dx + 'px, ' + dy + 'px, 0)'; + this.wave.style.webkitTransform = 'scale(' + scale + ',' + scale + ')'; + this.wave.style.transform = 'scale3d(' + scale + ',' + scale + ',1)'; + }, + + /** @param {Event=} event */ + downAction: function(event) { + var xCenter = this.containerMetrics.width / 2; + var yCenter = this.containerMetrics.height / 2; + + this.resetInteractionState(); + this.mouseDownStart = Utility.now(); + + if (this.center) { + this.xStart = xCenter; + this.yStart = yCenter; + this.slideDistance = Utility.distance( + this.xStart, this.yStart, this.xEnd, this.yEnd + ); + } else { + this.xStart = event ? + event.detail.x - this.containerMetrics.boundingRect.left : + this.containerMetrics.width / 2; + this.yStart = event ? + event.detail.y - this.containerMetrics.boundingRect.top : + this.containerMetrics.height / 2; + } + + if (this.recenters) { + this.xEnd = xCenter; + this.yEnd = yCenter; + this.slideDistance = Utility.distance( + this.xStart, this.yStart, this.xEnd, this.yEnd + ); + } + + this.maxRadius = this.containerMetrics.furthestCornerDistanceFrom( + this.xStart, + this.yStart + ); + + this.waveContainer.style.top = + (this.containerMetrics.height - this.containerMetrics.size) / 2 + 'px'; + this.waveContainer.style.left = + (this.containerMetrics.width - this.containerMetrics.size) / 2 + 'px'; + + this.waveContainer.style.width = this.containerMetrics.size + 'px'; + this.waveContainer.style.height = this.containerMetrics.size + 'px'; + }, + + /** @param {Event=} event */ + upAction: function(event) { + if (!this.isMouseDown) { + return; + } + + this.mouseUpStart = Utility.now(); + }, + + remove: function() { + Polymer.dom(this.waveContainer.parentNode).removeChild( + this.waveContainer + ); + } + }; + + Polymer({ + is: 'paper-ripple', + + behaviors: [ + Polymer.IronA11yKeysBehavior + ], + + properties: { + /** + * The initial opacity set on the wave. + * + * @attribute initialOpacity + * @type number + * @default 0.25 + */ + initialOpacity: { + type: Number, + value: 0.25 + }, + + /** + * How fast (opacity per second) the wave fades out. + * + * @attribute opacityDecayVelocity + * @type number + * @default 0.8 + */ + opacityDecayVelocity: { + type: Number, + value: 0.8 + }, + + /** + * If true, ripples will exhibit a gravitational pull towards + * the center of their container as they fade away. + * + * @attribute recenters + * @type boolean + * @default false + */ + recenters: { + type: Boolean, + value: false + }, + + /** + * If true, ripples will center inside its container + * + * @attribute recenters + * @type boolean + * @default false + */ + center: { + type: Boolean, + value: false + }, + + /** + * A list of the visual ripples. + * + * @attribute ripples + * @type Array + * @default [] + */ + ripples: { + type: Array, + value: function() { + return []; + } + }, + + /** + * True when there are visible ripples animating within the + * element. + */ + animating: { + type: Boolean, + readOnly: true, + reflectToAttribute: true, + value: false + }, + + /** + * If true, the ripple will remain in the "down" state until `holdDown` + * is set to false again. + */ + holdDown: { + type: Boolean, + value: false, + observer: '_holdDownChanged' + }, + + /** + * If true, the ripple will not generate a ripple effect + * via pointer interaction. + * Calling ripple's imperative api like `simulatedRipple` will + * still generate the ripple effect. + */ + noink: { + type: Boolean, + value: false + }, + + _animating: { + type: Boolean + }, + + _boundAnimate: { + type: Function, + value: function() { + return this.animate.bind(this); + } + } + }, + + get target () { + return this.keyEventTarget; + }, + + keyBindings: { + 'enter:keydown': '_onEnterKeydown', + 'space:keydown': '_onSpaceKeydown', + 'space:keyup': '_onSpaceKeyup' + }, + + attached: function() { + // Set up a11yKeysBehavior to listen to key events on the target, + // so that space and enter activate the ripple even if the target doesn't + // handle key events. The key handlers deal with `noink` themselves. + if (this.parentNode.nodeType == 11) { // DOCUMENT_FRAGMENT_NODE + this.keyEventTarget = Polymer.dom(this).getOwnerRoot().host; + } else { + this.keyEventTarget = this.parentNode; + } + var keyEventTarget = /** @type {!EventTarget} */ (this.keyEventTarget); + this.listen(keyEventTarget, 'up', 'uiUpAction'); + this.listen(keyEventTarget, 'down', 'uiDownAction'); + }, + + detached: function() { + this.unlisten(this.keyEventTarget, 'up', 'uiUpAction'); + this.unlisten(this.keyEventTarget, 'down', 'uiDownAction'); + this.keyEventTarget = null; + }, + + get shouldKeepAnimating () { + for (var index = 0; index < this.ripples.length; ++index) { + if (!this.ripples[index].isAnimationComplete) { + return true; + } + } + + return false; + }, + + simulatedRipple: function() { + this.downAction(null); + + // Please see polymer/polymer#1305 + this.async(function() { + this.upAction(); + }, 1); + }, + + /** + * Provokes a ripple down effect via a UI event, + * respecting the `noink` property. + * @param {Event=} event + */ + uiDownAction: function(event) { + if (!this.noink) { + this.downAction(event); + } + }, + + /** + * Provokes a ripple down effect via a UI event, + * *not* respecting the `noink` property. + * @param {Event=} event + */ + downAction: function(event) { + if (this.holdDown && this.ripples.length > 0) { + return; + } + + var ripple = this.addRipple(); + + ripple.downAction(event); + + if (!this._animating) { + this._animating = true; + this.animate(); + } + }, + + /** + * Provokes a ripple up effect via a UI event, + * respecting the `noink` property. + * @param {Event=} event + */ + uiUpAction: function(event) { + if (!this.noink) { + this.upAction(event); + } + }, + + /** + * Provokes a ripple up effect via a UI event, + * *not* respecting the `noink` property. + * @param {Event=} event + */ + upAction: function(event) { + if (this.holdDown) { + return; + } + + this.ripples.forEach(function(ripple) { + ripple.upAction(event); + }); + + this._animating = true; + this.animate(); + }, + + onAnimationComplete: function() { + this._animating = false; + this.$.background.style.backgroundColor = null; + this.fire('transitionend'); + }, + + addRipple: function() { + var ripple = new Ripple(this); + + Polymer.dom(this.$.waves).appendChild(ripple.waveContainer); + this.$.background.style.backgroundColor = ripple.color; + this.ripples.push(ripple); + + this._setAnimating(true); + + return ripple; + }, + + removeRipple: function(ripple) { + var rippleIndex = this.ripples.indexOf(ripple); + + if (rippleIndex < 0) { + return; + } + + this.ripples.splice(rippleIndex, 1); + + ripple.remove(); + + if (!this.ripples.length) { + this._setAnimating(false); + } + }, + + animate: function() { + if (!this._animating) { + return; + } + var index; + var ripple; + + for (index = 0; index < this.ripples.length; ++index) { + ripple = this.ripples[index]; + + ripple.draw(); + + this.$.background.style.opacity = ripple.outerOpacity; + + if (ripple.isOpacityFullyDecayed && !ripple.isRestingAtMaxRadius) { + this.removeRipple(ripple); + } + } + + if (!this.shouldKeepAnimating && this.ripples.length === 0) { + this.onAnimationComplete(); + } else { + window.requestAnimationFrame(this._boundAnimate); + } + }, + + _onEnterKeydown: function() { + this.uiDownAction(); + this.async(this.uiUpAction, 1); + }, + + _onSpaceKeydown: function() { + this.uiDownAction(); + }, + + _onSpaceKeyup: function() { + this.uiUpAction(); + }, + + // note: holdDown does not respect noink since it can be a focus based + // effect. + _holdDownChanged: function(newVal, oldVal) { + if (oldVal === undefined) { + return; + } + if (newVal) { + this.downAction(); + } else { + this.upAction(); + } + } + + /** + Fired when the animation finishes. + This is useful if you want to wait until + the ripple animation finishes to perform some action. + + @event transitionend + @param {{node: Object}} detail Contains the animated node. + */ + }); + })(); +</script> |