Title: [290050] trunk/Source/WebCore
Revision
290050
Author
[email protected]
Date
2022-02-17 12:21:43 -0800 (Thu, 17 Feb 2022)

Log Message

Unreviewed, reverting r290046.
https://bugs.webkit.org/show_bug.cgi?id=236797

Broke the macOS build

Reverted changeset:

"[macOS] Light appearance text fields are invisible in
Increased Contrast mode"
https://bugs.webkit.org/show_bug.cgi?id=236753
https://commits.webkit.org/r290046

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (290049 => 290050)


--- trunk/Source/WebCore/ChangeLog	2022-02-17 20:19:09 UTC (rev 290049)
+++ trunk/Source/WebCore/ChangeLog	2022-02-17 20:21:43 UTC (rev 290050)
@@ -1,3 +1,17 @@
+2022-02-17  Commit Queue  <[email protected]>
+
+        Unreviewed, reverting r290046.
+        https://bugs.webkit.org/show_bug.cgi?id=236797
+
+        Broke the macOS build
+
+        Reverted changeset:
+
+        "[macOS] Light appearance text fields are invisible in
+        Increased Contrast mode"
+        https://bugs.webkit.org/show_bug.cgi?id=236753
+        https://commits.webkit.org/r290046
+
 2022-02-17  Patrick Angle  <[email protected]>
 
         Web Inspector: [Flexbox] Gaps and free space do not have pattern fills when navigating to a page with Web Inspector already open

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.h (290049 => 290050)


--- trunk/Source/WebCore/rendering/RenderThemeMac.h	2022-02-17 20:19:09 UTC (rev 290049)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.h	2022-02-17 20:21:43 UTC (rev 290050)
@@ -165,8 +165,6 @@
 private:
     String fileListNameForWidth(const FileList*, const FontCascade&, int width, bool multipleFilesAllowed) const final;
 
-    bool shouldPaintCustomTextField(const RenderObject&) const;
-
     Color systemColor(CSSValueID, OptionSet<StyleColorOptions>) const final;
 
     // Get the control size based off the font. Used by some of the controls (like buttons).

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (290049 => 290050)


--- trunk/Source/WebCore/rendering/RenderThemeMac.mm	2022-02-17 20:19:09 UTC (rev 290049)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm	2022-02-17 20:21:43 UTC (rev 290050)
@@ -1095,52 +1095,28 @@
 }
 #endif
 
-bool RenderThemeMac::shouldPaintCustomTextField(const RenderObject& renderer) const
-{
-    // <rdar://problem/88948646> Prevent AppKit from painting textfields in the light appearance
-    // with increased contrast, as the border is not painted, rendering the control invisible.
-#if HAVE_LARGE_CONTROL_SIZE
-    return Theme::singleton().userPrefersContrast() && !renderer.useDarkAppearance();
-#else
-    return false;
-#endif
-}
-
 bool RenderThemeMac::paintTextField(const RenderObject& o, const PaintInfo& paintInfo, const FloatRect& r)
 {
-    FloatRect paintRect(r);
-    auto& context = paintInfo.context();
+    LocalCurrentGraphicsContext localContext(paintInfo.context());
 
-    LocalCurrentGraphicsContext localContext(context);
-    GraphicsContextStateSaver stateSaver(context);
+    // <rdar://problem/22896977> We adjust the paint rect here to account for how AppKit draws the text
+    // field cell slightly smaller than the rect we pass to drawWithFrame.
+    FloatRect adjustedPaintRect(r);
+    AffineTransform transform = paintInfo.context().getCTM();
+    if (transform.xScale() > 1 || transform.yScale() > 1) {
+        adjustedPaintRect.inflateX(1 / transform.xScale());
+        adjustedPaintRect.inflateY(2 / transform.yScale());
+        adjustedPaintRect.move(0, -1 / transform.yScale());
+    }
+    NSTextFieldCell *textField = this->textField();
 
-    auto enabled = isEnabled(o) && !isReadOnlyControl(o);
+    GraphicsContextStateSaver stateSaver(paintInfo.context());
 
-    if (shouldPaintCustomTextField(o)) {
-        constexpr int strokeThickness = 1;
+    [textField setEnabled:(isEnabled(o) && !isReadOnlyControl(o))];
+    [textField drawWithFrame:NSRect(adjustedPaintRect) inView:documentViewFor(o)];
 
-        FloatRect strokeRect(paintRect);
-        strokeRect.inflate(-strokeThickness / 2.0f);
+    [textField setControlView:nil];
 
-        context.setStrokeColor(enabled ? Color::black : Color::darkGray);
-        context.setStrokeStyle(SolidStroke);
-        context.strokeRect(strokeRect, strokeThickness);
-    } else {
-        // <rdar://problem/22896977> We adjust the paint rect here to account for how AppKit draws the text
-        // field cell slightly smaller than the rect we pass to drawWithFrame.
-        AffineTransform transform = context.getCTM();
-        if (transform.xScale() > 1 || transform.yScale() > 1) {
-            paintRect.inflateX(1 / transform.xScale());
-            paintRect.inflateY(2 / transform.yScale());
-            paintRect.move(0, -1 / transform.yScale());
-        }
-
-        NSTextFieldCell *textField = this->textField();
-        [textField setEnabled:enabled];
-        [textField drawWithFrame:NSRect(paintRect) inView:documentViewFor(o)];
-        [textField setControlView:nil];
-    }
-
 #if ENABLE(DATALIST_ELEMENT)
     if (!is<HTMLInputElement>(o.generatingNode()))
         return false;
@@ -1147,7 +1123,7 @@
 
     const auto& input = downcast<HTMLInputElement>(*(o.generatingNode()));
     if (input.list())
-        paintListButtonForInput(o, context, paintRect);
+        paintListButtonForInput(o, paintInfo.context(), adjustedPaintRect);
 #endif
 
     return false;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to