Web Inspector: [SuggestBox] textPrompt.css disablement displays garbled suggest box
authorapavlov@chromium.org <apavlov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Feb 2012 16:17:03 +0000 (16:17 +0000)
committerapavlov@chromium.org <apavlov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Feb 2012 16:17:03 +0000 (16:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=79107

Reviewed by Pavel Feldman.

* inspector/front-end/TextPrompt.js:
(WebInspector.TextPrompt.SuggestBox):
(WebInspector.TextPrompt.SuggestBox.prototype.get visible):
(WebInspector.TextPrompt.SuggestBox.prototype.hide):
(WebInspector.TextPrompt.SuggestBox.prototype.removeFromElement):
(WebInspector.TextPrompt.SuggestBox.prototype._completionsReady):
* inspector/front-end/textPrompt.css:
(.suggest-box):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108356 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/TextPrompt.js
Source/WebCore/inspector/front-end/textPrompt.css

index ec3a378..30d777a 100644 (file)
@@ -1,3 +1,19 @@
+2012-02-21  Alexander Pavlov  <apavlov@chromium.org>
+
+        Web Inspector: [SuggestBox] textPrompt.css disablement displays garbled suggest box
+        https://bugs.webkit.org/show_bug.cgi?id=79107
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/front-end/TextPrompt.js:
+        (WebInspector.TextPrompt.SuggestBox):
+        (WebInspector.TextPrompt.SuggestBox.prototype.get visible):
+        (WebInspector.TextPrompt.SuggestBox.prototype.hide):
+        (WebInspector.TextPrompt.SuggestBox.prototype.removeFromElement):
+        (WebInspector.TextPrompt.SuggestBox.prototype._completionsReady):
+        * inspector/front-end/textPrompt.css:
+        (.suggest-box):
+
 2012-02-21  Yury Semikhatsky  <yurys@chromium.org>
 
         Web Inspector: timeline hangs on a page with deep chain of nested events.
index b616e43..3c43f69 100644 (file)
@@ -927,8 +927,9 @@ WebInspector.TextPrompt.SuggestBox = function(textPrompt, inputElement, classNam
     window.addEventListener("scroll", this._boundOnScroll, true);
     window.addEventListener("resize", this._boundOnResize, true);
 
-    var bodyElement = inputElement.ownerDocument.body;
-    this._element = bodyElement.createChild("div", "suggest-box " + (className || ""));
+    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.containerElement = this._element.createChild("div", "container");
     this.contentElement = this.containerElement.createChild("div", "content");
@@ -937,7 +938,7 @@ WebInspector.TextPrompt.SuggestBox = function(textPrompt, inputElement, classNam
 WebInspector.TextPrompt.SuggestBox.prototype = {
     get visible()
     {
-        return this._element.hasStyleClass("visible");
+        return !!this._element.parentElement;
     },
 
     get hasSelection()
@@ -1020,7 +1021,7 @@ WebInspector.TextPrompt.SuggestBox.prototype = {
         if (!this.visible)
             return;
 
-        this._element.removeStyleClass("visible");
+        this._element.parentElement.removeChild(this._element);
         delete this._selectedElement;
     },
 
@@ -1028,7 +1029,7 @@ WebInspector.TextPrompt.SuggestBox.prototype = {
     {
         window.removeEventListener("scroll", this._boundOnScroll, true);
         window.removeEventListener("resize", this._boundOnResize, true);
-        this._element.parentElement.removeChild(this._element);
+        this.hide();
     },
 
     /**
@@ -1225,7 +1226,8 @@ WebInspector.TextPrompt.SuggestBox.prototype = {
         if (this._canShowBox(completions, canShowForSingleItem)) {
             this._updateItems(completions, canShowForSingleItem);
             this._updateBoxPosition(anchorBox);
-            this._element.addStyleClass("visible");
+            if (!this.visible)
+                this._bodyElement.appendChild(this._element);
             this._rememberRowCountPerViewport();
         } else
             this.hide();
index 217ae94..ca4ba07 100644 (file)
 .suggest-box {
     position: absolute;
     background-color: #FFFFFF;
-    display: none;
+    display: block;
     border: 1px solid black;
     padding: 2px;
     z-index: 100;
 }
 
-.suggest-box.visible {
-    display: block;
-}
-
 .suggest-box .container {
     position: absolute;
     top: 0;