Changeset 245752 in webkit
- Timestamp:
- May 24, 2019 2:41:00 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r245748 r245752 1 2019-05-24 Timothy Hatcher <timothy@apple.com> 2 3 Plumb dark appearance down to GraphicsContext. 4 https://bugs.webkit.org/show_bug.cgi?id=198224 5 rdar://problem/51068494 6 7 Reviewed by Dean Jackson. 8 9 No test yet, as it is not testable until this gets used. 10 11 * platform/graphics/GraphicsContext.cpp: 12 (WebCore::GraphicsContextStateChange::changesFromState const): 13 (WebCore::GraphicsContextStateChange::accumulate): 14 (WebCore::GraphicsContextStateChange::apply const): 15 (WebCore::GraphicsContextStateChange::dump const): 16 (WebCore::GraphicsContext::setUseDarkAppearance): 17 * platform/graphics/GraphicsContext.h: 18 (WebCore::GraphicsContext::useDarkAppearance const): 19 * rendering/TextPaintStyle.cpp: 20 (WebCore::TextPaintStyle::operator== const): 21 (WebCore::computeTextPaintStyle): 22 (WebCore::updateGraphicsContext): 23 * rendering/TextPaintStyle.h: 24 1 25 2019-05-24 Youenn Fablet <youenn@apple.com> 2 26 -
trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp
r243163 r245752 110 110 CHECK_FOR_CHANGED_PROPERTY(ImageInterpolationQualityChange, imageInterpolationQuality); 111 111 112 #if HAVE(OS_DARK_MODE_SUPPORT) 113 CHECK_FOR_CHANGED_PROPERTY(UseDarkAppearanceChange, useDarkAppearance); 114 #endif 115 112 116 return changeFlags; 113 117 } … … 178 182 if (flags & GraphicsContextState::ImageInterpolationQualityChange) 179 183 m_state.imageInterpolationQuality = state.imageInterpolationQuality; 180 184 185 #if HAVE(OS_DARK_MODE_SUPPORT) 186 if (flags & GraphicsContextState::UseDarkAppearanceChange) 187 m_state.useDarkAppearance = state.useDarkAppearance; 188 #endif 189 181 190 m_changeFlags |= flags; 182 191 } … … 246 255 if (m_changeFlags & GraphicsContextState::ImageInterpolationQualityChange) 247 256 context.setImageInterpolationQuality(m_state.imageInterpolationQuality); 257 258 #if HAVE(OS_DARK_MODE_SUPPORT) 259 if (m_changeFlags & GraphicsContextState::UseDarkAppearanceChange) 260 context.setUseDarkAppearance(m_state.useDarkAppearance); 261 #endif 248 262 } 249 263 … … 313 327 if (m_changeFlags & GraphicsContextState::DrawLuminanceMaskChange) 314 328 ts.dumpProperty("draw-luminance-mask", m_state.drawLuminanceMask); 329 330 #if HAVE(OS_DARK_MODE_SUPPORT) 331 if (m_changeFlags & GraphicsContextState::UseDarkAppearanceChange) 332 ts.dumpProperty("use-dark-appearance", m_state.useDarkAppearance); 333 #endif 315 334 } 316 335 … … 939 958 m_impl->updateState(m_state, GraphicsContextState::DrawLuminanceMaskChange); 940 959 } 960 961 #if HAVE(OS_DARK_MODE_SUPPORT) 962 void GraphicsContext::setUseDarkAppearance(bool useDarkAppearance) 963 { 964 m_state.useDarkAppearance = useDarkAppearance; 965 if (m_impl) 966 m_impl->updateState(m_state, GraphicsContextState::UseDarkAppearanceChange); 967 } 968 #endif 941 969 942 970 #if !USE(CG) && !USE(DIRECT2D) -
trunk/Source/WebCore/platform/graphics/GraphicsContext.h
r241271 r245752 164 164 DrawLuminanceMaskChange = 1 << 20, 165 165 ImageInterpolationQualityChange = 1 << 21, 166 #if HAVE(OS_DARK_MODE_SUPPORT) 167 UseDarkAppearanceChange = 1 << 22, 168 #endif 166 169 }; 167 170 typedef uint32_t StateChangeFlags; … … 200 203 #endif 201 204 bool drawLuminanceMask : 1; 205 #if HAVE(OS_DARK_MODE_SUPPORT) 206 bool useDarkAppearance : 1; 207 #endif 202 208 }; 203 209 … … 410 416 void setTextDrawingMode(TextDrawingModeFlags); 411 417 TextDrawingModeFlags textDrawingMode() const { return m_state.textDrawingMode; } 418 419 #if HAVE(OS_DARK_MODE_SUPPORT) 420 void setUseDarkAppearance(bool); 421 bool useDarkAppearance() const { return m_state.useDarkAppearance; } 422 #endif 412 423 413 424 float drawText(const FontCascade&, const TextRun&, const FloatPoint&, unsigned from = 0, Optional<unsigned> to = WTF::nullopt); -
trunk/Source/WebCore/rendering/TextPaintStyle.cpp
r239427 r245752 53 53 && useLetterpressEffect == other.useLetterpressEffect 54 54 #endif 55 #if HAVE(OS_DARK_MODE_SUPPORT) 56 && useDarkAppearance == other.useDarkAppearance 57 #endif 55 58 && lineCap == other.lineCap && miterLimit == other.miterLimit; 56 59 } … … 82 85 paintStyle.useLetterpressEffect = lineStyle.textDecorationsInEffect().contains(TextDecoration::Letterpress); 83 86 #endif 87 88 #if HAVE(OS_DARK_MODE_SUPPORT) 89 paintStyle.useDarkAppearance = frame.document() ? frame.document()->useDarkAppearance(&lineStyle) : false; 90 #endif 91 84 92 auto viewportSize = frame.view() ? frame.view()->size() : IntSize(); 85 93 paintStyle.strokeWidth = lineStyle.computedStrokeWidth(viewportSize); … … 187 195 } 188 196 197 #if HAVE(OS_DARK_MODE_SUPPORT) 198 context.setUseDarkAppearance(paintStyle.useDarkAppearance); 199 #endif 200 189 201 Color fillColor = fillColorType == UseEmphasisMarkColor ? paintStyle.emphasisMarkColor : paintStyle.fillColor; 190 202 if (mode & TextModeFill && (fillColor != context.fillColor())) -
trunk/Source/WebCore/rendering/TextPaintStyle.h
r239427 r245752 53 53 bool useLetterpressEffect { false }; 54 54 #endif 55 #if HAVE(OS_DARK_MODE_SUPPORT) 56 bool useDarkAppearance { false }; 57 #endif 55 58 PaintOrder paintOrder { PaintOrder::Normal }; 56 59 LineJoin lineJoin { MiterJoin };
Note: See TracChangeset
for help on using the changeset viewer.