Title: [104240] trunk/Source/WebCore
- Revision
- 104240
- Author
- [email protected]
- Date
- 2012-01-05 16:30:50 -0800 (Thu, 05 Jan 2012)
Log Message
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):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (104239 => 104240)
--- trunk/Source/WebCore/ChangeLog 2012-01-06 00:29:14 UTC (rev 104239)
+++ trunk/Source/WebCore/ChangeLog 2012-01-06 00:30:50 UTC (rev 104240)
@@ -1,3 +1,17 @@
+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-01-05 Ryosuke Niwa <[email protected]>
Add a compile-time assertion for the size of CSSValue
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.h (104239 => 104240)
--- trunk/Source/WebCore/rendering/RenderThemeMac.h 2012-01-06 00:29:14 UTC (rev 104239)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.h 2012-01-06 00:30:50 UTC (rev 104240)
@@ -219,6 +219,7 @@
NSMenu* searchMenuTemplate() const;
NSSliderCell* sliderThumbHorizontal() const;
NSSliderCell* sliderThumbVertical() const;
+ NSTextFieldCell* textField() const;
#if ENABLE(METER_TAG)
NSLevelIndicatorStyle levelIndicatorStyleFor(ControlPart) const;
@@ -238,6 +239,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: trunk/Source/WebCore/rendering/RenderThemeMac.mm (104239 => 104240)
--- trunk/Source/WebCore/rendering/RenderThemeMac.mm 2012-01-06 00:29:14 UTC (rev 104239)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm 2012-01-06 00:30:50 UTC (rev 104240)
@@ -713,7 +713,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;
}
@@ -2084,6 +2092,23 @@
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();
+}
+
String RenderThemeMac::fileListNameForWidth(const Vector<String>& filenames, const Font& font, int width, bool multipleFilesAllowed)
{
if (width <= 0)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes