Title: [110752] branches/safari-534.55-branch/Source/WebCore

Diff

Modified: branches/safari-534.55-branch/Source/WebCore/ChangeLog (110751 => 110752)


--- branches/safari-534.55-branch/Source/WebCore/ChangeLog	2012-03-14 21:21:42 UTC (rev 110751)
+++ branches/safari-534.55-branch/Source/WebCore/ChangeLog	2012-03-14 21:24:44 UTC (rev 110752)
@@ -1,3 +1,21 @@
+2012-03-14  Lucas Forschler  <[email protected]>
+
+    Merge 104240
+
+    2012-01-05  Beth Dakin  <[email protected]>
+
+            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):
+
 2012-03-07  Lucas Forschler  <[email protected]>
 
     Merge 109594

Modified: branches/safari-534.55-branch/Source/WebCore/rendering/RenderThemeMac.h (110751 => 110752)


--- branches/safari-534.55-branch/Source/WebCore/rendering/RenderThemeMac.h	2012-03-14 21:21:42 UTC (rev 110751)
+++ branches/safari-534.55-branch/Source/WebCore/rendering/RenderThemeMac.h	2012-03-14 21:24:44 UTC (rev 110752)
@@ -218,6 +218,7 @@
     NSMenu* searchMenuTemplate() const;
     NSSliderCell* sliderThumbHorizontal() const;
     NSSliderCell* sliderThumbVertical() const;
+    NSTextFieldCell* textField() const;
 
 #if ENABLE(METER_TAG)
     NSLevelIndicatorStyle levelIndicatorStyleFor(ControlPart) const;
@@ -231,6 +232,7 @@
     mutable RetainPtr<NSSliderCell> m_sliderThumbHorizontal;
     mutable RetainPtr<NSSliderCell> m_sliderThumbVertical;
     mutable RetainPtr<NSLevelIndicatorCell> m_levelIndicator;
+    mutable RetainPtr<NSTextFieldCell> m_textField;
 
     bool m_isSliderThumbHorizontalPressed;
     bool m_isSliderThumbVerticalPressed;

Modified: branches/safari-534.55-branch/Source/WebCore/rendering/RenderThemeMac.mm (110751 => 110752)


--- branches/safari-534.55-branch/Source/WebCore/rendering/RenderThemeMac.mm	2012-03-14 21:21:42 UTC (rev 110751)
+++ branches/safari-534.55-branch/Source/WebCore/rendering/RenderThemeMac.mm	2012-03-14 21:24:44 UTC (rev 110752)
@@ -707,7 +707,15 @@
 bool RenderThemeMac::paintTextField(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
 {
     LocalCurrentGraphicsContext localContext(paintInfo.context);
-    wkDrawBezeledTextFieldCell(r, isEnabled(o) && !isReadOnlyControl(o));
+    NSTextFieldCell* textField = this->textField();
+
+    GraphicsContextStateSaver stateSaver(*paintInfo.context);
+
+    [textField setEnabled:(isEnabled(o) && !isReadOnlyControl(o))];
+    [textField drawWithFrame:NSRect(r) inView:documentViewFor(o)];
+
+    [textField setControlView:nil];
+
     return false;
 }
 
@@ -2035,4 +2043,21 @@
     return m_sliderThumbVertical.get();
 }
 
+NSTextFieldCell* RenderThemeMac::textField() const
+{
+    if (!m_textField) {
+        m_textField.adoptNS([[NSTextFieldCell alloc] initTextCell:@""]);
+        [m_textField.get() setBezeled:YES];
+        [m_textField.get() setEditable:YES];
+        [m_textField.get() setFocusRingType:NSFocusRingTypeExterior];
+
+        // Setting a clear background on the cell is necessary for CSS-styled backgrounds
+        // to show through. Ideally, there would be a better way to do this.
+        [m_textField.get() setDrawsBackground:YES];
+        [m_textField.get() setBackgroundColor:[NSColor clearColor]];
+    }
+
+    return m_textField.get();
+}
+
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to