Changeset 112643 in webkit


Ignore:
Timestamp:
Mar 29, 2012 9:43:59 PM (12 years ago)
Author:
Beth Dakin
Message:

<rdar://problem/11008998> Branch: Shadow inside text field is blurry/blocky in
HiDPI

Reviewed by Dan Bernstein.

This patch merges the following changes to the branch:
http://trac.webkit.org/changeset/97032
http://trac.webkit.org/changeset/98520

This patch also adds branch-specific code that makes it so the regression tracked
by <rdar://problem/11115221> only affects the branch in HiDPI mode.

Essentially, this is a workaround for <rdar://problem/11150452>. With this
workaround, when the deviceScaleFactor is 1, we have an old-school gradient bezel
in text fields whether they are styled or not. This is good and matches shipping
Safari. When the deviceScaleFactor is greater than 1, text fields will have newer,
AppKit-matching gradients that look much more appropriate at the higher
resolutions. However, if the text field is styled in any way, we'll revert to the
old-school bezel, which doesn't look great in HiDPI, but it looks better than the
CSS border, which is the only alternative until 11150452 is resolved.

This is the merging of the changes listed above.

  • platform/mac/ThemeMac.mm:

(WebCore::ThemeMac::ensuredView):

  • rendering/RenderThemeMac.mm:

(WebCore::RenderThemeMac::paintSliderThumb):

isControlStyled() should treat text fields like it used to in order to avoid the
regression tracked by 11115221.

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

(WebCore::RenderThemeMac::isControlStyled):

Use the old gradient always unless we are an unstyled text field in HiDPI.
(WebCore::RenderThemeMac::paintTextField):
(WebCore::RenderThemeMac::textField):

Location:
branches/safari-534.56-branch/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-534.56-branch/Source/WebCore/ChangeLog

    r111068 r112643  
     12012-03-29  Beth Dakin  <bdakin@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        <rdar://problem/11008998> Branch: Shadow inside text field is blurry/blocky in
     6        HiDPI
     7
     8        This patch merges the following changes to the branch:
     9        http://trac.webkit.org/changeset/97032
     10        http://trac.webkit.org/changeset/98520
     11
     12        This patch also adds branch-specific code that makes it so the regression tracked
     13        by <rdar://problem/11115221> only affects the branch in HiDPI mode.
     14
     15        Essentially, this is a workaround for <rdar://problem/11150452>. With this
     16        workaround, when the deviceScaleFactor is 1, we have an old-school gradient bezel
     17        in text fields whether they are styled or not. This is good and matches shipping
     18        Safari. When the deviceScaleFactor is greater than 1, text fields will have newer,
     19        AppKit-matching gradients that look much more appropriate at the higher
     20        resolutions. However, if the text field is styled  in any way, we'll revert to the
     21        old-school bezel, which doesn't look great in HiDPI, but it looks better than the
     22        CSS border, which is the only alternative until 11150452 is resolved.
     23
     24        This is the merging of the changes listed above.
     25        * platform/mac/ThemeMac.mm:
     26        (WebCore::ThemeMac::ensuredView):
     27        * rendering/RenderThemeMac.mm:
     28        (WebCore::RenderThemeMac::paintSliderThumb):
     29
     30        isControlStyled() should treat text fields like it used to in order to avoid the
     31        regression tracked by 11115221.
     32        * rendering/RenderThemeMac.h:
     33        * rendering/RenderThemeMac.mm:
     34        (WebCore::RenderThemeMac::isControlStyled):
     35
     36        Use the old gradient always unless we are an unstyled text field in HiDPI.
     37        (WebCore::RenderThemeMac::paintTextField):
     38        (WebCore::RenderThemeMac::textField):
     39
    1402012-03-16  Lucas Forschler  <lforschler@apple.com>
    241
  • branches/safari-534.56-branch/Source/WebCore/platform/mac/ThemeMac.mm

    r84504 r112643  
    3838
    3939// This is a view whose sole purpose is to tell AppKit that it's flipped.
    40 @interface WebCoreFlippedView : NSView
     40@interface WebCoreFlippedView : NSControl
    4141@end
    4242
     
    557557    // Use a fake flipped view.
    558558    static NSView *flippedView = [[WebCoreFlippedView alloc] init];
     559    [flippedView setFrameSize:scrollView->contentsSize()];
    559560   
    560561    return flippedView;
  • branches/safari-534.56-branch/Source/WebCore/rendering/RenderThemeMac.h

    r110752 r112643  
    219219    NSSliderCell* sliderThumbHorizontal() const;
    220220    NSSliderCell* sliderThumbVertical() const;
    221     NSTextFieldCell* textField() const;
     221    NSTextFieldCell* textField(bool useNewGradient) const;
    222222
    223223#if ENABLE(METER_TAG)
  • branches/safari-534.56-branch/Source/WebCore/rendering/RenderThemeMac.mm

    r110755 r112643  
    3636#import "LocalCurrentGraphicsContext.h"
    3737#import "MediaControlElements.h"
     38#import "Page.h"
    3839#import "PaintInfo.h"
    3940#import "RenderMedia.h"
     
    482483                                     const FillLayer& background, const Color& backgroundColor) const
    483484{
    484     if (style->appearance() == TextAreaPart || style->appearance() == ListboxPart)
     485    if (style->appearance() == TextFieldPart || style->appearance() == TextAreaPart || style->appearance() == ListboxPart)
    485486        return style->border() != border;
    486487       
     
    708709{
    709710    LocalCurrentGraphicsContext localContext(paintInfo.context);
    710     NSTextFieldCell* textField = this->textField();
     711
     712    // See comment in RenderThemeMac::textField() for a complete explanation of this. In short,
     713    // we only want to use the new style gradient for completely unstyled text fields in HiDPI.
     714    // isControledStyle(), however, treats all text fields that do not have custom borders as
     715    // "unstyled" to avoid using the CSS border in that case, so we have to sniff around for
     716    // other types of styling.
     717    bool useNewGradient = WebCore::deviceScaleFactor(o->frame()) != 1;
     718    if (useNewGradient) {
     719        useNewGradient = o->style()->hasAppearance()
     720            && o->style()->visitedDependentColor(CSSPropertyBackgroundColor) == Color::white
     721            && !o->style()->hasBackgroundImage();
     722    }
     723    NSTextFieldCell* textField = this->textField(useNewGradient);
    711724
    712725    GraphicsContextStateSaver stateSaver(*paintInfo.context);
     
    13581371    }
    13591372   
    1360 #if PLATFORM(MAC)
    1361     // Workaround for <rdar://problem/9421781>.
    1362     if (!o->view()->frameView()->documentView()) {
    1363         paintInfo.context->translate(0, unzoomedRect.y());
    1364         paintInfo.context->scale(FloatSize(1, -1));
    1365         paintInfo.context->translate(0, -(unzoomedRect.y() + unzoomedRect.height()));
    1366     }
    1367 #endif
    1368    
    13691373    [sliderThumbCell drawInteriorWithFrame:unzoomedRect inView:documentViewFor(o)];
    13701374    [sliderThumbCell setControlView:nil];
     
    20442048}
    20452049
    2046 NSTextFieldCell* RenderThemeMac::textField() const
     2050NSTextFieldCell* RenderThemeMac::textField(bool useNewGradient) const
    20472051{
    20482052    if (!m_textField) {
     
    20512055        [m_textField.get() setEditable:YES];
    20522056        [m_textField.get() setFocusRingType:NSFocusRingTypeExterior];
    2053     }
     2057        [m_textField.get() setDrawsBackground:YES];
     2058    }
     2059
     2060    // This is a workaround for <rdar://problem/11150452>. With this workaround, when the deviceScaleFactor is 1,
     2061    // we have an old-school gradient bezel in text fields whether they are styled or not. This is good and
     2062    // matches shipping Safari. When the deviceScaleFactor is greater than 1, text fields will have newer,
     2063    // AppKit-matching gradients that look much more appropriate at the higher resolutions. However, if the text
     2064    // field is styled  in any way, we'll revert to the old-school bezel, which doesn't look great in HiDPI, but
     2065    // it looks better than the CSS border, which is the only alternative until 11150452 is resolved.
     2066    if (useNewGradient)
     2067        [m_textField.get() setBackgroundColor:[NSColor whiteColor]];
     2068    else
     2069        [m_textField.get() setBackgroundColor:[NSColor clearColor]];
    20542070
    20552071    return m_textField.get();
Note: See TracChangeset for help on using the changeset viewer.