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