| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 2731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2742 if (!spectrumHelper || e.shiftKey) { | 2742 if (!spectrumHelper || e.shiftKey) { |
| 2743 changeColorDisplay(); | 2743 changeColorDisplay(); |
| 2744 return; | 2744 return; |
| 2745 } | 2745 } |
| 2746 | 2746 |
| 2747 if (!isEditable) | 2747 if (!isEditable) |
| 2748 return; | 2748 return; |
| 2749 | 2749 |
| 2750 var visible = spectrumHelper.toggle(colorSwatch.element, color, form
at); | 2750 var visible = spectrumHelper.toggle(colorSwatch.element, color, form
at); |
| 2751 if (visible) { | 2751 if (visible) { |
| 2752 spectrum.displayText = color.toString(format); | 2752 spectrum.displayText = color.asString(format); |
| 2753 this.originalPropertyText = this.property.propertyText; | 2753 this.originalPropertyText = this.property.propertyText; |
| 2754 this.editablePane()._isEditingStyle = true; | 2754 this.editablePane()._isEditingStyle = true; |
| 2755 spectrum.addEventListener(WebInspector.Spectrum.Events.ColorChan
ged, boundSpectrumChanged); | 2755 spectrum.addEventListener(WebInspector.Spectrum.Events.ColorChan
ged, boundSpectrumChanged); |
| 2756 spectrumHelper.addEventListener(WebInspector.SpectrumPopupHelper
.Events.Hidden, boundSpectrumHidden); | 2756 spectrumHelper.addEventListener(WebInspector.SpectrumPopupHelper
.Events.Hidden, boundSpectrumHidden); |
| 2757 | 2757 |
| 2758 scrollerElement = colorSwatch.element.enclosingNodeOrSelfWithCla
ss("style-panes-wrapper"); | 2758 scrollerElement = colorSwatch.element.enclosingNodeOrSelfWithCla
ss("style-panes-wrapper"); |
| 2759 if (scrollerElement) | 2759 if (scrollerElement) |
| 2760 scrollerElement.addEventListener("scroll", repositionSpectru
m, false); | 2760 scrollerElement.addEventListener("scroll", repositionSpectru
m, false); |
| 2761 else | 2761 else |
| 2762 console.error("Unable to handle color picker scrolling"); | 2762 console.error("Unable to handle color picker scrolling"); |
| 2763 } | 2763 } |
| 2764 } | 2764 } |
| 2765 | 2765 |
| 2766 var colorValueElement = createElement("span"); | 2766 var colorValueElement = createElement("span"); |
| 2767 if (format === WebInspector.Color.Format.Original) | 2767 if (format === WebInspector.Color.Format.Original) |
| 2768 colorValueElement.textContent = text; | 2768 colorValueElement.textContent = text; |
| 2769 else | 2769 else |
| 2770 colorValueElement.textContent = color.toString(format); | 2770 colorValueElement.textContent = color.asString(format); |
| 2771 | 2771 |
| 2772 /** | 2772 /** |
| 2773 * @param {string} curFormat | 2773 * @param {string} curFormat |
| 2774 */ | 2774 */ |
| 2775 function nextFormat(curFormat) | 2775 function nextFormat(curFormat) |
| 2776 { | 2776 { |
| 2777 // The format loop is as follows: | 2777 // The format loop is as follows: |
| 2778 // * original | 2778 // * original |
| 2779 // * rgb(a) | 2779 // * rgb(a) |
| 2780 // * hsl(a) | 2780 // * hsl(a) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2815 | 2815 |
| 2816 default: | 2816 default: |
| 2817 return cf.RGBA; | 2817 return cf.RGBA; |
| 2818 } | 2818 } |
| 2819 } | 2819 } |
| 2820 | 2820 |
| 2821 function changeColorDisplay() | 2821 function changeColorDisplay() |
| 2822 { | 2822 { |
| 2823 do { | 2823 do { |
| 2824 format = nextFormat(format); | 2824 format = nextFormat(format); |
| 2825 var currentValue = color.toString(format); | 2825 var currentValue = color.asString(format); |
| 2826 } while (currentValue === colorValueElement.textContent); | 2826 } while (currentValue === colorValueElement.textContent); |
| 2827 colorValueElement.textContent = currentValue; | 2827 colorValueElement.textContent = currentValue; |
| 2828 } | 2828 } |
| 2829 | 2829 |
| 2830 var container = createElement("nobr"); | 2830 var container = createElement("nobr"); |
| 2831 container.appendChild(colorSwatch.element); | 2831 container.appendChild(colorSwatch.element); |
| 2832 container.appendChild(colorValueElement); | 2832 container.appendChild(colorValueElement); |
| 2833 return container; | 2833 return container; |
| 2834 }, | 2834 }, |
| 2835 | 2835 |
| (...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3860 if (userEnteredText && (userEnteredText === userEnteredText.toUpperCase(
))) { | 3860 if (userEnteredText && (userEnteredText === userEnteredText.toUpperCase(
))) { |
| 3861 for (var i = 0; i < results.length; ++i) | 3861 for (var i = 0; i < results.length; ++i) |
| 3862 results[i] = results[i].toUpperCase(); | 3862 results[i] = results[i].toUpperCase(); |
| 3863 } | 3863 } |
| 3864 var selectedIndex = this._cssCompletions.mostUsedOf(results); | 3864 var selectedIndex = this._cssCompletions.mostUsedOf(results); |
| 3865 completionsReadyCallback(results, selectedIndex); | 3865 completionsReadyCallback(results, selectedIndex); |
| 3866 }, | 3866 }, |
| 3867 | 3867 |
| 3868 __proto__: WebInspector.TextPrompt.prototype | 3868 __proto__: WebInspector.TextPrompt.prototype |
| 3869 } | 3869 } |
| OLD | NEW |