Changeset 112643 in webkit
- Timestamp:
- Mar 29, 2012 9:43:59 PM (12 years ago)
- 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 1 2012-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 1 40 2012-03-16 Lucas Forschler <lforschler@apple.com> 2 41 -
branches/safari-534.56-branch/Source/WebCore/platform/mac/ThemeMac.mm
r84504 r112643 38 38 39 39 // This is a view whose sole purpose is to tell AppKit that it's flipped. 40 @interface WebCoreFlippedView : NS View40 @interface WebCoreFlippedView : NSControl 41 41 @end 42 42 … … 557 557 // Use a fake flipped view. 558 558 static NSView *flippedView = [[WebCoreFlippedView alloc] init]; 559 [flippedView setFrameSize:scrollView->contentsSize()]; 559 560 560 561 return flippedView; -
branches/safari-534.56-branch/Source/WebCore/rendering/RenderThemeMac.h
r110752 r112643 219 219 NSSliderCell* sliderThumbHorizontal() const; 220 220 NSSliderCell* sliderThumbVertical() const; 221 NSTextFieldCell* textField( ) const;221 NSTextFieldCell* textField(bool useNewGradient) const; 222 222 223 223 #if ENABLE(METER_TAG) -
branches/safari-534.56-branch/Source/WebCore/rendering/RenderThemeMac.mm
r110755 r112643 36 36 #import "LocalCurrentGraphicsContext.h" 37 37 #import "MediaControlElements.h" 38 #import "Page.h" 38 39 #import "PaintInfo.h" 39 40 #import "RenderMedia.h" … … 482 483 const FillLayer& background, const Color& backgroundColor) const 483 484 { 484 if (style->appearance() == Text AreaPart || style->appearance() == ListboxPart)485 if (style->appearance() == TextFieldPart || style->appearance() == TextAreaPart || style->appearance() == ListboxPart) 485 486 return style->border() != border; 486 487 … … 708 709 { 709 710 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); 711 724 712 725 GraphicsContextStateSaver stateSaver(*paintInfo.context); … … 1358 1371 } 1359 1372 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 #endif1368 1369 1373 [sliderThumbCell drawInteriorWithFrame:unzoomedRect inView:documentViewFor(o)]; 1370 1374 [sliderThumbCell setControlView:nil]; … … 2044 2048 } 2045 2049 2046 NSTextFieldCell* RenderThemeMac::textField( ) const2050 NSTextFieldCell* RenderThemeMac::textField(bool useNewGradient) const 2047 2051 { 2048 2052 if (!m_textField) { … … 2051 2055 [m_textField.get() setEditable:YES]; 2052 2056 [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]]; 2054 2070 2055 2071 return m_textField.get();
Note: See TracChangeset
for help on using the changeset viewer.