Changeset 56280 in webkit


Ignore:
Timestamp:
Mar 19, 2010 4:05:15 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-03-19 Alexander Pavlov <apavlov@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: caret moves past prompt in javascript console
https://bugs.webkit.org/show_bug.cgi?id=26602

Having noticed any Element children besides a leading <br> (which are empty
text nodes), WebCore editing facility thinks it should delete the <br>,
thus clearing away the text prompt contents.

  • inspector/front-end/TextPrompt.js: (WebInspector.TextPrompt.prototype.clearAutoComplete): (WebInspector.TextPrompt.prototype._completionsReady):
  • inspector/front-end/utilities.js: (Element.prototype.pruneEmptyTextNodes):
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r56256 r56280  
     12010-03-19  Alexander Pavlov  <apavlov@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: caret moves past prompt in javascript console
     6        https://bugs.webkit.org/show_bug.cgi?id=26602
     7
     8        Having noticed any Element children besides a leading <br> (which are empty
     9        text nodes), WebCore editing facility thinks it should delete the <br>,
     10        thus clearing away the text prompt contents.
     11
     12        * inspector/front-end/TextPrompt.js:
     13        (WebInspector.TextPrompt.prototype.clearAutoComplete):
     14        (WebInspector.TextPrompt.prototype._completionsReady):
     15        * inspector/front-end/utilities.js:
     16        (Element.prototype.pruneEmptyTextNodes):
     17
    1182010-03-19  Adam Roben  <aroben@apple.com>
    219
  • trunk/WebCore/inspector/front-end/TextPrompt.js

    r52099 r56280  
    150150
    151151        this._userEnteredRange.deleteContents();
     152        this.element.pruneEmptyTextNodes();
    152153
    153154        var userTextNode = document.createTextNode(this._userEnteredText);
     
    224225
    225226        fullWordRange.deleteContents();
     227        this.element.pruneEmptyTextNodes();
    226228
    227229        var finalSelectionRange = document.createRange();
  • trunk/WebCore/inspector/front-end/utilities.js

    r54962 r56280  
    218218    this.style.left = x + "px";
    219219    this.style.top = y + "px";
     220}
     221
     222Element.prototype.pruneEmptyTextNodes = function()
     223{
     224    var sibling = this.firstChild;
     225    while (sibling) {
     226        var nextSibling = sibling.nextSibling;
     227        if (sibling.nodeType === this.TEXT_NODE && sibling.nodeValue === "")
     228            this.removeChild(sibling);
     229        sibling = nextSibling;
     230    }
    220231}
    221232
Note: See TracChangeset for help on using the changeset viewer.