Changeset 58313 in webkit


Ignore:
Timestamp:
Apr 27, 2010 10:19:47 AM (14 years ago)
Author:
Joseph Pecoraro
Message:

2010-04-27 Joseph Pecoraro <Joseph Pecoraro>

Reviewed by Dan Bernstein.

<input type="search"> with uneven padding causes text clipping
https://bugs.webkit.org/show_bug.cgi?id=38160

  • fast/css/input-search-padding.html: Added.
  • platform/mac/fast/css/input-search-padding-expected.checksum: Added.
  • platform/mac/fast/css/input-search-padding-expected.png: Added.
  • platform/mac/fast/css/input-search-padding-expected.txt: Added.

2010-04-27 Joseph Pecoraro <Joseph Pecoraro>

Reviewed by Dan Bernstein.

<input type="search"> with uneven padding causes text clipping
https://bugs.webkit.org/show_bug.cgi?id=38160

Test: fast/css/input-search-padding.html

An <input type="search"> contains an inner block, which is explicitly
centered in RenderTextControlSingleLine based on the height of the element.
However, the clipping rect was not using the set location, and instead
calculated off of the top border and padding alone. This also vertically
centers the Caps Lock indicator.

  • rendering/RenderTextControl.cpp: moved controlClipRect implementation to RenderTextControlSingleLine
  • rendering/RenderTextControl.h: allow a subclass implementation of controlClipRect, removed redundant hasControlClip implementation, and moved controlClipRect
  • rendering/RenderTextControlSingleLine.cpp: (WebCore::RenderTextControlSingleLine::paint): vertically center the Caps Lock indicator (WebCore::RenderTextControlSingleLine::controlClipRect): use the set location of the anonymous inner block instead
  • rendering/RenderTextControlSingleLine.h: allow for an implementation of controlClipRect for <input type="search">
Location:
trunk
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r58304 r58313  
     12010-04-27  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        <input type="search"> with uneven padding causes text clipping
     6        https://bugs.webkit.org/show_bug.cgi?id=38160
     7
     8        * fast/css/input-search-padding.html: Added.
     9        * platform/mac/fast/css/input-search-padding-expected.checksum: Added.
     10        * platform/mac/fast/css/input-search-padding-expected.png: Added.
     11        * platform/mac/fast/css/input-search-padding-expected.txt: Added.
     12
    1132010-04-27  Jeremy Orlow  <jorlow@chromium.org>
    214
  • trunk/WebCore/ChangeLog

    r58310 r58313  
     12010-04-27  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        <input type="search"> with uneven padding causes text clipping
     6        https://bugs.webkit.org/show_bug.cgi?id=38160
     7
     8        Test: fast/css/input-search-padding.html
     9
     10        An <input type="search"> contains an inner block, which is explicitly
     11        centered in RenderTextControlSingleLine based on the height of the element.
     12        However, the clipping rect was not using the set location, and instead
     13        calculated off of the top border and padding alone. This also vertically
     14        centers the Caps Lock indicator.
     15
     16        * rendering/RenderTextControl.cpp: moved controlClipRect implementation to RenderTextControlSingleLine
     17        * rendering/RenderTextControl.h: allow a subclass implementation of controlClipRect, removed redundant hasControlClip implementation, and moved controlClipRect
     18        * rendering/RenderTextControlSingleLine.cpp:
     19        (WebCore::RenderTextControlSingleLine::paint): vertically center the Caps Lock indicator
     20        (WebCore::RenderTextControlSingleLine::controlClipRect): use the set location of the anonymous inner block instead
     21        * rendering/RenderTextControlSingleLine.h: allow for an implementation of controlClipRect for <input type="search">
     22
    1232010-04-27  Thomas Zander <t.zander@nokia.com>
    224
  • trunk/WebCore/rendering/RenderTextControl.cpp

    r58177 r58313  
    432432        return;
    433433    m_innerText->defaultEventHandler(event);
    434 }
    435 
    436 IntRect RenderTextControl::controlClipRect(int tx, int ty) const
    437 {
    438     IntRect clipRect = contentBoxRect();
    439     clipRect.move(tx, ty);
    440     return clipRect;
    441434}
    442435
  • trunk/WebCore/rendering/RenderTextControl.h

    r54748 r58313  
    9696    virtual const char* renderName() const { return "RenderTextControl"; }
    9797    virtual bool isTextControl() const { return true; }
    98     virtual bool hasControlClip() const { return false; }
    99     virtual IntRect controlClipRect(int tx, int ty) const;
    10098    virtual void calcPrefWidths();
    10199    virtual void removeLeftoverAnonymousBlock(RenderBlock*) { }
  • trunk/WebCore/rendering/RenderTextControlSingleLine.cpp

    r58177 r58313  
    11/**
    2  * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved.
    33 *           (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
    44 *
     
    186186        IntRect contentsRect = contentBoxRect();
    187187
     188        // Center vertically like the text.
     189        contentsRect.setY((height() - contentsRect.height()) / 2);
     190
    188191        // Convert the rect into the coords used for painting the content
    189192        contentsRect.move(tx + x(), ty + y());
     
    357360        repaint();
    358361    }
     362}
     363
     364IntRect RenderTextControlSingleLine::controlClipRect(int tx, int ty) const
     365{
     366    // This should only get called for search inputs, which have an innerBlock.
     367    ASSERT(hasControlClip());
     368    ASSERT(m_innerBlock);
     369
     370    RenderBox* renderBox = m_innerBlock->renderBox();
     371    IntRect clipRect = IntRect(renderBox->x(), renderBox->y(), contentWidth(), contentHeight());       
     372    clipRect.move(tx, ty);
     373    return clipRect;
    359374}
    360375
  • trunk/WebCore/rendering/RenderTextControlSingleLine.h

    r55425 r58313  
    5656private:
    5757    virtual bool hasControlClip() const { return m_cancelButton; }
     58    virtual IntRect controlClipRect(int tx, int ty) const;
    5859    virtual bool isTextField() const { return true; }
    5960
Note: See TracChangeset for help on using the changeset viewer.