SWServer::removeClientServiceWorkerRegistration should not log an error if there...
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-03-01  Youenn Fablet  <youenn@apple.com>
2
3         SWServer::removeClientServiceWorkerRegistration should not log an error if there is no registration
4         https://bugs.webkit.org/show_bug.cgi?id=183248
5
6         Reviewed by Chris Dumez.
7
8         No change of behavior.
9         Removed the error logging.
10         As can be seen from running api and layout tests, a web process can ask a registration to be unregistered
11         and by the time it goes to the StorageProcess, the registration is already cleared.
12
13         * workers/service/server/SWServer.cpp:
14         (WebCore::SWServer::removeClientServiceWorkerRegistration):
15
16 2018-03-01  Daniel Bates  <dabates@apple.com>
17
18         CSS ::selection stroke-color and stroke-width are not applied to selected text in text fields
19         and ::selection:window-inactive stroke-color and stroke-width are never applied
20         https://bugs.webkit.org/show_bug.cgi?id=183178
21
22         Reviewed by David Hyatt.
23
24         This change fixes the following two issues:
25             1. Properties stroke-color and stroke-width are not applied to the ::selection pseudo-
26                element of text fields.
27             2. Properties stroke-color and stroke-width are never applied to ::selection:window-inactive
28                pseudo elements.
29
30         Currently when computing the paint styles for selected text we query the cached styles for
31         the ::selection pseudo element on the renderer. Text fields are implemented using a User Agent
32         shadow DOM. With regards to issue (1) the renderer queried was the inner most renderer for
33         the text in the text field. But it should have been the shadow host renderer (i.e. the renderer
34         for the <input>). With regards to issue (2) we cannot retrieve cached styles for the
35         ::selection pseudo element because it can be effected by a pseudo class, :window-inactive,
36         which matches when the page is deactivated (i.e. the window is in the background as the user
37         made another window the frontmost window). Both of these issues are fixed by making use
38         of RenderElement::selectionPseudoStyle().
39
40         Tests: fast/selectors/selection-window-inactive-stroke-color.html
41                fast/selectors/selection-window-inactive-text-shadow.html
42                fast/selectors/text-field-selection-stroke-color.html
43                fast/selectors/text-field-selection-text-shadow.html
44                fast/selectors/text-field-selection-window-inactive-stroke-color.html
45                fast/selectors/text-field-selection-window-inactive-text-shadow.html
46
47         * rendering/RenderText.h:
48         (WebCore::RenderText::selectionPseudoStyle const): Add a convenience function that turns
49         around and calls the function of the same name on its parent.
50         * rendering/TextPaintStyle.cpp:
51         (WebCore::computeTextSelectionPaintStyle): Modified to use RenderText::selectionPseudoStyle()
52         instead of directly querying for the cached styles for the ::selection pseudo element.
53
54 2018-03-01  Per Arne Vollan  <pvollan@apple.com>
55
56         Scrollbar preferences are ignored when the WebContent process doesn't have access to the WindowServer.
57         https://bugs.webkit.org/show_bug.cgi?id=183231
58         <rdar://problem/37793457>
59
60         Reviewed by Brent Fulgham.
61
62         When the WebContent process doesn't have access to the WindowServer, the scrollbars are always of the overlay type.
63         The notification about scrollbar preferences is never received by the WebContent process when there is no
64         WindowServer access. This can be fixed by adding an observer of scrollbar preferences in the UI process, and
65         notifying the WebProcess about this by sending it a message. This message should also contain the preferred
66         scrollbar type, since the call '[NSScroller preferredScrollerStyle]' will always return the overlay style when
67         there is no WindowServer access.
68
69         No new tests, covered by existing tests.
70
71         * WebCore.xcodeproj/project.pbxproj:
72         * platform/mac/NSScrollerImpDetails.h:
73         * platform/mac/NSScrollerImpDetails.mm:
74         (WebCore::ScrollerStyle::recommendedScrollerStyle):
75         (WebCore::ScrollerStyle::setUseOverlayScrollbars):
76         (WebCore::recommendedScrollerStyle): Deleted.
77         * platform/mac/ScrollAnimatorMac.mm:
78         (WebCore::ScrollAnimatorMac::ScrollAnimatorMac):
79         (WebCore::ScrollAnimatorMac::mouseEnteredScrollbar const):
80         (WebCore::ScrollAnimatorMac::mouseExitedScrollbar const):
81         (WebCore::ScrollAnimatorMac::shouldScrollbarParticipateInHitTesting):
82         * platform/mac/ScrollbarThemeMac.mm:
83         (WebCore::ScrollbarThemeMac::registerScrollbar):
84         (WebCore::ScrollbarThemeMac::scrollbarThickness):
85         (WebCore::ScrollbarThemeMac::usesOverlayScrollbarsChanged):
86
87 2018-03-01  Myles C. Maxfield  <mmaxfield@apple.com>
88
89         Temporarily enable user-installed-fonts everywhere until we can stop crashing on launch
90         https://bugs.webkit.org/show_bug.cgi?id=183255
91
92         Unreviewed.
93
94         Tests are already disabled.
95
96         * platform/graphics/cocoa/FontCacheCoreText.cpp:
97
98 2018-03-01  Basuke Suzuki  <Basuke.Suzuki@sony.com>
99
100         [Curl] Split DNS cache expiration and connection timeout setting.
101         https://bugs.webkit.org/show_bug.cgi?id=182979
102
103         It was mis-implemented and was named ambiguous name 'enableTimeout'.
104         Implement each feature correctly.
105
106         Reviewed by Per Arne Vollan.
107
108         * platform/network/curl/CurlContext.cpp:
109         (WebCore::EnvironmentVariableReader::read):
110         (WebCore::EnvironmentVariableReader::defined):
111         (WebCore::EnvironmentVariableReader::readAs):
112         (WebCore::EnvironmentVariableReader::sscanTemplate):
113         (WebCore::EnvironmentVariableReader::sscanTemplate<unsigned>):
114         (WebCore::CurlContext::CurlContext):
115         (WebCore::safeTimeValue):
116         (WebCore::CurlHandle::setDnsCacheTimeout):
117         (WebCore::CurlHandle::setConnectTimeout):
118         (WebCore::CurlHandle::setTimeout):
119         (WebCore::CurlHandle::enableTimeout): Deleted.
120         * platform/network/curl/CurlContext.h:
121         (WebCore::CurlContext::dnsCacheTimeout const):
122         (WebCore::CurlContext::connectTimeout const):
123         * platform/network/curl/CurlRequest.cpp:
124         (WebCore::CurlRequest::setupTransfer):
125
126 2018-03-01  Zalan Bujtas  <zalan@apple.com>
127
128         Remove RenderElement::s_noLongerAffectsParentBlock
129         https://bugs.webkit.org/show_bug.cgi?id=183196
130         <rdar://problem/38030797>
131
132         Reviewed by Antti Koivisto.
133
134         Remove the hack to track floating/out-of-flow changes between styleWillChange and styleDidChange.
135
136         Covered by existing tests.
137
138         * rendering/RenderBlockFlow.cpp:
139         (WebCore::RenderBlockFlow::styleDidChange):
140         * rendering/RenderElement.cpp:
141         (WebCore::RenderElement::styleWillChange):
142         (WebCore::RenderElement::noLongerAffectsParentBlock const):
143         (WebCore::RenderElement::styleDidChange):
144         * rendering/RenderElement.h:
145         (WebCore::RenderElement::noLongerAffectsParentBlock const): Deleted.
146
147 2018-03-01  Chris Dumez  <cdumez@apple.com>
148
149         imported/w3c/web-platform-tests/html/browsers/windows/browsing-context.html fails with async policy delegates
150         https://bugs.webkit.org/show_bug.cgi?id=183225
151         <rdar://problem/38003828>
152
153         Reviewed by Alex Christensen.
154
155         Bypass navigation policy check when loading about:blank. This does not seem necessary and it would not
156         be Web-compatible for such policy check to happen synchronously. This is because an iframe without src
157         or src="about:blank" should load synchronously as per HTML specification.
158
159         Test: http/wpt/html/browsers/windows/browsing-context.html
160
161         * loader/PolicyChecker.cpp:
162         (WebCore::PolicyChecker::checkNavigationPolicy):
163
164 2018-03-01  Christopher Reid  <chris.reid@sony.com>
165
166         [Curl] Linker errors in some curl files due to missing exports
167         https://bugs.webkit.org/show_bug.cgi?id=183238
168
169         Reviewed by Alex Christensen.
170
171         No new tests, no change in behavior.
172
173         Adding WEBCORE_EXPORT to functions now used in WebKit.
174
175         * platform/network/NetworkStorageSession.h:
176         * platform/network/curl/CookieJarDB.h:
177         * platform/network/curl/CurlContext.h:
178
179 2018-03-01  Commit Queue  <commit-queue@webkit.org>
180
181         Unreviewed, rolling out r229130.
182         https://bugs.webkit.org/show_bug.cgi?id=183244
183
184         It breaks AppleWin compilation (Requested by alexg__ on
185         #webkit).
186
187         Reverted changeset:
188
189         "Make LibWebRTCProvider port agnostic again after r215424"
190         https://bugs.webkit.org/show_bug.cgi?id=183080
191         https://trac.webkit.org/changeset/229130
192
193 2018-03-01  Alejandro G. Castro  <alex@igalia.com>
194
195         Make LibWebRTCProvider port agnostic again after r215424
196         https://bugs.webkit.org/show_bug.cgi?id=183080
197
198         Reviewed by Youenn Fablet.
199
200         In the r215424 commit the webRTCAvailable function started to use a function from the DARWIN platform,
201         we have moved that code to the cocoa class and created a glib implementation that will be used in the future
202         to implement the LibWebRTCProviderGlib class.
203
204         No new tests, this is a refactor.
205
206         * Sources.txt: Add the compilation of the new file.
207         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: Remove the webRTCAvailable function from this file.
208         (WebCore::LibWebRTCProvider::create): We want to use this even when LIBWEBRTC is not used.
209         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
210         (WebCore::LibWebRTCProvider::webRTCAvailable): Moved the code from the LibWebRTCProvider class.
211         * platform/mediastream/libwebrtc/LibWebRTCProviderGlib.cpp:
212         (WebCore::LibWebRTCProvider::webRTCAvailable): Add the glib implementation, basically true, we are always
213         linking libwebrtc for the moment in these situations.
214
215 2018-03-01  Carlos Garcia Campos  <cgarcia@igalia.com>
216
217         [FreeType] Color emojis in WebKitGTK+ for great justice
218         https://bugs.webkit.org/show_bug.cgi?id=183155
219
220         Reviewed by Michael Catanzaro.
221
222         Emojis are actually rendered if there's an emoji font installed in the system, but the size is so tiny that we
223         don't see them. This is because for some reason the matrix we are getting from fontconfig contains a scale,
224         which we don't expect. We only get the fontconfig matrix to apply rotations in case of oblique fonts, and then we
225         always apply the scale for the computed pixel font size. Ignoring the fontconfig matrix scale fixes the issue.
226
227         * platform/graphics/freetype/FontCacheFreeType.cpp:
228         (WebCore::fontWeightToFontconfigWeight): Moved here since it's now used by configurePatternForFontDescription().
229         (WebCore::configurePatternForFontDescription): Helper function to apply the same options for fallback pattern.
230         (WebCore::createFontConfigPatternForCharacters): Use configurePatternForFontDescription().
231         (WebCore::findBestFontGivenFallbacks): Adopt the returned reference.
232         (WebCore::FontCache::systemFallbackForCharacters): Clean it up.
233         (WebCore::FontCache::createFontPlatformData): Use configurePatternForFontDescription().
234         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
235         (WebCore::FontPlatformData::buildScaledFont): Ignore the scale returned by fontconfig matrix.
236
237 2018-02-28  Philippe Normand  <pnormand@igalia.com>
238
239         [GStreamer] text samples no longer processed
240         https://bugs.webkit.org/show_bug.cgi?id=183212
241
242         Reviewed by Xabier Rodriguez-Calvar.
243
244         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
245         (WebCore::MediaPlayerPrivateGStreamer::newTextSample): Refer to
246         track stream ID instead of (potentially) manually generated track
247         ID stored as hashmap keys.
248
249 2018-02-28  Tim Horton  <timothy_horton@apple.com>
250
251         Push WTF_PLATFORM_IOS down into preprocessor.pm instead of trying to determine it inside
252         https://bugs.webkit.org/show_bug.cgi?id=183193
253
254         Reviewed by Andy Estes.
255
256         * DerivedSources.make:
257         * bindings/scripts/preprocessor.pm:
258         (applyPreprocessor):
259         Instead of trying to discern WTF_PLATFORM_IOS inside preprocessor.pm,
260         push it down from DerivedSources.make. Also clean up DerivedSources.make
261         a tiny bit by adding a variable, FEATURE_AND_PLATFORM_DEFINES, which
262         contains both FEATURE_DEFINES and WTF_PLATFORM macros if needed.
263
264 2018-02-28  Nan Wang  <n_wang@apple.com>
265
266         AX: AOM: Dispatch accessiblesetvalue event
267         https://bugs.webkit.org/show_bug.cgi?id=183021
268         <rdar://problem/37764242>
269
270         Reviewed by Chris Fleizach.
271
272         Accessibility events.
273         Spec: https://wicg.github.io/aom/spec/phase2.html
274
275         Added a new event type AccessibleSetValueEvent. 
276
277         Test: accessibility/mac/AOM-event-accessiblesetvalue.html
278
279         * CMakeLists.txt:
280         * DerivedSources.make:
281         * Sources.txt:
282         * WebCore.xcodeproj/project.pbxproj:
283         * accessibility/AccessibilityAllInOne.cpp:
284         * accessibility/AccessibilityNodeObject.cpp:
285         (WebCore::AccessibilityNodeObject::canSetValueAttribute const):
286         * accessibility/AccessibilityObject.cpp:
287         (WebCore::AccessibilityObject::press):
288         (WebCore::AccessibilityObject::dispatchAccessibilityEvent):
289         (WebCore::AccessibilityObject::dispatchAccessibleSetValueEvent):
290         * accessibility/AccessibilityObject.h:
291         * accessibility/AccessibilityRenderObject.cpp:
292         (WebCore::AccessibilityRenderObject::setValue):
293         * accessibility/AccessibilityScrollbar.cpp:
294         (WebCore::AccessibilityScrollbar::setValue):
295         * accessibility/AccessibilitySlider.cpp:
296         (WebCore::AccessibilitySlider::setValue):
297         * accessibility/AccessibleSetValueEvent.cpp: Added.
298         (WebCore::AccessibleSetValueEvent::AccessibleSetValueEvent):
299         * accessibility/AccessibleSetValueEvent.h: Added.
300         (WebCore::AccessibleSetValueEvent::create):
301         (WebCore::AccessibleSetValueEvent::value const):
302         * accessibility/AccessibleSetValueEvent.idl: Added.
303         * dom/Element.idl:
304         * dom/EventNames.h:
305         * dom/EventNames.in:
306
307 2018-02-28  Chris Dumez  <cdumez@apple.com>
308
309         html/browsers/browsing-the-web/navigating-across-documents/006.html fails with async policy delegates
310         https://bugs.webkit.org/show_bug.cgi?id=183168
311         <rdar://problem/37951341>
312
313         Reviewed by Alex Christensen.
314
315         The test has an anchor element with both a 'click' event handler which submits a form
316         and an href attribute. When clicking the link, as per specification, things happen in
317         this order:
318         1. We fire the click event at the anchor, which will execute the event handler and submit the form.
319            Submitting the form *schedules* a navigation to 'click.html'.
320         2. We execute the anchor activation code which *navigates* to 'href.html'. The navigation to
321            'href' is supposed to cancel the pending navigation to 'click.html' and we should navigate
322            to 'href.html', which is what the test asserts.
323
324         The issue for us is that we do not cancel pending navigations until after the navigation
325         policy decision is made, when the provisional loads actually starts, in FrameLoader::provisionalLoadStarted().
326         Because the policy decision for the navigation can now be made asynchronously, the NavigationScheduler
327         timer can now fire while the decision is made and we'll submit the form, thus navigating to
328         'click.html'.
329
330         To address the issue, we now cancel any pending navigations in FrameLoader::loadWithDocumentLoader(),
331         *before* doing the policy check for the navigation.
332
333         Test: http/wpt/html/browsers/browsing-the-web/navigating-across-documents/006.html
334
335         * loader/FrameLoader.cpp:
336         (WebCore::FrameLoader::loadWithDocumentLoader):
337
338 2018-02-28  John Wilander  <wilander@apple.com>
339
340         Add a second tier of prevalence to facilitate telemetry on very prevalent domains
341         https://bugs.webkit.org/show_bug.cgi?id=183218
342         <rdar://problem/37992388>
343
344         Reviewed by Brent Fulgham.
345
346         Test: http/tests/resourceLoadStatistics/classify-as-very-prevalent-based-on-mixed-statistics.html
347
348         * loader/ResourceLoadStatistics.cpp:
349         (WebCore::ResourceLoadStatistics::encode const):
350         (WebCore::ResourceLoadStatistics::decode):
351         (WebCore::ResourceLoadStatistics::toString const):
352         (WebCore::ResourceLoadStatistics::merge):
353             Handling of the new boolean field isVeryPrevalentResource.
354         * loader/ResourceLoadStatistics.h:
355             Added the new boolean field isVeryPrevalentResource.
356
357 2018-02-28  Alex Christensen  <achristensen@webkit.org>
358
359         Reduce use of NetworkingContext in WebKit
360         https://bugs.webkit.org/show_bug.cgi?id=183213
361
362         Reviewed by Brady Eidson.
363
364         NetworkingContext is intended to be used only with ResourceHandle, which is now only used in WebKitLegacy.
365         Now that we don't use ResourceHandle in the WebProcess, everything that was done through the NetworkingContext
366         can now be done a cleaner way with no change in behavior.
367
368         * loader/FrameLoader.cpp:
369         (WebCore::FrameLoader::loadResourceSynchronously):
370         * loader/LinkLoader.cpp:
371         (WebCore::LinkLoader::loadLink):
372         * loader/LoaderStrategy.h:
373         * platform/network/ProxyServer.h:
374         * platform/network/cf/ProxyServerCFNet.cpp:
375         (WebCore::proxyServersForURL):
376         * platform/network/curl/ProxyServerCurl.cpp:
377         (WebCore::proxyServersForURL):
378         * platform/network/soup/ProxyServerSoup.cpp:
379         (WebCore::proxyServersForURL):
380
381 2018-02-28  Zalan Bujtas  <zalan@apple.com>
382
383         Remove RenderElement::s_affectsParentBlock
384         https://bugs.webkit.org/show_bug.cgi?id=183187
385         <rdar://problem/37961079>
386
387         Reviewed by Antti Koivisto.
388
389         Remove the hack to track floating/out-of-flow changes between styleWillChange and styleDidChange.
390
391         Covered by existing tests.
392
393         * rendering/RenderElement.cpp:
394         (WebCore::RenderElement::styleWillChange):
395         (WebCore::RenderElement::styleDidChange):
396         * rendering/RenderElement.h:
397
398 2018-02-28  Antti Koivisto  <antti@apple.com>
399
400         Filter attribute selectors with selector filter
401         https://bugs.webkit.org/show_bug.cgi?id=183200
402
403         Reviewed by Zalan Bujtas.
404
405         Currently selector filtering is done based on tags, classes and ids. We should include attributes too.
406
407         This patch adds filtering based on attribute name (but not content).
408
409         * css/SelectorFilter.cpp:
410         (WebCore::isExcludedAttribute):
411
412             Ignore id, class and style attributes. First two are already handled and the last is common but is rarely
413             used in selectors.
414
415         (WebCore::collectElementIdentifierHashes):
416
417             Collect attributes.
418             Remove the unnecessary StyledElement casting.
419
420         (WebCore::collectSimpleSelectorHash):
421
422             Collect attribute selectors.
423
424         (WebCore::chooseSelectorHashesForFilter):
425
426             Pick attributes with high priority for the filter as it is likely a good signal.
427
428 2018-02-27  Sergio Villar Senin  <svillar@igalia.com>
429
430         [WebVR] Convert VRPlatformDisplayInfo into a class
431         https://bugs.webkit.org/show_bug.cgi?id=183162
432
433         Reviewed by Žan Doberšek.
434
435         In preparation for further changes we're transforming the
436         VRPlatformDisplayInfo into a class. All the members are now private
437         and the class provides the needed getters/setters.
438
439         Apart from that VRDisplayCapabilityFlags is now just an unsigned and
440         the different flags are defined in VRDisplayCapabilityFlag enum.
441         Another cleanup was the removal of VRDisplayCapabilities.cpp as
442         everything can be implemented in the header.
443
444         * Modules/webvr/VRDisplay.cpp:
445         (WebCore::VRDisplay::VRDisplay):
446         (WebCore::VRDisplay::isConnected const):
447         (WebCore::VRDisplay::stageParameters const):
448         * Modules/webvr/VRDisplayCapabilities.cpp: Removed.
449         * Modules/webvr/VRDisplayCapabilities.h:
450         (WebCore::VRDisplayCapabilities::hasPosition const):
451         (WebCore::VRDisplayCapabilities::hasOrientation const):
452         (WebCore::VRDisplayCapabilities::hasExternalDisplay const):
453         (WebCore::VRDisplayCapabilities::canPresent const):
454         (WebCore::VRDisplayCapabilities::maxLayer const):
455         (WebCore::VRDisplayCapabilities::VRDisplayCapabilities):
456         * Sources.txt:
457         * platform/vr/VRPlatformDisplay.h:
458         (WebCore::VRPlatformDisplayInfo::displayName const):
459         (WebCore::VRPlatformDisplayInfo::setDisplayName):
460         (WebCore::VRPlatformDisplayInfo::isConnected const):
461         (WebCore::VRPlatformDisplayInfo::setIsConnected):
462         (WebCore::VRPlatformDisplayInfo::isMounted const):
463         (WebCore::VRPlatformDisplayInfo::setIsMounted):
464         (WebCore::VRPlatformDisplayInfo::capabilityFlags const):
465         (WebCore::VRPlatformDisplayInfo::setCapabilityFlags):
466         (WebCore::VRPlatformDisplayInfo::displayIdentifier const):
467         (WebCore::VRPlatformDisplayInfo::setDisplayIdentifier):
468         (WebCore::VRPlatformDisplayInfo::eyeTranslation const):
469         (WebCore::VRPlatformDisplayInfo::setEyeTranslation):
470         (WebCore::VRPlatformDisplayInfo::eyeFieldOfView const):
471         (WebCore::VRPlatformDisplayInfo::setEyeFieldOfView):
472         (WebCore::VRPlatformDisplayInfo::renderSize const):
473         (WebCore::VRPlatformDisplayInfo::setRenderSize):
474         (WebCore::VRPlatformDisplayInfo::setPlayAreaBounds):
475         (WebCore::VRPlatformDisplayInfo::playAreaBounds const):
476         (WebCore::VRPlatformDisplayInfo::setSittingToStandingTransform):
477         (WebCore::VRPlatformDisplayInfo::sittingToStandingTransform const):
478         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
479         (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
480         (WebCore::VRPlatformDisplayOpenVR::updateEyeParameters):
481         (WebCore::VRPlatformDisplayOpenVR::updateStageParameters):
482
483 2018-02-27  Commit Queue  <commit-queue@webkit.org>
484
485         Unreviewed, rolling out r229060.
486         https://bugs.webkit.org/show_bug.cgi?id=183198
487
488         This patch causes crashes on two SVG tests (Requested by fredw
489         on #webkit).
490
491         Reverted changeset:
492
493         "Relayout frames after AsyncFrameScrolling or FrameFlattening
494         option is changed"
495         https://bugs.webkit.org/show_bug.cgi?id=183081
496         https://trac.webkit.org/changeset/229060
497
498 2018-02-27  Youenn Fablet  <youenn@apple.com>
499
500         Do not trigger a service worker match in case of document redirection if it will be already served by AppCache
501         https://bugs.webkit.org/show_bug.cgi?id=183185
502         <rdar://problem/37693796>
503
504         Reviewed by Chris Dumez.
505
506         Disabling service worker matching in case there is a substitute data.
507         Otherwise there is a risk for a double load, substitute data first and the new load
508         triggered if matching a new registration.
509         A future fix should first do service worker registration matching and if there is no registration query appcache.
510
511         Test: http/tests/appcache/main-resource-redirect-with-sw.html
512
513         * loader/DocumentLoader.cpp:
514         (WebCore::DocumentLoader::redirectReceived):
515
516 2018-02-27  Tim Horton  <timothy_horton@apple.com>
517
518         Ensure target triple is propagated correctly to DerivedSources.make
519         https://bugs.webkit.org/show_bug.cgi?id=183189
520         <rdar://problem/37959694>
521
522         Reviewed by Dan Bernstein.
523
524         If we don't propagate the target triple, we can sometimes build with
525         the wrong options enabled.
526
527         * Configurations/Base.xcconfig:
528         Mentioning LLVM_TARGET_TRIPLE_SUFFIX here is required to get it to be available to scripts.
529
530         * DerivedSources.make:
531         Propagate the target triple into our compiler invocations.
532
533 2018-02-27  Doug Russell  <doug@getitdownonpaper.com>
534
535         AX: Spell check and style attributes should be optional when fetching attributed string
536         https://bugs.webkit.org/show_bug.cgi?id=160744
537
538         Reviewed by Chris Fleizach.
539
540         The overhead of fetching a spell checked attributed string via AX API is substantial. 
541         In some cases on the order of 7/8 of the total time spent fetching the string.
542
543         This change introduces the new attribute AXAttributedStringForTextMarkerRangeWithOptions which accepts an NSDictionary as it's parameter with keys "AXTextMarkerRange" (AXTextMarkerRangeRef) and "AXSpellCheck" (NSNumber(BOOL)).
544
545         AXAttributedStringForTextMarkerRange will remain unchanged.
546
547         Tests: accessibility/mac/attributed-string/attributed-string-for-range-with-options.html
548                accessibility/mac/attributed-string/attributed-string-for-range.html
549
550         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
551         (AXAttributedStringAppendText):
552         (-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:spellCheck:]):
553         (-[WebAccessibilityObjectWrapper accessibilityParameterizedAttributeNames]):
554         (-[WebAccessibilityObjectWrapper doAXAttributedStringForRange:]):
555         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
556         (-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:]): Deleted.
557
558 2018-02-27  Daniel Bates  <dabates@apple.com>
559
560         Standardize terminology for marked text
561         https://bugs.webkit.org/show_bug.cgi?id=180999
562
563         Reviewed by Zalan Bujtas.
564
565         The name MarkerSubrange is a misnomer for a data structure that associates a text subrange with a type
566         and optional document marker. In particular, a MarkerSubrange may not always correspond to a document
567         marker. For instance, selected text is represented using a MarkerSubrange that does not have a
568         corresponding document marker. Let's standardize on the phrase "marked text" as the canonical way to
569         describe these tagged text subranges.
570
571         * Sources.txt:
572         * WebCore.xcodeproj/project.pbxproj:
573         * rendering/InlineTextBox.cpp:
574         (WebCore::InlineTextBox::localSelectionRect const):
575         (WebCore::InlineTextBox::MarkedTextStyle::areBackgroundMarkedTextStylesEqual):
576         (WebCore::InlineTextBox::MarkedTextStyle::areForegroundMarkedTextStylesEqual):
577         (WebCore::InlineTextBox::MarkedTextStyle::areDecorationMarkedTextStylesEqual):
578         (WebCore::InlineTextBox::StyledMarkedText::StyledMarkedText):
579         (WebCore::createMarkedTextFromSelectionInBox):
580         (WebCore::InlineTextBox::paint):
581         (WebCore::InlineTextBox::paintPlatformDocumentMarkers):
582         (WebCore::InlineTextBox::paintPlatformDocumentMarker):
583         (WebCore::InlineTextBox::computeStyleForUnmarkedMarkedText const):
584         (WebCore::InlineTextBox::resolveStyleForMarkedText):
585         (WebCore::InlineTextBox::subdivideAndResolveStyle):
586         (WebCore::InlineTextBox::coalesceAdjacentMarkedTexts):
587         (WebCore::InlineTextBox::collectMarkedTextsForDraggedContent):
588         (WebCore::InlineTextBox::collectMarkedTextsForDocumentMarkers):
589         (WebCore::InlineTextBox::paintMarkedTexts):
590         (WebCore::InlineTextBox::paintMarkedTextBackground):
591         (WebCore::InlineTextBox::paintMarkedTextForeground):
592         (WebCore::InlineTextBox::paintMarkedTextDecoration):
593         (WebCore::InlineTextBox::paintCompositionBackground):
594         (WebCore::InlineTextBox::MarkerSubrangeStyle::areBackgroundMarkerSubrangeStylesEqual): Deleted.
595         (WebCore::InlineTextBox::MarkerSubrangeStyle::areForegroundMarkerSubrangeStylesEqual): Deleted.
596         (WebCore::InlineTextBox::MarkerSubrangeStyle::areDecorationMarkerSubrangeStylesEqual): Deleted.
597         (WebCore::InlineTextBox::StyledMarkerSubrange::StyledMarkerSubrange): Deleted.
598         (WebCore::createMarkerSubrangeFromSelectionInBox): Deleted.
599         (WebCore::InlineTextBox::computeStyleForUnmarkedMarkerSubrange const): Deleted.
600         (WebCore::InlineTextBox::resolveStyleForSubrange): Deleted.
601         (WebCore::InlineTextBox::coalesceAdjacentSubranges): Deleted.
602         (WebCore::InlineTextBox::collectSubrangesForDraggedContent): Deleted.
603         (WebCore::InlineTextBox::collectSubrangesForDocumentMarkers): Deleted.
604         (WebCore::InlineTextBox::paintMarkerSubranges): Deleted.
605         (WebCore::InlineTextBox::paintTextSubrangeBackground): Deleted.
606         (WebCore::InlineTextBox::paintTextSubrangeForeground): Deleted.
607         (WebCore::InlineTextBox::paintTextSubrangeDecoration): Deleted.
608         * rendering/InlineTextBox.h:
609         (WebCore::InlineTextBox::paintMarkedTexts):
610         (WebCore::InlineTextBox::paintMarkerSubranges): Deleted.
611         * rendering/MarkedText.cpp: Renamed from Source/WebCore/rendering/MarkerSubrange.cpp.
612         (WebCore::subdivide):
613         * rendering/MarkedText.h: Renamed from Source/WebCore/rendering/MarkerSubrange.h.
614         (WebCore::MarkedText::MarkedText):
615         (WebCore::MarkedText::isEmpty const):
616         (WebCore::MarkedText::operator!= const):
617         (WebCore::MarkedText::operator== const):
618
619 2018-02-27  Chris Dumez  <cdumez@apple.com>
620
621         Unreviewed, roll out r228430.
622
623         Roll out r228430 now that it is no longer needed after r228852.
624
625         No new tests, initial fix is still covered by WebKit.RespondToPolicyForNavigationResponseAsynchronously
626         API test.
627
628         * loader/FrameLoader.cpp:
629         (WebCore::FrameLoader::stopLoading):
630         * loader/NavigationScheduler.cpp:
631         (WebCore::NavigationScheduler::schedule):
632
633 2018-02-27  Antoine Quint  <graouts@apple.com>
634
635         [Web Animations] Correct implementation of pending tasks and promises
636         https://bugs.webkit.org/show_bug.cgi?id=183161
637
638         Reviewed by Dean Jackson.
639
640         We had an incorrect implementation of the spec due to two misinterpretations.
641
642         The first one is about pending tasks (play and pause) which the spec says should
643         be performed by "scheduling a task". In WebCore, this means using postTask() on a
644         ScriptExecutionContext, such as Document. One of the big practical changes is that
645         calling play() on an animation correctly sets its startTime to null (unresolved)
646         immediately after the call to play() returns before setting it to a resolved value
647         when the task is performed asynchronously. As a result, the playState is now always
648         accurate.
649
650         The second one is about promises where new promises need to be created in certain
651         situations called out by the spec. We used to call clear() on them, but this merely
652         resets the fulfillment or rejection state of the promise, while the spec requires
653         a different object to be returned for the promise. We now create our promises using
654         makeUniqueRef<> when new promise objects are expected to be created.
655
656         This patch also corrects a few smaller bugs and spec compliant issues, called out
657         below, related to pending tasks and promises uncovered while looking at relevant
658         WPT tests.
659
660         * animation/DocumentTimeline.h: Expose the Document used to create this timeline such
661         that it may be used by WebAnimation objects registered for this timeline when scheduling
662         a task is required via postTask().
663         * animation/WebAnimation.cpp:
664         (WebCore::WebAnimation::WebAnimation):
665         (WebCore::WebAnimation::setBindingsStartTime):
666         (WebCore::WebAnimation::setCurrentTime):
667         (WebCore::WebAnimation::cancel): Ensure the finished promise has not already been fulfilled
668         before rejecting it. While the spec does not specifically call this out, a promise may not
669         be rejected after being fulfilled, and we would hit an ASSERT if we didn't also check that
670         it was in the correct pending state before attemping to reject it.
671         (WebCore::WebAnimation::resetPendingTasks):
672         (WebCore::WebAnimation::finish):
673         (WebCore::WebAnimation::updateFinishedState):
674         (WebCore::WebAnimation::finishNotificationSteps):
675         (WebCore::WebAnimation::play): We used to only check for a pending pause task before canceling
676         that task, but the spec says to check for either a pending pause or play task (ie. pending())
677         and to cancel whichever is scheduled.
678         (WebCore::WebAnimation::runPendingPlayTask): We were missing an assertion called out by the
679         spec when running a pending task.
680         (WebCore::WebAnimation::pause):
681         (WebCore::WebAnimation::runPendingPauseTask):
682         (WebCore::WebAnimation::updatePendingTasks): We now use postTask() on the animation's associated
683         timeline's document to schedule pending tasks for which the criteria to run are met, ie. there
684         is an associated timeline.
685         * animation/WebAnimation.h:
686
687 2018-02-27  Wenson Hsieh  <wenson_hsieh@apple.com>
688
689         [Extra zoom mode] Implement additional SPI for adjusting viewport shrink-to-fit behavior
690         https://bugs.webkit.org/show_bug.cgi?id=183100
691         <rdar://problem/37840987>
692
693         Reviewed by Tim Horton.
694
695         Introduce new customization options to ViewportConfiguration. The first is m_forceHorizontalShrinkToFit, which
696         (when set to true) forces the viewport to scale using shrink-to-fit heuristics, regardless of whether
697         "shrink-to-fit=no" is specified via viewport parameters or if content width did not exceed minimum layout size.
698         The second is m_viewSize, which reflects the true size of the viewport. See WebKit ChangeLog for more details.
699
700         Tests: ViewportSizingTests.ForceShrinkToFitViewportOverridesViewportParameters
701                ViewportSizingTests.ShrinkToFitViewportWithMinimumAllowedLayoutWidth
702
703         * page/ViewportConfiguration.cpp:
704         (WebCore::ViewportConfiguration::ViewportConfiguration):
705         (WebCore::ViewportConfiguration::setMinimumLayoutSize):
706
707         Plumb the real size of the view alongside the minimum layout size when updating the minimum layout size.
708
709         (WebCore::ViewportConfiguration::setForceHorizontalShrinkToFit):
710         (WebCore::ViewportConfiguration::shouldIgnoreHorizontalScalingConstraints const):
711
712         Bail early and return true if forceHorizontalShrinkToFit is set. This forces shrink-to-fit even in cases where
713         "shrink-to-fit" is set to "no", or content dimensions don't exceed layout dimensions.
714
715         (WebCore::ViewportConfiguration::initialScaleFromSize const):
716
717         Use view dimensions rather than minimum layout dimensions when computing the initial scale. Minimum layout size
718         is no longer always equal to the size of the view if the client has specified a minimum allowed layout width. As
719         such, when computing the initial scale, to ensure that the content (which was laid out using the minimum layout
720         size) fits within the real viewport, we need to divide real viewport dimensions by content dimensions.
721
722         (WebCore::ViewportConfiguration::minimumScale const):
723
724         Similarly, use view size instead of minimum layout size to compute minimum scale.
725
726         (WebCore::ViewportConfiguration::description const):
727         * page/ViewportConfiguration.h:
728
729 2018-02-27  Wenson Hsieh  <wenson_hsieh@apple.com>
730
731         Unreviewed, fix the debug build after r228877.
732
733         In the case where CAN_DISALLOW_USER_INSTALLED_FONTS is enabled, this function doesn't return anything when
734         allowUserInstalledFonts != AllowUserInstalledFonts::No. Fix the build by moving `return nullptr;` back out of
735         the `#else`.
736
737         * platform/graphics/cocoa/FontCacheCoreText.cpp:
738         (WebCore::installedFontMandatoryAttributes):
739
740 2018-02-27  Milan Crha  <mcrha@redhat.com>
741
742         Potential privacy issue: DNS prefetching can be re-enabled
743         https://bugs.webkit.org/show_bug.cgi?id=182924
744
745         Reviewed by Michael Catanzaro.
746
747         * dom/Document.cpp:
748         (WebCore::Document::parseDNSPrefetchControlHeader):
749
750 2018-02-26  Antoine Quint  <graouts@apple.com>
751
752         [Web Animations] Implement the procedure to set the target effect of an animation
753         https://bugs.webkit.org/show_bug.cgi?id=183146
754
755         Reviewed by Dean Jackson.
756
757         We only had a partial implementation of setEffect() and we now update it to cover the entire
758         implementation as mandated by the spec. While this doesn't yield any WPT results changes, this
759         patch will help getting a significant number of new PASS results when we get around to implement
760         correct support for async procedures (pending pause/play tasks and promises) in the next patch.
761
762         * animation/WebAnimation.cpp:
763         (WebCore::WebAnimation::setEffect):
764
765 2018-02-26  Antoine Quint  <graouts@apple.com>
766
767         [Web Animations] Update the playState implementation
768         https://bugs.webkit.org/show_bug.cgi?id=183145
769
770         Reviewed by Dean Jackson.
771
772         The Web Animations spec has changed since we first implemented the playState property and the "pending"
773         enum value has been dropped since then (there is a separate "pending" property which we also implement).
774         We update our implementation to match the latest spec text. This does not change WPT test results a lot,
775         but this patch will help getting a significant number of new PASS results when we get around to implementing
776         correct support for async procedures (pending pause/play tasks and promises) in a couple of patches.
777   
778         * animation/WebAnimation.cpp:
779         (WebCore::WebAnimation::playState const):
780         * animation/WebAnimation.h:
781         * animation/WebAnimation.idl:
782
783 2018-02-27  Wenson Hsieh  <wenson_hsieh@apple.com>
784
785         Address post-review comment after r229049.
786         https://bugs.webkit.org/show_bug.cgi?id=183142
787
788         Reviewed by Tim Horton.
789
790         Wrap a newly added string literal with ASCIILiteral.
791
792         * rendering/RenderThemeIOS.mm:
793         (WebCore::RenderThemeIOS::extraDefaultStyleSheet):
794
795 2018-02-26  Mark Lam  <mark.lam@apple.com>
796
797         Modernize FINALIZE_CODE and peer macros to use __VA_ARGS__ arguments.
798         https://bugs.webkit.org/show_bug.cgi?id=183159
799         <rdar://problem/37930837>
800
801         Reviewed by Keith Miller.
802
803         No new tests needed because this is just a refactoring patch.
804
805         * cssjit/SelectorCompiler.cpp:
806         (WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
807
808 2018-02-26  Dan Bernstein  <mitz@apple.com>
809
810         Removed references to files that were removed in r228912.
811
812         * WebCore.xcodeproj/project.pbxproj: Removed references to SourcesIOS.txt and SourcesMac.txt.
813
814 2018-02-26  Wenson Hsieh  <wenson_hsieh@apple.com>
815
816         [Extra zoom mode] Tweak UA stylesheet to improve legibility of rendered text
817         https://bugs.webkit.org/show_bug.cgi?id=183142
818         <rdar://problem/37912966>
819
820         Reviewed by Tim Horton.
821
822         Force text-size-adjust and hyphens to be always on in EXTRA_ZOOM_MODE. To accomplish this, we override the extra
823         style sheet in RenderTheme to include these two style rules.
824
825         * rendering/RenderThemeIOS.h:
826         * rendering/RenderThemeIOS.mm:
827         (WebCore::RenderThemeIOS::extraDefaultStyleSheet):
828
829 2018-02-26  Don Olmstead  <don.olmstead@sony.com>
830
831         Fix WebCore includes within WebKitLegacy
832         https://bugs.webkit.org/show_bug.cgi?id=183147
833
834         Reviewed by Tim Horton.
835
836         No new tests. No change in behavior.
837
838         * PlatformWin.cmake:
839         * platform/win/GDIUtilities.h:
840
841 2018-02-26  Youenn Fablet  <youenn@apple.com>
842
843         Add some more release logging related to DocumentWriter::addData crash
844         https://bugs.webkit.org/show_bug.cgi?id=183141
845
846         Reviewed by Chris Dumez.
847
848         No change of behavior.
849         Add some additional release logging to verify whether DocumentWriter::begin was called and exited before updating its state.
850
851         * loader/DocumentLoader.cpp:
852         (WebCore::DocumentLoader::commitData):
853         * loader/DocumentWriter.cpp:
854         (WebCore::DocumentWriter::begin):
855         * loader/DocumentWriter.h:
856
857 2018-02-26  Antoine Quint  <graouts@apple.com>
858
859         [Web Animations] Implement the procedure to set the start time
860         https://bugs.webkit.org/show_bug.cgi?id=183137
861
862         Reviewed by Dean Jackson.
863
864         Implement the procedure to set the start time as setBindingsStartTime() and use the setStartTime() method as
865         an internal method to set the m_startTime instance variable and invalidate the timing model rather than run
866         the entire procedure which should only be called when setting the "startTime" property through the JS API.
867
868         * animation/WebAnimation.cpp:
869         (WebCore::WebAnimation::setTimeline):
870         (WebCore::WebAnimation::setBindingsStartTime):
871         (WebCore::WebAnimation::setStartTime):
872         (WebCore::WebAnimation::silentlySetCurrentTime):
873         (WebCore::WebAnimation::finish):
874         (WebCore::WebAnimation::updateFinishedState):
875         (WebCore::WebAnimation::runPendingPlayTask):
876         (WebCore::WebAnimation::runPendingPauseTask):
877
878 2018-02-26  Christopher Reid  <chris.reid@sony.com>
879
880         [Curl] Cookies are not being added to the Cookie field in Request Headers
881         https://bugs.webkit.org/show_bug.cgi?id=183095
882
883         Reviewed by Alex Christensen.
884
885         Populating the Cookie request header field now that cookies are no longer handled in libcurl.
886
887         * platform/network/curl/CookieJarCurlDatabase.cpp: Renaming the httpOnly variable as its actual use wasn't clear
888         * platform/network/curl/ResourceHandleCurl.cpp:
889
890 2018-02-26  Antoine Quint  <graouts@apple.com>
891
892         [Web Animations] Ensure setting the hold time invalidates the timing model
893         https://bugs.webkit.org/show_bug.cgi?id=183136
894
895         Reviewed by Dean Jackson.
896
897         We used to always set the m_holdTime member variable directly, but the computation of the currentTime
898         depends on the value of m_holdTime, so setting the hold time should invalidate the timing model as well
899         as setting the m_holdTime member variable. In this patch we add a new setHoldTime() private method that
900         sets the member variable and invalidates the timing model.
901
902         * animation/WebAnimation.cpp:
903         (WebCore::WebAnimation::setTimeline):
904         (WebCore::WebAnimation::setHoldTime):
905         (WebCore::WebAnimation::silentlySetCurrentTime):
906         (WebCore::WebAnimation::setCurrentTime):
907         (WebCore::WebAnimation::cancel):
908         (WebCore::WebAnimation::finish):
909         (WebCore::WebAnimation::updateFinishedState):
910         (WebCore::WebAnimation::play):
911         (WebCore::WebAnimation::runPendingPlayTask):
912         (WebCore::WebAnimation::pause):
913         (WebCore::WebAnimation::runPendingPauseTask):
914         * animation/WebAnimation.h:
915
916 2018-02-26  Youenn Fablet  <youenn@apple.com>
917
918         MessagePort is not always destroyed in the right thread
919         https://bugs.webkit.org/show_bug.cgi?id=183053
920
921         Reviewed by Chris Dumez.
922
923         Make existingMessagePortForIdentifier take a lambda so that we hold the lock until there
924         is no longer a need to keep the MessagePort around.
925         This is very time sensitive and does not happen a lot when running WPT tests.
926
927         Update existing call sites to pass a lambda.
928
929         * dom/MessagePort.cpp:
930         (WebCore::MessagePort::existingMessagePortForIdentifier):
931         * dom/MessagePort.h:
932         * dom/messageports/MessagePortChannelProviderImpl.cpp:
933         (WebCore::MessagePortChannelProviderImpl::postMessageToRemote):
934         (WebCore::MessagePortChannelProviderImpl::checkProcessLocalPortForActivity):
935
936 2018-02-26  Commit Queue  <commit-queue@webkit.org>
937
938         Unreviewed, rolling out r226745.
939         https://bugs.webkit.org/show_bug.cgi?id=183132
940
941         This is breaking some websites (Requested by youenn on
942         #webkit).
943
944         Reverted changeset:
945
946         "Use no-cache fetch mode when loading main documents with
947         location.reload()"
948         https://bugs.webkit.org/show_bug.cgi?id=181285
949         https://trac.webkit.org/changeset/226745
950
951 2018-02-26  Philippe Normand  <pnormand@igalia.com>
952
953         Unreviewed, USE_GSTREAMER_PLAYBIN3 build fix.
954
955         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
956         There is no such ENABLE_GSTREAMER_PLAYBIN3.
957
958 2018-02-26  Philippe Normand  <pnormand@igalia.com>
959
960         Unreviewed, manual rollout of r228866 causing EGL_BAD_CONTEXT errors
961
962         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
963         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext):
964         Create an EGL display, even in Wayland.
965
966 2018-02-21  Sergio Villar Senin  <svillar@igalia.com>
967
968         [WebVR][OpenVR] Retrieve displayId and the z-depth of eye view frustum
969         https://bugs.webkit.org/show_bug.cgi?id=182999
970
971         Reviewed by Žan Doberšek.
972
973         Retrieve the z-depth of the eye view frustum and the HMD unique id.
974         The unique identifier is generated by the VRPlatormManager whereas
975         we use the default values from the spec for the z-depth (those can
976         be changed by applications later via JavaScript).
977
978         Once this lands the only remaining data to be retrieved from VR
979         backends for VRDisplay is the pose (getPose() call) and the frame
980         data (getFrameData() call).
981
982         * Modules/webvr/VRDisplay.cpp:
983         (WebCore::VRDisplay::VRDisplay):
984         (WebCore::VRDisplay::displayId const): Deleted.
985         (WebCore::VRDisplay::displayName const): Deleted.
986         (WebCore::VRDisplay::depthNear const): Deleted.
987         (WebCore::VRDisplay::setDepthNear): Deleted.
988         (WebCore::VRDisplay::depthFar const): Deleted.
989         (WebCore::VRDisplay::setDepthFar): Deleted.
990         * Modules/webvr/VRDisplay.h:
991         (WebCore::VRDisplay::displayId const): Moved implementation from
992         source file.
993         (WebCore::VRDisplay::displayName const): Ditto.
994         (WebCore::VRDisplay::depthNear const):
995         (WebCore::VRDisplay::setDepthNear):
996         (WebCore::VRDisplay::depthFar const):
997         (WebCore::VRDisplay::setDepthFar):
998         * platform/vr/VRManager.cpp:
999         (WebCore::VRManager::generateUniqueDisplayIdentifier):
1000         * platform/vr/VRManager.h:
1001         * platform/vr/VRPlatformDisplay.h:
1002         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
1003         (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
1004
1005 2018-02-26  Charlie Turner  <cturner@igalia.com>
1006
1007         Fix build error with !LOG_DISABLED
1008         https://bugs.webkit.org/show_bug.cgi?id=183049
1009
1010         Reviewed by Philippe Normand.
1011
1012         The following error message was being reported when doing a
1013         release build with -DLOG_DISABLED=0:
1014
1015         ../../Source/WebCore/dom/messageports/MessagePortChannel.cpp: In member function ‘void WebCore::MessagePortChannel::entanglePortWithProcess(const WebCore::MessagePortIdentifier&, WebCore::ProcessIdentifier)’:
1016 ../../Source/WebCore/dom/messageports/MessagePortChannel.cpp:85:111: error: ‘logString’ was not declared in this scope
1017      LOG(MessagePorts, "MessagePortChannel %s (%p) entangling port %s (that port has %zu messages available)", logString().utf8().data(), this, port.logString().utf8().data(), m_pendingMessages[i].size());
1018
1019         Other uses of logString are guarded by !LOG_DISABLED rather than
1020         NDEBUG, which was the cause of this issue.
1021
1022         * dom/messageports/MessagePortChannel.h: Guard using !LOG_DISABLED
1023         rather than NDEBUG.
1024
1025 2018-02-26  Carlos Garcia Campos  <cgarcia@igalia.com>
1026
1027         [GStreamer] User current executable name instead of g_get_prgname() for gst_init
1028         https://bugs.webkit.org/show_bug.cgi?id=183119
1029
1030         Reviewed by Philippe Normand.
1031
1032         g_get_prgname() is only set for programs using GOptionContext, calling gtk_init or explicitly calling
1033         g_set_prgname(). Use WTF::getCurrentExecutableName() instead.
1034
1035         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
1036         (WebCore::initializeGStreamer):
1037
1038 2018-02-25  Wenson Hsieh  <wenson_hsieh@apple.com>
1039
1040         [Extra zoom mode] Disable downloadable binary fonts by default
1041         https://bugs.webkit.org/show_bug.cgi?id=183102
1042         <rdar://problem/37860699>
1043
1044         Reviewed by Tim Horton.
1045
1046         Disable downloadable binary fonts by default in extra zoom mode by making the initial value of
1047         `downloadableBinaryFontsEnabled` conditional. Layout tests are not possible at this time; test to be added once
1048         layout test support is in place.
1049
1050         * page/Settings.yaml:
1051         * page/SettingsBase.cpp:
1052         (WebCore::SettingsBase::defaultDownloadableBinaryFontsEnabled):
1053         * page/SettingsBase.h:
1054
1055 2018-02-25  Chris Dumez  <cdumez@apple.com>
1056
1057         Service workers do not work well inside Web.app
1058         https://bugs.webkit.org/show_bug.cgi?id=183105
1059         <rdar://problem/37864140>
1060
1061         Reviewed by Youenn Fablet.
1062
1063         SessionID::defaultSessionID() was hardcoded in the ServiceWorkerThread constructor
1064         instead of using the sessionID of the SWServer that created the service worker thread.
1065         As a result, when the Service Worker would establish a SWClientConnection to the
1066         server, it would use the wrong sessionID and would end up using a different SWServer
1067         (Since we have a different SWServer instance per sessionID). As a result,
1068         ServiceWorkerRegistration / ServiceWorker objects inside the service worker would not
1069         be kept in sync with the server (since they registered themselves with the wrong
1070         SWServer).
1071
1072         Covered by new API test.
1073
1074         * workers/service/ServiceWorkerContextData.cpp:
1075         (WebCore::ServiceWorkerContextData::isolatedCopy const):
1076         * workers/service/ServiceWorkerContextData.h:
1077         (WebCore::ServiceWorkerContextData::encode const):
1078         (WebCore::ServiceWorkerContextData::decode):
1079         * workers/service/context/ServiceWorkerThread.cpp:
1080         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
1081         * workers/service/context/ServiceWorkerThreadProxy.cpp:
1082         (WebCore::createPageForServiceWorker):
1083         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
1084         * workers/service/server/RegistrationDatabase.cpp:
1085         (WebCore::RegistrationDatabase::importRecords):
1086         * workers/service/server/RegistrationStore.h:
1087         (WebCore::RegistrationStore::server):
1088         * workers/service/server/SWServer.cpp:
1089         (WebCore::SWServer::updateWorker):
1090         * workers/service/server/SWServerWorker.cpp:
1091         (WebCore::SWServerWorker::contextData const):
1092
1093 2018-02-24  Fujii Hironori  <Hironori.Fujii@sony.com>
1094
1095         Null-dereference of the second argument `resource` of DocumentLoader::scheduleSubstituteResourceLoad
1096         https://bugs.webkit.org/show_bug.cgi?id=182920
1097
1098         Reviewed by Darin Adler.
1099
1100         A test case
1101         imported/w3c/web-platform-tests/html/browsers/offline/appcache/workers/appcache-worker.html
1102         always crashes due to a null-dereference if compiled and optimized
1103         by GCC 7.2. The second argument `resource` of
1104         DocumentLoader::scheduleSubstituteResourceLoad can be null if the
1105         resource can't be found in cache. I guess GCC optimizes inline
1106         HashMap::add based on assuming the `resource` never becomes null
1107         because its type is SubstituteResource&.
1108
1109         This changes introduces a new method
1110         DocumentLoader::scheduleCannotShowURLError because it looks tricky
1111         to pass a nullptr to the second argument of
1112         scheduleSubstituteResourceLoad.
1113
1114         No new tests (Covered by existing tests).
1115
1116         * loader/DocumentLoader.cpp:
1117         (WebCore::DocumentLoader::scheduleCannotShowURLError): Added a new method.
1118         * loader/DocumentLoader.h:
1119         * loader/appcache/ApplicationCacheHost.cpp:
1120         (WebCore::ApplicationCacheHost::maybeLoadResource):
1121         Call scheduleCannotShowURLError if the resource not found in the appcache.
1122
1123 2018-02-17  Darin Adler  <darin@apple.com>
1124
1125         Prepare for ExtendedColor changes (first step)
1126         https://bugs.webkit.org/show_bug.cgi?id=182904
1127
1128         Reviewed by Sam Weinig.
1129
1130         * css/CSSValuePool.cpp:
1131         (WebCore::CSSValuePool::createColorValue): Use HashMap::ensure.
1132         (WebCore::CSSValuePool::createFontFamilyValue): Ditto.
1133         (WebCore::CSSValuePool::createFontFaceValue): Ditto.
1134
1135         * css/parser/CSSParserFastPaths.cpp:
1136         (WebCore::CSSParserFastPaths::maybeParseValue): Tightened up
1137         the logic a bit.
1138
1139         * html/canvas/CanvasRenderingContext2D.cpp: Removed many unneeded includes.
1140
1141         * inspector/InspectorCanvas.cpp:
1142         (WebCore::InspectorCanvas::recordAction): Updated for Ref instead of
1143         RefPtr and to use move semantics.
1144         (WebCore::buildArrayForAffineTransform): Return Ref instead of RefPtr.
1145         (WebCore::buildArrayForVector): Ditto.
1146         (WebCore::InspectorCanvas::buildInitialState): Ditto. Also use auto more.
1147         (WebCore::InspectorCanvas::buildAction): Ditto.
1148         (WebCore::InspectorCanvas::buildArrayForCanvasGradient): Ditto.
1149         (WebCore::InspectorCanvas::buildArrayForCanvasPattern): Ditto.
1150         (WebCore::InspectorCanvas::buildArrayForImageData): Ditto.
1151         * inspector/InspectorCanvas.h: Updated for the above. Also us "using" instead
1152         of typedef and removed unneeded ErrorString typedef and some includes.
1153
1154         * page/DragController.cpp:
1155         (WebCore::DragController::concludeEditDrag): Use auto and Ref.
1156
1157         * platform/DragData.h: Used pragma once and reorganized includes a bit.
1158
1159         * platform/graphics/ImageFrame.h:
1160         (WebCore::ImageFrame::frameBytes const): Use uint32_t instead of RGBA32 to
1161         prepare for removal of the RGBA32 type coming in a future patch.
1162         * platform/graphics/ImageSource.cpp:
1163         (WebCore::ImageSource::cacheNativeImageAtIndex): Ditto.
1164         (WebCore::ImageSource::canUseAsyncDecoding): Ditto.
1165
1166         * platform/graphics/cocoa/GraphicsContextCocoa.mm: Tweaked #if for Mac-only
1167         code to use PLATFORM(MAC) to be easier to read.
1168         (WebCore::GraphicsContext::focusRingColor): Use sRGBColorSpaceRef instead of
1169         calling CGColorSpaceCreateWithName each time.
1170
1171         * platform/graphics/texmap/TextureMapperFPSCounter.cpp: Added include needed
1172         now that it was removed from some header.
1173
1174         * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h: Use uint32_t
1175         instead of RGBA32 to prepare for removal of the RGBA32 type coming in a future patch.
1176         * platform/image-decoders/ScalableImageDecoder.cpp:
1177         (WebCore::ScalableImageDecoder::frameBytesAtIndex const): Ditto.
1178         * platform/image-decoders/cairo/ImageBackingStoreCairo.cpp:
1179         (WebCore::ImageBackingStore::image const): Ditto.
1180         * platform/image-decoders/gif/GIFImageDecoder.cpp:
1181         (WebCore::GIFImageDecoder::haveDecodedRow): Ditto.
1182         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
1183         (WebCore::setPixel): Ditto.
1184         (WebCore::JPEGImageDecoder::outputScanlines): Ditto.
1185         * platform/image-decoders/png/PNGImageDecoder.cpp:
1186         (WebCore::PNGImageDecoder::rowAvailable): Ditto.
1187         (WebCore::PNGImageDecoder::frameComplete): Ditto.
1188         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
1189         (WebCore::WEBPImageDecoder::decodeFrame): Ditto.
1190         (WebCore::WEBPImageDecoder::applyPostProcessing): Ditto.
1191
1192         * platform/mac/PlatformPasteboardMac.mm:
1193         (WebCore::PlatformPasteboard::color): Added comments.
1194
1195         * rendering/EllipsisBox.cpp:
1196         (WebCore::EllipsisBox::paintSelection): Use Color::isVisible.
1197
1198 2018-02-23  Chris Dumez  <cdumez@apple.com>
1199
1200         Crash under SchemeRegistry::shouldTreatURLSchemeAsLocal(WTF::String const&)
1201         https://bugs.webkit.org/show_bug.cgi?id=183066
1202         <rdar://problem/37804111>
1203
1204         Reviewed by Ryosuke Niwa.
1205
1206         SecurityOrigin objects are constructed on various threads. However, someone added a
1207         shouldTreatAsPotentiallyTrustworthy() call to the SecurityOrigin constructor which
1208         was not thread safe. This is because this function relies on SchemeRegistry::shouldTreatURLSchemeAsSecure()
1209         and SchemeRegistry::shouldTreatURLSchemeAsLocal() which were relying on global static HashMaps without
1210         locks.
1211
1212         Update SecurityOrigin to initialize m_isPotentiallyTrustworthy lazily, to avoid paying
1213         initialization cost in the constructor. This is only queries by SecurityContext::isSecureContext().
1214
1215         Make SchemeRegistry::shouldTreatURLSchemeAsLocal() and SchemeRegistry::shouldTreatURLSchemeAsSecure()
1216         thread-safe, since they are needed to initialize SecurityOrigin::m_isPotentiallyTrustworthy from
1217         various threads.
1218
1219         SchemeRegistry::shouldTreatURLSchemeAsSecure() is only called from SecurityOrigin (which requires
1220         thread-safety), and getUserMedia() which is not hot code so the extra locking there should not
1221         be an issue.
1222
1223         SchemeRegistry::shouldTreatURLSchemeAsLocal() is called from SecurityOrigin (which requires thread-
1224         safety). It is also called from isQuickLookPreviewURL(), MHTMLArchive::create(), Page::userStyleSheetLocationChanged(),
1225         isRemoteWebArchive() and HTMLPlugInImageElement. All these are not hot code so I do not think
1226         we need a fast path.
1227
1228         * page/SecurityOrigin.cpp:
1229         (WebCore::isLoopbackIPAddress):
1230         (WebCore::shouldTreatAsPotentiallyTrustworthy):
1231         (WebCore::SecurityOrigin::isPotentiallyTrustworthy const):
1232         (WebCore::SecurityOrigin::isLocalHostOrLoopbackIPAddress):
1233         * page/SecurityOrigin.h:
1234         * platform/SchemeRegistry.cpp:
1235         (WebCore::localURLSchemesLock):
1236         (WebCore::localURLSchemes):
1237         (WebCore::secureSchemesLock):
1238         (WebCore::secureSchemes):
1239         (WebCore::SchemeRegistry::registerURLSchemeAsLocal):
1240         (WebCore::SchemeRegistry::removeURLSchemeRegisteredAsLocal):
1241         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal):
1242         (WebCore::SchemeRegistry::registerURLSchemeAsSecure):
1243         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsSecure):
1244         * platform/SchemeRegistry.h:
1245
1246 2018-02-23  Christopher Reid  <chris.reid@sony.com>
1247
1248         [Curl] Cookie Database files are wrongfully getting deleted when the database is opened
1249         https://bugs.webkit.org/show_bug.cgi?id=183051
1250
1251         Reviewed by Per Arne Vollan.
1252
1253         The file stat logic was backwards causing a wrongful detection of database corruption.
1254         Fixed the logic and abstracted these calls to use FileSystem.
1255
1256         * platform/network/curl/CookieJarDB.cpp:
1257
1258 2018-02-23  Zalan Bujtas  <zalan@apple.com>
1259
1260         [RenderTreeBuilder] Make RenderTreeBuilder::* classes WTF_MAKE_FAST_ALLOCATED
1261         https://bugs.webkit.org/show_bug.cgi?id=183084
1262         <rdar://problem/37828706>
1263
1264         Reviewed by Antti Koivisto.
1265
1266         * rendering/updating/RenderTreeBuilderBlock.h:
1267         * rendering/updating/RenderTreeBuilderBlockFlow.h:
1268         * rendering/updating/RenderTreeBuilderContinuation.h:
1269         * rendering/updating/RenderTreeBuilderFirstLetter.h:
1270         * rendering/updating/RenderTreeBuilderFormControls.h:
1271         * rendering/updating/RenderTreeBuilderFullScreen.h:
1272         * rendering/updating/RenderTreeBuilderInline.h:
1273         * rendering/updating/RenderTreeBuilderList.h:
1274         * rendering/updating/RenderTreeBuilderMathML.h:
1275         * rendering/updating/RenderTreeBuilderMultiColumn.h:
1276         * rendering/updating/RenderTreeBuilderRuby.h:
1277         * rendering/updating/RenderTreeBuilderSVG.h:
1278         * rendering/updating/RenderTreeBuilderTable.h:
1279         * rendering/updating/RenderTreeUpdaterGeneratedContent.h:
1280
1281 2018-02-23  Zalan Bujtas  <zalan@apple.com>
1282
1283         [RenderTreeBuilder] Move RenderFullScreen::createPlaceholder to RenderTreeBuilder
1284         https://bugs.webkit.org/show_bug.cgi?id=183027
1285         <rdar://problem/37773058>
1286
1287         Reviewed by Antti Koivisto.
1288
1289         No change in functionality.
1290
1291         * dom/Document.cpp:
1292         (WebCore::Document::setFullScreenRenderer):
1293         * dom/Document.h:
1294         * rendering/RenderFullScreen.cpp:
1295         (WebCore::RenderFullScreenPlaceholder::RenderFullScreenPlaceholder):
1296         (WebCore::RenderFullScreenPlaceholder::isRenderFullScreenPlaceholder const):
1297         (WebCore::RenderFullScreen::wrapNewRenderer):
1298         (WebCore::RenderFullScreen::wrapExistingRenderer):
1299         (): Deleted.
1300         (WebCore::RenderFullScreen::createPlaceholder): Deleted.
1301         * rendering/RenderFullScreen.h:
1302         * rendering/updating/RenderTreeBuilder.cpp:
1303         (WebCore::RenderTreeBuilder::createPlaceholderForFullScreen):
1304         * rendering/updating/RenderTreeBuilder.h:
1305         * rendering/updating/RenderTreeBuilderFullScreen.cpp:
1306         (WebCore::RenderTreeBuilder::FullScreen::createPlaceholder):
1307         * rendering/updating/RenderTreeBuilderFullScreen.h:
1308
1309 2018-02-23  Zalan Bujtas  <zalan@apple.com>
1310
1311         [RenderTreeBuilder] Add WARN_UNUSED_RETURN to detach()
1312         https://bugs.webkit.org/show_bug.cgi?id=183073
1313         <rdar://problem/37814585>
1314
1315         Reviewed by Antti Koivisto.
1316
1317         So that we don't destroy a renderer accidentally.
1318
1319         * rendering/updating/RenderTreeBuilderBlock.h:
1320         * rendering/updating/RenderTreeBuilderRuby.h:
1321         * rendering/updating/RenderTreeBuilderSVG.h:
1322
1323 2018-02-22  Antoine Quint  <graouts@apple.com>
1324
1325         REGRESSION (r228445): A big pause button shows over YouTube videos if you tap "Tap To Unmute" on iOS
1326         https://bugs.webkit.org/show_bug.cgi?id=183074
1327         <rdar://problem/37747028>
1328
1329         Reviewed by Eric Carlson.
1330
1331         Test: media/modern-media-controls/start-support/start-support-disable-controls-and-re-enable-post-play.html
1332
1333         In the fix for webkit.org/b/182668, we made it so that when the "controls" attribute is absent from a media
1334         element we stop listening to the bulk of media events and prevent controls from updating any DOM properties
1335         so as to minimize the amount of CPU usage by the Web process.
1336
1337         An unfortunate side effect was that, if the media controls were disabled at the time the video starts playing,
1338         the StartSupport class would thus not catch the "play" event and would not be able to set the "hasPlayed"
1339         property to "true" on the MediaController, which would then prevent the _shouldShowStartButton() from returning
1340         "false". As a result, if the "controls" attribute was turned back on after the media started playing, they
1341         would default to showing the start button, which would be then in the play state, ie. showing the pause icon.
1342
1343         We now set the "hasPlayed" property in the "play" event handler on MediaController, which is always registered
1344         regardless of the "controls" attribute setting. We also ensure we invalidate the "showStartButton" property on
1345         the media controls when StartSupport is enabled, which is the case when the "controls" attribute is toggled back
1346         to "true" from a previous "false" value.
1347
1348         * Modules/modern-media-controls/media/media-controller.js:
1349         (MediaController.prototype.handleEvent):
1350         * Modules/modern-media-controls/media/start-support.js:
1351         (StartSupport):
1352         (StartSupport.prototype.enable):
1353         (StartSupport.prototype.handleEvent):
1354         (StartSupport.prototype._updateShowsStartButton):
1355
1356 2018-02-23  Carlos Garcia Campos  <cgarcia@igalia.com>
1357
1358         [GStreamer][MiniBrowser] Honor GStreamer command line parameters in MiniBrowser
1359         https://bugs.webkit.org/show_bug.cgi?id=173655
1360         <rdar://problem/37706341>
1361
1362         Reviewed by Philippe Normand.
1363
1364         Do not assume gst is only used in the WebProcess, the MIMETypeRegistry also uses gst to get the list of
1365         supported media types. Move the code to extract gst options from the process command line to a helper function
1366         and use it in the UI process to pass the options to the WebProcess, but also in the current process when gst is
1367         initialized without providing options.
1368
1369         Fixes several unit tests that use MIMETypeRegistry in the UI process.
1370
1371         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
1372         (WebCore::extractGStreamerOptionsFromCommandLine): Helper to get the gst options from the current process
1373         command line.
1374         (WebCore::initializeGStreamer): Ensure this is called once. Get the gst options from the given vector or extract
1375         it from the command line if not provided.
1376         * platform/graphics/gstreamer/GStreamerUtilities.h:
1377         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1378         (WebCore::MediaPlayerPrivateGStreamerBase::initializeGStreamerAndRegisterWebKitElements): Bring back the gst
1379         initialization here.
1380
1381 2018-02-23  Philippe Normand  <pnormand@igalia.com>
1382
1383         [GStreamer] HTTP totalBytes query returns 0 after seeking (sometimes)
1384         https://bugs.webkit.org/show_bug.cgi?id=183002
1385
1386         Reviewed by Xabier Rodriguez-Calvar.
1387
1388         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1389         (webkit_web_src_init): Initialize member variables. Also no need
1390         to set the appsrc size at that point.
1391         (webKitWebSrcStop): There is no need to reset the size when
1392         seeking. Size should in most cases represent the Content-Length
1393         response attribute, even when seeking.
1394         (webKitWebSrcStart): No need to reset the size attribute.
1395         (webKitWebSrcQueryWithParent): Let appsrc handle DURATION queries.
1396         (CachedResourceStreamingClient::responseReceived): Emit duration notification one time only.
1397
1398 2018-02-23  Philippe Normand  <pnormand@igalia.com>
1399
1400         [GStreamer] media/video-src-blob-using-open-panel.html crashes in Debug
1401         https://bugs.webkit.org/show_bug.cgi?id=183005
1402
1403         Reviewed by Xabier Rodriguez-Calvar.
1404
1405         Test: media/video-src-blob-using-open-panel.html
1406
1407         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1408         (WebCore::convertToInternalProtocol): Also convert blob URIs
1409         because they're handled by our httpsrc element.
1410         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1411         (webKitWebSrcGetProtocols): Prefix blob URIs too, for consistency purpose.
1412
1413 2018-02-22  Yusuke Suzuki  <utatane.tea@gmail.com>
1414
1415         Remove currentTime() / currentTimeMS()
1416         https://bugs.webkit.org/show_bug.cgi?id=183052
1417
1418         Reviewed by Mark Lam.
1419
1420         * Modules/geolocation/Geolocation.cpp:
1421         (WebCore::Geolocation::haveSuitableCachedPosition):
1422         * dom/DOMTimeStamp.h:
1423         (WebCore::convertSecondsToDOMTimeStamp):
1424         * fileapi/File.cpp:
1425         (WebCore::File::File):
1426         (WebCore::File::lastModified const):
1427         * history/HistoryItem.cpp:
1428         (WebCore::generateSequenceNumber):
1429         * html/BaseDateAndTimeInputType.cpp:
1430         (WebCore::BaseDateAndTimeInputType::defaultValueForStepUp const):
1431         * html/DateTimeInputType.cpp:
1432         (WebCore::DateTimeInputType::defaultValueForStepUp const):
1433         * html/MonthInputType.cpp:
1434         (WebCore::MonthInputType::defaultValueForStepUp const):
1435         * html/TimeInputType.cpp:
1436         (WebCore::TimeInputType::defaultValueForStepUp const):
1437         * inspector/agents/InspectorNetworkAgent.cpp:
1438         (WebCore::InspectorNetworkAgent::willSendRequest):
1439         (WebCore::InspectorNetworkAgent::willSendWebSocketHandshakeRequest):
1440         * loader/EmptyFrameLoaderClient.h:
1441         * loader/FormSubmission.cpp:
1442         (WebCore::generateFormDataIdentifier):
1443         * loader/FrameLoader.cpp:
1444         (WebCore::FrameLoader::clientRedirected):
1445         * loader/FrameLoader.h:
1446         * loader/FrameLoaderClient.h:
1447         * loader/NavigationScheduler.cpp:
1448         * page/History.cpp:
1449         (WebCore::History::stateObjectAdded):
1450         * page/History.h:
1451         * page/PageOverlay.cpp:
1452         (WebCore::PageOverlay::startFadeAnimation):
1453         (WebCore::PageOverlay::fadeAnimationTimerFired):
1454         * page/PageOverlay.h:
1455         * platform/graphics/cg/GraphicsContextCG.cpp:
1456         (WebCore::GraphicsContext::drawNativeImage):
1457         * platform/ios/LegacyTileLayerPool.h:
1458         * platform/ios/LegacyTileLayerPool.mm:
1459         (WebCore::LegacyTileLayerPool::LegacyTileLayerPool):
1460         (WebCore::LegacyTileLayerPool::addLayer):
1461         (WebCore::LegacyTileLayerPool::decayedCapacity const):
1462         (WebCore::LegacyTileLayerPool::prune):
1463         * platform/ios/SystemMemoryIOS.cpp:
1464         (WebCore::systemMemoryLevel):
1465         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
1466         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
1467
1468 2018-02-22  Per Arne Vollan  <pvollan@apple.com>
1469
1470         The WebContent process should not use NSScreen in the screenDepth implementation.
1471         https://bugs.webkit.org/show_bug.cgi?id=183048
1472
1473         Reviewed by Brent Fulgham.
1474
1475         NSScreen method calls should be done in the UIProcess, since these calls will communicate with
1476         the WindowServer. The screen depth property can be retrieved in the UIProcess, and sent to the
1477         WebContent process, where it is cached. Whenever screen properties change, the UIProcess will
1478         send the new screen properties to the WebProcess.
1479
1480         No new tests, covered by existing tests.
1481
1482         * platform/ScreenProperties.h:
1483         (WebCore::ScreenProperties::encode const):
1484         (WebCore::ScreenProperties::decode):
1485         * platform/mac/PlatformScreenMac.mm:
1486         (WebCore::getScreenProperties):
1487         (WebCore::screenDepth):
1488         (WebCore::screenDepthPerComponent):
1489         (WebCore::screenRect):
1490         (WebCore::screenAvailableRect):
1491
1492 2018-02-22  Zalan Bujtas  <zalan@apple.com>
1493
1494         [RenderTreeBuilder] Rename insertChild() -> attach(), takeChild() -> detach() and removeAndDestroy() -> destroy()
1495         https://bugs.webkit.org/show_bug.cgi?id=183061
1496         <rdar://problem/37800269>
1497
1498         Reviewed by Ryosuke Niwa.
1499
1500         ...and moveChildTo() -> move() (moveChildrenTo() -> moveChildren()),
1501         removeFromParentAndDestroyCleaningUpAnonymousWrappers() -> destroyAndCleanUpAnonymousWrappers()
1502
1503         No change in functionality.
1504
1505         * dom/Document.cpp:
1506         (WebCore::Document::destroyRenderTree):
1507         (WebCore::Document::setFullScreenRenderer):
1508         * rendering/RenderBlockFlow.cpp:
1509         (WebCore::RenderBlockFlow::styleDidChange):
1510         * rendering/RenderButton.cpp:
1511         (WebCore::RenderButton::setText):
1512         * rendering/RenderElement.cpp:
1513         (WebCore::RenderElement::didAttachChild):
1514         (WebCore::RenderElement::didInsertChild): Deleted.
1515         * rendering/RenderElement.h:
1516         * rendering/RenderFullScreen.cpp:
1517         (WebCore::RenderFullScreen::wrapNewRenderer):
1518         (WebCore::RenderFullScreen::wrapExistingRenderer):
1519         (WebCore::RenderFullScreen::unwrapRenderer):
1520         (WebCore::RenderFullScreen::createPlaceholder):
1521         * rendering/RenderMenuList.cpp:
1522         (RenderMenuList::didAttachChild):
1523         (RenderMenuList::setText):
1524         (RenderMenuList::didInsertChild): Deleted.
1525         * rendering/RenderMenuList.h:
1526         * rendering/RenderQuote.cpp:
1527         (WebCore::RenderQuote::updateTextRenderer):
1528         * rendering/RenderTextFragment.cpp:
1529         (WebCore::RenderTextFragment::setText):
1530         * rendering/updating/RenderTreeBuilder.cpp:
1531         (WebCore::RenderTreeBuilder::destroy):
1532         (WebCore::RenderTreeBuilder::attach):
1533         (WebCore::RenderTreeBuilder::attachIgnoringContinuation):
1534         (WebCore::RenderTreeBuilder::detach):
1535         (WebCore::RenderTreeBuilder::attachToRenderElement):
1536         (WebCore::RenderTreeBuilder::attachToRenderElementInternal):
1537         (WebCore::RenderTreeBuilder::move):
1538         (WebCore::RenderTreeBuilder::moveAllChildren):
1539         (WebCore::RenderTreeBuilder::moveChildren):
1540         (WebCore::RenderTreeBuilder::moveAllChildrenIncludingFloats):
1541         (WebCore::RenderTreeBuilder::makeChildrenNonInline):
1542         (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild):
1543         (WebCore::RenderTreeBuilder::childFlowStateChangesAndAffectsParentBlock):
1544         (WebCore::RenderTreeBuilder::destroyAndCleanUpAnonymousWrappers):
1545         (WebCore::RenderTreeBuilder::detachFromRenderGrid):
1546         (WebCore::RenderTreeBuilder::detachFromRenderElement):
1547         (WebCore::RenderTreeBuilder::attachToRenderGrid):
1548         (WebCore::RenderTreeBuilder::removeAndDestroy): Deleted.
1549         (WebCore::RenderTreeBuilder::insertChild): Deleted.
1550         (WebCore::RenderTreeBuilder::insertChildIgnoringContinuation): Deleted.
1551         (WebCore::RenderTreeBuilder::takeChild): Deleted.
1552         (WebCore::RenderTreeBuilder::insertChildToRenderElement): Deleted.
1553         (WebCore::RenderTreeBuilder::insertChildToRenderElementInternal): Deleted.
1554         (WebCore::RenderTreeBuilder::moveChildTo): Deleted.
1555         (WebCore::RenderTreeBuilder::moveAllChildrenTo): Deleted.
1556         (WebCore::RenderTreeBuilder::moveChildrenTo): Deleted.
1557         (WebCore::RenderTreeBuilder::moveAllChildrenIncludingFloatsTo): Deleted.
1558         (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers): Deleted.
1559         (WebCore::RenderTreeBuilder::takeChildFromRenderGrid): Deleted.
1560         (WebCore::RenderTreeBuilder::takeChildFromRenderElement): Deleted.
1561         (WebCore::RenderTreeBuilder::insertChildToRenderGrid): Deleted.
1562         * rendering/updating/RenderTreeBuilder.h:
1563         * rendering/updating/RenderTreeBuilderBlock.cpp:
1564         (WebCore::RenderTreeBuilder::Block::attach):
1565         (WebCore::RenderTreeBuilder::Block::insertChildToContinuation):
1566         (WebCore::RenderTreeBuilder::Block::attachIgnoringContinuation):
1567         (WebCore::RenderTreeBuilder::Block::removeLeftoverAnonymousBlock):
1568         (WebCore::RenderTreeBuilder::Block::detach):
1569         (WebCore::RenderTreeBuilder::Block::dropAnonymousBoxChild):
1570         (WebCore::RenderTreeBuilder::Block::insertChild): Deleted.
1571         (WebCore::RenderTreeBuilder::Block::insertChildIgnoringContinuation): Deleted.
1572         (WebCore::RenderTreeBuilder::Block::takeChild): Deleted.
1573         * rendering/updating/RenderTreeBuilderBlock.h:
1574         * rendering/updating/RenderTreeBuilderBlockFlow.cpp:
1575         (WebCore::RenderTreeBuilder::BlockFlow::attach):
1576         (WebCore::RenderTreeBuilder::BlockFlow::moveAllChildrenIncludingFloats):
1577         (WebCore::RenderTreeBuilder::BlockFlow::insertChild): Deleted.
1578         (WebCore::RenderTreeBuilder::BlockFlow::moveAllChildrenIncludingFloatsTo): Deleted.
1579         * rendering/updating/RenderTreeBuilderBlockFlow.h:
1580         * rendering/updating/RenderTreeBuilderContinuation.cpp:
1581         (WebCore::RenderTreeBuilder::Continuation::cleanupOnDestroy):
1582         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
1583         (WebCore::RenderTreeBuilder::FirstLetter::cleanupOnDestroy):
1584         (WebCore::RenderTreeBuilder::FirstLetter::updateStyle):
1585         (WebCore::RenderTreeBuilder::FirstLetter::createRenderers):
1586         * rendering/updating/RenderTreeBuilderFormControls.cpp:
1587         (WebCore::RenderTreeBuilder::FormControls::attach):
1588         (WebCore::RenderTreeBuilder::FormControls::detach):
1589         (WebCore::RenderTreeBuilder::FormControls::findOrCreateParentForChild):
1590         (WebCore::RenderTreeBuilder::FormControls::insertChild): Deleted.
1591         (WebCore::RenderTreeBuilder::FormControls::takeChild): Deleted.
1592         * rendering/updating/RenderTreeBuilderFormControls.h:
1593         * rendering/updating/RenderTreeBuilderFullScreen.cpp:
1594         (WebCore::RenderTreeBuilder::FullScreen::cleanupOnDestroy):
1595         * rendering/updating/RenderTreeBuilderInline.cpp:
1596         (WebCore::RenderTreeBuilder::Inline::attach):
1597         (WebCore::RenderTreeBuilder::Inline::insertChildToContinuation):
1598         (WebCore::RenderTreeBuilder::Inline::attachIgnoringContinuation):
1599         (WebCore::RenderTreeBuilder::Inline::splitFlow):
1600         (WebCore::RenderTreeBuilder::Inline::splitInlines):
1601         (WebCore::RenderTreeBuilder::Inline::childBecameNonInline):
1602         (WebCore::RenderTreeBuilder::Inline::insertChild): Deleted.
1603         (WebCore::RenderTreeBuilder::Inline::insertChildIgnoringContinuation): Deleted.
1604         * rendering/updating/RenderTreeBuilderInline.h:
1605         * rendering/updating/RenderTreeBuilderList.cpp:
1606         (WebCore::RenderTreeBuilder::List::updateItemMarker):
1607         * rendering/updating/RenderTreeBuilderMathML.cpp:
1608         (WebCore::RenderTreeBuilder::MathML::makeFences):
1609         (WebCore::RenderTreeBuilder::MathML::attach):
1610         (WebCore::RenderTreeBuilder::MathML::insertChild): Deleted.
1611         * rendering/updating/RenderTreeBuilderMathML.h:
1612         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
1613         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
1614         (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
1615         (WebCore::RenderTreeBuilder::MultiColumn::processPossibleSpannerDescendant):
1616         (WebCore::RenderTreeBuilder::MultiColumn::handleSpannerRemoval):
1617         * rendering/updating/RenderTreeBuilderRuby.cpp:
1618         (WebCore::RenderTreeBuilder::Ruby::moveInlineChildren):
1619         (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
1620         (WebCore::RenderTreeBuilder::Ruby::attach):
1621         (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild):
1622         (WebCore::RenderTreeBuilder::Ruby::rubyBaseSafe):
1623         (WebCore::RenderTreeBuilder::Ruby::detach):
1624         (WebCore::RenderTreeBuilder::Ruby::insertChild): Deleted.
1625         (WebCore::RenderTreeBuilder::Ruby::takeChild): Deleted.
1626         * rendering/updating/RenderTreeBuilderRuby.h:
1627         * rendering/updating/RenderTreeBuilderSVG.cpp:
1628         (WebCore::RenderTreeBuilder::SVG::attach):
1629         (WebCore::RenderTreeBuilder::SVG::detach):
1630         (WebCore::RenderTreeBuilder::SVG::insertChild): Deleted.
1631         (WebCore::RenderTreeBuilder::SVG::takeChild): Deleted.
1632         * rendering/updating/RenderTreeBuilderSVG.h:
1633         * rendering/updating/RenderTreeBuilderTable.cpp:
1634         (WebCore::RenderTreeBuilder::Table::findOrCreateParentForChild):
1635         (WebCore::RenderTreeBuilder::Table::attach):
1636         (WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows):
1637         (WebCore::RenderTreeBuilder::Table::insertChild): Deleted.
1638         * rendering/updating/RenderTreeBuilderTable.h:
1639         * rendering/updating/RenderTreeUpdater.cpp:
1640         (WebCore::RenderTreeUpdater::createRenderer):
1641         (WebCore::RenderTreeUpdater::createTextRenderer):
1642         (WebCore::RenderTreeUpdater::tearDownRenderers):
1643         (WebCore::RenderTreeUpdater::tearDownTextRenderer):
1644         (WebCore::RenderTreeUpdater::tearDownLeftoverPaginationRenderersIfNeeded):
1645         * rendering/updating/RenderTreeUpdaterGeneratedContent.cpp:
1646         (WebCore::createContentRenderers):
1647
1648 2018-02-22  Chris Dumez  <cdumez@apple.com>
1649
1650         ResourceRequestBase::isolatedCopy() fails to isolate copy the cachePartition
1651         https://bugs.webkit.org/show_bug.cgi?id=183059
1652         <rdar://problem/37800202>
1653
1654         Reviewed by Youenn Fablet.
1655
1656         Update ResourceRequestBase::setAsIsolatedCopy() to call isolatedCopy() on the cachePartition as well,
1657         given that it is a String and it would not be safe to send it to another thread otherwise.
1658
1659         * platform/network/ResourceRequestBase.cpp:
1660         (WebCore::ResourceRequestBase::setAsIsolatedCopy):
1661
1662 2018-02-22  Chris Dumez  <cdumez@apple.com>
1663
1664         ServiceWorkerContainer::startScriptFetchForJob() fails to isolate copy the registrationKey before passing it to the main thread
1665         https://bugs.webkit.org/show_bug.cgi?id=183050
1666         <rdar://problem/37796881>
1667
1668         Reviewed by Youenn Fablet.
1669
1670         Create an isolated copy of the registrationKey before passing it to the main thread in ServiceWorkerContainer's
1671         startScriptFetchForJob() / jobFinishedLoadingScript() / jobFailedLoadingScript().
1672
1673         * workers/service/ServiceWorkerContainer.cpp:
1674         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
1675         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
1676         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
1677
1678 2018-02-22  Chris Dumez  <cdumez@apple.com>
1679
1680         ServiceWorkerContainer::scheduleJob() fails to isolate copy the jobData before passing it to the main thread
1681         https://bugs.webkit.org/show_bug.cgi?id=183046
1682         <rdar://problem/37793395>
1683
1684         Reviewed by Youenn Fablet.
1685
1686         Make sure we isolate copy the jobData before passing it to the main thread in ServiceWorkerContainer::scheduleJob().
1687         The jobData contains Strings / URLs so it is not safe to have non-isolated copies of it on various threads.
1688
1689         * workers/service/ServiceWorkerContainer.cpp:
1690         (WebCore::ServiceWorkerContainer::scheduleJob):
1691
1692 2018-02-22  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1693
1694         [Curl] Fix warning on clang.
1695         https://bugs.webkit.org/show_bug.cgi?id=182986
1696
1697         Reviewed by Konstantin Tokarev.
1698
1699         No new tests because there's no behaviro changes.
1700
1701         * platform/network/curl/CurlResourceHandleDelegate.cpp:
1702         (WebCore::CurlResourceHandleDelegate::curlDidSendData):
1703         (WebCore::CurlResourceHandleDelegate::curlDidReceiveBuffer):
1704         (WebCore::CurlResourceHandleDelegate::curlDidFailWithError):
1705         * platform/network/curl/CurlResourceHandleDelegate.h:
1706
1707 2018-02-22  Youenn Fablet  <youenn@apple.com>
1708
1709         WorkerCacheStorageConnection::doRemove can assert in case two frames try to delete the same cache at the same time
1710         https://bugs.webkit.org/show_bug.cgi?id=183041
1711
1712         Reviewed by Chris Dumez.
1713
1714         * Modules/cache/WorkerCacheStorageConnection.cpp:
1715         (WebCore::WorkerCacheStorageConnection::doRemove): Update the assertion to accept the
1716         case of an already deleted cache, i.e. returned identifer is 0.
1717
1718 2018-02-22  Alejandro G. Castro  <alex@igalia.com>
1719
1720         Remove some code leftovers in LibWebRTCMediaEndpoint and RealtimeOutgoingVideoSource classes
1721         https://bugs.webkit.org/show_bug.cgi?id=183031
1722
1723         Reviewed by Youenn Fablet.
1724
1725         This include and namespace are not required in the file.
1726
1727         Just removing unused code, no tests required.
1728
1729         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1730
1731 2018-02-22  Chris Dumez  <cdumez@apple.com>
1732
1733         Document.open() cancels existing provisional load but not navigation policy check
1734         https://bugs.webkit.org/show_bug.cgi?id=183012
1735         <rdar://problem/37755831>
1736
1737         Reviewed by Alex Christensen.
1738
1739         Test: fast/dom/Document/open-with-pending-load-async-policy.html
1740
1741         * dom/Document.cpp:
1742         (WebCore::Document::open):
1743         The existing code was calling FrameLoader::stopAllLoaders() when the loader's state
1744         is FrameStateProvisional. The issue is that the FrameLoader's state only gets set
1745         to FrameStateProvisional after the policy decision for the navigation is made.
1746         This means that we fail to cancel a pending load if is still in the policy decision
1747         stage, which can happen when the policy decision is made asynchronously. We now
1748         also cancel such pending navigation policy checks as well.
1749
1750         * loader/PolicyChecker.cpp:
1751         (WebCore::PolicyChecker::checkNavigationPolicy):
1752         Make sure the m_delegateIsDecidingNavigationPolicy flag gets reset inside the
1753         lambda. Otherwise, it gets reset too early when the policy decision is made
1754         asynchronously.
1755
1756 2018-02-22  Youenn Fablet  <youenn@apple.com>
1757
1758         Add release asserts for service worker fetch and postMessage events
1759         https://bugs.webkit.org/show_bug.cgi?id=183025
1760         rdar://problem/37765052
1761
1762         Reviewed by Daniel Bates.
1763
1764         Add release assertion so that a service worker will only dispatch a message event
1765         for clients and service workers with the same origin.
1766         No change of behavior.
1767
1768         * platform/network/ResourceRequestBase.h:
1769         * workers/service/context/ServiceWorkerThread.cpp:
1770         (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
1771         * workers/service/context/ServiceWorkerThreadProxy.h:
1772
1773 2018-02-22  Miguel Gomez  <magomez@igalia.com>
1774
1775         including both gl3.h and gl2.h when USE_OPENGL_ES is enabled
1776         https://bugs.webkit.org/show_bug.cgi?id=183008
1777
1778         Reviewed by Michael Catanzaro.
1779
1780         Don't include GLES3 headers as we stick to GLES2 API resources.
1781
1782         No new tests, no behavior change.
1783
1784         * platform/graphics/GLContext.cpp:
1785
1786 2018-02-22  Ms2ger  <Ms2ger@igalia.com>
1787
1788         [GTK][WPE] Fix some build errors in service workers code
1789         https://bugs.webkit.org/show_bug.cgi?id=182966
1790
1791         Reviewed by Žan Doberšek.
1792
1793         No new tests: no change in behavior.
1794
1795         * workers/service/ServiceWorkerProvider.h: add missing forward declaration.
1796
1797 2018-02-21  Zalan Bujtas  <zalan@apple.com>
1798
1799         [RenderTreeBuilder] Move RenderObject::insertedInto() mutation logic to RenderTreeBuilder
1800         https://bugs.webkit.org/show_bug.cgi?id=183022
1801         <rdar://problem/37764326>
1802
1803         Reviewed by Antti Koivisto.
1804
1805         No change in functionality.
1806
1807         * rendering/RenderObject.cpp:
1808         (WebCore::RenderObject::insertedIntoTree):
1809         * rendering/updating/RenderTreeBuilder.cpp:
1810         (WebCore::RenderTreeBuilder::insertChildToRenderElementInternal):
1811         (WebCore::RenderTreeBuilder::moveChildrenTo):
1812         (WebCore::RenderTreeBuilder::multiColumnDescendantInserted): Deleted.
1813         * rendering/updating/RenderTreeBuilder.h:
1814
1815 2018-02-21  Tim Horton  <timothy_horton@apple.com>
1816
1817         Include all Cocoa sources in all Cocoa platform builds
1818         https://bugs.webkit.org/show_bug.cgi?id=183026
1819         <rdar://problem/37513101>
1820
1821         Reviewed by Dan Bernstein.
1822
1823         Similar to r228571, don't have separate Sources files for iOS and Mac.
1824         All sources now have #ifdefs that ensure that only the right ones
1825         build on the right platforms. This makes it much easier to reason
1826         about what builds where by just looking at the sources.
1827
1828         * SourcesCocoa.txt:
1829         * SourcesIOS.txt: Removed.
1830         * SourcesMac.txt: Removed.
1831         * WebCore.xcodeproj/project.pbxproj:
1832         * editing/WebContentReader.h:
1833         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
1834
1835 2018-02-21  Youenn Fablet  <youenn@apple.com>
1836
1837         Make SubstituteResource take a ResourceResponse r-value
1838         https://bugs.webkit.org/show_bug.cgi?id=183020
1839
1840         Reviewed by Alex Christensen.
1841
1842         No change of behavior.
1843         Make SubstituteResource take a ResourceResponse r-value.
1844         Update ArchiveResource accordingly.
1845         Take benefit of that in ApplicationCacheResource to set the response source to ApplicationCache
1846         before passing it to SubstituteResource constructor.
1847
1848         * loader/SubstituteResource.h:
1849         (WebCore::SubstituteResource::SubstituteResource):
1850         (WebCore::SubstituteResource::resourceResponse): Deleted.
1851         * loader/appcache/ApplicationCacheResource.cpp:
1852         (WebCore::ApplicationCacheResource::create):
1853         (WebCore::ApplicationCacheResource::ApplicationCacheResource):
1854         * loader/appcache/ApplicationCacheResource.h:
1855         (WebCore::ApplicationCacheResource::create): Deleted.
1856         * loader/archive/ArchiveResource.cpp:
1857         (WebCore::ArchiveResource::ArchiveResource):
1858
1859 2018-02-21  Zalan Bujtas  <zalan@apple.com>
1860
1861         [RenderTreeBuilder] ::willBeRemoved() does not need RenderTreeBuilder anymore.
1862         https://bugs.webkit.org/show_bug.cgi?id=183019
1863         <rdar://problem/37761421>
1864
1865         Reviewed by Antti Koivisto.
1866
1867         All the willBeDestroyed() mutations have been moved over to RenderTreeBuilder. 
1868
1869         No change in functionality.
1870
1871         * rendering/RenderBlock.cpp:
1872         (WebCore::RenderBlock::willBeDestroyed):
1873         * rendering/RenderBlock.h:
1874         * rendering/RenderBlockFlow.cpp:
1875         (WebCore::RenderBlockFlow::willBeDestroyed):
1876         * rendering/RenderBlockFlow.h:
1877         * rendering/RenderBox.cpp:
1878         (WebCore::RenderBox::willBeDestroyed):
1879         * rendering/RenderBox.h:
1880         * rendering/RenderBoxModelObject.cpp:
1881         (WebCore::RenderBoxModelObject::willBeDestroyed):
1882         * rendering/RenderBoxModelObject.h:
1883         * rendering/RenderCounter.cpp:
1884         (WebCore::RenderCounter::willBeDestroyed):
1885         * rendering/RenderCounter.h:
1886         * rendering/RenderElement.cpp:
1887         (WebCore::RenderElement::willBeDestroyed):
1888         * rendering/RenderElement.h:
1889         * rendering/RenderEmbeddedObject.cpp:
1890         (WebCore::RenderEmbeddedObject::willBeDestroyed):
1891         * rendering/RenderEmbeddedObject.h:
1892         * rendering/RenderFragmentedFlow.cpp:
1893         (WebCore::RenderFragmentedFlow::willBeDestroyed):
1894         * rendering/RenderFragmentedFlow.h:
1895         * rendering/RenderImage.cpp:
1896         (WebCore::RenderImage::willBeDestroyed):
1897         * rendering/RenderImage.h:
1898         * rendering/RenderInline.cpp:
1899         (WebCore::RenderInline::willBeDestroyed):
1900         * rendering/RenderInline.h:
1901         * rendering/RenderLayerModelObject.cpp:
1902         (WebCore::RenderLayerModelObject::willBeDestroyed):
1903         * rendering/RenderLayerModelObject.h:
1904         * rendering/RenderListBox.cpp:
1905         (WebCore::RenderListBox::willBeDestroyed):
1906         * rendering/RenderListBox.h:
1907         * rendering/RenderListMarker.cpp:
1908         (WebCore::RenderListMarker::willBeDestroyed):
1909         * rendering/RenderListMarker.h:
1910         * rendering/RenderMenuList.cpp:
1911         (WebCore::RenderMenuList::willBeDestroyed):
1912         * rendering/RenderMenuList.h:
1913         * rendering/RenderObject.cpp:
1914         (WebCore::RenderObject::willBeDestroyed):
1915         (WebCore::RenderObject::destroy):
1916         * rendering/RenderObject.h:
1917         * rendering/RenderReplaced.cpp:
1918         (WebCore::RenderReplaced::willBeDestroyed):
1919         * rendering/RenderReplaced.h:
1920         * rendering/RenderSearchField.cpp:
1921         (WebCore::RenderSearchField::willBeDestroyed):
1922         * rendering/RenderSearchField.h:
1923         * rendering/RenderSnapshottedPlugIn.cpp:
1924         (WebCore::RenderSnapshottedPlugIn::willBeDestroyed):
1925         * rendering/RenderSnapshottedPlugIn.h:
1926         * rendering/RenderText.cpp:
1927         (WebCore::RenderText::willBeDestroyed):
1928         * rendering/RenderText.h:
1929         * rendering/RenderTextControlMultiLine.cpp:
1930         (WebCore::RenderTextControlMultiLine::willBeDestroyed):
1931         * rendering/RenderTextControlMultiLine.h:
1932         * rendering/RenderVideo.cpp:
1933         (WebCore::RenderVideo::willBeDestroyed):
1934         * rendering/RenderVideo.h:
1935         * rendering/RenderWidget.cpp:
1936         (WebCore::RenderWidget::willBeDestroyed):
1937         * rendering/RenderWidget.h:
1938         * rendering/svg/RenderSVGBlock.cpp:
1939         (WebCore::RenderSVGBlock::willBeDestroyed):
1940         * rendering/svg/RenderSVGBlock.h:
1941         * rendering/svg/RenderSVGImage.cpp:
1942         (WebCore::RenderSVGImage::willBeDestroyed):
1943         * rendering/svg/RenderSVGImage.h:
1944         * rendering/svg/RenderSVGInline.cpp:
1945         (WebCore::RenderSVGInline::willBeDestroyed):
1946         * rendering/svg/RenderSVGInline.h:
1947         * rendering/svg/RenderSVGModelObject.cpp:
1948         (WebCore::RenderSVGModelObject::willBeDestroyed):
1949         * rendering/svg/RenderSVGModelObject.h:
1950         * rendering/svg/RenderSVGResourceContainer.cpp:
1951         (WebCore::RenderSVGResourceContainer::willBeDestroyed):
1952         * rendering/svg/RenderSVGResourceContainer.h:
1953         * rendering/svg/RenderSVGRoot.cpp:
1954         (WebCore::RenderSVGRoot::willBeDestroyed):
1955         * rendering/svg/RenderSVGRoot.h:
1956         * rendering/svg/RenderSVGText.cpp:
1957         (WebCore::RenderSVGText::willBeDestroyed):
1958         * rendering/svg/RenderSVGText.h:
1959
1960 2018-02-21  Per Arne Vollan  <pvollan@apple.com>
1961
1962         The WebContent process should not use NSScreen in the screenAvailableRect/screenRect implementations.
1963         https://bugs.webkit.org/show_bug.cgi?id=182855
1964
1965         Reviewed by Brent Fulgham.
1966
1967         On macOS, the functions screenAvailableRect and screenRect is implemented using NSScreen, which is communicating
1968         with the WindowServer. To avoid this WindowServer communication from the WebContent process when calling
1969         screenAvailableRect and screenRect, it is possible to let the UIProcess send a message to the WebContent
1970         process whenever there is a change in the display properties, and have the WebContent process cache these
1971         display properties. This message should also be sent to a newly started WebContent process.
1972
1973         No new tests, covered by existing tests.
1974
1975         * WebCore.xcodeproj/project.pbxproj:
1976         * platform/PlatformScreen.h:
1977         * platform/mac/PlatformScreenMac.mm:
1978         (WebCore::getScreenProperties):
1979         (WebCore::screenProperties):
1980         (WebCore::setScreenProperties):
1981         (WebCore::screenRect):
1982         (WebCore::screenAvailableRect):
1983         * platform/ScreenProperties.h: Added.
1984         (WebCore::ScreenProperties::encode const):
1985         (WebCore::ScreenProperties::decode):
1986
1987 2018-02-21  Christopher Reid  <chris.reid@sony.com>
1988
1989         [Curl] Curl Cookie Database File should be configurable using NetworkProcessCreationParameters
1990         https://bugs.webkit.org/show_bug.cgi?id=182751
1991
1992         Reviewed by Youenn Fablet.
1993
1994         No change in behavior.
1995
1996         Adding support to set a custom CookieJar Database.
1997         Took CookieJarDB::open() out of its constructor because both the Network and Web process
1998         were trying to open the journal files but one process was failing due to a lack of permission.
1999         Now the database file is lazily opened and only the Network process will try to open the database.
2000         Some cleanup was done to CookieJarDB too.
2001
2002         * platform/network/NetworkStorageSession.h:
2003         * platform/network/curl/CookieJarDB.cpp:
2004         * platform/network/curl/CookieJarDB.h:
2005         * platform/network/curl/NetworkStorageSessionCurl.cpp:
2006
2007 2018-02-21  Chris Dumez  <cdumez@apple.com>
2008
2009         Regression(r228708): Crash under WebCore::MediaResource::responseReceived(WebCore::CachedResource&, WebCore::ResourceResponse const&)
2010         https://bugs.webkit.org/show_bug.cgi?id=183018
2011         <rdar://problem/37754154>
2012
2013         Reviewed by Eric Carlson.
2014
2015         The fix at r228708 was trying to address the fact that avplayer sometimes
2016         deallocates WebCoreNSURLSessionDataTask objects on a non-main thread, which
2017         was not safe because its _resource data member needs to be deallocated on
2018         the main thread.
2019
2020         The issue is that r228708 caused _resource to outlive its WebCoreNSURLSessionDataTask.
2021         This is an issue because _resource has a client data member (of type WebCoreNSURLSessionDataTaskClient)
2022         which has a raw pointer to the WebCoreNSURLSessionDataTask. This means that the main thread could
2023         call methods like responseReceived() on the resource, which would call responseReceived() on the
2024         client, which would try to call [WebCoreNSURLSessionDataTask receivedResponse:] with an invalid
2025         m_task pointer.
2026
2027         To address the issue, I introduced a clearTask() method on WebCoreNSURLSessionDataTaskClient, which
2028         gets called from a non-main thread to clear the client's m_task pointer when the task is destroyed
2029         on a non-main thread. So that this is safe, every time the client tries to use m_task, we now
2030         acquire a lock for thread-safety and do a null-check on m_task.
2031
2032         No new tests, no known reproduction case.
2033
2034         * platform/graphics/PlatformMediaResourceLoader.h:
2035         (WebCore::PlatformMediaResource::client):
2036         * platform/network/cocoa/WebCoreNSURLSession.mm:
2037         (WebCore::WebCoreNSURLSessionDataTaskClient::clearTask):
2038         (WebCore::WebCoreNSURLSessionDataTaskClient::dataSent):
2039         (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived):
2040         (WebCore::WebCoreNSURLSessionDataTaskClient::shouldCacheResponse):
2041         (WebCore::WebCoreNSURLSessionDataTaskClient::dataReceived):
2042         (WebCore::WebCoreNSURLSessionDataTaskClient::redirectReceived):
2043         (WebCore::WebCoreNSURLSessionDataTaskClient::accessControlCheckFailed):
2044         (WebCore::WebCoreNSURLSessionDataTaskClient::loadFailed):
2045         (WebCore::WebCoreNSURLSessionDataTaskClient::loadFinished):
2046         (-[WebCoreNSURLSessionDataTask dealloc]):
2047
2048 2018-02-21  Youenn Fablet  <youenn@apple.com>
2049
2050         Move AppCache loading to the NetworkProcess
2051         https://bugs.webkit.org/show_bug.cgi?id=178540
2052         <rdar://problem/37119346>
2053
2054         Reviewed by Alex Christensen.
2055
2056         Covered by existing tests.
2057
2058         Use ApplicationResourceLoader for cache entry loading.
2059         Remove all ResourceHandle use from ApplicationCacheGroup.
2060         Renamed m_loader in m_manifestLoader and added a new m_entryLoader to load cache entries.
2061
2062         Updated ApplicationCacheResourceLoader to handle different types of CachedResource.
2063         This allows in particular to handle redirections based on the resource type and create the ApplicationCacheResource with the right type.
2064         Use Include as credentials mode as per specification.
2065
2066         Add a new ApplicationCache ResourceResonse::Source.
2067         This allows fixing an assertion and should allow better inspector support if needs be.
2068
2069         * inspector/agents/InspectorNetworkAgent.cpp:
2070         (WebCore::responseSource):
2071         * loader/ResourceLoader.cpp:
2072         (WebCore::logResourceResponseSource):
2073         * loader/SubstituteResource.h:
2074         (WebCore::SubstituteResource::resourceResponse):
2075         * loader/appcache/ApplicationCacheGroup.cpp:
2076         (WebCore::ApplicationCacheGroup::stopLoading):
2077         (WebCore::ApplicationCacheGroup::update):
2078         (WebCore::ApplicationCacheGroup::didFinishLoading):
2079         (WebCore::ApplicationCacheGroup::didFinishLoadingEntry):
2080         (WebCore::ApplicationCacheGroup::didFail):
2081         (WebCore::ApplicationCacheGroup::didFailLoadingEntry):
2082         (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete):
2083         (WebCore::ApplicationCacheGroup::startLoadingEntry):
2084         * loader/appcache/ApplicationCacheGroup.h:
2085         * loader/appcache/ApplicationCacheResource.cpp:
2086         (WebCore::ApplicationCacheResource::ApplicationCacheResource):
2087         * loader/appcache/ApplicationCacheResourceLoader.cpp:
2088         (WebCore::ApplicationCacheResourceLoader::create):
2089         (WebCore::ApplicationCacheResourceLoader::ApplicationCacheResourceLoader):
2090         (WebCore::ApplicationCacheResourceLoader::responseReceived):
2091         (WebCore::ApplicationCacheResourceLoader::redirectReceived):
2092         * loader/appcache/ApplicationCacheResourceLoader.h:
2093         * platform/network/ResourceResponseBase.h:
2094         * platform/network/cocoa/ResourceResponseCocoa.mm:
2095         (WebCore::ResourceResponse::platformCertificateInfo const):
2096         * testing/Internals.cpp:
2097         (WebCore::responseSourceToString):
2098
2099 2018-02-21  Zalan Bujtas  <zalan@apple.com>
2100
2101         [RenderTreeBuilder] Move RenderBoxModelObject::willBeRemoved() mutation logic to RenderTreeBuilder
2102         https://bugs.webkit.org/show_bug.cgi?id=183014
2103         <rdar://problem/37757428>
2104
2105         Reviewed by Antti Koivisto.
2106
2107         No change in functionality.
2108
2109         * Sources.txt:
2110         * WebCore.xcodeproj/project.pbxproj:
2111         * rendering/RenderBoxModelObject.cpp:
2112         (WebCore::RenderBoxModelObject::~RenderBoxModelObject):
2113         (WebCore::RenderBoxModelObject::willBeDestroyed):
2114         (WebCore::RenderBoxModelObject::continuationChainNode const):
2115         (): Deleted.
2116         (WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations): Deleted.
2117         * rendering/RenderBoxModelObject.h:
2118         * rendering/updating/RenderTreeBuilder.cpp:
2119         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
2120         (WebCore::RenderTreeBuilder::removeAndDestroy):
2121         * rendering/updating/RenderTreeBuilder.h:
2122         (WebCore::RenderTreeBuilder::continuationBuilder):
2123         * rendering/updating/RenderTreeBuilderContinuation.cpp: Added.
2124         (WebCore::RenderTreeBuilder::Continuation::Continuation):
2125         (WebCore::RenderTreeBuilder::Continuation::cleanupOnDestroy):
2126         * rendering/updating/RenderTreeBuilderContinuation.h: Added.
2127
2128 2018-02-21  Youenn Fablet  <youenn@apple.com>
2129
2130         ServiceWorkerJob::m_lastResponse is unneeded
2131         https://bugs.webkit.org/show_bug.cgi?id=183013
2132
2133         Reviewed by Chris Dumez.
2134
2135         Remove this field since not used anywhere.
2136
2137         * workers/service/ServiceWorkerJob.cpp:
2138         (WebCore::ServiceWorkerJob::didReceiveResponse):
2139         * workers/service/ServiceWorkerJob.h:
2140
2141 2018-02-21  Youenn Fablet  <youenn@apple.com>
2142
2143         Use ResourceLoader to load appcache manifest
2144         https://bugs.webkit.org/show_bug.cgi?id=182861
2145
2146         Reviewed by Alex Christensen.
2147
2148         Covered by updated tests.
2149
2150         Add ApplicationCacheResourceLoader to load an ApplicationCacheResource from a ResourceLoader.
2151         Make use of it to load the app cache manifest.
2152         Future work should load entries using the same loader.
2153
2154         Remove manifest handle.
2155         Ensure that DocumentLoader does not register the manifest resource loader as its lifetime
2156         is handled by its ApplicationCacheGroup.
2157
2158         Add a ResourceLoader option to bypass the application cache.
2159         Use it for manifest loading.
2160
2161         * Sources.txt:
2162         * WebCore.xcodeproj/project.pbxproj:
2163         * loader/DocumentLoader.cpp:
2164         (WebCore::DocumentLoader::addSubresourceLoader):
2165         * loader/ResourceLoaderOptions.h:
2166         * loader/appcache/ApplicationCacheGroup.cpp:
2167         (WebCore::ApplicationCacheGroup::stopLoading):
2168         (WebCore::ApplicationCacheGroup::update):
2169         (WebCore::ApplicationCacheGroup::createRequest):
2170         (WebCore::ApplicationCacheGroup::didReceiveResponseAsync):
2171         (WebCore::ApplicationCacheGroup::didReceiveData):
2172         (WebCore::ApplicationCacheGroup::didFinishLoading):
2173         (WebCore::ApplicationCacheGroup::didFail):
2174         (WebCore::ApplicationCacheGroup::didFinishLoadingManifest):
2175         (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete):
2176         * loader/appcache/ApplicationCacheGroup.h:
2177         * loader/appcache/ApplicationCacheHost.cpp:
2178         (WebCore::ApplicationCacheHost::maybeLoadResource):
2179         (WebCore::ApplicationCacheHost::maybeLoadFallbackForRedirect):
2180         (WebCore::ApplicationCacheHost::maybeLoadFallbackForResponse):
2181         (WebCore::ApplicationCacheHost::maybeLoadFallbackForError):
2182         * loader/appcache/ApplicationCacheResourceLoader.cpp: Added.
2183         * loader/appcache/ApplicationCacheResourceLoader.h: Added.
2184
2185 2018-02-21  Don Olmstead  <don.olmstead@sony.com>
2186
2187         [CMake][Win] Use cmakeconfig.h rather than config.h and Platform.h
2188         https://bugs.webkit.org/show_bug.cgi?id=182883
2189
2190         Reviewed by Per Arne Vollan.
2191
2192         No new tests. No change in behavior.
2193
2194         * WebCorePrefix.h:
2195         * config.h:
2196         * testing/js/WebCoreTestSupportPrefix.h:
2197
2198 2018-02-21  Zalan Bujtas  <zalan@apple.com>
2199
2200         [RenderTreeBuilder] Move RenderView::willBeRemoved() mutation logic to RenderTreeBuilder
2201         https://bugs.webkit.org/show_bug.cgi?id=183009
2202
2203         Reviewed by Antti Koivisto.
2204
2205         No change in functionality.
2206
2207         * dom/Document.cpp:
2208         (WebCore::Document::destroyRenderTree):
2209         * rendering/RenderView.cpp:
2210         (WebCore::RenderView::~RenderView):
2211         (WebCore::RenderView::willBeDestroyed): Deleted.
2212         * rendering/RenderView.h:
2213
2214 2018-02-21  Michael Catanzaro  <mcatanzaro@igalia.com>
2215
2216         [GTK] USE_UPOWER causes crashes inside a chroot or on systems with broken dbus/upower
2217         https://bugs.webkit.org/show_bug.cgi?id=181825
2218
2219         Reviewed by Carlos Garcia Campos.
2220
2221         We could fix this crash, but that would not be good enough, because upower-glib is a
2222         synchronous API that wraps D-Bus calls. That's not acceptable for use in the web process.
2223         Rewrite LowPowerModeNotifierGLib to use upower's D-Bus API directly, instead.
2224
2225         Note that this also enables LowPowerModeNotifier for WPE, since the USE(UPOWER) build
2226         flag is no longer needed.
2227
2228         * platform/LowPowerModeNotifier.cpp:
2229         * platform/LowPowerModeNotifier.h:
2230         * platform/glib/LowPowerModeNotifierGLib.cpp:
2231         (WebCore::LowPowerModeNotifier::LowPowerModeNotifier):
2232         (WebCore::LowPowerModeNotifier::updateWarningLevel):
2233         (WebCore::LowPowerModeNotifier::warningLevelChanged):
2234         (WebCore::LowPowerModeNotifier::gPropertiesChangedCallback):
2235         (WebCore::LowPowerModeNotifier::~LowPowerModeNotifier):
2236         (WebCore::LowPowerModeNotifier::updateState): Deleted.
2237         (WebCore::LowPowerModeNotifier::warningLevelCallback): Deleted.
2238
2239 2018-02-21  Chris Dumez  <cdumez@apple.com>
2240
2241         VTTCue constructor should use 'double' type for startTime / endTime
2242         https://bugs.webkit.org/show_bug.cgi?id=182988
2243
2244         Reviewed by Eric Carlson.
2245
2246         VTTCue constructor should use 'double' type for startTime / endTime, not
2247         'unrestricted double':
2248         - https://w3c.github.io/webvtt/#the-vttcue-interface
2249
2250         Otherwise, we end up potentially returning NaN for TextTrackCue.startTime / endTime,
2251         even though those correctly use type 'double':
2252         - https://html.spec.whatwg.org/multipage/media.html#texttrackcue
2253
2254         The new behavior is consistent with Firefox and Chrome.
2255
2256         No new tests, updated existing test.
2257
2258         * bindings/js/JSDOMConvertNumbers.h:
2259         (WebCore::JSConverter<IDLDouble>::convert):
2260         Add assertion to make sure our implementation never tries to return NaN
2261         for an IDL attribute of type 'double'. This would be invalid as per Web
2262         IDL spec and would crash if the NaN being returned was impure as JSValue
2263         could not store it as a double.
2264
2265         * html/track/VTTCue.idl:
2266         Update constructor parameters to use 'double' type instead of 'unrestricted
2267         double', as per:
2268         - https://w3c.github.io/webvtt/#the-vttcue-interface
2269
2270 2018-02-21  Zalan Bujtas  <zalan@apple.com>
2271
2272         [RenderTreeBuilder] Move RenderTextFragment::willBeRemoved() mutation logic to RenderTreeBuilder
2273         https://bugs.webkit.org/show_bug.cgi?id=182946
2274         <rdar://problem/37690039>
2275
2276         Reviewed by Antti Koivisto.
2277
2278         No change in functionality.
2279
2280         * rendering/RenderTextFragment.cpp:
2281         (WebCore::RenderTextFragment::willBeDestroyed):
2282         * rendering/updating/RenderTreeBuilder.cpp:
2283         (WebCore::RenderTreeBuilder::takeChild):
2284         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
2285         (WebCore::RenderTreeBuilder::FirstLetter::cleanupOnRemoval):
2286         * rendering/updating/RenderTreeBuilderFirstLetter.h:
2287
2288 2018-02-21  Ms2ger  <Ms2ger@igalia.com>
2289
2290         [GCrypt] Remove unsound assertion from CryptoKeyRSA::exportData().
2291         https://bugs.webkit.org/show_bug.cgi?id=183001
2292
2293         Reviewed by Philippe Normand.
2294
2295         This function is called from structured cloning, in particular when storing
2296         a key in IndexedDB. This would trip the assertion if the key in question is
2297         non-exportable.
2298
2299         The assertion was copied from the macOS implementation in r172389; it was
2300         subsequently removed there in r172898 to handle this case.
2301
2302         Test: crypto/subtle/rsa-indexeddb-non-exportable.html
2303
2304         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
2305         (WebCore::CryptoKeyRSA::exportData const): remove assertion.
2306
2307 2018-02-21  Myles C. Maxfield  <mmaxfield@apple.com>
2308
2309         [Cocoa] Make system-ui obey the user-installed-font policy
2310         https://bugs.webkit.org/show_bug.cgi?id=182860
2311         <rdar://problem/36158249>
2312
2313         Reviewed by Antti Koivisto.
2314
2315         We have a completely different codepath for system-ui which makes it follow the system's
2316         font cascade list. This codepath (along with all the other relevant places which create
2317         system fonts) needs to obey the AllowUserInstalledFonts enum. This patch is fairly
2318         mechanical; we simply are hooking up the flag across SystemFontDatabase.
2319
2320         There are a few places which creates system fonts which this patch doesn't touch. This is
2321         not a problem because all the remaining places either:
2322         1) Simply pull out some attributes of the font (name, weight, size, etc.) and then throw
2323         away the font object itself, or
2324         2) Use the font in an environment where script cannot access the characters rendered (such
2325         as DragImages or the fullscreen placeholder view or the inside of the attachment element).
2326
2327         Test: fast/text/user-installed-fonts/system-ui.html
2328
2329         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2330         (WebCore::FontDatabase::collectionForFamily):
2331         (WebCore::FontDatabase::fontForPostScriptName):
2332         (WebCore::fontWithFamily):
2333         (WebCore::installedFontMandatoryAttributes):
2334         (WebCore::createSpecificFontForInstalledFonts):
2335         * platform/graphics/cocoa/FontCacheCoreText.h:
2336         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
2337         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::operator== const):
2338         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::hash const):
2339         (WebCore::SystemFontDatabase::systemFontCascadeList):
2340         (WebCore::SystemFontDatabase::removeCascadeList):
2341         (WebCore::SystemFontDatabase::computeCascadeList):
2342         (WebCore::systemFontParameters):
2343         (WebCore::systemFontCascadeList):
2344         (WebCore::FontCascadeDescription::effectiveFamilyCount const):
2345         (WebCore::FontCascadeDescription::effectiveFamilyAt const):
2346         * platform/graphics/ios/FontCacheIOS.mm:
2347         (WebCore::platformFontWithFamilySpecialCase):
2348         * platform/graphics/mac/FontCacheMac.mm:
2349         (WebCore::platformFontWithFamilySpecialCase):
2350
2351 2018-02-21  Chris Dumez  <cdumez@apple.com>
2352
2353         Unreviewed attempt to fix build after r228867.
2354
2355         * Modules/webvr/VRStageParameters.cpp:
2356
2357 2018-02-21  Philippe Normand  <pnormand@igalia.com>
2358
2359         [GStreamer] Rewrite purgeInvalid*Tracks methods
2360         https://bugs.webkit.org/show_bug.cgi?id=183004
2361
2362         Reviewed by Carlos Garcia Campos.
2363
2364         Removing items from a hashmap while iterating is bad.
2365
2366         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2367         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidAudioTracks):
2368         Safely remove items from the hashmap using removeIf().
2369         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidVideoTracks): Ditto.
2370         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidTextTracks): Ditto.
2371
2372 2018-02-21  Chris Dumez  <cdumez@apple.com>
2373
2374         Unreviewed attempt to fix build after r228867.
2375
2376         * Modules/webvr/VRStageParameters.cpp:
2377
2378 2018-02-21  Philippe Normand  <pnormand@igalia.com>
2379
2380         [GStreamer] Crash in Debug build when purging invalid tracks
2381         https://bugs.webkit.org/show_bug.cgi?id=182997
2382
2383         Reviewed by Xabier Rodriguez-Calvar.
2384
2385         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2386         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidAudioTracks): Clear the hashmap when there is no valid track left.
2387         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidVideoTracks): Ditto.
2388         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidTextTracks): Ditto.
2389         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
2390         (WebCore::TrackPrivateBaseGStreamer::getLanguageCode): Demote debugging, this appears too much at least with playbin2.
2391         (WebCore::TrackPrivateBaseGStreamer::getTag): Ditto.
2392
2393 2018-02-21  Philippe Normand  <pnormand@igalia.com>
2394
2395         [GStreamer] We need to adopt GstGlDisplays after GStreamer 1.13.1
2396         https://bugs.webkit.org/show_bug.cgi?id=182996
2397
2398         Reviewed by Xabier Rodriguez-Calvar.
2399
2400         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2401         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext):
2402         Adopt references when running with GStreamer 1.13.1 to avoid
2403         memory leaks.
2404
2405 2018-02-20  Philippe Normand  <pnormand@igalia.com>
2406
2407         [GTK] Layout test media/track/track-in-band-duplicate-tracks-when-source-changes.html failing since r228617
2408         https://bugs.webkit.org/show_bug.cgi?id=160131
2409         <rdar://problem/35873985>
2410
2411         Reviewed by Michael Catanzaro.
2412
2413         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2414         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfText): We
2415         can't assume the pad has a sticky event here like implemented in
2416         InbandTextTrackPrivateGStreamer because it might be emitted after
2417         the track was created. So fallback to a dummy stream ID like in
2418         the Audio and Video tracks.
2419
2420 2018-02-20  Sergio Villar Senin  <svillar@igalia.com>
2421
2422         [WebVR][OpenVR] Retrieve stage parameters
2423         https://bugs.webkit.org/show_bug.cgi?id=182976
2424
2425         Reviewed by Žan Doberšek.
2426
2427         Use OpenVR to retrieve stage parameters, i.e., play area size and
2428         the transformation from sitting to standing position. It includes
2429         the same fallback used by Firefox to provide sensible values in case
2430         we cannot get the required information from the VR SDK (it's quite
2431         common not to have defined a play area).
2432
2433         * Modules/webvr/VRDisplay.cpp:
2434         (WebCore::VRDisplay::stageParameters const):
2435         * Modules/webvr/VRDisplay.h:
2436         * Modules/webvr/VRStageParameters.cpp:
2437         (WebCore::VRStageParameters::VRStageParameters):
2438         (WebCore::VRStageParameters::sittingToStandingTransform const):
2439         (WebCore::VRStageParameters::sizeX const):
2440         (WebCore::VRStageParameters::sizeZ const):
2441         * Modules/webvr/VRStageParameters.h:
2442         (WebCore::VRStageParameters::create):
2443         * platform/vr/VRPlatformDisplay.h:
2444         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
2445         (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
2446         (WebCore::VRPlatformDisplayOpenVR::updateStageParameters):
2447         * platform/vr/openvr/VRPlatformDisplayOpenVR.h:
2448
2449 2018-02-21  Philippe Normand  <pnormand@igalia.com>
2450
2451         [GStreamer] Create a Wayland GL display instead of EGL
2452         https://bugs.webkit.org/show_bug.cgi?id=182968
2453
2454         Reviewed by Xabier Rodriguez-Calvar.
2455
2456         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2457         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext):
2458         Add logging and instantiate a GstDisplayWayland display instead of
2459         an EGL display when running under a Wayland compositor.
2460
2461 2018-02-21  Zalan Bujtas  <zalan@apple.com>
2462
2463         [RenderTreeBuilder] Move RenderFullScreen::willBeRemoved() mutation logic to RenderTreeBuilder
2464         https://bugs.webkit.org/show_bug.cgi?id=182947
2465         <rdar://problem/37690848>
2466
2467         Reviewed by Antti Koivisto.
2468
2469         No change in functionality.
2470
2471         * Sources.txt:
2472         * WebCore.xcodeproj/project.pbxproj:
2473         * rendering/RenderFullScreen.cpp:
2474         (WebCore::RenderFullScreen::willBeDestroyed):
2475         * rendering/updating/RenderTreeBuilder.cpp:
2476         (WebCore::RenderTreeBuilder::takeChild):
2477         * rendering/updating/RenderTreeBuilder.h:
2478         (WebCore::RenderTreeBuilder::fullScreenBuilder):
2479         * rendering/updating/RenderTreeBuilderFullScreen.cpp: Added.
2480         (WebCore::RenderTreeBuilder::FullScreen::FullScreen):
2481         (WebCore::RenderTreeBuilder::FullScreen::cleanupOnRemoval):
2482         * rendering/updating/RenderTreeBuilderFullScreen.h: Added.
2483         * rendering/updating/RenderTreeBuilderMathML.cpp:
2484
2485 2018-02-20  Zalan Bujtas  <zalan@apple.com>
2486
2487         [RenderTreeBuilder] Move RenderListItem::willBeRemoved() mutation logic to RenderTreeBuilder
2488         https://bugs.webkit.org/show_bug.cgi?id=182943
2489         <rdar://problem/37689029>
2490
2491         Reviewed by Antti Koivisto.
2492
2493         We don't need to destroy the marker in RenderListItem::willBeRemoved(), because it gets deleted
2494         in RenderTreeBuilder::removeAndDestroy() together with RenderListItem (as long as the marker is
2495         the RenderListItem's descendent). 
2496
2497         Covered by existing tests.
2498
2499         * rendering/RenderListItem.cpp:
2500         (WebCore::RenderListItem::~RenderListItem):
2501         (WebCore::RenderListItem::willBeDestroyed): Deleted.
2502         * rendering/RenderListItem.h:
2503
2504 2018-02-20  Nan Wang  <n_wang@apple.com>
2505
2506         AX: Keyboard focus not following VoiceOver cursor into web content or within web content.
2507         https://bugs.webkit.org/show_bug.cgi?id=182752
2508         <rdar://problem/37518233>
2509
2510         Reviewed by Ryosuke Niwa.
2511
2512         Call the assistive technology specific method for becoming first responder.
2513
2514         Test: accessibility/mac/accessibility-make-first-responder.html
2515
2516         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2517         (-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]):
2518         * page/ChromeClient.h:
2519
2520 2018-02-20  Tim Horton  <timothy_horton@apple.com>
2521
2522         Introduce HAVE(IOSURFACE_ACCELERATOR)
2523         https://bugs.webkit.org/show_bug.cgi?id=182955
2524         <rdar://problem/37699510>
2525
2526         Reviewed by Sam Weinig.
2527
2528         No new tests, no change in behavior.
2529
2530         Introduce HAVE(IOSURFACE_ACCELERATOR) and guard all uses of
2531         IOSurfaceAccelerator behind it.
2532
2533         Rename USE(IOSURFACE) to HAVE(IOSURFACE) for accuracy.
2534
2535         * page/cocoa/MemoryReleaseCocoa.mm:
2536         * platform/graphics/ca/TileController.cpp:
2537         * platform/graphics/cg/IOSurfacePool.cpp:
2538         * platform/graphics/cg/IOSurfacePool.h:
2539         * platform/graphics/cg/ImageBufferCG.cpp:
2540         * platform/graphics/cocoa/IOSurface.h:
2541         * platform/graphics/cocoa/IOSurface.mm:
2542         * platform/graphics/cocoa/IOSurfacePoolCocoa.mm:
2543         * platform/graphics/cv/VideoTextureCopierCV.cpp:
2544         * platform/graphics/cv/VideoTextureCopierCV.h:
2545
2546 2018-02-20  Chris Dumez  <cdumez@apple.com>
2547
2548         Provisional load may get committed before receiving the decidePolicyForNavigationResponse response
2549         https://bugs.webkit.org/show_bug.cgi?id=182720
2550         <rdar://problem/37515204>
2551
2552         Reviewed by Alex Christensen.
2553
2554         Wait for the policy response from the client after receiving a resource response,
2555         before sending the NetworkResourceLoader::ContinueDidReceiveResponse IPC back to
2556         the NetworkProcess. Otherwise, the network process may start sending us data and
2557         we may end up committing the provisional load before receiving the policy decision
2558         fron the client.
2559
2560         Change is covered by new API test.
2561
2562         * loader/DocumentLoader.cpp:
2563         (WebCore::DocumentLoader::responseReceived):
2564         * loader/NetscapePlugInStreamLoader.cpp:
2565         (WebCore::NetscapePlugInStreamLoader::didReceiveResponse):
2566         * loader/NetscapePlugInStreamLoader.h:
2567         * loader/ResourceLoader.cpp:
2568         (WebCore::ResourceLoader::deliverResponseAndData):
2569         (WebCore::ResourceLoader::loadDataURL):
2570         (WebCore::ResourceLoader::didReceiveResponse):
2571         (WebCore::ResourceLoader::didReceiveResponseAsync):
2572         * loader/ResourceLoader.h:
2573         * loader/SubresourceLoader.cpp:
2574         (WebCore::SubresourceLoader::didReceiveResponse):
2575         (WebCore::SubresourceLoader::didReceiveResponsePolicy):
2576         (WebCore::SubresourceLoader::willCancel):
2577         * loader/SubresourceLoader.h:
2578         * loader/ios/PreviewLoader.mm:
2579         (-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]):
2580
2581 2018-02-20  Chris Dumez  <cdumez@apple.com>
2582
2583         Crash under JSC::JSCell::toNumber(JSC::ExecState*)
2584         https://bugs.webkit.org/show_bug.cgi?id=182984
2585         <rdar://problem/37694346>
2586
2587         Reviewed by Mark Lam.
2588
2589         The issue was caused by DOMMatrix attributes potentially returning "impure"
2590         NaN values. We would call JSC::jsNumber(double) to construct the JSValue
2591         but this is only safe for pure NaN values. Make sure we purify the double
2592         returned by the implementation for IDL attributes of type 'unrestricted double'
2593         before calling JSC::jsNumber(double).
2594
2595         No new tests, extended existing test.
2596
2597         * bindings/js/JSDOMConvertNumbers.h:
2598         (WebCore::JSConverter<IDLUnrestrictedDouble>::convert):
2599         * testing/TypeConversions.h:
2600         (WebCore::TypeConversions::testImpureNaNUnrestrictedDouble const):
2601         (WebCore::TypeConversions::testImpureNaN2UnrestrictedDouble const):
2602         (WebCore::TypeConversions::testQuietNaNUnrestrictedDouble const):
2603         * testing/TypeConversions.idl:
2604
2605 2018-02-20  Tim Horton  <timothy_horton@apple.com>
2606
2607         Make more use of USE(OPENGL_ES) where it makes sense
2608         https://bugs.webkit.org/show_bug.cgi?id=182957
2609         <rdar://problem/37699443>
2610
2611         Reviewed by Dan Bernstein.
2612
2613         No new tests, no behavior change.
2614
2615         Make use of USE(OPENGL_ES) for CoreVideo functions that differ based
2616         on GL availability. Also adjust GraphicsContext3D in the same way.
2617
2618         * platform/cocoa/CoreVideoSoftLink.cpp:
2619         * platform/cocoa/CoreVideoSoftLink.h:
2620         * platform/graphics/GraphicsContext3D.h:
2621         * platform/graphics/cv/TextureCacheCV.mm:
2622         (WebCore::TextureCacheCV::create):
2623         (WebCore::TextureCacheCV::textureFromImage):
2624         * platform/graphics/cv/VideoTextureCopierCV.cpp:
2625         (WebCore::enumToStringMap):
2626         (WebCore::VideoTextureCopierCV::initializeContextObjects):
2627         (WebCore::VideoTextureCopierCV::initializeUVContextObjects):
2628         (WebCore::VideoTextureCopierCV::copyImageToPlatformTexture):
2629         (WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture):
2630
2631 2018-02-20  Nan Wang  <n_wang@apple.com>
2632
2633         AX: AOM: Dispatch accessibleclick event
2634         https://bugs.webkit.org/show_bug.cgi?id=180898
2635         <rdar://problem/36086710>
2636
2637         Reviewed by Ryosuke Niwa.
2638
2639         Accessibility events.
2640         Spec: https://wicg.github.io/aom/spec/phase2.html
2641
2642         This patch allows developers to register event handlers on Elements
2643         for custom accessibility events.
2644
2645         Accessibility events go through a capturing and bubbling phase just
2646         like DOM events, but in the accessibility tree.
2647
2648         Implemented "accessibleclick" event.
2649
2650         Test: accessibility/mac/AOM-events.html
2651
2652         * accessibility/AccessibilityObject.cpp:
2653         (WebCore::AccessibilityObject::press):
2654         (WebCore::AccessibilityObject::dispatchAccessibilityEvent):
2655         * accessibility/AccessibilityObject.h:
2656         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2657         (-[WebAccessibilityObjectWrapper accessibilityPerformAction:]):
2658         * dom/Element.idl:
2659         * dom/EventDispatcher.cpp:
2660         (WebCore::dispatchEventWithType):
2661         (WebCore::EventDispatcher::dispatchEvent):
2662         * dom/EventDispatcher.h:
2663         * dom/EventNames.h:
2664         * dom/EventPath.cpp:
2665         (WebCore::EventPath::EventPath):
2666         * dom/EventPath.h:
2667
2668 2018-02-20  Wenson Hsieh  <wenson_hsieh@apple.com>
2669
2670         [iOS 11.3 Beta] Can't copy a URL from Safari and paste it into the Gmail app
2671         https://bugs.webkit.org/show_bug.cgi?id=182952
2672         <rdar://problem/37636190>
2673
2674         Reviewed by Tim Horton.
2675
2676         After r220865 refactored the iOS copy codepaths to use NSItemProviders, we stopped writing the URL as plain text
2677         to the pasteboard. However, this means clients that only check for "text/plain" (or one of its aliases) on the
2678         pasteboard won't read any data on paste.
2679
2680         To fix this, we restore the pre-iOS 11.3 behavior of writing both the URL and plain text to the pasteboard.
2681         Since we're using item providers, we also ensure that the NSURL is at a higher fidelity than the string to make
2682         it clear that the data should be consumed as a URL.
2683
2684         This patch also rebaselines an existing drag and drop test to cover this change, and adds a new API test,
2685         ActionSheetTests.CopyLinkWritesURLAndPlainText, which simulates copying a link using the share sheet and pasting
2686         into a DataTransfer-dumping test harness.
2687
2688         * platform/ios/PlatformPasteboardIOS.mm:
2689         (WebCore::PlatformPasteboard::write):
2690
2691 2018-02-20  Eric Carlson  <eric.carlson@apple.com>
2692
2693         [iOS] Returning from Auto-PiP causes Safari to be unresponsive
2694         https://bugs.webkit.org/show_bug.cgi?id=182977
2695         <rdar://problem/37685981>
2696
2697         Reviewed by Jer Noble.
2698
2699         Remove the error handling added in r228115, it breaks auto-pip.
2700
2701         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
2702         (VideoFullscreenInterfaceAVKit::applicationDidBecomeActive):
2703         (VideoFullscreenInterfaceAVKit::enterFullscreenStandard):
2704         (VideoFullscreenInterfaceAVKit::exitFullscreen):
2705         (VideoFullscreenInterfaceAVKit::cleanupFullscreen):
2706         (VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
2707         (VideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler):
2708         (VideoFullscreenInterfaceAVKit::exitFullscreenHandler):
2709         (VideoFullscreenInterfaceAVKit::enterFullscreenHandler):
2710
2711 2018-02-20  Jer Noble  <jer.noble@apple.com>
2712
2713         [EME] Adopt new AVContentKeySession success delegate callback
2714         https://bugs.webkit.org/show_bug.cgi?id=182974
2715         <rdar://problem/36079035>
2716
2717         Reviewed by Eric Carlson.
2718
2719         Store the updateLicenseCallback if the new protocol method is present and supported.
2720
2721         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
2722         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
2723         (-[WebCoreFPSContentKeySessionDelegate contentKeySession:contentKeyRequestDidSucceed:]):
2724         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense):
2725         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didFailToProvideRequest):
2726         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::requestDidSucceed):
2727
2728 2018-02-19  Dean Jackson  <dino@apple.com>
2729
2730         Handle all writing-modes in downcast
2731         https://bugs.webkit.org/show_bug.cgi?id=182949
2732         <rdar://problem/37710687>
2733
2734         Reviewed by Myles Maxfield.
2735
2736         It appears we forgot to handle the deprecated "lr"
2737         writing-mode value.
2738
2739         Test: fast/writing-mode/svg-writing-modes.html
2740
2741         * css/CSSPrimitiveValueMappings.h:
2742         (WebCore::CSSPrimitiveValue::operator WritingMode const):
2743
2744 2018-02-20  Zan Dobersek  <zdobersek@igalia.com>
2745
2746         [Cairo] Drop target GraphicsContext usage in Cairo operations
2747         https://bugs.webkit.org/show_bug.cgi?id=182964
2748
2749         Reviewed by Carlos Garcia Campos.
2750
2751         The GraphicsContext parameters in various Cairo operations are not used
2752         anymore, so they can be removed. Callsites are updated to reflect this.
2753
2754         * platform/graphics/cairo/CairoOperations.cpp:
2755         (WebCore::Cairo::drawShadowLayerBuffer):
2756         (WebCore::Cairo::fillShadowBuffer):
2757         (WebCore::Cairo::drawPathShadow):
2758         (WebCore::Cairo::drawGlyphsShadow):
2759         (WebCore::Cairo::fillRect):
2760         (WebCore::Cairo::fillRoundedRect):
2761         (WebCore::Cairo::fillRectWithRoundedHole):
2762         (WebCore::Cairo::fillPath):
2763         (WebCore::Cairo::strokeRect):
2764         (WebCore::Cairo::strokePath):
2765         (WebCore::Cairo::drawGlyphs):
2766         (WebCore::Cairo::drawNativeImage):
2767         (WebCore::Cairo::drawSurface):
2768         * platform/graphics/cairo/CairoOperations.h:
2769         * platform/graphics/cairo/FontCairo.cpp:
2770         (WebCore::FontCascade::drawGlyphs):
2771         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2772         (WebCore::GraphicsContext::drawNativeImage):
2773         (WebCore::GraphicsContext::fillPath):
2774         (WebCore::GraphicsContext::strokePath):
2775         (WebCore::GraphicsContext::fillRect):
2776         (WebCore::GraphicsContext::strokeRect):
2777         (WebCore::GraphicsContext::platformFillRoundedRect):
2778         (WebCore::GraphicsContext::fillRectWithRoundedHole):
2779         * platform/graphics/cairo/GraphicsContextImplCairo.cpp:
2780         (WebCore::GraphicsContextImplCairo::fillRect):
2781         (WebCore::GraphicsContextImplCairo::fillRoundedRect):
2782         (WebCore::GraphicsContextImplCairo::fillRectWithRoundedHole):
2783         (WebCore::GraphicsContextImplCairo::fillPath):
2784         (WebCore::GraphicsContextImplCairo::strokeRect):
2785         (WebCore::GraphicsContextImplCairo::strokePath):
2786         (WebCore::GraphicsContextImplCairo::drawGlyphs):
2787         (WebCore::GraphicsContextImplCairo::drawNativeImage):
2788         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
2789         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
2790
2791 2018-02-20  Sergio Villar Senin  <svillar@igalia.com>
2792
2793         [WebVR][OpenVR] Retrieve eye parameters and field of view
2794         https://bugs.webkit.org/show_bug.cgi?id=182962
2795
2796         Reviewed by Žan Doberšek.
2797
2798         Get the required data from OpenVR to fill in the VREyeParameters and
2799         the VRFieldOfView objects.
2800
2801         * Modules/webvr/VRDisplay.cpp: Create some attributes in the
2802         body of the constructor instead in the member initialization list to
2803         avoid calling getDisplayInfo() multiple times.
2804         (WebCore::VRDisplay::VRDisplay):
2805         (WebCore::VRDisplay::capabilities const):
2806         (WebCore::VRDisplay::getEyeParameters const):
2807         * Modules/webvr/VRDisplay.h:
2808         * Modules/webvr/VREyeParameters.cpp:
2809         (WebCore::VREyeParameters::VREyeParameters): Added new attributes to
2810         the constructor.
2811         (WebCore::VREyeParameters::offset const): Return a Ref instead of
2812         a raw pointer.
2813         (WebCore::VREyeParameters::renderWidth const):
2814         (WebCore::VREyeParameters::renderHeight const):
2815         * Modules/webvr/VREyeParameters.h:
2816         (WebCore::VREyeParameters::create):
2817         * Modules/webvr/VRFieldOfView.cpp: Removed. All the impletementation
2818         fits perfectly in the header file.
2819         * Modules/webvr/VRFieldOfView.h:
2820         (WebCore::VRFieldOfView::create):
2821         (WebCore::VRFieldOfView::upDegrees const):
2822         (WebCore::VRFieldOfView::rightDegrees const):
2823         (WebCore::VRFieldOfView::downDegrees const):
2824         (WebCore::VRFieldOfView::leftDegrees const):
2825         (WebCore::VRFieldOfView::VRFieldOfView):
2826         * Sources.txt:
2827         * platform/vr/VRPlatformDisplay.h: Added some more data to the
2828         VRPlatformDisplayInfo struct.
2829         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
2830         (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
2831         (WebCore::VRPlatformDisplayOpenVR::computeFieldOfView): Computes the
2832         up/down/left/right FOV angles in degrees from the raw project
2833         values returned by OpenVR.
2834         (WebCore::VRPlatformDisplayOpenVR::updateEyeParameters): Fills in
2835         the eye parameter info.
2836         (WebCore::VRPlatformDisplayOpenVR::~VRPlatformDisplayOpenVR):
2837         * platform/vr/openvr/VRPlatformDisplayOpenVR.h:
2838
2839 2018-02-20  Philippe Normand  <pnormand@igalia.com>
2840
2841         [GStreamer][MiniBrowser] Honor GStreamer command line parameters in MiniBrowser
2842         https://bugs.webkit.org/show_bug.cgi?id=173655
2843
2844         Reviewed by Xabier Rodriguez-Calvar.
2845
2846         The FIXME in GStreamerUtilities.cpp asks to pass the command line
2847         parameters to the GStreamer initialization function.
2848
2849         Based on initial patch by: Vanessa Chipirrás Navalón  <vchipirras@igalia.com>
2850
2851         * Modules/webaudio/AudioContext.cpp:
2852         (WebCore::AudioContext::constructCommon): Removes the call to the method
2853         that GStreamer initializes. It is no longer necessary.
2854         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2855         (WebCore::MediaPlayerPrivateGStreamerBase::initializeGStreamerAndRegisterWebKitElements): Ditto
2856         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
2857         (WebCore::initializeGStreamerAndRegisterWebKitMSEElement): Ditto
2858         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
2859         (WebCore::initializeGStreamer): Receive the GStreamer options and initialize GStreamer.
2860         * platform/graphics/gstreamer/GStreamerUtilities.h: Add vector which contains
2861         GStreamer options as the input parameter of the initializeGStreamer() method.
2862
2863 2018-02-20  Miguel Gomez  <magomez@igalia.com>
2864
2865         [GTK] whatsapp web blurry in some parts, sharp on others
2866         https://bugs.webkit.org/show_bug.cgi?id=182673
2867
2868         Reviewed by Carlos Garcia Campos.
2869
2870         CoordinatedGraphicsLayer::createBackingStore() uses the scale factor returned by effectiveContentsScale(),
2871         which is always 1 if selfOrAncestorHaveNonAffineTransforms() returns true. But this fuction always returns
2872         true if the layer has an AnimatedPropertyTransform animation, which means that layers with those animations
2873         won't use the appropriate scale factor, causing blurry renderings.
2874
2875         This patch removes the animations check, so animated layers properly use the required scale factor.
2876
2877         No new tests, no behavior change.
2878
2879         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2880         (WebCore::CoordinatedGraphicsLayer::selfOrAncestorHaveNonAffineTransforms):
2881
2882 2018-02-20  Zan Dobersek  <zdobersek@igalia.com>
2883
2884         [Cairo] Leverage ShadowBlur without using scratch buffer, target GraphicsContext
2885         https://bugs.webkit.org/show_bug.cgi?id=182958
2886
2887         Reviewed by Carlos Garcia Campos.
2888
2889         To allow ShadowBlur usage in different threads, avoid the ShadowBlur
2890         class using the scratch buffer internally. The current implementation of
2891         that scratch buffer is not thread-safe and its usage in such conditions
2892         can lead to crashes.
2893
2894         Instead, the new methods use a temporary ImageBuffer object for drawing.
2895         This does negate the efficiency of possibly reusing the scratch buffer,
2896         but at this point that is not yet the priority. This only affects ports
2897         using Cairo for drawing.
2898
2899         The added methods don't require a target GraphicsContext object to be
2900         passed in, instead they accept buffer draw callbacks that are invoked
2901         with the temporary ImageBuffer object containing the rasterized shadow,
2902         as well as position and size parameters. The CTM and clip bounds values
2903         also have to be passed in manually. In CairoOperations.cpp, the provided
2904         callbacks invoke commands that are equivalent in effect to those that
2905         would otherwise be invoked on the target GraphicsContext object in the
2906         ShadowBlur class.
2907
2908         For now, this approach has to avoid the tiling-based drawing of the
2909         rectangular shadows in drawRectShadow() and inset shadows in
2910         drawInsetShadow(), and instead stick to the non-tiling fallback. While
2911         only affecting Cairo-using ports, with some refactoring it should be
2912         possible to again leverage the tiling-based approach as well.
2913
2914         The beginShadowLayer() and endShadowLayer() functions, which are only
2915         used in CairoOperations.cpp, are replaced with the drawShadowLayer()
2916         method. This one accepts an additional callback that allows the caller
2917         to explicitly draw the shadow shape using the provided shadowing
2918         GraphicsContext object. As with the other two new methods, a temporary
2919         ImageBuffer object is used, and the buffer draw callback is invoked to
2920         allow caller to properly handle the shadowing output.
2921
2922         In CairoOperations.cpp, the new ShadowBlur methods are exercised, with
2923         direct Cairo operation invocation replacing the GraphicsContext calls
2924         otherwise done through ShadowBlur. ShadowState object now also has to
2925         track the global alpha and the global composite operator values so that
2926         it can properly rasterize the resulting shadow into the final image.
2927
2928         No new tests -- no change in behavior.
2929
2930         * platform/graphics/ShadowBlur.cpp:
2931         (WebCore::ShadowBlur::adjustBlurRadius):
2932         (WebCore::ShadowBlur::calculateLayerBoundingRect):
2933         (WebCore::ShadowBlur::drawRectShadow):
2934         (WebCore::ShadowBlur::drawInsetShadow):
2935         (WebCore::ShadowBlur::drawShadowLayer):
2936         (WebCore::ShadowBlur::beginShadowLayer): Deleted.
2937         (WebCore::ShadowBlur::endShadowLayer): Deleted.
2938         * platform/graphics/ShadowBlur.h:
2939         * platform/graphics/cairo/CairoOperations.cpp:
2940         (WebCore::Cairo::drawShadowLayerBuffer):
2941         (WebCore::Cairo::fillShadowBuffer):
2942         (WebCore::Cairo::drawPathShadow):
2943         (WebCore::Cairo::drawGlyphsShadow):
2944         (WebCore::Cairo::ShadowState::ShadowState):
2945         (WebCore::Cairo::fillRect):
2946         (WebCore::Cairo::fillRoundedRect):
2947         (WebCore::Cairo::fillRectWithRoundedHole):
2948         (WebCore::Cairo::drawSurface):
2949         * platform/graphics/cairo/CairoOperations.h:
2950         Default-initialize FillSource::fillRule to RULE_NONZERO.
2951         * platform/graphics/cairo/PlatformContextCairo.h:
2952         Drop the ShadowBlur.h include, it's moved to CairoOperations.cpp.
2953         * rendering/RenderThemeGtk.cpp:
2954         Explicitly include the FloatRoundedRect.h header now that it's not
2955         included through the ShadowBlur.h header via PlatformContextCairo.h.
2956
2957 2018-02-20  Sergio Villar Senin  <svillar@igalia.com>
2958
2959         [WebVR] Use RuntimeEnabledFeatures to enable/disable WebVR
2960         https://bugs.webkit.org/show_bug.cgi?id=182961
2961
2962         Reviewed by Xabier Rodriguez-Calvar.
2963
2964         The shared feature was properly added to RuntimeEnabledFeatures some
2965         time ago but the code was instead using a private method in
2966         NavigatorWebVR to temporarily disable it. WebVR is enabled in
2967         WebPreferences.yaml for GTK+ & WPE as default experimental feature.
2968
2969         * Modules/webvr/NavigatorWebVR.cpp:
2970         (WebCore::NavigatorWebVR::getVRDisplays):
2971         (WebCore::NavigatorWebVR::vrEnabled): Deleted.
2972
2973 2018-02-19  Antti Koivisto  <antti@apple.com>
2974
2975         Use selector filter when invalidating descendants
2976         https://bugs.webkit.org/show_bug.cgi?id=182839
2977         <rdar://problem/37581072>
2978
2979         Reviewed by Zalan Bujtas.
2980
2981         We can make descendant invalidation faster by enabling filtering.
2982
2983         * css/SelectorFilter.cpp:
2984         (WebCore::SelectorFilter::initializeParentStack):
2985
2986             Traverse and reverse the ancestor chain, and push it.
2987
2988         (WebCore::SelectorFilter::pushParent):
2989         (WebCore::SelectorFilter::pushParentInitializingIfNeeded):
2990
2991             Add a version of pushParent that can initialize the stack.
2992
2993         (WebCore::SelectorFilter::popParent):
2994         (WebCore::SelectorFilter::popParentsUntil):
2995
2996             Pop until a given parent element.
2997
2998         (WebCore::SelectorFilter::pushParentStackFrame): Deleted.
2999         (WebCore::SelectorFilter::popParentStackFrame): Deleted.
3000
3001             These were the same as push/popParent.
3002
3003         * css/SelectorFilter.h:
3004         (WebCore::SelectorFilter::popParent): Deleted.
3005         * style/StyleInvalidator.cpp:
3006         (WebCore::Style::Invalidator::invalidateStyleForDescendants):
3007
3008             Use pushParentInitializingIfNeeded.
3009
3010         (WebCore::Style::Invalidator::invalidateStyleWithMatchElement):
3011
3012             Use selector filter when doing descendant tree invalidation.
3013             Make sure to pop it until the parent when reusing.
3014
3015 2018-02-19  Fujii Hironori  <Hironori.Fujii@sony.com>
3016
3017         null m_lastNodeInserted dereference at ReplaceSelectionCommand::InsertedNodes::lastLeafInserted
3018         https://bugs.webkit.org/show_bug.cgi?id=161947
3019
3020         Reviewed by Ryosuke Niwa.
3021
3022         InsertedNodes happened to be empty if the inserted nodes were
3023         removed. Add more checks if InsertedNodes is empty.
3024
3025         No new tests (Covered by existing tests).
3026
3027         * editing/ReplaceSelectionCommand.cpp:
3028         (WebCore::ReplaceSelectionCommand::doApply): Return early if InsertedNodes becomes empty.
3029         * editing/ReplaceSelectionCommand.h:
3030         (WebCore::ReplaceSelectionCommand::InsertedNodes::isEmpty): New method.
3031         (WebCore::ReplaceSelectionCommand::InsertedNodes::lastLeafInserted const):
3032         Assert m_lastNodeInserted is not null.
3033         (WebCore::ReplaceSelectionCommand::InsertedNodes::pastLastLeaf const): Ditto.
3034
3035 2018-02-19  Said Abou-Hallawa  <sabouhallawa@apple.com>
3036
3037         Add SVGPropertyTraits::fromString() to all the SVG animated types
3038         https://bugs.webkit.org/show_bug.cgi?id=182901
3039
3040         Reviewed by Dean Jackson.
3041
3042         This is a work toward https://bugs.webkit.org/show_bug.cgi?id=168586. The
3043         goal is is to templatize the SVGAnimatedType class and to use SVGPropertyTraits
3044         methods inside the template functions.
3045
3046         * WebCore.xcodeproj/project.pbxproj: Move the enum and the SVGPropertyTraits
3047         from SVGMarkerElement.h to SVGMarkerTypes.h.
3048         * svg/SVGAngle.h:
3049         (WebCore::SVGAngle::SVGAngle): Delete unused constructor and create() method.
3050         * svg/SVGAngleValue.h:
3051         * svg/SVGAnimateMotionElement.cpp:
3052         (WebCore::parsePoint): Deleted. Move this function to SVGParserUtilities.cpp
3053         * svg/SVGAnimatedAngle.cpp:
3054         (WebCore::SVGAnimatedAngleAnimator::constructFromString): Use SVGPropertyTraits::fromString().
3055         * svg/SVGAnimatedBoolean.cpp:
3056         (WebCore::SVGAnimatedBooleanAnimator::constructFromString): Ditto.
3057         * svg/SVGAnimatedColor.cpp:
3058         (WebCore::SVGAnimatedColorAnimator::constructFromString): Ditto.
3059         (WebCore::SVGAnimatedColorAnimator::addAnimatedTypes): Use const.
3060         (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue): Ditto.
3061         * svg/SVGAnimatedEnumeration.cpp:
3062         (WebCore::SVGAnimatedEnumerationAnimator::constructFromString): Ditto.
3063         * svg/SVGAnimatedInteger.cpp:
3064         (WebCore::SVGAnimatedIntegerAnimator::constructFromString): Ditto.
3065         * svg/SVGAnimatedIntegerOptionalInteger.cpp:
3066         (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString): Ditto.
3067         * svg/SVGAnimatedLength.cpp:
3068         * svg/SVGAnimatedLengthList.cpp:
3069         (WebCore::SVGAnimatedLengthListAnimator::constructFromString): Ditto.
3070         * svg/SVGAnimatedNumber.cpp:
3071         (WebCore::SVGAnimatedNumberAnimator::constructFromString): Ditto
3072         (WebCore::parseNumberFromString):
3073         * svg/SVGAnimatedNumberList.cpp:
3074         (WebCore::SVGAnimatedNumberListAnimator::constructFromString): Ditto.
3075         * svg/SVGAnimatedNumberOptionalNumber.cpp:
3076         (WebCore::SVGAnimatedNumberOptionalNumberAnimator::constructFromString): Ditto.
3077         * svg/SVGAnimatedPath.cpp:
3078         (WebCore::SVGAnimatedPathAnimator::constructFromString): Ditto.
3079         * svg/SVGAnimatedPointList.cpp:
3080         (WebCore::SVGAnimatedPointListAnimator::constructFromString): Ditto.
3081         * svg/SVGAnimatedPreserveAspectRatio.cpp:
3082         (WebCore::SVGAnimatedPreserveAspectRatioAnimator::constructFromString): Ditto.
3083         * svg/SVGAnimatedRect.cpp:
3084         (WebCore::SVGAnimatedRectAnimator::constructFromString): Ditto.
3085         * svg/SVGAnimatedString.cpp:
3086         (WebCore::SVGAnimatedStringAnimator::constructFromString): Ditto.
3087         * svg/SVGAnimatedTransformList.cpp:
3088         (WebCore::SVGAnimatedTransformListAnimator::constructFromString): Ditto.
3089         * svg/SVGLength.h:
3090         (WebCore::SVGLength::SVGLength): Delete unused constructor and create() method.
3091         * svg/SVGLengthListValues.h:
3092         (WebCore::SVGPropertyTraits<SVGLengthListValues>::fromString): New SVGPropertyTraits method.
3093         (WebCore::SVGPropertyTraits<SVGLengthListValues>::parse): Ditto.
3094         * svg/SVGMarkerElement.h:
3095         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue): Deleted.
3096         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString): Deleted.
3097         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString): Deleted.
3098         (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue): Deleted.
3099         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue): Deleted.
3100         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString): Deleted.
3101         * svg/SVGMarkerTypes.h: Added.
3102         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue):
3103         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString):
3104         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString):
3105         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue):
3106         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString):
3107         (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue):
3108         * svg/SVGMatrix.h: Delete unused constructor and create method.
3109         * svg/SVGNumber.h:
3110         (WebCore::SVGNumber::SVGNumber): Ditto.
3111         * svg/SVGNumberListValues.h:
3112         (WebCore::SVGPropertyTraits<SVGNumberListValues>::fromString): New SVGPropertyTraits method.
3113         * svg/SVGParserUtilities.cpp:
3114         (WebCore::parsePoint): This is moved from SVGAnimateMotionElement.cpp
3115         * svg/SVGParserUtilities.h:
3116         * svg/SVGPathByteStream.h:
3117         (WebCore::SVGPathByteStream::SVGPathByteStream):
3118         (WebCore::SVGPathByteStream::operator=): Add copy and move assignment operators.
3119         (WebCore::SVGPathByteStream::copy const): Use the copy assignment.
3120         (WebCore::SVGPathByteStream::isEmpty const): Use Data.isEmpty().
3121         (WebCore::SVGPropertyTraits<SVGPathByteStream>::initialValue): New SVGPropertyTraits method.
3122         (WebCore::SVGPropertyTraits<SVGPathByteStream>::fromString): Ditto.
3123         * svg/SVGPathUtilities.cpp:
3124         (WebCore::addToSVGPathByteStream): Answer Simon's questions which were added in r190844.
3125         * svg/SVGPoint.h:
3126         (WebCore::SVGPoint::SVGPoint): Delete unused constructor and create method.
3127         * svg/SVGPointListValues.h:
3128         (WebCore::SVGPropertyTraits<SVGPointListValues>::fromString): New SVGPropertyTraits method.
3129         * svg/SVGPolyElement.cpp:
3130         (WebCore::SVGPolyElement::parseAttribute): Use the move assignment operator.
3131         * svg/SVGPreserveAspectRatio.h:
3132         (WebCore::SVGPreserveAspectRatio::SVGPreserveAspectRatio): Delete unused constructor and create method.
3133         * svg/SVGPreserveAspectRatioValue.cpp:
3134         (WebCore::SVGPreserveAspectRatioValue::SVGPreserveAspectRatioValue): Add new constructor.
3135         * svg/SVGPreserveAspectRatioValue.h:
3136         (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::fromString): New SVGPropertyTraits method.
3137         (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::toString): Ditto.
3138         * svg/SVGRect.h:
3139         (WebCore::SVGRect::SVGRect): Delete unused constructor and create method.
3140         * svg/SVGRectTraits.h: Removed.
3141         * svg/SVGTransform.h:
3142         (WebCore::SVGTransform::SVGTransform): Delete unused constructor and create method.
3143         * svg/SVGTransformListValues.h:
3144         (WebCore::SVGPropertyTraits<SVGTransformListValues>::fromString): New SVGPropertyTraits method.
3145         * svg/properties/SVGPropertyTearOff.h: Delete unused create method.
3146         * svg/properties/SVGPropertyTraits.h: New SVGPropertyTraits methods.
3147         (WebCore::SVGPropertyTraits<bool>::fromString): 
3148         (WebCore::SVGPropertyTraits<Color>::initialValue):
3149         (WebCore::SVGPropertyTraits<Color>::fromString):
3150         (WebCore::SVGPropertyTraits<Color>::parse):
3151         (WebCore::SVGPropertyTraits<Color>::toString):
3152         (WebCore::SVGPropertyTraits<int>::fromString):
3153         (WebCore::SVGPropertyTraits<float>::fromString):
3154         (WebCore::SVGPropertyTraits<float>::parse):
3155         (WebCore::SVGPropertyTraits<FloatPoint>::initialValue):
3156         (WebCore::SVGPropertyTraits<FloatPoint>::fromString):
3157         (WebCore::SVGPropertyTraits<FloatPoint>::parse):
3158         (WebCore::SVGPropertyTraits<FloatPoint>::toString):
3159         (WebCore::SVGPropertyTraits<FloatRect>::initialValue):
3160         (WebCore::SVGPropertyTraits<FloatRect>::fromString):
3161         (WebCore::SVGPropertyTraits<FloatRect>::parse):
3162         (WebCore::SVGPropertyTraits<FloatRect>::toString):
3163         (WebCore::SVGPropertyTraits<String>::fromString):
3164         (WebCore::SVGPropertyTraits<String>::parse):
3165         (WebCore::SVGPropertyTraits<String>::toString):
3166
3167 2018-02-19  Antoine Quint  <graouts@apple.com>
3168
3169         [Modern Media Controls] Implement a compact set of media controls
3170         https://bugs.webkit.org/show_bug.cgi?id=182937
3171         <rdar://problem/37682257>
3172
3173         Reviewed by Eric Carlson.
3174
3175         We add a new type of media controls used when we need stripped down and compact controls. The new
3176         CompactMediaControls only show a play/pause button and an invalid placard and disregard all media
3177         events that are not relevant to the display of these controls.
3178
3179         To distinguish cases where we need to show compact media controls, we expose a new property on
3180         MediaControlsHost called "compactMode".
3181
3182         Tests: media/modern-media-controls/compact-media-controls/compact-media-controls-constructor.html
3183                media/modern-media-controls/compact-media-controls/compact-media-controls-layout.html
3184
3185         * Modules/mediacontrols/MediaControlsHost.cpp:
3186         (WebCore::MediaControlsHost::base64StringForIconNameAndType const):
3187         (WebCore::MediaControlsHost::compactMode const):
3188         * Modules/mediacontrols/MediaControlsHost.h:
3189         (WebCore::MediaControlsHost::setSimulateCompactMode):
3190         * Modules/mediacontrols/MediaControlsHost.idl:
3191         * Modules/modern-media-controls/controls/compact-media-controls.js: Added.
3192         (CompactMediaControls.prototype.get scaleFactor):
3193         (CompactMediaControls.prototype.set scaleFactor):
3194         (CompactMediaControls.prototype.get shouldCenterControlsVertically):
3195         (CompactMediaControls.prototype.set shouldCenterControlsVertically):
3196         (CompactMediaControls.prototype.get placard):
3197         (CompactMediaControls.prototype.set placard):
3198         (CompactMediaControls.prototype.layout):
3199         (CompactMediaControls.prototype.commitProperty):
3200         * Modules/modern-media-controls/controls/icon-service.js:
3201         (const.iconService.new.IconService.prototype._fileNameAndPlatformForIconAndLayoutTraits):
3202         (const.iconService.new.IconService):
3203         * Modules/modern-media-controls/controls/inline-media-controls.js:
3204         * Modules/modern-media-controls/controls/layout-item.js:
3205         * Modules/modern-media-controls/js-files:
3206         * Modules/modern-media-controls/main.js:
3207         * Modules/modern-media-controls/media/media-controller.js:
3208         (MediaController.prototype.get layoutTraits):
3209         (MediaController.prototype._supportingObjectClasses): Compute the set of MediaControllerSupport classes based
3210         on the layout traits such that in compact mode we only return PlacardSupport and PlaybackSupport.
3211         (MediaController.prototype._updateControlsIfNeeded):
3212         (MediaController.prototype._controlsClassForLayoutTraits):
3213         (MediaController.prototype._shouldControlsBeAvailable):
3214         * Modules/modern-media-controls/media/placard-support.js:
3215         (PlacardSupport.prototype.get mediaEvents): Only track the "error" event in compact mode since this is the only
3216         relevant placard.
3217         * Modules/modern-media-controls/media/playback-support.js:
3218         (PlaybackSupport.prototype.syncControl): Only show or hide the play/pause button based on the playback state
3219         when in compact mode.
3220         (PlaybackSupport):
3221         * WebCore.xcodeproj/project.pbxproj:
3222
3223 2018-02-19  Antoine Quint  <graouts@apple.com>
3224
3225         [Web Animations] Make KeyframeEffect target nullable and read-write
3226         https://bugs.webkit.org/show_bug.cgi?id=182741
3227
3228         Reviewed by Dean Jackson.
3229
3230         We used to completely disregard null targets, for instance not parsing keyframes, but targets
3231         can be null and are also supposed to be read-write for KeyframeEffect. We now update the IDL
3232         for KeyframeEffect to mark the target property as read-write and update the implementation
3233         to correctly handle null targets.
3234
3235         This revealed a few issues in our implementation by allowing more WPT tests to run. So we also
3236         ensure that:
3237         
3238         - we don't crash when parsing font-related properties by calling update() on the generated
3239         RenderStyle's FontCascade when parsing keyframes.
3240
3241         - CSS properties are provided as camel-case and not as hyphenated form
3242
3243         - values provided in keyframes dictionaries are only read for valid properties
3244
3245         - styles for effect targets are invalidated as soon as the timing model for that animation
3246         is changed
3247
3248         * animation/KeyframeEffect.idl:
3249         * animation/KeyframeEffectReadOnly.cpp:
3250         (WebCore::invalidateElement): Add a new utility method to invalidate a given element since
3251         we may want to invalidate not only the current target (m_target) but also a previous target.
3252         (WebCore::IDLAttributeNameToAnimationPropertyName): Move this function below CSSPropertyIDToIDLAttributeName
3253         so that it can call that function. We also check that we reject CSS properties that are not provided in
3254         camel-case form (eg. "font-size" vs. "fontSize").
3255         (WebCore::processIterableKeyframes): Only read the JS values if we know that the provided JS property name
3256         maps to a valid CSS property.
3257         (WebCore::KeyframeEffectReadOnly::processKeyframes): Allow keyframes to be processed even if the effect's
3258         target is null.
3259         (WebCore::KeyframeEffectReadOnly::setTarget): Notify the animation that the effect target has changed and
3260         invalidate the style of the new target and the old targets, if any. We also update the blending keyframes
3261         since this task may not have been completed in a previous call to processKeyframes() due to the target being
3262         null at that time.
3263         (WebCore::KeyframeEffectReadOnly::invalidate): Use the invalidateElement() utility.
3264         * animation/KeyframeEffectReadOnly.h:
3265         * animation/WebAnimation.cpp:
3266         (WebCore::WebAnimation::effectTargetDidChange): This method is called in KeyframeEffectReadOnly::setTarget()
3267         to inform the animation of the previous effect target and the new one upon a target change. This allows us to
3268         forward this information onto the timeline so that we correctly add or remove the targets from the list of
3269         animated elements.
3270         * animation/WebAnimation.h:
3271
3272 2018-02-19  Chris Dumez  <cdumez@apple.com>
3273
3274         Crash under MIMETypeRegistry::isSupportedJavaScriptMIMEType()
3275         https://bugs.webkit.org/show_bug.cgi?id=182927
3276         <rdar://problem/37675748>
3277
3278         Reviewed by Antti Koivisto.
3279
3280         Make it safe to call MIMETypeRegistry::isSupportedJavaScriptMIMEType() from the non-main thread.
3281         It is currently being called from a background thread in the following places:
3282         - ServiceWorkerJob::didReceiveResponse()
3283         - WorkerGlobalScope::importScripts()
3284
3285         These call sites on non-main threads were added recently with the support for service workers.
3286
3287         No new tests, already covered by existing tests that flakily experience service worker
3288         process crashes.
3289
3290         * platform/MIMETypeRegistry.cpp:
3291         (WebCore::MIMETypeRegistry::isSupportedJavaScriptMIMEType):
3292
3293 2018-02-19  Dean Jackson  <dino@apple.com>
3294
3295         SIGFPE @ int WebCore::SVGToOTFFontConverter::scaleUnitsPerEm<int> const + 45
3296         https://bugs.webkit.org/show_bug.cgi?id=182944
3297         <rdar://problem/35369984>
3298
3299         Reviewed by Myles Maxfield.
3300
3301         Avoid a divide-by-zero.
3302
3303         Test: svg/text/font-bad-unitsperem.html
3304
3305         * svg/SVGFontFaceElement.cpp:
3306         (WebCore::SVGFontFaceElement::unitsPerEm const):
3307
3308 2018-02-19  Tim Horton  <timothy_horton@apple.com>
3309
3310         REGRESSION (r219342): Touch event coordinates and elementFromPoint coordinates differ
3311         https://bugs.webkit.org/show_bug.cgi?id=182910
3312         <rdar://problem/37533950>
3313
3314         Reviewed by Simon Fraser.
3315
3316         We reverted other changes to the definition of client coordinates
3317         in r219829 due to compatibility concerns. However, we failed to revert
3318         r219342 on trunk, leaving elementFromPoint() using coordinates relative
3319         to the layout viewport.
3320
3321         Add a currently off-by-default setting to switch on layout-viewport-relative
3322         client coordinates and guard the elementFromPoint changes behind it.
3323         A future patch should roll r219829 back in also behind this setting, so
3324         that everything remains consistent regardless of which coordinate space we choose.
3325
3326         * dom/TreeScope.cpp:
3327         (WebCore::absolutePointIfNotClipped):
3328         * page/Settings.yaml:
3329         * rendering/RenderLayer.cpp:
3330         (WebCore::RenderLayer::hitTest):
3331
3332 2018-02-19  Eric Carlson  <eric.carlson@apple.com>
3333
3334         [Extra zoom mode] Don't allow PiP media playback
3335         https://bugs.webkit.org/show_bug.cgi?id=182930
3336         <rdar://problem/37676259>
3337
3338         Reviewed by Andy Estes.
3339
3340         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3341         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Don't call setPIPModeEnabled:
3342         if it isn't implemented.
3343         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode): Ditto.
3344
3345 2018-02-19  Antoine Quint  <graouts@apple.com>
3346
3347         [Web Animations] Decouple parsing JS keyframes and computing blending keyframes
3348         https://bugs.webkit.org/show_bug.cgi?id=182939
3349         <rdar://problem/37678364>
3350
3351         Reviewed by Dean Jackson.
3352
3353         Move all the code used to create the KeyframeList into a dedicated updateBlendingKeyframes() method.
3354
3355         No new tests since this code change has no user-visible impact.
3356
3357         * animation/KeyframeEffectReadOnly.cpp:
3358         (WebCore::KeyframeEffectReadOnly::processKeyframes):
3359         (WebCore::KeyframeEffectReadOnly::updateBlendingKeyframes):
3360         * animation/KeyframeEffectReadOnly.h:
3361
3362 2018-02-19  Jer Noble  <jer.noble@apple.com>
3363
3364         [EME] Add mechanism for MediaKeySession to react to HDCP changes
3365         https://bugs.webkit.org/show_bug.cgi?id=182935
3366
3367         Reviewed by Eric Carlson.
3368
3369         Add a client callback interface to CDMInterface to allow subclasses to communicate up to
3370         MediaKeySEssion. Add a virtual method to CDMInterface to allow it to be notified of HDCP
3371         status changes. Override this method in CDMInstanceFairPlayStreamingAVFObjC. Hook up the
3372         outputObscuredDueToInsufficientExternalProtectionChanged() methods in both
3373         MediaPlayerPrivateAVFoundationObjC and MediaPlayerPrivateMediaSourceAVFObjC to this new
3374         CDMInstance method. Add an Internals method to simulate an HDCP error for testing purposes.
3375
3376         * Modules/encryptedmedia/MediaKeySession.cpp:
3377         (WebCore::MediaKeySession::MediaKeySession):
3378         (WebCore::MediaKeySession::~MediaKeySession):
3379         (WebCore::MediaKeySession::updateKeyStatuses):
3380         * Modules/encryptedmedia/MediaKeySession.h:
3381         * platform/encryptedmedia/CDMInstance.h:
3382         (WebCore::CDMInstance::setHDCPStatus):
3383         (WebCore::CDMInstance::setClient):
3384         (WebCore::CDMInstance::clearClient):
3385         * platform/graphics/MediaPlayer.cpp:
3386         (WebCore::MediaPlayer::beginSimulatedHDCPError):
3387         (WebCore::MediaPlayer::endSimulatedHDCPError):
3388         * platform/graphics/MediaPlayer.h:
3389         * platform/graphics/MediaPlayerPrivate.h:
3390         (WebCore::MediaPlayerPrivateInterface::beginSimulatedHDCPError):
3391         (WebCore::MediaPlayerPrivateInterface::endSimulatedHDCPError):
3392         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
3393         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
3394         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::setClient):
3395         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::clearClient):
3396         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::sessionIdentifierChanged):
3397         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
3398         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
3399         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3400         (WebCore::MediaPlayerPrivateAVFoundationObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
3401         (WebCore::playerKVOProperties):
3402         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
3403         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
3404         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3405         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
3406         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h: