Modified: trunk/Source/WebCore/inspector/front-end/SuggestBox.js (143426 => 143427)
--- trunk/Source/WebCore/inspector/front-end/SuggestBox.js 2013-02-20 03:05:32 UTC (rev 143426)
+++ trunk/Source/WebCore/inspector/front-end/SuggestBox.js 2013-02-20 05:24:35 UTC (rev 143427)
@@ -66,33 +66,35 @@
this._length = 0;
this._selectedIndex = -1;
this._selectedElement = null;
- this._boundOnScroll = this._onscrollresize.bind(this, true);
- this._boundOnResize = this._onscrollresize.bind(this, false);
+ this._boundOnScroll = this._onScrollOrResize.bind(this, true);
+ this._boundOnResize = this._onScrollOrResize.bind(this, false);
window.addEventListener("scroll", this._boundOnScroll, true);
window.addEventListener("resize", this._boundOnResize, true);
this._bodyElement = inputElement.ownerDocument.body;
this._element = inputElement.ownerDocument.createElement("div");
this._element.className = "suggest-box " + (className || "");
- this._element.addEventListener("mousedown", this._onboxmousedown.bind(this), true);
+ this._element.addEventListener("mousedown", this._onBoxMouseDown.bind(this), true);
this.containerElement = this._element.createChild("div", "container");
this.contentElement = this.containerElement.createChild("div", "content");
}
WebInspector.SuggestBox.prototype = {
- get visible()
+ /**
+ * @return {boolean}
+ */
+ visible: function()
{
return !!this._element.parentElement;
},
- get hasSelection()
+ /**
+ * @param {boolean} isScroll
+ * @param {Event} event
+ */
+ _onScrollOrResize: function(isScroll, event)
{
- return !!this._selectedElement;
- },
-
- _onscrollresize: function(isScroll, event)
- {
- if (isScroll && this._element.isAncestor(event.target) || !this.visible)
+ if (isScroll && this._element.isAncestor(event.target) || !this.visible())
return;
this._updateBoxPositionWithExistingAnchor();
},
@@ -155,14 +157,17 @@
this._element.style.height = height + "px";
},
- _onboxmousedown: function(event)
+ /**
+ * @param {Event} event
+ */
+ _onBoxMouseDown: function(event)
{
event.preventDefault();
},
hide: function()
{
- if (!this.visible)
+ if (!this.visible())
return;
this._element.parentElement.removeChild(this._element);
@@ -182,7 +187,7 @@
*/
_applySuggestion: function(text, isIntermediateSuggestion)
{
- if (!this.visible || !(text || this._selectedElement))
+ if (!this.visible() || !(text || this._selectedElement))
return false;
var suggestion = text || this._selectedElement.textContent;
@@ -231,26 +236,19 @@
},
/**
- * @param {AnchorBox} anchorBox
- * @param {Array.<string>=} completions
- * @param {number=} selectedIndex
- * @param {boolean=} canShowForSingleItem
+ * @param {string} text
+ * @param {Event} event
*/
- updateSuggestions: function(anchorBox, completions, selectedIndex, canShowForSingleItem)
- {
- if (this._suggestTimeout) {
- clearTimeout(this._suggestTimeout);
- delete this._suggestTimeout;
- }
- this._completionsReady(anchorBox, completions, selectedIndex, canShowForSingleItem);
- },
-
_onItemMouseDown: function(text, event)
{
this.acceptSuggestion(text);
event.consume(true);
},
+ /**
+ * @param {string} prefix
+ * @param {string} text
+ */
_createItemElement: function(prefix, text)
{
var element = document.createElement("div");
@@ -335,12 +333,12 @@
* @param {number=} selectedIndex
* @param {boolean=} canShowForSingleItem
*/
- _completionsReady: function(anchorBox, completions, selectedIndex, canShowForSingleItem)
+ updateSuggestions: function(anchorBox, completions, selectedIndex, canShowForSingleItem)
{
if (this._canShowBox(completions, canShowForSingleItem)) {
this._updateItems(completions, selectedIndex);
this._updateBoxPosition(anchorBox);
- if (!this.visible)
+ if (!this.visible())
this._bodyElement.appendChild(this._element);
this._rememberRowCountPerViewport();
} else
Modified: trunk/Source/WebCore/inspector/front-end/TextPrompt.js (143426 => 143427)
--- trunk/Source/WebCore/inspector/front-end/TextPrompt.js 2013-02-20 03:05:32 UTC (rev 143426)
+++ trunk/Source/WebCore/inspector/front-end/TextPrompt.js 2013-02-20 05:24:35 UTC (rev 143427)
@@ -630,7 +630,7 @@
isSuggestBoxVisible: function()
{
- return this._suggestBox && this._suggestBox.visible;
+ return this._suggestBox && this._suggestBox.visible();
},
isCaretInsidePrompt: function()