diff options
Diffstat (limited to 'chromium/chrome/browser/resources/pdf/elements/viewer-bookmark')
3 files changed, 0 insertions, 222 deletions
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/BUILD.gn b/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/BUILD.gn deleted file mode 100644 index fa2b15b86f7..00000000000 --- a/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/BUILD.gn +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright 2018 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("//third_party/closure_compiler/compile_js.gni") - -js_type_check("closure_compile") { - deps = [ - ":viewer-bookmark", - ] -} - -js_library("viewer-bookmark") { - deps = [ - "//third_party/polymer/v1_0/components-chromium/iron-a11y-keys-behavior:iron-a11y-keys-behavior-extracted", - ] -} diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.html b/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.html deleted file mode 100644 index 004aa1b1677..00000000000 --- a/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.html +++ /dev/null @@ -1,72 +0,0 @@ -<link rel="import" href="chrome://resources/html/polymer.html"> - -<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html"> -<link rel="import" href="chrome://resources/cr_elements/icons.html"> -<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html"> -<link rel="import" href="chrome://resources/polymer/v1_0/paper-ripple/paper-ripple.html"> -<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html"> - -<dom-module id="viewer-bookmark" attributes="bookmark"> - <template> - <style> - #item { - @apply --layout-center; - @apply --layout-horizontal; - cursor: pointer; - height: 30px; - position: relative; - } - - #item:hover { - background-color: var(--cr-menu-background-focus-color); - } - - paper-ripple { - /* Allowing the ripple to capture pointer events prevents a focus - * rectangle for showing up for clicks, while still allowing it with - * tab-navigation. This undoes a paper-ripple bug fix aimed at - * non-Chrome browsers. TODO(tsergeant): Improve focus in - * viewer-bookmark so this can be removed (https://crbug.com/5448190). - */ - pointer-events: auto; - } - - #title { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - - #expand { - --cr-icon-button-color: var(--primary-text-color); - --cr-icon-button-icon-size: 16px; - --cr-icon-button-size: 28px; - margin: 0; - transition: transform 150ms; - } - - :host-context([dir=rtl]) #expand { - transform: rotate(180deg); - } - - :host([children-shown_]) #expand { - transform: rotate(90deg); - } - </style> - <div id="item" on-click="onClick_"> - <paper-ripple></paper-ripple> - <cr-icon-button id="expand" iron-icon="cr:chevron-right" - on-click="toggleChildren_"></cr-icon-button> - <span id="title" tabindex="0">{{bookmark.title}}</span> - </div> - <!-- dom-if will stamp the complex bookmark tree lazily as individual nodes - are opened. --> - <template is="dom-if" if="[[childrenShown_]]"> - <template is="dom-repeat" items="[[bookmark.children]]"> - <viewer-bookmark bookmark="{{item}}" depth="[[childDepth_]]"> - </viewer-bookmark> - </template> - </template> - </template> - <script src="viewer-bookmark.js"></script> -</dom-module> diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.js b/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.js deleted file mode 100644 index f1cce48abaa..00000000000 --- a/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.js +++ /dev/null @@ -1,133 +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. - -/** - * The |title| is the text label displayed for the bookmark. - * - * The bookmark may point at a location in the PDF or a URI. - * If it points at a location, |page| indicates which 0-based page it leads to. - * Optionally, |y| is the y position in that page, in pixel coordinates. - * If it points at an URI, |uri| is the target for that bookmark. - * - * |children| is an array of the |Bookmark|s that are below this in a table of - * contents tree - * structure. - * @typedef {{ - * title: string, - * page: (number | undefined), - * y: (number | undefined), - * uri: (string | undefined), - * children: !Array<!Bookmark> - * }} - */ -let Bookmark; - -(function() { -/** Amount that each level of bookmarks is indented by (px). */ -const BOOKMARK_INDENT = 20; - -Polymer({ - is: 'viewer-bookmark', - - properties: { - /** @type {Bookmark} */ - bookmark: { - type: Object, - observer: 'bookmarkChanged_', - }, - - depth: { - type: Number, - observer: 'depthChanged_' - }, - - /** @private */ - childDepth_: Number, - - /** @private */ - childrenShown_: { - type: Boolean, - reflectToAttribute: true, - value: false, - }, - - /** @type {?HTMLElement} The target for the key bindings below. */ - keyEventTarget: Object, - }, - - behaviors: [Polymer.IronA11yKeysBehavior], - - keyBindings: {'enter': 'onEnter_', 'space': 'onSpace_'}, - - /** @override */ - attached: function() { - this.keyEventTarget = this.$.item; - }, - - /** @private */ - bookmarkChanged_: function() { - this.$.expand.style.visibility = - this.bookmark.children.length > 0 ? 'visible' : 'hidden'; - }, - - /** @private */ - depthChanged_: function() { - this.childDepth_ = this.depth + 1; - this.$.item.style.paddingInlineStart = - (this.depth * BOOKMARK_INDENT) + 'px'; - }, - - /** @private */ - onClick_: function() { - if (this.bookmark.hasOwnProperty('page')) { - if (this.bookmark.hasOwnProperty('y')) { - this.fire('change-page-and-xy', { - page: this.bookmark.page, - x: 0, - y: this.bookmark.y, - origin: 'bookmark' - }); - } else { - this.fire( - 'change-page', {page: this.bookmark.page, origin: 'bookmark'}); - } - } else if (this.bookmark.hasOwnProperty('uri')) { - this.fire('navigate', {uri: this.bookmark.uri, newtab: true}); - } - }, - - /** - * @param {!KeyboardEvent} e - * @private - */ - onEnter_: function(e) { - // Don't allow events which have propagated up from the expand button to - // trigger a click. - if (e.detail.keyboardEvent.target != this.$.expand) { - this.onClick_(); - } - }, - - /** - * @param {!KeyboardEvent} e - * @private - */ - onSpace_: function(e) { - // cr-icon-button stops propagation of space events, so there's no need - // to check the event source here. - this.onClick_(); - // Prevent default space scroll behavior. - e.detail.keyboardEvent.preventDefault(); - }, - - /** - * @param {!Event} e - * @private - */ - toggleChildren_: function(e) { - this.childrenShown_ = !this.childrenShown_; - e.stopPropagation(); // Prevent the above onClick_ handler from firing. - } -}); -})(); |