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

Side by Side Diff: Source/WebCore/inspector/front-end/StylesSidebarPane.js

Issue 6591106: Merge 76941 - 2011-01-28 Alexander Pavlov <apavlov@chromium.org>... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/648/
Patch Set: Created 9 years, 9 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 | « no previous file | 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 /* 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 1911 matching lines...) Expand 10 before | Expand all | Expand 10 after
1922 tabKeyPressed: function(event) 1922 tabKeyPressed: function(event)
1923 { 1923 {
1924 this.acceptAutoComplete(); 1924 this.acceptAutoComplete();
1925 }, 1925 },
1926 1926
1927 _handleNameOrValueUpDown: function(event) 1927 _handleNameOrValueUpDown: function(event)
1928 { 1928 {
1929 var reverse = event.keyIdentifier === "Up"; 1929 var reverse = event.keyIdentifier === "Up";
1930 if (this.autoCompleteElement) 1930 if (this.autoCompleteElement)
1931 this.complete(false, reverse); // Accept the current suggestion, if any. 1931 this.complete(false, reverse); // Accept the current suggestion, if any.
1932 else {
1933 // Select the word suffix to affect it when computing the subsequent suggestion.
1934 this._selectCurrentWordSuffix();
1935 }
1936
1932 this.complete(false, reverse); // Actually increment/decrement the sugge stion. 1937 this.complete(false, reverse); // Actually increment/decrement the sugge stion.
1933 event.handled = true; 1938 event.handled = true;
1934 }, 1939 },
1935 1940
1941 _selectCurrentWordSuffix: function()
1942 {
1943 var selection = window.getSelection();
1944 if (!selection.rangeCount)
1945 return;
1946
1947 var selectionRange = selection.getRangeAt(0);
1948 if (!selectionRange.commonAncestorContainer.isDescendant(this.element))
1949 return;
1950 var wordSuffixRange = selectionRange.startContainer.rangeOfWord(selectio nRange.startOffset, WebInspector.StylesSidebarPane.StyleValueDelimiters, this.el ement, "forward");
1951 if (!wordSuffixRange.toString())
1952 return;
1953 selection.removeAllRanges();
1954 selection.addRange(wordSuffixRange);
1955 },
1956
1936 _buildPropertyCompletions: function(wordRange, bestMatchOnly, completionsRea dyCallback) 1957 _buildPropertyCompletions: function(wordRange, bestMatchOnly, completionsRea dyCallback)
1937 { 1958 {
1938 var prefix = wordRange.toString().toLowerCase(); 1959 var prefix = wordRange.toString().toLowerCase();
1939 if (!prefix.length) 1960 if (!prefix.length)
1940 return; 1961 return;
1941 1962
1942 var results; 1963 var results;
1943 if (bestMatchOnly) { 1964 if (bestMatchOnly) {
1944 results = []; 1965 results = [];
1945 var firstMatch = this._cssCompletions.firstStartsWith(prefix); 1966 var firstMatch = this._cssCompletions.firstStartsWith(prefix);
1946 if (firstMatch) 1967 if (firstMatch)
1947 results.push(firstMatch); 1968 results.push(firstMatch);
1948 return completionsReadyCallback(results); 1969 return completionsReadyCallback(results);
1949 } 1970 }
1950 1971
1951 results = this._cssCompletions.startsWith(prefix); 1972 results = this._cssCompletions.startsWith(prefix);
1952 if (results) 1973 if (results)
1953 completionsReadyCallback(results); 1974 completionsReadyCallback(results);
1954 } 1975 }
1955 } 1976 }
1956 1977
1957 WebInspector.StylesSidebarPane.CSSPropertyPrompt.prototype.__proto__ = WebInspec tor.TextPrompt.prototype; 1978 WebInspector.StylesSidebarPane.CSSPropertyPrompt.prototype.__proto__ = WebInspec tor.TextPrompt.prototype;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698