Changeset 58627 in webkit


Ignore:
Timestamp:
Apr 30, 2010 7:54:08 PM (14 years ago)
Author:
Joseph Pecoraro
Message:

2010-04-28 Joseph Pecoraro <Joseph Pecoraro>

Reviewed by Oliver Hunt.

<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-28 Joseph Pecoraro <Joseph Pecoraro>

Reviewed by Oliver Hunt.

<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
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r58622 r58627  
     12010-04-28  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        REGRESSION(r58313): Regression evident in pixel tests: the search icon is always clipped at the bottom.
     6        https://bugs.webkit.org/show_bug.cgi?id=38253
     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
     13        * platform/mac/fast/forms/search-zoomed-expected.checksum: Updated.
     14        * platform/mac/fast/forms/search-zoomed-expected.png: Updated.
     15
    1162010-04-30  Chris Marrin  <cmarrin@apple.com>
    217
  • trunk/LayoutTests/platform/mac/fast/forms/search-zoomed-expected.checksum

    r54748 r58627  
    1 d7f9ad12c55272dfa8b7ee73d2133ddd
     18560c314c6480f5f117c36da2edd6b69
  • trunk/WebCore/ChangeLog

    r58625 r58627  
     12010-04-28  Joseph Pecoraro  <joepeck@webkit.org>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        REGRESSION(r58313): Regression evident in pixel tests: the search icon is always clipped at the bottom.
     6        https://bugs.webkit.org/show_bug.cgi?id=38253
     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-30  Jon Honeycutt  <jhoneycutt@apple.com>
    224
  • trunk/WebCore/rendering/RenderTextControl.cpp

    r58400 r58627  
    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

    r58400 r58627  
    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

    r58572 r58627  
    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 *
     
    189189        IntRect contentsRect = contentBoxRect();
    190190
     191        // Center vertically like the text.
     192        contentsRect.setY((height() - contentsRect.height()) / 2);
     193
    191194        // Convert the rect into the coords used for painting the content
    192195        contentsRect.move(tx + x(), ty + y());
     
    392395        repaint();
    393396    }
     397}
     398
     399IntRect RenderTextControlSingleLine::controlClipRect(int tx, int ty) const
     400{
     401    // This should only get called for search inputs.
     402    ASSERT(hasControlClip());
     403    IntRect clipRect = IntRect(x(), y(), width(), height());       
     404    clipRect.move(tx, ty);
     405    return clipRect;
    394406}
    395407
  • trunk/WebCore/rendering/RenderTextControlSingleLine.h

    r58564 r58627  
    6161    int preferredDecorationWidthRight() const;
    6262    virtual bool hasControlClip() const { return m_cancelButton; }
     63    virtual IntRect controlClipRect(int tx, int ty) const;
    6364    virtual bool isTextField() const { return true; }
    6465
Note: See TracChangeset for help on using the changeset viewer.