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