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