af8f7ab798daacddec36d29792384c1ab6f7aaed
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-07-16  Megan Gardner  <megan_gardner@apple.com>
2
3         Correctly adjust scroll offsets when a page is zoomed
4         https://bugs.webkit.org/show_bug.cgi?id=187673
5         <rdar://problem/41712829>
6
7         Reviewed by Wenson Hsieh.
8
9         Will add test later.
10
11         Make sure that distance is scaled by the pageScaleFactor, to 
12         make sure that we scroll correctly when we are zoomed in.
13
14         * page/ios/EventHandlerIOS.mm:
15         (WebCore::autoscrollAdjustmentFactorForScreenBoundaries):
16         
17 2018-07-16  Simon Fraser  <simon.fraser@apple.com>
18
19         Roll out r233873 and r233875 since they caused 8 new layout test crashes.
20
21         * crypto/CryptoAlgorithm.cpp:
22         (WebCore::CryptoAlgorithm::encrypt):
23         (WebCore::CryptoAlgorithm::decrypt):
24         (WebCore::CryptoAlgorithm::sign):
25         (WebCore::CryptoAlgorithm::verify):
26         (WebCore::CryptoAlgorithm::deriveBits):
27         (WebCore::CryptoAlgorithm::importKey):
28         (WebCore::dispatchAlgorithmOperation):
29         (WebCore::CryptoAlgorithm::dispatchOperation):
30         (WebCore::CryptoAlgorithm::dispatchOperationInWorkQueue): Deleted.
31         * crypto/CryptoAlgorithm.h:
32         * crypto/SubtleCrypto.cpp:
33         (WebCore::SubtleCrypto::encrypt):
34         (WebCore::SubtleCrypto::decrypt):
35         (WebCore::SubtleCrypto::sign):
36         (WebCore::SubtleCrypto::verify):
37         (WebCore::SubtleCrypto::deriveKey):
38         (WebCore::SubtleCrypto::deriveBits):
39         (WebCore::SubtleCrypto::importKey):
40         (WebCore::SubtleCrypto::wrapKey):
41         (WebCore::SubtleCrypto::unwrapKey):
42         (WebCore::crossThreadCopyImportParams): Deleted.
43         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
44         (WebCore::CryptoAlgorithmAES_CBC::encrypt):
45         (WebCore::CryptoAlgorithmAES_CBC::decrypt):
46         (WebCore::CryptoAlgorithmAES_CBC::importKey):
47         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
48         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
49         (WebCore::CryptoAlgorithmAES_CFB::encrypt):
50         (WebCore::CryptoAlgorithmAES_CFB::decrypt):
51         (WebCore::CryptoAlgorithmAES_CFB::importKey):
52         * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
53         * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp:
54         (WebCore::parametersAreValid):
55         (WebCore::CryptoAlgorithmAES_CTR::encrypt):
56         (WebCore::CryptoAlgorithmAES_CTR::decrypt):
57         (WebCore::CryptoAlgorithmAES_CTR::importKey):
58         * crypto/algorithms/CryptoAlgorithmAES_CTR.h:
59         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
60         (WebCore::CryptoAlgorithmAES_GCM::encrypt):
61         (WebCore::CryptoAlgorithmAES_GCM::decrypt):
62         (WebCore::CryptoAlgorithmAES_GCM::importKey):
63         * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
64         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
65         (WebCore::CryptoAlgorithmAES_KW::importKey):
66         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
67         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
68         (WebCore::CryptoAlgorithmECDH::deriveBits):
69         (WebCore::CryptoAlgorithmECDH::importKey):
70         * crypto/algorithms/CryptoAlgorithmECDH.h:
71         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
72         (WebCore::CryptoAlgorithmECDSA::sign):
73         (WebCore::CryptoAlgorithmECDSA::verify):
74         (WebCore::CryptoAlgorithmECDSA::importKey):
75         * crypto/algorithms/CryptoAlgorithmECDSA.h:
76         * crypto/algorithms/CryptoAlgorithmHKDF.cpp:
77         (WebCore::CryptoAlgorithmHKDF::deriveBits):
78         (WebCore::CryptoAlgorithmHKDF::importKey):
79         * crypto/algorithms/CryptoAlgorithmHKDF.h:
80         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
81         (WebCore::CryptoAlgorithmHMAC::sign):
82         (WebCore::CryptoAlgorithmHMAC::verify):
83         (WebCore::CryptoAlgorithmHMAC::importKey):
84         * crypto/algorithms/CryptoAlgorithmHMAC.h:
85         * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp:
86         (WebCore::CryptoAlgorithmPBKDF2::deriveBits):
87         (WebCore::CryptoAlgorithmPBKDF2::importKey):
88         * crypto/algorithms/CryptoAlgorithmPBKDF2.h:
89         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
90         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt):
91         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt):
92         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
93         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
94         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
95         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
96         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
97         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
98         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
99         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
100         (WebCore::CryptoAlgorithmRSA_OAEP::encrypt):
101         (WebCore::CryptoAlgorithmRSA_OAEP::decrypt):
102         (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
103         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
104         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
105         (WebCore::CryptoAlgorithmRSA_PSS::sign):
106         (WebCore::CryptoAlgorithmRSA_PSS::verify):
107         (WebCore::CryptoAlgorithmRSA_PSS::importKey):
108         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
109         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
110         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
111         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
112         * crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp:
113         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
114         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
115         * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp:
116         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
117         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
118         * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp:
119         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
120         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
121         * crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp:
122         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
123         * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp:
124         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
125         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
126         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
127         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
128         * crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp:
129         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
130         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
131         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
132         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
133         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
134         * crypto/mac/CryptoAlgorithmAES_CFBMac.cpp:
135         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
136         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
137         * crypto/mac/CryptoAlgorithmAES_CTRMac.cpp:
138         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
139         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
140         * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:
141         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
142         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
143         * crypto/mac/CryptoAlgorithmHKDFMac.cpp:
144         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
145         * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp:
146         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
147         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
148         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
149         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
150         * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp:
151         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
152         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
153         * crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h:
154         * crypto/parameters/CryptoAlgorithmAesCtrParams.h:
155         * crypto/parameters/CryptoAlgorithmAesGcmParams.h:
156         * crypto/parameters/CryptoAlgorithmEcKeyParams.h:
157         * crypto/parameters/CryptoAlgorithmEcdsaParams.h:
158         * crypto/parameters/CryptoAlgorithmHkdfParams.h:
159         * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
160         * crypto/parameters/CryptoAlgorithmPbkdf2Params.h:
161         * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h:
162         * crypto/parameters/CryptoAlgorithmRsaOaepParams.h:
163         * crypto/parameters/CryptoAlgorithmRsaPssParams.h:
164
165 2018-07-16  Ryosuke Niwa  <rniwa@webkit.org>
166
167         Release assert in ~TimerBase is getting hit in WK1 apps which uses JSC API directly
168         https://bugs.webkit.org/show_bug.cgi?id=187713
169         <rdar://problem/41759548>
170
171         Reviewed by Simon Fraser.
172
173         Turn this into a debug assertion in WebKit1 on iOS since JSC API doesn't grab the web thread lock,
174         which means that Timer can get destroyed without the web thread lock in the main thread.
175
176         * platform/Timer.cpp:
177         (WebCore::TimerBase::~TimerBase):
178         (WebCore::TimerBase::setNextFireTime):
179
180 2018-07-16  Simon Fraser  <simon.fraser@apple.com>
181
182         Add color filter for transforming colors in Dark Mode
183         https://bugs.webkit.org/show_bug.cgi?id=187717
184         rdar://problem/41146650
185
186         Reviewed by Dean Jackson.
187         
188         Add a new filter function for use in -apple-color-filter for transforming colors
189         when in Dark Mode. The filter is called apple-invert-lightness(), and takes no parameters.
190         It's based on a lightness invert in HSL space, with some adjustments to improve the contrast
191         of some colors on dark backgrounds, so does a much better job that using invert() with hue-rotate().
192
193         Test: css3/color-filters/color-filter-apple-invert-lightness.html
194
195         * css/CSSComputedStyleDeclaration.cpp:
196         (WebCore::ComputedStyleExtractor::valueForFilter):
197         * css/CSSValueKeywords.in:
198         * css/StyleResolver.cpp:
199         (WebCore::filterOperationForType):
200         (WebCore::StyleResolver::createFilterOperations):
201         * css/parser/CSSPropertyParser.cpp:
202         (WebCore::CSSPropertyParser::parseSingleValue):
203         * css/parser/CSSPropertyParserHelpers.cpp:
204         (WebCore::CSSPropertyParserHelpers::consumeFilterImage):
205         (WebCore::CSSPropertyParserHelpers::isPixelFilterFunction):
206         (WebCore::CSSPropertyParserHelpers::isColorFilterFunction):
207         (WebCore::CSSPropertyParserHelpers::consumeFilterFunction):
208         (WebCore::CSSPropertyParserHelpers::consumeFilter):
209         (WebCore::CSSPropertyParserHelpers::isValidPrimitiveFilterFunction): Deleted.
210         * css/parser/CSSPropertyParserHelpers.h:
211         * page/FrameView.cpp:
212         (WebCore::FrameView::paintContents):
213         * platform/graphics/Color.cpp:
214         * platform/graphics/ColorUtilities.cpp:
215         (WebCore::sRGBToLinearComponents):
216         (WebCore::linearToSRGBComponents):
217         (WebCore::sRGBToLinearColorComponentForLuminance):
218         (WebCore::luminance):
219         (WebCore::sRGBToHSL):
220         (WebCore::calcHue):
221         (WebCore::HSLToSRGB):
222         (WebCore::ColorMatrix::ColorMatrix):
223         * platform/graphics/ColorUtilities.h:
224         * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
225         (PlatformCAFilters::filterValueForOperation):
226         (PlatformCAFilters::colorMatrixValueForFilter):
227         * platform/graphics/filters/FEColorMatrix.cpp:
228         * platform/graphics/filters/FilterOperation.cpp:
229         (WebCore::InvertLightnessFilterOperation::operator== const):
230         (WebCore::InvertLightnessFilterOperation::blend):
231         (WebCore::InvertLightnessFilterOperation::transformColor const):
232         (WebCore::operator<<):
233         * platform/graphics/filters/FilterOperation.h:
234         * rendering/FilterEffectRenderer.cpp:
235         (WebCore::FilterEffectRenderer::build):
236
237 2018-07-16  Jiewen Tan  <jiewen_tan@apple.com>
238
239         Unreviewed, build fix for r233873.
240
241         * crypto/SubtleCrypto.cpp:
242         (WebCore::crossThreadCopyImportParams):
243
244 2018-07-15  Jiewen Tan  <jiewen_tan@apple.com>
245
246         [WebCrypto] Crypto operations should copy their parameters before hoping to another thread
247         https://bugs.webkit.org/show_bug.cgi?id=187501
248         <rdar://problem/41438160>
249
250         Reviewed by Youenn Fablet.
251
252         This patch aims at making all captured variables in all crypto lambdas that need to be passed
253         to a worker thread thread safe, which includes:
254         1) changing ref counted objects to thread safe ref counted object.
255         2) adding isolatedCopy methods to non ref counted classes, so they can be called by CrossThreadCopy().
256
257         In addition to above changes, this patch also does the following things:
258         1) change the name CryptoAlgorithm::dispatchOperation => CryptoAlgorithm::dispatchOperationInWorkQueue
259         to make it clear that lambdas will be passed to a secondary thread.
260         2) make CryptoAlgorithmParameters as const parameters for all methods.
261
262         Tests: crypto/subtle/aes-gcm-import-key-unwrap-ec-raw-key.html
263                http/wpt/crypto/aes-cbc-crash.any.html
264                http/wpt/crypto/aes-cbc-crash.any.worker.html
265                http/wpt/crypto/aes-ctr-crash.any.html
266                http/wpt/crypto/aes-ctr-crash.any.worker.html
267                http/wpt/crypto/aes-gcm-crash.any.html
268                http/wpt/crypto/aes-gcm-crash.any.worker.html
269                http/wpt/crypto/derive-hmac-key-crash.any.html
270                http/wpt/crypto/derive-hmac-key-crash.any.worker.html
271                http/wpt/crypto/ecdsa-crash.any.html
272                http/wpt/crypto/ecdsa-crash.any.worker.html
273                http/wpt/crypto/hkdf-crash.any.html
274                http/wpt/crypto/hkdf-crash.any.worker.html
275                http/wpt/crypto/pbkdf2-crash.any.html
276                http/wpt/crypto/pbkdf2-crash.any.worker.html
277                http/wpt/crypto/rsa-oaep-crash.any.html
278                http/wpt/crypto/rsa-oaep-crash.any.worker.html
279                http/wpt/crypto/rsa-pss-crash.any.html
280                http/wpt/crypto/rsa-pss-crash.any.worker.html
281                http/wpt/crypto/unwrap-ec-key-crash.any.html
282                http/wpt/crypto/unwrap-ec-key-crash.any.worker.html
283                http/wpt/crypto/unwrap-rsa-key-crash.any.html
284                http/wpt/crypto/unwrap-rsa-key-crash.any.worker.html
285
286         * crypto/CryptoAlgorithm.cpp:
287         (WebCore::CryptoAlgorithm::encrypt):
288         (WebCore::CryptoAlgorithm::decrypt):
289         (WebCore::CryptoAlgorithm::sign):
290         (WebCore::CryptoAlgorithm::verify):
291         (WebCore::CryptoAlgorithm::deriveBits):
292         (WebCore::CryptoAlgorithm::importKey):
293         (WebCore::dispatchAlgorithmOperation):
294         (WebCore::CryptoAlgorithm::dispatchOperationInWorkQueue):
295         (WebCore::CryptoAlgorithm::dispatchOperation): Deleted.
296         * crypto/CryptoAlgorithm.h:
297         * crypto/SubtleCrypto.cpp:
298         (WebCore::crossThreadCopyImportParams):
299         (WebCore::SubtleCrypto::encrypt):
300         (WebCore::SubtleCrypto::decrypt):
301         (WebCore::SubtleCrypto::sign):
302         (WebCore::SubtleCrypto::verify):
303         (WebCore::SubtleCrypto::deriveKey):
304         (WebCore::SubtleCrypto::deriveBits):
305         (WebCore::SubtleCrypto::importKey):
306         (WebCore::SubtleCrypto::wrapKey):
307         (WebCore::SubtleCrypto::unwrapKey):
308         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
309         (WebCore::CryptoAlgorithmAES_CBC::encrypt):
310         (WebCore::CryptoAlgorithmAES_CBC::decrypt):
311         (WebCore::CryptoAlgorithmAES_CBC::importKey):
312         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
313         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
314         (WebCore::CryptoAlgorithmAES_CFB::encrypt):
315         (WebCore::CryptoAlgorithmAES_CFB::decrypt):
316         (WebCore::CryptoAlgorithmAES_CFB::importKey):
317         * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
318         * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp:
319         (WebCore::parametersAreValid):
320         (WebCore::CryptoAlgorithmAES_CTR::encrypt):
321         (WebCore::CryptoAlgorithmAES_CTR::decrypt):
322         (WebCore::CryptoAlgorithmAES_CTR::importKey):
323         * crypto/algorithms/CryptoAlgorithmAES_CTR.h:
324         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
325         (WebCore::CryptoAlgorithmAES_GCM::encrypt):
326         (WebCore::CryptoAlgorithmAES_GCM::decrypt):
327         (WebCore::CryptoAlgorithmAES_GCM::importKey):
328         * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
329         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
330         (WebCore::CryptoAlgorithmAES_KW::importKey):
331         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
332         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
333         (WebCore::CryptoAlgorithmECDH::deriveBits):
334         (WebCore::CryptoAlgorithmECDH::importKey):
335         * crypto/algorithms/CryptoAlgorithmECDH.h:
336         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
337         (WebCore::CryptoAlgorithmECDSA::sign):
338         (WebCore::CryptoAlgorithmECDSA::verify):
339         (WebCore::CryptoAlgorithmECDSA::importKey):
340         * crypto/algorithms/CryptoAlgorithmECDSA.h:
341         * crypto/algorithms/CryptoAlgorithmHKDF.cpp:
342         (WebCore::CryptoAlgorithmHKDF::deriveBits):
343         (WebCore::CryptoAlgorithmHKDF::importKey):
344         * crypto/algorithms/CryptoAlgorithmHKDF.h:
345         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
346         (WebCore::CryptoAlgorithmHMAC::sign):
347         (WebCore::CryptoAlgorithmHMAC::verify):
348         (WebCore::CryptoAlgorithmHMAC::importKey):
349         * crypto/algorithms/CryptoAlgorithmHMAC.h:
350         * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp:
351         (WebCore::CryptoAlgorithmPBKDF2::deriveBits):
352         (WebCore::CryptoAlgorithmPBKDF2::importKey):
353         * crypto/algorithms/CryptoAlgorithmPBKDF2.h:
354         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
355         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt):
356         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt):
357         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
358         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
359         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
360         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
361         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
362         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
363         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
364         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
365         (WebCore::CryptoAlgorithmRSA_OAEP::encrypt):
366         (WebCore::CryptoAlgorithmRSA_OAEP::decrypt):
367         (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
368         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
369         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
370         (WebCore::CryptoAlgorithmRSA_PSS::sign):
371         (WebCore::CryptoAlgorithmRSA_PSS::verify):
372         (WebCore::CryptoAlgorithmRSA_PSS::importKey):
373         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
374         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
375         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
376         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
377         * crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp:
378         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
379         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
380         * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp:
381         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
382         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
383         * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp:
384         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
385         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
386         * crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp:
387         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
388         * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp:
389         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
390         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
391         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
392         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
393         * crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp:
394         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
395         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
396         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
397         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
398         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
399         * crypto/mac/CryptoAlgorithmAES_CFBMac.cpp:
400         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
401         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
402         * crypto/mac/CryptoAlgorithmAES_CTRMac.cpp:
403         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
404         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
405         * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:
406         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
407         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
408         * crypto/mac/CryptoAlgorithmHKDFMac.cpp:
409         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
410         * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp:
411         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
412         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
413         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
414         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
415         * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp:
416         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
417         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
418         * crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h:
419         * crypto/parameters/CryptoAlgorithmAesCtrParams.h:
420         * crypto/parameters/CryptoAlgorithmAesGcmParams.h:
421         * crypto/parameters/CryptoAlgorithmEcKeyParams.h:
422         * crypto/parameters/CryptoAlgorithmEcdsaParams.h:
423         * crypto/parameters/CryptoAlgorithmHkdfParams.h:
424         * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
425         * crypto/parameters/CryptoAlgorithmPbkdf2Params.h:
426         * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h:
427         * crypto/parameters/CryptoAlgorithmRsaOaepParams.h:
428         * crypto/parameters/CryptoAlgorithmRsaPssParams.h:
429
430 2018-07-16  Said Abou-Hallawa  <sabouhallawa@apple.com>
431
432         [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the flush immediate transaction
433         https://bugs.webkit.org/show_bug.cgi?id=187375
434
435         Reviewed by Simon Fraser.
436
437         An immediate-paint transaction should force all the images which are pending
438         decoding to be repainted.
439
440         To do that, FrameView::paintControlTints() will be re-factored to a new
441         generic function such that it takes PaintInvalidationReasons. The new function
442         which is named 'traverseForPaintInvalidation' will traverse the render tree
443         for a specific PaintInvalidationReasons.
444
445         invalidateImagesWithAsyncDecodes() will stop the asynchronous decoding for
446         the underlying image and repaint all the clients which are waiting for the
447         decoding to finish.
448
449         * loader/cache/CachedImage.cpp:
450         (WebCore::CachedImage::didRemoveClient):
451         (WebCore::CachedImage::isClientWaitingForAsyncDecoding const):
452         (WebCore::CachedImage::addClientWaitingForAsyncDecoding):
453         (WebCore::CachedImage::removeAllClientsWaitingForAsyncDecoding):
454         (WebCore::CachedImage::allClientsRemoved):
455         (WebCore::CachedImage::clear):
456         (WebCore::CachedImage::createImage):
457         (WebCore::CachedImage::imageFrameAvailable):
458         (WebCore::CachedImage::addPendingImageDrawingClient): Deleted.
459         * loader/cache/CachedImage.h:
460         * page/FrameView.cpp:
461         (WebCore::FrameView::paintScrollCorner):
462         (WebCore::FrameView::updateControlTints):
463         (WebCore::FrameView::traverseForPaintInvalidation):
464         (WebCore::FrameView::adjustPageHeightDeprecated):
465         (WebCore::FrameView::paintControlTints): Deleted.
466         * page/FrameView.h:
467         * platform/ScrollView.cpp:
468         (WebCore::ScrollView::paint):
469         * platform/Scrollbar.cpp:
470         (WebCore::Scrollbar::paint):
471         * platform/graphics/BitmapImage.h:
472         * platform/graphics/GraphicsContext.cpp:
473         (WebCore::GraphicsContext::GraphicsContext):
474         * platform/graphics/GraphicsContext.h:
475         (WebCore::GraphicsContext::performingPaintInvalidation const):
476         (WebCore::GraphicsContext::invalidatingControlTints const):
477         (WebCore::GraphicsContext::invalidatingImagesWithAsyncDecodes const):
478         (WebCore::GraphicsContext::updatingControlTints const): Deleted.
479         * rendering/RenderBoxModelObject.cpp:
480         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
481         * rendering/RenderImage.cpp:
482         (WebCore::RenderImage::paintReplaced):
483         (WebCore::RenderImage::paintAreaElementFocusRing):
484         (WebCore::RenderImage::paintIntoRect):
485         * rendering/RenderLayer.cpp:
486         (WebCore::RenderLayer::paintScrollCorner):
487         (WebCore::RenderLayer::paintResizer):
488         (WebCore::RenderLayer::paintLayer):
489         * rendering/RenderScrollbar.cpp:
490         (WebCore::RenderScrollbar::paint):
491         * rendering/RenderTheme.cpp:
492         (WebCore::RenderTheme::paint):
493         * testing/Internals.cpp:
494         (WebCore::Internals::invalidateControlTints):
495         (WebCore::Internals::paintControlTints): Deleted.
496         * testing/Internals.h:
497         * testing/Internals.idl:
498
499 2018-07-16  Ryan Haddad  <ryanhaddad@apple.com>
500
501         Unreviewed attempt to fix the build.
502
503         * rendering/RenderThemeMac.mm:
504
505 2018-07-11  Dean Jackson  <dino@apple.com>
506
507         Allow removal of white backgrounds
508         https://bugs.webkit.org/show_bug.cgi?id=187574
509         <rdar://problem/41146792>
510
511         Reviewed by Simon Fraser.
512
513         Add a drawing mode that turns white backgrounds into transparent
514         regions, such that a hosting app can see through to its window.
515
516         Test: css3/color-filters/punch-out-white-backgrounds.html
517
518         * page/Settings.yaml: New Setting.
519
520         * rendering/InlineFlowBox.cpp: Draw with a destination out blend mode
521         if the background is white and we are punching out backgrounds, which means
522         that it will erase the destination.
523         (WebCore::InlineFlowBox::paintBoxDecorations):
524         * rendering/RenderBox.cpp:
525         (WebCore::RenderBox::paintBackground): Ditto.
526         * rendering/RenderTableCell.cpp:
527         (WebCore::RenderTableCell::paintBackgroundsBehindCell): Ditto.
528
529         * rendering/RenderBoxModelObject.cpp:
530         (WebCore::RenderBoxModelObject::paintFillLayerExtended): Save and restore
531         the composition mode if necessary.
532
533 2018-07-16  David Fenton  <david_fenton@apple.com>
534
535         Unreviewed, rolling out r233867.
536
537         caused build failures on High Sierra, Sierra and iOS
538
539         Reverted changeset:
540
541         "[WebCrypto] Crypto operations should copy their parameters
542         before hoping to another thread"
543         https://bugs.webkit.org/show_bug.cgi?id=187501
544         https://trac.webkit.org/changeset/233867
545
546 2018-07-15  Jiewen Tan  <jiewen_tan@apple.com>
547
548         [WebCrypto] Crypto operations should copy their parameters before hoping to another thread
549         https://bugs.webkit.org/show_bug.cgi?id=187501
550         <rdar://problem/41438160>
551
552         Reviewed by Youenn Fablet.
553
554         This patch aims at making all captured variables in all crypto lambdas that need to be passed
555         to a worker thread thread safe, which includes:
556         1) changing ref counted objects to thread safe ref counted object.
557         2) adding isolatedCopy methods to non ref counted classes, so they can be called by CrossThreadCopy().
558
559         In addition to above changes, this patch also does the following things:
560         1) change the name CryptoAlgorithm::dispatchOperation => CryptoAlgorithm::dispatchOperationInWorkQueue
561         to make it clear that lambdas will be passed to a secondary thread.
562         2) make CryptoAlgorithmParameters as const parameters for all methods.
563
564         Tests: crypto/subtle/aes-gcm-import-key-unwrap-ec-raw-key.html
565                http/wpt/crypto/aes-cbc-crash.any.html
566                http/wpt/crypto/aes-cbc-crash.any.worker.html
567                http/wpt/crypto/aes-ctr-crash.any.html
568                http/wpt/crypto/aes-ctr-crash.any.worker.html
569                http/wpt/crypto/aes-gcm-crash.any.html
570                http/wpt/crypto/aes-gcm-crash.any.worker.html
571                http/wpt/crypto/derive-hmac-key-crash.any.html
572                http/wpt/crypto/derive-hmac-key-crash.any.worker.html
573                http/wpt/crypto/ecdsa-crash.any.html
574                http/wpt/crypto/ecdsa-crash.any.worker.html
575                http/wpt/crypto/hkdf-crash.any.html
576                http/wpt/crypto/hkdf-crash.any.worker.html
577                http/wpt/crypto/pbkdf2-crash.any.html
578                http/wpt/crypto/pbkdf2-crash.any.worker.html
579                http/wpt/crypto/rsa-oaep-crash.any.html
580                http/wpt/crypto/rsa-oaep-crash.any.worker.html
581                http/wpt/crypto/rsa-pss-crash.any.html
582                http/wpt/crypto/rsa-pss-crash.any.worker.html
583                http/wpt/crypto/unwrap-ec-key-crash.any.html
584                http/wpt/crypto/unwrap-ec-key-crash.any.worker.html
585                http/wpt/crypto/unwrap-rsa-key-crash.any.html
586                http/wpt/crypto/unwrap-rsa-key-crash.any.worker.html
587
588         * crypto/CryptoAlgorithm.cpp:
589         (WebCore::CryptoAlgorithm::encrypt):
590         (WebCore::CryptoAlgorithm::decrypt):
591         (WebCore::CryptoAlgorithm::sign):
592         (WebCore::CryptoAlgorithm::verify):
593         (WebCore::CryptoAlgorithm::deriveBits):
594         (WebCore::CryptoAlgorithm::importKey):
595         (WebCore::dispatchAlgorithmOperation):
596         (WebCore::CryptoAlgorithm::dispatchOperationInWorkQueue):
597         (WebCore::CryptoAlgorithm::dispatchOperation): Deleted.
598         * crypto/CryptoAlgorithm.h:
599         * crypto/SubtleCrypto.cpp:
600         (WebCore::crossThreadCopyImportParams):
601         (WebCore::SubtleCrypto::encrypt):
602         (WebCore::SubtleCrypto::decrypt):
603         (WebCore::SubtleCrypto::sign):
604         (WebCore::SubtleCrypto::verify):
605         (WebCore::SubtleCrypto::deriveKey):
606         (WebCore::SubtleCrypto::deriveBits):
607         (WebCore::SubtleCrypto::importKey):
608         (WebCore::SubtleCrypto::wrapKey):
609         (WebCore::SubtleCrypto::unwrapKey):
610         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
611         (WebCore::CryptoAlgorithmAES_CBC::encrypt):
612         (WebCore::CryptoAlgorithmAES_CBC::decrypt):
613         (WebCore::CryptoAlgorithmAES_CBC::importKey):
614         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
615         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
616         (WebCore::CryptoAlgorithmAES_CFB::encrypt):
617         (WebCore::CryptoAlgorithmAES_CFB::decrypt):
618         (WebCore::CryptoAlgorithmAES_CFB::importKey):
619         * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
620         * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp:
621         (WebCore::parametersAreValid):
622         (WebCore::CryptoAlgorithmAES_CTR::encrypt):
623         (WebCore::CryptoAlgorithmAES_CTR::decrypt):
624         (WebCore::CryptoAlgorithmAES_CTR::importKey):
625         * crypto/algorithms/CryptoAlgorithmAES_CTR.h:
626         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
627         (WebCore::CryptoAlgorithmAES_GCM::encrypt):
628         (WebCore::CryptoAlgorithmAES_GCM::decrypt):
629         (WebCore::CryptoAlgorithmAES_GCM::importKey):
630         * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
631         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
632         (WebCore::CryptoAlgorithmAES_KW::importKey):
633         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
634         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
635         (WebCore::CryptoAlgorithmECDH::deriveBits):
636         (WebCore::CryptoAlgorithmECDH::importKey):
637         * crypto/algorithms/CryptoAlgorithmECDH.h:
638         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
639         (WebCore::CryptoAlgorithmECDSA::sign):
640         (WebCore::CryptoAlgorithmECDSA::verify):
641         (WebCore::CryptoAlgorithmECDSA::importKey):
642         * crypto/algorithms/CryptoAlgorithmECDSA.h:
643         * crypto/algorithms/CryptoAlgorithmHKDF.cpp:
644         (WebCore::CryptoAlgorithmHKDF::deriveBits):
645         (WebCore::CryptoAlgorithmHKDF::importKey):
646         * crypto/algorithms/CryptoAlgorithmHKDF.h:
647         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
648         (WebCore::CryptoAlgorithmHMAC::sign):
649         (WebCore::CryptoAlgorithmHMAC::verify):
650         (WebCore::CryptoAlgorithmHMAC::importKey):
651         * crypto/algorithms/CryptoAlgorithmHMAC.h:
652         * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp:
653         (WebCore::CryptoAlgorithmPBKDF2::deriveBits):
654         (WebCore::CryptoAlgorithmPBKDF2::importKey):
655         * crypto/algorithms/CryptoAlgorithmPBKDF2.h:
656         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
657         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt):
658         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt):
659         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
660         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
661         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
662         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
663         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
664         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
665         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
666         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
667         (WebCore::CryptoAlgorithmRSA_OAEP::encrypt):
668         (WebCore::CryptoAlgorithmRSA_OAEP::decrypt):
669         (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
670         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
671         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
672         (WebCore::CryptoAlgorithmRSA_PSS::sign):
673         (WebCore::CryptoAlgorithmRSA_PSS::verify):
674         (WebCore::CryptoAlgorithmRSA_PSS::importKey):
675         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
676         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
677         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
678         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
679         * crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp:
680         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
681         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
682         * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp:
683         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
684         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
685         * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp:
686         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
687         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
688         * crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp:
689         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
690         * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp:
691         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
692         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
693         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
694         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
695         * crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp:
696         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
697         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
698         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
699         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
700         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
701         * crypto/mac/CryptoAlgorithmAES_CFBMac.cpp:
702         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
703         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
704         * crypto/mac/CryptoAlgorithmAES_CTRMac.cpp:
705         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
706         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
707         * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:
708         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
709         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
710         * crypto/mac/CryptoAlgorithmHKDFMac.cpp:
711         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
712         * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp:
713         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
714         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
715         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
716         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
717         * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp:
718         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
719         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
720         * crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h:
721         * crypto/parameters/CryptoAlgorithmAesCtrParams.h:
722         * crypto/parameters/CryptoAlgorithmAesGcmParams.h:
723         * crypto/parameters/CryptoAlgorithmEcKeyParams.h:
724         * crypto/parameters/CryptoAlgorithmEcdsaParams.h:
725         * crypto/parameters/CryptoAlgorithmHkdfParams.h:
726         * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
727         * crypto/parameters/CryptoAlgorithmPbkdf2Params.h:
728         * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h:
729         * crypto/parameters/CryptoAlgorithmRsaOaepParams.h:
730         * crypto/parameters/CryptoAlgorithmRsaPssParams.h:
731
732 2018-07-16  Aditya Keerthi  <akeerthi@apple.com>
733
734         [Datalist][macOS] Add suggestions UI for TextFieldInputTypes
735         https://bugs.webkit.org/show_bug.cgi?id=186531
736
737         Reviewed by Tim Horton.
738
739         Tests: fast/forms/datalist/datalist-show-hide.html
740                fast/forms/datalist/datalist-textinput-keydown.html
741
742         * html/TextFieldInputType.cpp:
743         (WebCore::TextFieldInputType::handleKeydownEvent):
744         (WebCore::TextFieldInputType::handleKeydownEventForSpinButton): The suggestions view takes precedence when handling arrow key events.
745
746 2018-07-16  Jeremy Jones  <jeremyj@apple.com>
747
748         Fullscreen requires active document.
749         https://bugs.webkit.org/show_bug.cgi?id=186226
750         rdar://problem/36187413
751
752         Reviewed by Jer Noble.
753
754         Test: media/no-fullscreen-when-hidden.html
755
756         This change guarantees the document to be visible for both element fullscreen and video fullscreen.
757
758         User gesture is not enough to guarantee that the document is visible when fullscreen is initiated
759         because JavaScript can spin wait before initiating fullscreen. During that spin the page or window might
760         be hidden.
761
762         Document::hidden() can't be relied upon because it won't update while JavaScript spins.
763
764         This change adds a sync call to the UI process to get the current UI visibility state.
765
766         * dom/Document.cpp:
767         (WebCore::Document::requestFullScreenForElement):
768         * html/HTMLMediaElement.cpp:
769         (WebCore::HTMLMediaElement::enterFullscreen):
770         * page/ChromeClient.h:
771
772 2018-07-16  Alex Christensen  <achristensen@webkit.org>
773
774         Reduce size of NetworkLoadMetrics and therefore ResourceResponse
775         https://bugs.webkit.org/show_bug.cgi?id=187671
776
777         Reviewed by Darin Adler.
778
779         * inspector/agents/InspectorNetworkAgent.cpp:
780         (WebCore::toProtocol):
781         (WebCore::InspectorNetworkAgent::buildObjectForMetrics):
782         * platform/network/NetworkLoadMetrics.h:
783         (WebCore::NetworkLoadMetrics::isolatedCopy const):
784         (WebCore::NetworkLoadMetrics::reset):
785         (WebCore::NetworkLoadMetrics::clearNonTimingData):
786
787 2018-07-16  Chris Dumez  <cdumez@apple.com>
788
789         Make sure LibWebRTCMediaEndpoint is always destroyed on the main thread
790         https://bugs.webkit.org/show_bug.cgi?id=187702
791
792         Reviewed by Youenn Fablet.
793
794         Make sure LibWebRTCMediaEndpoint is always constructed and destructed on the main thread since
795         it has a Timer data member and it would not be safe otherwise. LibWebRTCMediaEndpoint is
796         ThreadSafeRefCounted and frequently passed to other threads.
797
798         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
799         (WebCore::LibWebRTCMediaEndpoint::LibWebRTCMediaEndpoint):
800         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
801
802 2018-07-16  Sihui Liu  <sihui_liu@apple.com>
803
804         IndexedDB: closeAndDeleteDatabasesForOrigins should remove all databases for those origins
805         https://bugs.webkit.org/show_bug.cgi?id=187631
806         <rdar://problem/42164227>
807
808         Reviewed by Brady Eidson.
809
810         When asked to delete database for an origin, we deleted the databases whose mainFrameOrigin 
811         is that origin. Given that the origin may create IndexedDB from subframes, we should delete 
812         databases whose openingOrigin is that origin too.
813
814         Covered by modified API test: WebKit.WebsiteDataStoreCustomPaths. 
815
816         * Modules/indexeddb/server/IDBServer.cpp:
817         (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesForOrigins):
818
819 2018-07-16  Simon Fraser  <simon.fraser@apple.com>
820
821         Shrink some font-related classes and enums
822         https://bugs.webkit.org/show_bug.cgi?id=187686
823
824         Reviewed by Myles Maxfield.
825         
826         Use enum class for enums in TextFlags.h and make them one byte big.
827
828         Re-order members of Font to shrink it from 360 to 328 bytes.
829
830         * css/CSSPrimitiveValueMappings.h:
831         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
832         (WebCore::CSSPrimitiveValue::operator FontSmoothingMode const):
833         (WebCore::CSSPrimitiveValue::operator FontSmallCaps const):
834         (WebCore::CSSPrimitiveValue::operator TextRenderingMode const):
835         * platform/graphics/Font.cpp:
836         (WebCore::Font::Font):
837         (WebCore::Font::verticalRightOrientationFont const):
838         * platform/graphics/Font.h:
839         * platform/graphics/FontCascade.cpp:
840         (WebCore::offsetToMiddleOfGlyph):
841         * platform/graphics/FontCascade.h:
842         (WebCore::FontCascade::advancedTextRenderingMode const):
843         * platform/graphics/FontCascadeFonts.cpp:
844         (WebCore::FontCascadeFonts::glyphDataForSystemFallback):
845         (WebCore::FontCascadeFonts::glyphDataForVariant):
846         (WebCore::glyphPageFromFontRanges):
847         * platform/graphics/FontDescription.cpp:
848         (WebCore::FontCascadeDescription::FontCascadeDescription):
849         * platform/graphics/FontDescription.h:
850         (WebCore::FontDescription::setTextRenderingMode):
851         (WebCore::FontDescription::setOrientation):
852         (WebCore::FontDescription::setWidthVariant):
853         (WebCore::FontCascadeDescription::setFontSmoothing):
854         (WebCore::FontCascadeDescription::initialSmallCaps):
855         (WebCore::FontCascadeDescription::initialFontSmoothing):
856         (WebCore::FontCascadeDescription::initialTextRenderingMode):
857         * platform/graphics/FontPlatformData.h:
858         (WebCore::FontPlatformData::isForTextCombine const):
859         * platform/graphics/cocoa/FontCacheCoreText.cpp:
860         (WebCore::preparePlatformFont):
861         * platform/graphics/cocoa/FontCascadeCocoa.mm:
862         (WebCore::showLetterpressedGlyphsWithAdvances):
863         (WebCore::showGlyphsWithAdvances):
864         (WebCore::FontCascade::drawGlyphs):
865         (WebCore::FontCascade::fontForCombiningCharacterSequence const):
866         * platform/graphics/cocoa/FontCocoa.mm:
867         (WebCore::Font::platformInit):
868         (WebCore::Font::platformBoundsForGlyph const):
869         (WebCore::Font::platformWidthForGlyph const):
870         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
871         (WebCore::FontPlatformData::hash const):
872         (WebCore::mapFontWidthVariantToCTFeatureSelector):
873         (WebCore::FontPlatformData::ctFont const):
874         (WebCore::FontPlatformData::description const):
875         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
876         (WebCore::FontPlatformData::buildScaledFont):
877         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
878         (WebCore::Font::platformInit):
879         (WebCore::Font::platformWidthForGlyph const):
880         * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
881         (WebCore::fontFeatures):
882         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
883         * platform/graphics/mac/SimpleFontDataCoreText.cpp:
884         (WebCore::Font::getCFStringAttributes const):
885         * platform/graphics/win/FontCGWin.cpp:
886         (WebCore::FontCascade::drawGlyphs):
887         * platform/graphics/win/FontCascadeDirect2D.cpp:
888         (WebCore::FontCascade::drawGlyphs):
889         * platform/graphics/win/GlyphPageTreeNodeDirect2D.cpp:
890         (WebCore::GlyphPage::fill):
891         * platform/graphics/win/SimpleFontDataDirect2D.cpp:
892         (WebCore::Font::platformInit):
893         (WebCore::Font::platformBoundsForGlyph const):
894         (WebCore::Font::platformWidthForGlyph const):
895         * platform/text/TextFlags.h:
896         * rendering/RenderCombineText.cpp:
897         (WebCore::RenderCombineText::combineTextIfNeeded):
898         * rendering/RenderLayer.cpp:
899         (WebCore::RenderLayer::calculateClipRects const):
900         * rendering/TextPainter.cpp:
901         (WebCore::TextPainter::paintTextWithShadows):
902         * rendering/TextPainter.h:
903         * rendering/style/RenderStyle.cpp:
904         (WebCore::RenderStyle::fontAndGlyphOrientation):
905         * rendering/svg/RenderSVGInlineText.cpp:
906         (WebCore::RenderSVGInlineText::computeNewScaledFontForStyle):
907
908 2018-07-16  Sergio Villar Senin  <svillar@igalia.com>
909
910         [WebVR] Add support for connect/disconnect and mount/unmount device events
911         https://bugs.webkit.org/show_bug.cgi?id=187343
912
913         Reviewed by Žan Doberšek.
914
915         WebVR specs define a series of events as part of the Window Interface Extension. We're
916         adding support for the connect/disconnect and mount/unmount events both at the module level
917         and the platform level using OpenVR.
918
919         In order to do that we need to keep lists of VRPlatformDisplays at platform level and
920         VRDisplays at bindings level. We then update those lists accordingly to detect potential
921         additions/removals, and emit the corresponding signals. A new client interface
922         VRPlatformDisplayClient was also defined so that VRPlatformDisplay implementations could
923         notify their clients (typically a VRDisplay).
924
925         Last but not least, NavigatorWebVR was updated so it supplements Navigator instead of
926         supplementing Page.
927
928         * Modules/webvr/NavigatorWebVR.cpp: Supplement Navigator not Page.
929         (WebCore::NavigatorWebVR::getVRDisplays): Keep a list of VRDisplays and update them
930         conveniently, also emitting the required events under certain conditions (like device
931         disconnection).
932         (WebCore::NavigatorWebVR::supplementName): New method.
933         (WebCore::NavigatorWebVR::from): Ditto.
934         * Modules/webvr/NavigatorWebVR.h: Supplement Navigator not Page.
935         * Modules/webvr/VRDisplay.cpp:
936         (WebCore::VRDisplay::create): Moved suspendIfNeeded() to constructor.
937         (WebCore::VRDisplay::VRDisplay): Set itself as VRPlatformDisplay client.
938         (WebCore::VRDisplay::~VRDisplay): Unset as  VRPlatformDisplay client.
939         (WebCore::VRDisplay::VRPlatformDisplayConnected): Dispatch event on DOM window.
940         (WebCore::VRDisplay::VRPlatformDisplayDisconnected): Ditto.
941         (WebCore::VRDisplay::VRPlatformDisplayMounted): Ditto.
942         (WebCore::VRDisplay::VRPlatformDisplayUnmounted): Ditto.
943         * Modules/webvr/VRDisplay.h: Extend from VRPlatformDisplayClient.
944         (WebCore::VRDisplay::document):
945         * Modules/webvr/VRDisplayEvent.cpp: Updated Copyright.
946         * Modules/webvr/VRDisplayEvent.h: Ditto.
947         * Sources.txt: Added the two new files.
948         * WebCore.xcodeproj/project.pbxproj: Ditto.
949         * platform/vr/VRManager.cpp:
950         (WebCore::VRManager::getVRDisplays): Keep a list of VRPlatformDisplays and update them conveniently,
951         also emitting the required events under certain conditions (like device disconnection).
952         * platform/vr/VRManager.h:
953         * platform/vr/VRPlatformDisplay.cpp: New file with common implementations for VRPlatformDisplays.
954         (WebCore::VRPlatformDisplay::setClient):
955         (WebCore::VRPlatformDisplay::notifyVRPlatformDisplayEvent):
956         * platform/vr/VRPlatformDisplay.h: Added a generic method to notify about different
957         events. Added the client pointer.
958         * platform/vr/VRPlatformDisplayClient.h: New file. VRPlatformDisplay implementations will
959         call the client methods in the event of some circumstances happening.
960         (WebCore::VRPlatformDisplayClient::VRPlatformDisplayConnected):
961         (WebCore::VRPlatformDisplayClient::VRPlatformDisplayDisconnected):
962         (WebCore::VRPlatformDisplayClient::VRPlatformDisplayMounted):
963         (WebCore::VRPlatformDisplayClient::VRPlatformDisplayUnmounted):
964         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
965         (WebCore::VRPlatformDisplayOpenVR::updateDisplayInfo): Poll the device for new events to
966         detect connection/disconnections or device activations/deactivations (HMD
967         mounted/unmounted).
968         * platform/vr/openvr/VRPlatformDisplayOpenVR.h:
969
970 2018-07-16  Zan Dobersek  <zdobersek@igalia.com>
971
972         [Nicosia] Add Nicosia::PlatformLayer, Nicosia::CompositionLayer classes
973         https://bugs.webkit.org/show_bug.cgi?id=187693
974
975         Reviewed by Carlos Garcia Campos.
976
977         Add the Nicosia::PlatformLayer class. This will be the base platform
978         layer class from which different derivatives will be created, addressing
979         different use cases. The generic PlatformLayer type alias will point to
980         this class in the future.
981
982         First class deriving from Nicosia::PlatformLayer is
983         Nicosia::CompositionLayer, purpose of which will be to mirror the state
984         that's stored in the platform-specific GraphicsLayer derivative. It will
985         also allow making thread-safe updates to that state.
986
987         CoordinatedGraphicsLayer implementation now spawns a CompositionLayer
988         object and tracks state changes in a separate
989         CompositionLayer::LayerState::Delta object. During flushing, the changed
990         state is applied to the layer's pending state before the delta is nulled
991         out. The updated state isn't used anywhere yet, but future changes will
992         implement committing this state into the rendering pipeline.
993
994         There's bits of state not yet being managed by CompositionLayer, e.g.
995         debug visuals, filters and animations. These will be addressed later.
996
997         The m_solidColor member variable is added to CoordinatedGraphicsLayer in
998         order to properly store the solid color value. Normally this would be
999         contained by the parent GraphicsLayer class, but no such member variable
1000         exists there.
1001
1002         * platform/TextureMapper.cmake:
1003         * platform/graphics/nicosia/NicosiaPlatformLayer.cpp: Added.
1004         (Nicosia::PlatformLayer::PlatformLayer):
1005         (Nicosia::CompositionLayer::CompositionLayer):
1006         * platform/graphics/nicosia/NicosiaPlatformLayer.h: Added.
1007         (Nicosia::PlatformLayer::isCompositionLayer const):
1008         (Nicosia::PlatformLayer::id const):
1009         (Nicosia::CompositionLayer::create):
1010         (Nicosia::CompositionLayer::LayerState::Flags::Flags):
1011         (Nicosia::CompositionLayer::updateState):
1012         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1013         (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
1014         (WebCore::CoordinatedGraphicsLayer::setPosition):
1015         (WebCore::CoordinatedGraphicsLayer::setAnchorPoint):
1016         (WebCore::CoordinatedGraphicsLayer::setSize):
1017         (WebCore::CoordinatedGraphicsLayer::setTransform):
1018         (WebCore::CoordinatedGraphicsLayer::setChildrenTransform):
1019         (WebCore::CoordinatedGraphicsLayer::setPreserves3D):
1020         (WebCore::CoordinatedGraphicsLayer::setMasksToBounds):
1021         (WebCore::CoordinatedGraphicsLayer::setDrawsContent):
1022         (WebCore::CoordinatedGraphicsLayer::setContentsVisible):
1023         (WebCore::CoordinatedGraphicsLayer::setContentsOpaque):
1024         (WebCore::CoordinatedGraphicsLayer::setBackfaceVisibility):
1025         (WebCore::CoordinatedGraphicsLayer::setOpacity):
1026         (WebCore::CoordinatedGraphicsLayer::setContentsRect):
1027         (WebCore::CoordinatedGraphicsLayer::setContentsTileSize):
1028         (WebCore::CoordinatedGraphicsLayer::setContentsTilePhase):
1029         (WebCore::CoordinatedGraphicsLayer::setContentsToSolidColor):
1030         (WebCore::CoordinatedGraphicsLayer::setMaskLayer):
1031         (WebCore::CoordinatedGraphicsLayer::setReplicatedByLayer):
1032         (WebCore::CoordinatedGraphicsLayer::syncChildren):
1033         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
1034         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
1035
1036 2018-07-15  Wenson Hsieh  <wenson_hsieh@apple.com>
1037
1038         [iOS apps on macOS] Playing embedded Twitter videos in the News app crashes the web process
1039         https://bugs.webkit.org/show_bug.cgi?id=187690
1040         <rdar://problem/41869703>
1041
1042         Reviewed by Tim Horton.
1043
1044         Work around unexpected behavior when soft-linking AVFoundation. After using `dlopen_preflight` to check for the
1045         existence of a library prior to loading the library using `dlopen`, `dlsym` subsequently returns null for some
1046         symbols that would otherwise be available. This causes us to RELEASE_ASSERT later down the road when we try to
1047         load AVAudioSessionModeDefault in AudioSessionIOS.mm.
1048
1049         To fix this for now, simply check for the library directly instead of using the more lightweight preflight
1050         check. See clone: <rdar://problem/42224780> for more detail.
1051
1052         * platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm:
1053         (WebCore::AVFoundationMIMETypeCache::isAvailable const):
1054
1055 2018-07-14  Simon Fraser  <simon.fraser@apple.com>
1056
1057         Shrink StyleFillData, StyleStrokeData and StyleMiscData
1058         https://bugs.webkit.org/show_bug.cgi?id=187681
1059
1060         Reviewed by Anders Carlsson.
1061
1062         Shrink these data structures by making more enum classes one byte in size, and
1063         re-ordering. StyleFillData goes from 56 to 48, StyleStrokeData from 80 to 72,
1064         StyleMiscData from 40 to 32 bytes.
1065
1066         * rendering/style/SVGRenderStyleDefs.cpp:
1067         (WebCore::StyleFillData::StyleFillData):
1068         (WebCore::StyleFillData::operator== const):
1069         (WebCore::StyleStrokeData::StyleStrokeData):
1070         (WebCore::StyleStrokeData::operator== const):
1071         (WebCore::StyleStopData::operator== const):
1072         (WebCore::StyleMiscData::StyleMiscData):
1073         * rendering/style/SVGRenderStyleDefs.h:
1074
1075 2018-07-14  Simon Fraser  <simon.fraser@apple.com>
1076
1077         Shrink CachedResource and subclasses
1078         https://bugs.webkit.org/show_bug.cgi?id=187546
1079
1080         Reviewed by Daniel Bates.
1081
1082         Shrink CachedResource down from 1384 to 1336 bytes, CachedImage from 1480 to
1083         1424 bytes, and CachedFont a little.
1084         
1085         This saves about 23KB on cnn.com.
1086
1087         * loader/ResourceLoaderOptions.h:
1088         * loader/cache/CachedFont.h:
1089         * loader/cache/CachedImage.h:
1090         * loader/cache/CachedResource.cpp:
1091         (WebCore::CachedResource::CachedResource):
1092         * loader/cache/CachedResource.h:
1093         * platform/network/CacheValidation.h:
1094         (WebCore::RedirectChainCacheStatus::RedirectChainCacheStatus):
1095         * platform/network/NetworkLoadMetrics.h:
1096         * platform/network/ParsedContentRange.h:
1097         * platform/network/ResourceRequestBase.h:
1098         * platform/network/ResourceResponseBase.h:
1099
1100 2018-07-14  Simon Fraser  <simon.fraser@apple.com>
1101
1102         Shrink some style-related classes and enums
1103         https://bugs.webkit.org/show_bug.cgi?id=187680
1104
1105         Reviewed by Antti Koivisto.
1106         
1107         Make all the enum classes in RenderStyleConstants be one byte big (all have less
1108         than 256 values).
1109         
1110         Shrink DocumentRuleSet from 384 to 368 bytes by re-ordering, which also helps shrink
1111         StyleResolver from 1024 to 952 bytes.
1112         
1113         Shrink BorderValue by re-ordering (now that the layout of Color has changed) which
1114         shrinks BorderData from 168 to 136 bytes.
1115         
1116         Convert a couple of other enums to enum class so that they can have explicit size.
1117
1118         * css/DocumentRuleSets.h:
1119         * css/MediaQueryMatcher.cpp:
1120         (WebCore::MediaQueryMatcher::documentElementUserAgentStyle const):
1121         * css/StyleMedia.cpp:
1122         (WebCore::StyleMedia::matchMedium const):
1123         * css/StyleResolver.cpp:
1124         (WebCore::StyleResolver::StyleResolver):
1125         (WebCore::StyleResolver::State::State):
1126         (WebCore::StyleResolver::styleForElement):
1127         (WebCore::StyleResolver::cascadedPropertiesForRollback):
1128         (WebCore::StyleResolver::applyProperty):
1129         (WebCore::cascadeLevelForIndex):
1130         * css/StyleResolver.h:
1131         * rendering/style/BorderValue.h:
1132         * rendering/style/RenderStyle.cpp:
1133         * rendering/style/RenderStyleConstants.h:
1134         * style/StyleTreeResolver.cpp:
1135         (WebCore::Style::TreeResolver::styleForElement):
1136         * svg/SVGElementRareData.h:
1137         (WebCore::SVGElementRareData::overrideComputedStyle):
1138
1139 2018-07-14  Kocsen Chung  <kocsen_chung@apple.com>
1140
1141         Ensure WebKit stack is ad-hoc signed
1142         https://bugs.webkit.org/show_bug.cgi?id=187667
1143
1144         Reviewed by Alexey Proskuryakov.
1145
1146         * Configurations/Base.xcconfig:
1147
1148 2018-07-14  Dirk Schulze  <krit@webkit.org>
1149
1150         [css-masking] Fully support -webkit-clip-path on SVG elements
1151         https://bugs.webkit.org/show_bug.cgi?id=185829
1152
1153         Reviewed by Simon Fraser.
1154
1155         -webkit-clip-path contributes to SVG elements with boxes, shapes and now with
1156         element references to <clipPath> elements as well. Make sure that all types
1157         contribute to hit-testing of the SVG element as well as they should.
1158
1159         Tests: svg/clip-path/webkit-clip-path-after-expected.svg
1160                svg/clip-path/webkit-clip-path-after.svg
1161                svg/clip-path/webkit-clip-path-before-expected.svg
1162                svg/clip-path/webkit-clip-path-before.svg
1163                svg/dynamic-updates/SVGClipPath-prefixed-influences-hitTesting.html
1164                svg/dynamic-updates/SVGClipPath-prefixed-path-influences-hitTesting.html
1165                svg/dynamic-updates/SVGClipPathElement-prefixed-css-transform-influences-hitTesting.html
1166                svg/dynamic-updates/SVGClipPathElement-prefixed-transform-influences-hitTesting.html
1167
1168         * rendering/svg/SVGRenderSupport.cpp: Share code as much as possible.
1169         (WebCore::clipPathReferenceBox):
1170         (WebCore::isPointInCSSClippingArea): Take -webkit-clip-path into account.
1171         (WebCore::SVGRenderSupport::clipContextToCSSClippingArea):
1172         (WebCore::SVGRenderSupport::pointInClippingArea):
1173         * rendering/svg/SVGRenderSupport.h:
1174         * rendering/svg/SVGRenderingContext.cpp: Clip to -webkit-clip-path boxes, shapes and references.
1175         (WebCore::SVGRenderingContext::prepareToRenderSVGContent):
1176         * rendering/svg/SVGResources.cpp: Add -webkit-clip-path references to cached resources. Mimic SVG clip-path.
1177         (WebCore::SVGResources::buildCachedResources):
1178
1179 2018-07-13  Simon Fraser  <simon.fraser@apple.com>
1180
1181         Avoid fetching visitedDependentColor() so many times in editing code
1182         https://bugs.webkit.org/show_bug.cgi?id=187676
1183
1184         Reviewed by Zalan Bujtas.
1185         
1186         editingAttributedStringFromRange called style.visitedDependentColor() twice for each property,
1187         and fontAttributesForSelectionStart() called it two or three times. Use a local Color variable
1188         to avoid so many calls. Also replace a call to alpha() with isVisible() which makes the usage more clear.
1189
1190         No behavior change.
1191
1192         * editing/cocoa/EditorCocoa.mm:
1193         (WebCore::Editor::fontAttributesForSelectionStart const):
1194         * editing/cocoa/HTMLConverter.mm:
1195         (WebCore::editingAttributedStringFromRange):
1196
1197 2018-07-13  Youenn Fablet  <youenn@apple.com>
1198
1199         Support connecting a MediaStreamAudioDestinationNode to RTCPeerConnection
1200         https://bugs.webkit.org/show_bug.cgi?id=187627
1201         <rdar://problem/35334400>
1202
1203         Reviewed by Jer Noble.
1204
1205         When MediaStreamAudioSource is called to read new audio samples,
1206         convert these samples to a WebAudioBufferList and call RealtimeMediaSource::audioSamplesAvailable.
1207         This makes its observers to get the audio data.
1208
1209         Test: webrtc/peer-connection-createMediaStreamDestination.html
1210
1211         * Modules/mediastream/MediaStream.cpp:
1212         (WebCore::MediaStream::create): Minor refactoring.
1213         * Modules/webaudio/MediaStreamAudioDestinationNode.cpp:
1214         (WebCore::createMediaStream):
1215         (WebCore::MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode):
1216         (WebCore::MediaStreamAudioDestinationNode::process):
1217         * Modules/webaudio/MediaStreamAudioDestinationNode.h:
1218         * Modules/webaudio/MediaStreamAudioSource.cpp:
1219         (WebCore::MediaStreamAudioSource::MediaStreamAudioSource):
1220         (WebCore::MediaStreamAudioSource::consumeAudio):
1221         * Modules/webaudio/MediaStreamAudioSource.h:
1222         * Modules/webaudio/MediaStreamAudioSourceCocoa.cpp: Added.
1223         (WebCore::streamDescription):
1224         (WebCore::MediaStreamAudioSource::consumeAudio):
1225         * WebCore.xcodeproj/project.pbxproj:
1226         * platform/audio/AudioDestinationConsumer.h: Removed.
1227         * platform/mediastream/MediaStreamPrivate.cpp:
1228         (WebCore::MediaStreamPrivate::create):
1229         * platform/mediastream/MediaStreamPrivate.h:
1230
1231 2018-07-13  Christopher Reid  <chris.reid@sony.com>
1232
1233         [WinCairo] Enable WebGL when Accelerated Compositing is disabled
1234         https://bugs.webkit.org/show_bug.cgi?id=187664
1235
1236         Reviewed by Fujii Hironori.
1237
1238         AC was disabled for WinCairo in r233725 but it can still run WebGL without AC.
1239
1240         * html/HTMLCanvasElement.cpp:
1241
1242 2018-07-13  Chris Dumez  <cdumez@apple.com>
1243
1244         Crash under ApplicationCacheGroup::didFailLoadingEntry()
1245         https://bugs.webkit.org/show_bug.cgi?id=187661
1246         <rdar://problem/42179755>
1247
1248         Reviewed by Youenn Fablet.
1249
1250         If ApplicationCacheResourceLoader::create() fails synchronously with
1251         ApplicationCacheResourceLoader::Error::CannotCreateResource error, then
1252         m_entryLoader will be null when didFailLoadingEntry() is called. However,
1253         didFailLoadingEntry() fails to null check m_entryLoader before using it.
1254
1255         * loader/appcache/ApplicationCacheGroup.cpp:
1256         (WebCore::ApplicationCacheGroup::didFailLoadingEntry):
1257         (WebCore::ApplicationCacheGroup::startLoadingEntry):
1258         * loader/appcache/ApplicationCacheGroup.h:
1259
1260 2018-07-13  Alex Christensen  <achristensen@webkit.org>
1261
1262         Add release assertion to check thread in TimerBase::setNextFireTime
1263         https://bugs.webkit.org/show_bug.cgi?id=187666
1264
1265         Reviewed by Ryosuke Niwa.
1266
1267         This should give us insight into what is causing <rdar://problem/33352721>
1268         
1269         * platform/Timer.cpp:
1270         (WebCore::TimerBase::setNextFireTime):
1271
1272 2018-07-13  Ryosuke Niwa  <rniwa@webkit.org>
1273
1274         [iOS] [WK1] Crash inside IOSurfacePool::platformGarbageCollectNow() in WebThread
1275         https://bugs.webkit.org/show_bug.cgi?id=187635
1276         <rdar://problem/34297065>
1277
1278         Reviewed by Simon Fraser.
1279
1280         r167717 added code to trigger a CA commit in the web process via platformGarbageCollectNow() in order to free IOSurface-related memory.
1281         However, that code is also running in the web thread in apps using WebKit1, causing unwanted UIView layout on the web thread.
1282
1283         Fix by not triggering this CA commit if it's called on the web thread.
1284
1285         * platform/graphics/cocoa/IOSurfacePoolCocoa.mm:
1286         (WebCore::IOSurfacePool::platformGarbageCollectNow):
1287
1288 2018-07-13  Antoine Quint  <graouts@apple.com>
1289
1290         Dark Mode: document markers are difficult to see
1291         https://bugs.webkit.org/show_bug.cgi?id=187632
1292         <rdar://problem/41099719>
1293
1294         Reviewed by Simon Fraser.
1295
1296         We update the way we draw the document markers for macOS and use more constrasting colors in dark mode.
1297         Paving the way for future improvements, we move the drawLineForDocumentMarker() method from GraphicsContext
1298         to RenderTheme and implement a first version in RenderThemeMac. The circles used for the underline are now
1299         drawn directly with Core Graphics and we no longer use an image resource. To allow both GraphicsContext
1300         and RenderTheme to have different versions of the drawLineForDocumentMarker() method, the DocumentMarkerLineStyle
1301         enum is now an "enum class".
1302
1303         No new test due to webkit.org/b/105616, webkit.org/b/187655 was raised to track the creation of new tests
1304         when it becomes possible again.
1305
1306         * platform/graphics/GraphicsContext.h:
1307         * platform/graphics/GraphicsContextImpl.h:
1308         * platform/graphics/cairo/CairoOperations.cpp:
1309         (WebCore::Cairo::drawLineForDocumentMarker):
1310         * platform/graphics/cairo/CairoOperations.h:
1311         * platform/graphics/cairo/GraphicsContextImplCairo.cpp:
1312         (WebCore::GraphicsContextImplCairo::drawLineForDocumentMarker):
1313         * platform/graphics/cairo/GraphicsContextImplCairo.h:
1314         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
1315         (WebCore::GraphicsContext::drawLineForDocumentMarker):
1316         * platform/graphics/displaylists/DisplayListItems.h:
1317         (WebCore::DisplayList::DrawLineForDocumentMarker::create):
1318         (WebCore::DisplayList::DrawLineForDocumentMarker::DrawLineForDocumentMarker):
1319         * platform/graphics/displaylists/DisplayListRecorder.cpp:
1320         (WebCore::DisplayList::Recorder::drawLineForDocumentMarker):
1321         * platform/graphics/displaylists/DisplayListRecorder.h:
1322         * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
1323         (Nicosia::CairoOperationRecorder::drawLineForDocumentMarker):
1324         * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h:
1325         * platform/graphics/win/GraphicsContextCGWin.cpp:
1326         (WebCore::GraphicsContext::drawLineForDocumentMarker):
1327         * rendering/InlineTextBox.cpp:
1328         (WebCore::InlineTextBox::paintPlatformDocumentMarker): Call drawLineForDocumentMarker() on the RenderTheme on
1329         macOS and on GraphicsContext in all other cases.
1330         * rendering/RenderTheme.cpp:
1331         (WebCore::RenderTheme::drawLineForDocumentMarker):
1332         * rendering/RenderTheme.h:
1333         * rendering/RenderThemeMac.h:
1334         * rendering/RenderThemeMac.mm:
1335         (WebCore::colorForStyle): Provide different colors for light and dark modes.
1336         (WebCore::RenderThemeMac::drawLineForDocumentMarker): A new macOS-specific version of drawLineForDocumentMarker()
1337         where we paint circles using Core Graphics directly.
1338
1339 2018-07-13  Charlie Turner  <cturner@igalia.com>
1340
1341         [GStreamer] Use smart pointers for GstByteReader
1342         https://bugs.webkit.org/show_bug.cgi?id=187638
1343
1344         Reviewed by Xabier Rodriguez-Calvar.
1345
1346         * platform/graphics/gstreamer/GUniquePtrGStreamer.h: Add
1347         specialisation for GstByteReader.
1348         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
1349         Use the new smart pointer class to avoid needing to remember where
1350         to call gst_byte_reader_free.
1351         (webKitMediaClearKeyDecryptorDecrypt):
1352
1353 2018-07-13  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1354
1355         [Curl] Move HTTP Setup logic from CurlRequest to CurlHandle for reuse.
1356         https://bugs.webkit.org/show_bug.cgi?id=187427
1357
1358         Reviewed by Fujii Hironori.
1359
1360         CurlContext will be used by Secure WebSocket client, but HTTP setup code is
1361         in CurlRequest, which is only for regular HTTP/HTTPS transaction. This patch
1362         allows wss client to setup CurlHandle for HTTPS communication, such as TLS,
1363         proxy or authentication.
1364
1365         No new tests because there's no behavior change.
1366
1367         * platform/network/curl/CurlContext.cpp:
1368         (WebCore::CurlHandle::CurlHandle):
1369         (WebCore::CurlHandle::enableSSLForHost):
1370         (WebCore::CurlHandle::willSetupSslCtx):
1371         (WebCore::CurlHandle::willSetupSslCtxCallback):
1372         (WebCore::CurlHandle::sslErrors const):
1373         (WebCore::CurlHandle::setUrl):
1374         (WebCore::CurlHandle::enableHttp):
1375         (WebCore::CurlHandle::enableConnectionOnly):
1376         (WebCore::CurlHandle::certificateInfo const):
1377         (WebCore::CurlHandle::enableStdErrIfUsed):
1378         (WebCore::CurlHandle::initialize): Deleted.
1379         * platform/network/curl/CurlContext.h:
1380         (WebCore::CurlHandle::url const):
1381         * platform/network/curl/CurlRequest.cpp:
1382         (WebCore::CurlRequest::setupTransfer):
1383         (WebCore::CurlRequest::didReceiveHeader):
1384         (WebCore::CurlRequest::didCompleteTransfer):
1385         (WebCore::CurlRequest::finalizeTransfer):
1386         (WebCore::CurlRequest::willSetupSslCtx): Deleted.
1387         (WebCore::CurlRequest::willSetupSslCtxCallback): Deleted.
1388         * platform/network/curl/CurlRequest.h:
1389         * platform/network/curl/CurlSSLVerifier.cpp:
1390         (WebCore::CurlSSLVerifier::CurlSSLVerifier):
1391         (WebCore::CurlSSLVerifier::verify):
1392         * platform/network/curl/CurlSSLVerifier.h:
1393
1394 2018-07-13  Xabier Rodriguez Calvar  <calvaris@igalia.com>
1395
1396         [GStreamer][MSE] Add GstFlowCombiner to handle non-linked inactive branches
1397         https://bugs.webkit.org/show_bug.cgi?id=187636
1398
1399         Reviewed by Carlos Garcia Campos.
1400
1401         When we have more than one source buffer, only one will be
1402         rendered and the inactive branch will report linking errors that
1403         we have to deal with.
1404
1405         * platform/graphics/gstreamer/GUniquePtrGStreamer.h: Added GstFlowCombiner.
1406         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
1407         (webkitMediaSrcChain): Combine the flow in the flow combiner.
1408         (webkit_media_src_init): Initialize the flow combiner.
1409         (webKitMediaSrcLinkStreamToSrcPad): Add the proxypad to the
1410         combiner and set the chain function.
1411         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamerPrivate.h:
1412         Declare the flow combiner.
1413
1414 2018-07-13  Charlie Turner  <cturner@igalia.com>
1415
1416         [GStreamer] Add GstBufferMapped abstraction
1417         https://bugs.webkit.org/show_bug.cgi?id=187600
1418
1419         Reviewed by Xabier Rodriguez-Calvar.
1420
1421         There is a similar abstraction called `mapGstBuffer` and friends,
1422         which have a slightly different use-case: wanting a buffer that is
1423         mapped for a longer lifetime without have to keep track of the map
1424         infos separately. They could be subsumed by this abstraction, but
1425         everytime they need to write to the buffer, they'd have to remap
1426         the memory blocks.
1427
1428         This abstraction is more for one-short reads and writes saving the user
1429         from remembering to unmap the buffer and having to manage to
1430         auxiliary GstMapInfo structures.
1431
1432         * platform/graphics/gstreamer/GStreamerCommon.h:
1433         (WebCore::GstMappedBuffer::GstMappedBuffer):
1434         (WebCore::GstMappedBuffer::~GstMappedBuffer):
1435         (WebCore::GstMappedBuffer::data):
1436         (WebCore::GstMappedBuffer::size const):
1437         (WebCore::GstMappedBuffer::operator bool const):
1438         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
1439         (WebCore::InbandTextTrackPrivateGStreamer::notifyTrackOfSample):
1440         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1441         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
1442         (WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered):
1443         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
1444         (webKitMediaClearKeyDecryptorSetupCipher):
1445         (webKitMediaClearKeyDecryptorDecrypt):
1446
1447 2018-07-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1448
1449         Make it easier to hit the significant rendered text layout milestone on pages with main article elements
1450         https://bugs.webkit.org/show_bug.cgi?id=187578
1451         <rdar://problem/42104637>
1452
1453         Reviewed by Ryosuke Niwa.
1454
1455         Our current heuristics for triggering the significant rendered text layout milestone are very conservative, with
1456         the intention of avoiding false positives. In practice, we can relax some of these constraints when we've
1457         detected the presence of a main article element on the page. (e.g. in New York Times articles). See per-method
1458         changes below for more detail.
1459
1460         Test: RenderingProgressTests.DidRenderSignificantAmountOfText
1461
1462         * dom/Document.cpp:
1463         (WebCore::Document::registerArticleElement):
1464         (WebCore::Document::unregisterArticleElement):
1465         (WebCore::Document::updateMainArticleElementAfterLayout):
1466
1467         As a post layout task, update the main article element by looping through the articles (up to a maximum limit of
1468         10) in search of an article element that is several times larger than the second largest article element.
1469
1470         * dom/Document.h:
1471
1472         Store a set containing the article elements in the document, as well as the current main article on the page.
1473
1474         (WebCore::Document::hasMainArticleElement const):
1475         * html/Element.cpp:
1476         (WebCore::Element::insertedIntoAncestor):
1477         (WebCore::Element::removedFromAncestor):
1478
1479         Keep track of the article elements that exist in the document whenever elements with the article tag are added
1480         to or removed from the document.
1481
1482         * page/FrameView.cpp:
1483
1484         Add new minimum thresholds for firing the significant rendered text milestone when there exists a main article.
1485
1486         (WebCore::FrameView::performPostLayoutTasks):
1487         (WebCore::FrameView::updateSignificantRenderedTextMilestoneIfNeeded):
1488
1489         Take the main article element into consideration when determining whether to fire the significant text
1490         layout milestone.
1491
1492 2018-07-12  Daniel Bates  <dabates@apple.com>
1493
1494         JavaScript URL gives incorrect result when frame is navigated
1495         https://bugs.webkit.org/show_bug.cgi?id=187203
1496         <rdar://problem/41438443>
1497
1498         Reviewed by David Kilzer.
1499
1500         * loader/SubframeLoader.cpp:
1501         (WebCore::SubframeLoader::requestFrame):
1502
1503 2018-07-12  Alex Christensen  <achristensen@webkit.org>
1504
1505         Reduce size of WebCore::URL
1506         https://bugs.webkit.org/show_bug.cgi?id=186820
1507
1508         Reviewed by Yusuke Suzuki and Youenn Fablet.
1509
1510         We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive
1511         because port numbers are missing or between 0 and 65535.  Let's just use 3 bits here.
1512         We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be
1513         longer for some custom schemes, but I've never seen one more than 20 characters.  If we assume
1514         schemes are always less than 64MB, we can save 8 bytes per URL!
1515
1516         No change in behavior, just less memory use!
1517         
1518         To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it.
1519
1520         * platform/URL.cpp:
1521         (WebCore::URL::invalidate):
1522         (WebCore::URL::lastPathComponent const):
1523         (WebCore::URL::port const):
1524         (WebCore::URL::protocolHostAndPort const):
1525         (WebCore::URL::path const):
1526         (WebCore::URL::removePort):
1527         (WebCore::URL::setPort):
1528         (WebCore::URL::setHostAndPort):
1529         (WebCore::URL::setPath):
1530         * platform/URL.h:
1531         (WebCore::URL::encode const):
1532         (WebCore::URL::decode):
1533         (WebCore::URL::hasPath const):
1534         (WebCore::URL::pathStart const):
1535         * platform/URLParser.cpp:
1536         (WebCore::URLParser::copyBaseWindowsDriveLetter):
1537         (WebCore::URLParser::urlLengthUntilPart):
1538         (WebCore::URLParser::copyURLPartsUntil):
1539         (WebCore::URLParser::shouldPopPath):
1540         (WebCore::URLParser::popPath):
1541         (WebCore::URLParser::parse):
1542         (WebCore::URLParser::parsePort):
1543         (WebCore::URLParser::parseHostAndPort):
1544         (WebCore::URLParser::allValuesEqual):
1545         (WebCore::URLParser::internalValuesConsistent):
1546         * workers/service/server/RegistrationDatabase.cpp:
1547         Increment the service worker registration schema version because of the URL encoding change.
1548
1549 2018-07-12  Youenn Fablet  <youenn@apple.com>
1550
1551         Add a FrameLoaderClient willInjectUserScriptForFrame callback
1552         https://bugs.webkit.org/show_bug.cgi?id=187565
1553
1554         Reviewed by Alex Christensen.
1555
1556         Test: http/tests/contentextensions/injected-script-callback.html.
1557
1558         * loader/FrameLoaderClient.h:
1559         * page/Frame.cpp:
1560         (WebCore::Frame::injectUserScriptImmediately):
1561         Calling the new callback whenever being about to inject a new script.
1562
1563 2018-07-12  Megan Gardner  <megan_gardner@apple.com>
1564
1565         Keep Selections within Shadow DOM boundaries
1566         https://bugs.webkit.org/show_bug.cgi?id=187556
1567         <rdar://problem/41664567>
1568
1569         Reviewed by Ryosuke Niwa.
1570
1571         Expose needed functionality to WebKit to help with determing editing and shadow dom boundries.
1572
1573         Only exposing functionality to WebKit.
1574
1575         * dom/TreeScope.h:
1576         * editing/Editing.h:
1577         * editing/VisibleSelection.cpp:
1578         (WebCore::VisibleSelection::adjustPositionForEnd const):
1579         (WebCore::VisibleSelection::adjustPositionForStart const):
1580         (WebCore::adjustPositionForEnd): Deleted.
1581         (WebCore::adjustPositionForStart): Deleted.
1582         * editing/VisibleSelection.h:
1583         
1584 2018-07-12  Sihui Liu  <sihui_liu@apple.com>
1585
1586         IndexedDB: database file of subframe cannot be removed
1587         https://bugs.webkit.org/show_bug.cgi?id=187564
1588
1589         Reviewed by Youenn Fablet.
1590
1591         For IndexedDB, if openingOrigin is different from mainFrameOrigin, there will be another 
1592         layer in the database file path. 
1593         IDBServer should delete database files recursively to make sure all files are removed.
1594
1595         Covered by modified test: WebKit.WebsiteDataStoreCustomPaths.
1596
1597         * Modules/indexeddb/server/IDBServer.cpp:
1598         (WebCore::IDBServer::removeAllDatabasesForOriginPath):
1599
1600 2018-07-12  Per Arne Vollan  <pvollan@apple.com>
1601
1602         Add compile guard for enabling NSRunLoop in the WebContent process.
1603         https://bugs.webkit.org/show_bug.cgi?id=187563
1604
1605         Reviewed by Chris Dumez.
1606
1607         No new tests, no change in behavior.
1608
1609         * platform/mac/EventLoopMac.mm:
1610         (WebCore::EventLoop::cycle):
1611
1612 2018-07-12  Zalan Bujtas  <zalan@apple.com>
1613
1614         Newly added float should trigger full layout on the block.
1615         https://bugs.webkit.org/show_bug.cgi?id=187251
1616         <rdar://problem/41726137>
1617
1618         Reviewed by David Kilzer.
1619
1620         RenderBlockFlow::determineStartPosition() is one of the places where we decide the extent of the line layout for the current block.
1621         In here we try to figure out the first line in the block that requires layout. In certain cases when floats are present,
1622         (due to their intrusive behavior) we just trigger a full layout on the entire block.
1623         One of the special cases is when a new float is added to the block. determineStartPosition() checks for such floats (floats inserted
1624         after the "last known float") and marks the block for full layout. However it missed the case when other, unrelated mutations happened
1625         in addition to this newly inserted float. This patch fixes this case by checking if the floats after the "last know float" actually need layout.
1626
1627         Test: fast/inline/new-float-needs-layout-when-line-is-dirty.html
1628
1629         * rendering/RenderBlockLineLayout.cpp:
1630         (WebCore::RenderBlockFlow::determineStartPosition):
1631
1632 2018-07-12  Thibault Saunier  <tsaunier@igalia.com>
1633
1634         [GStreamer] Add pads to the GstFlowCombiner in MediaStreamSrc
1635         https://bugs.webkit.org/show_bug.cgi?id=187552
1636
1637         Reviewed by Alejandro G. Castro.
1638
1639         This was overlooked and it is the way the API is supposed to be used.
1640
1641         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
1642         (WebCore::webkitMediaStreamSrcAddPad):
1643
1644 2018-07-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1645
1646         [JSC] Thread VM& to JSCell::methodTable(VM&)
1647         https://bugs.webkit.org/show_bug.cgi?id=187548
1648
1649         Reviewed by Saam Barati.
1650
1651         * bindings/js/JSDOMConstructorBase.h:
1652         (WebCore::JSDOMConstructorBase::className):
1653         * bindings/js/JSPluginElementFunctions.cpp:
1654         (WebCore::pluginElementCustomGetCallData):
1655         * bindings/scripts/CodeGeneratorJS.pm:
1656         (GenerateHeader):
1657         (GenerateImplementation):
1658         * bindings/scripts/test/JS/JSInterfaceName.cpp:
1659         (WebCore::JSInterfaceName::estimatedSize):
1660         * bindings/scripts/test/JS/JSInterfaceName.h:
1661
1662 2018-07-11  Youenn Fablet  <youenn@apple.com>
1663
1664         MediaDevices should derive from EventTarget in its IDL
1665         https://bugs.webkit.org/show_bug.cgi?id=187575
1666
1667         Reviewed by Chris Dumez.
1668
1669         Test: fast/mediastream/MediaDevices-addEventListener.html
1670
1671         * Modules/mediastream/MediaDevices.idl:
1672
1673 2018-07-11  Jon Lee  <jonlee@apple.com>
1674
1675         Update iOS fullscreen alert text
1676         https://bugs.webkit.org/show_bug.cgi?id=187576
1677         rdar://problem/42052284
1678
1679         Reviewed by Ryosuke Niwa.
1680
1681         * English.lproj/Localizable.strings:
1682
1683 2018-07-11  Commit Queue  <commit-queue@webkit.org>
1684
1685         Unreviewed, rolling out r233742.
1686         https://bugs.webkit.org/show_bug.cgi?id=187577
1687
1688         Binary incompatible change with respect to Service Worker
1689         registration map (Requested by dydz on #webkit).
1690
1691         Reverted changeset:
1692
1693         "Reduce size of WebCore::URL"
1694         https://bugs.webkit.org/show_bug.cgi?id=186820
1695         https://trac.webkit.org/changeset/233742
1696
1697 2018-07-11  Aditya Keerthi  <akeerthi@apple.com>
1698
1699         REGRESSION (231276): Attempting to copy an image fails
1700         https://bugs.webkit.org/show_bug.cgi?id=187212
1701         <rdar://problem/41540074>
1702
1703         Reviewed by Ryosuke Niwa.
1704
1705         Renamed methods to make it clear that one URL and one title are being passed in.
1706
1707         Test: editing/mac/pasteboard/can-copy-url-without-title.html
1708
1709         * platform/PasteboardStrategy.h:
1710         * platform/PlatformPasteboard.h:
1711         * platform/ios/PlatformPasteboardIOS.mm:
1712         (WebCore::PlatformPasteboard::setURL):
1713         * platform/mac/PasteboardMac.mm:
1714         (WebCore::writeURLForTypes):
1715         (WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
1716         * platform/mac/PlatformPasteboardMac.mm:
1717         (WebCore::PlatformPasteboard::setURL):
1718
1719 2018-07-11  Alex Christensen  <achristensen@webkit.org>
1720
1721         Add SPI for immediate injection of user scripts
1722         https://bugs.webkit.org/show_bug.cgi?id=173342
1723         <rdar://problem/29202285>
1724
1725         Reviewed by Brady Eidson, Youenn Fablet, and Geoff Garen.
1726
1727         The new SPI is WKUserContentController._addUserScriptImmediately.
1728         It is covered by new API tests.
1729         Existing functionality remains unchanged unless the new SPI is adopted.
1730
1731         * page/Frame.cpp:
1732         (WebCore::Frame::injectUserScripts):
1733         (WebCore::Frame::injectUserScriptImmediately):
1734         Move injection functionality to allow us to call it directly from the new SPI.
1735         * page/Frame.h:
1736         * page/Page.cpp:
1737         (WebCore::Page::forEachPage):
1738         * page/Page.h:
1739
1740 2018-07-11  Alex Christensen  <achristensen@webkit.org>
1741
1742         Reduce size of WebCore::URL
1743         https://bugs.webkit.org/show_bug.cgi?id=186820
1744
1745         Reviewed by Yusuke Suzuki.
1746
1747         We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive
1748         because port numbers are missing or between 0 and 65535.  Let's just use 3 bits here.
1749         We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be
1750         longer for some custom schemes, but I've never seen one more than 20 characters.  If we assume
1751         schemes are always less than 64MB, we can save 8 bytes per URL!
1752
1753         No change in behavior, just less memory use!
1754
1755         * platform/URL.cpp:
1756         (WebCore::URL::invalidate):
1757         (WebCore::URL::lastPathComponent const):
1758         (WebCore::URL::port const):
1759         (WebCore::URL::protocolHostAndPort const):
1760         (WebCore::URL::path const):
1761         (WebCore::URL::removePort):
1762         (WebCore::URL::setPort):
1763         (WebCore::URL::setHostAndPort):
1764         (WebCore::URL::setPath):
1765         * platform/URL.h:
1766         (WebCore::URL::encode const):
1767         (WebCore::URL::decode):
1768         (WebCore::URL::hasPath const):
1769         (WebCore::URL::pathStart const):
1770         * platform/URLParser.cpp:
1771         (WebCore::URLParser::copyBaseWindowsDriveLetter):
1772         (WebCore::URLParser::urlLengthUntilPart):
1773         (WebCore::URLParser::copyURLPartsUntil):
1774         (WebCore::URLParser::shouldPopPath):
1775         (WebCore::URLParser::popPath):
1776         (WebCore::URLParser::parse):
1777         (WebCore::URLParser::parsePort):
1778         (WebCore::URLParser::parseHostAndPort):
1779         (WebCore::URLParser::allValuesEqual):
1780         (WebCore::URLParser::internalValuesConsistent):
1781
1782 2018-07-11  Youenn Fablet  <youenn@apple.com>
1783
1784         Fix remaining Cross-Origin-Resource-Policy failures, if any
1785         https://bugs.webkit.org/show_bug.cgi?id=186761
1786         <rdar://problem/41209829>
1787
1788         Reviewed by Alex Christensen.
1789
1790         Add case-sensitive check for CORP header value, as per fetch specification.
1791         Add HTTP->HTTPS check for same-site case, as per fetch specification.
1792         https://fetch.spec.whatwg.org/#cross-origin-resource-policy-check
1793
1794         Test: imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/scheme-restriction.https.window.html
1795
1796         * loader/CrossOriginAccessControl.cpp:
1797         (WebCore::shouldCrossOriginResourcePolicyCancelLoad):
1798         * platform/network/HTTPParsers.cpp:
1799         (WebCore::parseCrossOriginResourcePolicyHeader):
1800
1801 2018-07-11  Ross Kirsling  <ross.kirsling@sony.com>
1802
1803         [WinCairo] MIME type registry doesn't explicitly recognize *.xht
1804         https://bugs.webkit.org/show_bug.cgi?id=187555
1805
1806         Reviewed by Konstantin Tokarev.
1807
1808         Follow-up to r233715 -- WinCairo bots are failing on *.xht layout tests as they lack a registry key for this filetype.
1809         (Hopefully this is the last one to add.)
1810
1811         * platform/win/MIMETypeRegistryWin.cpp:
1812         (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
1813         Add *.xht to the list of recognized filetypes.
1814
1815 2018-07-11  Antoine Quint  <graouts@apple.com>
1816
1817         [Web Animations] Make WPT test at interfaces/KeyframeEffect/processing-a-keyframes-argument-001.html pass reliably
1818         https://bugs.webkit.org/show_bug.cgi?id=186501
1819         <rdar://problem/41000224>
1820
1821         Unreviewed build fix after r233729 and r233730.
1822
1823         * animation/KeyframeEffectReadOnly.cpp:
1824         (WebCore::processIterableKeyframes):
1825
1826 2018-07-11  Antoine Quint  <graouts@apple.com>
1827
1828         [Web Animations] Make WPT test at interfaces/KeyframeEffect/processing-a-keyframes-argument-001.html pass reliably
1829         https://bugs.webkit.org/show_bug.cgi?id=186501
1830         <rdar://problem/41000224>
1831
1832         Unreviewed build fix after r233729.
1833
1834         * animation/KeyframeEffectReadOnly.cpp:
1835         (WebCore::processIterableKeyframes):
1836
1837 2018-07-10  Antoine Quint  <graouts@apple.com>
1838
1839         [Web Animations] Make WPT test at interfaces/KeyframeEffect/processing-a-keyframes-argument-001.html pass reliably
1840         https://bugs.webkit.org/show_bug.cgi?id=186501
1841         <rdar://problem/41000224>
1842
1843         Reviewed by Dean Jackson.
1844
1845         There were two remaining assertions that we were failing in this WPT test file, both related to processing iterable keyframes.
1846         The first one was failing because didn't correctly propagate the TypeError exception in the forEachInIterable() callback. The
1847         second one was failing because we didn't use the "process a keyframe-like object" procedure when processing iterable keyframes
1848         and, as such, we didn't correctly sort property alphabetically before reading their values.
1849
1850         To fix this second issue, we make processIterableKeyframes() use processKeyframeLikeObject(). To do so, we update processKeyframeLikeObject()
1851         to accept a new boolean flag to match the "allow lists" flag from the specification. We also ensure we sort the properties *before*
1852         reading from them which we didn't use to do previously.
1853
1854         * animation/KeyframeEffectReadOnly.cpp:
1855         (WebCore::processKeyframeLikeObject):
1856         (WebCore::processIterableKeyframes):
1857         (WebCore::processPropertyIndexedKeyframes):
1858         * animation/KeyframeEffectReadOnly.h:
1859         * animation/KeyframeEffectReadOnly.idl:
1860
1861 2018-07-11  Zalan Bujtas  <zalan@apple.com>
1862
1863         SimpleLineLayout::FlowContents wastes 54KB of Vector capacity on nytimes.com
1864         https://bugs.webkit.org/show_bug.cgi?id=186709
1865         <rdar://problem/41173793>
1866
1867         Reviewed by Simon Fraser.
1868
1869         The size of the m_segments vector in SimpleLineLayoutFlowContents is alway pre-computed and don't change after the initial append.  
1870
1871         Not testable.
1872
1873         * rendering/SimpleLineLayoutFlowContents.h:
1874
1875 2018-07-10  Youenn Fablet  <youenn@apple.com>
1876
1877         Make fetch() use "same-origin" credentials by default
1878         https://bugs.webkit.org/show_bug.cgi?id=176023
1879
1880         Reviewed by Chris Dumez.
1881
1882         Covered by updated tests.
1883
1884         * Modules/fetch/FetchRequest.cpp:
1885         (WebCore::FetchRequest::initializeWith):
1886         Setting credentials mode to same-origin for FetchRequest by default.
1887         * loader/DocumentThreadableLoader.cpp:
1888         (WebCore::DocumentThreadableLoader::redirectReceived):
1889         Handle correctly referrer in case we restart a load.
1890         * page/PerformanceResourceTiming.cpp:
1891         (WebCore::entryStartTime):
1892         (WebCore::entryEndTime):
1893         In case it is not allowed to disclose resource timing info, update as
1894         https://www.w3.org/TR/resource-timing-1/#performanceresourcetiming
1895
1896 2018-07-10  Chris Dumez  <cdumez@apple.com>
1897
1898         "serviceworker.js" is fetched several times in a row
1899         https://bugs.webkit.org/show_bug.cgi?id=187435
1900         <rdar://problem/41940569>
1901
1902         Reviewed by Youenn Fablet.
1903
1904         Soft updates happen every time a fetch event is sent to a service worker for a main resource request.
1905         This can happen many times during a page load and will cause us to spam the HTTP server with update
1906         requests, especially considering that the default behavior is to bypass the HTTP cache. To address
1907         the issue, we now do soft updates on a 1 second delay and we keep rescheduling this timer was long as
1908         soft update requests keep coming. Based on my understanding of the Chromium code, this seems to be
1909         what they are doing so this should align our behavior with them.
1910
1911         * workers/service/ServiceWorkerRegistration.cpp:
1912         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
1913         (WebCore::ServiceWorkerRegistration::scheduleSoftUpdate):
1914         * workers/service/ServiceWorkerRegistration.h:
1915         * workers/service/context/ServiceWorkerFetch.cpp:
1916         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
1917
1918 2018-07-10  Ross Kirsling  <ross.kirsling@sony.com>
1919
1920         [WinCairo] MIME type registry doesn't explicitly recognize *.css
1921         https://bugs.webkit.org/show_bug.cgi?id=187538
1922
1923         Reviewed by Yusuke Suzuki.
1924
1925         MIMETypeRegistryWin doesn't explicitly recognize *.css; it instead falls back to the registry key "Content Type"
1926         under HKEY_CLASSES_ROOT\.css. This key doesn't exist on Windows Server unless an application actually registers
1927         it -- as a result, WinCairo bots are currently viewing it as an unrecognized filetype!
1928
1929         * platform/win/MIMETypeRegistryWin.cpp:
1930         (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
1931         Add *.css to the list of recognized filetypes.
1932
1933 2018-07-10  Timothy Hatcher  <timothy@apple.com>
1934
1935         REGRESSION (r233552): Find highlight has white text on yellow background
1936         https://bugs.webkit.org/show_bug.cgi?id=187535
1937         rdar://problem/42043371
1938
1939         Reviewed by Tim Horton.
1940
1941         Fixes existing image tests:
1942         - fast/text/mark-matches-rendering.html
1943         - fast/text/mark-matches-broken-line-rendering.html
1944
1945         * rendering/InlineTextBox.cpp:
1946         (WebCore::InlineTextBox::resolveStyleForMarkedText): Remove incorect UseDarkAppearance.
1947
1948 2018-07-10  Chris Fleizach  <cfleizach@apple.com>
1949
1950         AX: Crash in accessing AXObjectCache in textMarkerDataForVisiblePosition
1951         https://bugs.webkit.org/show_bug.cgi?id=187528
1952         <rdar://problem/37231941>
1953
1954         Reviewed by Joanmarie Diggs.
1955
1956         Occasional crashes reported when running accessibility/mac/search-field-cancel-button.html.
1957         Looks like the cache object retrieved was not valid and we weren't checking for it.
1958
1959         * accessibility/AXObjectCache.cpp:
1960         (WebCore::AXObjectCache::visiblePositionForTextMarkerData):
1961         (WebCore::AXObjectCache::textMarkerDataForVisiblePosition):
1962         (WebCore::AXObjectCache::textMarkerDataForFirstPositionInTextControl):
1963
1964 2018-07-10  Zalan Bujtas  <zalan@apple.com>
1965
1966         FragmentInterval, FragmentIntervalTree and FragmentSearchAdapter should hold not hold raw pointers to renderers.
1967         https://bugs.webkit.org/show_bug.cgi?id=187249
1968         <rdar://problem/41725869>
1969
1970         Reviewed by Simon Fraser.
1971
1972         Test: fast/multicol/crash-in-vertical-writing-mode.html
1973
1974         * rendering/RenderFragmentedFlow.cpp:
1975         (WebCore::RenderFragmentedFlow::updateFragmentsFragmentedFlowPortionRect):
1976         * rendering/RenderFragmentedFlow.h:
1977         (WTF::ValueToString<WeakPtr<WebCore::RenderFragmentContainer>>::string):
1978
1979 2018-07-10  Ryosuke Niwa  <rniwa@webkit.org>
1980
1981         Disable cross-origin-window-policy by default
1982         https://bugs.webkit.org/show_bug.cgi?id=187509
1983
1984         Reviewed by Chris Dumez.
1985
1986         Disabled the feature by default.
1987
1988         * page/Settings.yaml:
1989
1990 2018-07-10  Alejandro G. Castro  <alex@igalia.com>
1991
1992         [GTK][WPE] The LibWebRTCProvider object in RealtimeMediaSourceCenterLibWebRTC is not needed anymore
1993         https://bugs.webkit.org/show_bug.cgi?id=187513
1994
1995         Reviewed by Youenn Fablet.
1996
1997         We used the factory of the LibWebRTCProvider in
1998         RealtimeMediaSourceCenterLibWebRTC as a singleton to make sure the
1999         devices were correctly listed and used, we needed this when using
2000         libwebrtc media devices management. We are now using GStreamer to handle
2001         the media devices so this is not needed anymore.
2002
2003         No new tests, this change removed unused code.
2004
2005         * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.cpp:
2006         (WebCore::RealtimeMediaSourceCenterLibWebRTC::RealtimeMediaSourceCenterLibWebRTC):
2007         * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.h:
2008
2009 2018-07-10  Zalan Bujtas  <zalan@apple.com>
2010
2011         Rollout r233530: Candidate for Speedometer regression.
2012         https://bugs.webkit.org/show_bug.cgi?id=187518
2013
2014         * rendering/SimpleLineLayoutFlowContents.h:
2015
2016 2018-07-09  Antoine Quint  <graouts@apple.com>
2017
2018         [Web Animations] Correct handle repetition of composite and easing values
2019         https://bugs.webkit.org/show_bug.cgi?id=187498
2020         <rdar://problem/41999183>
2021
2022         Reviewed by Dean Jackson.
2023
2024         If there are fewer values for "easing" and "composite" than there are keyframes, we are supposed to
2025         fill in missing values by repeating the pattern of specified values. We were starting our iteration
2026         to fill those missing values on the second missing value rather than the first missing value.
2027
2028         * animation/KeyframeEffectReadOnly.cpp:
2029         (WebCore::processPropertyIndexedKeyframes):
2030
2031 2018-07-09  Youenn Fablet  <youenn@apple.com>
2032
2033         Add the possibility to run unsandboxed plug-ins
2034         https://bugs.webkit.org/show_bug.cgi?id=187310
2035         <rdar://problem/41798808>
2036
2037         Reviewed by Alexey Proskuryakov.
2038
2039         Add a runtime flag to enforce plugin sandboxing.
2040         Covered by manual testing.
2041
2042         * page/RuntimeEnabledFeatures.h:
2043         (WebCore::RuntimeEnabledFeatures::setSandboxPlugInEnabled):
2044         (WebCore::RuntimeEnabledFeatures::sandboxPlugInEnabled const):
2045
2046 2018-07-09  Dean Jackson  <dino@apple.com>
2047
2048         Remove fullscreen-auto-hide-delay
2049         https://bugs.webkit.org/show_bug.cgi?id=187493
2050         <rdar://problem/41830852>
2051
2052         Reviewed by Antoine Quint.
2053
2054         Remove the env() value for fullscreen-auto-hide-delay.
2055
2056         * dom/ConstantPropertyMap.cpp:
2057         (WebCore::ConstantPropertyMap::nameForProperty const):
2058         (WebCore::ConstantPropertyMap::setFullscreenAutoHideDelay): Deleted.
2059         * dom/ConstantPropertyMap.h:
2060         * page/Page.cpp:
2061         (WebCore::Page::setFullscreenAutoHideDelay): Deleted.
2062         * page/Page.h:
2063         * testing/Internals.cpp:
2064         (WebCore::Internals::resetToConsistentState): No need to reset delay.
2065         (WebCore::Internals::setFullscreenAutoHideDelay): Deleted.
2066         * testing/Internals.h: Remove the delay setter/getter.
2067         * testing/Internals.idl:
2068
2069 2018-07-09  Timothy Hatcher  <timothy@apple.com>
2070
2071         Semantic colors don't update when accessibility Increase Contrast mode is enabled.
2072         https://bugs.webkit.org/show_bug.cgi?id=187425
2073         rdar://problem/39948240
2074
2075         Reviewed by Tim Horton.
2076
2077         Added a listener for the accessibility change notification to invalidate our color caches.
2078
2079         Removed calls to RenderTheme::singleton().platformColorsDidChange() in Page, since that
2080         ended up calling Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment multiple times.
2081         Instead, changed the functions to use the new instance version instead.
2082
2083         * page/Page.cpp:
2084         (WebCore::Page::updateStyleAfterChangeInEnvironment): Added. Gives Page a direct way to do this work
2085         per instance instead of on all pages (since appearance can be difference per view).
2086         (WebCore::Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment): Call updateStyleAfterChangeInEnvironment.
2087         (WebCore::Page::setUseSystemAppearance): Call updateStyleAfterChangeInEnvironment.
2088         (WebCore::Page::setUseDarkAppearance): Added. Call updateStyleAfterChangeInEnvironment.
2089         * page/Page.h:
2090         (WebCore::Page::setUseDarkAppearance): Moved to the implementation file.
2091         * platform/mac/LocalDefaultSystemAppearance.mm:
2092         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): Removed recursive check since it was interfering
2093         with the setting of m_usingDarkAppearance and causing the wrong color cache to be used.
2094         (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance): Ditto.
2095         * rendering/RenderThemeMac.mm:
2096         (-[WebCoreRenderThemeNotificationObserver init]): Listen for NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification.
2097         (-[WebCoreRenderThemeNotificationObserver systemColorsDidChange:]): Removed assert since multiple notifications are used now.
2098         (WebCore::RenderThemeMac::systemColor): Change how system link colors are cached. Don't store useSystemAppearance link colors in the
2099         ColorCache, since that special bool isn't considered in the cache after the first time.
2100
2101 2018-07-09  Simon Fraser  <simon.fraser@apple.com>
2102
2103         Shrink various loading-related enums to shrink CachedResource
2104         https://bugs.webkit.org/show_bug.cgi?id=187443
2105
2106         Reviewed by Chris Dumez.
2107         
2108         ResourceRequestBase, ResourceResponseBase, ResourceLoaderOptions, FetchOptions and
2109         CachedResource have a lot of enum members variables most of which took 4 bytes each.
2110         These can be packed much more efficiently if the enums are declared with an 8-bit size.
2111         This requires turning enums into enum classes in some cases.
2112         
2113         This reduces the size of CachedResource from 1464 to 1384 bytes, which saves about 49KB
2114         over the ~600 CachedResources on nytimes.com.
2115
2116         * Modules/fetch/FetchLoader.cpp:
2117         (WebCore::FetchLoader::startLoadingBlobURL):
2118         (WebCore::FetchLoader::start):
2119         * css/StyleRuleImport.cpp:
2120         (WebCore::StyleRuleImport::requestStyleSheet):
2121         * fileapi/FileReaderLoader.cpp:
2122         (WebCore::FileReaderLoader::start):
2123         * html/MediaDocument.cpp:
2124         (WebCore::MediaDocumentParser::createDocumentStructure):
2125         * html/PluginDocument.cpp:
2126         (WebCore::PluginDocumentParser::appendBytes):
2127         * html/parser/CSSPreloadScanner.cpp:
2128         (WebCore::CSSPreloadScanner::emitRule):
2129         * html/parser/HTMLPreloadScanner.cpp:
2130         (WebCore::TokenPreloadScanner::StartTagScanner::resourceType const):
2131         * inspector/NetworkResourcesData.cpp:
2132         (WebCore::shouldBufferResourceData):
2133         * inspector/agents/InspectorNetworkAgent.cpp:
2134         (WebCore::InspectorNetworkAgent::didReceiveResponse):
2135         (WebCore::InspectorNetworkAgent::loadResource):
2136         (WebCore::InspectorNetworkAgent::cachedResourceContent):
2137         * inspector/agents/InspectorPageAgent.cpp:
2138         (WebCore::InspectorPageAgent::sourceMapURLForResource):
2139         (WebCore::InspectorPageAgent::inspectorResourceType):
2140         * loader/ApplicationManifestLoader.cpp:
2141         (WebCore::ApplicationManifestLoader::startLoading):
2142         * loader/ContentFilter.cpp:
2143         (WebCore::ContentFilter::deliverResourceData):
2144         * loader/DocumentLoader.cpp:
2145         (WebCore::DocumentLoader::notifyFinished):
2146         (WebCore::DocumentLoader::willSendRequest):
2147         (WebCore::DocumentLoader::tryLoadingRedirectRequestFromApplicationCache):
2148         (WebCore::DocumentLoader::subresource const):
2149         (WebCore::DocumentLoader::loadMainResource):
2150         * loader/DocumentThreadableLoader.cpp:
2151         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
2152         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
2153         (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):
2154         (WebCore::DocumentThreadableLoader::preflightSuccess):
2155         (WebCore::DocumentThreadableLoader::loadRequest):
2156         * loader/FetchOptions.h:
2157         (WebCore::FetchOptions::FetchOptions):
2158         * loader/FrameLoader.cpp:
2159         (WebCore::FrameLoader::loadFrameRequest):
2160         (WebCore::FrameLoader::loadURL):
2161         (WebCore::FrameLoader::load):
2162         (WebCore::FrameLoader::reloadWithOverrideEncoding):
2163         (WebCore::FrameLoader::reload):
2164         (WebCore::FrameLoader::defaultRequestCachingPolicy):
2165         (WebCore::FrameLoader::addExtraFieldsToRequest):
2166         (WebCore::FrameLoader::loadedResourceFromMemoryCache):
2167         (WebCore::FrameLoader::loadDifferentDocumentItem):
2168         * loader/LinkLoader.cpp:
2169         (WebCore::LinkLoader::resourceTypeFromAsAttribute):
2170         (WebCore::createLinkPreloadResourceClient):
2171         (WebCore::LinkLoader::isSupportedType):
2172         (WebCore::LinkLoader::prefetchIfNeeded):
2173         * loader/MediaResourceLoader.cpp:
2174         (WebCore::MediaResourceLoader::requestResource):
2175         * loader/NavigationScheduler.cpp:
2176         (WebCore::NavigationScheduler::scheduleLocationChange):
2177         * loader/NetscapePlugInStreamLoader.cpp:
2178         (WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader):
2179         * loader/ResourceLoadInfo.cpp:
2180         (WebCore::toResourceType):
2181         * loader/ResourceLoader.cpp:
2182         (WebCore::ResourceLoader::init):
2183         (WebCore::ResourceLoader::start):
2184         (WebCore::ResourceLoader::setDataBufferingPolicy):
2185         (WebCore::ResourceLoader::addDataOrBuffer):
2186         (WebCore::ResourceLoader::willSendRequestInternal):
2187         (WebCore::ResourceLoader::didReceiveResponse):
2188         (WebCore::ResourceLoader::didReceiveDataOrBuffer):
2189         (WebCore::ResourceLoader::didFinishLoadingOnePart):
2190         (WebCore::ResourceLoader::cleanupForError):
2191         * loader/ResourceLoader.h:
2192         (WebCore::ResourceLoader::shouldSendResourceLoadCallbacks const):
2193         (WebCore::ResourceLoader::shouldSniffContent const):
2194         (WebCore::ResourceLoader::shouldIncludeCertificateInfo const):
2195         * loader/ResourceLoaderOptions.h:
2196         * loader/ResourceTimingInformation.cpp:
2197         (WebCore::ResourceTimingInformation::addResourceTiming):
2198         (WebCore::ResourceTimingInformation::storeResourceTimingInitiatorInformation):
2199         * loader/SubresourceLoader.cpp:
2200         (WebCore::SubresourceLoader::SubresourceLoader):
2201         (WebCore::SubresourceLoader::willSendRequestInternal):
2202         (WebCore::SubresourceLoader::shouldCreatePreviewLoaderForResponse const):
2203         (WebCore::SubresourceLoader::didReceiveResponse):
2204         (WebCore::logResourceLoaded):
2205         (WebCore::SubresourceLoader::didFinishLoading):
2206         (WebCore::SubresourceLoader::didFail):
2207         (WebCore::SubresourceLoader::didCancel):
2208         * loader/cache/CachedApplicationManifest.cpp:
2209         (WebCore::CachedApplicationManifest::CachedApplicationManifest):
2210         * loader/cache/CachedApplicationManifest.h:
2211         * loader/cache/CachedCSSStyleSheet.cpp:
2212         (WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet):
2213         * loader/cache/CachedCSSStyleSheet.h:
2214         * loader/cache/CachedFont.h:
2215         * loader/cache/CachedImage.cpp:
2216         (WebCore::CachedImage::CachedImage):
2217         (WebCore::CachedImage::updateBuffer):
2218         (WebCore::CachedImage::updateData):
2219         * loader/cache/CachedImage.h:
2220         * loader/cache/CachedRawResource.cpp:
2221         (WebCore::CachedRawResource::updateBuffer):
2222         (WebCore::CachedRawResource::updateData):
2223         (WebCore::CachedRawResource::finishLoading):
2224         (WebCore::CachedRawResource::canReuse const):
2225         * loader/cache/CachedResource.cpp:
2226         (WebCore::CachedResource::defaultPriorityForResourceType):
2227         (WebCore::deadDecodedDataDeletionIntervalForResourceType):
2228         (WebCore::CachedResource::CachedResource):
2229         (WebCore::CachedResource::load):
2230         (WebCore::CachedResource::updateBuffer):
2231         (WebCore::CachedResource::updateData):
2232         (WebCore::CachedResource::isCORSSameOrigin const):
2233         (WebCore::CachedResource::freshnessLifetime const):
2234         (WebCore::CachedResource::setResponse):
2235         (WebCore::CachedResource::addClientToSet):
2236         (WebCore::CachedResource::areAllClientsXMLHttpRequests const):
2237         * loader/cache/CachedResource.h:
2238         (WebCore::CachedResource::isImage const):
2239         (WebCore::CachedResource::isMainOrMediaOrIconOrRawResource const):
2240         (WebCore::CachedResource::ignoreForRequestCount const):
2241         (WebCore::CachedResource::shouldSendResourceLoadCallbacks const):
2242         * loader/cache/CachedResourceLoader.cpp:
2243         (WebCore::createResource):
2244         (WebCore::CachedResourceLoader::requestImage):
2245         (WebCore::CachedResourceLoader::requestFont):
2246         (WebCore::CachedResourceLoader::requestTextTrack):
2247         (WebCore::CachedResourceLoader::requestCSSStyleSheet):
2248         (WebCore::CachedResourceLoader::requestScript):
2249         (WebCore::CachedResourceLoader::requestXSLStyleSheet):
2250         (WebCore::CachedResourceLoader::requestSVGDocument):
2251         (WebCore::CachedResourceLoader::requestLinkResource):
2252         (WebCore::CachedResourceLoader::requestMedia):
2253         (WebCore::CachedResourceLoader::requestIcon):
2254         (WebCore::CachedResourceLoader::requestRawResource):
2255         (WebCore::CachedResourceLoader::requestBeaconResource):
2256         (WebCore::CachedResourceLoader::requestMainResource):
2257         (WebCore::CachedResourceLoader::requestApplicationManifest):
2258         (WebCore::contentTypeFromResourceType):
2259         (WebCore::CachedResourceLoader::checkInsecureContent const):
2260         (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy const):
2261         (WebCore::CachedResourceLoader::canRequest):
2262         (WebCore::CachedResourceLoader::canRequestInContentDispositionAttachmentSandbox const):
2263         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest):
2264         (WebCore::isResourceSuitableForDirectReuse):
2265         (WebCore::destinationForType):
2266         (WebCore::CachedResourceLoader::loadResource):
2267         (WebCore::CachedResourceLoader::determineRevalidationPolicy const):
2268         (WebCore::CachedResourceLoader::cachePolicy const):
2269         (WebCore::CachedResourceLoader::preload):
2270         (WebCore::CachedResourceLoader::warnUnusedPreloads):
2271         (WebCore::CachedResourceLoader::clearPreloads):
2272         (WebCore::CachedResourceLoader::defaultCachedResourceOptions):
2273         * loader/cache/CachedResourceRequest.cpp:
2274         (WebCore::CachedResourceRequest::updateAccordingCacheMode):
2275         * loader/cache/CachedResourceRequest.h:
2276         * loader/cache/CachedSVGDocument.cpp:
2277         (WebCore::CachedSVGDocument::CachedSVGDocument):
2278         * loader/cache/CachedSVGDocument.h:
2279         * loader/cache/CachedSVGFont.cpp:
2280         (WebCore::CachedSVGFont::CachedSVGFont):
2281         * loader/cache/CachedSVGFont.h:
2282         * loader/cache/CachedScript.cpp:
2283         (WebCore::CachedScript::CachedScript):
2284         * loader/cache/CachedScript.h:
2285         * loader/cache/CachedTextTrack.cpp:
2286         (WebCore::CachedTextTrack::CachedTextTrack):
2287         (WebCore::CachedTextTrack::doUpdateBuffer):
2288         * loader/cache/CachedTextTrack.h:
2289         * loader/cache/CachedXSLStyleSheet.cpp:
2290         (WebCore::CachedXSLStyleSheet::CachedXSLStyleSheet):
2291         * loader/cache/CachedXSLStyleSheet.h:
2292         * loader/cache/MemoryCache.cpp:
2293         (WebCore::MemoryCache::getStatistics):
2294         * loader/icon/IconLoader.cpp:
2295         (WebCore::IconLoader::startLoading):
2296         * loader/mac/ResourceLoaderMac.mm:
2297         (WebCore::ResourceLoader::willCacheResponseAsync):
2298         * page/DOMWindow.cpp:
2299         (WebCore::DOMWindow::createWindow):
2300         * page/EventSource.cpp:
2301         (WebCore::EventSource::connect):
2302         * platform/ReferrerPolicy.h:
2303         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
2304         (WebCore::WebCoreAVFResourceLoader::startLoading):
2305         * platform/ios/QuickLook.mm:
2306         (WebCore::registerQLPreviewConverterIfNeeded):
2307         * platform/network/CacheValidation.cpp:
2308         (WebCore::updateRedirectChainStatus):
2309         (WebCore::redirectChainAllowsReuse):
2310         * platform/network/CacheValidation.h:
2311         (WebCore::RedirectChainCacheStatus::RedirectChainCacheStatus):
2312         * platform/network/ResourceErrorBase.h:
2313         * platform/network/ResourceLoadPriority.h:
2314         * platform/network/ResourceRequestBase.cpp:
2315         (WebCore::ResourceRequestBase::httpBody const):
2316         (WebCore::ResourceRequestBase::updatePlatformRequest const):
2317         (WebCore::ResourceRequestBase::updateResourceRequest const):
2318         * platform/network/ResourceRequestBase.h:
2319         * platform/network/ResourceResponseBase.h:
2320         * platform/network/StoredCredentialsPolicy.h:
2321         * platform/network/cf/ResourceRequest.h:
2322         (WebCore::ResourceRequest::ResourceRequest):
2323         * platform/network/cf/ResourceRequestCFNet.cpp:
2324         (WebCore::toPlatformRequestCachePolicy):
2325         (WebCore::fromPlatformRequestCachePolicy):
2326         (WebCore::ResourceRequest::doUpdateResourceRequest):
2327         * platform/network/cocoa/ResourceRequestCocoa.mm:
2328         (WebCore::fromPlatformRequestCachePolicy):
2329         (WebCore::toPlatformRequestCachePolicy):
2330         (WebCore::ResourceRequest::doUpdateResourceRequest):
2331         * platform/network/cocoa/WebCoreNSURLSession.mm:
2332         (-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:completionHandler:]):
2333         * platform/network/ios/PreviewConverter.mm:
2334         (WebCore::PreviewConverter::safeRequest const):
2335         * platform/network/mac/ResourceHandleMac.mm:
2336         (WebCore::ResourceHandle::createNSURLConnection):
2337         (WebCore::ResourceHandle::start):
2338         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
2339         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
2340         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
2341         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
2342         * testing/Internals.cpp:
2343         (WebCore::toResourceRequestCachePolicy):
2344         * workers/WorkerScriptLoader.cpp:
2345         (WebCore::WorkerScriptLoader::loadSynchronously):
2346         (WebCore::WorkerScriptLoader::loadAsynchronously):
2347         * xml/XMLHttpRequest.cpp:
2348         (WebCore::XMLHttpRequest::createRequest):
2349
2350 2018-07-09  Antoine Quint  <graouts@apple.com>
2351
2352         [Web Animations] Make WPT test at interfaces/DocumentTimeline/constructor.html pass reliably
2353         https://bugs.webkit.org/show_bug.cgi?id=186498
2354         <rdar://problem/41000205>
2355         
2356         Reviewed by Dean Jackson.
2357
2358         Add a Constructor to the DocumentTimeline IDL to match the spec and ensure we respect the provided
2359         origin time. To ensure all DocumentTimeline instances report matching current times, we read the
2360         current time from the "main" document timeline, the one created by the Document automatically.
2361
2362         * CMakeLists.txt:
2363         * DerivedSources.make:
2364         * Sources.txt:
2365         * WebCore.xcodeproj/project.pbxproj:
2366         * animation/DocumentTimeline.cpp:
2367         (WebCore::DocumentTimeline::create):
2368         (WebCore::DocumentTimeline::DocumentTimeline):
2369         (WebCore::DocumentTimeline::currentTime):
2370         * animation/DocumentTimeline.h:
2371         * animation/DocumentTimeline.idl:
2372         * animation/DocumentTimelineOptions.h:
2373         * animation/DocumentTimelineOptions.idl:
2374
2375 2018-07-09  Antoine Quint  <graouts@apple.com>
2376
2377         [Web Animations] Support overlapping keyframes
2378         https://bugs.webkit.org/show_bug.cgi?id=187481
2379         <rdar://problem/41988674>
2380
2381         Reviewed by Dean Jackson.
2382
2383         We now support parsing of multiple keyframes for the same offset.
2384
2385         * animation/KeyframeEffectReadOnly.cpp:
2386         (WebCore::computeMissingKeyframeOffsets): Keyframes with a null offset that don't yet have a non-zero
2387         computed offset are keyframes with an offset that needs to be computed.
2388         (WebCore::KeyframeEffectReadOnly::processKeyframes): Only file an exception if an offset is found that
2389         is lower than a previously-parsed one, allowing offsets with the same value.
2390         * rendering/style/KeyframeList.cpp:
2391         (WebCore::KeyframeList::insert): Remove the assertion that prevented an offset to be found more than once.
2392
2393 2018-07-09  Youenn Fablet  <youenn@apple.com>
2394
2395         StringView operator==(char*) should check the length of the string
2396         https://bugs.webkit.org/show_bug.cgi?id=187422
2397
2398         Reviewed by Chris Dumez.
2399
2400         Covered by existing tests.
2401
2402         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
2403         (WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameFromEncodedFilename):
2404
2405 2018-07-09  Simon Fraser  <simon.fraser@apple.com>
2406
2407         Shrink WebCore::Pair
2408         https://bugs.webkit.org/show_bug.cgi?id=187450
2409
2410         Reviewed by Sam Weinig.
2411
2412         Move m_encoding to pack in with m_refCount and remove the virtual destructor,
2413         shrinking the class from 40 to 24 bytes.
2414         Also make the enum take only a byte, in case it gets used elsewhere
2415         
2416         There are about 500 Pairs on nytimes.com, so this memory saving is non-trivial.
2417
2418         * css/Pair.h:
2419
2420 2018-07-09  Yusuke Suzuki  <utatane.tea@gmail.com>
2421
2422         [WebCore] Annotate classes with WTF_MAKE_FAST_ALLOCATED as much as possible
2423         https://bugs.webkit.org/show_bug.cgi?id=187474
2424
2425         Reviewed by Mark Lam.
2426
2427         When opening cnn.com, debugger says that so many objects in WebCore are allocated
2428         from system allocator. This patch attempts to annotate these found classes with
2429         WTF_MAKE_FAST_ALLOCATED.
2430
2431         We also annotate WebAudio classes with `final` to make WebAudio class hierarchy solid.
2432
2433         No behavior change.
2434
2435         * Modules/indexeddb/IDBIndex.h:
2436         * Modules/indexeddb/IDBObjectStore.h:
2437         * Modules/indexeddb/client/IDBConnectionProxy.h:
2438         * Modules/mediastream/UserMediaController.h:
2439         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
2440         * Modules/webaudio/AsyncAudioDecoder.h:
2441         * Modules/webaudio/AudioListener.h:
2442         (WebCore::AudioListener::create): Deleted.
2443         (WebCore::AudioListener::setPosition): Deleted.
2444         (WebCore::AudioListener::position const): Deleted.
2445         (WebCore::AudioListener::setOrientation): Deleted.
2446         (WebCore::AudioListener::orientation const): Deleted.
2447         (WebCore::AudioListener::setUpVector): Deleted.
2448         (WebCore::AudioListener::upVector const): Deleted.
2449         (WebCore::AudioListener::setVelocity): Deleted.
2450         (WebCore::AudioListener::velocity const): Deleted.
2451         (WebCore::AudioListener::setDopplerFactor): Deleted.
2452         (WebCore::AudioListener::dopplerFactor const): Deleted.
2453         (WebCore::AudioListener::setSpeedOfSound): Deleted.
2454         (WebCore::AudioListener::speedOfSound const): Deleted.
2455         * Modules/webaudio/AudioNode.h:
2456         * Modules/webaudio/AudioNodeInput.h:
2457         (WebCore::AudioNodeInput::node const): Deleted.
2458         * Modules/webaudio/AudioNodeOutput.h:
2459         * Modules/webaudio/AudioParam.h:
2460         (WebCore::AudioParam::create): Deleted.
2461         (WebCore::AudioParam::name const): Deleted.
2462         (WebCore::AudioParam::minValue const): Deleted.
2463         (WebCore::AudioParam::maxValue const): Deleted.
2464         (WebCore::AudioParam::defaultValue const): Deleted.
2465         (WebCore::AudioParam::units const): Deleted.
2466         (WebCore::AudioParam::resetSmoothedValue): Deleted.
2467         (WebCore::AudioParam::setSmoothingConstant): Deleted.
2468         (WebCore::AudioParam::setValueAtTime): Deleted.
2469         (WebCore::AudioParam::linearRampToValueAtTime): Deleted.
2470         (WebCore::AudioParam::exponentialRampToValueAtTime): Deleted.
2471         (WebCore::AudioParam::setTargetAtTime): Deleted.
2472         (WebCore::AudioParam::setValueCurveAtTime): Deleted.
2473         (WebCore::AudioParam::cancelScheduledValues): Deleted.
2474         (WebCore::AudioParam::hasSampleAccurateValues): Deleted.
2475         (WebCore::AudioParam::AudioParam): Deleted.
2476         * Modules/webaudio/AudioParamTimeline.h:
2477         * Modules/webaudio/AudioProcessingEvent.h:
2478         (WebCore::AudioProcessingEvent::create): Deleted.
2479         (WebCore::AudioProcessingEvent::createForBindings): Deleted.
2480         (WebCore::AudioProcessingEvent::inputBuffer): Deleted.
2481         (WebCore::AudioProcessingEvent::outputBuffer): Deleted.
2482         (WebCore::AudioProcessingEvent::playbackTime const): Deleted.
2483         * Modules/webaudio/BiquadDSPKernel.h:
2484         (WebCore::BiquadDSPKernel::BiquadDSPKernel): Deleted.
2485         (WebCore::BiquadDSPKernel::biquadProcessor): Deleted.
2486         * Modules/webaudio/BiquadFilterNode.h:
2487         (WebCore::BiquadFilterNode::create): Deleted.
2488         (WebCore::BiquadFilterNode::frequency): Deleted.
2489         (WebCore::BiquadFilterNode::q): Deleted.
2490         (WebCore::BiquadFilterNode::gain): Deleted.
2491         (WebCore::BiquadFilterNode::detune): Deleted.
2492         (WebCore::BiquadFilterNode::biquadProcessor): Deleted.
2493         * Modules/webaudio/BiquadProcessor.h:
2494         (WebCore::BiquadProcessor::filterCoefficientsDirty const): Deleted.
2495         (WebCore::BiquadProcessor::hasSampleAccurateValues const): Deleted.
2496         (WebCore::BiquadProcessor::parameter1): Deleted.
2497         (WebCore::BiquadProcessor::parameter2): Deleted.
2498         (WebCore::BiquadProcessor::parameter3): Deleted.
2499         (WebCore::BiquadProcessor::parameter4): Deleted.
2500         (WebCore::BiquadProcessor::type const): Deleted.
2501         * Modules/webaudio/ChannelMergerNode.h:
2502         * Modules/webaudio/ChannelSplitterNode.h:
2503         * Modules/webaudio/DelayDSPKernel.h:
2504         (WebCore::DelayDSPKernel::maxDelayTime const): Deleted.
2505         (WebCore::DelayDSPKernel::setDelayFrames): Deleted.
2506         (WebCore::DelayDSPKernel::delayProcessor): Deleted.
2507         * Modules/webaudio/DelayNode.h:
2508         * Modules/webaudio/DelayProcessor.h:
2509         (WebCore::DelayProcessor::delayTime const): Deleted.
2510         (WebCore::DelayProcessor::maxDelayTime): Deleted.
2511         * Modules/webaudio/DynamicsCompressorNode.h:
2512         (WebCore::DynamicsCompressorNode::create): Deleted.
2513         (WebCore::DynamicsCompressorNode::threshold): Deleted.
2514         (WebCore::DynamicsCompressorNode::knee): Deleted.
2515         (WebCore::DynamicsCompressorNode::ratio): Deleted.
2516         (WebCore::DynamicsCompressorNode::attack): Deleted.
2517         (WebCore::DynamicsCompressorNode::release): Deleted.
2518         (WebCore::DynamicsCompressorNode::reduction): Deleted.
2519         * Modules/webaudio/GainNode.h:
2520         (WebCore::GainNode::create): Deleted.
2521         (WebCore::GainNode::gain): Deleted.
2522         * Modules/webaudio/MediaElementAudioSourceNode.h:
2523         (WebCore::MediaElementAudioSourceNode::mediaElement): Deleted.
2524         * Modules/webaudio/MediaStreamAudioDestinationNode.h:
2525         (WebCore::MediaStreamAudioDestinationNode::stream): Deleted.
2526         * Modules/webaudio/MediaStreamAudioSourceNode.h:
2527         (WebCore::MediaStreamAudioSourceNode::mediaStream): Deleted.
2528         * Modules/webaudio/OfflineAudioCompletionEvent.h:
2529         (WebCore::OfflineAudioCompletionEvent::renderedBuffer): Deleted.
2530         * Modules/webaudio/OfflineAudioDestinationNode.h:
2531         (WebCore::OfflineAudioDestinationNode::create): Deleted.
2532         * Modules/webaudio/PannerNode.h:
2533         (WebCore::PannerNode::create): Deleted.
2534         (WebCore::PannerNode::panningModel const): Deleted.
2535         (WebCore::PannerNode::position const): Deleted.
2536         (WebCore::PannerNode::setPosition): Deleted.
2537         (WebCore::PannerNode::orientation const): Deleted.
2538         (WebCore::PannerNode::setOrientation): Deleted.
2539         (WebCore::PannerNode::velocity const): Deleted.
2540         (WebCore::PannerNode::setVelocity): Deleted.
2541         (WebCore::PannerNode::refDistance): Deleted.
2542         (WebCore::PannerNode::setRefDistance): Deleted.
2543         (WebCore::PannerNode::maxDistance): Deleted.
2544         (WebCore::PannerNode::setMaxDistance): Deleted.
2545         (WebCore::PannerNode::rolloffFactor): Deleted.
2546         (WebCore::PannerNode::setRolloffFactor): Deleted.
2547         (WebCore::PannerNode::coneInnerAngle const): Deleted.
2548         (WebCore::PannerNode::setConeInnerAngle): Deleted.
2549         (WebCore::PannerNode::coneOuterAngle const): Deleted.
2550         (WebCore::PannerNode::setConeOuterAngle): Deleted.
2551         (WebCore::PannerNode::coneOuterGain const): Deleted.
2552         (WebCore::PannerNode::setConeOuterGain): Deleted.
2553         (WebCore::PannerNode::distanceGain): Deleted.
2554         (WebCore::PannerNode::coneGain): Deleted.
2555         * Modules/webaudio/PeriodicWave.h:
2556         (WebCore::PeriodicWave::rateScale const): Deleted.
2557         (WebCore::PeriodicWave::periodicWaveSize const): Deleted.
2558         (WebCore::PeriodicWave::sampleRate const): Deleted.
2559         (WebCore::PeriodicWave::numberOfRanges const): Deleted.
2560         * Modules/webaudio/RealtimeAnalyser.h:
2561         * Modules/webaudio/ScriptProcessorNode.h:
2562         (WebCore::ScriptProcessorNode::bufferSize const): Deleted.
2563         (WebCore::ScriptProcessorNode::doubleBufferIndex const): Deleted.
2564         (WebCore::ScriptProcessorNode::swapBuffers): Deleted.
2565         * Modules/webaudio/WaveShaperDSPKernel.h:
2566         (WebCore::WaveShaperDSPKernel::waveShaperProcessor): Deleted.
2567         * Modules/webaudio/WaveShaperProcessor.h:
2568         (WebCore::WaveShaperProcessor::curve): Deleted.
2569         (WebCore::WaveShaperProcessor::oversample const): Deleted.
2570         * dom/MessagePort.h:
2571         * html/FormAssociatedElement.h:
2572         * loader/LinkPreloadResourceClients.h:
2573         * page/WheelEventDeltaFilter.h:
2574         * page/mac/WheelEventDeltaFilterMac.h:
2575         * platform/RemoteCommandListener.h:
2576         * platform/audio/AudioDSPKernel.h:
2577         * platform/audio/AudioProcessor.h:
2578         * platform/audio/PlatformMediaSession.h:
2579         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h:
2580         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h:
2581         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h:
2582         * workers/service/ServiceWorkerContainer.h:
2583
2584 2018-07-09  Simon Fraser  <simon.fraser@apple.com>
2585
2586         Shrink RenderSVGShape
2587         https://bugs.webkit.org/show_bug.cgi?id=187459
2588
2589         Reviewed by Zalan Bujtas.
2590
2591         Shrink RenderSVGShape from 328 to 320 bytes by moving the bits before the AffineTransform,
2592         which is 16-byte aligned. This saves 9.6KB on nytimes.com.
2593
2594         * rendering/svg/RenderSVGShape.h:
2595
2596 2018-07-09  Simon Fraser  <simon.fraser@apple.com>
2597
2598         Shrink CSSFontFace
2599         https://bugs.webkit.org/show_bug.cgi?id=187456
2600
2601         Reviewed by Anders Carlsson.
2602
2603         Shrink CSSFontFace by 56 bytes, from 288 to 256 bytes, mostly by defining enums as 8-bit,
2604         but also re-ordering the member variables. There are over 400 of these objects on nytimes.com,
2605         so this saves about 22KB.
2606
2607         * css/CSSFontFace.cpp:
2608         (WebCore::CSSFontFace::CSSFontFace):
2609         * css/CSSFontFace.h:
2610         * platform/text/TextFlags.h:
2611         * rendering/style/RenderStyleConstants.h:
2612
2613 2018-07-09  Commit Queue  <commit-queue@webkit.org>
2614
2615         Unreviewed, rolling out r233612.
2616         https://bugs.webkit.org/show_bug.cgi?id=187475
2617
2618         Revision caused the api test LinkColorWithSystemAppearance to
2619         fail on all systems. (Requested by Truitt on #webkit).
2620
2621         Reverted changeset:
2622
2623         "Semantic colors don't update when accessibility Increase
2624         Contrast mode is enabled."
2625         https://bugs.webkit.org/show_bug.cgi?id=187425
2626         https://trac.webkit.org/changeset/233612
2627
2628 2018-07-09  Philippe Normand  <pnormand@igalia.com>
2629
2630         [GStreamer] Remove useless workaround
2631         https://bugs.webkit.org/show_bug.cgi?id=186921
2632
2633         Reviewed by Xabier Rodriguez-Calvar.
2634
2635         In bug 67407 a workaround was added for GStreamer 0.10. With 1.x
2636         the media/video-reverse-play-duration.html test passes without any
2637         workaround needed. The other test mentioned in that bug was
2638         removed, it seems.
2639
2640         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2641         (WebCore::MediaPlayerPrivateGStreamer::playbackPosition const):
2642         Removed early return, position queries shouldn't be avoided on EOS
2643         because the pipeline is in READY state, not NULL.
2644         (WebCore::MediaPlayerPrivateGStreamer::currentMediaTime const):
2645
2646 2018-07-08  Simon Fraser  <simon.fraser@apple.com>
2647
2648         Optimize packing of RenderSVGViewportContainer
2649         https://bugs.webkit.org/show_bug.cgi?id=187458
2650
2651         Reviewed by Zalan Bujtas.
2652
2653         Shrink RenderSVGViewportContainer from 296 bytes to 280 bytes, saving about 6KB on nytimes.com.
2654
2655         * rendering/svg/RenderSVGContainer.cpp:
2656         (WebCore::RenderSVGContainer::RenderSVGContainer):
2657         * rendering/svg/RenderSVGContainer.h:
2658         * rendering/svg/RenderSVGViewportContainer.h:
2659
2660 2018-07-08  Simon Fraser  <simon.fraser@apple.com>
2661
2662         Shrink RenderTableSection
2663         https://bugs.webkit.org/show_bug.cgi?id=187457
2664
2665         Reviewed by Zalan Bujtas.
2666
2667         Shrink RenderTableSection from 344 to 336 bytes, saving about 3.6KB on nytimes.com.
2668
2669         * rendering/RenderTableSection.h:
2670
2671 2018-07-08  Simon Fraser  <simon.fraser@apple.com>
2672
2673         Optimize packing of RootInlineBox
2674         https://bugs.webkit.org/show_bug.cgi?id=187430
2675
2676         Reviewed by Zalan Bujtas.
2677
2678         In InlineBox, move the m_logicalWidth float up next to the m_expansion float with m_topLeft next; this
2679         avoids padding of 4 bytes after this float.
2680         
2681         In InlineFlowBox, move the bitfields before the pointers so they can snug up into the
2682         4 bytes after m_expansion in the base class.
2683         
2684         The comment about m_lineBreakPos's padding in RootInlineBox is wrong; just move it to the end
2685         to avoid padding before the m_lineBreakObj pointer.
2686         
2687         Make m_logicalWidth private and have derived classes use the accessor.
2688         
2689         Make EllipsisBox 4 bytes smaller too.
2690
2691         * rendering/EllipsisBox.cpp:
2692         (WebCore::EllipsisBox::EllipsisBox):
2693         (WebCore::EllipsisBox::paintMarkupBox):
2694         (WebCore::EllipsisBox::nodeAtPoint):
2695         * rendering/EllipsisBox.h:
2696         * rendering/InlineBox.h:
2697         (WebCore::InlineBox::InlineBox):
2698         * rendering/InlineFlowBox.cpp:
2699         * rendering/InlineFlowBox.h:
2700         (WebCore::InlineFlowBox::InlineFlowBox):
2701         (WebCore::InlineFlowBox::frameRectIncludingLineHeight const):
2702         * rendering/InlineTextBox.cpp:
2703         (WebCore::InlineTextBox::localSelectionRect const):
2704         (WebCore::InlineTextBox::paint):
2705         (WebCore::InlineTextBox::paintPlatformDocumentMarker):
2706         (WebCore::InlineTextBox::paintMarkedTextBackground):
2707         (WebCore::InlineTextBox::paintCompositionUnderline const):
2708         * rendering/RootInlineBox.cpp:
2709         (WebCore::RootInlineBox::RootInlineBox):
2710         * rendering/RootInlineBox.h:
2711
2712 2018-07-08  Antoine Quint  <graouts@apple.com>
2713
2714         [Web Animations] A number of tests report an incorrect computed offset
2715         https://bugs.webkit.org/show_bug.cgi?id=187410
2716         <rdar://problem/41905790>
2717
2718         Reviewed by Dean Jackson.
2719
2720         While we would correctly avoid computing missing offsets when processing the first keyframe following the last
2721         keyframes with a specified offset, we were forgetting to update the index of the last keyframe with a specified
2722         offset which meant we would accidentally override a specified offset with an automically-computed one.
2723
2724         * animation/KeyframeEffectReadOnly.cpp:
2725         (WebCore::computeMissingKeyframeOffsets):
2726
2727 2018-07-08  David Kilzer  <ddkilzer@apple.com>
2728
2729         DOMMatrix.invertSelf() returns garbage values for a non-invertible matrix
2730         <https://webkit.org/b/187446>
2731         <rdar://problem/41853187>
2732
2733         Reviewed by Daniel Bates.
2734
2735         Test: http/wpt/css/geometry/DOMMatrix-invertSelf.html
2736
2737         * css/DOMMatrix.cpp:
2738         (WebCore::DOMMatrix::invertSelf): Add missing `else`, and
2739         restructure to use positive logic.
2740
2741 2018-07-07  Wenson Hsieh  <wenson_hsieh@apple.com>
2742
2743         Introduce a layout milestone to track when the document contains a large number of rendered characters
2744         https://bugs.webkit.org/show_bug.cgi?id=187412
2745         <rdar://problem/41744338>
2746
2747         Reviewed by Ryosuke Niwa.
2748
2749         Implements a new layout milestone: `DidRenderSignificantAmountOfText`. This is similar to the existing
2750         `DidFirstVisuallyNonEmptyLayout` milestone, but with a few important additional constraints:
2751
2752         • The minimum threshold of rendered characters is much larger (3000 instead of 200).
2753         • The mean length of a text node must be large (at least 50).
2754
2755         This is a (computationally) lightweight heuristic intended to estimate the likelihood that a page is capable of
2756         being presented in Reader mode. In many article-like pages, the average length of a text node is significantly
2757         longer than other types of pages; thus, on pages where the average length of a text node is very large *and*
2758         there is a large quantity of text, we can use this as a cue to opportunistically detect and enter Safari reader
2759         mode on watchOS.
2760
2761         Test: RenderingProgressTests.DidRenderSignificantAmountOfText
2762
2763         * page/FrameView.cpp:
2764         (WebCore::FrameView::reset):
2765
2766         Clear out new state members that keep track of whether the significant rendered text milestone has been met.
2767
2768         (WebCore::elementOverflowRectIsLargerThanThreshold):
2769
2770         Factor out logic to grab the overflow height of an element into a separate helper function.
2771
2772         (WebCore::FrameView::qualifiesAsVisuallyNonEmpty const):
2773         (WebCore::FrameView::updateSignificantRenderedTextMilestoneIfNeeded):
2774
2775         Determines whether to fire this new milestone after the next layout pass is finished. The logic here is similar
2776         to the logic in qualifiesAsVisuallyNonEmpty, requiring that there are not still pending stylesheets in the head
2777         and that the document height is at least a minimum threshold. However, unlike the first visually non-empty
2778         layout, this milestone is never guaranteed to fire.
2779
2780         (WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
2781         * page/FrameView.h:
2782         (WebCore::FrameView::incrementVisuallyNonEmptyCharacterCount):
2783         * page/LayoutMilestones.h:
2784
2785 2018-07-06  Timothy Hatcher  <timothy@apple.com>
2786
2787         Semantic colors don't update when accessibility Increase Contrast mode is enabled.
2788         https://bugs.webkit.org/show_bug.cgi?id=187425
2789         rdar://problem/39948240
2790
2791         Reviewed by Tim Horton.
2792
2793         Added a listener for the accessibility change notification to invalidate our color caches.
2794
2795         Removed calls to RenderTheme::singleton().platformColorsDidChange() in Page, since that
2796         ended up calling Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment multiple times.
2797         Instead, changed the functions to use the new instance version instead.
2798
2799         * page/Page.cpp:
2800         (WebCore::Page::updateStyleAfterChangeInEnvironment): Added. Gives Page a direct way to do this work
2801         per instance instead of on all pages (since appearance can be difference per view).
2802         (WebCore::Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment): Call updateStyleAfterChangeInEnvironment.
2803         (WebCore::Page::setUseSystemAppearance): Call updateStyleAfterChangeInEnvironment.
2804         (WebCore::Page::setUseDarkAppearance): Added. Call updateStyleAfterChangeInEnvironment.
2805         * page/Page.h:
2806         (WebCore::Page::setUseDarkAppearance): Moved to the implementation file.
2807         * platform/mac/LocalDefaultSystemAppearance.mm:
2808         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): Removed recursive check since it was interfering
2809         with the setting of m_usingDarkAppearance and causing the wrong color cache to be used.
2810         (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance): Ditto.
2811         * rendering/RenderThemeMac.mm:
2812         (-[WebCoreRenderThemeNotificationObserver init]): Listen for NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification.
2813         (-[WebCoreRenderThemeNotificationObserver systemColorsDidChange:]): Removed assert since multiple notifications are used now.
2814
2815 2018-07-06  Ryosuke Niwa  <rniwa@webkit.org>
2816
2817         Make ReasonForSuspension enum class
2818         https://bugs.webkit.org/show_bug.cgi?id=187405
2819
2820         Reviewed by Zalan Bujtas.
2821
2822         Made ReasonForSuspension an enum class instead of enum and moved out of ActiveDOMObject.
2823
2824         * Modules/geolocation/Geolocation.cpp:
2825         (WebCore::Geolocation::suspend):
2826         * Modules/websockets/WebSocket.cpp:
2827         (WebCore::WebSocket::suspend):
2828         * dom/ActiveDOMObject.h:
2829         * dom/Document.cpp:
2830         (WebCore::Document::didBecomeCurrentDocumentInFrame):
2831         (WebCore::Document::suspendActiveDOMObjects):
2832         (WebCore::Document::resumeActiveDOMObjects):
2833         (WebCore::Document::suspend):
2834         (WebCore::Document::resume):
2835         (WebCore::Document::suspendScheduledTasks):
2836         (WebCore::Document::resumeScheduledTasks):
2837         * dom/Document.h:
2838         * dom/ScriptExecutionContext.cpp:
2839         (WebCore::ScriptExecutionContext::suspendActiveDOMObjects):
2840         (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
2841         * dom/ScriptExecutionContext.h:
2842         (WebCore::ScriptExecutionContext::reasonForSuspendingActiveDOMObjects const):
2843         * history/CachedFrame.cpp:
2844         (WebCore::CachedFrameBase::restore):
2845         (WebCore::CachedFrame::CachedFrame):
2846         * html/HTMLMediaElement.cpp:
2847         (WebCore::HTMLMediaElement::suspend):
2848         * html/HTMLSourceElement.cpp:
2849         (WebCore::HTMLSourceElement::suspend):
2850         * inspector/PageScriptDebugServer.cpp:
2851         (WebCore::PageScriptDebugServer::setJavaScriptPaused):
2852         * loader/FrameLoader.cpp:
2853         (WebCore::FrameLoader::commitProvisionalLoad):
2854         * page/Frame.cpp:
2855         (WebCore::Frame::suspendActiveDOMObjectsAndAnimations):
2856         (WebCore::Frame::resumeActiveDOMObjectsAndAnimations):
2857         * page/PageGroupLoadDeferrer.cpp:
2858         (WebCore::PageGroupLoadDeferrer::PageGroupLoadDeferrer):
2859         (WebCore::PageGroupLoadDeferrer::~PageGroupLoadDeferrer):
2860         * xml/XMLHttpRequest.cpp:
2861         (WebCore::XMLHttpRequest::suspend):
2862
2863 2018-07-06  Nan Wang  <n_wang@apple.com>
2864
2865         AX: add a subrole for meter elements on macOS
2866         https://bugs.webkit.org/show_bug.cgi?id=187409
2867         <rdar://problem/41905702>
2868
2869         Reviewed by Chris Fleizach.
2870
2871         Test: accessibility/mac/meter-subrole.html
2872
2873         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2874         (-[WebAccessibilityObjectWrapper subrole]):
2875
2876 2018-07-06  Jeremy Jones  <jeremyj@apple.com>
2877
2878         For <video> element, use video fullscreen instead of element fullscreen.
2879         https://bugs.webkit.org/show_bug.cgi?id=186093
2880         rdar://problem/40144751
2881
2882         Reviewed by Jer Noble.
2883
2884         Some pages use webkitRequestFullscreen directly on the video element, without any custom controls.
2885         This will prevent native fullscreeen presentation mode conrols from being used.
2886
2887         This change makes webkitRequestFullscreen on a video element call webKitSetPresentationMode.
2888
2889         * dom/Element.h:
2890         * html/HTMLVideoElement.cpp:
2891         (WebCore::HTMLVideoElement::webkitRequestFullscreen):
2892         * html/HTMLVideoElement.h:
2893
2894 2018-07-06  Youenn Fablet  <youenn@apple.com>
2895
2896         WebRTC MediaStreamTrack Enable / Disable causes video delay / lag
2897         https://bugs.webkit.org/show_bug.cgi?id=186889
2898         <rdar://problem/41370285>
2899
2900         Reviewed by Eric Carlson.
2901
2902         Libwebrtc expects a continuous flow of calls for audio data since the API
2903         does not provide any possiblity to give timestamps.
2904
2905         We were optimizing previously when a source is muted so that we would not transmit audio data.
2906         This breaks synchronization between audio and video frames (which are timestamped).
2907
2908         This patch reverts the optimization and instead makes sure to send zeros for silenced audio tracks.
2909
2910         This requires MediaStreamTrackPrivate to send audio data even if disabled,
2911         so that RealtimeOutgoingAudioSource will continue sending zeros at the correct pace.
2912         This also requires WebAudioSourceProviderAVFObjC to exit early if its track is disabled.
2913
2914         Covered by existing tests.
2915         Manual testing shows that synchronization is kept.
2916
2917         * platform/mediastream/MediaStreamTrackPrivate.cpp:
2918         (WebCore::MediaStreamTrackPrivate::audioSamplesAvailable):
2919         * platform/mediastream/RealtimeOutgoingAudioSource.cpp:
2920         (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
2921         (WebCore::RealtimeOutgoingAudioSource::initializeConverter):
2922         (WebCore::RealtimeOutgoingAudioSource::stop):
2923         (WebCore::RealtimeOutgoingAudioSource::sourceMutedChanged):
2924         (WebCore::RealtimeOutgoingAudioSource::sourceEnabledChanged):
2925         (WebCore::RealtimeOutgoingAudioSource::handleMutedIfNeeded): Deleted.
2926         * platform/mediastream/RealtimeOutgoingAudioSource.h:
2927         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
2928         (WebCore::RealtimeOutgoingAudioSource::isSilenced const):
2929         (WebCore::RealtimeOutgoingAudioSource::sendSilence): Deleted.
2930         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp:
2931         (WebCore::RealtimeOutgoingAudioSourceCocoa::pullAudioData):
2932         (WebCore::RealtimeOutgoingAudioSourceCocoa::handleMutedIfNeeded): Deleted.
2933         (WebCore::RealtimeOutgoingAudioSourceCocoa::sendSilence): Deleted.
2934         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.h:
2935         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
2936         (WebCore::WebAudioSourceProviderAVFObjC::audioSamplesAvailable):
2937
2938 2018-07-06  Youenn Fablet  <youenn@apple.com>
2939
2940         Make RealtimeOutgoingVideoSource use DestructionThread::Main
2941         https://bugs.webkit.org/show_bug.cgi?id=187402
2942
2943         Reviewed by Chris Dumez.
2944
2945         No change of behavior.
2946
2947         * platform/mediastream/RealtimeOutgoingVideoSource.h:
2948
2949 2018-07-06  Ryosuke Niwa  <rniwa@webkit.org>
2950
2951         Make HTMLMediaElement::remove*Track take a Ref<>&&
2952         https://bugs.webkit.org/show_bug.cgi?id=187407
2953
2954         Reviewed by Zalan Bujtas.
2955
2956         Make these functions take Ref<>&& since they can delete track objects.
2957
2958         * html/HTMLMediaElement.cpp:
2959         (WebCore::HTMLMediaElement::removeAudioTrack):
2960         (WebCore::HTMLMediaElement::removeTextTrack):
2961         (WebCore::HTMLMediaElement::removeVideoTrack):
2962         (WebCore::HTMLMediaElement::forgetResourceSpecificTracks):
2963         * html/HTMLMediaElement.h:
2964
2965 2018-07-06  Antoine Quint  <graouts@apple.com>
2966
2967         [Web Animations] Make WPT test at interfaces/KeyframeEffect/processing-a-keyframes-argument-002.html pass reliably
2968         https://bugs.webkit.org/show_bug.cgi?id=186502
2969         <rdar://problem/41000229>l
2970
2971         Reviewed by Dean Jackson.
2972
2973         Ensure we only attempt to convert defined objects or we risk to throw errors in valid situations.
2974
2975         * animation/KeyframeEffectReadOnly.cpp:
2976         (WebCore::processKeyframeLikeObject):
2977
2978 2018-07-05  Antoine Quint  <graouts@apple.com>
2979
2980         [Web Animations] Make WPT test at interfaces/Animation/finish.html pass reliably
2981         https://bugs.webkit.org/show_bug.cgi?id=186496
2982         <rdar://problem/41000179>
2983
2984         Reviewed by Dean Jackson.
2985
2986         We used to only resolve animations that had a target element, but animations need not have a target and their
2987         current time should still advance so that their finished promise may resolve. We now maintain a list of animations
2988         without targets and we iterate through them as well as animations with targets in DocumentTimeline::updateAnimations().
2989
2990         * animation/AnimationTimeline.cpp:
2991         (WebCore::AnimationTimeline::addAnimation):
2992         (WebCore::AnimationTimeline::removeAnimation):
2993         (WebCore::AnimationTimeline::animationWasAddedToElement):
2994         (WebCore::AnimationTimeline::animationWasRemovedFromElement):
2995         * animation/AnimationTimeline.h:
2996         (WebCore::AnimationTimeline:: const):
2997         * animation/DocumentTimeline.cpp:
2998         (WebCore::DocumentTimeline::updateAnimations):
2999         * animation/WebAnimation.cpp:
3000         (WebCore::WebAnimation::resolve):
3001         * animation/WebAnimation.h:
3002
3003 2018-07-05  Antoine Quint  <graouts@apple.com>
3004
3005         [Web Animations] Make WPT test at interfaces/Animation/finished.html pass reliably
3006         https://bugs.webkit.org/show_bug.cgi?id=186497
3007         <rdar://problem/41000193>
3008
3009         Reviewed by Dean Jackson.
3010
3011         We need to ensure the finished state is updated as a result of any timing property changing.
3012
3013         * animation/AnimationEffectReadOnly.cpp:
3014         (WebCore::AnimationEffectReadOnly::timingDidChange):
3015         * animation/WebAnimation.cpp:
3016         (WebCore::WebAnimation::effectTimingPropertiesDidChange):
3017         * animation/WebAnimation.h:
3018
3019 2018-07-06  Antoine Quint  <graouts@apple.com>
3020
3021         [Web Animations] Using a Web Animation leaks the Document
3022         https://bugs.webkit.org/show_bug.cgi?id=187088
3023         <rdar://problem/41392046>
3024
3025         Reviewed by Darin Adler.
3026
3027         Test: webanimations/leak-document-with-web-animation.html
3028
3029         We need to ensure that any remaining animation is cleared when the DocumentTimeline is detached from its Document.
3030         We rename WebAnimation::prepareAnimationForRemoval() to WebAnimation::remove() since it really actively disassociates
3031         the animation from its timeline.
3032
3033         An earlier version of this patch (r233349) was rolled out due to crashes caught in the ASan configuration. The following
3034         changes were made to make it safe:
3035
3036         - We protect the DocumentAnimationScheduler instance in displayRefreshFired() against code that might run in a
3037         requestAnimationFrame() callback that would trigger the object to be deleted.
3038
3039         - We protect the WebAnimation instance in remove() against setEffectInternal() or setTimelineInternal() potentially
3040         causing the object to be deleted. Similar protections were addede to setEffect() and setTimeline().
3041
3042         - We changed ~DocumentTimeline() to a default implementation to ensure it calls ~DisplayRefreshMonitorClient()
3043         to avoid callbacks after the object has been marked for deletion.
3044
3045
3046         * animation/AnimationTimeline.cpp:
3047         (WebCore::AnimationTimeline::removeAnimationsForElement): We no longer need the call to removeAnimation()
3048         since the new WebAnimation::remove() method will also set the timeline to null which will eventually call
3049         removeAnimation() on the disassociated timeline.
3050         * animation/DeclarativeAnimation.cpp:
3051         (WebCore::DeclarativeAnimation::remove):
3052         (WebCore::DeclarativeAnimation::prepareAnimationForRemoval): Deleted.
3053         * animation/DeclarativeAnimation.h:
3054         * animation/DocumentAnimationScheduler.cpp:
3055         (WebCore::DocumentAnimationScheduler::displayRefreshFired):
3056         * animation/DocumentTimeline.cpp:
3057         (WebCore::DocumentTimeline::detachFromDocument): Call remove() on all known animations.
3058         (WebCore::DocumentTimeline::~DocumentTimeline): Deleted.
3059         * animation/WebAnimation.cpp:
3060         (WebCore::WebAnimation::remove): Set the timeline to null to fully disassociate this animation from its timeline.
3061         (WebCore::WebAnimation::setEffect):
3062         (WebCore::WebAnimation::setEffectInternal):
3063         (WebCore::WebAnimation::setTimeline): Factor the internal timeline-association code out of this JS API method so
3064         that we can call this code without any JS-facing implications.
3065         (WebCore::WebAnimation::setTimelineInternal):
3066         (WebCore::WebAnimation::prepareAnimationForRemoval): Deleted.
3067         * animation/WebAnimation.h:
3068
3069 2018-07-06  Daniel Bates  <dabates@apple.com>
3070
3071         Remove Strong Confirmation Password button
3072         https://bugs.webkit.org/show_bug.cgi?id=187306
3073         <rdar://problem/41795185>
3074
3075         Reviewed by Sam Weinig.
3076
3077         Remove support for the Strong Confirmation Password button because we never made use of it.
3078
3079         * English.lproj/Localizable.strings:
3080         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
3081         (-[WebAccessibilityObjectWrapper _accessibilityIsStrongPasswordField]):
3082         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3083         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
3084         * html/HTMLInputElement.h:
3085         (WebCore::HTMLInputElement::hasAutoFillStrongPasswordButton const):
3086         * html/HTMLTextFormControlElement.h:
3087         * html/TextFieldInputType.cpp:
3088         (WebCore::autoFillButtonTypeToAccessibilityLabel):
3089         (WebCore::autoFillButtonTypeToAutoFillButtonText):
3090         (WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName):
3091         (WebCore::isAutoFillButtonTypeChanged):
3092         * platform/LocalizedStrings.cpp:
3093         (WebCore::AXAutoFillStrongConfirmationPasswordLabel): Deleted.
3094         * platform/LocalizedStrings.h:
3095         * rendering/RenderTextControlSingleLine.cpp:
3096         (WebCore::RenderTextControlSingleLine::layout):
3097         * testing/Internals.cpp:
3098         (WebCore::toAutoFillButtonType):
3099         (WebCore::toInternalsAutoFillButtonType):
3100         * testing/Internals.h:
3101         * testing/Internals.idl:
3102
3103 2018-07-06  Carlos Garcia Campos  <cgarcia@igalia.com>
3104
3105         [GTK][WPE] REGRESSION(r233239): proxy settings not applied after r233239
3106         https://bugs.webkit.org/show_bug.cgi?id=187381
3107
3108         Reviewed by Yusuke Suzuki.
3109
3110         This is because the static variable for proxy settings was replaced by a NeverDestroyed, but the function is not
3111         returning a reference, but a copy. This is causing several unit tests to fail.
3112
3113         * platform/network/soup/SoupNetworkSession.cpp:
3114         (WebCore::proxySettings):
3115
3116 2018-07-06  Frederic Wang  <fwang@igalia.com>
3117
3118         [Crash] Illegal use of uninitialized std::optional value in WebCore::AnimationBase::updateStateMachine
3119         https://bugs.webkit.org/show_bug.cgi?id=187382
3120
3121         Reviewed by Carlos Garcia Campos.
3122
3123         WebCore::AnimationBase::updateStateMachine has two potential places where the use of an
3124         uninitialized std:optional value is possible and one of them is hit when using Google drive.
3125         Since that old animation code is going to be removed soon, we just quickly patch this issue
3126         via value_or() so that we can restore the ASSERT added in bug 186536.
3127
3128         No new tests, code is going to be removed soon.
3129
3130         * page/animation/AnimationBase.cpp:
3131         (WebCore::AnimationBase::updateStateMachine): Use value_or(0) to avoid potential crashes.
3132
3133 2018-07-06  Frederic Wang  <fwang@igalia.com>
3134
3135         Rename HTMLTreeBuilder::didCreateCustomOrCallbackElement
3136         https://bugs.webkit.org/show_bug.cgi?id=187317
3137
3138         Reviewed by Ryosuke Niwa.
3139
3140         This function is called with a new custom element or the fallback HTMLUnknownElement element
3141         so we rename it didCreateCustomOrFallbackElement.
3142
3143         No new tests, behavior unchanged.
3144
3145         * html/parser/HTMLDocumentParser.cpp:
3146         (WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder):
3147         * html/parser/HTMLTreeBuilder.cpp:
3148         (WebCore::HTMLTreeBuilder::didCreateCustomOrFallbackElement):
3149         (WebCore::HTMLTreeBuilder::didCreateCustomOrCallbackElement): Deleted.
3150         * html/parser/HTMLTreeBuilder.h:
3151
3152 2018-07-05  Ryosuke Niwa  <rniwa@webkit.org>
3153
3154         REGRESSION(r233496): macOS Sierra hits debug assertions in TrackListBase::suspend
3155         https://bugs.webkit.org/show_bug.cgi?id=187378
3156         <rdar://problem/41878885>
3157
3158         Reviewed by Eric Carlson.
3159
3160         These assertions were wrong since inline debugger, alert, etc... can suspend active DOM objects without
3161         calling canSuspendForDocumentSuspension. Fixed the bug by removing the assertion and instead suspending
3162         and resuming the generic event queue.
3163
3164         * Modules/mediasource/MediaSource.cpp:
3165         (WebCore::MediaSource::suspend):
3166         (WebCore::MediaSource::resume):
3167         * Modules/mediasource/SourceBuffer.cpp:
3168         (WebCore::SourceBuffer::suspend):
3169         (WebCore::SourceBuffer::resume):
3170         * Modules/mediasource/SourceBufferList.cpp:
3171         (WebCore::SourceBufferList::suspend):
3172         (WebCore::SourceBufferList::resume):
3173         * html/track/TrackListBase.cpp:
3174         (WebCore::TrackListBase::suspend):
3175         (WebCore::TrackListBase::resume):
3176
3177 2018-07-05  Youenn Fablet  <youenn@apple.com>
3178
3179         REGRESSION (r230843): Flash doesn't work; Produces blue box on page
3180         https://bugs.webkit.org/show_bug.cgi?id=187346
3181         <rdar://problem/41773974>
3182
3183         Reviewed by Ryosuke Niwa.
3184
3185         Introduce clearPagesPluginData used by WebProcess when a plugin policy changes.
3186         Add a new internals API to get the plugin count as navigator.plugin is filtering plugins.
3187
3188         Test: http/tests/plugins/plugin-allow-then-reload.html
3189
3190         * plugins/PluginData.h:
3191         * plugins/PluginInfoProvider.cpp:
3192         (WebCore::PluginInfoProvider::clearPagesPluginData):
3193         * plugins/PluginInfoProvider.h:
3194         * testing/Internals.cpp:
3195         (WebCore::Internals::pluginCount):
3196         * testing/Internals.h:
3197         * testing/Internals.idl:
3198
3199 2018-07-05  Brady Eidson  <beidson@apple.com>
3200
3201         IndexedDB operations in a Page fail after a StorageProcess crash.
3202         <rdar://problem/41626526> and https://bugs.webkit.org/show_bug.cgi?id=187123
3203
3204         Reviewed by Alex Christensen.
3205
3206         Test: storage/indexeddb/modern/opendatabase-after-storage-crash.html
3207
3208         When the connection to a StorageProcess goes away, explicitly tell all of the WebPages
3209         in the WebProcess about it.
3210         
3211         This puts Documents/Workers in an error mode where requests fail instead of timeout.
3212         It also clears the Page's connection so *new* Documents and Workers will get a fresh 
3213         new connection that works.
3214         
3215         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
3216         (WebCore::IDBClient::IDBConnectionToServer::callResultFunctionLater):
3217         (WebCore::IDBClient::IDBConnectionToServer::deleteDatabase):
3218         (WebCore::IDBClient::IDBConnectionToServer::openDatabase):
3219         (WebCore::IDBClient::IDBConnectionToServer::createObjectStore):
3220         (WebCore::IDBClient::IDBConnectionToServer::deleteObjectStore):
3221         (WebCore::IDBClient::IDBConnectionToServer::renameObjectStore):
3222         (WebCore::IDBClient::IDBConnectionToServer::clearObjectStore):
3223         (WebCore::IDBClient::IDBConnectionToServer::createIndex):
3224         (WebCore::IDBClient::IDBConnectionToServer::deleteIndex):
3225         (WebCore::IDBClient::IDBConnectionToServer::renameIndex):
3226         (WebCore::IDBClient::IDBConnectionToServer::putOrAdd):
3227         (WebCore::IDBClient::IDBConnectionToServer::getRecord):
3228         (WebCore::IDBClient::IDBConnectionToServer::getAllRecords):
3229         (WebCore::IDBClient::IDBConnectionToServer::getCount):
3230         (WebCore::IDBClient::IDBConnectionToServer::deleteRecord):
3231         (WebCore::IDBClient::IDBConnectionToServer::openCursor):
3232         (WebCore::IDBClient::IDBConnectionToServer::iterateCursor):
3233         (WebCore::IDBClient::IDBConnectionToServer::establishTransaction):
3234         (WebCore::IDBClient::IDBConnectionToServer::commitTransaction):
3235         (WebCore::IDBClient::IDBConnectionToServer::didFinishHandlingVersionChangeTransaction):
3236         (WebCore::IDBClient::IDBConnectionToServer::abortTransaction):
3237         (WebCore::IDBClient::IDBConnectionToServer::didFireVersionChangeEvent):
3238         (WebCore::IDBClient::IDBConnectionToServer::confirmDidCloseFromServer):
3239         (WebCore::IDBClient::IDBConnectionToServer::connectionToServerLost):
3240         (WebCore::IDBClient::IDBConnectionToServer::openDBRequestCancelled):
3241         (WebCore::IDBClient::IDBConnectionToServer::databaseConnectionPendingClose):
3242         (WebCore::IDBClient::IDBConnectionToServer::databaseConnectionClosed):
3243         (WebCore::IDBClient::IDBConnectionToServer::abortOpenAndUpgradeNeeded):
3244         (WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNames):
3245         * Modules/indexeddb/client/IDBConnectionToServer.h:
3246
3247         * Modules/indexeddb/shared/IDBError.h:
3248         (WebCore::IDBError::serverConnectionLostError):
3249
3250         * page/Page.cpp:
3251         (WebCore::Page::setSessionID):
3252         (WebCore::Page::idbConnection):
3253         (WebCore::Page::optionalIDBConnection):
3254         (WebCore::Page::clearIDBConnection):
3255         * page/Page.h:
3256
3257 2018-07-05  Ryosuke Niwa  <rniwa@webkit.org>
3258
3259         Youtube video pages crash after a couple of minutes
3260         https://bugs.webkit.org/show_bug.cgi?id=187316
3261
3262         Reviewed by Antti Koivisto.
3263
3264         The crash was caused by HTMLMediaElement::stopWithoutDestroyingMediaPlayer invoking updatePlaybackControlsManager,
3265         which traverses all media players across different documents including the one in the main frame while its iframe
3266         is getting removed (to update the Touch Bar's media control).
3267
3268         Fixed the bug by making this code async in both stopWithoutDestroyingMediaPlayer and ~HTMLMediaElement. To do this,
3269         this patch moves the timer to update the playback controls manager from HTMLMediaElement to Page since scheduling
3270         a timer owned by HTMLMediaElement in its destructor wouldn't work as the timer would get destructed immediately.
3271
3272         Also replaced the call to clientWillPausePlayback by a call to stopSession in stopWithoutDestroyingMediaPlayer
3273         since the former also updates the layout synchronously via updateNowPlayingInfo; the latter function schedules
3274         a timer via scheduleUpdateNowPlayingInfo instead.
3275
3276         Test: media/remove-video-best-media-element-in-main-frame-crash.html
3277
3278         * html/HTMLMediaElement.cpp:
3279         (WebCore::HTMLMediaElement::~HTMLMediaElement): Call scheduleUpdatePlaybackControlsManager now that timer has been
3280         moved to Page.
3281         (WebCore::HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager): Made this return a RefPtr instead of
3282         a raw pointer while we're at it.
3283         (WebCore::HTMLMediaElement::clearMediaPlayer): Call scheduleUpdatePlaybackControlsManager.
3284         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer): Ditto. Also invoke stopSession instead of
3285         clientWillPausePlayback on MediaSession since clientWillPausePlayback will synchronously try to update the layout.
3286         (WebCore::HTMLMediaElement::contextDestroyed):
3287         (WebCore::HTMLMediaElement::stop):
3288         (WebCore::HTMLMediaElement::schedulePlaybackControlsManagerUpdate): Renamed from scheduleUpdatePlaybackControlsManager.
3289         (WebCore::HTMLMediaElement::updatePlaybackControlsManager): Moved to Page::playbackControlsManagerUpdateTimerFired.
3290         * html/HTMLMediaElement.h:
3291         * page/Page.cpp:
3292         (WebCore::Page::Page):
3293         (WebCore::Page::schedulePlaybackControlsManagerUpdate): Added.
3294         (WebCore::Page::playbackControlsManagerUpdateTimerFired): Moved from HTMLMediaElement::updatePlaybackControlsManager.
3295         * page/Page.h:
3296         * testing/Internals.cpp:
3297         (WebCore::Internals::bestMediaElementForShowingPlaybackControlsManager):
3298         * testing/Internals.h:
3299
3300 2018-07-05  Ryosuke Niwa  <rniwa@webkit.org>
3301
3302         REGRESSION(r233496): Crash in WebCore::VideoTrack::clearClient()
3303         https://bugs.webkit.org/show_bug.cgi?id=187377
3304
3305         Reviewed by Simon Fraser.
3306
3307         Clear m_client of an audio track or a video track before removing it from the list
3308         since TrackListBase::m_inbandTracks may hold the last ref to the track.
3309
3310         * html/HTMLMediaElement.cpp:
3311         (WebCore::HTMLMediaElement::removeAudioTrack):
3312         (WebCore::HTMLMediaElement::removeVideoTrack):
3313
3314 2018-07-05  Fujii Hironori  <Hironori.Fujii@sony.com>
3315
3316         REGRESSION(r233495) [cairo] drawGlyphsShadow should use the fast path for zero blur-radius
3317         https://bugs.webkit.org/show_bug.cgi?id=187336
3318
3319         Reviewed by Carlos Garcia Campos.
3320
3321         drawGlyphsShadow has a fast path to draw a shadow without a shadow
3322         layer. Since r233495, it is not used for zero blur-radius shadow.
3323
3324         In Bug 187244, I changed ShadowState::isRequired not to check
3325         blur-radius is zero. This is not a right fix.
3326
3327         This change reverts r233495.
3328
3329         No new tests (Covered by existing tests).
3330
3331         * platform/graphics/cairo/CairoOperations.cpp:
3332         (WebCore::Cairo::ShadowState::isRequired const): Return false if
3333         'blur' is zero.
3334         (WebCore::Cairo::fillRectWithRoundedHole): Use
3335         ShadowState::isVisible instead of ShadowState::isRequired to check
3336         a shadow should be drawn.
3337
3338 2018-07-05  Timothy Hatcher  <timothy@apple.com>
3339
3340         Rename and flip the meaning of defaultAppearance to be useDarkAppearance.
3341         https://bugs.webkit.org/show_bug.cgi?id=187369
3342         rdar://problem/41870420
3343
3344         Reviewed by Tim Horton.
3345
3346         * Modules/mediasession/WebMediaSessionManager.cpp:
3347         (WebCore::WebMediaSessionManager::showPlaybackTargetPicker):
3348         * css/MediaQueryEvaluator.cpp:
3349         (WebCore::prefersDarkInterfaceEvaluate):
3350         * css/StyleColor.h:
3351         * dom/Document.cpp:
3352         (WebCore::Document::useDarkAppearance const):
3353         (WebCore::Document::styleColorOptions const):
3354         (WebCore::Document::useDefaultAppearance const): Deleted.
3355         * dom/Document.h:
3356         * inspector/InspectorOverlay.cpp:
3357         (WebCore::InspectorOverlay::paint):
3358         * page/Page.cpp:
3359         (WebCore::Page::useDarkAppearance const):
3360         (WebCore::Page::defaultAppearance const): Deleted.
3361         * page/Page.h:
3362         (WebCore::Page::setUseDarkAppearance):
3363         (WebCore::Page::setDefaultAppearance): Deleted.
3364         * platform/Theme.h:
3365         * platform/graphics/MediaPlaybackTargetPicker.h:
3366         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h:
3367         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
3368         (WebCore::MediaPlaybackTargetPickerMac::showPlaybackTargetPicker):
3369         * platform/mac/DragImageMac.mm:
3370         (WebCore::createDragImageForLink):
3371         * platform/mac/LocalDefaultSystemAppearance.h:
3372         * platform/mac/LocalDefaultSystemAppearance.mm:
3373         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
3374         * platform/mac/ThemeMac.h:
3375         * platform/mac/ThemeMac.mm:
3376         (WebCore::ThemeMac::paint):
3377         * platform/mock/MediaPlaybackTargetPickerMock.cpp:
3378         (WebCore::MediaPlaybackTargetPickerMock::showPlaybackTargetPicker):
3379         * platform/mock/MediaPlaybackTargetPickerMock.h:
3380         * rendering/InlineTextBox.cpp:
3381         (WebCore::InlineTextBox::resolveStyleForMarkedText):
3382         * rendering/RenderLayerBacking.cpp:
3383         (WebCore::RenderLayerBacking::paintContents):
3384         * rendering/RenderLayerCompositor.cpp:
3385         (WebCore::RenderLayerCompositor::paintContents):
3386         * rendering/RenderTheme.cpp:
3387         (WebCore::RenderTheme::paint):
3388         * rendering/RenderThemeMac.mm:
3389         (WebCore::RenderThemeMac::documentViewFor const):
3390         (WebCore::RenderThemeMac::platformActiveSelectionBackgroundColor const):
3391         (WebCore::RenderThemeMac::platformInactiveSelectionBackgroundColor const):
3392         (WebCore::RenderThemeMac::supportsSelectionForegroundColors const):
3393         (WebCore::RenderThemeMac::platformActiveSelectionForegroundColor const):
3394         (WebCore::RenderThemeMac::platformInactiveSelectionForegroundColor const):
3395         (WebCore::RenderThemeMac::platformActiveListBoxSelectionBackgroundColor const):
3396         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const):
3397         (WebCore::RenderThemeMac::platformActiveListBoxSelectionForegroundColor const):
3398         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionForegroundColor const):
3399         (WebCore::RenderThemeMac::platformActiveTextSearchHighlightColor const):
3400         (WebCore::RenderThemeMac::colorCache const):
3401         (WebCore::RenderThemeMac::systemColor const):
3402         (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary):
3403         (WebCore::RenderThemeMac::paintSliderThumb):
3404         * svg/graphics/SVGImage.cpp:
3405         (WebCore::SVGImage::draw):
3406
3407 2018-07-05  Commit Queue  <commit-queue@webkit.org>
3408
3409         Unreviewed, rolling out r233539.
3410         https://bugs.webkit.org/show_bug.cgi?id=187368
3411
3412         Changes made for youtube crashes has caused 15 api failures
3413         (Requested by Truitt on #webkit).
3414
3415         Reverted changeset:
3416
3417         "Youtube video pages crash after a couple of minutes"
3418         https://bugs.webkit.org/show_bug.cgi?id=187316
3419         https://trac.webkit.org/changeset/233539
3420
3421 2018-07-05  Chris Dumez  <cdumez@apple.com>
3422
3423         Update Element API to use qualifiedName instead of name/localName where applicable
3424         https://bugs.webkit.org/show_bug.cgi?id=187347
3425
3426         Reviewed by Darin Adler.
3427
3428         Update Element API to use qualifiedName instead of name/localName where applicable. Naming
3429         is now consistent with the IDL and the specification:
3430         - https://dom.spec.whatwg.org/#element
3431
3432         Our implementation properly deals with qualified names already, even though the parameters
3433         were named localName.
3434
3435         * dom/Element.cpp:
3436         (WebCore::Element::getAttribute const):
3437         (WebCore::Element::toggleAttribute):
3438         (WebCore::Element::setAttribute):
3439         (WebCore::Element::removeAttribute):
3440         (WebCore::Element::getAttributeNode):
3441         (WebCore::Element::hasAttribute const):
3442         * dom/Element.h:
3443
3444 2018-07-04  Ryosuke Niwa  <rniwa@webkit.org>
3445
3446         Youtube video pages crash after a couple of minutes
3447         https://bugs.webkit.org/show_bug.cgi?id=187316
3448
3449         Reviewed by Antti Koivisto.
3450
3451         The crash was caused by HTMLMediaElement::stopWithoutDestroyingMediaPlayer invoking updatePlaybackControlsManager,
3452         which traverses all media players across different documents including the one in the main frame while its iframe
3453         is getting removed (to update the Touch Bar's media control).
3454
3455         Fixed the bug by making this code async in both stopWithoutDestroyingMediaPlayer and ~HTMLMediaElement. To do this,
3456         this patch moves the timer to update the playback controls manager from HTMLMediaElement to Page since scheduling
3457         a timer owned by HTMLMediaElement in its destructor wouldn't work as the timer would get destructed immediately.
3458
3459         Also replaced the call to clientWillPausePlayback by a call to stopSession in stopWithoutDestroyingMediaPlayer
3460         since the former also updates the layout synchronously via updateNowPlayingInfo; the latter function schedules
3461         a timer via scheduleUpdateNowPlayingInfo instead.
3462
3463         Test: media/remove-video-best-media-element-in-main-frame-crash.html
3464
3465         * html/HTMLMediaElement.cpp:
3466         (WebCore::HTMLMediaElement::~HTMLMediaElement): Call scheduleUpdatePlaybackControlsManager now that timer has been
3467         moved to Page.
3468         (WebCore::HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager): Made this return a RefPtr instead of
3469         a raw pointer while we're at it.
3470         (WebCore::HTMLMediaElement::clearMediaPlayer): Call scheduleUpdatePlaybackControlsManager.
3471         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer): Ditto. Also invoke stopSession instead of
3472         clientWillPausePlayback on MediaSession since clientWillPausePlayback will synchronously try to update the layout.
3473         (WebCore::HTMLMediaElement::contextDestroyed):
3474         (WebCore::HTMLMediaElement::stop):
3475         (WebCore::HTMLMediaElement::scheduleUpdatePlaybackControlsManager):
3476         (WebCore::HTMLMediaElement::updatePlaybackControlsManager): Moved to Page::schedulePlaybackControlsManagerUpdate.
3477         * html/HTMLMediaElement.h:
3478         * page/Page.cpp:
3479         (WebCore::Page::schedulePlaybackControlsManagerUpdate): Added.
3480         * page/Page.h:
3481         * testing/Internals.cpp:
3482         (WebCore::Internals::bestMediaElementForShowingPlaybackControlsManager):
3483         * testing/Internals.h:
3484
3485 2018-07-05  Zalan Bujtas  <zalan@apple.com>
3486
3487         Do not assume that hypen's width can be computed using the simplified text measure codepath.
3488         https://bugs.webkit.org/show_bug.cgi?id=187352
3489         <rdar://problem/40821283>
3490
3491         Reviewed by Simon Fraser.
3492
3493         Just because the text content is qualified for simplified text measure, it does not necessarily mean the hyphen is simple enough as well.
3494
3495         Test: fast/text/hyphen-is-complex-crash.html
3496
3497         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
3498         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
3499         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragmentIterator):
3500         * rendering/SimpleLineLayoutTextFragmentIterator.h:
3501
3502 2018-07-05  Eric Carlson  <eric.carlson@apple.com>
3503
3504         Video sometimes flickers when playing to AppleTV
3505         https://bugs.webkit.org/show_bug.cgi?id=187193
3506         <rdar://problem/40153865>
3507
3508         Unreviewed, fix a broken API test.
3509
3510         * platform/audio/ios/AudioSessionIOS.mm:
3511         (WebCore::AudioSession::setCategory): None should set the category to AVAudioSessionCategoryAmbient, 
3512         because it signals that WebKit is not playing audio so we want allow other apps to play.
3513
3514 2018-07-05  Per Arne Vollan  <pvollan@apple.com>
3515
3516         Use ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) in ScrollAnimatorMac.mm
3517         https://bugs.webkit.org/show_bug.cgi?id=187334
3518
3519         Reviewed by Alex Christensen.
3520
3521         Use ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) instead of __MAC_OS_X_VERSION_MIN_REQUIRED when deciding
3522         to use NSTimer or NSAnimation for scrollbar animation.
3523
3524         No new tests. No change in behavior.
3525
3526         * platform/mac/ScrollAnimatorMac.mm:
3527         (-[WebScrollbarPartAnimation initWithScrollbar:featureToAnimate:animateFrom:animateTo:duration:]):
3528         (-[WebScrollbarPartAnimation startAnimation]):
3529         (-[WebScrollbarPartAnimation setCurrentProgress:setCurrentProgress:]):
3530
3531 2018-07-05  Timothy Hatcher  <timothy@apple.com>
3532
3533         Don't invert text color for selections in light mode.
3534         https://bugs.webkit.org/show_bug.cgi?id=187349
3535         rdar://problem/41297946
3536
3537         Reviewed by Tim Horton.
3538
3539         Fix color caching in RenderTheme so we don't cache a dark mode color
3540         for a light appearance, or vise versa. Use the new color caching
3541         in RenderThemeMac, and clear the color caches in purgeCaches.
3542
3543         Allow supportsSelectionForegroundColors to conditionalize on StyleColor::Options.
3544         Return true only in dark mode.
3545
3546         * rendering/RenderTheme.cpp:
3547         (WebCore::RenderTheme::activeSelectionBackgroundColor const):
3548         (WebCore::RenderTheme::inactiveSelectionBackgroundColor const):
3549         (WebCore::RenderTheme::activeSelectionForegroundColor const):
3550         (WebCore::RenderTheme::inactiveSelectionForegroundColor const):
3551         (WebCore::RenderTheme::activeListBoxSelectionBackgroundColor const):
3552         (WebCore::RenderTheme::inactiveListBoxSelectionBackgroundColor const):
3553         (WebCore::RenderTheme::activeListBoxSelectionForegroundColor const):
3554         (WebCore::RenderTheme::inactiveListBoxSelectionForegroundColor const):
3555         (WebCore::RenderTheme::purgeCaches):
3556         (WebCore::RenderTheme::platformColorsDidChange):
3557         (WebCore::RenderTheme::activeTextSearchHighlightColor const):
3558         (WebCore::RenderTheme::inactiveTextSearchHighlightColor const):
3559         * rendering/RenderTheme.h:
3560         (WebCore::RenderTheme::supportsSelectionForegroundColors const):
3561         (WebCore::RenderTheme::supportsListBoxSelectionForegroundColors const):
3562         (WebCore::RenderTheme::colorCache const):
3563         (WebCore::RenderTheme::purgeCaches): Deleted.
3564         * rendering/RenderThemeMac.h:
3565         * rendering/RenderThemeMac.mm:
3566         (WebCore::RenderThemeMac::purgeCaches):
3567         (WebCore::RenderThemeMac::supportsSelectionForegroundColors const):
3568         (WebCore::RenderThemeMac::platformActiveSelectionForegroundColor const):
3569         (WebCore::RenderThemeMac::platformInactiveSelectionForegroundColor const):
3570         (WebCore::RenderThemeMac::platformColorsDidChange):
3571         (WebCore::RenderThemeMac::colorCache const):
3572         (WebCore::RenderThemeMac::systemColor const):
3573
3574 2018-07-05  Zalan Bujtas  <zalan@apple.com>
3575
3576         SimpleLineLayout::FlowContents wastes 54KB of Vector capacity on nytimes.com
3577         https://bugs.webkit.org/show_bug.cgi?id=186709
3578         <rdar://problem/41173793>
3579
3580         Reviewed by Simon Fraser.
3581
3582         The size of the m_segments vector in SimpleLineLayoutFlowContents is alway pre-computed and don't change after the initial append.  
3583
3584         Not testable.
3585
3586         * rendering/SimpleLineLayoutFlowContents.h:
3587
3588 2018-07-05  Nan Wang  <n_wang@apple.com>
3589
3590         AX: setValue on text controls should send out key events
3591         https://bugs.webkit.org/show_bug.cgi?id=186690
3592         <rdar://problem/41169985>
3593
3594         Reviewed by Chris Fleizach.
3595
3596         Use Editor's insertText function when the text control element is being
3597         focused, so that the InputEvent will be dispatched properly.
3598
3599         Test: accessibility/mac/set-value-editable-dispatch-events.html
3600
3601         * accessibility/AccessibilityRenderObject.cpp:
3602         (WebCore::AccessibilityRenderObject::setValue):
3603
3604 2018-07-05  Chris Dumez  <cdumez@apple.com>
3605
3606         ASSERT(m_dictionaryStack.size() == 1) assertion hit in ~KeyedDecoderCF() when decoding fails
3607         https://bugs.webkit.org/show_bug.cgi?id=187152
3608
3609         Reviewed by Brent Fulgham.
3610
3611         Whenever a call to KeyedDecoderCF::beginArrayElement() succeeds (returns true), it
3612         appends an item to m_dictionaryStack which is expected to get popped later on via
3613         a matching call to KeyedDecoderCF::endArrayElement(). The ASSERT(m_dictionaryStack.size() == 1)
3614         assertion in the destructor protects against a begin / end mismatch.
3615
3616         However, there was a bug in KeyedDecoder::decodeObjects(), which would cause us to return early
3617         after a call to beginArrayElement() when the lambda function call returns false, causing us
3618         not to call the matching endArrayElement() in this case. This patch addresses the issue by
3619         calling endArrayElement() before returning early.
3620
3621         This bug was uncovered by r233309 which slightly changed the ITP encoding / decoding format.
3622         Because empty HashCountedSets are now expected to be encoded as empty array, decoding of old
3623         data fails and we hit the buggy code path.
3624
3625         * platform/KeyedCoding.h:
3626         (WebCore::KeyedDecoder::decodeObjects):
3627
3628 2018-07-05  Antti Koivisto  <antti@apple.com>
3629
3630         Move CSSParserContext to a file of its own
3631         https://bugs.webkit.org/show_bug.cgi?id=187342
3632
3633         Reviewed by Zalan Bujtas.
3634
3635         Move it out from CSSParserMode.h and CSSParser.cpp.
3636
3637         * Sources.txt:
3638         * WebCore.xcodeproj/project.pbxproj:
3639         * contentextensions/ContentExtensionParser.cpp:
3640         * css/PropertySetCSSStyleDeclaration.h:
3641         * css/StyleProperties.h:
3642         * css/StyleSheetContents.h:
3643         * css/parser/CSSDeferredParser.h:
3644         * css/parser/CSSParser.cpp:
3645         (WebCore::strictCSSParserContext): Deleted.
3646         (WebCore::CSSParserContext::CSSParserContext): Deleted.
3647         (WebCore::operator==): Deleted.
3648         * css/parser/CSSParser.h:
3649         * css/parser/CSSParserContext.cpp: Added.
3650         (WebCore::strictCSSParserContext):
3651         (WebCore::CSSParserContext::CSSParserContext):
3652         (WebCore::operator==):
3653
3654         Also add the missing textAutosizingEnabled bit.
3655
3656         * css/parser/CSSParserContext.h: Copied from Source/WebCore/css/parser/CSSParserMode.h.
3657         (WebCore::CSSParserContextHash::hash):
3658
3659         Also add the missing bits to the hash function.
3660         
3661         (WebCore::isQuirksModeBehavior): Deleted.
3662         (WebCore::isUASheetBehavior): Deleted.
3663         (WebCore::isUnitLessValueParsingEnabledForMode): Deleted.
3664         (WebCore::isCSSViewportParsingEnabledForMode): Deleted.
3665         (WebCore::strictToCSSParserMode): Deleted.
3666         (WebCore::isStrictParserMode): Deleted.
3667         * css/parser/CSSParserIdioms.h:
3668         * css/parser/CSSParserImpl.h:
3669         * css/parser/CSSParserMode.h:
3670         (WebCore::CSSParserContext::completeURL const): Deleted.
3671         (WebCore::operator!=): Deleted.
3672         (WebCore::CSSParserContextHash::hash): Deleted.
3673         (WebCore::CSSParserContextHash::equal): Deleted.
3674         (WTF::HashTraits<WebCore::CSSParserContext>::constructDeletedValue): Deleted.
3675         (WTF::HashTraits<WebCore::CSSParserContext>::isDeletedValue): Deleted.
3676         (WTF::HashTraits<WebCore::CSSParserContext>::emptyValue): Deleted.
3677         * css/parser/CSSPropertyParserHelpers.h:
3678         * css/parser/CSSSelectorParser.cpp:
3679         * css/parser/CSSVariableParser.cpp:
3680
3681 2018-07-05  Antoine Quint  <graouts@apple.com>
3682
3683         [Web Animations] The ready promise should initially be resolved
3684         https://bugs.webkit.org/show_bug.cgi?id=187341
3685         <rdar://problem/41844711>
3686
3687         Reviewed by Dean Jackson.
3688
3689         The Web Animations spec mandates that the ready promise is initially resolved.
3690
3691         * animation/WebAnimation.cpp:
3692         (WebCore::WebAnimation::WebAnimation):
3693
3694 2018-07-05  Sergio Villar Senin  <svillar@igalia.com>
3695
3696         [WebVR] Fix VRDisplayEvent implementation
3697         https://bugs.webkit.org/show_bug.cgi?id=187337
3698
3699         Reviewed by Žan Doberšek.
3700
3701         VRDisplayEvent implementation had two issues. First there were no attributes storing the
3702         VRDisplay the event refers to. Secondly the VRDisplayEventReason is not mandatory so it
3703         should be handled via an optional.
3704
3705         * Modules/webvr/VRDisplayEvent.cpp:
3706         (WebCore::VRDisplayEvent::VRDisplayEvent):
3707         (WebCore::VRDisplayEvent::display const): Deleted.
3708         (WebCore::VRDisplayEvent::reason const): Deleted.
3709         * Modules/webvr/VRDisplayEvent.h:
3710
3711 2018-07-04  Carlos Garcia Campos  <cgarcia@igalia.com>
3712
3713         REGRESSION(r233325): [GTK] Broke 40 animations tests
3714         https://bugs.webkit.org/show_bug.cgi?id=187264
3715
3716         Reviewed by Žan Doberšek.
3717
3718         This is because DocumentAnimationScheduler uses DisplayRefreshMonitor, that is only used by GTK port when
3719         accelerated compositing is enabled. Add a GTK display refresh monitor implementation to be used as the default.
3720
3721         * PlatformGTK.cmake: Add new file to compilation.
3722         * platform/graphics/DisplayRefreshMonitor.cpp:
3723         (WebCore::DisplayRefreshMonitor::createDefaultDisplayRefreshMonitor): Create DisplayRefreshMonitorGtk in GTK.
3724         * platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp: Added.
3725         (WebCore::DisplayRefreshMonitorGtk::DisplayRefreshMonitorGtk):
3726         (WebCore::DisplayRefreshMonitorGtk::~DisplayRefreshMonitorGtk):
3727         (WebCore::onFrameClockUpdate):
3728         (WebCore::DisplayRefreshMonitorGtk::requestRefreshCallback):
3729         (WebCore::DisplayRefreshMonitorGtk::displayLinkFired):
3730         * platform/graphics/gtk/DisplayRefreshMonitorGtk.h: Added.
3731         (WebCore::DisplayRefreshMonitorGtk::create):
3732
3733 2018-07-04  Antti Koivisto  <antti@apple.com>
3734
3735         Reparse user stylesheets when _useSystemAppearance changes
3736         https://bugs.webkit.org/show_bug.cgi?id=187312
3737         <rdar://problem/38565834>
3738
3739         Reviewed by Tim Horton.
3740
3741         This setting may affect user stylesheet parsing. Reparse if it changes.
3742
3743         Test: fast/media/use-system-appearance-user-stylesheet-parsing.html
3744
3745         * page/Page.cpp:
3746         (WebCore::Page::setUseSystemAppearance):
3747         * page/Page.h:
3748         (WebCore::Page::setUseSystemAppearance): Deleted.
3749         * testing/Internals.cpp:
3750         (WebCore::Internals::setUseSystemAppearance):
3751         * testing/Internals.h:
3752         * testing/Internals.idl:
3753
3754 2018-07-04  Thibault Saunier  <tsaunier@igalia.com>
3755
3756         RealtimeIncomingVideoSources: Call stop() directly in the destructor
3757         https://bugs.webkit.org/show_bug.cgi?id=187303
3758
3759         Reviewed by Youenn Fablet.
3760
3761         Avoiding to call stopProducingData when we are not actually producing data.
3762
3763         This fixes tests that will run once the WPE/GTK PeerConnection implementation is merged.
3764
3765         * platform/mediastream/RealtimeIncomingVideoSource.h:
3766         (WebCore::RealtimeIncomingVideoSource::~RealtimeIncomingVideoSource):
3767
3768 2018-07-04  Thibault Saunier  <tsaunier@igalia.com>
3769
3770         [GTK][WPE] Stop pushing the StreamCollection as event in GStreamerMediaStreamSource
3771         https://bugs.webkit.org/show_bug.cgi?id=187304
3772
3773         Reviewed by Philippe Normand.
3774
3775         We let parsebin build the StreamCollection for us and pass extra metadata through the
3776         `TAG_EVENT` pushing the collection ourself is not bringing anything but adds extra work in the
3777         MediaPlayerGStreamer duplicating the STREAM_COLLECTION message for no good reason.
3778
3779         MediaStream layout tests already test that code path.
3780
3781         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
3782         (WebCore::webkitMediaStreamSrcPadProbeCb):
3783
3784 2018-07-04  Frederic Wang  <fwang@igalia.com>
3785
3786         [WebIDL] Remove custom bindings for HTMLDocument
3787         https://bugs.webkit.org/show_bug.cgi?id=173444
3788
3789         Unreviewed, add missing bugzilla link for FIXME comments.
3790
3791         * dom/Document.cpp:
3792         (WebCore::Document::closeForBindings):
3793         (WebCore::Document::write):
3794         (WebCore::Document::writeln):
3795
3796 2018-07-04  Tim Horton  <timothy_horton@apple.com>
3797
3798         Introduce PLATFORM(IOSMAC)
3799         https://bugs.webkit.org/show_bug.cgi?id=187315
3800
3801         Reviewed by Dan Bernstein.
3802
3803         * Configurations/Base.xcconfig:
3804         * Configurations/FeatureDefines.xcconfig:
3805         * Configurations/WebCore.xcconfig:
3806         * Modules/geolocation/ios/GeolocationPositionIOS.mm:
3807         (WebCore::GeolocationPosition::GeolocationPosition):
3808         * page/cocoa/MemoryReleaseCocoa.mm:
3809         (WebCore::platformReleaseMemory):
3810         * platform/audio/ios/AudioSessionIOS.mm:
3811         (WebCore::AudioSession::setCategory):
3812         (WebCore::AudioSession::routingContextUID const):
3813         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3814         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
3815         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep):
3816         * platform/ios/PlatformPasteboardIOS.mm:
3817         (WebCore::registerItemToPasteboard):
3818         * platform/ios/WebItemProviderPasteboard.mm:
3819         (-[WebItemProviderRegistrationInfoList itemProvider]):
3820
3821 2018-07-03  Antoine Quint  <graouts@apple.com>
3822
3823         [Web Animations] Make WPT test at timing-model/timelines/timelines.html pass reliably
3824         https://bugs.webkit.org/show_bug.cgi?id=186508
3825         <rdar://problem/41000260>
3826
3827         Reviewed by Dean Jackson.
3828
3829         The remaining failing assertion in this test assumes that the ready promise for an animation is fired
3830         prior to requestAnimationFrame callbacks being fired in the current event loop such that registering
3831         the requestAnimationFrame() call within the ready promise has its callback fired with the same timeline
3832         time. To ensure that is true, we perform a microtask checkpoint as soon as we're done running pending
3833         tasks, which will resolve the ready promise for any play-pending animations.
3834
3835         * animation/DocumentTimeline.cpp:
3836         (WebCore::DocumentTimeline::updateAnimations):
3837
3838 2018-07-03  Ryosuke Niwa  <rniwa@webkit.org>
3839
3840         Nullptr crash accessing Document in GenericEventQueue::dispatchOneEvent()
3841         https://bugs.webkit.org/show_bug.cgi?id=187284
3842
3843         Reviewed by Eric Carlson.
3844
3845         The null pointer crash was caused by some GenericEventQueue dispatching an event in a stopped document,
3846         which does not have a valid script execution context because some uses of GenericEventQueue in media code
3847         was not closing the queue upon stopping of all active DOM objects.
3848
3849         Fixed all uses of GenericEventQueue which did not suspend or stop the queue with active DOM objects.
3850         Made SourceBufferList and TrackListBase (along with AudioTrackList, TextTrackList, and VideoTrackList)
3851         inherit from ActiveDOMObject instead of ContextDestructionObserver to do this.
3852
3853         Also fixed a bug that media elements inside a template element (and other cases where the document doesn't
3854         have a browsing context) were scheduling events since this would hit the newly added debug assertion in
3855         GenericEventQueue::dispatchOneEvent.
3856
3857         Test: media/track/video-track-addition-and-frame-removal.html
3858
3859         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
3860         (WebCore::WebKitMediaKeySession::suspend): Assert that we never try to suspend when the document has
3861         this object alive since canSuspendForDocumentSuspension always returns false.
3862         (WebCore::WebKitMediaKeySession::resume): Ditto.
3863         (WebCore::WebKitMediaKeySession::stop): Stop the event queue to avoid the crash.
3864         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h:
3865         * Modules/mediasource/MediaSource.cpp:
3866         (WebCore::MediaSource::removeSourceBuffer): Don't do any work to update tracks when the active DOM
3867         objects are stopped since this MediaSource and the related media objects are about to be destructed.
3868         (WebCore::MediaSource::suspend): Assert that m_asyncEventQueue is empty as canSuspendForDocumentSuspension
3869         returns false whenever the queue is not empty.
3870         (WebCore::MediaSource::resume): Ditto.
3871         * Modules/mediasource/MediaSource.h:
3872         * Modules/mediasource/SourceBuffer.cpp:
3873         (WebCore::SourceBuffer::suspend): Ditto.
3874         (WebCore::SourceBuffer::resume): Ditto.
3875         (WebCore::SourceBuffer::stop): Stop the event queue to avoid the crash.
3876         * Modules/mediasource/SourceBuffer.h:
3877         * Modules/mediasource/SourceBufferList.cpp:
3878         (WebCore::SourceBufferList): Made this an active DOM object.
3879         (WebCore::SourceBufferList::SourceBufferList):
3880         (WebCore::SourceBufferList::canSuspendForDocumentSuspension const): Added. Return false when there are
3881         pending events to match other media code.
3882         (WebCore::SourceBufferList::suspend): Added. Assert that the event queue is empty here.
3883         (WebCore::SourceBufferList::resume): Ditto.
3884         (WebCore::SourceBufferList::stop): Added. Stop the event queue to avoid the crash.
3885         (WebCore::SourceBufferList::activeDOMObjectName const): Added.
3886         * Modules/mediasource/SourceBufferList.h:
3887         (WebCore::SourceBufferList): Made this an active DOM object.
3888         * Modules/mediasource/SourceBufferList.idl:
3889         * dom/Document.h:
3890         (WebCore::Document::hasBrowsingContext const): Added.
3891         * dom/GenericEventQueue.cpp:
3892         (WebCore::GenericEventQueue::dispatchOneEvent): Added an assertion to catch when an event is dispatched
3893         inside a stopped document, which is never correct and causes this crash down the line.
3894         * html/HTMLMediaElement.cpp:
3895         (WebCore::HTMLMediaElement::playInternal): Exit early when the document doesn't have a browsing context;
3896         e.g. when the media element is inside a template element.
3897         (WebCore::HTMLMediaElement::pauseInternal): Ditto.
3898         (WebCore::HTMLMediaElement::sourceWasAdded): Ditto.
3899         * html/track/AudioTrackList.cpp:
3900         (AudioTrackList::activeDOMObjectName const): Added.
3901         * html/track/AudioTrackList.h:
3902         * html/track/AudioTrackList.idl:
3903         * html/track/TextTrackList.cpp::
3904         (TextTrackList::activeDOMObjectName const): Added.
3905         * html/track/TextTrackList.h:
3906         * html/track/TextTrackList.idl:
3907         * html/track/TrackListBase.cpp:
3908         (WebCore::TrackListBase): Made this an active DOM object.
3909         (WebCore::TrackListBase::TrackListBase): 
3910         (WebCore::TrackListBase::canSuspendForDocumentSuspension const): Added. Return false when there are pending events
3911         to match other media code.
3912         (WebCore::TrackListBase::suspend): Added. Assert that the event queue is empty here.
3913         (WebCore::TrackListBase::resume): Ditto.
3914         (WebCore::TrackListBase::stop): Added. Stop the event queue to avoid the crash.
3915         * html/track/TrackListBase.h:
3916         * html/track/VideoTrackList.cpp:
3917         (VideoTrackList::activeDOMObjectName const): Added.
3918         * html/track/VideoTrackList.h:
3919         * html/track/VideoTrackList.idl:
3920
3921 2018-07-03  Fujii Hironori  <Hironori.Fujii@sony.com>
3922
3923         [cairo] Doesn't paint box-shadow with zero blur-radius
3924         https://bugs.webkit.org/show_bug.cgi?id=187244
3925
3926         Reviewed by Žan Doberšek.
3927
3928         Cairo::ShadowState::isRequired() returned false if blur-radius is
3929         zero.
3930
3931         No new tests (Covered by existing tests).
3932
3933         * platform/graphics/cairo/CairoOperations.cpp:
3934         (WebCore::Cairo::ShadowState::isRequired const): Do not check blur
3935         is zero.
3936
3937 2018-07-03  Ryosuke Niwa  <rniwa@webkit.org>
3938
3939         Add a release assert to diagnose infinite recursions in removeAllEventListeners()
3940         https://bugs.webkit.org/show_bug.cgi?id=187287
3941
3942         Reviewed by Keith Miller.
3943
3944         Assert that we never re-enter removeAllEventListeners per thread.
3945
3946         * dom/EventTarget.cpp:
3947         (WebCore::EventTarget::removeAllEventListeners):
3948         * platform/ThreadGlobalData.h:
3949         (WebCore::ThreadGlobalData::ThreadGlobalData::isInRemoveAllEventListeners const):
3950         (WebCore::ThreadGlobalData::ThreadGlobalData::setIsInRemoveAllEventListeners):
3951
3952 2018-07-03  Chris Dumez  <cdumez@apple.com>
3953
3954         performance-api/performance-observer-no-document-leak.html is flaky
3955         https://bugs.webkit.org/show_bug.cgi?id=186938
3956         <rdar://problem/41379336>
3957
3958         Reviewed by Simon Fraser.
3959
3960         Add internals API to get the identifier of a document and to ask if the document with
3961         a given identifier is still alive. This is helpful to write tests for document leaking
3962         fixes.
3963
3964         * testing/Internals.cpp:
3965         (WebCore::Internals::documentIdentifier const):
3966         (WebCore::Internals::isDocumentAlive const):
3967         * testing/Internals.h:
3968         * testing/Internals.idl:
3969
3970 2018-07-03  Chris Dumez  <cdumez@apple.com>
3971
3972         Improve window.event compliance: Should not be set when target is in shadow tree
3973         https://bugs.webkit.org/show_bug.cgi?id=186266
3974
3975         Reviewed by Ryosuke Niwa.
3976
3977         Stop exposing window.event to Shadow DOM by not setting window.event if the event's target
3978         is a Node inside a shadow tree. This is as per the latest DOM specification:
3979         - https://github.com/whatwg/dom/pull/407
3980
3981         This aligns our behavior with Blink as well:
3982         - https://bugs.chromium.org/p/chromium/issues/detail?id=779461
3983
3984         Tests: imported/w3c/web-platform-tests/dom/events/event-global.html