| Differences between
and this patch
- a/Source/WebCore/ChangeLog +85 lines
Lines 1-5 a/Source/WebCore/ChangeLog_sec1
1
2016-01-25  Myles C. Maxfield  <mmaxfield@apple.com>
1
2016-01-25  Myles C. Maxfield  <mmaxfield@apple.com>
2
2
3
        Modularize CSSFontFaceSource
4
        https://bugs.webkit.org/show_bug.cgi?id=153414
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        No new tests because there is no behavior change.
9
10
        * WebCore.xcodeproj/project.pbxproj:
11
        * css/ByteBasedFontFaceSource.cpp: Added.
12
        (WebCore::ByteBasedFontFaceSource::ByteBasedFontFaceSource):
13
        (WebCore::convertWOFF):
14
        (WebCore::getSVGFontById):
15
        (WebCore::convertSVGFont):
16
        (WebCore::ByteBasedFontFaceSource::bufferProvided):
17
        (WebCore::ByteBasedFontFaceSource::createFont):
18
        * css/ByteBasedFontFaceSource.h: Copied from Source/WebCore/loader/cache/CachedFontClient.h.
19
        * css/CSSFontFaceSource.cpp:
20
        (WebCore::CSSFontFaceSource::fontLoaded):
21
        (WebCore::CSSFontFaceSource::font):
22
        (WebCore::CSSFontFaceSource::CSSFontFaceSource): Deleted.
23
        * css/CSSFontFaceSource.h:
24
        * css/CSSFontSelector.cpp:
25
        (WebCore::createFontFace):
26
        * css/CachedRemoteFontFaceSource.cpp: Copied from Source/WebCore/loader/cache/CachedFontClient.h.
27
        (WebCore::CachedRemoteFontFaceSource::CachedRemoteFontFaceSource):
28
        (WebCore::CachedRemoteFontFaceSource::initiateLoad):
29
        (WebCore::CachedRemoteFontFaceSource::fontLoaded):
30
        * css/CachedRemoteFontFaceSource.h: Copied from Source/WebCore/loader/cache/CachedFontClient.h.
31
        * css/FontFaceSource.cpp: Added.
32
        (WebCore::FontFaceSource::HashKey::HashKey):
33
        (WebCore::FontFaceSource::HashKey::isHashTableDeletedValue):
34
        (WebCore::FontFaceSource::HashKey::operator==):
35
        (WebCore::FontFaceSource::HashKey::operator!=):
36
        (WebCore::FontFaceSource::HashKey::hash):
37
        (WebCore::FontFaceSource::HashKey::equal):
38
        (WebCore::FontFaceSource::FontFaceSource):
39
        (WebCore::FontFaceSource::load):
40
        (WebCore::FontFaceSource::font):
41
        * css/FontFaceSource.h: Added.
42
        (WebCore::FontFaceSource::~FontFaceSource):
43
        (WebCore::FontFaceSource::state):
44
        (WebCore::FontFaceSource::owner):
45
        (WebCore::FontFaceSource::setState):
46
        (WebCore::FontFaceSource::shouldCache):
47
        * css/ImmediateFontFaceSource.h: Copied from Source/WebCore/loader/cache/CachedFontClient.h.
48
        * css/InDocumentSVGFontFaceSource.cpp: Copied from Source/WebCore/loader/cache/CachedFontClient.h.
49
        (WebCore::InDocumentSVGFontFaceSource::InDocumentSVGFontFaceSource):
50
        (WebCore::InDocumentSVGFontFaceSource::initiateLoad):
51
        * css/InDocumentSVGFontFaceSource.h: Copied from Source/WebCore/loader/cache/CachedFontClient.h.
52
        * css/LocalFontFaceSource.cpp: Copied from Source/WebCore/loader/cache/CachedFontClient.h.
53
        (WebCore::LocalFontFaceSource::LocalFontFaceSource):
54
        (WebCore::LocalFontFaceSource::initiateLoad):
55
        (WebCore::LocalFontFaceSource::createFont):
56
        * css/LocalFontFaceSource.h: Copied from Source/WebCore/loader/cache/CachedFontClient.h.
57
        * css/UncachedRemoteFontFaceSource.cpp: Added.
58
        (WebCore::UncachedRemoteFontFaceSource::Listener::Listener):
59
        (WebCore::UncachedRemoteFontFaceSource::Listener::handleEvent):
60
        (WebCore::UncachedRemoteFontFaceSource::Listener::operator==):
61
        (WebCore::UncachedRemoteFontFaceSource::UncachedRemoteFontFaceSource):
62
        (WebCore::UncachedRemoteFontFaceSource::initiateLoad):
63
        (WebCore::UncachedRemoteFontFaceSource::loadFinished):
64
        * css/UncachedRemoteFontFaceSource.h: Added.
65
        * loader/cache/CachedFont.cpp:
66
        (WebCore::CachedFont::didAddClient):
67
        (WebCore::CachedFont::ensureCustomFontData):
68
        (WebCore::CachedFont::createFont):
69
        (WebCore::CachedFont::checkNotify):
70
        * loader/cache/CachedFont.h:
71
        (WebCore::CachedFont::setHasCreatedFontDataWrappingResource):
72
        * loader/cache/CachedFontClient.h:
73
        (WebCore::CachedFontClient::fontLoaded):
74
        * loader/cache/CachedSVGFont.cpp:
75
        (WebCore::CachedSVGFont::createFont):
76
        (WebCore::CachedSVGFont::ensureCustomFontData):
77
        * loader/cache/CachedSVGFont.h:
78
        * platform/graphics/mac/FontCustomPlatformData.cpp:
79
        (WebCore::FontCustomPlatformData::fontPlatformData):
80
        * platform/network/HTTPParsers.cpp:
81
        (WebCore::isValidHTTPToken):
82
        * platform/text/TextFlags.h:
83
        (WebCore::FontVariantSettings::operator==):
84
        (WebCore::FontVariantSettings::hash):
85
86
2016-01-25  Myles C. Maxfield  <mmaxfield@apple.com>
87
3
        Remove broken cache from CSSFontFaceSource
88
        Remove broken cache from CSSFontFaceSource
4
        https://bugs.webkit.org/show_bug.cgi?id=153440
89
        https://bugs.webkit.org/show_bug.cgi?id=153440
5
90
- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj -8 / +52 lines
Lines 5563-5570 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec1
5563
		BC64B4CC0CB4295D005F2B62 /* CachedFont.h in Headers */ = {isa = PBXBuildFile; fileRef = BC64B4CA0CB4295D005F2B62 /* CachedFont.h */; };
5563
		BC64B4CC0CB4295D005F2B62 /* CachedFont.h in Headers */ = {isa = PBXBuildFile; fileRef = BC64B4CA0CB4295D005F2B62 /* CachedFont.h */; };
5564
		BC64B4D50CB4298A005F2B62 /* CSSFontFace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC64B4CD0CB4298A005F2B62 /* CSSFontFace.cpp */; };
5564
		BC64B4D50CB4298A005F2B62 /* CSSFontFace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC64B4CD0CB4298A005F2B62 /* CSSFontFace.cpp */; };
5565
		BC64B4D60CB4298A005F2B62 /* CSSFontFace.h in Headers */ = {isa = PBXBuildFile; fileRef = BC64B4CE0CB4298A005F2B62 /* CSSFontFace.h */; };
5565
		BC64B4D60CB4298A005F2B62 /* CSSFontFace.h in Headers */ = {isa = PBXBuildFile; fileRef = BC64B4CE0CB4298A005F2B62 /* CSSFontFace.h */; };
5566
		BC64B4D70CB4298A005F2B62 /* CSSFontFaceSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC64B4CF0CB4298A005F2B62 /* CSSFontFaceSource.cpp */; };
5567
		BC64B4D80CB4298A005F2B62 /* CSSFontFaceSource.h in Headers */ = {isa = PBXBuildFile; fileRef = BC64B4D00CB4298A005F2B62 /* CSSFontFaceSource.h */; };
5568
		BC64B4D90CB4298A005F2B62 /* CSSFontFaceSrcValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC64B4D10CB4298A005F2B62 /* CSSFontFaceSrcValue.cpp */; };
5566
		BC64B4D90CB4298A005F2B62 /* CSSFontFaceSrcValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC64B4D10CB4298A005F2B62 /* CSSFontFaceSrcValue.cpp */; };
5569
		BC64B4DA0CB4298A005F2B62 /* CSSFontFaceSrcValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC64B4D20CB4298A005F2B62 /* CSSFontFaceSrcValue.h */; };
5567
		BC64B4DA0CB4298A005F2B62 /* CSSFontFaceSrcValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC64B4D20CB4298A005F2B62 /* CSSFontFaceSrcValue.h */; };
5570
		BC64B4DB0CB4298A005F2B62 /* CSSFontSelector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC64B4D30CB4298A005F2B62 /* CSSFontSelector.cpp */; };
5568
		BC64B4DB0CB4298A005F2B62 /* CSSFontSelector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC64B4D30CB4298A005F2B62 /* CSSFontSelector.cpp */; };
Lines 5877-5882 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec2
5877
		C105DA620F3AA68F001DD44F /* TextEncodingDetectorICU.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C105DA610F3AA68F001DD44F /* TextEncodingDetectorICU.cpp */; };
5875
		C105DA620F3AA68F001DD44F /* TextEncodingDetectorICU.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C105DA610F3AA68F001DD44F /* TextEncodingDetectorICU.cpp */; };
5878
		C105DA640F3AA6B8001DD44F /* TextEncodingDetector.h in Headers */ = {isa = PBXBuildFile; fileRef = C105DA630F3AA6B8001DD44F /* TextEncodingDetector.h */; };
5876
		C105DA640F3AA6B8001DD44F /* TextEncodingDetector.h in Headers */ = {isa = PBXBuildFile; fileRef = C105DA630F3AA6B8001DD44F /* TextEncodingDetector.h */; };
5879
		C2015C0A1BE6FEB200822389 /* FontVariantBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = C2015C091BE6FE2C00822389 /* FontVariantBuilder.h */; };
5877
		C2015C0A1BE6FEB200822389 /* FontVariantBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = C2015C091BE6FE2C00822389 /* FontVariantBuilder.h */; };
5878
		C2C73BD61C55671E00DF6B6B /* FontFaceSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C2C73BD41C55671E00DF6B6B /* FontFaceSource.cpp */; };
5879
		C2C73BD71C55671E00DF6B6B /* FontFaceSource.h in Headers */ = {isa = PBXBuildFile; fileRef = C2C73BD51C55671E00DF6B6B /* FontFaceSource.h */; };
5880
		C2C73BDA1C5580DC00DF6B6B /* LocalFontFaceSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C2C73BD81C5580DC00DF6B6B /* LocalFontFaceSource.cpp */; };
5881
		C2C73BDB1C5580DC00DF6B6B /* LocalFontFaceSource.h in Headers */ = {isa = PBXBuildFile; fileRef = C2C73BD91C5580DC00DF6B6B /* LocalFontFaceSource.h */; };
5882
		C2C73BDE1C558A3C00DF6B6B /* ByteBasedFontFaceSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C2C73BDC1C558A3B00DF6B6B /* ByteBasedFontFaceSource.cpp */; };
5883
		C2C73BDF1C558A3C00DF6B6B /* ByteBasedFontFaceSource.h in Headers */ = {isa = PBXBuildFile; fileRef = C2C73BDD1C558A3B00DF6B6B /* ByteBasedFontFaceSource.h */; };
5884
		C2C73BE61C55A11800DF6B6B /* CachedRemoteFontFaceSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C2C73BE41C55A11800DF6B6B /* CachedRemoteFontFaceSource.cpp */; };
5885
		C2C73BE71C55A11800DF6B6B /* CachedRemoteFontFaceSource.h in Headers */ = {isa = PBXBuildFile; fileRef = C2C73BE51C55A11800DF6B6B /* CachedRemoteFontFaceSource.h */; };
5886
		C2C73BEA1C55A26E00DF6B6B /* UncachedRemoteFontFaceSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C2C73BE81C55A26E00DF6B6B /* UncachedRemoteFontFaceSource.cpp */; };
5887
		C2C73BEB1C55A26E00DF6B6B /* UncachedRemoteFontFaceSource.h in Headers */ = {isa = PBXBuildFile; fileRef = C2C73BE91C55A26E00DF6B6B /* UncachedRemoteFontFaceSource.h */; };
5888
		C2C73BEF1C55B01D00DF6B6B /* ImmediateFontFaceSource.h in Headers */ = {isa = PBXBuildFile; fileRef = C2C73BED1C55B01C00DF6B6B /* ImmediateFontFaceSource.h */; };
5889
		C2C73BF21C55C35C00DF6B6B /* InDocumentSVGFontFaceSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C2C73BF01C55C35C00DF6B6B /* InDocumentSVGFontFaceSource.cpp */; };
5890
		C2C73BF31C55C35C00DF6B6B /* InDocumentSVGFontFaceSource.h in Headers */ = {isa = PBXBuildFile; fileRef = C2C73BF11C55C35C00DF6B6B /* InDocumentSVGFontFaceSource.h */; };
5880
		C330A22313EC196B0000B45B /* ColorChooser.h in Headers */ = {isa = PBXBuildFile; fileRef = C330A22113EC196B0000B45B /* ColorChooser.h */; settings = {ATTRIBUTES = (Private, ); }; };
5891
		C330A22313EC196B0000B45B /* ColorChooser.h in Headers */ = {isa = PBXBuildFile; fileRef = C330A22113EC196B0000B45B /* ColorChooser.h */; settings = {ATTRIBUTES = (Private, ); }; };
5881
		C33EE5C414FB49610002095A /* BaseClickableWithKeyInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C33EE5C214FB49610002095A /* BaseClickableWithKeyInputType.cpp */; };
5892
		C33EE5C414FB49610002095A /* BaseClickableWithKeyInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C33EE5C214FB49610002095A /* BaseClickableWithKeyInputType.cpp */; };
5882
		C33EE5C514FB49610002095A /* BaseClickableWithKeyInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = C33EE5C314FB49610002095A /* BaseClickableWithKeyInputType.h */; };
5893
		C33EE5C514FB49610002095A /* BaseClickableWithKeyInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = C33EE5C314FB49610002095A /* BaseClickableWithKeyInputType.h */; };
Lines 13376-13383 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec3
13376
		BC64B4CA0CB4295D005F2B62 /* CachedFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedFont.h; sourceTree = "<group>"; };
13387
		BC64B4CA0CB4295D005F2B62 /* CachedFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedFont.h; sourceTree = "<group>"; };
13377
		BC64B4CD0CB4298A005F2B62 /* CSSFontFace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSFontFace.cpp; sourceTree = "<group>"; };
13388
		BC64B4CD0CB4298A005F2B62 /* CSSFontFace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSFontFace.cpp; sourceTree = "<group>"; };
13378
		BC64B4CE0CB4298A005F2B62 /* CSSFontFace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSFontFace.h; sourceTree = "<group>"; };
13389
		BC64B4CE0CB4298A005F2B62 /* CSSFontFace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSFontFace.h; sourceTree = "<group>"; };
13379
		BC64B4CF0CB4298A005F2B62 /* CSSFontFaceSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSFontFaceSource.cpp; sourceTree = "<group>"; };
13380
		BC64B4D00CB4298A005F2B62 /* CSSFontFaceSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSFontFaceSource.h; sourceTree = "<group>"; };
13381
		BC64B4D10CB4298A005F2B62 /* CSSFontFaceSrcValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSFontFaceSrcValue.cpp; sourceTree = "<group>"; };
13390
		BC64B4D10CB4298A005F2B62 /* CSSFontFaceSrcValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSFontFaceSrcValue.cpp; sourceTree = "<group>"; };
13382
		BC64B4D20CB4298A005F2B62 /* CSSFontFaceSrcValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSFontFaceSrcValue.h; sourceTree = "<group>"; };
13391
		BC64B4D20CB4298A005F2B62 /* CSSFontFaceSrcValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSFontFaceSrcValue.h; sourceTree = "<group>"; };
13383
		BC64B4D30CB4298A005F2B62 /* CSSFontSelector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSFontSelector.cpp; sourceTree = "<group>"; };
13392
		BC64B4D30CB4298A005F2B62 /* CSSFontSelector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSFontSelector.cpp; sourceTree = "<group>"; };
Lines 13726-13731 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec4
13726
		C2015C091BE6FE2C00822389 /* FontVariantBuilder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FontVariantBuilder.h; sourceTree = "<group>"; };
13735
		C2015C091BE6FE2C00822389 /* FontVariantBuilder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FontVariantBuilder.h; sourceTree = "<group>"; };
13727
		C24685131A148E1800811792 /* CoreGraphicsSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreGraphicsSPI.h; sourceTree = "<group>"; };
13736
		C24685131A148E1800811792 /* CoreGraphicsSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreGraphicsSPI.h; sourceTree = "<group>"; };
13728
		C2C4CB1D161A131200D214DA /* WebSafeIncrementalSweeperIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSafeIncrementalSweeperIOS.h; sourceTree = "<group>"; };
13737
		C2C4CB1D161A131200D214DA /* WebSafeIncrementalSweeperIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSafeIncrementalSweeperIOS.h; sourceTree = "<group>"; };
13738
		C2C73BD41C55671E00DF6B6B /* FontFaceSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontFaceSource.cpp; sourceTree = "<group>"; };
13739
		C2C73BD51C55671E00DF6B6B /* FontFaceSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontFaceSource.h; sourceTree = "<group>"; };
13740
		C2C73BD81C5580DC00DF6B6B /* LocalFontFaceSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LocalFontFaceSource.cpp; sourceTree = "<group>"; };
13741
		C2C73BD91C5580DC00DF6B6B /* LocalFontFaceSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalFontFaceSource.h; sourceTree = "<group>"; };
13742
		C2C73BDC1C558A3B00DF6B6B /* ByteBasedFontFaceSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ByteBasedFontFaceSource.cpp; sourceTree = "<group>"; };
13743
		C2C73BDD1C558A3B00DF6B6B /* ByteBasedFontFaceSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ByteBasedFontFaceSource.h; sourceTree = "<group>"; };
13744
		C2C73BE41C55A11800DF6B6B /* CachedRemoteFontFaceSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedRemoteFontFaceSource.cpp; sourceTree = "<group>"; };
13745
		C2C73BE51C55A11800DF6B6B /* CachedRemoteFontFaceSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedRemoteFontFaceSource.h; sourceTree = "<group>"; };
13746
		C2C73BE81C55A26E00DF6B6B /* UncachedRemoteFontFaceSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UncachedRemoteFontFaceSource.cpp; sourceTree = "<group>"; };
13747
		C2C73BE91C55A26E00DF6B6B /* UncachedRemoteFontFaceSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UncachedRemoteFontFaceSource.h; sourceTree = "<group>"; };
13748
		C2C73BED1C55B01C00DF6B6B /* ImmediateFontFaceSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImmediateFontFaceSource.h; sourceTree = "<group>"; };
13749
		C2C73BF01C55C35C00DF6B6B /* InDocumentSVGFontFaceSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InDocumentSVGFontFaceSource.cpp; sourceTree = "<group>"; };
13750
		C2C73BF11C55C35C00DF6B6B /* InDocumentSVGFontFaceSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InDocumentSVGFontFaceSource.h; sourceTree = "<group>"; };
13729
		C330A22113EC196B0000B45B /* ColorChooser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorChooser.h; sourceTree = "<group>"; };
13751
		C330A22113EC196B0000B45B /* ColorChooser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorChooser.h; sourceTree = "<group>"; };
13730
		C33EE5C214FB49610002095A /* BaseClickableWithKeyInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BaseClickableWithKeyInputType.cpp; sourceTree = "<group>"; };
13752
		C33EE5C214FB49610002095A /* BaseClickableWithKeyInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BaseClickableWithKeyInputType.cpp; sourceTree = "<group>"; };
13731
		C33EE5C314FB49610002095A /* BaseClickableWithKeyInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseClickableWithKeyInputType.h; sourceTree = "<group>"; };
13753
		C33EE5C314FB49610002095A /* BaseClickableWithKeyInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseClickableWithKeyInputType.h; sourceTree = "<group>"; };
Lines 23316-23323 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec5
23316
				A80E6CBD0A1989CA007FB8C5 /* CSSFontFaceRule.cpp */,
23338
				A80E6CBD0A1989CA007FB8C5 /* CSSFontFaceRule.cpp */,
23317
				A80E6CD30A1989CA007FB8C5 /* CSSFontFaceRule.h */,
23339
				A80E6CD30A1989CA007FB8C5 /* CSSFontFaceRule.h */,
23318
				85C56CA30AA89CA400D95755 /* CSSFontFaceRule.idl */,
23340
				85C56CA30AA89CA400D95755 /* CSSFontFaceRule.idl */,
23319
				BC64B4CF0CB4298A005F2B62 /* CSSFontFaceSource.cpp */,
23320
				BC64B4D00CB4298A005F2B62 /* CSSFontFaceSource.h */,
23321
				BC64B4D10CB4298A005F2B62 /* CSSFontFaceSrcValue.cpp */,
23341
				BC64B4D10CB4298A005F2B62 /* CSSFontFaceSrcValue.cpp */,
23322
				BC64B4D20CB4298A005F2B62 /* CSSFontFaceSrcValue.h */,
23342
				BC64B4D20CB4298A005F2B62 /* CSSFontFaceSrcValue.h */,
23323
				83520C7D1A71BFCC006BD2AA /* CSSFontFamily.h */,
23343
				83520C7D1A71BFCC006BD2AA /* CSSFontFamily.h */,
Lines 23559-23564 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec6
23559
				3FFFF9A6159D9A550020BBD5 /* WebKitCSSViewportRule.cpp */,
23579
				3FFFF9A6159D9A550020BBD5 /* WebKitCSSViewportRule.cpp */,
23560
				3FFFF9A7159D9A550020BBD5 /* WebKitCSSViewportRule.h */,
23580
				3FFFF9A7159D9A550020BBD5 /* WebKitCSSViewportRule.h */,
23561
				3F2B33E3165ABD3500E3987C /* WebKitCSSViewportRule.idl */,
23581
				3F2B33E3165ABD3500E3987C /* WebKitCSSViewportRule.idl */,
23582
				C2C73BD41C55671E00DF6B6B /* FontFaceSource.cpp */,
23583
				C2C73BD51C55671E00DF6B6B /* FontFaceSource.h */,
23584
				C2C73BD81C5580DC00DF6B6B /* LocalFontFaceSource.cpp */,
23585
				C2C73BD91C5580DC00DF6B6B /* LocalFontFaceSource.h */,
23586
				C2C73BDC1C558A3B00DF6B6B /* ByteBasedFontFaceSource.cpp */,
23587
				C2C73BDD1C558A3B00DF6B6B /* ByteBasedFontFaceSource.h */,
23588
				C2C73BE41C55A11800DF6B6B /* CachedRemoteFontFaceSource.cpp */,
23589
				C2C73BE51C55A11800DF6B6B /* CachedRemoteFontFaceSource.h */,
23590
				C2C73BE81C55A26E00DF6B6B /* UncachedRemoteFontFaceSource.cpp */,
23591
				C2C73BE91C55A26E00DF6B6B /* UncachedRemoteFontFaceSource.h */,
23592
				C2C73BED1C55B01C00DF6B6B /* ImmediateFontFaceSource.h */,
23593
				C2C73BF01C55C35C00DF6B6B /* InDocumentSVGFontFaceSource.cpp */,
23594
				C2C73BF11C55C35C00DF6B6B /* InDocumentSVGFontFaceSource.h */,
23562
			);
23595
			);
23563
			path = css;
23596
			path = css;
23564
			sourceTree = "<group>";
23597
			sourceTree = "<group>";
Lines 25055-25061 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec7
25055
				BC64B4D60CB4298A005F2B62 /* CSSFontFace.h in Headers */,
25088
				BC64B4D60CB4298A005F2B62 /* CSSFontFace.h in Headers */,
25056
				409EBDB116B7EE7100CBA3FC /* CSSFontFaceLoadEvent.h in Headers */,
25089
				409EBDB116B7EE7100CBA3FC /* CSSFontFaceLoadEvent.h in Headers */,
25057
				A80E6CFD0A1989CA007FB8C5 /* CSSFontFaceRule.h in Headers */,
25090
				A80E6CFD0A1989CA007FB8C5 /* CSSFontFaceRule.h in Headers */,
25058
				BC64B4D80CB4298A005F2B62 /* CSSFontFaceSource.h in Headers */,
25059
				BC64B4DA0CB4298A005F2B62 /* CSSFontFaceSrcValue.h in Headers */,
25091
				BC64B4DA0CB4298A005F2B62 /* CSSFontFaceSrcValue.h in Headers */,
25060
				83520C7E1A71BFCC006BD2AA /* CSSFontFamily.h in Headers */,
25092
				83520C7E1A71BFCC006BD2AA /* CSSFontFamily.h in Headers */,
25061
				4A6E9FC413C17D1D0046A7F8 /* CSSFontFeatureValue.h in Headers */,
25093
				4A6E9FC413C17D1D0046A7F8 /* CSSFontFeatureValue.h in Headers */,
Lines 25574-25579 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec8
25574
				858015CE0ABCA75D0080588D /* DOMXPathException.h in Headers */,
25606
				858015CE0ABCA75D0080588D /* DOMXPathException.h in Headers */,
25575
				85E9E0A10AB3A0C700069CD0 /* DOMXPathExpression.h in Headers */,
25607
				85E9E0A10AB3A0C700069CD0 /* DOMXPathExpression.h in Headers */,
25576
				85E711DA0AC5D5350053270F /* DOMXPathExpressionInternal.h in Headers */,
25608
				85E711DA0AC5D5350053270F /* DOMXPathExpressionInternal.h in Headers */,
25609
				C2C73BEF1C55B01D00DF6B6B /* ImmediateFontFaceSource.h in Headers */,
25577
				85E9E0A40AB3A0C700069CD0 /* DOMXPathNSResolver.h in Headers */,
25610
				85E9E0A40AB3A0C700069CD0 /* DOMXPathNSResolver.h in Headers */,
25578
				85E9E0A50AB3A0C700069CD0 /* DOMXPathResult.h in Headers */,
25611
				85E9E0A50AB3A0C700069CD0 /* DOMXPathResult.h in Headers */,
25579
				85E711DB0AC5D5350053270F /* DOMXPathResultInternal.h in Headers */,
25612
				85E711DB0AC5D5350053270F /* DOMXPathResultInternal.h in Headers */,
Lines 26418-26423 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec9
26418
				8A9A588811E84F37008ACFD1 /* JSPerformanceTiming.h in Headers */,
26451
				8A9A588811E84F37008ACFD1 /* JSPerformanceTiming.h in Headers */,
26419
				FDEA6247152102FC00479DF0 /* JSPeriodicWave.h in Headers */,
26452
				FDEA6247152102FC00479DF0 /* JSPeriodicWave.h in Headers */,
26420
				93B70D6C09EB0C7C009D8468 /* JSPluginElementFunctions.h in Headers */,
26453
				93B70D6C09EB0C7C009D8468 /* JSPluginElementFunctions.h in Headers */,
26454
				C2C73BDF1C558A3C00DF6B6B /* ByteBasedFontFaceSource.h in Headers */,
26421
				5189F01E10B37BD900F3C739 /* JSPopStateEvent.h in Headers */,
26455
				5189F01E10B37BD900F3C739 /* JSPopStateEvent.h in Headers */,
26422
				598365DD1355F557001B185D /* JSPositionCallback.h in Headers */,
26456
				598365DD1355F557001B185D /* JSPositionCallback.h in Headers */,
26423
				FE80DA720E9C472F000D6F75 /* JSPositionError.h in Headers */,
26457
				FE80DA720E9C472F000D6F75 /* JSPositionError.h in Headers */,
Lines 26573-26578 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec10
26573
				B2FA3DBB0AB75A6F000E5AC4 /* JSSVGPathSegArcRel.h in Headers */,
26607
				B2FA3DBB0AB75A6F000E5AC4 /* JSSVGPathSegArcRel.h in Headers */,
26574
				B2FA3DBD0AB75A6F000E5AC4 /* JSSVGPathSegClosePath.h in Headers */,
26608
				B2FA3DBD0AB75A6F000E5AC4 /* JSSVGPathSegClosePath.h in Headers */,
26575
				B2FA3DBF0AB75A6F000E5AC4 /* JSSVGPathSegCurvetoCubicAbs.h in Headers */,
26609
				B2FA3DBF0AB75A6F000E5AC4 /* JSSVGPathSegCurvetoCubicAbs.h in Headers */,
26610
				C2C73BE71C55A11800DF6B6B /* CachedRemoteFontFaceSource.h in Headers */,
26576
				B2FA3DC10AB75A6F000E5AC4 /* JSSVGPathSegCurvetoCubicRel.h in Headers */,
26611
				B2FA3DC10AB75A6F000E5AC4 /* JSSVGPathSegCurvetoCubicRel.h in Headers */,
26577
				B2FA3DC30AB75A6F000E5AC4 /* JSSVGPathSegCurvetoCubicSmoothAbs.h in Headers */,
26612
				B2FA3DC30AB75A6F000E5AC4 /* JSSVGPathSegCurvetoCubicSmoothAbs.h in Headers */,
26578
				B2FA3DC50AB75A6F000E5AC4 /* JSSVGPathSegCurvetoCubicSmoothRel.h in Headers */,
26613
				B2FA3DC50AB75A6F000E5AC4 /* JSSVGPathSegCurvetoCubicSmoothRel.h in Headers */,
Lines 27189-27194 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec11
27189
				4A0FFAA61AAF5EF60062803B /* RealtimeMediaSourceCenterMac.h in Headers */,
27224
				4A0FFAA61AAF5EF60062803B /* RealtimeMediaSourceCenterMac.h in Headers */,
27190
				4A4F65741AA997F100E38CDD /* RealtimeMediaSourceSettings.h in Headers */,
27225
				4A4F65741AA997F100E38CDD /* RealtimeMediaSourceSettings.h in Headers */,
27191
				07C1C0E51BFB60ED00BD2256 /* RealtimeMediaSourceSupportedConstraints.h in Headers */,
27226
				07C1C0E51BFB60ED00BD2256 /* RealtimeMediaSourceSupportedConstraints.h in Headers */,
27227
				C2C73BEB1C55A26E00DF6B6B /* UncachedRemoteFontFaceSource.h in Headers */,
27192
				BC4368E80C226E32005EFB5F /* Rect.h in Headers */,
27228
				BC4368E80C226E32005EFB5F /* Rect.h in Headers */,
27193
				FD45A958175D414C00C21EC8 /* RectangleShape.h in Headers */,
27229
				FD45A958175D414C00C21EC8 /* RectangleShape.h in Headers */,
27194
				9831AE4A154225C900FE2644 /* ReferrerPolicy.h in Headers */,
27230
				9831AE4A154225C900FE2644 /* ReferrerPolicy.h in Headers */,
Lines 27356-27361 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec12
27356
				934F713C0D5A6F1900018D69 /* ResourceErrorBase.h in Headers */,
27392
				934F713C0D5A6F1900018D69 /* ResourceErrorBase.h in Headers */,
27357
				514C76790CE923A1007EF3CD /* ResourceHandle.h in Headers */,
27393
				514C76790CE923A1007EF3CD /* ResourceHandle.h in Headers */,
27358
				26FAE4CD1852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.h in Headers */,
27394
				26FAE4CD1852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.h in Headers */,
27395
				C2C73BDB1C5580DC00DF6B6B /* LocalFontFaceSource.h in Headers */,
27359
				26C15CF71857E15E00F15C03 /* ResourceHandleCFURLConnectionDelegateWithOperationQueue.h in Headers */,
27396
				26C15CF71857E15E00F15C03 /* ResourceHandleCFURLConnectionDelegateWithOperationQueue.h in Headers */,
27360
				514C767A0CE923A1007EF3CD /* ResourceHandleClient.h in Headers */,
27397
				514C767A0CE923A1007EF3CD /* ResourceHandleClient.h in Headers */,
27361
				514C767B0CE923A1007EF3CD /* ResourceHandleInternal.h in Headers */,
27398
				514C767B0CE923A1007EF3CD /* ResourceHandleInternal.h in Headers */,
Lines 27542-27547 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec13
27542
				E4E9B1191810916F003ACCDF /* SimpleLineLayoutResolver.h in Headers */,
27579
				E4E9B1191810916F003ACCDF /* SimpleLineLayoutResolver.h in Headers */,
27543
				582CB0531A78A14B00AFFCC4 /* SimpleLineLayoutTextFragmentIterator.h in Headers */,
27580
				582CB0531A78A14B00AFFCC4 /* SimpleLineLayoutTextFragmentIterator.h in Headers */,
27544
				C5A1EA7D152BCF08004D00B6 /* SimplifyMarkupCommand.h in Headers */,
27581
				C5A1EA7D152BCF08004D00B6 /* SimplifyMarkupCommand.h in Headers */,
27582
				C2C73BF31C55C35C00DF6B6B /* InDocumentSVGFontFaceSource.h in Headers */,
27545
				31741AAD16636609008A5B7E /* SimulatedClickOptions.h in Headers */,
27583
				31741AAD16636609008A5B7E /* SimulatedClickOptions.h in Headers */,
27546
				FD00D7A514A3F61900734011 /* SincResampler.h in Headers */,
27584
				FD00D7A514A3F61900734011 /* SincResampler.h in Headers */,
27547
				51327D6011A33A2B004F9D65 /* SinkDocument.h in Headers */,
27585
				51327D6011A33A2B004F9D65 /* SinkDocument.h in Headers */,
Lines 28152-28157 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec14
28152
				E180810F16FCECDF00B80D07 /* WebCoreResourceHandleAsDelegate.h in Headers */,
28190
				E180810F16FCECDF00B80D07 /* WebCoreResourceHandleAsDelegate.h in Headers */,
28153
				E152551516FD2350003D7ADB /* WebCoreResourceHandleAsOperationQueueDelegate.h in Headers */,
28191
				E152551516FD2350003D7ADB /* WebCoreResourceHandleAsOperationQueueDelegate.h in Headers */,
28154
				93EB169709F880C00091F8FF /* WebCoreSystemInterface.h in Headers */,
28192
				93EB169709F880C00091F8FF /* WebCoreSystemInterface.h in Headers */,
28193
				C2C73BD71C55671E00DF6B6B /* FontFaceSource.h in Headers */,
28155
				A14832C7187F66C800DA63A6 /* WebCoreThread.h in Headers */,
28194
				A14832C7187F66C800DA63A6 /* WebCoreThread.h in Headers */,
28156
				A14832C9187F676B00DA63A6 /* WebCoreThreadInternal.h in Headers */,
28195
				A14832C9187F676B00DA63A6 /* WebCoreThreadInternal.h in Headers */,
28157
				A14832CA187F678000DA63A6 /* WebCoreThreadMessage.h in Headers */,
28196
				A14832CA187F678000DA63A6 /* WebCoreThreadMessage.h in Headers */,
Lines 28761-28766 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec15
28761
				1A569CF70D7E2B82007C3983 /* c_class.cpp in Sources */,
28800
				1A569CF70D7E2B82007C3983 /* c_class.cpp in Sources */,
28762
				1A569CF90D7E2B82007C3983 /* c_instance.cpp in Sources */,
28801
				1A569CF90D7E2B82007C3983 /* c_instance.cpp in Sources */,
28763
				1A569CFB0D7E2B82007C3983 /* c_runtime.cpp in Sources */,
28802
				1A569CFB0D7E2B82007C3983 /* c_runtime.cpp in Sources */,
28803
				C2C73BDA1C5580DC00DF6B6B /* LocalFontFaceSource.cpp in Sources */,
28764
				1A569CFD0D7E2B82007C3983 /* c_utility.cpp in Sources */,
28804
				1A569CFD0D7E2B82007C3983 /* c_utility.cpp in Sources */,
28765
				BCB16C190979C3BD00467741 /* CachedCSSStyleSheet.cpp in Sources */,
28805
				BCB16C190979C3BD00467741 /* CachedCSSStyleSheet.cpp in Sources */,
28766
				BC64B4CB0CB4295D005F2B62 /* CachedFont.cpp in Sources */,
28806
				BC64B4CB0CB4295D005F2B62 /* CachedFont.cpp in Sources */,
Lines 28935-28941 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec16
28935
				BC64B4D50CB4298A005F2B62 /* CSSFontFace.cpp in Sources */,
28975
				BC64B4D50CB4298A005F2B62 /* CSSFontFace.cpp in Sources */,
28936
				409EBDB216B7EE7400CBA3FC /* CSSFontFaceLoadEvent.cpp in Sources */,
28976
				409EBDB216B7EE7400CBA3FC /* CSSFontFaceLoadEvent.cpp in Sources */,
28937
				A80E6CE70A1989CA007FB8C5 /* CSSFontFaceRule.cpp in Sources */,
28977
				A80E6CE70A1989CA007FB8C5 /* CSSFontFaceRule.cpp in Sources */,
28938
				BC64B4D70CB4298A005F2B62 /* CSSFontFaceSource.cpp in Sources */,
28939
				BC64B4D90CB4298A005F2B62 /* CSSFontFaceSrcValue.cpp in Sources */,
28978
				BC64B4D90CB4298A005F2B62 /* CSSFontFaceSrcValue.cpp in Sources */,
28940
				4A6E9FC313C17D1D0046A7F8 /* CSSFontFeatureValue.cpp in Sources */,
28979
				4A6E9FC313C17D1D0046A7F8 /* CSSFontFeatureValue.cpp in Sources */,
28941
				BC64B4DB0CB4298A005F2B62 /* CSSFontSelector.cpp in Sources */,
28980
				BC64B4DB0CB4298A005F2B62 /* CSSFontSelector.cpp in Sources */,
Lines 29251-29256 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec17
29251
				31611E620E1C4E1400F6A579 /* DOMWebKitCSSTransformValue.mm in Sources */,
29290
				31611E620E1C4E1400F6A579 /* DOMWebKitCSSTransformValue.mm in Sources */,
29252
				3F2B33EC165AF15600E3987C /* DOMWebKitCSSViewportRule.mm in Sources */,
29291
				3F2B33EC165AF15600E3987C /* DOMWebKitCSSViewportRule.mm in Sources */,
29253
				8A195933147EA16E00D1EA61 /* DOMWebKitNamedFlow.mm in Sources */,
29292
				8A195933147EA16E00D1EA61 /* DOMWebKitNamedFlow.mm in Sources */,
29293
				C2C73BE61C55A11800DF6B6B /* CachedRemoteFontFaceSource.cpp in Sources */,
29254
				31C0FF4D0E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.mm in Sources */,
29294
				31C0FF4D0E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.mm in Sources */,
29255
				85C7F5E80AAFBAFB004014DD /* DOMWheelEvent.mm in Sources */,
29295
				85C7F5E80AAFBAFB004014DD /* DOMWheelEvent.mm in Sources */,
29256
				1403B99809EB13AF00797C7F /* DOMWindow.cpp in Sources */,
29296
				1403B99809EB13AF00797C7F /* DOMWindow.cpp in Sources */,
Lines 29405-29410 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec18
29405
				085B92BA0EFDE73D00E6123C /* FormDataBuilder.cpp in Sources */,
29445
				085B92BA0EFDE73D00E6123C /* FormDataBuilder.cpp in Sources */,
29406
				A8136D390973A8E700D74463 /* FormDataList.cpp in Sources */,
29446
				A8136D390973A8E700D74463 /* FormDataList.cpp in Sources */,
29407
				7EE6846612D26E3800E79415 /* FormDataStreamCFNet.cpp in Sources */,
29447
				7EE6846612D26E3800E79415 /* FormDataStreamCFNet.cpp in Sources */,
29448
				C2C73BD61C55671E00DF6B6B /* FontFaceSource.cpp in Sources */,
29408
				514C764F0CE9234E007EF3CD /* FormDataStreamMac.mm in Sources */,
29449
				514C764F0CE9234E007EF3CD /* FormDataStreamMac.mm in Sources */,
29409
				656D373B0ADBA5DE00A4554D /* FormState.cpp in Sources */,
29450
				656D373B0ADBA5DE00A4554D /* FormState.cpp in Sources */,
29410
				41885B9411B6FDA6003383BB /* FormSubmission.cpp in Sources */,
29451
				41885B9411B6FDA6003383BB /* FormSubmission.cpp in Sources */,
Lines 30182-30187 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec19
30182
				1AD2316E0CD269E700C1F194 /* JSSQLTransactionCustom.cpp in Sources */,
30223
				1AD2316E0CD269E700C1F194 /* JSSQLTransactionCustom.cpp in Sources */,
30183
				B59DD6A211902A52007E9684 /* JSSQLTransactionErrorCallback.cpp in Sources */,
30224
				B59DD6A211902A52007E9684 /* JSSQLTransactionErrorCallback.cpp in Sources */,
30184
				51E3F9D60DA05E1D00250911 /* JSStorage.cpp in Sources */,
30225
				51E3F9D60DA05E1D00250911 /* JSStorage.cpp in Sources */,
30226
				C2C73BF21C55C35C00DF6B6B /* InDocumentSVGFontFaceSource.cpp in Sources */,
30185
				51D0C5160DAA90B7003B3831 /* JSStorageCustom.cpp in Sources */,
30227
				51D0C5160DAA90B7003B3831 /* JSStorageCustom.cpp in Sources */,
30186
				51E0BAEA0DA55D4A00A9E417 /* JSStorageEvent.cpp in Sources */,
30228
				51E0BAEA0DA55D4A00A9E417 /* JSStorageEvent.cpp in Sources */,
30187
				0FF50269102BA9430066F39A /* JSStyleMedia.cpp in Sources */,
30229
				0FF50269102BA9430066F39A /* JSStyleMedia.cpp in Sources */,
Lines 30626-30631 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec20
30626
				F55B3DC51251F12D003EF269 /* MonthInputType.cpp in Sources */,
30668
				F55B3DC51251F12D003EF269 /* MonthInputType.cpp in Sources */,
30627
				85031B450A44EFC700F992E0 /* MouseEvent.cpp in Sources */,
30669
				85031B450A44EFC700F992E0 /* MouseEvent.cpp in Sources */,
30628
				93EB355F09E37FD600F43799 /* MouseEventWithHitTestResults.cpp in Sources */,
30670
				93EB355F09E37FD600F43799 /* MouseEventWithHitTestResults.cpp in Sources */,
30671
				C2C73BDE1C558A3C00DF6B6B /* ByteBasedFontFaceSource.cpp in Sources */,
30629
				85031B470A44EFC700F992E0 /* MouseRelatedEvent.cpp in Sources */,
30672
				85031B470A44EFC700F992E0 /* MouseRelatedEvent.cpp in Sources */,
30630
				93309DFB099E64920056E581 /* MoveSelectionCommand.cpp in Sources */,
30673
				93309DFB099E64920056E581 /* MoveSelectionCommand.cpp in Sources */,
30631
				FDB1700514A2BAB200A2B5D9 /* MultiChannelResampler.cpp in Sources */,
30674
				FDB1700514A2BAB200A2B5D9 /* MultiChannelResampler.cpp in Sources */,
Lines 30895-30900 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec21
30895
				1479FAEF109AE37500DED655 /* RenderRubyBase.cpp in Sources */,
30938
				1479FAEF109AE37500DED655 /* RenderRubyBase.cpp in Sources */,
30896
				1479FAF1109AE37500DED655 /* RenderRubyRun.cpp in Sources */,
30939
				1479FAF1109AE37500DED655 /* RenderRubyRun.cpp in Sources */,
30897
				1479FAF3109AE37500DED655 /* RenderRubyText.cpp in Sources */,
30940
				1479FAF3109AE37500DED655 /* RenderRubyText.cpp in Sources */,
30941
				C2C73BEA1C55A26E00DF6B6B /* UncachedRemoteFontFaceSource.cpp in Sources */,
30898
				BC3BE9930E9C1C7C00835588 /* RenderScrollbar.cpp in Sources */,
30942
				BC3BE9930E9C1C7C00835588 /* RenderScrollbar.cpp in Sources */,
30899
				BC3BE9AB0E9C242000835588 /* RenderScrollbarPart.cpp in Sources */,
30943
				BC3BE9AB0E9C242000835588 /* RenderScrollbarPart.cpp in Sources */,
30900
				BC3BE9A50E9C239600835588 /* RenderScrollbarTheme.cpp in Sources */,
30944
				BC3BE9A50E9C239600835588 /* RenderScrollbarTheme.cpp in Sources */,
- a/Source/WebCore/css/ByteBasedFontFaceSource.cpp +163 lines
Line 0 a/Source/WebCore/css/ByteBasedFontFaceSource.cpp_sec1
1
/*
2
 * Copyright (C) 2016 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 "ByteBasedFontFaceSource.h"
28
29
#include "SVGDocument.h"
30
#include "SVGFontElement.h"
31
#include "SVGToOTFFontConversion.h"
32
#include "SharedBuffer.h"
33
#include "TypedElementDescendantIterator.h"
34
35
#include <runtime/ArrayBuffer.h>
36
37
namespace WebCore {
38
39
ByteBasedFontFaceSource::ByteBasedFontFaceSource(CSSFontFace& owner, const AtomicString& remoteURI, bool performConversion)
40
    : FontFaceSource(owner)
41
    , m_remoteURI(remoteURI)
42
    , m_performConversion(performConversion)
43
{
44
}
45
46
enum class WOFFConversionStatus {
47
    Unnecessary,
48
    Success,
49
    Failure
50
};
51
52
static WOFFConversionStatus convertWOFF(SharedBuffer& buffer, Vector<char>& result)
53
{
54
#if PLATFORM(COCOA)
55
    UNUSED_PARAM(buffer);
56
    UNUSED_PARAM(result);
57
    return WOFFConversionStatus::Unnecessary;
58
#else
59
    if (!isWOFF(&buffer))
60
        return Nullopt;
61
    if (!convertWOFFToSfnt(&buffer, result))
62
        return WOFFConversionStatus::Failure;
63
    result = WTF::move(convertedFont);
64
    return WOFFConversionStatus::Success;
65
#endif
66
}
67
68
static SVGFontElement* getSVGFontById(SVGDocument& externalSVGDocument, const String& fontName)
69
{
70
    auto elements = descendantsOfType<SVGFontElement>(externalSVGDocument);
71
72
    if (fontName.isEmpty())
73
        return elements.first();
74
75
    for (auto& element : elements) {
76
        if (element.getIdAttribute() == fontName)
77
            return &element;
78
    }
79
    return nullptr;
80
}
81
82
static Optional<Vector<char>> convertSVGFont(SharedBuffer& buffer, const AtomicString& remoteURI)
83
{
84
    RefPtr<SVGDocument> externalSVGDocument = SVGDocument::create(nullptr, URL());
85
    RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("application/xml");
86
    externalSVGDocument->setContent(decoder->decodeAndFlush(buffer.data(), buffer.size()));
87
    if (decoder->sawError())
88
        return Nullopt;
89
90
    String fragmentIdentifier;
91
    size_t start = remoteURI.find('#');
92
    if (start != notFound)
93
        fragmentIdentifier = remoteURI.string().substring(start + 1);
94
    SVGFontElement* externalSVGFontElement = getSVGFontById(*externalSVGDocument, fragmentIdentifier);
95
    if (!externalSVGFontElement)
96
        return Nullopt;
97
98
    return convertSVGToOTFFont(*externalSVGFontElement);
99
}
100
101
void ByteBasedFontFaceSource::bufferProvided(JSC::ArrayBuffer& arrayBuffer)
102
{
103
    RefPtr<SharedBuffer> buffer = SharedBuffer::create(static_cast<const char*>(arrayBuffer.data()), arrayBuffer.byteLength());
104
    if (!buffer) {
105
        setState(State::Failed);
106
        return;
107
    }
108
109
    bufferProvided(*buffer);
110
}
111
112
bool ByteBasedFontFaceSource::bufferProvided(SharedBuffer& buffer)
113
{
114
    ASSERT(state() == State::Loading);
115
    bool wrapping = true;
116
    RefPtr<SharedBuffer> active = &buffer;
117
118
    if (m_performConversion) {
119
        // Step 1: Try to convert WOFF to SFNT.
120
        Vector<char> sfnt;
121
        switch (convertWOFF(buffer, sfnt)) {
122
        case WOFFConversionStatus::Unnecessary:
123
            break;
124
        case WOFFConversionStatus::Success:
125
            wrapping = false;
126
            active = SharedBuffer::adoptVector(sfnt);
127
            break;
128
        case WOFFConversionStatus::Failure:
129
            setState(State::Failed);
130
            return false;
131
        }
132
133
        // Step 2: Try to convert SVG to OTF.
134
        if (auto otf = convertSVGFont(*active, m_remoteURI)) {
135
            wrapping = false;
136
            active = SharedBuffer::adoptVector(otf.value());
137
        }
138
    }
139
140
    m_fontCustomPlatformData = createFontCustomPlatformData(*active);
141
    if (!m_fontCustomPlatformData) {
142
        setState(State::Failed);
143
        return false;
144
    }
145
146
    // Finally!!
147
    setState(State::Succeeded);
148
149
    return wrapping;
150
}
151
152
RefPtr<Font> ByteBasedFontFaceSource::createFont(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings& fontFaceFeatures, const FontVariantSettings& fontFaceVariantSettings)
153
{
154
#if PLATFORM(COCOA)
155
    return Font::create(m_fontCustomPlatformData->fontPlatformData(fontDescription, syntheticBold, syntheticItalic, fontFaceFeatures, fontFaceVariantSettings), true, false);
156
#else
157
    UNUSED_PARAM(fontFaceFeatures);
158
    UNUSED_PARAM(fontFaceVariantSettings);
159
    return Font::create(m_fontCustomPlatformData->fontPlatformData(fontDescription, bold, italic), true, false);
160
#endif
161
}
162
163
}
- a/Source/WebCore/css/ByteBasedFontFaceSource.h +57 lines
Line 0 a/Source/WebCore/css/ByteBasedFontFaceSource.h_sec1
1
/*
2
 * Copyright (C) 2016 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
#ifndef ByteBasedFontFaceSource_h
27
#define ByteBasedFontFaceSource_h
28
29
#include "FontCustomPlatformData.h"
30
#include "FontFaceSource.h"
31
32
namespace JSC {
33
class ArrayBuffer;
34
}
35
36
namespace WebCore {
37
38
class ByteBasedFontFaceSource : public FontFaceSource {
39
public:
40
    ByteBasedFontFaceSource(CSSFontFace& owner, const AtomicString& remoteURI = AtomicString(), bool performConversion = true);
41
42
protected:
43
    void bufferProvided(JSC::ArrayBuffer&);
44
    // Return value is whether or not I added a reference to the argument.
45
    bool bufferProvided(SharedBuffer&);
46
47
private:
48
    virtual RefPtr<Font> createFont(const FontDescription&, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings&, const FontVariantSettings&) override;
49
50
    std::unique_ptr<FontCustomPlatformData> m_fontCustomPlatformData;
51
    AtomicString m_remoteURI;
52
    bool m_performConversion;
53
};
54
55
}
56
57
#endif
- a/Source/WebCore/css/CSSFontFace.cpp -100 / +25 lines
Lines 26-32 a/Source/WebCore/css/CSSFontFace.cpp_sec1
26
#include "config.h"
26
#include "config.h"
27
#include "CSSFontFace.h"
27
#include "CSSFontFace.h"
28
28
29
#include "CSSFontFaceSource.h"
30
#include "CSSFontSelector.h"
29
#include "CSSFontSelector.h"
31
#include "CSSSegmentedFontFace.h"
30
#include "CSSSegmentedFontFace.h"
32
#include "Document.h"
31
#include "Document.h"
Lines 37-50 a/Source/WebCore/css/CSSFontFace.cpp_sec2
37
36
38
namespace WebCore {
37
namespace WebCore {
39
38
40
bool CSSFontFace::isValid() const
39
bool CSSFontFace::allSourcesHaveFailed() const
41
{
40
{
42
    size_t size = m_sources.size();
41
    for (auto& source : m_sources) {
43
    for (size_t i = 0; i < size; i++) {
42
        if (source->state() != FontFaceSource::State::Failed)
44
        if (m_sources[i]->isValid())
43
            return false;
45
            return true;
46
    }
44
    }
47
    return false;
45
    return true;
48
}
46
}
49
47
50
void CSSFontFace::addedToSegmentedFontFace(CSSSegmentedFontFace* segmentedFontFace)
48
void CSSFontFace::addedToSegmentedFontFace(CSSSegmentedFontFace* segmentedFontFace)
Lines 57-73 void CSSFontFace::removedFromSegmentedFontFace(CSSSegmentedFontFace* segmentedFo a/Source/WebCore/css/CSSFontFace.cpp_sec3
57
    m_segmentedFontFaces.remove(segmentedFontFace);
55
    m_segmentedFontFaces.remove(segmentedFontFace);
58
}
56
}
59
57
60
void CSSFontFace::addSource(std::unique_ptr<CSSFontFaceSource> source)
58
void CSSFontFace::addSource(std::unique_ptr<FontFaceSource>&& source)
61
{
59
{
62
    source->setFontFace(this);
63
    m_sources.append(WTFMove(source));
60
    m_sources.append(WTFMove(source));
64
}
61
}
65
62
66
void CSSFontFace::fontLoaded(CSSFontFaceSource* source)
63
void CSSFontFace::kick(FontFaceSource&)
67
{
64
{
68
    if (source != m_activeSource)
69
        return;
70
71
    // FIXME: Can we assert that m_segmentedFontFaces is not empty? That may
65
    // FIXME: Can we assert that m_segmentedFontFaces is not empty? That may
72
    // require stopping in-progress font loading when the last
66
    // require stopping in-progress font loading when the last
73
    // CSSSegmentedFontFace is removed.
67
    // CSSSegmentedFontFace is removed.
Lines 79-181 void CSSFontFace::fontLoaded(CSSFontFaceSource* source) a/Source/WebCore/css/CSSFontFace.cpp_sec4
79
    CSSFontSelector* fontSelector = (*m_segmentedFontFaces.begin())->fontSelector();
73
    CSSFontSelector* fontSelector = (*m_segmentedFontFaces.begin())->fontSelector();
80
    fontSelector->fontLoaded();
74
    fontSelector->fontLoaded();
81
75
82
#if ENABLE(FONT_LOAD_EVENTS)
83
    if (RuntimeEnabledFeatures::sharedFeatures().fontLoadEventsEnabled() && m_loadState == Loading) {
84
        if (source->ensureFontData())
85
            notifyFontLoader(Loaded);
86
        else if (!isValid())
87
            notifyFontLoader(Error);
88
    }
89
#endif
90
91
    for (auto* face : m_segmentedFontFaces)
76
    for (auto* face : m_segmentedFontFaces)
92
        face->fontLoaded(this);
77
        face->fontLoaded(this);
93
94
#if ENABLE(FONT_LOAD_EVENTS)
95
    if (RuntimeEnabledFeatures::sharedFeatures().fontLoadEventsEnabled())
96
        notifyLoadingDone();
97
#endif
98
}
78
}
99
79
100
RefPtr<Font> CSSFontFace::font(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic)
80
RefPtr<Font> CSSFontFace::font(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic)
101
{
81
{
102
    m_activeSource = 0;
82
    if (allSourcesHaveFailed())
103
    if (!isValid())
83
        return nullptr;
104
        return 0;
84
105
85
    for (size_t index = 0; index < m_sources.size(); ) {
106
    ASSERT(!m_segmentedFontFaces.isEmpty());
86
        switch (m_sources[index]->state()) {
107
    CSSFontSelector* fontSelector = (*m_segmentedFontFaces.begin())->fontSelector();
87
        case FontFaceSource::State::Pending:
108
88
            m_sources[index]->load();
109
#if ENABLE(FONT_LOAD_EVENTS)
89
            break;
110
    if (RuntimeEnabledFeatures::sharedFeatures().fontLoadEventsEnabled() && m_loadState == NotLoaded)
90
        case FontFaceSource::State::Loading:
111
        notifyFontLoader(Loading);
91
            return Font::create(FontCache::singleton().lastResortFallbackFont(fontDescription)->platformData(), true, true);
112
#endif
92
        case FontFaceSource::State::Failed:
113
93
            ++index;
114
    size_t size = m_sources.size();
94
            break;
115
    for (size_t i = 0; i < size; ++i) {
95
        case FontFaceSource::State::Succeeded:
116
        if (RefPtr<Font> result = m_sources[i]->font(fontDescription, syntheticBold, syntheticItalic, fontSelector, m_featureSettings, m_variantSettings)) {
96
            if (auto result = m_sources[index]->font(fontDescription, syntheticBold, syntheticItalic, m_featureSettings, m_variantSettings))
117
            m_activeSource = m_sources[i].get();
97
                return result;
118
#if ENABLE(FONT_LOAD_EVENTS)
98
            ++index;
119
            if (RuntimeEnabledFeatures::sharedFeatures().fontLoadEventsEnabled() && m_loadState == Loading && m_sources[i]->isLoaded()) {
99
            break;
120
                notifyFontLoader(Loaded);
121
                notifyLoadingDone();
122
            }
123
#endif
124
            return result.release();
125
        }
100
        }
126
    }
101
    }
127
102
128
#if ENABLE(FONT_LOAD_EVENTS)
129
    if (RuntimeEnabledFeatures::sharedFeatures().fontLoadEventsEnabled() && m_loadState == Loading) {
130
        notifyFontLoader(Error);
131
        notifyLoadingDone();
132
    }
133
#endif
134
    return nullptr;
103
    return nullptr;
135
}
104
}
136
105
137
#if ENABLE(FONT_LOAD_EVENTS)
138
void CSSFontFace::notifyFontLoader(LoadState newState)
139
{
140
    m_loadState = newState;
141
142
    Document* document = (*m_segmentedFontFaces.begin())->fontSelector()->document();
143
    if (!document)
144
        return;
145
146
    switch (newState) {
147
    case Loading:
148
        document->fonts()->beginFontLoading(m_rule.get());
149
        break;
150
    case Loaded:
151
        document->fonts()->fontLoaded(m_rule.get());
152
        break;
153
    case Error:
154
        document->fonts()->loadError(m_rule.get(), m_activeSource);
155
        break;
156
    default:
157
        break;
158
    }
159
}
160
161
void CSSFontFace::notifyLoadingDone()
162
{
163
    Document* document = (*m_segmentedFontFaces.begin())->fontSelector()->document();
164
    if (document)
165
        document->fonts()->loadingDone();
166
}
167
#endif
168
169
#if ENABLE(SVG_FONTS)
170
bool CSSFontFace::hasSVGFontFaceSource() const
171
{
172
    size_t size = m_sources.size();
173
    for (size_t i = 0; i < size; i++) {
174
        if (m_sources[i]->isSVGFontFaceSource())
175
            return true;
176
    }
177
    return false;
178
}
179
#endif
180
181
}
106
}
- a/Source/WebCore/css/CSSFontFace.h -30 / +8 lines
Lines 26-33 a/Source/WebCore/css/CSSFontFace.h_sec1
26
#ifndef CSSFontFace_h
26
#ifndef CSSFontFace_h
27
#define CSSFontFace_h
27
#define CSSFontFace_h
28
28
29
#include "CSSFontFaceRule.h"
29
#include "FontFaceSource.h"
30
#include "CSSFontFaceSource.h"
31
#include "FontFeatureSettings.h"
30
#include "FontFeatureSettings.h"
32
#include "TextFlags.h"
31
#include "TextFlags.h"
33
#include <memory>
32
#include <memory>
Lines 45-51 class Font; a/Source/WebCore/css/CSSFontFace.h_sec2
45
44
46
class CSSFontFace : public RefCounted<CSSFontFace> {
45
class CSSFontFace : public RefCounted<CSSFontFace> {
47
public:
46
public:
48
    static Ref<CSSFontFace> create(FontTraitsMask traitsMask, RefPtr<CSSFontFaceRule>&& rule, bool isLocalFallback = false) { return adoptRef(*new CSSFontFace(traitsMask, WTFMove(rule), isLocalFallback)); }
47
    static Ref<CSSFontFace> create(FontTraitsMask traitsMask, bool isLocalFallback = false) { return adoptRef(*new CSSFontFace(traitsMask, isLocalFallback)); }
49
48
50
    FontTraitsMask traitsMask() const { return m_traitsMask; }
49
    FontTraitsMask traitsMask() const { return m_traitsMask; }
51
50
Lines 75-87 public: a/Source/WebCore/css/CSSFontFace.h_sec3
75
    void addedToSegmentedFontFace(CSSSegmentedFontFace*);
74
    void addedToSegmentedFontFace(CSSSegmentedFontFace*);
76
    void removedFromSegmentedFontFace(CSSSegmentedFontFace*);
75
    void removedFromSegmentedFontFace(CSSSegmentedFontFace*);
77
76
78
    bool isValid() const;
77
    bool allSourcesHaveFailed() const;
79
78
80
    bool isLocalFallback() const { return m_isLocalFallback; }
79
    bool isLocalFallback() const { return m_isLocalFallback; }
81
80
82
    void addSource(std::unique_ptr<CSSFontFaceSource>);
81
    void addSource(std::unique_ptr<FontFaceSource>&&);
83
82
84
    void fontLoaded(CSSFontFaceSource*);
83
    // Something asynchronous happened (but nothing in particular; if you want to know, you have to figure it out yourself).
84
    void kick(FontFaceSource&);
85
85
86
    RefPtr<Font> font(const FontDescription&, bool syntheticBold, bool syntheticItalic);
86
    RefPtr<Font> font(const FontDescription&, bool syntheticBold, bool syntheticItalic);
87
87
Lines 100-125 public: a/Source/WebCore/css/CSSFontFace.h_sec4
100
        UChar32 m_to;
100
        UChar32 m_to;
101
    };
101
    };
102
102
103
#if ENABLE(SVG_FONTS)
104
    bool hasSVGFontFaceSource() const;
105
#endif
106
107
#if ENABLE(FONT_LOAD_EVENTS)
108
    enum LoadState { NotLoaded, Loading, Loaded, Error };
109
    LoadState loadState() const { return m_loadState; }
110
#endif
111
112
private:
103
private:
113
    CSSFontFace(FontTraitsMask traitsMask, RefPtr<CSSFontFaceRule>&& rule, bool isLocalFallback)
104
    CSSFontFace(FontTraitsMask traitsMask, bool isLocalFallback)
114
        : m_traitsMask(traitsMask)
105
        : m_traitsMask(traitsMask)
115
        , m_activeSource(0)
116
        , m_isLocalFallback(isLocalFallback)
106
        , m_isLocalFallback(isLocalFallback)
117
#if ENABLE(FONT_LOAD_EVENTS)
118
        , m_loadState(isLocalFallback ? Loaded : NotLoaded)
119
        , m_rule(rule)
120
#endif
121
    {
107
    {
122
        UNUSED_PARAM(rule);
123
    }
108
    }
124
109
125
    FontTraitsMask m_traitsMask;
110
    FontTraitsMask m_traitsMask;
Lines 127-141 private: a/Source/WebCore/css/CSSFontFace.h_sec5
127
    HashSet<CSSSegmentedFontFace*> m_segmentedFontFaces;
112
    HashSet<CSSSegmentedFontFace*> m_segmentedFontFaces;
128
    FontFeatureSettings m_featureSettings;
113
    FontFeatureSettings m_featureSettings;
129
    FontVariantSettings m_variantSettings;
114
    FontVariantSettings m_variantSettings;
130
    Vector<std::unique_ptr<CSSFontFaceSource>> m_sources;
115
    Vector<std::unique_ptr<FontFaceSource>> m_sources;
131
    CSSFontFaceSource* m_activeSource;
132
    bool m_isLocalFallback;
116
    bool m_isLocalFallback;
133
#if ENABLE(FONT_LOAD_EVENTS)
134
    LoadState m_loadState;
135
    RefPtr<CSSFontFaceRule> m_rule;
136
    void notifyFontLoader(LoadState);
137
    void notifyLoadingDone();
138
#endif
139
};
117
};
140
118
141
}
119
}
- a/Source/WebCore/css/CSSFontFaceSource.cpp -163 lines
Lines 1-163 a/Source/WebCore/css/CSSFontFaceSource.cpp_sec1
1
/*
2
 * Copyright (C) 2007, 2008, 2010, 2011 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. ``AS IS'' AND ANY
14
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#include "config.h"
27
#include "CSSFontFaceSource.h"
28
29
#include "CSSFontFace.h"
30
#include "CSSFontSelector.h"
31
#include "CachedFont.h"
32
#include "CachedResourceLoader.h"
33
#include "Document.h"
34
#include "ElementIterator.h"
35
#include "Font.h"
36
#include "FontCache.h"
37
#include "FontDescription.h"
38
39
#if ENABLE(SVG_OTF_CONVERTER)
40
#include "FontCustomPlatformData.h"
41
#include "SVGToOTFFontConversion.h"
42
#endif
43
44
#if ENABLE(SVG_FONTS)
45
#include "CachedSVGFont.h"
46
#include "FontCustomPlatformData.h"
47
#include "SVGFontData.h"
48
#include "SVGFontElement.h"
49
#include "SVGFontFaceElement.h"
50
#include "SVGNames.h"
51
#include "SVGURIReference.h"
52
#endif
53
54
namespace WebCore {
55
56
CSSFontFaceSource::CSSFontFaceSource(const String& str, CachedFont* font)
57
    : m_string(str)
58
    , m_font(font)
59
    , m_face(0)
60
{
61
    if (m_font)
62
        m_font->addClient(this);
63
}
64
65
CSSFontFaceSource::~CSSFontFaceSource()
66
{
67
    if (m_font)
68
        m_font->removeClient(this);
69
}
70
71
bool CSSFontFaceSource::isValid() const
72
{
73
    if (m_font)
74
        return !m_font->errorOccurred();
75
    return true;
76
}
77
78
void CSSFontFaceSource::fontLoaded(CachedFont*)
79
{
80
    if (m_face)
81
        m_face->fontLoaded(this);
82
}
83
84
RefPtr<Font> CSSFontFaceSource::font(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic, CSSFontSelector* fontSelector, const FontFeatureSettings& fontFaceFeatures, const FontVariantSettings& fontFaceVariantSettings)
85
{
86
    // If the font hasn't loaded or an error occurred, then we've got nothing.
87
    if (!isValid())
88
        return nullptr;
89
90
    if (!m_font
91
#if ENABLE(SVG_FONTS)
92
            && !m_svgFontFaceElement
93
#endif
94
    ) {
95
        // We're local. Just return a Font from the normal cache.
96
        // We don't want to check alternate font family names here, so pass true as the checkingAlternateName parameter.
97
        return FontCache::singleton().fontForFamily(fontDescription, m_string, true);
98
    }
99
100
    if (!m_font || m_font->isLoaded()) {
101
        if (m_font) {
102
            if (!m_font->ensureCustomFontData(m_string))
103
                return nullptr;
104
105
            return m_font->createFont(fontDescription, m_string, syntheticBold, syntheticItalic, fontFaceFeatures, fontFaceVariantSettings);
106
        } else {
107
#if ENABLE(SVG_FONTS)
108
            // In-Document SVG Fonts
109
            if (m_svgFontFaceElement) {
110
#if ENABLE(SVG_OTF_CONVERTER)
111
                if (!m_svgFontFaceElement->parentNode() || !is<SVGFontElement>(m_svgFontFaceElement->parentNode()))
112
                    return nullptr;
113
                SVGFontElement& fontElement = downcast<SVGFontElement>(*m_svgFontFaceElement->parentNode());
114
                // FIXME: Re-run this when script modifies the element or any of its descendents
115
                // FIXME: We might have already converted this font. Make existing conversions discoverable.
116
                if (auto otfFont = convertSVGToOTFFont(fontElement))
117
                    m_generatedOTFBuffer = SharedBuffer::adoptVector(otfFont.value());
118
                if (!m_generatedOTFBuffer)
119
                    return nullptr;
120
                auto customPlatformData = createFontCustomPlatformData(*m_generatedOTFBuffer);
121
                if (!customPlatformData)
122
                    return nullptr;
123
                return Font::create(customPlatformData->fontPlatformData(fontDescription, syntheticBold, syntheticItalic, fontFaceFeatures, fontFaceVariantSettings), true, false);
124
#else
125
                return Font::create(std::make_unique<SVGFontData>(m_svgFontFaceElement.get()), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);
126
#endif
127
            }
128
#endif
129
            return nullptr;
130
        }
131
    } else {
132
        // Kick off the load. Do it soon rather than now, because we may be in the middle of layout,
133
        // and the loader may invoke arbitrary delegate or event handler code.
134
        fontSelector->beginLoadingFontSoon(m_font.get());
135
136
        return Font::create(FontCache::singleton().lastResortFallbackFont(fontDescription)->platformData(), true, true);
137
    }
138
}
139
140
#if ENABLE(SVG_FONTS)
141
bool CSSFontFaceSource::isSVGFontFaceSource() const
142
{
143
    return m_svgFontFaceElement || is<CachedSVGFont>(m_font.get());
144
}
145
#endif
146
147
#if ENABLE(FONT_LOAD_EVENTS)
148
bool CSSFontFaceSource::isDecodeError() const
149
{
150
    if (m_font)
151
        return m_font->status() == CachedResource::DecodeError;
152
    return false;
153
}
154
155
bool CSSFontFaceSource::ensureFontData()
156
{
157
    if (!m_font)
158
        return false;
159
    return m_font->ensureCustomFontData(m_hasExternalSVGFont, m_string);
160
}
161
#endif
162
163
}
- a/Source/WebCore/css/CSSFontFaceSource.h -95 lines
Lines 1-95 a/Source/WebCore/css/CSSFontFaceSource.h_sec1
1
/*
2
 * Copyright (C) 2007, 2008, 2011 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. ``AS IS'' AND ANY
14
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#ifndef CSSFontFaceSource_h
27
#define CSSFontFaceSource_h
28
29
#include "CachedFontClient.h"
30
#include "CachedResourceHandle.h"
31
#include "SharedBuffer.h"
32
#if ENABLE(SVG_FONTS)
33
#include "SVGFontElement.h"
34
#include "SVGFontFaceElement.h"
35
#endif
36
#include "Timer.h"
37
#include <wtf/text/AtomicString.h>
38
39
namespace WebCore {
40
41
class CSSFontFace;
42
class CSSFontSelector;
43
class Font;
44
class FontDescription;
45
class FontFeatureSettings;
46
struct FontVariantSettings;
47
48
class CSSFontFaceSource final : public CachedFontClient {
49
    WTF_MAKE_FAST_ALLOCATED;
50
public:
51
    CSSFontFaceSource(const String&, CachedFont* = nullptr);
52
    virtual ~CSSFontFaceSource();
53
54
    bool isValid() const;
55
56
    const AtomicString& string() const { return m_string; }
57
58
    void setFontFace(CSSFontFace* face) { m_face = face; }
59
60
    virtual void fontLoaded(CachedFont*) override;
61
62
    RefPtr<Font> font(const FontDescription&, bool syntheticBold, bool syntheticItalic, CSSFontSelector*, const FontFeatureSettings&, const FontVariantSettings&);
63
64
    void pruneTable();
65
66
#if ENABLE(SVG_FONTS)
67
    SVGFontFaceElement* svgFontFaceElement() const { return m_svgFontFaceElement.get(); }
68
    void setSVGFontFaceElement(PassRefPtr<SVGFontFaceElement> element) { m_svgFontFaceElement = element; }
69
    bool isSVGFontFaceSource() const;
70
#endif
71
72
#if ENABLE(FONT_LOAD_EVENTS)
73
    bool isDecodeError() const;
74
    bool ensureFontData();
75
#endif
76
77
private:
78
    void startLoadingTimerFired();
79
80
    AtomicString m_string; // URI for remote, built-in font name for local.
81
    CachedResourceHandle<CachedFont> m_font; // For remote fonts, a pointer to our cached resource.
82
    CSSFontFace* m_face; // Our owning font face.
83
84
#if ENABLE(SVG_OTF_CONVERTER)
85
    RefPtr<SharedBuffer> m_generatedOTFBuffer;
86
#endif
87
88
#if ENABLE(SVG_FONTS) || ENABLE(SVG_OTF_CONVERTER)
89
    RefPtr<SVGFontFaceElement> m_svgFontFaceElement;
90
#endif
91
};
92
93
}
94
95
#endif
- a/Source/WebCore/css/CSSFontSelector.cpp -23 / +20 lines
Lines 27-36 a/Source/WebCore/css/CSSFontSelector.cpp_sec1
27
#include "config.h"
27
#include "config.h"
28
#include "CSSFontSelector.h"
28
#include "CSSFontSelector.h"
29
29
30
#include "CachedFont.h"
31
#include "CSSFontFace.h"
30
#include "CSSFontFace.h"
32
#include "CSSFontFaceRule.h"
31
#include "CSSFontFaceRule.h"
33
#include "CSSFontFaceSource.h"
34
#include "CSSFontFaceSrcValue.h"
32
#include "CSSFontFaceSrcValue.h"
35
#include "CSSFontFamily.h"
33
#include "CSSFontFamily.h"
36
#include "CSSFontFeatureValue.h"
34
#include "CSSFontFeatureValue.h"
Lines 41-46 a/Source/WebCore/css/CSSFontSelector.cpp_sec2
41
#include "CSSUnicodeRangeValue.h"
39
#include "CSSUnicodeRangeValue.h"
42
#include "CSSValueKeywords.h"
40
#include "CSSValueKeywords.h"
43
#include "CSSValueList.h"
41
#include "CSSValueList.h"
42
#include "CachedFont.h"
43
#include "CachedRemoteFontFaceSource.h"
44
#include "CachedResourceLoader.h"
44
#include "CachedResourceLoader.h"
45
#include "Document.h"
45
#include "Document.h"
46
#include "Font.h"
46
#include "Font.h"
Lines 48-53 a/Source/WebCore/css/CSSFontSelector.cpp_sec3
48
#include "FontVariantBuilder.h"
48
#include "FontVariantBuilder.h"
49
#include "Frame.h"
49
#include "Frame.h"
50
#include "FrameLoader.h"
50
#include "FrameLoader.h"
51
#include "InDocumentSVGFontFaceSource.h"
52
#include "LocalFontFaceSource.h"
51
#include "SVGFontFaceElement.h"
53
#include "SVGFontFaceElement.h"
52
#include "SVGNames.h"
54
#include "SVGNames.h"
53
#include "Settings.h"
55
#include "Settings.h"
Lines 152-167 static Optional<FontTraitsMask> computeTraitsMask(const StyleProperties& style) a/Source/WebCore/css/CSSFontSelector.cpp_sec4
152
    return static_cast<FontTraitsMask>(traitsMask);
154
    return static_cast<FontTraitsMask>(traitsMask);
153
}
155
}
154
156
155
static Ref<CSSFontFace> createFontFace(CSSValueList& srcList, FontTraitsMask traitsMask, Document* document, const StyleRuleFontFace& fontFaceRule, bool isInitiatingElementInUserAgentShadowTree)
157
static Ref<CSSFontFace> createFontFace(CSSValueList& srcList, FontTraitsMask traitsMask, Document* document, CSSFontSelector& fontSelector, bool isInitiatingElementInUserAgentShadowTree)
156
{
158
{
157
    RefPtr<CSSFontFaceRule> rule;
159
    RefPtr<CSSFontFaceRule> rule;
158
#if ENABLE(FONT_LOAD_EVENTS)
159
    // FIXME: https://bugs.webkit.org/show_bug.cgi?id=112116 - This CSSFontFaceRule has no parent.
160
    if (RuntimeEnabledFeatures::sharedFeatures().fontLoadEventsEnabled())
161
        rule = static_pointer_cast<CSSFontFaceRule>(fontFaceRule.createCSSOMWrapper());
162
#else
163
    UNUSED_PARAM(fontFaceRule);
164
#endif
165
    Ref<CSSFontFace> fontFace = CSSFontFace::create(traitsMask, WTFMove(rule));
160
    Ref<CSSFontFace> fontFace = CSSFontFace::create(traitsMask, WTFMove(rule));
166
161
167
    int srcLength = srcList.length();
162
    int srcLength = srcList.length();
Lines 171-177 static Ref<CSSFontFace> createFontFace(CSSValueList& srcList, FontTraitsMask tra a/Source/WebCore/css/CSSFontSelector.cpp_sec5
171
    for (int i = 0; i < srcLength; i++) {
166
    for (int i = 0; i < srcLength; i++) {
172
        // An item in the list either specifies a string (local font name) or a URL (remote font to download).
167
        // An item in the list either specifies a string (local font name) or a URL (remote font to download).
173
        CSSFontFaceSrcValue& item = downcast<CSSFontFaceSrcValue>(*srcList.itemWithoutBoundsCheck(i));
168
        CSSFontFaceSrcValue& item = downcast<CSSFontFaceSrcValue>(*srcList.itemWithoutBoundsCheck(i));
174
        std::unique_ptr<CSSFontFaceSource> source;
169
        std::unique_ptr<FontFaceSource> source;
175
170
176
#if ENABLE(SVG_FONTS)
171
#if ENABLE(SVG_FONTS)
177
        foundSVGFont = item.isSVGFontFaceSrc() || item.svgFontFaceElement();
172
        foundSVGFont = item.isSVGFontFaceSrc() || item.svgFontFaceElement();
Lines 181-197 static Ref<CSSFontFace> createFontFace(CSSValueList& srcList, FontTraitsMask tra a/Source/WebCore/css/CSSFontSelector.cpp_sec6
181
            bool allowDownloading = foundSVGFont || (settings && settings->downloadableBinaryFontsEnabled());
176
            bool allowDownloading = foundSVGFont || (settings && settings->downloadableBinaryFontsEnabled());
182
            if (allowDownloading && item.isSupportedFormat() && document) {
177
            if (allowDownloading && item.isSupportedFormat() && document) {
183
                if (CachedFont* cachedFont = item.cachedFont(document, foundSVGFont, isInitiatingElementInUserAgentShadowTree))
178
                if (CachedFont* cachedFont = item.cachedFont(document, foundSVGFont, isInitiatingElementInUserAgentShadowTree))
184
                    source = std::make_unique<CSSFontFaceSource>(item.resource(), cachedFont);
179
                    source = std::make_unique<CachedRemoteFontFaceSource>(fontFace, fontSelector, *cachedFont, item.resource());
185
            }
180
            }
186
        } else
181
        } else {
187
            source = std::make_unique<CSSFontFaceSource>(item.resource());
188
189
        if (source) {
190
#if ENABLE(SVG_FONTS)
182
#if ENABLE(SVG_FONTS)
191
            source->setSVGFontFaceElement(item.svgFontFaceElement());
183
            if (auto* fontFaceElement = item.svgFontFaceElement())
184
                source = std::make_unique<InDocumentSVGFontFaceSource>(fontFace, *fontFaceElement, item.resource());
185
            else
192
#endif
186
#endif
193
            fontFace->addSource(WTFMove(source));
187
                source = std::make_unique<LocalFontFaceSource>(fontFace, item.resource());
194
        }
188
        }
189
190
        if (source)
191
            fontFace->addSource(WTFMove(source));
195
    }
192
    }
196
193
197
    return fontFace;
194
    return fontFace;
Lines 234-242 static void registerLocalFontFacesForFamily(const String& familyName, HashMap<St a/Source/WebCore/css/CSSFontSelector.cpp_sec7
234
231
235
    Vector<Ref<CSSFontFace>> faces = { };
232
    Vector<Ref<CSSFontFace>> faces = { };
236
    for (auto mask : traitsMasks) {
233
    for (auto mask : traitsMasks) {
237
        Ref<CSSFontFace> face = CSSFontFace::create(mask, nullptr, true);
234
        Ref<CSSFontFace> face = CSSFontFace::create(mask, true);
238
        face->addSource(std::make_unique<CSSFontFaceSource>(familyName));
235
        face->addSource(std::make_unique<LocalFontFaceSource>(face, familyName));
239
        ASSERT(face->isValid());
236
        ASSERT(!face->allSourcesHaveFailed());
240
        faces.append(WTFMove(face));
237
        faces.append(WTFMove(face));
241
    }
238
    }
242
    locallyInstalledFontFaces.add(familyName, WTFMove(faces));
239
    locallyInstalledFontFaces.add(familyName, WTFMove(faces));
Lines 273-280 void CSSFontSelector::addFontFaceRule(const StyleRuleFontFace& fontFaceRule, boo a/Source/WebCore/css/CSSFontSelector.cpp_sec8
273
        return;
270
        return;
274
    auto traitsMask = computedTraitsMask.value();
271
    auto traitsMask = computedTraitsMask.value();
275
272
276
    Ref<CSSFontFace> fontFace = createFontFace(srcList, traitsMask, m_document, fontFaceRule, isInitiatingElementInUserAgentShadowTree);
273
    Ref<CSSFontFace> fontFace = createFontFace(srcList, traitsMask, m_document, *this, isInitiatingElementInUserAgentShadowTree);
277
    if (!fontFace->isValid())
274
    if (fontFace->allSourcesHaveFailed())
278
        return;
275
        return;
279
276
280
    if (rangeList) {
277
    if (rangeList) {
- a/Source/WebCore/css/CSSSegmentedFontFace.cpp -4 / +2 lines
Lines 27-33 a/Source/WebCore/css/CSSSegmentedFontFace.cpp_sec1
27
#include "CSSSegmentedFontFace.h"
27
#include "CSSSegmentedFontFace.h"
28
28
29
#include "CSSFontFace.h"
29
#include "CSSFontFace.h"
30
#include "CSSFontFaceSource.h"
31
#include "CSSFontSelector.h"
30
#include "CSSFontSelector.h"
32
#include "Document.h"
31
#include "Document.h"
33
#include "Font.h"
32
#include "Font.h"
Lines 98-111 static void appendFontWithInvalidUnicodeRangeIfLoading(FontRanges& ranges, Ref<F a/Source/WebCore/css/CSSSegmentedFontFace.cpp_sec2
98
97
99
FontRanges CSSSegmentedFontFace::fontRanges(const FontDescription& fontDescription)
98
FontRanges CSSSegmentedFontFace::fontRanges(const FontDescription& fontDescription)
100
{
99
{
101
    FontTraitsMask desiredTraitsMask = fontDescription.traitsMask();
102
103
    auto addResult = m_descriptionToRangesMap.add(FontDescriptionKey(fontDescription), FontRanges());
100
    auto addResult = m_descriptionToRangesMap.add(FontDescriptionKey(fontDescription), FontRanges());
104
    auto& fontRanges = addResult.iterator->value;
101
    auto& fontRanges = addResult.iterator->value;
105
102
106
    if (addResult.isNewEntry) {
103
    if (addResult.isNewEntry) {
104
        FontTraitsMask desiredTraitsMask = fontDescription.traitsMask();
107
        for (auto& face : m_fontFaces) {
105
        for (auto& face : m_fontFaces) {
108
            if (!face->isValid())
106
            if (face->allSourcesHaveFailed())
109
                continue;
107
                continue;
110
108
111
            FontTraitsMask traitsMask = face->traitsMask();
109
            FontTraitsMask traitsMask = face->traitsMask();
- a/Source/WebCore/css/CachedRemoteFontFaceSource.cpp +70 lines
Line 0 a/Source/WebCore/css/CachedRemoteFontFaceSource.cpp_sec1
1
/*
2
 * Copyright (C) 2016 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 "CachedRemoteFontFaceSource.h"
28
29
#include "CSSFontFace.h"
30
#include "CSSFontSelector.h"
31
#include "CachedFont.h"
32
33
namespace WebCore {
34
35
CachedRemoteFontFaceSource::CachedRemoteFontFaceSource(CSSFontFace& owner, CSSFontSelector& fontSelector, CachedFont& cachedFont, const AtomicString& remoteURI)
36
    : ByteBasedFontFaceSource(owner, remoteURI)
37
    , m_fontSelector(fontSelector)
38
    , m_cachedFont(cachedFont)
39
{
40
    m_cachedFont.addClient(this);
41
}
42
43
void CachedRemoteFontFaceSource::initiateLoad()
44
{
45
    // Kick off the load. Do it soon rather than now, because we may be in the middle of layout,
46
    // and the loader may invoke arbitrary delegate or event handler code.
47
    m_fontSelector.beginLoadingFontSoon(&m_cachedFont);
48
}
49
50
void CachedRemoteFontFaceSource::fontLoaded(CachedFont& font)
51
{
52
    ASSERT_UNUSED(font, &font == &m_cachedFont);
53
    ASSERT(!m_cachedFont.isLoading());
54
55
    // If the font is in the cache, this function will be called synchronously from CachedFont::addClient().
56
    if (state() == State::Pending)
57
        setState(State::Loading);
58
59
    if (m_cachedFont.errorOccurred() || !m_cachedFont.resourceBuffer()) {
60
        setState(State::Failed);
61
        owner().kick(*this);
62
        return;
63
    }
64
65
    m_cachedFont.setHasCreatedFontDataWrappingResource(bufferProvided(*m_cachedFont.resourceBuffer()));
66
67
    owner().kick(*this);
68
}
69
70
}
- a/Source/WebCore/css/CachedRemoteFontFaceSource.h +53 lines
Line 0 a/Source/WebCore/css/CachedRemoteFontFaceSource.h_sec1
1
/*
2
 * Copyright (C) 2016 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
#ifndef CachedRemoteFontFaceSource_h
27
#define CachedRemoteFontFaceSource_h
28
29
#include "ByteBasedFontFaceSource.h"
30
#include "CachedFontClient.h"
31
32
namespace WebCore {
33
34
class CachedFont;
35
class CSSFontSelector;
36
37
class CachedRemoteFontFaceSource final : public ByteBasedFontFaceSource, public CachedFontClient {
38
public:
39
    CachedRemoteFontFaceSource(CSSFontFace& owner, CSSFontSelector&, CachedFont&, const AtomicString& remoteURI);
40
41
private:
42
    virtual void initiateLoad() override;
43
44
    // CachedFontClient
45
    virtual void fontLoaded(CachedFont&) override;
46
47
    CSSFontSelector& m_fontSelector;
48
    CachedFont& m_cachedFont;
49
};
50
51
}
52
53
#endif
- a/Source/WebCore/css/FontFaceSource.cpp +130 lines
Line 0 a/Source/WebCore/css/FontFaceSource.cpp_sec1
1
/*
2
 * Copyright (C) 2016 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 "FontFaceSource.h"
28
29
#include "FontDescription.h"
30
#include "TextFlags.h"
31
32
namespace WebCore {
33
34
FontFaceSource::HashKey::HashKey()
35
{
36
}
37
38
FontFaceSource::HashKey::HashKey(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings& fontFaceFeatureSettings, const FontVariantSettings& fontFaceVariantSettings)
39
    : m_size(fontDescription.computedPixelSize() + 1) // We don't want to collide with an empty cache entry.
40
    , m_widthVariant(fontDescription.widthVariant())
41
    , m_orientation(fontDescription.orientation())
42
    , m_syntheticBold(syntheticBold)
43
    , m_syntheticItalic(syntheticItalic)
44
    , m_textRenderingMode(fontDescription.textRenderingMode())
45
    , m_descriptionFeatureSettings(fontDescription.featureSettings())
46
    , m_fontFaceFeatureSettings(fontFaceFeatureSettings)
47
    , m_descriptionVariantSettings(fontDescription.variantSettings())
48
    , m_fontFaceVariantSettings(fontFaceVariantSettings)
49
{
50
    ASSERT(m_size > 0 && m_size < cHashTableDeletedSize);
51
}
52
53
FontFaceSource::HashKey::HashKey(WTF::HashTableDeletedValueType)
54
    : m_size(cHashTableDeletedSize)
55
{
56
}
57
58
bool FontFaceSource::HashKey::isHashTableDeletedValue() const
59
{
60
    return m_size == cHashTableDeletedSize;
61
}
62
63
bool FontFaceSource::HashKey::operator==(const HashKey& other) const
64
{
65
    return m_size == other.m_size
66
        && m_widthVariant == other.m_widthVariant
67
        && m_orientation == other.m_orientation
68
        && m_syntheticBold == other.m_syntheticBold
69
        && m_syntheticItalic == other.m_syntheticItalic
70
        && m_textRenderingMode == other.m_textRenderingMode
71
        && m_descriptionFeatureSettings == other.m_descriptionFeatureSettings
72
        && m_fontFaceFeatureSettings == other.m_fontFaceFeatureSettings
73
        && m_descriptionVariantSettings == other.m_descriptionVariantSettings
74
        && m_fontFaceVariantSettings == other.m_fontFaceVariantSettings;
75
}
76
77
bool FontFaceSource::HashKey::operator!=(const HashKey& other) const
78
{
79
    return !(*this == other);
80
}
81
82
unsigned FontFaceSource::HashKey::hash(const HashKey& key)
83
{
84
    IntegerHasher hasher;
85
    hasher.add(key.m_size);
86
    hasher.add(key.m_widthVariant);
87
    hasher.add(key.m_orientation);
88
    hasher.add(key.m_syntheticBold);
89
    hasher.add(key.m_syntheticItalic);
90
    hasher.add(key.m_textRenderingMode);
91
    hasher.add(key.m_descriptionFeatureSettings.hash());
92
    hasher.add(key.m_fontFaceFeatureSettings.hash());
93
    hasher.add(key.m_descriptionVariantSettings.hash());
94
    hasher.add(key.m_fontFaceVariantSettings.hash());
95
    return hasher.hash();
96
}
97
98
bool FontFaceSource::HashKey::equal(const HashKey& a, const HashKey& b)
99
{
100
    return a == b;
101
}
102
103
const unsigned FontFaceSource::HashKey::cHashTableDeletedSize = 0xFFFFFFFFU;
104
105
FontFaceSource::FontFaceSource(CSSFontFace& owner)
106
    : m_owner(owner)
107
{
108
}
109
110
void FontFaceSource::load()
111
{
112
    ASSERT(m_state == State::Pending);
113
    setState(State::Loading);
114
    initiateLoad();
115
}
116
117
RefPtr<Font> FontFaceSource::font(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings& fontFaceFeatureSettings, const FontVariantSettings& fontFaceVariantSettings)
118
{
119
    ASSERT(m_state == State::Succeeded);
120
    if (!shouldCache())
121
        return createFont(fontDescription, syntheticBold, syntheticItalic, fontFaceFeatureSettings, fontFaceVariantSettings);
122
123
    HashKey hashKey(fontDescription, syntheticBold, syntheticItalic, fontFaceFeatureSettings, fontFaceVariantSettings);
124
    auto addResult = m_cache.add(hashKey, nullptr);
125
    if (addResult.isNewEntry)
126
        addResult.iterator->value = createFont(fontDescription, syntheticBold, syntheticItalic, fontFaceFeatureSettings, fontFaceVariantSettings);
127
    return addResult.iterator->value;
128
}
129
130
}
- a/Source/WebCore/css/FontFaceSource.h +118 lines
Line 0 a/Source/WebCore/css/FontFaceSource.h_sec1
1
/*
2
 * Copyright (C) 2016 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
#ifndef FontFaceSource_h
27
#define FontFaceSource_h
28
29
#include "Font.h"
30
#include "FontFeatureSettings.h"
31
32
namespace WebCore {
33
34
class CSSFontFace;
35
class Font;
36
class FontDescription;
37
class FontFeatureSettings;
38
struct FontVariantSettings;
39
40
// This class represents a single clause of a src: attribute inside an @font-face block.
41
class FontFaceSource {
42
    WTF_MAKE_FAST_ALLOCATED;
43
public:
44
    FontFaceSource(CSSFontFace& owner);
45
    virtual ~FontFaceSource() { }
46
47
    //                      -> Succeeded
48
    //                    /
49
    // Pending -> Loading
50
    //                    \
51
    //                      -> Failed
52
    enum class State {
53
        Pending,
54
        Loading,
55
        Failed,
56
        Succeeded
57
    };
58
    State state() const { return m_state; }
59
60
    // State transition from Pending to Loading
61
    void load();
62
63
    // Subclasses handle the transition from Loading to Failed/Succeeded.
64
65
    // Only valid when state is Succeeded
66
    RefPtr<Font> font(const FontDescription&, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings& fontFaceFeatureSettings, const FontVariantSettings& fontFaceVariantSettings);
67
68
protected:
69
    CSSFontFace& owner() const { return m_owner; }
70
    void setState(State state) { m_state = state; }
71
72
private:
73
    // Among the many arguments to font(), this key is only sensitive to the pieces that are actually used when creating a Font.
74
    // Other values are expected (indeed, encouraged) to collide for performance.
75
    class HashKey {
76
    public:
77
        HashKey();
78
        HashKey(const FontDescription&, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings& fontFaceFeatureSettings, const FontVariantSettings& fontFaceVariantSettings);
79
80
        explicit HashKey(WTF::HashTableDeletedValueType);
81
82
        bool isHashTableDeletedValue() const;
83
84
        bool operator==(const HashKey& other) const;
85
        bool operator!=(const HashKey& other) const;
86
87
        static unsigned hash(const HashKey&);
88
        static bool equal(const HashKey&, const HashKey&);
89
90
        static const bool safeToCompareToEmptyOrDeleted = true;
91
92
    private:
93
        static const unsigned cHashTableDeletedSize;
94
95
        unsigned m_size { 0 };
96
        FontWidthVariant m_widthVariant { RegularWidth };
97
        FontOrientation m_orientation { Horizontal };
98
        bool m_syntheticBold { false };
99
        bool m_syntheticItalic { false };
100
        TextRenderingMode m_textRenderingMode { AutoTextRendering };
101
        FontFeatureSettings m_descriptionFeatureSettings;
102
        FontFeatureSettings m_fontFaceFeatureSettings;
103
        FontVariantSettings m_descriptionVariantSettings;
104
        FontVariantSettings m_fontFaceVariantSettings;
105
    };
106
107
    virtual bool shouldCache() const { return true; }
108
    virtual void initiateLoad() = 0;
109
    virtual RefPtr<Font> createFont(const FontDescription&, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings& fontFaceFeatureSettings, const FontVariantSettings& fontFaceVariantSettings) = 0;
110
111
    CSSFontFace& m_owner;
112
    HashMap<HashKey, RefPtr<Font>, HashKey, WTF::SimpleClassHashTraits<HashKey>> m_cache;
113
    State m_state { State::Pending };
114
};
115
116
}
117
118
#endif
- a/Source/WebCore/css/FontLoader.cpp -1 lines
Lines 29-35 a/Source/WebCore/css/FontLoader.cpp_sec1
29
#if ENABLE(FONT_LOAD_EVENTS)
29
#if ENABLE(FONT_LOAD_EVENTS)
30
30
31
#include "CSSFontFaceLoadEvent.h"
31
#include "CSSFontFaceLoadEvent.h"
32
#include "CSSFontFaceSource.h"
33
#include "CSSFontSelector.h"
32
#include "CSSFontSelector.h"
34
#include "CSSParser.h"
33
#include "CSSParser.h"
35
#include "CSSSegmentedFontFace.h"
34
#include "CSSSegmentedFontFace.h"
- a/Source/WebCore/css/ImmediateFontFaceSource.h +53 lines
Line 0 a/Source/WebCore/css/ImmediateFontFaceSource.h_sec1
1
/*
2
 * Copyright (C) 2016 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
#ifndef ImmediateFontFaceSource_h
27
#define ImmediateFontFaceSource_h
28
29
#include "ByteBasedFontFaceSource.h"
30
31
namespace WebCore {
32
33
class ImmediateFontFaceSource final : public ByteBasedFontFaceSource {
34
public:
35
    ImmediateFontFaceSource(CSSFontFace& owner, JSC::ArrayBuffer& data)
36
        : ByteBasedFontFaceSource(owner)
37
    {
38
        setState(State::Loading);
39
        bufferProvided(data);
40
    }
41
42
private:
43
    virtual void initiateLoad() override
44
    {
45
        ASSERT_NOT_REACHED();
46
    }
47
};
48
49
}
50
51
#endif
52
53
- a/Source/WebCore/css/InDocumentSVGFontFaceSource.cpp +60 lines
Line 0 a/Source/WebCore/css/InDocumentSVGFontFaceSource.cpp_sec1
1
/*
2
 * Copyright (C) 2016 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 "InDocumentSVGFontFaceSource.h"
28
29
#include "SVGFontElement.h"
30
#include "SVGFontFaceElement.h"
31
#include "SVGToOTFFontConversion.h"
32
#include "SharedBuffer.h"
33
34
namespace WebCore {
35
36
InDocumentSVGFontFaceSource::InDocumentSVGFontFaceSource(CSSFontFace& owner, SVGFontFaceElement& fontFace, const AtomicString& remoteURI)
37
    : ByteBasedFontFaceSource(owner, remoteURI, false)
38
    , m_svgFontFaceElement(fontFace)
39
{
40
}
41
42
void InDocumentSVGFontFaceSource::initiateLoad()
43
{
44
    if (!m_svgFontFaceElement->parentNode() || !is<SVGFontElement>(m_svgFontFaceElement->parentNode())) {
45
        setState(State::Failed);
46
        return;
47
    }
48
49
    SVGFontElement& fontElement = downcast<SVGFontElement>(*m_svgFontFaceElement->parentNode());
50
51
    if (auto otfFont = convertSVGToOTFFont(fontElement)) {
52
        RefPtr<SharedBuffer> buffer = SharedBuffer::adoptVector(otfFont.value());
53
        bufferProvided(*buffer);
54
        return;
55
    }
56
57
    setState(State::Failed);
58
}
59
60
}
- a/Source/WebCore/css/InDocumentSVGFontFaceSource.h +49 lines
Line 0 a/Source/WebCore/css/InDocumentSVGFontFaceSource.h_sec1
1
/*
2
 * Copyright (C) 2016 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
#ifndef InDocumentSVGFontFaceSource_h
27
#define InDocumentSVGFontFaceSource_h
28
29
#include "ByteBasedFontFaceSource.h"
30
31
namespace WebCore {
32
33
class SVGFontFaceElement;
34
35
class InDocumentSVGFontFaceSource final : public ByteBasedFontFaceSource {
36
public:
37
    InDocumentSVGFontFaceSource(CSSFontFace& owner, SVGFontFaceElement&, const AtomicString& remoteURI);
38
39
private:
40
    virtual void initiateLoad() override;
41
42
    Ref<SVGFontFaceElement> m_svgFontFaceElement;
43
};
44
45
}
46
47
#endif
48
49
- a/Source/WebCore/css/LocalFontFaceSource.cpp +54 lines
Line 0 a/Source/WebCore/css/LocalFontFaceSource.cpp_sec1
1
/*
2
 * Copyright (C) 2016 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 "LocalFontFaceSource.h"
28
29
#include "FontCache.h"
30
31
namespace WebCore {
32
33
LocalFontFaceSource::LocalFontFaceSource(CSSFontFace& owner, const String& familyName)
34
    : FontFaceSource(owner)
35
    , m_familyName(familyName)
36
{
37
}
38
39
void LocalFontFaceSource::initiateLoad()
40
{
41
    setState(State::Succeeded);
42
}
43
44
RefPtr<Font> LocalFontFaceSource::createFont(const FontDescription& fontDescription, bool, bool, const FontFeatureSettings&, const FontVariantSettings&)
45
{
46
    // The @font-face block's bold/italic style may disagree with our own knowledge of the real traits of a preinstalled font.
47
    // In this situation, we should consider the real traits of the preinstalled font when determining if we should apply synthetic bold/italic.
48
    // Luckily, FontCache automatically does this for us, so we simply disregard the @font-face block's bold/italic style.
49
50
    // FIXME: This local font face needs to apply the @font-face's font feature properties.
51
    return FontCache::singleton().fontForFamily(fontDescription, m_familyName, true);
52
}
53
54
}
- a/Source/WebCore/css/LocalFontFaceSource.h +52 lines
Line 0 a/Source/WebCore/css/LocalFontFaceSource.h_sec1
1
/*
2
 * Copyright (C) 2016 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
#ifndef LocalFontFaceSource_h
27
#define LocalFontFaceSource_h
28
29
#include "FontFaceSource.h"
30
31
namespace WebCore {
32
33
// This class represents an entry of "src: local(xyz)" in an @font-face block.
34
class LocalFontFaceSource final : public FontFaceSource {
35
public:
36
    LocalFontFaceSource(CSSFontFace& owner, const String& familyName);
37
38
private:
39
    // We internally use FontCache, which is sensitive to more pieces of the FontDescription than our cache is sensitive to, so the FontFaceSource's cache would yield false hits.
40
    // Luckily, FontCache internally caches fonts, so we are still on a fast path.
41
    virtual bool shouldCache() const override { return false; }
42
43
    virtual void initiateLoad() override;
44
45
    virtual RefPtr<Font> createFont(const FontDescription&, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings& fontFaceFeatureSettings, const FontVariantSettings& fontFaceVariantSettings) override;
46
47
    String m_familyName;
48
};
49
50
}
51
52
#endif
- a/Source/WebCore/css/UncachedRemoteFontFaceSource.cpp +97 lines
Line 0 a/Source/WebCore/css/UncachedRemoteFontFaceSource.cpp_sec1
1
/*
2
 * Copyright (C) 2016 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 "UncachedRemoteFontFaceSource.h"
28
29
#include "CSSFontFace.h"
30
#include "Event.h"
31
32
namespace WebCore {
33
34
UncachedRemoteFontFaceSource::Listener::Listener(WeakPtr<UncachedRemoteFontFaceSource>&& owner)
35
    : EventListener(EventListener::CPPEventListenerType)
36
    , m_owner(WTFMove(owner))
37
{
38
}
39
40
void UncachedRemoteFontFaceSource::Listener::handleEvent(ScriptExecutionContext*, Event* event)
41
{
42
    if (!m_owner)
43
        return;
44
45
    m_owner->loadFinished(event && event->type() == eventNames().successEvent);
46
}
47
48
bool UncachedRemoteFontFaceSource::Listener::operator==(const EventListener& other)
49
{
50
    return this == &other;
51
}
52
53
UncachedRemoteFontFaceSource::UncachedRemoteFontFaceSource(CSSFontFace& owner, ScriptExecutionContext& scriptExecutionContext, const URL& url)
54
    : ByteBasedFontFaceSource(owner, url.string())
55
    , m_factory(this)
56
    , m_xmlHttpRequest(XMLHttpRequest::create(scriptExecutionContext))
57
    , m_listener(Listener::create(m_factory.createWeakPtr()))
58
    , m_url(url)
59
{
60
    m_xmlHttpRequest->addEventListener(eventNames().successEvent, m_listener.copyRef(), false);
61
    m_xmlHttpRequest->addEventListener(eventNames().errorEvent, m_listener.copyRef(), false);
62
    m_xmlHttpRequest->addEventListener(eventNames().abortEvent, m_listener.copyRef(), false);
63
}
64
65
void UncachedRemoteFontFaceSource::initiateLoad()
66
{
67
    ExceptionCode ec = 0;
68
    m_xmlHttpRequest->open(String("GET", String::ConstructFromLiteral), m_url, ec);
69
    if (ec) {
70
        setState(State::Failed);
71
        return;
72
    }
73
    m_xmlHttpRequest->setResponseType(String("arraybuffer", String::ConstructFromLiteral), ec);
74
    if (ec) {
75
        setState(State::Failed);
76
        return;
77
    }
78
    m_xmlHttpRequest->send(ec);
79
    if (ec) {
80
        setState(State::Failed);
81
        return;
82
    }
83
}
84
85
void UncachedRemoteFontFaceSource::loadFinished(bool success)
86
{
87
    if (!success || !m_xmlHttpRequest->responseArrayBuffer()) {
88
        setState(State::Failed);
89
        return;
90
    }
91
92
    bufferProvided(*m_xmlHttpRequest->responseArrayBuffer());
93
94
    owner().kick(*this);
95
}
96
97
}
- a/Source/WebCore/css/UncachedRemoteFontFaceSource.h +72 lines
Line 0 a/Source/WebCore/css/UncachedRemoteFontFaceSource.h_sec1
1
/*
2
 * Copyright (C) 2016 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
#ifndef UncachedRemoteFontFaceSource_h
27
#define UncachedRemoteFontFaceSource_h
28
29
#include "ByteBasedFontFaceSource.h"
30
#include "EventListener.h"
31
#include "XMLHttpRequest.h"
32
#include <wtf/WeakPtr.h>
33
34
namespace WebCore {
35
36
class scriptExecutionContext;
37
class URL;
38
39
class UncachedRemoteFontFaceSource final : public ByteBasedFontFaceSource {
40
public:
41
    UncachedRemoteFontFaceSource(CSSFontFace& owner, ScriptExecutionContext&, const URL&);
42
43
private:
44
    // This is a separate class becasue it needs to be RefCounted, but we don't want our FontFaceSources to be RefCounted.
45
    class Listener : public EventListener {
46
    public:
47
        static Ref<Listener> create(WeakPtr<UncachedRemoteFontFaceSource>&& owner) { return adoptRef(*new Listener(WTFMove(owner))); }
48
        bool success() const { return m_success; }
49
50
    private:
51
        Listener(WeakPtr<UncachedRemoteFontFaceSource>&& owner);
52
53
        virtual void handleEvent(ScriptExecutionContext*, Event*) override;
54
        virtual bool operator==(const EventListener& other) override;
55
56
        WeakPtr<UncachedRemoteFontFaceSource> m_owner;
57
        bool m_success { false };
58
    };
59
60
    virtual void initiateLoad() override;
61
62
    void loadFinished(bool success);
63
64
    WeakPtrFactory<UncachedRemoteFontFaceSource> m_factory;
65
    Ref<XMLHttpRequest> m_xmlHttpRequest;
66
    Ref<Listener> m_listener;
67
    URL m_url;
68
};
69
70
}
71
72
#endif
- a/Source/WebCore/loader/cache/CachedFont.cpp -2 / +2 lines
Lines 73-79 void CachedFont::didAddClient(CachedResourceClient* c) a/Source/WebCore/loader/cache/CachedFont.cpp_sec1
73
{
73
{
74
    ASSERT(c->resourceClientType() == CachedFontClient::expectedType());
74
    ASSERT(c->resourceClientType() == CachedFontClient::expectedType());
75
    if (!isLoading())
75
    if (!isLoading())
76
        static_cast<CachedFontClient*>(c)->fontLoaded(this);
76
        static_cast<CachedFontClient*>(c)->fontLoaded(*this);
77
}
77
}
78
78
79
void CachedFont::finishLoading(SharedBuffer* data)
79
void CachedFont::finishLoading(SharedBuffer* data)
Lines 150-156 void CachedFont::checkNotify() a/Source/WebCore/loader/cache/CachedFont.cpp_sec2
150
    
150
    
151
    CachedResourceClientWalker<CachedFontClient> w(m_clients);
151
    CachedResourceClientWalker<CachedFontClient> w(m_clients);
152
    while (CachedFontClient* c = w.next())
152
    while (CachedFontClient* c = w.next())
153
         c->fontLoaded(this);
153
        c->fontLoaded(*this);
154
}
154
}
155
155
156
bool CachedFont::mayTryReplaceEncodedData() const
156
bool CachedFont::mayTryReplaceEncodedData() const
- a/Source/WebCore/loader/cache/CachedFont.h +2 lines
Lines 49-54 public: a/Source/WebCore/loader/cache/CachedFont.h_sec1
49
    void beginLoadIfNeeded(CachedResourceLoader&);
49
    void beginLoadIfNeeded(CachedResourceLoader&);
50
    virtual bool stillNeedsLoad() const override { return !m_loadInitiated; }
50
    virtual bool stillNeedsLoad() const override { return !m_loadInitiated; }
51
51
52
    void setHasCreatedFontDataWrappingResource(bool hasCreatedFontDataWrappingResource) { hasCreatedFontDataWrappingResource = m_hasCreatedFontDataWrappingResource; }
53
52
    virtual bool ensureCustomFontData(const AtomicString& remoteURI);
54
    virtual bool ensureCustomFontData(const AtomicString& remoteURI);
53
55
54
    virtual RefPtr<Font> createFont(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings&, const FontVariantSettings&);
56
    virtual RefPtr<Font> createFont(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings&, const FontVariantSettings&);
- a/Source/WebCore/loader/cache/CachedFontClient.h -1 / +1 lines
Lines 37-43 public: a/Source/WebCore/loader/cache/CachedFontClient.h_sec1
37
    virtual ~CachedFontClient() { }
37
    virtual ~CachedFontClient() { }
38
    static CachedResourceClientType expectedType() { return FontType; }
38
    static CachedResourceClientType expectedType() { return FontType; }
39
    virtual CachedResourceClientType resourceClientType() const override { return expectedType(); }
39
    virtual CachedResourceClientType resourceClientType() const override { return expectedType(); }
40
    virtual void fontLoaded(CachedFont*) { }
40
    virtual void fontLoaded(CachedFont&) { }
41
};
41
};
42
42
43
} // namespace WebCore
43
} // namespace WebCore
- a/Source/WebCore/platform/graphics/FontCache.h -15 / +1 lines
Lines 118-138 private: a/Source/WebCore/platform/graphics/FontCache.h_sec1
118
            | static_cast<unsigned>(description.orientation()) << 2
118
            | static_cast<unsigned>(description.orientation()) << 2
119
            | static_cast<unsigned>(description.italic()) << 1
119
            | static_cast<unsigned>(description.italic()) << 1
120
            | static_cast<unsigned>(description.renderingMode());
120
            | static_cast<unsigned>(description.renderingMode());
121
        unsigned second = static_cast<unsigned>(description.variantEastAsianRuby()) << 27
121
        unsigned second = description.variantSettings().uniqueValue();
122
            | static_cast<unsigned>(description.variantEastAsianWidth()) << 25
123
            | static_cast<unsigned>(description.variantEastAsianVariant()) << 22
124
            | static_cast<unsigned>(description.variantAlternates()) << 21
125
            | static_cast<unsigned>(description.variantNumericSlashedZero()) << 20
126
            | static_cast<unsigned>(description.variantNumericOrdinal()) << 19
127
            | static_cast<unsigned>(description.variantNumericFraction()) << 17
128
            | static_cast<unsigned>(description.variantNumericSpacing()) << 15
129
            | static_cast<unsigned>(description.variantNumericFigure()) << 13
130
            | static_cast<unsigned>(description.variantCaps()) << 10
131
            | static_cast<unsigned>(description.variantPosition()) << 8
132
            | static_cast<unsigned>(description.variantContextualAlternates()) << 6
133
            | static_cast<unsigned>(description.variantHistoricalLigatures()) << 4
134
            | static_cast<unsigned>(description.variantDiscretionaryLigatures()) << 2
135
            | static_cast<unsigned>(description.variantCommonLigatures());
136
        return {{ first, second }};
122
        return {{ first, second }};
137
    }
123
    }
138
124
- a/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp +1 lines
Lines 36-41 FontCustomPlatformData::~FontCustomPlatformData() a/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp_sec1
36
36
37
FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription& fontDescription, bool bold, bool italic, const FontFeatureSettings& fontFaceFeatures, const FontVariantSettings& fontFaceVariantSettings)
37
FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription& fontDescription, bool bold, bool italic, const FontFeatureSettings& fontFaceFeatures, const FontVariantSettings& fontFaceVariantSettings)
38
{
38
{
39
    // This function must be consistent with FontFaceSource::HashKey.
39
    int size = fontDescription.computedPixelSize();
40
    int size = fontDescription.computedPixelSize();
40
    FontOrientation orientation = fontDescription.orientation();
41
    FontOrientation orientation = fontDescription.orientation();
41
    FontWidthVariant widthVariant = fontDescription.widthVariant();
42
    FontWidthVariant widthVariant = fontDescription.widthVariant();
- a/Source/WebCore/platform/text/TextFlags.h -1 / +30 lines
Lines 26-31 a/Source/WebCore/platform/text/TextFlags.h_sec1
26
#ifndef TextFlags_h
26
#ifndef TextFlags_h
27
#define TextFlags_h
27
#define TextFlags_h
28
28
29
#include <wtf/Hasher.h>
30
29
namespace WebCore {
31
namespace WebCore {
30
32
31
enum TextRenderingMode { AutoTextRendering, OptimizeSpeed, OptimizeLegibility, GeometricPrecision };
33
enum TextRenderingMode { AutoTextRendering, OptimizeSpeed, OptimizeLegibility, GeometricPrecision };
Lines 212-218 struct FontVariantSettings { a/Source/WebCore/platform/text/TextFlags.h_sec2
212
            && eastAsianRuby == FontVariantEastAsianRuby::Normal;
214
            && eastAsianRuby == FontVariantEastAsianRuby::Normal;
213
    }
215
    }
214
216
215
    bool operator==(const FontVariantSettings& other)
217
    bool operator==(const FontVariantSettings& other) const
216
    {
218
    {
217
        return commonLigatures == other.commonLigatures
219
        return commonLigatures == other.commonLigatures
218
            && discretionaryLigatures == other.discretionaryLigatures
220
            && discretionaryLigatures == other.discretionaryLigatures
Lines 231-236 struct FontVariantSettings { a/Source/WebCore/platform/text/TextFlags.h_sec3
231
            && eastAsianRuby == other.eastAsianRuby;
233
            && eastAsianRuby == other.eastAsianRuby;
232
    }
234
    }
233
235
236
    // Each combination of these variant features can be uniquely represented by a 32-bit number.
237
    unsigned uniqueValue() const
238
    {
239
        return static_cast<unsigned>(eastAsianRuby) << 27
240
            | static_cast<unsigned>(eastAsianWidth) << 25
241
            | static_cast<unsigned>(eastAsianVariant) << 22
242
            | static_cast<unsigned>(alternates) << 21
243
            | static_cast<unsigned>(numericSlashedZero) << 20
244
            | static_cast<unsigned>(numericOrdinal) << 19
245
            | static_cast<unsigned>(numericFraction) << 17
246
            | static_cast<unsigned>(numericSpacing) << 15
247
            | static_cast<unsigned>(numericFigure) << 13
248
            | static_cast<unsigned>(caps) << 10
249
            | static_cast<unsigned>(position) << 8
250
            | static_cast<unsigned>(contextualAlternates) << 6
251
            | static_cast<unsigned>(historicalLigatures) << 4
252
            | static_cast<unsigned>(discretionaryLigatures) << 2
253
            | static_cast<unsigned>(commonLigatures);
254
    }
255
256
    unsigned hash() const
257
    {
258
        IntegerHasher hasher;
259
        hasher.add(uniqueValue());
260
        return hasher.hash();
261
    }
262
234
    FontVariantLigatures commonLigatures;
263
    FontVariantLigatures commonLigatures;
235
    FontVariantLigatures discretionaryLigatures;
264
    FontVariantLigatures discretionaryLigatures;
236
    FontVariantLigatures historicalLigatures;
265
    FontVariantLigatures historicalLigatures;
- a/Source/WebCore/svg/SVGFontData.h -1 / +1 lines
Lines 56-62 private: a/Source/WebCore/svg/SVGFontData.h_sec1
56
    bool applyTransforms(GlyphBufferGlyph*, GlyphBufferAdvance*, size_t, bool enableKerning, bool requiresShaping) const = delete;
56
    bool applyTransforms(GlyphBufferGlyph*, GlyphBufferAdvance*, size_t, bool enableKerning, bool requiresShaping) const = delete;
57
57
58
    // Ths SVGFontFaceElement is kept alive --
58
    // Ths SVGFontFaceElement is kept alive --
59
    // 1) in the external font case: by the CSSFontFaceSource, which holds a reference to the external SVG document
59
    // 1) in the external font case: by the FontFaceSource, which holds a reference to the external SVG document
60
    //    containing the element;
60
    //    containing the element;
61
    // 2) in the in-document font case: by virtue of being in the document tree and making sure that when it is removed
61
    // 2) in the in-document font case: by virtue of being in the document tree and making sure that when it is removed
62
    //    from the document, it removes the @font-face rule it owns from the document's mapped element sheet and forces
62
    //    from the document, it removes the @font-face rule it owns from the document's mapped element sheet and forces

Return to Bug 153414