Title: [117502] trunk/Source/WebCore
- Revision
- 117502
- Author
- bda...@apple.com
- Date
- 2012-05-17 14:59:05 -0700 (Thu, 17 May 2012)
Log Message
https://bugs.webkit.org/show_bug.cgi?id=86266
r112643/r116697 break Webview form input fields
-and corresponding-
<rdar://problem/11400430>
Reviewed by Dan Bernstein.
There is a recent history of changes in this are that seem worth documenting.
First was the change to switch to using NSTextFieldCell to draw text fields:
http://trac.webkit.org/changeset/104240
That led to problems because of the clear background that I thought at the time
were specific to MountainLion. To fix that, I made this change:
http://trac.webkit.org/changeset/110480
But that change resulted in styled text fields getting an un-themed border, which
led to this change on the branch: http://trac.webkit.org/changeset/112643 and a
change on TOT that was identical for Lion and SnowLeopard but introduced new
behavior for MountainLion: http://trac.webkit.org/changeset/116697
And that brings us to this bug, where it turns out the clear background is a
problem on Lion and SnowLeopard too. This patch fixes the bug by using the
original WebCoreSystemInterface function to paint all text fields on Lion and
SnowLeopard that are styled. This is what we used to paint all text fields before
r104240, which is the first change listed above. Un-styled text fields will still
use NSTextFieldCell on these platforms, but with a hardcoded white background.
* rendering/RenderThemeMac.h:
(RenderThemeMac):
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintTextField):
(WebCore::RenderThemeMac::textField):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (117501 => 117502)
--- trunk/Source/WebCore/ChangeLog 2012-05-17 21:49:43 UTC (rev 117501)
+++ trunk/Source/WebCore/ChangeLog 2012-05-17 21:59:05 UTC (rev 117502)
@@ -1,3 +1,37 @@
+2012-05-17 Beth Dakin <bda...@apple.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=86266
+ r112643/r116697 break Webview form input fields
+ -and corresponding-
+ <rdar://problem/11400430>
+
+ Reviewed by Dan Bernstein.
+
+ There is a recent history of changes in this are that seem worth documenting.
+ First was the change to switch to using NSTextFieldCell to draw text fields:
+ http://trac.webkit.org/changeset/104240
+
+ That led to problems because of the clear background that I thought at the time
+ were specific to MountainLion. To fix that, I made this change:
+ http://trac.webkit.org/changeset/110480
+
+ But that change resulted in styled text fields getting an un-themed border, which
+ led to this change on the branch: http://trac.webkit.org/changeset/112643 and a
+ change on TOT that was identical for Lion and SnowLeopard but introduced new
+ behavior for MountainLion: http://trac.webkit.org/changeset/116697
+
+ And that brings us to this bug, where it turns out the clear background is a
+ problem on Lion and SnowLeopard too. This patch fixes the bug by using the
+ original WebCoreSystemInterface function to paint all text fields on Lion and
+ SnowLeopard that are styled. This is what we used to paint all text fields before
+ r104240, which is the first change listed above. Un-styled text fields will still
+ use NSTextFieldCell on these platforms, but with a hardcoded white background.
+ * rendering/RenderThemeMac.h:
+ (RenderThemeMac):
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::paintTextField):
+ (WebCore::RenderThemeMac::textField):
+
2012-05-15 Andreas Kling <kl...@webkit.org>
IconDatabase: Move icon retain/release off of the main thread.
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.h (117501 => 117502)
--- trunk/Source/WebCore/rendering/RenderThemeMac.h 2012-05-17 21:49:43 UTC (rev 117501)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.h 2012-05-17 21:59:05 UTC (rev 117502)
@@ -219,7 +219,7 @@
NSMenu* searchMenuTemplate() const;
NSSliderCell* sliderThumbHorizontal() const;
NSSliderCell* sliderThumbVertical() const;
- NSTextFieldCell* textField(bool useNewGradient) const;
+ NSTextFieldCell* textField() const;
#if ENABLE(METER_TAG)
NSLevelIndicatorStyle levelIndicatorStyleFor(ControlPart) const;
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (117501 => 117502)
--- trunk/Source/WebCore/rendering/RenderThemeMac.mm 2012-05-17 21:49:43 UTC (rev 117501)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm 2012-05-17 21:59:05 UTC (rev 117502)
@@ -734,18 +734,22 @@
{
LocalCurrentGraphicsContext localContext(paintInfo.context);
- bool useNewGradient = true;
#if defined(BUILDING_ON_LION) || defined(BUILDING_ON_SNOW_LEOPARD)
- // See comment in RenderThemeMac::textField() for a complete explanation of this.
- useNewGradient = WebCore::deviceScaleFactor(o->frame()) != 1;
- if (useNewGradient) {
- useNewGradient = o->style()->hasAppearance()
- && o->style()->visitedDependentColor(CSSPropertyBackgroundColor) == Color::white
- && !o->style()->hasBackgroundImage();
+ bool useNSTextFieldCell = o->style()->hasAppearance()
+ && o->style()->visitedDependentColor(CSSPropertyBackgroundColor) == Color::white
+ && !o->style()->hasBackgroundImage();
+
+ // We do not use NSTextFieldCell to draw styled text fields on Lion and SnowLeopard because
+ // there are a number of bugs on those platforms that require NSTextFieldCell to be in charge
+ // of painting its own background. We need WebCore to paint styled backgrounds, so we'll use
+ // this WebCoreSystemInterface function instead.
+ if (!useNSTextFieldCell) {
+ wkDrawBezeledTextFieldCell(r, isEnabled(o) && !isReadOnlyControl(o));
+ return false;
}
#endif
- NSTextFieldCell* textField = this->textField(useNewGradient);
+ NSTextFieldCell *textField = this->textField();
GraphicsContextStateSaver stateSaver(*paintInfo.context);
@@ -2164,7 +2168,7 @@
return m_sliderThumbVertical.get();
}
-NSTextFieldCell* RenderThemeMac::textField(bool useNewGradient) const
+NSTextFieldCell* RenderThemeMac::textField() const
{
if (!m_textField) {
m_textField.adoptNS([[WebCoreTextFieldCell alloc] initTextCell:@""]);
@@ -2173,27 +2177,15 @@
[m_textField.get() setFocusRingType:NSFocusRingTypeExterior];
#if defined(BUILDING_ON_LION) || defined(BUILDING_ON_SNOW_LEOPARD)
[m_textField.get() setDrawsBackground:YES];
+ [m_textField.get() setBackgroundColor:[NSColor whiteColor]];
#else
- UNUSED_PARAM(useNewGradient);
+ // Post-Lion, WebCore can be in charge of paintinng the background thanks to
+ // the workaround in place for <rdar://problem/11385461>, which is implemented
+ // above as _coreUIDrawOptionsWithFrame.
[m_textField.get() setDrawsBackground:NO];
#endif
}
-#if defined(BUILDING_ON_LION) || defined(BUILDING_ON_SNOW_LEOPARD)
- // This is a workaround for <rdar://problem/11385461> on Lion and SnowLeopard. Newer versions of the
- // OS can always use the newer version of the text field with the workaround above in
- // _coreUIDrawOptionsWithFrame. With this workaround for older OS's, when the deviceScaleFactor is 1,
- // we have an old-school gradient bezel in text fields whether they are styled or not. This is fine 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 11385461 is resolved.
- if (useNewGradient)
- [m_textField.get() setBackgroundColor:[NSColor whiteColor]];
- else
- [m_textField.get() setBackgroundColor:[NSColor clearColor]];
-#endif
-
return m_textField.get();
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes