Clean up text decoration drawing code
[WebKit-https.git] / Source / WebCore / platform / graphics / GraphicsContext.cpp
1 /*
2  * Copyright (C) 2003, 2004, 2005, 2006, 2009, 2013 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #include "config.h"
27 #include "GraphicsContext.h"
28
29 #include "BidiResolver.h"
30 #include "BitmapImage.h"
31 #include "FloatRoundedRect.h"
32 #include "Gradient.h"
33 #include "GraphicsContextImpl.h"
34 #include "ImageBuffer.h"
35 #include "IntRect.h"
36 #include "RoundedRect.h"
37 #include "TextRun.h"
38 #include <wtf/text/TextStream.h>
39
40 namespace WebCore {
41
42 class TextRunIterator {
43 public:
44     TextRunIterator()
45         : m_textRun(0)
46         , m_offset(0)
47     {
48     }
49
50     TextRunIterator(const TextRun* textRun, unsigned offset)
51         : m_textRun(textRun)
52         , m_offset(offset)
53     {
54     }
55
56     TextRunIterator(const TextRunIterator& other)
57         : m_textRun(other.m_textRun)
58         , m_offset(other.m_offset)
59     {
60     }
61
62     unsigned offset() const { return m_offset; }
63     void increment() { m_offset++; }
64     bool atEnd() const { return !m_textRun || m_offset >= m_textRun->length(); }
65     UChar current() const { return (*m_textRun)[m_offset]; }
66     UCharDirection direction() const { return atEnd() ? U_OTHER_NEUTRAL : u_charDirection(current()); }
67
68     bool operator==(const TextRunIterator& other)
69     {
70         return m_offset == other.m_offset && m_textRun == other.m_textRun;
71     }
72
73     bool operator!=(const TextRunIterator& other) { return !operator==(other); }
74
75 private:
76     const TextRun* m_textRun;
77     unsigned m_offset;
78 };
79
80 #define CHECK_FOR_CHANGED_PROPERTY(flag, property) \
81     if ((m_changeFlags & GraphicsContextState::flag) && (m_state.property != state.property)) \
82         changeFlags |= GraphicsContextState::flag;
83
84 GraphicsContextState::StateChangeFlags GraphicsContextStateChange::changesFromState(const GraphicsContextState& state) const
85 {
86     GraphicsContextState::StateChangeFlags changeFlags = GraphicsContextState::NoChange;
87
88     CHECK_FOR_CHANGED_PROPERTY(StrokeGradientChange, strokeGradient);
89     CHECK_FOR_CHANGED_PROPERTY(StrokePatternChange, strokePattern);
90     CHECK_FOR_CHANGED_PROPERTY(FillGradientChange, fillGradient);
91     CHECK_FOR_CHANGED_PROPERTY(FillPatternChange, fillPattern);
92
93     if ((m_changeFlags & GraphicsContextState::ShadowChange)
94         && (m_state.shadowOffset != state.shadowOffset
95             || m_state.shadowBlur != state.shadowBlur
96             || m_state.shadowColor != state.shadowColor))
97         changeFlags |= GraphicsContextState::ShadowChange;
98
99     CHECK_FOR_CHANGED_PROPERTY(StrokeThicknessChange, strokeThickness);
100     CHECK_FOR_CHANGED_PROPERTY(TextDrawingModeChange, textDrawingMode);
101     CHECK_FOR_CHANGED_PROPERTY(StrokeColorChange, strokeColor);
102     CHECK_FOR_CHANGED_PROPERTY(FillColorChange, fillColor);
103     CHECK_FOR_CHANGED_PROPERTY(StrokeStyleChange, strokeStyle);
104     CHECK_FOR_CHANGED_PROPERTY(FillRuleChange, fillRule);
105     CHECK_FOR_CHANGED_PROPERTY(AlphaChange, alpha);
106
107     if ((m_changeFlags & (GraphicsContextState::CompositeOperationChange | GraphicsContextState::BlendModeChange))
108         && (m_state.compositeOperator != state.compositeOperator || m_state.blendMode != state.blendMode))
109         changeFlags |= (GraphicsContextState::CompositeOperationChange | GraphicsContextState::BlendModeChange);
110
111     CHECK_FOR_CHANGED_PROPERTY(ShouldAntialiasChange, shouldAntialias);
112     CHECK_FOR_CHANGED_PROPERTY(ShouldSmoothFontsChange, shouldSmoothFonts);
113     CHECK_FOR_CHANGED_PROPERTY(ShouldSubpixelQuantizeFontsChange, shouldSubpixelQuantizeFonts);
114     CHECK_FOR_CHANGED_PROPERTY(ShadowsIgnoreTransformsChange, shadowsIgnoreTransforms);
115     CHECK_FOR_CHANGED_PROPERTY(DrawLuminanceMaskChange, drawLuminanceMask);
116     CHECK_FOR_CHANGED_PROPERTY(ImageInterpolationQualityChange, imageInterpolationQuality);
117
118     return changeFlags;
119 }
120
121 void GraphicsContextStateChange::accumulate(const GraphicsContextState& state, GraphicsContextState::StateChangeFlags flags)
122 {
123     // FIXME: This code should move to GraphicsContextState.
124     if (flags & GraphicsContextState::StrokeGradientChange)
125         m_state.strokeGradient = state.strokeGradient;
126
127     if (flags & GraphicsContextState::StrokePatternChange)
128         m_state.strokePattern = state.strokePattern;
129
130     if (flags & GraphicsContextState::FillGradientChange)
131         m_state.fillGradient = state.fillGradient;
132
133     if (flags & GraphicsContextState::FillPatternChange)
134         m_state.fillPattern = state.fillPattern;
135
136     if (flags & GraphicsContextState::ShadowChange) {
137         // FIXME: Deal with state.shadowsUseLegacyRadius.
138         m_state.shadowOffset = state.shadowOffset;
139         m_state.shadowBlur = state.shadowBlur;
140         m_state.shadowColor = state.shadowColor;
141     }
142
143     if (flags & GraphicsContextState::StrokeThicknessChange)
144         m_state.strokeThickness = state.strokeThickness;
145
146     if (flags & GraphicsContextState::TextDrawingModeChange)
147         m_state.textDrawingMode = state.textDrawingMode;
148
149     if (flags & GraphicsContextState::StrokeColorChange)
150         m_state.strokeColor = state.strokeColor;
151
152     if (flags & GraphicsContextState::FillColorChange)
153         m_state.fillColor = state.fillColor;
154
155     if (flags & GraphicsContextState::StrokeStyleChange)
156         m_state.strokeStyle = state.strokeStyle;
157
158     if (flags & GraphicsContextState::FillRuleChange)
159         m_state.fillRule = state.fillRule;
160
161     if (flags & GraphicsContextState::AlphaChange)
162         m_state.alpha = state.alpha;
163
164     if (flags & (GraphicsContextState::CompositeOperationChange | GraphicsContextState::BlendModeChange)) {
165         m_state.compositeOperator = state.compositeOperator;
166         m_state.blendMode = state.blendMode;
167     }
168
169     if (flags & GraphicsContextState::ShouldAntialiasChange)
170         m_state.shouldAntialias = state.shouldAntialias;
171
172     if (flags & GraphicsContextState::ShouldSmoothFontsChange)
173         m_state.shouldSmoothFonts = state.shouldSmoothFonts;
174
175     if (flags & GraphicsContextState::ShouldSubpixelQuantizeFontsChange)
176         m_state.shouldSubpixelQuantizeFonts = state.shouldSubpixelQuantizeFonts;
177
178     if (flags & GraphicsContextState::ShadowsIgnoreTransformsChange)
179         m_state.shadowsIgnoreTransforms = state.shadowsIgnoreTransforms;
180
181     if (flags & GraphicsContextState::DrawLuminanceMaskChange)
182         m_state.drawLuminanceMask = state.drawLuminanceMask;
183
184     if (flags & GraphicsContextState::ImageInterpolationQualityChange)
185         m_state.imageInterpolationQuality = state.imageInterpolationQuality;
186     
187     m_changeFlags |= flags;
188 }
189
190 void GraphicsContextStateChange::apply(GraphicsContext& context) const
191 {
192     if (m_changeFlags & GraphicsContextState::StrokeGradientChange)
193         context.setStrokeGradient(*m_state.strokeGradient);
194
195     if (m_changeFlags & GraphicsContextState::StrokePatternChange)
196         context.setStrokePattern(*m_state.strokePattern);
197
198     if (m_changeFlags & GraphicsContextState::FillGradientChange)
199         context.setFillGradient(*m_state.fillGradient);
200
201     if (m_changeFlags & GraphicsContextState::FillPatternChange)
202         context.setFillPattern(*m_state.fillPattern);
203
204     if (m_changeFlags & GraphicsContextState::ShadowChange) {
205 #if USE(CG)
206         if (m_state.shadowsUseLegacyRadius)
207             context.setLegacyShadow(m_state.shadowOffset, m_state.shadowBlur, m_state.shadowColor);
208         else
209 #endif
210             context.setShadow(m_state.shadowOffset, m_state.shadowBlur, m_state.shadowColor);
211     }
212
213     if (m_changeFlags & GraphicsContextState::StrokeThicknessChange)
214         context.setStrokeThickness(m_state.strokeThickness);
215
216     if (m_changeFlags & GraphicsContextState::TextDrawingModeChange)
217         context.setTextDrawingMode(m_state.textDrawingMode);
218
219     if (m_changeFlags & GraphicsContextState::StrokeColorChange)
220         context.setStrokeColor(m_state.strokeColor);
221
222     if (m_changeFlags & GraphicsContextState::FillColorChange)
223         context.setFillColor(m_state.fillColor);
224
225     if (m_changeFlags & GraphicsContextState::StrokeStyleChange)
226         context.setStrokeStyle(m_state.strokeStyle);
227
228     if (m_changeFlags & GraphicsContextState::FillRuleChange)
229         context.setFillRule(m_state.fillRule);
230
231     if (m_changeFlags & GraphicsContextState::AlphaChange)
232         context.setAlpha(m_state.alpha);
233
234     if (m_changeFlags & (GraphicsContextState::CompositeOperationChange | GraphicsContextState::BlendModeChange))
235         context.setCompositeOperation(m_state.compositeOperator, m_state.blendMode);
236
237     if (m_changeFlags & GraphicsContextState::ShouldAntialiasChange)
238         context.setShouldAntialias(m_state.shouldAntialias);
239
240     if (m_changeFlags & GraphicsContextState::ShouldSmoothFontsChange)
241         context.setShouldSmoothFonts(m_state.shouldSmoothFonts);
242
243     if (m_changeFlags & GraphicsContextState::ShouldSubpixelQuantizeFontsChange)
244         context.setShouldSubpixelQuantizeFonts(m_state.shouldSubpixelQuantizeFonts);
245
246     if (m_changeFlags & GraphicsContextState::ShadowsIgnoreTransformsChange)
247         context.setShadowsIgnoreTransforms(m_state.shadowsIgnoreTransforms);
248
249     if (m_changeFlags & GraphicsContextState::DrawLuminanceMaskChange)
250         context.setDrawLuminanceMask(m_state.drawLuminanceMask);
251
252     if (m_changeFlags & GraphicsContextState::ImageInterpolationQualityChange)
253         context.setImageInterpolationQuality(m_state.imageInterpolationQuality);
254 }
255
256 void GraphicsContextStateChange::dump(TextStream& ts) const
257 {
258     ts.dumpProperty("change-flags", m_changeFlags);
259
260     if (m_changeFlags & GraphicsContextState::StrokeGradientChange)
261         ts.dumpProperty("stroke-gradient", m_state.strokeGradient.get());
262
263     if (m_changeFlags & GraphicsContextState::StrokePatternChange)
264         ts.dumpProperty("stroke-pattern", m_state.strokePattern.get());
265
266     if (m_changeFlags & GraphicsContextState::FillGradientChange)
267         ts.dumpProperty("fill-gradient", m_state.fillGradient.get());
268
269     if (m_changeFlags & GraphicsContextState::FillPatternChange)
270         ts.dumpProperty("fill-pattern", m_state.fillPattern.get());
271
272     if (m_changeFlags & GraphicsContextState::ShadowChange) {
273         ts.dumpProperty("shadow-blur", m_state.shadowBlur);
274         ts.dumpProperty("shadow-offset", m_state.shadowOffset);
275 #if USE(CG)
276         ts.dumpProperty("shadows-use-legacy-radius", m_state.shadowsUseLegacyRadius);
277 #endif
278     }
279
280     if (m_changeFlags & GraphicsContextState::StrokeThicknessChange)
281         ts.dumpProperty("stroke-thickness", m_state.strokeThickness);
282
283     if (m_changeFlags & GraphicsContextState::TextDrawingModeChange)
284         ts.dumpProperty("text-drawing-mode", m_state.textDrawingMode);
285
286     if (m_changeFlags & GraphicsContextState::StrokeColorChange)
287         ts.dumpProperty("stroke-color", m_state.strokeColor);
288
289     if (m_changeFlags & GraphicsContextState::FillColorChange)
290         ts.dumpProperty("fill-color", m_state.fillColor);
291
292     if (m_changeFlags & GraphicsContextState::StrokeStyleChange)
293         ts.dumpProperty("stroke-style", m_state.strokeStyle);
294
295     if (m_changeFlags & GraphicsContextState::FillRuleChange)
296         ts.dumpProperty("fill-rule", m_state.fillRule);
297
298     if (m_changeFlags & GraphicsContextState::AlphaChange)
299         ts.dumpProperty("alpha", m_state.alpha);
300
301     if (m_changeFlags & GraphicsContextState::CompositeOperationChange)
302         ts.dumpProperty("composite-operator", m_state.compositeOperator);
303
304     if (m_changeFlags & GraphicsContextState::BlendModeChange)
305         ts.dumpProperty("blend-mode", m_state.blendMode);
306
307     if (m_changeFlags & GraphicsContextState::ShouldAntialiasChange)
308         ts.dumpProperty("should-antialias", m_state.shouldAntialias);
309
310     if (m_changeFlags & GraphicsContextState::ShouldSmoothFontsChange)
311         ts.dumpProperty("should-smooth-fonts", m_state.shouldSmoothFonts);
312
313     if (m_changeFlags & GraphicsContextState::ShouldSubpixelQuantizeFontsChange)
314         ts.dumpProperty("should-subpixel-quantize-fonts", m_state.shouldSubpixelQuantizeFonts);
315
316     if (m_changeFlags & GraphicsContextState::ShadowsIgnoreTransformsChange)
317         ts.dumpProperty("shadows-ignore-transforms", m_state.shadowsIgnoreTransforms);
318
319     if (m_changeFlags & GraphicsContextState::DrawLuminanceMaskChange)
320         ts.dumpProperty("draw-luminance-mask", m_state.drawLuminanceMask);
321 }
322
323 TextStream& operator<<(TextStream& ts, const GraphicsContextStateChange& stateChange)
324 {
325     stateChange.dump(ts);
326     return ts;
327 }
328
329 GraphicsContext::GraphicsContext(PaintInvalidationReasons paintInvalidationReasons)
330     : m_paintInvalidationReasons(paintInvalidationReasons)
331 {
332 }
333
334 GraphicsContext::GraphicsContext(PlatformGraphicsContext* platformGraphicsContext)
335 {
336     platformInit(platformGraphicsContext);
337 }
338
339 GraphicsContext::GraphicsContext(const GraphicsContextImplFactory& factoryFunction)
340     : m_impl(factoryFunction(*this))
341 {
342 }
343
344 GraphicsContext::~GraphicsContext()
345 {
346     ASSERT(m_stack.isEmpty());
347     ASSERT(!m_transparencyCount);
348     platformDestroy();
349 }
350
351 bool GraphicsContext::hasPlatformContext() const
352 {
353     if (m_impl)
354         return m_impl->hasPlatformContext();
355     return !!m_data;
356 }
357
358 void GraphicsContext::save()
359 {
360     if (paintingDisabled())
361         return;
362
363     m_stack.append(m_state);
364
365     if (m_impl) {
366         m_impl->save();
367         return;
368     }
369
370     savePlatformState();
371 }
372
373 void GraphicsContext::restore()
374 {
375     if (paintingDisabled())
376         return;
377
378     if (m_stack.isEmpty()) {
379         LOG_ERROR("ERROR void GraphicsContext::restore() stack is empty");
380         return;
381     }
382
383     m_state = m_stack.last();
384     m_stack.removeLast();
385
386     // Make sure we deallocate the state stack buffer when it goes empty.
387     // Canvas elements will immediately save() again, but that goes into inline capacity.
388     if (m_stack.isEmpty())
389         m_stack.clear();
390
391     if (m_impl) {
392         m_impl->restore();
393         return;
394     }
395
396     restorePlatformState();
397 }
398
399 void GraphicsContext::drawRaisedEllipse(const FloatRect& rect, const Color& ellipseColor, const Color& shadowColor)
400 {
401     if (paintingDisabled())
402         return;
403
404     save();
405
406     setStrokeColor(shadowColor);
407     setFillColor(shadowColor);
408
409     drawEllipse(FloatRect(rect.x(), rect.y() + 1, rect.width(), rect.height()));
410
411     setStrokeColor(ellipseColor);
412     setFillColor(ellipseColor);
413
414     drawEllipse(rect);  
415
416     restore();
417 }
418
419 void GraphicsContext::setStrokeThickness(float thickness)
420 {
421     m_state.strokeThickness = thickness;
422     if (m_impl) {
423         m_impl->updateState(m_state, GraphicsContextState::StrokeThicknessChange);
424         return;
425     }
426
427     setPlatformStrokeThickness(thickness);
428 }
429
430 void GraphicsContext::setStrokeStyle(StrokeStyle style)
431 {
432     m_state.strokeStyle = style;
433     if (m_impl) {
434         m_impl->updateState(m_state, GraphicsContextState::StrokeStyleChange);
435         return;
436     }
437     setPlatformStrokeStyle(style);
438 }
439
440 void GraphicsContext::setStrokeColor(const Color& color)
441 {
442     m_state.strokeColor = color;
443     m_state.strokeGradient = nullptr;
444     m_state.strokePattern = nullptr;
445     if (m_impl) {
446         m_impl->updateState(m_state, GraphicsContextState::StrokeColorChange);
447         return;
448     }
449     setPlatformStrokeColor(color);
450 }
451
452 void GraphicsContext::setShadow(const FloatSize& offset, float blur, const Color& color)
453 {
454     m_state.shadowOffset = offset;
455     m_state.shadowBlur = blur;
456     m_state.shadowColor = color;
457 #if USE(CG)
458     m_state.shadowsUseLegacyRadius = false;
459 #endif
460     if (m_impl) {
461         m_impl->updateState(m_state, GraphicsContextState::ShadowChange);
462         return;
463     }
464     setPlatformShadow(offset, blur, color);
465 }
466
467 void GraphicsContext::setLegacyShadow(const FloatSize& offset, float blur, const Color& color)
468 {
469     m_state.shadowOffset = offset;
470     m_state.shadowBlur = blur;
471     m_state.shadowColor = color;
472 #if USE(CG)
473     m_state.shadowsUseLegacyRadius = true;
474 #endif
475     if (m_impl) {
476         m_impl->updateState(m_state, GraphicsContextState::ShadowChange);
477         return;
478     }
479     setPlatformShadow(offset, blur, color);
480 }
481
482 void GraphicsContext::clearShadow()
483 {
484     m_state.shadowOffset = FloatSize();
485     m_state.shadowBlur = 0;
486     m_state.shadowColor = Color();
487 #if USE(CG)
488     m_state.shadowsUseLegacyRadius = false;
489 #endif
490
491     if (m_impl) {
492         m_impl->clearShadow();
493         return;
494     }
495     clearPlatformShadow();
496 }
497
498 bool GraphicsContext::getShadow(FloatSize& offset, float& blur, Color& color) const
499 {
500     offset = m_state.shadowOffset;
501     blur = m_state.shadowBlur;
502     color = m_state.shadowColor;
503
504     return hasShadow();
505 }
506
507 void GraphicsContext::setFillColor(const Color& color)
508 {
509     m_state.fillColor = color;
510     m_state.fillGradient = nullptr;
511     m_state.fillPattern = nullptr;
512
513     if (m_impl) {
514         m_impl->updateState(m_state, GraphicsContextState::FillColorChange);
515         return;
516     }
517
518     setPlatformFillColor(color);
519 }
520
521 void GraphicsContext::setShadowsIgnoreTransforms(bool shadowsIgnoreTransforms)
522 {
523     m_state.shadowsIgnoreTransforms = shadowsIgnoreTransforms;
524     if (m_impl)
525         m_impl->updateState(m_state, GraphicsContextState::ShadowsIgnoreTransformsChange);
526 }
527
528 void GraphicsContext::setShouldAntialias(bool shouldAntialias)
529 {
530     m_state.shouldAntialias = shouldAntialias;
531
532     if (m_impl) {
533         m_impl->updateState(m_state, GraphicsContextState::ShouldAntialiasChange);
534         return;
535     }
536
537     setPlatformShouldAntialias(shouldAntialias);
538 }
539
540 void GraphicsContext::setShouldSmoothFonts(bool shouldSmoothFonts)
541 {
542     m_state.shouldSmoothFonts = shouldSmoothFonts;
543     
544     if (m_impl) {
545         m_impl->updateState(m_state, GraphicsContextState::ShouldSmoothFontsChange);
546         return;
547     }
548     
549     setPlatformShouldSmoothFonts(shouldSmoothFonts);
550 }
551
552 void GraphicsContext::setShouldSubpixelQuantizeFonts(bool shouldSubpixelQuantizeFonts)
553 {
554     m_state.shouldSubpixelQuantizeFonts = shouldSubpixelQuantizeFonts;
555     if (m_impl)
556         m_impl->updateState(m_state, GraphicsContextState::ShouldSubpixelQuantizeFontsChange);
557 }
558
559 void GraphicsContext::setImageInterpolationQuality(InterpolationQuality imageInterpolationQuality)
560 {
561     m_state.imageInterpolationQuality = imageInterpolationQuality;
562
563     if (paintingDisabled())
564         return;
565
566     if (m_impl) {
567         m_impl->updateState(m_state, GraphicsContextState::ImageInterpolationQualityChange);
568         return;
569     }
570
571     setPlatformImageInterpolationQuality(imageInterpolationQuality);
572 }
573
574 void GraphicsContext::setStrokePattern(Ref<Pattern>&& pattern)
575 {
576     m_state.strokeGradient = nullptr;
577     m_state.strokePattern = WTFMove(pattern);
578     if (m_impl)
579         m_impl->updateState(m_state, GraphicsContextState::StrokePatternChange);
580 }
581
582 void GraphicsContext::setFillPattern(Ref<Pattern>&& pattern)
583 {
584     m_state.fillGradient = nullptr;
585     m_state.fillPattern = WTFMove(pattern);
586     if (m_impl)
587         m_impl->updateState(m_state, GraphicsContextState::FillPatternChange);
588 }
589
590 void GraphicsContext::setStrokeGradient(Ref<Gradient>&& gradient)
591 {
592     m_state.strokeGradient = WTFMove(gradient);
593     m_state.strokePattern = nullptr;
594     if (m_impl)
595         m_impl->updateState(m_state, GraphicsContextState::StrokeGradientChange);
596 }
597
598 void GraphicsContext::setFillRule(WindRule fillRule)
599 {
600     m_state.fillRule = fillRule;
601     if (m_impl)
602         m_impl->updateState(m_state, GraphicsContextState::FillRuleChange);
603 }
604
605 void GraphicsContext::setFillGradient(Ref<Gradient>&& gradient)
606 {
607     m_state.fillGradient = WTFMove(gradient);
608     m_state.fillPattern = nullptr;
609     if (m_impl)
610         m_impl->updateState(m_state, GraphicsContextState::FillGradientChange); // FIXME: also fill pattern?
611 }
612
613 void GraphicsContext::beginTransparencyLayer(float opacity)
614 {
615     if (m_impl) {
616         m_impl->beginTransparencyLayer(opacity);
617         return;
618     }
619     beginPlatformTransparencyLayer(opacity);
620     ++m_transparencyCount;
621 }
622
623 void GraphicsContext::endTransparencyLayer()
624 {
625     if (m_impl) {
626         m_impl->endTransparencyLayer();
627         return;
628     }
629     endPlatformTransparencyLayer();
630     ASSERT(m_transparencyCount > 0);
631     --m_transparencyCount;
632 }
633
634 float GraphicsContext::drawText(const FontCascade& font, const TextRun& run, const FloatPoint& point, unsigned from, std::optional<unsigned> to)
635 {
636     if (paintingDisabled())
637         return 0;
638
639     // Display list recording for text content is done at glyphs level. See GraphicsContext::drawGlyphs.
640     return font.drawText(*this, run, point, from, to);
641 }
642
643 void GraphicsContext::drawGlyphs(const Font& font, const GlyphBuffer& buffer, unsigned from, unsigned numGlyphs, const FloatPoint& point, FontSmoothingMode fontSmoothingMode)
644 {
645     if (paintingDisabled())
646         return;
647
648     if (m_impl) {
649         m_impl->drawGlyphs(font, buffer, from, numGlyphs, point, fontSmoothingMode);
650         return;
651     }
652
653     FontCascade::drawGlyphs(*this, font, buffer, from, numGlyphs, point, fontSmoothingMode);
654 }
655
656 void GraphicsContext::drawEmphasisMarks(const FontCascade& font, const TextRun& run, const AtomicString& mark, const FloatPoint& point, unsigned from, std::optional<unsigned> to)
657 {
658     if (paintingDisabled())
659         return;
660
661     font.drawEmphasisMarks(*this, run, mark, point, from, to);
662 }
663
664 void GraphicsContext::drawBidiText(const FontCascade& font, const TextRun& run, const FloatPoint& point, FontCascade::CustomFontNotReadyAction customFontNotReadyAction)
665 {
666     if (paintingDisabled())
667         return;
668
669     BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver;
670     bidiResolver.setStatus(BidiStatus(run.direction(), run.directionalOverride()));
671     bidiResolver.setPositionIgnoringNestedIsolates(TextRunIterator(&run, 0));
672
673     // FIXME: This ownership should be reversed. We should pass BidiRunList
674     // to BidiResolver in createBidiRunsForLine.
675     BidiRunList<BidiCharacterRun>& bidiRuns = bidiResolver.runs();
676     bidiResolver.createBidiRunsForLine(TextRunIterator(&run, run.length()));
677
678     if (!bidiRuns.runCount())
679         return;
680
681     FloatPoint currPoint = point;
682     BidiCharacterRun* bidiRun = bidiRuns.firstRun();
683     while (bidiRun) {
684         TextRun subrun = run.subRun(bidiRun->start(), bidiRun->stop() - bidiRun->start());
685         bool isRTL = bidiRun->level() % 2;
686         subrun.setDirection(isRTL ? TextDirection::RTL : TextDirection::LTR);
687         subrun.setDirectionalOverride(bidiRun->dirOverride(false));
688
689         float width = font.drawText(*this, subrun, currPoint, 0, std::nullopt, customFontNotReadyAction);
690         currPoint.move(width, 0);
691
692         bidiRun = bidiRun->next();
693     }
694
695     bidiRuns.clear();
696 }
697
698 ImageDrawResult GraphicsContext::drawImage(Image& image, const FloatPoint& destination, const ImagePaintingOptions& imagePaintingOptions)
699 {
700     return drawImage(image, FloatRect(destination, image.size()), FloatRect(FloatPoint(), image.size()), imagePaintingOptions);
701 }
702
703 ImageDrawResult GraphicsContext::drawImage(Image& image, const FloatRect& destination, const ImagePaintingOptions& imagePaintingOptions)
704 {
705 #if PLATFORM(IOS_FAMILY)
706     FloatRect srcRect(FloatPoint(), image.originalSize());
707 #else
708     FloatRect srcRect(FloatPoint(), image.size());
709 #endif
710         
711     return drawImage(image, destination, srcRect, imagePaintingOptions);
712 }
713
714 ImageDrawResult GraphicsContext::drawImage(Image& image, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& imagePaintingOptions)
715 {
716     if (paintingDisabled())
717         return ImageDrawResult::DidNothing;
718
719     if (m_impl)
720         return m_impl->drawImage(image, destination, source, imagePaintingOptions);
721
722     InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_interpolationQuality);
723     return image.draw(*this, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_decodingMode, imagePaintingOptions.m_orientationDescription);
724 }
725
726 ImageDrawResult GraphicsContext::drawTiledImage(Image& image, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& imagePaintingOptions)
727 {
728     if (paintingDisabled())
729         return ImageDrawResult::DidNothing;
730
731     if (m_impl)
732         return m_impl->drawTiledImage(image, destination, source, tileSize, spacing, imagePaintingOptions);
733
734     InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_interpolationQuality);
735     return image.drawTiled(*this, destination, source, tileSize, spacing, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_decodingMode);
736 }
737
738 ImageDrawResult GraphicsContext::drawTiledImage(Image& image, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor,
739     Image::TileRule hRule, Image::TileRule vRule, const ImagePaintingOptions& imagePaintingOptions)
740 {
741     if (paintingDisabled())
742         return ImageDrawResult::DidNothing;
743
744     if (m_impl)
745         return m_impl->drawTiledImage(image, destination, source, tileScaleFactor, hRule, vRule, imagePaintingOptions);
746
747     if (hRule == Image::StretchTile && vRule == Image::StretchTile) {
748         // Just do a scale.
749         return drawImage(image, destination, source, imagePaintingOptions);
750     }
751
752     InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_interpolationQuality);
753     return image.drawTiled(*this, destination, source, tileScaleFactor, hRule, vRule, imagePaintingOptions.m_compositeOperator);
754 }
755
756 void GraphicsContext::drawImageBuffer(ImageBuffer& image, const FloatPoint& destination, const ImagePaintingOptions& imagePaintingOptions)
757 {
758     drawImageBuffer(image, FloatRect(destination, image.logicalSize()), FloatRect(FloatPoint(), image.logicalSize()), imagePaintingOptions);
759 }
760
761 void GraphicsContext::drawImageBuffer(ImageBuffer& image, const FloatRect& destination, const ImagePaintingOptions& imagePaintingOptions)
762 {
763     drawImageBuffer(image, destination, FloatRect(FloatPoint(), FloatSize(image.logicalSize())), imagePaintingOptions);
764 }
765
766 void GraphicsContext::drawImageBuffer(ImageBuffer& image, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& imagePaintingOptions)
767 {
768     if (paintingDisabled())
769         return;
770
771     InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_interpolationQuality);
772     image.draw(*this, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode);
773 }
774
775 void GraphicsContext::drawConsumingImageBuffer(std::unique_ptr<ImageBuffer> image, const FloatPoint& destination, const ImagePaintingOptions& imagePaintingOptions)
776 {
777     if (!image)
778         return;
779     IntSize imageLogicalSize = image->logicalSize();
780     drawConsumingImageBuffer(WTFMove(image), FloatRect(destination, imageLogicalSize), FloatRect(FloatPoint(), imageLogicalSize), imagePaintingOptions);
781 }
782
783 void GraphicsContext::drawConsumingImageBuffer(std::unique_ptr<ImageBuffer> image, const FloatRect& destination, const ImagePaintingOptions& imagePaintingOptions)
784 {
785     if (!image)
786         return;
787     IntSize imageLogicalSize = image->logicalSize();
788     drawConsumingImageBuffer(WTFMove(image), destination, FloatRect(FloatPoint(), FloatSize(imageLogicalSize)), imagePaintingOptions);
789 }
790
791 void GraphicsContext::drawConsumingImageBuffer(std::unique_ptr<ImageBuffer> image, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& imagePaintingOptions)
792 {
793     if (paintingDisabled() || !image)
794         return;
795     
796     InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_interpolationQuality);
797     ImageBuffer::drawConsuming(WTFMove(image), *this, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode);
798 }
799
800 void GraphicsContext::clipRoundedRect(const FloatRoundedRect& rect)
801 {
802     if (paintingDisabled())
803         return;
804
805     Path path;
806     path.addRoundedRect(rect);
807     clipPath(path);
808 }
809
810 void GraphicsContext::clipOutRoundedRect(const FloatRoundedRect& rect)
811 {
812     if (paintingDisabled())
813         return;
814
815     if (!rect.isRounded()) {
816         clipOut(rect.rect());
817         return;
818     }
819
820     Path path;
821     path.addRoundedRect(rect);
822     clipOut(path);
823 }
824
825 #if !USE(CG) && !USE(DIRECT2D) && !USE(CAIRO)
826 IntRect GraphicsContext::clipBounds() const
827 {
828     ASSERT_NOT_REACHED();
829     return IntRect();
830 }
831 #endif
832
833 void GraphicsContext::setTextDrawingMode(TextDrawingModeFlags mode)
834 {
835     m_state.textDrawingMode = mode;
836     if (paintingDisabled())
837         return;
838
839     if (m_impl) {
840         m_impl->updateState(m_state, GraphicsContextState::TextDrawingModeChange);
841         return;
842     }
843     setPlatformTextDrawingMode(mode);
844 }
845
846 void GraphicsContext::fillRect(const FloatRect& rect, Gradient& gradient)
847 {
848     if (paintingDisabled())
849         return;
850
851     if (m_impl) {
852         m_impl->fillRect(rect, gradient);
853         return;
854     }
855
856     gradient.fill(*this, rect);
857 }
858
859 void GraphicsContext::fillRect(const FloatRect& rect, const Color& color, CompositeOperator op, BlendMode blendMode)
860 {
861     if (paintingDisabled())
862         return;
863
864     if (m_impl) {
865         m_impl->fillRect(rect, color, op, blendMode);
866         return;
867     }
868
869     CompositeOperator previousOperator = compositeOperation();
870     setCompositeOperation(op, blendMode);
871     fillRect(rect, color);
872     setCompositeOperation(previousOperator);
873 }
874
875 void GraphicsContext::fillRoundedRect(const FloatRoundedRect& rect, const Color& color, BlendMode blendMode)
876 {
877     if (paintingDisabled())
878         return;
879
880     if (m_impl) {
881         m_impl->fillRoundedRect(rect, color, blendMode);
882         return;
883     }
884
885     if (rect.isRounded()) {
886         setCompositeOperation(compositeOperation(), blendMode);
887         platformFillRoundedRect(rect, color);
888         setCompositeOperation(compositeOperation());
889     } else
890         fillRect(rect.rect(), color, compositeOperation(), blendMode);
891 }
892
893 #if !USE(CG) && !USE(DIRECT2D) && !USE(CAIRO)
894 void GraphicsContext::fillRectWithRoundedHole(const IntRect& rect, const FloatRoundedRect& roundedHoleRect, const Color& color)
895 {
896     if (paintingDisabled())
897         return;
898
899     Path path;
900     path.addRect(rect);
901
902     if (!roundedHoleRect.radii().isZero())
903         path.addRoundedRect(roundedHoleRect);
904     else
905         path.addRect(roundedHoleRect.rect());
906
907     WindRule oldFillRule = fillRule();
908     Color oldFillColor = fillColor();
909     
910     setFillRule(WindRule::EvenOdd);
911     setFillColor(color);
912
913     fillPath(path);
914     
915     setFillRule(oldFillRule);
916     setFillColor(oldFillColor);
917 }
918 #endif
919
920 void GraphicsContext::setAlpha(float alpha)
921 {
922     m_state.alpha = alpha;
923     if (m_impl) {
924         m_impl->updateState(m_state, GraphicsContextState::AlphaChange);
925         return;
926     }
927     setPlatformAlpha(alpha);
928 }
929
930 void GraphicsContext::setCompositeOperation(CompositeOperator compositeOperation, BlendMode blendMode)
931 {
932     m_state.compositeOperator = compositeOperation;
933     m_state.blendMode = blendMode;
934     if (m_impl) {
935         m_impl->updateState(m_state, GraphicsContextState::CompositeOperationChange);
936         return;
937     }
938     setPlatformCompositeOperation(compositeOperation, blendMode);
939 }
940
941 void GraphicsContext::setDrawLuminanceMask(bool drawLuminanceMask)
942 {
943     m_state.drawLuminanceMask = drawLuminanceMask;
944     if (m_impl)
945         m_impl->updateState(m_state, GraphicsContextState::DrawLuminanceMaskChange);
946 }
947
948 #if !USE(CG) && !USE(DIRECT2D)
949 // Implement this if you want to go push the drawing mode into your native context immediately.
950 void GraphicsContext::setPlatformTextDrawingMode(TextDrawingModeFlags)
951 {
952 }
953 #endif
954
955 #if !USE(CAIRO) && !USE(DIRECT2D)
956 void GraphicsContext::setPlatformStrokeStyle(StrokeStyle)
957 {
958 }
959 #endif
960
961 #if !USE(CG) && !USE(DIRECT2D)
962 void GraphicsContext::setPlatformShouldSmoothFonts(bool)
963 {
964 }
965 #endif
966
967 #if !USE(CG) && !USE(DIRECT2D) && !USE(CAIRO)
968 bool GraphicsContext::isAcceleratedContext() const
969 {
970     return false;
971 }
972 #endif
973
974 void GraphicsContext::adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, float strokeWidth, StrokeStyle penStyle)
975 {
976     // For odd widths, we add in 0.5 to the appropriate x/y so that the float arithmetic
977     // works out.  For example, with a border width of 3, WebKit will pass us (y1+y2)/2, e.g.,
978     // (50+53)/2 = 103/2 = 51 when we want 51.5.  It is always true that an even width gave
979     // us a perfect position, but an odd width gave us a position that is off by exactly 0.5.
980     if (penStyle == DottedStroke || penStyle == DashedStroke) {
981         if (p1.x() == p2.x()) {
982             p1.setY(p1.y() + strokeWidth);
983             p2.setY(p2.y() - strokeWidth);
984         } else {
985             p1.setX(p1.x() + strokeWidth);
986             p2.setX(p2.x() - strokeWidth);
987         }
988     }
989
990     if (static_cast<int>(strokeWidth) % 2) { //odd
991         if (p1.x() == p2.x()) {
992             // We're a vertical line.  Adjust our x.
993             p1.setX(p1.x() + 0.5f);
994             p2.setX(p2.x() + 0.5f);
995         } else {
996             // We're a horizontal line. Adjust our y.
997             p1.setY(p1.y() + 0.5f);
998             p2.setY(p2.y() + 0.5f);
999         }
1000     }
1001 }
1002
1003 #if !USE(CG) && !USE(DIRECT2D)
1004 void GraphicsContext::platformApplyDeviceScaleFactor(float)
1005 {
1006 }
1007 #endif
1008
1009 void GraphicsContext::applyDeviceScaleFactor(float deviceScaleFactor)
1010 {
1011     scale(deviceScaleFactor);
1012
1013     if (m_impl) {
1014         m_impl->applyDeviceScaleFactor(deviceScaleFactor);
1015         return;
1016     }
1017
1018     platformApplyDeviceScaleFactor(deviceScaleFactor);
1019 }
1020     
1021 FloatSize GraphicsContext::scaleFactor() const
1022 {
1023     AffineTransform transform = getCTM(GraphicsContext::DefinitelyIncludeDeviceScale);
1024     return FloatSize(transform.xScale(), transform.yScale());
1025 }
1026     
1027 FloatSize GraphicsContext::scaleFactorForDrawing(const FloatRect& destRect, const FloatRect& srcRect) const
1028 {
1029     AffineTransform transform = getCTM(GraphicsContext::DefinitelyIncludeDeviceScale);
1030     auto transformedDestRect = transform.mapRect(destRect);
1031     return transformedDestRect.size() / srcRect.size();
1032 }
1033
1034 void GraphicsContext::fillEllipse(const FloatRect& ellipse)
1035 {
1036     if (m_impl) {
1037         m_impl->fillEllipse(ellipse);
1038         return;
1039     }
1040
1041     platformFillEllipse(ellipse);
1042 }
1043
1044 void GraphicsContext::strokeEllipse(const FloatRect& ellipse)
1045 {
1046     if (m_impl) {
1047         m_impl->strokeEllipse(ellipse);
1048         return;
1049     }
1050
1051     platformStrokeEllipse(ellipse);
1052 }
1053
1054 void GraphicsContext::fillEllipseAsPath(const FloatRect& ellipse)
1055 {
1056     Path path;
1057     path.addEllipse(ellipse);
1058     fillPath(path);
1059 }
1060
1061 void GraphicsContext::strokeEllipseAsPath(const FloatRect& ellipse)
1062 {
1063     Path path;
1064     path.addEllipse(ellipse);
1065     strokePath(path);
1066 }
1067
1068 #if !USE(CG) && !USE(DIRECT2D)
1069 void GraphicsContext::platformFillEllipse(const FloatRect& ellipse)
1070 {
1071     if (paintingDisabled())
1072         return;
1073
1074     fillEllipseAsPath(ellipse);
1075 }
1076
1077 void GraphicsContext::platformStrokeEllipse(const FloatRect& ellipse)
1078 {
1079     if (paintingDisabled())
1080         return;
1081
1082     strokeEllipseAsPath(ellipse);
1083 }
1084 #endif
1085
1086 FloatRect GraphicsContext::computeUnderlineBoundsForText(const FloatRect& rect, bool printing)
1087 {
1088     Color dummyColor;
1089     return computeLineBoundsAndAntialiasingModeForText(rect, printing, dummyColor);
1090 }
1091
1092 FloatRect GraphicsContext::computeLineBoundsAndAntialiasingModeForText(const FloatRect& rect, bool printing, Color& color)
1093 {
1094     FloatPoint origin = rect.location();
1095     float thickness = std::max(rect.height(), 0.5f);
1096     if (printing)
1097         return FloatRect(origin, FloatSize(rect.width(), thickness));
1098
1099     AffineTransform transform = getCTM(GraphicsContext::DefinitelyIncludeDeviceScale);
1100     // Just compute scale in x dimension, assuming x and y scales are equal.
1101     float scale = transform.b() ? sqrtf(transform.a() * transform.a() + transform.b() * transform.b()) : transform.a();
1102     if (scale < 1.0) {
1103         // This code always draws a line that is at least one-pixel line high,
1104         // which tends to visually overwhelm text at small scales. To counter this
1105         // effect, an alpha is applied to the underline color when text is at small scales.
1106         static const float minimumUnderlineAlpha = 0.4f;
1107         float shade = scale > minimumUnderlineAlpha ? scale : minimumUnderlineAlpha;
1108         color = color.colorWithAlphaMultipliedBy(shade);
1109     }
1110
1111     FloatPoint devicePoint = transform.mapPoint(rect.location());
1112     // Visual overflow might occur here due to integral roundf/ceilf. visualOverflowForDecorations adjusts the overflow value for underline decoration.
1113     FloatPoint deviceOrigin = FloatPoint(roundf(devicePoint.x()), ceilf(devicePoint.y()));
1114     if (auto inverse = transform.inverse())
1115         origin = inverse.value().mapPoint(deviceOrigin);
1116     return FloatRect(origin, FloatSize(rect.width(), thickness));
1117 }
1118
1119 void GraphicsContext::applyState(const GraphicsContextState& state)
1120 {
1121     setPlatformShadow(state.shadowOffset, state.shadowBlur, state.shadowColor);
1122     setPlatformStrokeThickness(state.strokeThickness);
1123     setPlatformTextDrawingMode(state.textDrawingMode);
1124     setPlatformStrokeColor(state.strokeColor);
1125     setPlatformFillColor(state.fillColor);
1126     setPlatformStrokeStyle(state.strokeStyle);
1127     setPlatformAlpha(state.alpha);
1128     setPlatformCompositeOperation(state.compositeOperator, state.blendMode);
1129     setPlatformShouldAntialias(state.shouldAntialias);
1130     setPlatformShouldSmoothFonts(state.shouldSmoothFonts);
1131 }
1132
1133 float GraphicsContext::dashedLineCornerWidthForStrokeWidth(float strokeWidth) const
1134 {
1135     float thickness = strokeThickness();
1136     return strokeStyle() == DottedStroke ? thickness : std::min(2.0f * thickness, std::max(thickness, strokeWidth / 3.0f));
1137 }
1138
1139 float GraphicsContext::dashedLinePatternWidthForStrokeWidth(float strokeWidth) const
1140 {
1141     float thickness = strokeThickness();
1142     return strokeStyle() == DottedStroke ? thickness : std::min(3.0f * thickness, std::max(thickness, strokeWidth / 3.0f));
1143 }
1144
1145 float GraphicsContext::dashedLinePatternOffsetForPatternAndStrokeWidth(float patternWidth, float strokeWidth) const
1146 {
1147     // Pattern starts with full fill and ends with the empty fill.
1148     // 1. Let's start with the empty phase after the corner.
1149     // 2. Check if we've got odd or even number of patterns and whether they fully cover the line.
1150     // 3. In case of even number of patterns and/or remainder, move the pattern start position
1151     // so that the pattern is balanced between the corners.
1152     float patternOffset = patternWidth;
1153     int numberOfSegments = std::floor(strokeWidth / patternWidth);
1154     bool oddNumberOfSegments = numberOfSegments % 2;
1155     float remainder = strokeWidth - (numberOfSegments * patternWidth);
1156     if (oddNumberOfSegments && remainder)
1157         patternOffset -= remainder / 2.0f;
1158     else if (!oddNumberOfSegments) {
1159         if (remainder)
1160             patternOffset += patternOffset - (patternWidth + remainder) / 2.0f;
1161         else
1162             patternOffset += patternWidth / 2.0f;
1163     }
1164
1165     return patternOffset;
1166 }
1167
1168 Vector<FloatPoint> GraphicsContext::centerLineAndCutOffCorners(bool isVerticalLine, float cornerWidth, FloatPoint point1, FloatPoint point2) const
1169 {
1170     // Center line and cut off corners for pattern painting.
1171     if (isVerticalLine) {
1172         float centerOffset = (point2.x() - point1.x()) / 2.0f;
1173         point1.move(centerOffset, cornerWidth);
1174         point2.move(-centerOffset, -cornerWidth);
1175     } else {
1176         float centerOffset = (point2.y() - point1.y()) / 2.0f;
1177         point1.move(cornerWidth, centerOffset);
1178         point2.move(-cornerWidth, -centerOffset);
1179     }
1180
1181     return { point1, point2 };
1182 }
1183
1184 #if !USE(CG)
1185 bool GraphicsContext::supportsInternalLinks() const
1186 {
1187     return false;
1188 }
1189
1190 void GraphicsContext::setDestinationForRect(const String&, const FloatRect&)
1191 {
1192 }
1193
1194 void GraphicsContext::addDestinationAtPoint(const String&, const FloatPoint&)
1195 {
1196 }
1197 #endif
1198
1199 }