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

Side by Side Diff: tracing/tracing/ui/base/table.html

Issue 2956023002: Remove tr.b.dictionaryContainsValue. (Closed)
Patch Set: Created 3 years, 5 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 unified diff | Download patch
« no previous file with comments | « tracing/tracing/base/iteration_helpers_test.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright (c) 2014 The Chromium Authors. All rights reserved. 3 Copyright (c) 2014 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be 4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file. 5 found in the LICENSE file.
6 --> 6 -->
7 7
8 <link rel="import" href="/tracing/ui/base/dom_helpers.html"> 8 <link rel="import" href="/tracing/ui/base/dom_helpers.html">
9 <link rel="import" href="/tracing/ui/base/utils.html"> 9 <link rel="import" href="/tracing/ui/base/utils.html">
10 10
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 </dom-module> 202 </dom-module>
203 <script> 203 <script>
204 'use strict'; 204 'use strict';
205 (function() { 205 (function() {
206 const RIGHT_ARROW = String.fromCharCode(0x25b6); 206 const RIGHT_ARROW = String.fromCharCode(0x25b6);
207 const UNSORTED_ARROW = String.fromCharCode(0x25BF); 207 const UNSORTED_ARROW = String.fromCharCode(0x25BF);
208 const ASCENDING_ARROW = String.fromCharCode(0x25B4); 208 const ASCENDING_ARROW = String.fromCharCode(0x25B4);
209 const DESCENDING_ARROW = String.fromCharCode(0x25BE); 209 const DESCENDING_ARROW = String.fromCharCode(0x25BE);
210 210
211 const SelectionMode = tr.ui.b.TableFormat.SelectionMode; 211 const SelectionMode = tr.ui.b.TableFormat.SelectionMode;
212 const SelectionModeValues = new Set(Object.values(SelectionMode));
212 const HighlightStyle = tr.ui.b.TableFormat.HighlightStyle; 213 const HighlightStyle = tr.ui.b.TableFormat.HighlightStyle;
214 const HighlightStyleValues = new Set(Object.values(HighlightStyle));
213 const ColumnAlignment = tr.ui.b.TableFormat.ColumnAlignment; 215 const ColumnAlignment = tr.ui.b.TableFormat.ColumnAlignment;
216 const ColumnAlignmentValues = new Set(Object.values(ColumnAlignment));
214 217
215 Polymer({ 218 Polymer({
216 is: 'tr-ui-b-table', 219 is: 'tr-ui-b-table',
217 220
218 created() { 221 created() {
219 this.selectionMode_ = SelectionMode.NONE; 222 this.selectionMode_ = SelectionMode.NONE;
220 this.rowHighlightStyle_ = HighlightStyle.DEFAULT; 223 this.rowHighlightStyle_ = HighlightStyle.DEFAULT;
221 this.cellHighlightStyle_ = HighlightStyle.DEFAULT; 224 this.cellHighlightStyle_ = HighlightStyle.DEFAULT;
222 this.selectedTableRowInfo_ = undefined; 225 this.selectedTableRowInfo_ = undefined;
223 this.selectedColumnIndex_ = undefined; 226 this.selectedColumnIndex_ = undefined;
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 } 1026 }
1024 1027
1025 this.maybeUpdateSelectedRow_(); 1028 this.maybeUpdateSelectedRow_();
1026 }, 1029 },
1027 1030
1028 get selectionMode() { 1031 get selectionMode() {
1029 return this.selectionMode_; 1032 return this.selectionMode_;
1030 }, 1033 },
1031 1034
1032 set selectionMode(selectionMode) { 1035 set selectionMode(selectionMode) {
1033 if (!tr.b.dictionaryContainsValue(SelectionMode, selectionMode)) { 1036 if (!SelectionModeValues.has(selectionMode)) {
1034 throw new Error('Invalid selection mode ' + selectionMode); 1037 throw new Error('Invalid selection mode ' + selectionMode);
1035 } 1038 }
1036 this.rebuildIfNeeded_(); 1039 this.rebuildIfNeeded_();
1037 this.selectionMode_ = selectionMode; 1040 this.selectionMode_ = selectionMode;
1038 this.didSelectionStateChange_(); 1041 this.didSelectionStateChange_();
1039 }, 1042 },
1040 1043
1041 get rowHighlightStyle() { 1044 get rowHighlightStyle() {
1042 return this.rowHighlightStyle_; 1045 return this.rowHighlightStyle_;
1043 }, 1046 },
1044 1047
1045 set rowHighlightStyle(rowHighlightStyle) { 1048 set rowHighlightStyle(rowHighlightStyle) {
1046 if (!tr.b.dictionaryContainsValue(HighlightStyle, rowHighlightStyle)) { 1049 if (!HighlightStyleValues.has(rowHighlightStyle)) {
1047 throw new Error('Invalid row highlight style ' + rowHighlightStyle); 1050 throw new Error('Invalid row highlight style ' + rowHighlightStyle);
1048 } 1051 }
1049 this.rebuildIfNeeded_(); 1052 this.rebuildIfNeeded_();
1050 this.rowHighlightStyle_ = rowHighlightStyle; 1053 this.rowHighlightStyle_ = rowHighlightStyle;
1051 this.didSelectionStateChange_(); 1054 this.didSelectionStateChange_();
1052 }, 1055 },
1053 1056
1054 get resolvedRowHighlightStyle() { 1057 get resolvedRowHighlightStyle() {
1055 if (this.rowHighlightStyle_ !== HighlightStyle.DEFAULT) { 1058 if (this.rowHighlightStyle_ !== HighlightStyle.DEFAULT) {
1056 return this.rowHighlightStyle_; 1059 return this.rowHighlightStyle_;
1057 } 1060 }
1058 switch (this.selectionMode_) { 1061 switch (this.selectionMode_) {
1059 case SelectionMode.NONE: 1062 case SelectionMode.NONE:
1060 return HighlightStyle.NONE; 1063 return HighlightStyle.NONE;
1061 case SelectionMode.ROW: 1064 case SelectionMode.ROW:
1062 return HighlightStyle.DARK; 1065 return HighlightStyle.DARK;
1063 case SelectionMode.CELL: 1066 case SelectionMode.CELL:
1064 return HighlightStyle.LIGHT; 1067 return HighlightStyle.LIGHT;
1065 default: 1068 default:
1066 throw new Error('Invalid selection mode ' + selectionMode); 1069 throw new Error('Invalid selection mode ' + selectionMode);
1067 } 1070 }
1068 }, 1071 },
1069 1072
1070 get cellHighlightStyle() { 1073 get cellHighlightStyle() {
1071 return this.cellHighlightStyle_; 1074 return this.cellHighlightStyle_;
1072 }, 1075 },
1073 1076
1074 set cellHighlightStyle(cellHighlightStyle) { 1077 set cellHighlightStyle(cellHighlightStyle) {
1075 if (!tr.b.dictionaryContainsValue(HighlightStyle, cellHighlightStyle)) { 1078 if (!HighlightStyleValues.has(cellHighlightStyle)) {
1076 throw new Error('Invalid cell highlight style ' + cellHighlightStyle); 1079 throw new Error('Invalid cell highlight style ' + cellHighlightStyle);
1077 } 1080 }
1078 this.rebuildIfNeeded_(); 1081 this.rebuildIfNeeded_();
1079 this.cellHighlightStyle_ = cellHighlightStyle; 1082 this.cellHighlightStyle_ = cellHighlightStyle;
1080 this.didSelectionStateChange_(); 1083 this.didSelectionStateChange_();
1081 }, 1084 },
1082 1085
1083 get resolvedCellHighlightStyle() { 1086 get resolvedCellHighlightStyle() {
1084 if (this.cellHighlightStyle_ !== HighlightStyle.DEFAULT) { 1087 if (this.cellHighlightStyle_ !== HighlightStyle.DEFAULT) {
1085 return this.cellHighlightStyle_; 1088 return this.cellHighlightStyle_;
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
1796 return this.tapCallback_; 1799 return this.tapCallback_;
1797 }, 1800 },
1798 1801
1799 onTap_() { 1802 onTap_() {
1800 if (this.tapCallback_) { 1803 if (this.tapCallback_) {
1801 this.tapCallback_(); 1804 this.tapCallback_();
1802 } 1805 }
1803 } 1806 }
1804 }); 1807 });
1805 </script> 1808 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/base/iteration_helpers_test.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698