WebKit Bugzilla
Attachment 370579 Details for
Bug 198224
: Plumb dark appearance down to GraphicsContext
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198224-20190524123335.patch (text/plain), 8.23 KB, created by
Timothy Hatcher
on 2019-05-24 12:33:35 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Timothy Hatcher
Created:
2019-05-24 12:33:35 PDT
Size:
8.23 KB
patch
obsolete
>Subversion Revision: 245745 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index c9098ae487d9e687a7fdc318e166070b27ebdd67..4a88932406715d301a24413e51be761066680c20 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,27 @@ >+2019-05-24 Timothy Hatcher <timothy@apple.com> >+ >+ Plumb dark appearance down to GraphicsContext. >+ https://bugs.webkit.org/show_bug.cgi?id=198224 >+ rdar://problem/51068494 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ No test yet, as it is not testable until this gets used. >+ >+ * platform/graphics/GraphicsContext.cpp: >+ (WebCore::GraphicsContextStateChange::changesFromState const): >+ (WebCore::GraphicsContextStateChange::accumulate): >+ (WebCore::GraphicsContextStateChange::apply const): >+ (WebCore::GraphicsContextStateChange::dump const): >+ (WebCore::GraphicsContext::setUseDarkAppearance): >+ * platform/graphics/GraphicsContext.h: >+ (WebCore::GraphicsContext::useDarkAppearance const): >+ * rendering/TextPaintStyle.cpp: >+ (WebCore::TextPaintStyle::operator== const): >+ (WebCore::computeTextPaintStyle): >+ (WebCore::updateGraphicsContext): >+ * rendering/TextPaintStyle.h: >+ > 2019-05-24 Saam barati <sbarati@apple.com> > > [WHLSL] ReadModifyWriteExpression always has a result and new value expression >diff --git a/Source/WebCore/platform/graphics/GraphicsContext.cpp b/Source/WebCore/platform/graphics/GraphicsContext.cpp >index 36cc5267465be27dc65bf6dc1f31f624868189eb..1332c940fd102763df4d08dd26f8caa241cefad5 100644 >--- a/Source/WebCore/platform/graphics/GraphicsContext.cpp >+++ b/Source/WebCore/platform/graphics/GraphicsContext.cpp >@@ -109,6 +109,10 @@ GraphicsContextState::StateChangeFlags GraphicsContextStateChange::changesFromSt > CHECK_FOR_CHANGED_PROPERTY(DrawLuminanceMaskChange, drawLuminanceMask); > CHECK_FOR_CHANGED_PROPERTY(ImageInterpolationQualityChange, imageInterpolationQuality); > >+#if HAVE(OS_DARK_MODE_SUPPORT) >+ CHECK_FOR_CHANGED_PROPERTY(UseDarkAppearanceChange, useDarkAppearance); >+#endif >+ > return changeFlags; > } > >@@ -177,7 +181,12 @@ void GraphicsContextStateChange::accumulate(const GraphicsContextState& state, G > > if (flags & GraphicsContextState::ImageInterpolationQualityChange) > m_state.imageInterpolationQuality = state.imageInterpolationQuality; >- >+ >+#if HAVE(OS_DARK_MODE_SUPPORT) >+ if (flags & GraphicsContextState::UseDarkAppearanceChange) >+ m_state.useDarkAppearance = state.useDarkAppearance; >+#endif >+ > m_changeFlags |= flags; > } > >@@ -245,6 +254,11 @@ void GraphicsContextStateChange::apply(GraphicsContext& context) const > > if (m_changeFlags & GraphicsContextState::ImageInterpolationQualityChange) > context.setImageInterpolationQuality(m_state.imageInterpolationQuality); >+ >+#if HAVE(OS_DARK_MODE_SUPPORT) >+ if (m_changeFlags & GraphicsContextState::UseDarkAppearanceChange) >+ context.setUseDarkAppearance(m_state.useDarkAppearance); >+#endif > } > > void GraphicsContextStateChange::dump(TextStream& ts) const >@@ -312,6 +326,11 @@ void GraphicsContextStateChange::dump(TextStream& ts) const > > if (m_changeFlags & GraphicsContextState::DrawLuminanceMaskChange) > ts.dumpProperty("draw-luminance-mask", m_state.drawLuminanceMask); >+ >+#if HAVE(OS_DARK_MODE_SUPPORT) >+ if (m_changeFlags & GraphicsContextState::UseDarkAppearanceChange) >+ ts.dumpProperty("use-dark-appearance", m_state.useDarkAppearance); >+#endif > } > > TextStream& operator<<(TextStream& ts, const GraphicsContextStateChange& stateChange) >@@ -939,6 +958,15 @@ void GraphicsContext::setDrawLuminanceMask(bool drawLuminanceMask) > m_impl->updateState(m_state, GraphicsContextState::DrawLuminanceMaskChange); > } > >+#if HAVE(OS_DARK_MODE_SUPPORT) >+void GraphicsContext::setUseDarkAppearance(bool useDarkAppearance) >+{ >+ m_state.useDarkAppearance = useDarkAppearance; >+ if (m_impl) >+ m_impl->updateState(m_state, GraphicsContextState::UseDarkAppearanceChange); >+} >+#endif >+ > #if !USE(CG) && !USE(DIRECT2D) > // Implement this if you want to go push the drawing mode into your native context immediately. > void GraphicsContext::setPlatformTextDrawingMode(TextDrawingModeFlags) >diff --git a/Source/WebCore/platform/graphics/GraphicsContext.h b/Source/WebCore/platform/graphics/GraphicsContext.h >index 1c366d51cbd74d0bcedec5790df2ed71aacc7a96..638b7671c9ecb53ab8efb5b8f3ed3a2c3f36e4c4 100644 >--- a/Source/WebCore/platform/graphics/GraphicsContext.h >+++ b/Source/WebCore/platform/graphics/GraphicsContext.h >@@ -163,6 +163,9 @@ struct GraphicsContextState { > ShouldSubpixelQuantizeFontsChange = 1 << 19, > DrawLuminanceMaskChange = 1 << 20, > ImageInterpolationQualityChange = 1 << 21, >+#if HAVE(OS_DARK_MODE_SUPPORT) >+ UseDarkAppearanceChange = 1 << 22, >+#endif > }; > typedef uint32_t StateChangeFlags; > >@@ -199,6 +202,9 @@ struct GraphicsContextState { > bool shadowsUseLegacyRadius : 1; > #endif > bool drawLuminanceMask : 1; >+#if HAVE(OS_DARK_MODE_SUPPORT) >+ bool useDarkAppearance : 1; >+#endif > }; > > struct ImagePaintingOptions { >@@ -410,6 +416,11 @@ public: > void setTextDrawingMode(TextDrawingModeFlags); > TextDrawingModeFlags textDrawingMode() const { return m_state.textDrawingMode; } > >+#if HAVE(OS_DARK_MODE_SUPPORT) >+ void setUseDarkAppearance(bool); >+ bool useDarkAppearance() const { return m_state.useDarkAppearance; } >+#endif >+ > float drawText(const FontCascade&, const TextRun&, const FloatPoint&, unsigned from = 0, Optional<unsigned> to = WTF::nullopt); > void drawGlyphs(const Font&, const GlyphBuffer&, unsigned from, unsigned numGlyphs, const FloatPoint&, FontSmoothingMode); > void drawEmphasisMarks(const FontCascade&, const TextRun&, const AtomicString& mark, const FloatPoint&, unsigned from = 0, Optional<unsigned> to = WTF::nullopt); >diff --git a/Source/WebCore/rendering/TextPaintStyle.cpp b/Source/WebCore/rendering/TextPaintStyle.cpp >index 9b56b0a5407299702c29ea68e139434991601671..76d9c84e8634eb81d523b883af8d754c7bed303c 100644 >--- a/Source/WebCore/rendering/TextPaintStyle.cpp >+++ b/Source/WebCore/rendering/TextPaintStyle.cpp >@@ -51,6 +51,9 @@ bool TextPaintStyle::operator==(const TextPaintStyle& other) const > && strokeWidth == other.strokeWidth && paintOrder == other.paintOrder && lineJoin == other.lineJoin > #if ENABLE(LETTERPRESS) > && useLetterpressEffect == other.useLetterpressEffect >+#endif >+#if HAVE(OS_DARK_MODE_SUPPORT) >+ && useDarkAppearance == other.useDarkAppearance > #endif > && lineCap == other.lineCap && miterLimit == other.miterLimit; > } >@@ -81,6 +84,11 @@ TextPaintStyle computeTextPaintStyle(const Frame& frame, const RenderStyle& line > #if ENABLE(LETTERPRESS) > paintStyle.useLetterpressEffect = lineStyle.textDecorationsInEffect().contains(TextDecoration::Letterpress); > #endif >+ >+#if HAVE(OS_DARK_MODE_SUPPORT) >+ paintStyle.useDarkAppearance = frame.document() ? frame.document()->useDarkAppearance(&lineStyle) : false; >+#endif >+ > auto viewportSize = frame.view() ? frame.view()->size() : IntSize(); > paintStyle.strokeWidth = lineStyle.computedStrokeWidth(viewportSize); > paintStyle.paintOrder = lineStyle.paintOrder(); >@@ -186,6 +194,10 @@ void updateGraphicsContext(GraphicsContext& context, const TextPaintStyle& paint > mode = newMode; > } > >+#if HAVE(OS_DARK_MODE_SUPPORT) >+ context.setUseDarkAppearance(paintStyle.useDarkAppearance); >+#endif >+ > Color fillColor = fillColorType == UseEmphasisMarkColor ? paintStyle.emphasisMarkColor : paintStyle.fillColor; > if (mode & TextModeFill && (fillColor != context.fillColor())) > context.setFillColor(fillColor); >diff --git a/Source/WebCore/rendering/TextPaintStyle.h b/Source/WebCore/rendering/TextPaintStyle.h >index c9f104c6e80ad3fe251c33fbe42ef4bccefb4d42..8a502b88f2e2f937d96293f27a3101ab41c63951 100644 >--- a/Source/WebCore/rendering/TextPaintStyle.h >+++ b/Source/WebCore/rendering/TextPaintStyle.h >@@ -51,6 +51,9 @@ struct TextPaintStyle { > float strokeWidth { 0 }; > #if ENABLE(LETTERPRESS) > bool useLetterpressEffect { false }; >+#endif >+#if HAVE(OS_DARK_MODE_SUPPORT) >+ bool useDarkAppearance { false }; > #endif > PaintOrder paintOrder { PaintOrder::Normal }; > LineJoin lineJoin { MiterJoin };
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
dino
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198224
: 370579