Changeset 17724 in webkit


Ignore:
Timestamp:
Nov 11, 2006 4:04:50 AM (18 years ago)
Author:
gdennis
Message:

WebCore:

Reviewed by mitz.


REGRESSION (r16122): min/max widths incorrectly calculated for contentEditable text
http://bugs.webkit.org/show_bug.cgi?id=11570

  • rendering/RenderStyle.h: (WebCore::RenderStyle::isSpace): Added.
  • rendering/RenderText.cpp: (WebCore::RenderText::calcMinMaxWidth): For the purposes of calculating the line widths, treat non-breaking spaces the same as normal spaces if -webkit-nbsp-mode is 'space'

LayoutTests:

Reviewed by mitz.

REGRESSION (r16122): min/max widths incorrectly calculated for contentEditable text
http://bugs.webkit.org/show_bug.cgi?id=11570

  • fast/text/whitespace/nbsp-mode-and-linewraps-expected.checksum: Added.
  • fast/text/whitespace/nbsp-mode-and-linewraps-expected.png: Added.
  • fast/text/whitespace/nbsp-mode-and-linewraps-expected.txt: Added.
  • fast/text/whitespace/nbsp-mode-and-linewraps.html: Added.
Location:
trunk
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r17720 r17724  
     12006-11-11  Graham Dennis  <graham.dennis@gmail.com>
     2
     3        Reviewed by mitz.
     4
     5        REGRESSION (r16122): min/max widths incorrectly calculated for contentEditable text
     6        http://bugs.webkit.org/show_bug.cgi?id=11570
     7
     8        * fast/text/whitespace/nbsp-mode-and-linewraps-expected.checksum: Added.
     9        * fast/text/whitespace/nbsp-mode-and-linewraps-expected.png: Added.
     10        * fast/text/whitespace/nbsp-mode-and-linewraps-expected.txt: Added.
     11        * fast/text/whitespace/nbsp-mode-and-linewraps.html: Added.
     12
    1132006-11-10  Justin Garcia  <justin.garcia@apple.com>
    214
  • trunk/WebCore/ChangeLog

    r17722 r17724  
     12006-11-11  Graham Dennis  <graham.dennis@gmail.com>
     2
     3        Reviewed by mitz.
     4       
     5        REGRESSION (r16122): min/max widths incorrectly calculated for contentEditable text
     6        http://bugs.webkit.org/show_bug.cgi?id=11570
     7
     8        * rendering/RenderStyle.h:
     9        (WebCore::RenderStyle::isSpace): Added.
     10        * rendering/RenderText.cpp:
     11        (WebCore::RenderText::calcMinMaxWidth): For the purposes of calculating the line widths,
     12        treat non-breaking spaces the same as normal spaces if -webkit-nbsp-mode is 'space'
     13
    1142006-11-10  Zalan Bujtas <zalan.bujtas@nokia.com>
    215
  • trunk/WebCore/rendering/RenderStyle.h

    r17717 r17724  
    66 *           (C) 2000 Dirk Mueller (mueller@kde.org)
    77 * Copyright (C) 2003, 2005, 2006 Apple Computer, Inc.
     8 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
    89 *
    910 * This library is free software; you can redistribute it and/or
     
    13281329        return false;
    13291330    }
     1331    bool isSpace(UChar c) const { return c == ' ' || (c == 0xa0 && nbspMode() == SPACE); }
    13301332    bool breakOnlyAfterWhiteSpace() const {
    13311333        return whiteSpace() == PRE_WRAP || khtmlLineBreak() == AFTER_WHITE_SPACE;
  • trunk/WebCore/rendering/RenderText.cpp

    r17667 r17724  
    66 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
    77 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
     8 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
    89 *
    910 * This library is free software; you can redistribute it and/or
     
    622623    bool firstLine = true;
    623624    int nextBreakable = -1;
     625    bool breakNBSP = style()->autoWrap() && style()->nbspMode() == SPACE;
     626   
    624627    for (int i = 0; i < len; i++) {
    625628        UChar c = txt[i];
     
    661664        }
    662665       
    663         bool hasBreak = isBreakable(txt, i, len, nextBreakable);
     666        bool hasBreak = isBreakable(txt, i, len, nextBreakable, breakNBSP);
    664667        int j = i;
    665         while (c != '\n' && c != ' ' && c != '\t' && c != SOFT_HYPHEN) {
     668        while (c != '\n' && !style()->isSpace(c) && c != '\t' && c != SOFT_HYPHEN) {
    666669            j++;
    667670            if (j == len)
    668671                break;
    669672            c = txt[j];
    670             if (isBreakable(txt, j, len, nextBreakable))
     673            if (isBreakable(txt, j, len, nextBreakable, breakNBSP))
    671674                break;
    672675        }
     
    678681            currMaxWidth += w;
    679682           
    680             bool isSpace = (j < len) && c == ' ';
     683            bool isSpace = (j < len) && style()->isSpace(c);
    681684            bool isCollapsibleWhiteSpace = (j < len) && style()->isCollapsibleWhiteSpace(c);
    682685            if (j < len && style()->autoWrap())
Note: See TracChangeset for help on using the changeset viewer.