Title: [121573] branches/safari-534.57-branch/Source/WebCore
Revision
121573
Author
lforsch...@apple.com
Date
2012-06-29 10:47:34 -0700 (Fri, 29 Jun 2012)

Log Message

Merge <rdar://problem/11736630>

Modified Paths


Diff

Modified: branches/safari-534.57-branch/Source/WebCore/ChangeLog (121572 => 121573)


--- branches/safari-534.57-branch/Source/WebCore/ChangeLog	2012-06-29 17:36:26 UTC (rev 121572)
+++ branches/safari-534.57-branch/Source/WebCore/ChangeLog	2012-06-29 17:47:34 UTC (rev 121573)
@@ -1,3 +1,41 @@
+2012-06-28  Lucas Forschler  <lforsch...@apple.com>
+
+    Merge 117502
+
+    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-30  Lucas Forschler  <lforsch...@apple.com>
 
     Merge 108550

Modified: branches/safari-534.57-branch/Source/WebCore/rendering/RenderThemeMac.h (121572 => 121573)


--- branches/safari-534.57-branch/Source/WebCore/rendering/RenderThemeMac.h	2012-06-29 17:36:26 UTC (rev 121572)
+++ branches/safari-534.57-branch/Source/WebCore/rendering/RenderThemeMac.h	2012-06-29 17:47:34 UTC (rev 121573)
@@ -218,7 +218,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: branches/safari-534.57-branch/Source/WebCore/rendering/RenderThemeMac.mm (121572 => 121573)


--- branches/safari-534.57-branch/Source/WebCore/rendering/RenderThemeMac.mm	2012-06-29 17:36:26 UTC (rev 121572)
+++ branches/safari-534.57-branch/Source/WebCore/rendering/RenderThemeMac.mm	2012-06-29 17:47:34 UTC (rev 121573)
@@ -709,19 +709,23 @@
 {
     LocalCurrentGraphicsContext localContext(paintInfo.context);
 
-    // See comment in RenderThemeMac::textField() for a complete explanation of this. In short,
-    // we only want to use the new style gradient for completely unstyled text fields in HiDPI. 
-    // isControledStyle(), however, treats all text fields that do not have custom borders as
-    // "unstyled" to avoid using the CSS border in that case, so we have to sniff around for 
-    // other types of styling.
-    bool useNewGradient = WebCore::deviceScaleFactor(o->frame()) != 1;
-    if (useNewGradient) {
-        useNewGradient = o->style()->hasAppearance() 
-            && o->style()->visitedDependentColor(CSSPropertyBackgroundColor) == Color::white
-            && !o->style()->hasBackgroundImage();
+#if defined(BUILDING_ON_LION) || defined(BUILDING_ON_SNOW_LEOPARD)
+    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;
     }
-    NSTextFieldCell* textField = this->textField(useNewGradient);
+#endif
 
+    NSTextFieldCell *textField = this->textField();
+
     GraphicsContextStateSaver stateSaver(*paintInfo.context);
 
     [textField setEnabled:(isEnabled(o) && !isReadOnlyControl(o))];
@@ -2047,7 +2051,7 @@
     return m_sliderThumbVertical.get();
 }
 
-NSTextFieldCell* RenderThemeMac::textField(bool useNewGradient) const
+NSTextFieldCell* RenderThemeMac::textField() const
 {
     if (!m_textField) {
         m_textField.adoptNS([[NSTextFieldCell alloc] initTextCell:@""]);
@@ -2055,19 +2059,9 @@
         [m_textField.get() setEditable:YES];
         [m_textField.get() setFocusRingType:NSFocusRingTypeExterior];
         [m_textField.get() setDrawsBackground:YES];
+        [m_textField.get() setBackgroundColor:[NSColor whiteColor]];
     }
 
-    // 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.
-    if (useNewGradient)
-        [m_textField.get() setBackgroundColor:[NSColor whiteColor]]; 
-    else
-        [m_textField.get() setBackgroundColor:[NSColor clearColor]];
-
     return m_textField.get();
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to