Changeset 104240 in webkit


Ignore:
Timestamp:
Jan 5, 2012 4:30:50 PM (12 years ago)
Author:
Beth Dakin
Message:

https://bugs.webkit.org/show_bug.cgi?id=75654
Text fields should draw using NSTextFieldCell instead of WebKitSystemInterface

Reviewed by John Sullivan.

This change should not have any affect on tests or real web sites. It just changed
the implementation under the hood to the more modern NSCell approach.

  • rendering/RenderThemeMac.h:
  • rendering/RenderThemeMac.mm:

(WebCore::RenderThemeMac::paintTextField):
(WebCore::RenderThemeMac::textField):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r104236 r104240  
     12012-01-05  Beth Dakin  <bdakin@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=75654
     4        Text fields should draw using NSTextFieldCell instead of WebKitSystemInterface
     5
     6        Reviewed by John Sullivan.
     7
     8        This change should not have any affect on tests or real web sites. It just changed
     9        the implementation under the hood to the more modern NSCell approach.
     10        * rendering/RenderThemeMac.h:
     11        * rendering/RenderThemeMac.mm:
     12        (WebCore::RenderThemeMac::paintTextField):
     13        (WebCore::RenderThemeMac::textField):
     14
    1152012-01-05  Ryosuke Niwa  <rniwa@webkit.org>
    216
  • trunk/Source/WebCore/rendering/RenderThemeMac.h

    r99083 r104240  
    220220    NSSliderCell* sliderThumbHorizontal() const;
    221221    NSSliderCell* sliderThumbVertical() const;
     222    NSTextFieldCell* textField() const;
    222223
    223224#if ENABLE(METER_TAG)
     
    239240    mutable RetainPtr<NSSliderCell> m_sliderThumbVertical;
    240241    mutable RetainPtr<NSLevelIndicatorCell> m_levelIndicator;
     242    mutable RetainPtr<NSTextFieldCell> m_textField;
    241243
    242244    bool m_isSliderThumbHorizontalPressed;
  • trunk/Source/WebCore/rendering/RenderThemeMac.mm

    r103863 r104240  
    714714{
    715715    LocalCurrentGraphicsContext localContext(paintInfo.context);
    716     wkDrawBezeledTextFieldCell(r, isEnabled(o) && !isReadOnlyControl(o));
     716    NSTextFieldCell* textField = this->textField();
     717
     718    GraphicsContextStateSaver stateSaver(*paintInfo.context);
     719
     720    [textField setEnabled:(isEnabled(o) && !isReadOnlyControl(o))];
     721    [textField drawWithFrame:NSRect(r) inView:documentViewFor(o)];
     722
     723    [textField setControlView:nil];
     724
    717725    return false;
    718726}
     
    20852093}
    20862094
     2095NSTextFieldCell* RenderThemeMac::textField() const
     2096{
     2097    if (!m_textField) {
     2098        m_textField.adoptNS([[NSTextFieldCell alloc] initTextCell:@""]);
     2099        [m_textField.get() setBezeled:YES];
     2100        [m_textField.get() setEditable:YES];
     2101        [m_textField.get() setFocusRingType:NSFocusRingTypeExterior];
     2102
     2103        // Setting a clear background on the cell is necessary for CSS-styled backgrounds
     2104        // to show through. Ideally, there would be a better way to do this.
     2105        [m_textField.get() setDrawsBackground:YES];
     2106        [m_textField.get() setBackgroundColor:[NSColor clearColor]];
     2107    }
     2108
     2109    return m_textField.get();
     2110}
     2111
    20872112String RenderThemeMac::fileListNameForWidth(const Vector<String>& filenames, const Font& font, int width, bool multipleFilesAllowed)
    20882113{
Note: See TracChangeset for help on using the changeset viewer.