| 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 1753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1764 | 1764 |
| 1765 var format = getFormat(); | 1765 var format = getFormat(); |
| 1766 var hasSpectrum = self._parentPane; | 1766 var hasSpectrum = self._parentPane; |
| 1767 var spectrumHelper = hasSpectrum ? self._parentPane._spectrumHel
per : null; | 1767 var spectrumHelper = hasSpectrum ? self._parentPane._spectrumHel
per : null; |
| 1768 var spectrum = spectrumHelper ? spectrumHelper.spectrum() : null
; | 1768 var spectrum = spectrumHelper ? spectrumHelper.spectrum() : null
; |
| 1769 | 1769 |
| 1770 var colorSwatch = new WebInspector.ColorSwatch(); | 1770 var colorSwatch = new WebInspector.ColorSwatch(); |
| 1771 colorSwatch.setColorString(text); | 1771 colorSwatch.setColorString(text); |
| 1772 colorSwatch.element.addEventListener("click", swatchClick, false
); | 1772 colorSwatch.element.addEventListener("click", swatchClick, false
); |
| 1773 | 1773 |
| 1774 var scrollerElement = hasSpectrum ? self._parentPane._computedSt
ylePane.element.parentElement : null; | 1774 var scrollerElement; |
| 1775 | 1775 |
| 1776 function spectrumChanged(e) | 1776 function spectrumChanged(e) |
| 1777 { | 1777 { |
| 1778 color = e.data; | 1778 color = e.data; |
| 1779 var colorString = color.toString(); | 1779 var colorString = color.toString(); |
| 1780 spectrum.displayText = colorString; | 1780 spectrum.displayText = colorString; |
| 1781 colorValueElement.textContent = colorString; | 1781 colorValueElement.textContent = colorString; |
| 1782 colorSwatch.setColorString(colorString); | 1782 colorSwatch.setColorString(colorString); |
| 1783 self.applyStyleText(nameElement.textContent + ": " + valueEl
ement.textContent, false, false, false); | 1783 self.applyStyleText(nameElement.textContent + ": " + valueEl
ement.textContent, false, false, false); |
| 1784 } | 1784 } |
| 1785 | 1785 |
| 1786 function spectrumHidden(event) | 1786 function spectrumHidden(event) |
| 1787 { | 1787 { |
| 1788 scrollerElement.removeEventListener("scroll", repositionSpec
trum, false); | 1788 if (scrollerElement) |
| 1789 scrollerElement.removeEventListener("scroll", reposition
Spectrum, false); |
| 1789 var commitEdit = event.data; | 1790 var commitEdit = event.data; |
| 1790 var propertyText = !commitEdit && self.originalPropertyText
? self.originalPropertyText : (nameElement.textContent + ": " + valueElement.tex
tContent); | 1791 var propertyText = !commitEdit && self.originalPropertyText
? self.originalPropertyText : (nameElement.textContent + ": " + valueElement.tex
tContent); |
| 1791 self.applyStyleText(propertyText, true, true, false); | 1792 self.applyStyleText(propertyText, true, true, false); |
| 1792 spectrum.removeEventListener(WebInspector.Spectrum.Events.Co
lorChanged, spectrumChanged); | 1793 spectrum.removeEventListener(WebInspector.Spectrum.Events.Co
lorChanged, spectrumChanged); |
| 1793 spectrumHelper.removeEventListener(WebInspector.SpectrumPopu
pHelper.Events.Hidden, spectrumHidden); | 1794 spectrumHelper.removeEventListener(WebInspector.SpectrumPopu
pHelper.Events.Hidden, spectrumHidden); |
| 1794 | 1795 |
| 1795 delete self._parentPane._isEditingStyle; | 1796 delete self._parentPane._isEditingStyle; |
| 1796 delete self.originalPropertyText; | 1797 delete self.originalPropertyText; |
| 1797 } | 1798 } |
| 1798 | 1799 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1810 else { | 1811 else { |
| 1811 var visible = spectrumHelper.toggle(colorSwatch.element,
color, format); | 1812 var visible = spectrumHelper.toggle(colorSwatch.element,
color, format); |
| 1812 | 1813 |
| 1813 if (visible) { | 1814 if (visible) { |
| 1814 spectrum.displayText = color.toString(format); | 1815 spectrum.displayText = color.toString(format); |
| 1815 self.originalPropertyText = self.property.propertyTe
xt; | 1816 self.originalPropertyText = self.property.propertyTe
xt; |
| 1816 self._parentPane._isEditingStyle = true; | 1817 self._parentPane._isEditingStyle = true; |
| 1817 spectrum.addEventListener(WebInspector.Spectrum.Even
ts.ColorChanged, spectrumChanged); | 1818 spectrum.addEventListener(WebInspector.Spectrum.Even
ts.ColorChanged, spectrumChanged); |
| 1818 spectrumHelper.addEventListener(WebInspector.Spectru
mPopupHelper.Events.Hidden, spectrumHidden); | 1819 spectrumHelper.addEventListener(WebInspector.Spectru
mPopupHelper.Events.Hidden, spectrumHidden); |
| 1819 | 1820 |
| 1820 scrollerElement.addEventListener("scroll", repositio
nSpectrum, false); | 1821 scrollerElement = colorSwatch.element.enclosingNodeO
rSelfWithClass("scroll-target"); |
| 1822 if (scrollerElement) |
| 1823 scrollerElement.addEventListener("scroll", repos
itionSpectrum, false); |
| 1824 else |
| 1825 console.error("Unable to handle color picker scr
olling"); |
| 1821 } | 1826 } |
| 1822 } | 1827 } |
| 1823 e.consume(true); | 1828 e.consume(true); |
| 1824 } | 1829 } |
| 1825 | 1830 |
| 1826 function getFormat() | 1831 function getFormat() |
| 1827 { | 1832 { |
| 1828 var format; | 1833 var format; |
| 1829 var formatSetting = WebInspector.settings.colorFormat.get(); | 1834 var formatSetting = WebInspector.settings.colorFormat.get(); |
| 1830 if (formatSetting === cf.Original) | 1835 if (formatSetting === cf.Original) |
| (...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2596 if (!prefix && !force) | 2601 if (!prefix && !force) |
| 2597 return; | 2602 return; |
| 2598 | 2603 |
| 2599 var results = this._cssCompletions.startsWith(prefix); | 2604 var results = this._cssCompletions.startsWith(prefix); |
| 2600 var selectedIndex = this._cssCompletions.mostUsedOf(results); | 2605 var selectedIndex = this._cssCompletions.mostUsedOf(results); |
| 2601 completionsReadyCallback(results, selectedIndex); | 2606 completionsReadyCallback(results, selectedIndex); |
| 2602 }, | 2607 }, |
| 2603 | 2608 |
| 2604 __proto__: WebInspector.TextPrompt.prototype | 2609 __proto__: WebInspector.TextPrompt.prototype |
| 2605 } | 2610 } |
| OLD | NEW |