b59bca47259a9ec1e11ecc807efd9361f5cea72c
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-01-22  Simon Fraser  <simon.fraser@apple.com>
2
3         REGRESSION (r226981): ASSERTION FAILED: startY >= 0 && endY <= height && startY < endY in WebCore::FEMorphology::platformApplyGeneric
4         https://bugs.webkit.org/show_bug.cgi?id=181836
5
6         Reviewed by Tim Horton.
7         
8         All the filters that use ParallelJobs<> has the same type of bug where very wide but not tall
9         filter regions could result in computing an optimalThreadNumber that was greater than the
10         number of rows to process, which resulted in jobs with zero rows to process.
11
12         Since we split the work by rows, cap the maximum number of threads to height/8 so that each job
13         has at least 8 rows of pixels to process. Add some assertions to detect jobs with zero rows.
14
15         FEMorphology was also using implicit float -> int conversion to detect integer overflow of radius,
16         so change that to use explicit clamping.
17         
18         Tests: svg/filters/feLighting-parallel-jobs.svg
19                svg/filters/feTurbulence-parallel-jobs-wide.svg
20
21         * platform/graphics/filters/FELighting.cpp:
22         (WebCore::FELighting::platformApplyGenericPaint):
23         (WebCore::FELighting::platformApplyGeneric):
24         * platform/graphics/filters/FEMorphology.cpp:
25         (WebCore::FEMorphology::platformApplyGeneric):
26         (WebCore::FEMorphology::platformApply):
27         (WebCore::FEMorphology::platformApplyDegenerate):
28         (WebCore::FEMorphology::platformApplySoftware):
29         * platform/graphics/filters/FETurbulence.cpp:
30         (WebCore::FETurbulence::fillRegion const):
31         (WebCore::FETurbulence::platformApplySoftware):
32
33 2018-01-22  Eric Carlson  <eric.carlson@apple.com>
34
35         Resign NowPlaying status when no media element is eligible
36         https://bugs.webkit.org/show_bug.cgi?id=181914
37         <rdar://problem/35294116>
38
39         Reviewed by Jer Noble.
40
41         No new tests, these changes prevent existing tests from crashing.
42
43         * html/HTMLMediaElement.h:
44         * html/MediaElementSession.cpp:
45         (WebCore::MediaElementSession::playbackPermitted const): Return early when the media 
46         element has been suspended.
47         (WebCore::MediaElementSession::canShowControlsManager const): Return false when the
48         media element has been suspended.
49         (WebCore::isMainContentForPurposesOfAutoplay): Return early if it isn't safe to update
50         style because HitTest can force a layout.
51         (WebCore::MediaElementSession::updateIsMainContent const): Ditto.
52
53 2018-01-22  Alex Christensen  <achristensen@webkit.org>
54
55         Begin removing QTKit code
56         https://bugs.webkit.org/show_bug.cgi?id=181951
57
58         Reviewed by Jer Noble.
59
60         QTKit was being used on El Capitan and before.
61
62         * Configurations/WebCore.xcconfig:
63         * SourcesMac.txt:
64         * WebCore.xcodeproj/project.pbxproj:
65         * platform/graphics/MediaPlayer.cpp:
66         (WebCore::buildMediaEnginesVector):
67         (WebCore::MediaPlayer::supportsType):
68         * platform/graphics/mac/MediaPlayerPrivateQTKit.h: Removed.
69         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: Removed.
70         * platform/graphics/mac/MediaTimeQTKit.h: Removed.
71         * platform/graphics/mac/MediaTimeQTKit.mm: Removed.
72         * platform/mac/WebVideoFullscreenController.mm:
73         (-[WebVideoFullscreenController setVideoElement:]):
74         (-[WebVideoFullscreenController updatePowerAssertions]):
75
76 2018-01-22  Per Arne Vollan  <pvollan@apple.com>
77
78         [Win] Null pointer crash under WebCore::RenderStyle::colorIncludingFallback.
79         https://bugs.webkit.org/show_bug.cgi?id=181801
80         <rdar://problem/35614900>
81
82         Reviewed by Brent Fulgham.
83
84         Do not paint synchronously when popup items have been added or changed while the popup is visible.
85         If new popup items have been added after the popup was shown, a synchronous paint operation will
86         possibly access their style before it is ready, leading to a null pointer crash. The invalidated
87         area will be painted asynchronously.
88
89         No new tests. To reproduce this crash, it is necessary to open a popup with JavaScript, add new
90         popup items, and then end the test. Opening the popup can be done by sending a mousedown event
91         with the eventsender. However, on Windows the mousedown event is sent synchronously, and will
92         block as long as the popup is open and running the popup event loop. This means no JS can be
93         executed until the popup is closed, causing the test to always time out before new popup items
94         can be added. I have verified the fix with a manual test case.
95
96         * platform/win/PopupMenuWin.cpp:
97         (WebCore::PopupMenuWin::updateFromElement):
98
99 2018-01-22  Chris Dumez  <cdumez@apple.com>
100
101         RELEASE_ASSERT(registration) hit in SWServer::installContextData(const ServiceWorkerContextData&)
102         https://bugs.webkit.org/show_bug.cgi?id=181941
103         <rdar://problem/36744892>
104
105         Reviewed by Youenn Fablet.
106
107         Make sure we clear SWServer::m_pendingContextDatas & SWServer::m_pendingJobs as needed
108         when clearing Website data. Otherwise, we will hit assertion when those gets processed
109         after the connection to the SW process has been established (not to mentioned we failed
110         to clear some in-memory data even though the user asked us to).
111
112         * workers/service/server/SWServer.cpp:
113         (WebCore::SWServer::clearAll):
114         (WebCore::SWServer::clear):
115
116 2018-01-22  Ryosuke Niwa  <rniwa@webkit.org>
117
118         Blob conversion and sanitization doesn't work with Microsoft Word for Mac 2011
119         https://bugs.webkit.org/show_bug.cgi?id=181616
120         <rdar://problem/36484908>
121
122         Reviewed by Wenson Hsieh.
123
124         The bug was caused by WebContentReader::readHTML and WebContentMarkupReader::readHTML not sanitizing plain HTML string
125         as done for web archives even when custom pasteboard data is enabled. Fixed the bug by doing the sanitization.
126
127         Unfortunately, we can't make file URLs available in this case because WebContent process doesn't have sandbox extensions
128         to access local files referenced by the HTML source in the clipboard, and we can't make WebContent process request for
129         a sandbox extension¸on an arbitrary local file, as it would defeat the whole point of sandboxing.
130
131         Instead, we strip away all HTML attributes referencing a URL whose scheme is not HTTP, HTTPS, or data when sanitizing
132         text/html from the clipboard to avoid exposing local file paths, which can reveal privacy & security sensitive data
133         such as the user's full name, and the location of private containers of other applications in the system.
134
135         Tests: PasteHTML.DoesNotSanitizeHTMLWhenCustomPasteboardDataIsDisabled
136                PasteHTML.DoesNotStripFileURLsWhenCustomPasteboardDataIsDisabled
137                PasteHTML.ExposesHTMLTypeInDataTransfer
138                PasteHTML.KeepsHTTPURLs
139                PasteHTML.SanitizesHTML
140                PasteHTML.StripsFileURLs
141
142         * editing/cocoa/WebContentReaderCocoa.mm:
143         (WebCore::WebContentReader::readHTML): Fixed the bug by sanitizing the markup, and stripping away file URLs.
144         (WebCore::WebContentMarkupReader::readHTML): Ditto.
145         * editing/markup.cpp:
146         (WebCore::removeSubresourceURLAttributes): Added.
147         (WebCore::sanitizeMarkup): Added.
148         * editing/markup.h:
149
150 2018-01-22  Chris Dumez  <cdumez@apple.com>
151
152         Add release logging to help debug issues related to service workers
153         https://bugs.webkit.org/show_bug.cgi?id=181935
154         <rdar://problem/36735900>
155
156         Reviewed by Brady Eidson.
157
158         * workers/service/ServiceWorker.cpp:
159         (WebCore::ServiceWorker::ServiceWorker):
160         (WebCore::ServiceWorker::scheduleTaskToUpdateState):
161         (WebCore::ServiceWorker::postMessage):
162         (WebCore::ServiceWorker::isAlwaysOnLoggingAllowed const):
163         * workers/service/ServiceWorker.h:
164         * workers/service/ServiceWorkerContainer.cpp:
165         (WebCore::ServiceWorkerContainer::addRegistration):
166         (WebCore::ServiceWorkerContainer::removeRegistration):
167         (WebCore::ServiceWorkerContainer::updateRegistration):
168         (WebCore::ServiceWorkerContainer::jobFailedWithException):
169         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
170         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
171         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
172         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
173         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
174         (WebCore::ServiceWorkerContainer::isAlwaysOnLoggingAllowed const):
175         * workers/service/ServiceWorkerContainer.h:
176         * workers/service/ServiceWorkerRegistration.cpp:
177         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
178         (WebCore::ServiceWorkerRegistration::updateStateFromServer):
179         (WebCore::ServiceWorkerRegistration::scheduleTaskToFireUpdateFoundEvent):
180         * workers/service/server/SWServer.cpp:
181         (WebCore::SWServer::scriptContextFailedToStart):
182         (WebCore::SWServer::didFinishInstall):
183         (WebCore::SWServer::didFinishActivation):
184         (WebCore::SWServer::terminateWorkerInternal):
185         * workers/service/server/SWServerJobQueue.cpp:
186         (WebCore::SWServerJobQueue::didResolveRegistrationPromise):
187         (WebCore::SWServerJobQueue::runRegisterJob):
188
189 2018-01-22  Youenn Fablet  <youenn@apple.com>
190
191         Safari Tech Preview can't use GitHub login at forums.swift.org
192         https://bugs.webkit.org/show_bug.cgi?id=181908
193         <rdar://problem/36715111>
194
195         Reviewed by Chris Dumez.
196
197         Test: http/wpt/service-workers/navigation-redirect.https.html
198
199         For subresource loads, redirections will not change who is in charge of continuing the load (service worker or network process).
200         For navigation loads, we need to match the registration for every redirection since this is using the Manual redirect mode.
201         This allows starting the load with a service worker and finishing the load with another service worker, which will become the controller.
202
203         Implement this by wrapping the registration matching of an URL within DocumentLoader::matchRegistration.
204         Use that method in DocumentLoader::redirectReceived.
205
206         * loader/DocumentLoader.cpp:
207         (WebCore::DocumentLoader::matchRegistration):
208         (WebCore::doRegistrationsMatch):
209         (WebCore::DocumentLoader::redirectReceived):
210         (WebCore::DocumentLoader::startLoadingMainResource):
211         * loader/DocumentLoader.h:
212
213 2018-01-22  Antti Koivisto  <antti@apple.com>
214
215         REGRESSION (Safari 11): Buttons inside a fieldset legend cannot be clicked on in Safari 11
216         https://bugs.webkit.org/show_bug.cgi?id=179666
217         <rdar://problem/35534292>
218
219         Reviewed by Zalan Bujtas.
220
221         The legend element of a fieldset is in the border area, outside the clip rect.
222         With overflow:hidden mouse events won't reach it.
223
224         Test case by Dhaya Benmessaoud.
225
226         Test: fast/forms/legend-overflow-hidden-hit-test.html
227
228         * rendering/RenderBlock.cpp:
229         (WebCore::RenderBlock::nodeAtPoint):
230         (WebCore::RenderBlock::hitTestExcludedChildrenInBorder):
231
232         Add a special case to hit testing to handle legend, similarly to what is done for painting.
233
234         * rendering/RenderBlock.h:
235
236 2018-01-22  Joanmarie Diggs  <jdiggs@igalia.com>
237
238         AX: Implement support for Graphics ARIA roles
239         https://bugs.webkit.org/show_bug.cgi?id=181796
240
241         Reviewed by Chris Fleizach.
242
243         Add mappings for the three new roles (graphics-document, graphics-object,
244         and graphics-symbol) as per the Graphics Accessibility API Mappings spec.
245
246         No new tests; instead, new test cases added to roles-computedRoleString.html
247         and roles-exposed.html.
248
249         * accessibility/AccessibilityObject.cpp:
250         (WebCore::initializeRoleMap):
251         (WebCore::AccessibilityObject::computedRoleString const):
252         * accessibility/AccessibilityObject.h:
253         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
254         (atkRole):
255         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
256         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
257         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
258         (createAccessibilityRoleMap):
259         (-[WebAccessibilityObjectWrapper subrole]):
260         (-[WebAccessibilityObjectWrapper roleDescription]):
261
262 2018-01-22  Antti Koivisto  <antti@apple.com>
263
264         REGRESSION(r224535): Can't write reviews in the App Store
265         https://bugs.webkit.org/show_bug.cgi?id=181936
266         <rdar://problem/36670246>
267
268         Reviewed by Zalan Bujtas.
269
270         * page/LayoutContext.cpp:
271         (WebCore::LayoutContext::updateStyleForLayout):
272
273         r224535 was about media queries but it also removed a seemingly spurious call to SyleScope::didChangeStyleSheetEnvironment
274         from the path that does not involve media queries.
275         Turns out UITextContentView somehow depended on it, so revert this specific change.
276
277 2018-01-22  Brady Eidson  <beidson@apple.com>
278
279         In WebKit2, make the MessagePortChannelRegistry live in the UI process.
280         https://bugs.webkit.org/show_bug.cgi?id=181922
281
282         Reviewed by Andy Estes.
283
284         No new tests (Refactor, no behavior change)
285
286         Add encoder/decoders and EXPORT a whole bunch of stuff.
287         
288         * WebCore.xcodeproj/project.pbxproj:
289
290         * dom/MessagePort.h:
291
292         * dom/messageports/MessagePortChannel.cpp:
293         (WebCore::MessagePortChannel::processForPort):
294         * dom/messageports/MessagePortChannel.h:
295
296         * dom/messageports/MessagePortChannelProvider.h:
297         * dom/messageports/MessagePortChannelRegistry.h:
298
299         * dom/messageports/MessageWithMessagePorts.h:
300         (WebCore::MessageWithMessagePorts::encode const):
301         (WebCore::MessageWithMessagePorts::decode):
302
303 2018-01-22  Youenn Fablet  <youenn@apple.com>
304
305         Fetch Headers from an Opaque response should be filtered out
306         https://bugs.webkit.org/show_bug.cgi?id=181926
307
308         Reviewed by Chris Dumez.
309
310         Covered by updated test.
311
312         Refactor to use the same FetchResponse::create for Cache API and cloning.
313         In this method, ensure that response and headers are filtered correctly according response tainting.
314         Make also sure that synthetic responses do not get filtered (not needed since created by JavaScript).
315
316         Introduce helper routine to set the header map of a resource response.
317         Use this routine when cloning a synthetic response as in that case, m_internalResponse has no header at all.
318
319         * Modules/cache/DOMCache.cpp:
320         (WebCore::DOMCache::updateRecords):
321         * Modules/fetch/FetchResponse.cpp:
322         (WebCore::FetchResponse::create):
323         (WebCore::FetchResponse::clone):
324         * Modules/fetch/FetchResponse.h:
325         * platform/network/ResourceResponseBase.cpp:
326         (WebCore::ResourceResponseBase::setHTTPHeaderFields):
327         * platform/network/ResourceResponseBase.h:
328         * testing/ServiceWorkerInternals.cpp:
329         (WebCore::ServiceWorkerInternals::createOpaqueWithBlobBodyResponse):
330
331 2018-01-22  Javier Fernandez  <jfernandez@igalia.com>
332
333         [css-align] 'overflow' keyword must precede the self-position and content-position value
334         https://bugs.webkit.org/show_bug.cgi?id=181793
335
336         Reviewed by Antti Koivisto.
337
338         There were several discussions to avoid ambiguities with the complex
339         values, specially when it comes to define the place-xxx shorthands.
340
341         One of the sources of problems is the 'overflow-position' keyword. The
342         CSS WG has decided to change the syntax of all the CSS Box Alignment
343         properties so that the 'overflow-position' keyword always precede the
344         'self-position' or the 'content-position' keywords.
345
346         https://github.com/w3c/csswg-drafts/issues/1446#event-1125715434
347
348         In order to apply this change to the Content Distribution properties'
349         (align-content and justify-content) syntax I had to completely
350         re-implement their parsing function. Thanks to this I addressed also
351         the issue with the content-distribution fallback, which cannot be
352         specified explicitly now.
353
354         https://github.com/w3c/csswg-drafts/issues/1002#ref-commit-c38cac4
355
356         No new tests, just rebaselined the expected results of the test cases affected.
357
358         Despite the so many layout tests affected by this change, it's
359         unlikely that it might break any content in current web
360         sites. This patch changes the new CSS syntax, obviously backward
361         compatible, defined by the new CSS Box Alignment. The
362         'overflow-position' keyword is only used by the layout models
363         implementing the new spec, so far only CSS Grid Layout.
364         Considering that CSS Grid has been shipped last year, it's unlikely
365         that many sites are using the new CSS values.
366
367         * css/CSSComputedStyleDeclaration.cpp:
368         (WebCore::valueForItemPositionWithOverflowAlignment):
369         (WebCore::valueForContentPositionAndDistributionWithOverflowAlignment):
370         * css/CSSContentDistributionValue.cpp:
371         (WebCore::CSSContentDistributionValue::customCSSText const):
372         * css/StyleBuilderConverter.h:
373         (WebCore::StyleBuilderConverter::convertSelfOrDefaultAlignmentData):
374         * css/parser/CSSPropertyParser.cpp:
375         (WebCore::consumeOverflowPositionKeyword):
376         (WebCore::consumeContentPositionKeyword):
377         (WebCore::consumeContentDistributionOverflowPosition):
378         (WebCore::consumeSelfPositionOverflowPosition):
379
380 2018-01-22  Chris Nardi  <csnardi1@gmail.com>
381
382         Parse calc() in CSS media queries
383         https://bugs.webkit.org/show_bug.cgi?id=181716
384
385         calc() was previously unsupported inside of media queries. This change
386         adds in support for parsing calc inside of media queries.
387
388         Reviewed by Antti Koivisto.
389
390         Tests: Imported web-platform-tests/css/mediaqueries
391
392         * css/MediaQueryExpression.cpp:
393         (WebCore::featureWithValidIdent): Updated function to take a CSSPrimitiveValue.
394         (WebCore::featureWithValidDensity): Updated function to take a CSSPrimitiveValue instead of a CSSParserToken.
395         (WebCore::featureWithValidPositiveLength): Ditto.
396         (WebCore::featureExpectingPositiveInteger): Ditto.
397         (WebCore::featureWithPositiveInteger): Ditto.
398         (WebCore::featureWithPositiveNumber): Ditto.
399         (WebCore::featureWithZeroOrOne): Ditto.
400         (WebCore::MediaQueryExpression::MediaQueryExpression): Use CSSPropertyParserHelpers for consuming.
401         * css/MediaQueryExpression.h:
402         * css/parser/CSSPropertyParserHelpers.cpp:
403         (WebCore::CSSPropertyParserHelpers::consumeResolution): Added function for use in media query expression parsing.
404         * css/parser/CSSPropertyParserHelpers.h:
405         * css/parser/MediaQueryParser.cpp:
406         (WebCore::MediaQueryParser::readRestrictor): Updated functions to take a CSSParserTokenRange in order to use CSSPropertyParserHelpers.
407         (WebCore::MediaQueryParser::readMediaNot): Ditto.
408         (WebCore::MediaQueryParser::readMediaType): Ditto.
409         (WebCore::MediaQueryParser::readAnd): Ditto.
410         (WebCore::MediaQueryParser::readFeatureStart): Ditto.
411         (WebCore::MediaQueryParser::readFeature): Ditto.
412         (WebCore::MediaQueryParser::readFeatureColon): Ditto.
413         (WebCore::MediaQueryParser::readFeatureValue): Ditto.
414         (WebCore::MediaQueryParser::readFeatureEnd): Ditto.
415         (WebCore::MediaQueryParser::skipUntilComma): Ditto.
416         (WebCore::MediaQueryParser::skipUntilBlockEnd): Ditto.
417         (WebCore::MediaQueryParser::processToken): Ditto.
418         (WebCore::MediaQueryParser::parseInternal): Ditto.
419         (WebCore::MediaQueryData::clear): Removed reference to m_valueList
420         (WebCore::MediaQueryData::addExpression): Use CSSParserTokenRange.
421         (WebCore::MediaQueryData::lastExpressionValid): New helper function.
422         (WebCore::MediaQueryData::removeLastExpression): New helper function.
423         * css/parser/MediaQueryParser.h:
424
425 2018-01-22  Zan Dobersek  <zdobersek@igalia.com>
426
427         [Cairo] Refactor PlatformContextCairo::drawSurfaceToContext() into a Cairo operation
428         https://bugs.webkit.org/show_bug.cgi?id=181930
429
430         Reviewed by Carlos Garcia Campos.
431
432         Move the PlatformContextCairo::drawSurfaceToContext() code into the
433         Cairo namespace as an operation, renaming it to drawSurface(). Mirroring
434         other operations, the PlatformContextCairo object is now passed through
435         a reference as the first argument to the function, and cairo_t context
436         object is retrieved from that.
437
438         Call sites of the PlatformContextCairo::drawSurfaceToContext() method
439         are adjusted to now call Cairo::drawSurface() and properly pass the
440         PlatformContextCairo object to the function.
441
442         No new tests -- no change in functionality.
443
444         * platform/graphics/cairo/CairoOperations.cpp:
445         (WebCore::Cairo::prepareForStroking): Make this static.
446         (WebCore::Cairo::drawPatternToCairoContext):
447         (WebCore::Cairo::drawNativeImage):
448         (WebCore::Cairo::drawSurface):
449         * platform/graphics/cairo/CairoOperations.h:
450         * platform/graphics/cairo/PlatformContextCairo.cpp:
451         (WebCore::drawPatternToCairoContext): Deleted.
452         (WebCore::PlatformContextCairo::drawSurfaceToContext): Deleted.
453         * platform/graphics/cairo/PlatformContextCairo.h:
454         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
455         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
456
457 2018-01-22  Manuel Rego Casasnovas  <rego@igalia.com>
458
459         [css-grid] Spanning Grid item has too much space at the bottom / is too high
460         https://bugs.webkit.org/show_bug.cgi?id=181677
461
462         Reviewed by Javier Fernandez.
463
464         In IndefiniteSizeStrategy::findUsedFlexFraction() we were not
465         subtracting the size of the gutters when we call findFrUnitSize().
466         If an item spans several tracks, we cannot pass the maxContentForChild()
467         directly, we need to subtract the gutters as they are treated
468         as fixed size tracks in the algorithm.
469
470         The spec text is pretty clear regarding this
471         (https://drafts.csswg.org/css-grid/#algo-find-fr-size):
472         "Let leftover space be the space to fill minus the base sizes
473          of the non-flexible grid tracks."
474
475         Gutters are treated as fixed-size tracks for the purpose
476         of the track sizing algorithm, so we need to subtract them from the
477         leftover space while finding the size of an "fr".
478
479         Tests: imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-find-fr-size-gutters-001.html
480                imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-find-fr-size-gutters-002.html
481
482         * rendering/GridTrackSizingAlgorithm.cpp:
483         (WebCore::GridTrackSizingAlgorithm::findFrUnitSize const):
484         (WebCore::IndefiniteSizeStrategy::findUsedFlexFraction const):
485
486 2018-01-21  Ryosuke Niwa  <rniwa@webkit.org>
487
488         Turning off custom pasteboard data doesn't actually turn it off in WK2
489         https://bugs.webkit.org/show_bug.cgi?id=181920
490         <rdar://problem/36686429>
491
492         Reviewed by Wenson Hsieh.
493
494         Replaced the global settings for custom pasteboard data by regular runtime enabled flags.
495
496         * dom/DataTransfer.cpp:
497         (WebCore::DataTransfer::getDataForItem const):
498         (WebCore::DataTransfer::shouldSuppressGetAndSetDataToAvoidExposingFilePaths const):
499         (WebCore::DataTransfer::setDataFromItemList):
500         (WebCore::DataTransfer::types const):
501         (WebCore::DataTransfer::commitToPasteboard):
502         * dom/DataTransferItemList.cpp:
503         (WebCore::shouldExposeTypeInItemList):
504         * editing/Editor.cpp:
505         (WebCore::createDataTransferForClipboardEvent):
506         * editing/cocoa/WebContentReaderCocoa.mm:
507         (WebCore::createFragmentAndAddResources):
508         (WebCore::WebContentReader::readWebArchive):
509         * page/DeprecatedGlobalSettings.cpp:
510         (WebCore::DeprecatedGlobalSettings::defaultCustomPasteboardDataEnabled): Deleted.
511         * page/DeprecatedGlobalSettings.h:
512         (WebCore::DeprecatedGlobalSettings::setCustomPasteboardDataEnabled): Deleted.
513         (WebCore::DeprecatedGlobalSettings::customPasteboardDataEnabled): Deleted.
514         * page/RuntimeEnabledFeatures.h:
515         (WebCore::RuntimeEnabledFeatures::setCustomPasteboardDataEnabled):
516         (WebCore::RuntimeEnabledFeatures::customPasteboardDataEnabled const):
517         * testing/InternalSettings.cpp:
518         (WebCore::InternalSettings::Backup::Backup):
519         (WebCore::InternalSettings::Backup::restoreTo):
520         (WebCore::InternalSettings::setCustomPasteboardDataEnabled):
521
522 2018-01-21  Wenson Hsieh  <wenson_hsieh@apple.com>
523
524         Add a new feature flag for EXTRA_ZOOM_MODE and reintroduce AdditionalFeatureDefines.h
525         https://bugs.webkit.org/show_bug.cgi?id=181918
526
527         Reviewed by Tim Horton.
528
529         Add EXTRA_ZOOM_MODE to FeatureDefines.xconfig (off by default). No change in behavior.
530
531         * Configurations/FeatureDefines.xcconfig:
532
533 2018-01-19  Ryosuke Niwa  <rniwa@webkit.org>
534
535         Release assertion in canExecuteScript when executing scripts during page cache restore
536         https://bugs.webkit.org/show_bug.cgi?id=181902
537
538         Reviewed by Antti Koivisto.
539
540         The crash was caused by an erroneous instantiation of ScriptDisallowedScope::InMainThread in CachedPage::restore.
541         It can execute arbitrary scripts since CachedFrame::open can update style, layout, and evaluate media queries.
542
543         This is fine because there is no way to put this page back into a page cache until the load is commited via
544         FrameLoader::commitProvisionalLoad is invoked later which only happens after CachedPage::restore had exited.
545
546         Also added a release assert to make sure this condition holds.
547
548         Tests: fast/history/page-cache-execute-script-during-restore.html
549                fast/history/page-cache-navigate-during-restore.html
550
551         * history/CachedPage.cpp:
552         (WebCore::CachedPageRestorationScope::CachedPageRestorationScope): Added.
553         (WebCore::CachedPageRestorationScope::~CachedPageRestorationScope): Added.
554         (WebCore::CachedPage::restore): Don't instantiate ScriptDisallowedScope::InMainThread. Set isRestoringCachedPage
555         on the cached pate to release-assert that there won't be any attempt to put this very page back into the cache.
556         * history/PageCache.cpp:
557         (WebCore::canCachePage): Added a release assert to make sure the page which is in the process of being restored
558         from the page cache is not put into the page cache.
559         * page/Page.h:
560         (WebCore::Page::setIsRestoringCachedPage): Added.
561         (WebCore::Page::isRestoringCachedPage const): Added.
562
563 2018-01-21  Eric Carlson  <eric.carlson@apple.com>
564
565         Resign NowPlaying status when no media element is eligible
566         https://bugs.webkit.org/show_bug.cgi?id=181914
567         <rdar://problem/35294116>
568
569         Reviewed by Jer Noble.
570
571         Updated API test.
572
573         * html/HTMLMediaElement.cpp:
574         (WebCore::HTMLMediaElement::removedFromAncestor): Call mediaSession->clientCharacteristicsChanged
575         so NowPlaying status will be updated.
576
577         * html/MediaElementSession.cpp:
578         (WebCore::MediaElementSession::canShowControlsManager const): Return false when being queried
579         for NowPlaying status in an inactive document.
580
581         * platform/audio/PlatformMediaSessionManager.cpp:
582         (WebCore::PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary): Implement in for all
583         ports.
584         * platform/audio/PlatformMediaSessionManager.h:
585         (WebCore::PlatformMediaSessionManager::registeredAsNowPlayingApplication const):
586         * platform/audio/ios/MediaSessionManagerIOS.h:
587         * platform/audio/mac/MediaSessionManagerMac.h:
588         * platform/audio/mac/MediaSessionManagerMac.mm:
589         (WebCore::MediaSessionManagerMac::updateNowPlayingInfo): Call MRMediaRemoteSetCanBeNowPlayingApplication
590         whenever status changes.
591         (WebCore::PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary): Deleted, implemented
592         in the base class.
593
594 2018-01-21  Jer Noble  <jer.noble@apple.com>
595
596         REGRESSION (macOS 10.13.2): imported/w3c/web-platform-tests/media-source/mediasource-* LayoutTests failing
597         https://bugs.webkit.org/show_bug.cgi?id=181891
598
599         Reviewed by Eric Carlson.
600
601         In macOS 10.13.2, CoreMedia changed the definition of CMSampleBufferGetDuration() to return
602         the presentation duration rather than the decode duration. For media streams where those two
603         durations are identical (or at least, closely similar), this isn't a problem. But the media
604         file used in the WPT tests have an unusual frame cadence: decode durations go {3000, 1, 5999,
605         1, 5999,...} and presentation durations go {3000, 2999, 3000, 2999}. This caused one check in
606         the "Coded Frame Processing" algorithm to begin failing, where it checks that the delta
607         between the last sample's decode time and the new decode time is no more than 2x as far as
608         the last sample's duration. That's not a problem as long as the "duration" is the "decode
609         duration" and the samples are all adjacent. Once the "duration" is "presentation duration",
610         all the assumptions in the algorithm are invalidated. In the WPT test case, the delta between
611         decode times is 5999, and 2 * the presentation duration is 5998, causing all samples up to
612         the next sync sample to be dropped.
613
614         To work around this change in behavior, we'll adopt the same technique used by Mozilla's MSE
615         implementation, which was done for similar reasons. Rather than track the "last frame duration",
616         we'll record the "greatest frame duration", and use actual decode timestamps to derive this
617         duration. The "greatest frame duration" field will be reset at the same times as "last frame
618         duration", and will be used only in the part of the algorithm that checks for large decode
619         timestamp gaps.
620
621         * Modules/mediasource/SourceBuffer.cpp:
622         (WebCore::SourceBuffer::TrackBuffer::TrackBuffer):
623         (WebCore::SourceBuffer::resetParserState):
624         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
625
626 2018-01-21  Andy Estes  <aestes@apple.com>
627
628         [ios] LayoutTest imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html is crashing in JSC::JSONParse
629         https://bugs.webkit.org/show_bug.cgi?id=177832
630         <rdar://problem/34805315>
631
632         Reviewed by Tim Horton.
633
634         Test: http/tests/paymentrequest/rejects_if_not_active.https.html
635
636         * Modules/paymentrequest/PaymentRequest.cpp:
637         (WebCore::PaymentRequest::show): Rejected promise if the document is not active.
638
639 2018-01-20  Brady Eidson  <beidson@apple.com>
640
641         Make garbage collection of MessagePort objects be asynchronous.
642         https://bugs.webkit.org/show_bug.cgi?id=181910
643
644         Reviewed by Andy Estes.
645
646         No new tests (Covered by existing tests, including GC-specific ones).
647
648         The basic premise here is as follows:
649         - You can *always* GC a MessagePort that is closed
650         - You can *always* GC a MessagePort that has no onmessage handler, as incoming messages cannot 
651           possibly revive it.
652         - You can GC a MessagePort, even if it has a message handler, as long as there are no messages 
653           in flight between it and the remote port, and as long as the remote port is "maybe eligible for GC."
654           
655         A MessagePort is considered "maybe eligible for GC" once hasPendingActivity is asked once.
656         
657         A MessagePort loses "maybe eligible for GC" status once it is used for sending or receiving a message.
658         
659         The changes to MessagePort.cpp implement the above with a tiny little bool-driven state machine.
660         * dom/MessagePort.cpp:
661         (WebCore::MessagePort::postMessage):
662         (WebCore::MessagePort::disentangle):
663         (WebCore::MessagePort::registerLocalActivity):
664         (WebCore::MessagePort::start):
665         (WebCore::MessagePort::close):
666         (WebCore::MessagePort::contextDestroyed):
667         (WebCore::MessagePort::dispatchMessages):
668         (WebCore::MessagePort::hasPendingActivity const):
669         (WebCore::MessagePort::isLocallyReachable const):
670         (WebCore::MessagePort::addEventListener):
671         (WebCore::MessagePort::removeEventListener):
672         * dom/MessagePort.h:
673
674         - Remove the lock and any background-thread code paths
675         - Add ASSERT(isMainThread())s throughout
676         * dom/messageports/MessagePortChannel.cpp:
677         (WebCore::MessagePortChannel::MessagePortChannel):
678         (WebCore::MessagePortChannel::includesPort):
679         (WebCore::MessagePortChannel::entanglePortWithProcess):
680         (WebCore::MessagePortChannel::disentanglePort):
681         (WebCore::MessagePortChannel::closePort):
682         (WebCore::MessagePortChannel::postMessageToRemote):
683         (WebCore::MessagePortChannel::takeAllMessagesForPort):
684         (WebCore::MessagePortChannel::checkRemotePortForActivity):
685         (WebCore::MessagePortChannel::hasAnyMessagesPendingOrInFlight const):
686         * dom/messageports/MessagePortChannel.h:
687         
688         Add a callback for a MessagePortChannel to go ask the remote MessagePort object about local activity:
689         * dom/messageports/MessagePortChannelProvider.h:
690         * dom/messageports/MessagePortChannelProviderImpl.cpp:
691         (WebCore::MessagePortChannelProviderImpl::checkRemotePortForActivity):
692         (WebCore::MessagePortChannelProviderImpl::checkProcessLocalPortForActivity):
693         (WebCore::MessagePortChannelProviderImpl::hasMessagesForPorts_temporarySync): Deleted.
694         * dom/messageports/MessagePortChannelProviderImpl.h:
695         
696         - Remove the lock and any background-thread code paths
697         - Add ASSERT(isMainThread())s throughout
698         * dom/messageports/MessagePortChannelRegistry.cpp:
699         (WebCore::MessagePortChannelRegistry::messagePortChannelCreated):
700         (WebCore::MessagePortChannelRegistry::messagePortChannelDestroyed):
701         (WebCore::MessagePortChannelRegistry::didEntangleLocalToRemote):
702         (WebCore::MessagePortChannelRegistry::didDisentangleMessagePort):
703         (WebCore::MessagePortChannelRegistry::didCloseMessagePort):
704         (WebCore::MessagePortChannelRegistry::didPostMessageToRemote):
705         (WebCore::MessagePortChannelRegistry::takeAllMessagesForPort):
706         (WebCore::MessagePortChannelRegistry::checkRemotePortForActivity):
707         (WebCore::MessagePortChannelRegistry::existingChannelContainingPort):
708         (WebCore::MessagePortChannelRegistry::hasMessagesForPorts_temporarySync): Deleted.
709         * dom/messageports/MessagePortChannelRegistry.h:
710
711 2018-01-20  Andy Estes  <aestes@apple.com>
712
713         [Apple Pay] Stop eagerly loading PassKit.framework
714         https://bugs.webkit.org/show_bug.cgi?id=181911
715         <rdar://problem/36555369>
716
717         Reviewed by Tim Horton.
718
719         r226458 and r226123 added code that caused PassKit.framework to be eagerly loaded when
720         initializing a WKWebView. This is costly and should only be done when Apple Pay is first used.
721
722         To avoid eagerly loading PassKit, this patch does two things:
723
724         1. Instead of sending the available payment networks as part of WebPageCreationParameters,
725         PaymentCoordinator asks for them using a syncrhonous message the first time they are needed.
726         2. Instead of setting the Apple Pay preference to false when PassKit can't be loaded,
727         the following API entry points check for a missing PassKit and return false, or throw
728         exceptions, or reject promises:
729             - ApplePaySession.canMakePayments()
730             - ApplePaySession.canMakePaymentsWithActiveCard()
731             - ApplePaySession.openPaymentSetup()
732             - ApplePaySession.begin()
733
734         No new tests for (1), which causes no change in behavior. (2) was manually verified by
735         locally moving aside PassKit.framework, but that's not possible to do in an automated test.
736
737         * Modules/applepay/PaymentCoordinator.cpp:
738         (WebCore::PaymentCoordinator::PaymentCoordinator):
739         (WebCore::PaymentCoordinator::validatedPaymentNetwork const):
740         (WebCore::toHashSet): Deleted.
741         * Modules/applepay/PaymentCoordinator.h:
742         * Modules/applepay/PaymentCoordinatorClient.h:
743         * loader/EmptyClients.cpp:
744         * page/MainFrame.cpp:
745         (WebCore::MainFrame::MainFrame):
746
747         Removed PaymentCoordinator::m_availablePaymentNetworks and made
748         PaymentCoordinator::validatedPaymentNetwork() call
749         PaymentCoordinatorClient::validatedPaymentNetwork() instead.
750
751         * page/PageConfiguration.h:
752
753         Removed availablePaymentNetworks from PageConfiguration.
754
755         * testing/Internals.cpp:
756         (WebCore::Internals::Internals):
757         * testing/MockPaymentCoordinator.cpp:
758         (WebCore::MockPaymentCoordinator::validatedPaymentNetwork):
759         * testing/MockPaymentCoordinator.h:
760
761         Implemented PaymentCoordinatorClient::validatedPaymentNetwork().
762
763 2018-01-20  Jer Noble  <jer.noble@apple.com>
764
765         Release ASSERT when reloading Vimeo page @ WebCore: WebCore::Document::updateLayout
766         https://bugs.webkit.org/show_bug.cgi?id=181840
767         <rdar://problem/36186214>
768
769         Reviewed by Simon Fraser.
770
771         Test: media/video-fullscreen-reload-crash.html
772
773         Short circuit play() or pause() operations if the document is suspended or stopped.
774
775         * html/HTMLMediaElement.cpp:
776         (WebCore::HTMLMediaElement::playInternal):
777         (WebCore::HTMLMediaElement::pauseInternal):
778
779 2018-01-20  Youenn Fablet  <youenn@apple.com>
780
781         fetch redirect is incompatible with "no-cors" mode
782         https://bugs.webkit.org/show_bug.cgi?id=181866
783         <rdar://problem/35827140>
784
785         Reviewed by Chris Dumez.
786
787         Covered by updated tests.
788
789         Return a network error when no-cors mode and redirect mode is manual or error.
790         Update preflight implementation to no longer use manual redirect mode to simulate https://fetch.spec.whatwg.org/#http-network-or-cache-fetch.
791         Instead implement redirectReceived callback to treat any redirect response as the preflight response.
792
793         * loader/cache/CachedResourceLoader.cpp:
794         (WebCore::CachedResourceLoader::canRequest):
795         * loader/CrossOriginPreflightChecker.cpp:
796         (WebCore::CrossOriginPreflightChecker::redirectReceived):
797         (WebCore::CrossOriginPreflightChecker::startPreflight):
798         * loader/CrossOriginPreflightChecker.h:
799
800 2018-01-19  Wenson Hsieh  <wenson_hsieh@apple.com>
801
802         [macOS] [WK2] Drag location is computed incorrectly when dragging content from subframes
803         https://bugs.webkit.org/show_bug.cgi?id=181896
804         <rdar://problem/35479043>
805
806         Reviewed by Tim Horton.
807
808         In r218837, I packaged most of the information needed to start a drag into DragItem, which is propagated to the client layer
809         via the startDrag codepath. However, this introduced a bug in computing the event position and drag location in window
810         coordinates. Consider the case where we're determining the drag image offset for a dragged element in a subframe:
811
812         Before the patch, the drag location (which starts out in the subframe's content coordinates) would be converted to root view
813         coordinates, which would then be converted to mainframe content coordinates, which would then be converted to window coordinates
814         using the mainframe's view. After the patch, we carry out the same math until the last step, where we erroneously use the
815         _subframe's_ view to convert to window coordinates from content coordinates. This results in the position of the iframe relative
816         to the mainframe being accounted for twice.
817
818         To fix this, we simply use the main frame's view to convert from mainframe content coordinates to window coordinates while
819         computing the drag location. As for the event position in window coordinates, this is currently unused by any codepath in WebKit,
820         so we can just remove it altogether.
821
822         Since this bug only affects drag and drop in the macOS WebKit2 port, there's currently no way to test this. I'll be using
823         <https://bugs.webkit.org/show_bug.cgi?id=181898> to track adding test support for drag and drop on macOS WebKit2. Manually tested
824         dragging in both WebKit1 and WebKit2 on macOS. dragLocationInWindowCoordinates isn't used at all for iOS drag and drop.
825
826         * page/DragController.cpp:
827         (WebCore::DragController::doSystemDrag):
828         * platform/DragItem.h:
829         (WebCore::DragItem::encode const):
830         (WebCore::DragItem::decode):
831
832 2018-01-19  Ryan Haddad  <ryanhaddad@apple.com>
833
834         Unreviewed, rolling out r227235.
835
836         The test for this change consistently times out on High
837         Sierra.
838
839         Reverted changeset:
840
841         "Support for preconnect Link headers"
842         https://bugs.webkit.org/show_bug.cgi?id=181657
843         https://trac.webkit.org/changeset/227235
844
845 2018-01-19  Youenn Fablet  <youenn@apple.com>
846
847         Cache storage errors like Quota should trigger console messages
848         https://bugs.webkit.org/show_bug.cgi?id=181879
849         <rdar://problem/36669048>
850
851         Reviewed by Chris Dumez.
852
853         Covered by rebased test.
854
855         * Modules/cache/DOMCache.cpp:
856         (WebCore::DOMCache::retrieveRecords):
857         (WebCore::DOMCache::batchDeleteOperation):
858         (WebCore::DOMCache::batchPutOperation):
859         * Modules/cache/DOMCacheEngine.cpp:
860         (WebCore::DOMCacheEngine::errorToException):
861         (WebCore::DOMCacheEngine::logErrorAndConvertToException):
862         * Modules/cache/DOMCacheEngine.h:
863         * Modules/cache/DOMCacheStorage.cpp:
864         (WebCore::DOMCacheStorage::retrieveCaches):
865         (WebCore::DOMCacheStorage::doOpen):
866         (WebCore::DOMCacheStorage::doRemove):
867
868 2018-01-19  Youenn Fablet  <youenn@apple.com>
869
870         Do not go to the storage process when registering a service worker client if there is no service worker registered
871         https://bugs.webkit.org/show_bug.cgi?id=181740
872         <rdar://problem/36650400>
873
874         Reviewed by Chris Dumez.
875
876         Register a document as service worker client only if there is an existing service worker connection.
877         This allows not creating any connection if no service worker is registered.
878
879         Add internals API to test whether a service worker connection was created or not.
880         This is used by API tests that cover the changes.
881
882         * dom/Document.cpp:
883         (WebCore::Document::privateBrowsingStateDidChange): No need to create a service worker connection if client is not registered yet.
884         (WebCore::Document::setServiceWorkerConnection): No need to unregister/register if service worker connection is the same.
885         Similarly, if Document is to be destroyed or suspended, we should not register it.
886         * loader/DocumentLoader.cpp:
887         (WebCore::DocumentLoader::commitData):
888         * testing/Internals.cpp:
889         (WebCore::Internals::hasServiceWorkerConnection):
890         * testing/Internals.h:
891         * testing/Internals.idl:
892         * workers/service/ServiceWorkerProvider.cpp:
893         (WebCore::ServiceWorkerProvider::registerServiceWorkerClients):
894         * workers/service/ServiceWorkerProvider.h:
895
896 2018-01-19  Dean Jackson  <dino@apple.com>
897
898         REGRESSION (r221092): Swipe actions are hard to perform in FastMail app
899         https://bugs.webkit.org/show_bug.cgi?id=181817
900         <rdar://problem/35274055>
901
902         Add a setting for controlling whether touch listeners are passive
903         by default on document/window/body.
904
905         Updated existing test.
906
907         * dom/EventTarget.cpp:
908         (WebCore::EventTarget::addEventListener):
909         * page/Settings.yaml:
910
911 2018-01-19  Daniel Bates  <dabates@apple.com>
912
913         Update frame-ancestor directive to match Content Security Policy Level 3
914         https://bugs.webkit.org/show_bug.cgi?id=178891
915         <rdar://problem/35209458>
916
917         Reviewed by Alex Christensen.
918
919         Derived from Blink e667cc2e501fabab3605b838e4ee0d642a9c4a59:
920         <https://chromium.googlesource.com/chromium/src.git/+/e667cc2e501fabab3605b838e4ee0d642a9c4a59>
921
922         Update frame-ancestor directive to match against the origin of the ancestor document per the
923         Content Security Policy Level 3 spec.: <https://w3c.github.io/webappsec-csp/> (15 January 2018).
924         Specifically this change in behavior was made to CSP 3 in <https://github.com/w3c/webappsec/issues/311>.
925         In earlier versions of the spec, the frame-ancestor directive matched against the URL of the
926         ancestor document.
927
928         Disregarding allow-same-origin sandboxed iframes, a document with policy "frame-ancestor 'self'"
929         will be blocked from loading in a sandboxed iframe as a result of this change.
930
931         Tests: http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-allow-same-origin-sandboxed-cross-url-allow.html
932                http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-sandboxed-cross-url-block.html
933
934         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
935         (WebCore::checkFrameAncestors):
936
937 2018-01-19  Basuke Suzuki  <Basuke.Suzuki@sony.com>
938
939         [Curl] Add timeout support to XMLHttpRequest
940         https://bugs.webkit.org/show_bug.cgi?id=181876
941
942         Reviewed by Alex Christensen 
943
944         * platform/network/ResourceRequestBase.cpp:
945         * platform/network/curl/CurlContext.cpp:
946         (WebCore::CurlHandle::setTimeout):
947         * platform/network/curl/CurlContext.h:
948         * platform/network/curl/CurlRequest.cpp:
949         (WebCore::CurlRequest::setupTransfer):
950         (WebCore::CurlRequest::didCompleteTransfer):
951         * platform/network/curl/ResourceError.h:
952         * platform/network/curl/ResourceErrorCurl.cpp:
953         (WebCore::ResourceError::httpError):
954
955 2018-01-19  Yoav Weiss  <yoav@yoav.ws>
956
957         Support for preconnect Link headers
958         https://bugs.webkit.org/show_bug.cgi?id=181657
959
960         Reviewed by Darin Adler.
961
962         Move the preconnect functionality into its own function, and
963         also call this function when Link headers are processed.
964
965         Test: http/tests/preconnect/link-header-rel-preconnect-http.php
966
967         * loader/LinkLoader.cpp:
968         (WebCore::LinkLoader::loadLinksFromHeader): Call preconnectIfNeeded.
969         (WebCore::LinkLoader::preconnectIfNeeded): Preconnect to a host functionality moved here.
970         (WebCore::LinkLoader::loadLink): Call preconnectIfNeeded.
971         * loader/LinkLoader.h:
972
973 2018-01-19  Joseph Pecoraro  <pecoraro@apple.com>
974
975         AppCache: Log a Deprecation warning to the Console when AppCache is used
976         https://bugs.webkit.org/show_bug.cgi?id=181778
977
978         Reviewed by Alex Christensen.
979
980         * html/HTMLHtmlElement.cpp:
981         (WebCore::HTMLHtmlElement::insertedByParser):
982
983 2018-01-19  Chris Dumez  <cdumez@apple.com>
984
985         ASSERT(registration || isTerminating()) hit in SWServerWorker::skipWaiting()
986         https://bugs.webkit.org/show_bug.cgi?id=181761
987         <rdar://problem/36594564>
988
989         Reviewed by Youenn Fablet.
990
991         There is a short period of time, early in the registration process where a
992         SWServerWorker object exists for a registration but is not in the registration's
993         installing/waiting/active slots yet. As a result, if a registration is cleared
994         during this period (for e.g. due to the user clearing all website data), that
995         SWServerWorker will not be terminated. We then hit assertion later on when this
996         worker is trying to do things (like call skipWaiting).
997
998         To address the issue, we now keep a reference this SWServerWorker on the
999         registration, via a new SWServerRegistration::m_preInstallationWorker data member.
1000         When the registration is cleared, we now take care of terminating this worker.
1001
1002         No new tests, covered by existing tests that crash flakily in debug builds.
1003
1004         * workers/WorkerThread.cpp:
1005         (WebCore::WorkerThread::stop):
1006         if the mutex is locked, then the worker thread is still starting. We spin the
1007         runloop and try to stop again later. This avoids the deadlock shown in
1008         Bug 181763 as the worker thread may need to interact with the main thread
1009         during startup.
1010
1011         * workers/service/server/SWServer.cpp:
1012         (WebCore::SWServer::installContextData):
1013         * workers/service/server/SWServerJobQueue.cpp:
1014         (WebCore::SWServerJobQueue::scriptContextFailedToStart):
1015         (WebCore::SWServerJobQueue::install):
1016         * workers/service/server/SWServerRegistration.cpp:
1017         (WebCore::SWServerRegistration::~SWServerRegistration):
1018         (WebCore::SWServerRegistration::setPreInstallationWorker):
1019         (WebCore::SWServerRegistration::clear):
1020         * workers/service/server/SWServerRegistration.h:
1021         (WebCore::SWServerRegistration::preInstallationWorker const):
1022
1023 2018-01-19  Chris Dumez  <cdumez@apple.com>
1024
1025         Service worker registrations restored from disk may not be reused when the JS calls register() again
1026         https://bugs.webkit.org/show_bug.cgi?id=181810
1027         <rdar://problem/36591711>
1028
1029         Reviewed by Youenn Fablet.
1030
1031         The issue was that when restoring a registration from disk, we would not set its active worker right
1032         away. We only set it later in installContextData(). installContextData() is only called after we’ve
1033         launched the service worker process and established a connection to it.
1034
1035         However, we would start processing jobs (such as registrations) before we’ve established the connection
1036         to the service worker process. SWServerJobQueue::runRegisterJob(), in order to reuse an existing
1037         registration checks the registration’s active worker has the right script URL. The issue was that when
1038         this code would execute, we may not have set the registration’s active service worker yet, in which case,
1039         we would update the existing registration instead of reusing it as-is.
1040
1041         To address the issue, we now delay the processing of jobs until the connection to the service worker
1042         process has been established and we've installed all pending contexts via installContextData().
1043
1044         Changed is covered by new API test.
1045
1046         * workers/service/server/SWServer.cpp:
1047         (WebCore::SWServer::Connection::scheduleJobInServer):
1048         (WebCore::SWServer::scheduleJob):
1049         (WebCore::SWServer::serverToContextConnectionCreated):
1050         * workers/service/server/SWServer.h:
1051
1052 2018-01-19  James Craig  <jcraig@apple.com>
1053
1054         AX: when invert colors is on, double-invert image and picture elements in UserAgentStyleSheet
1055         https://bugs.webkit.org/show_bug.cgi?id=181281
1056         <rdar://problem/36291776>
1057
1058         Reviewed by Simon Fraser.
1059
1060         Updated "Smart Invert" to include img and picture element inversion and tests.
1061
1062         Tests: accessibility/smart-invert-reference.html
1063                accessibility/smart-invert.html
1064
1065         * css/html.css:
1066         (@media (inverted-colors)):
1067         (img:not(picture>img), picture, video):
1068
1069 2018-01-19  Chris Dumez  <cdumez@apple.com>
1070
1071         The WebContent process should not process incoming IPC while waiting for a sync IPC reply
1072         https://bugs.webkit.org/show_bug.cgi?id=181560
1073
1074         Reviewed by Ryosuke Niwa.
1075
1076         Add internals API for testing purposes.
1077
1078         Test: fast/misc/testIncomingSyncIPCMessageWhileWaitingForSyncReply.html
1079
1080         * page/ChromeClient.h:
1081         * testing/Internals.cpp:
1082         (WebCore::Internals::testIncomingSyncIPCMessageWhileWaitingForSyncReply):
1083         * testing/Internals.h:
1084         * testing/Internals.idl:
1085
1086 2018-01-19  Keith Miller  <keith_miller@apple.com>
1087
1088         HaveInternalSDK includes should be "#include?"
1089         https://bugs.webkit.org/show_bug.cgi?id=179670
1090
1091         Reviewed by Dan Bernstein.
1092
1093         * Configurations/Base.xcconfig:
1094
1095 2018-01-19  Daniel Bates  <dabates@apple.com>
1096
1097         Fix misspelling; substitute willDetachRenderer for willDetatchRenderer.
1098
1099         * html/HTMLPlugInImageElement.cpp:
1100         (WebCore::HTMLPlugInImageElement::willDetachRenderers):
1101         * plugins/PluginViewBase.h:
1102         (WebCore::PluginViewBase::willDetachRenderer):
1103         (WebCore::PluginViewBase::willDetatchRenderer): Deleted.
1104
1105 2018-01-19  Jonathan Bedard  <jbedard@apple.com>
1106
1107         Unreviewed build fix, remove unused lambda captures.
1108
1109         * dom/messageports/MessagePortChannel.cpp:
1110         (WebCore::MessagePortChannel::takeAllMessagesForPort):
1111         * dom/messageports/MessagePortChannelRegistry.cpp:
1112         (WebCore::MessagePortChannelRegistry::messagePortChannelCreated):
1113
1114 2018-01-19  Antoine Quint  <graouts@apple.com>
1115
1116         [Web Animations] Expose timing properties (delay, endDelay, fill, iterationStart, iterations, direction) and getComputedTiming()
1117         https://bugs.webkit.org/show_bug.cgi?id=181857
1118         <rdar://problem/36660081>
1119
1120         Reviewed by Dean Jackson.
1121
1122         We start the work to implement the rest of the Web Animations timing and animation model by exposing more properties on
1123         AnimationEffectTiming to control delay (delay, endDelay), looping (iterationStart, iterations), fill and direction.
1124         Additionally, we expose the getComputedTiming() method on AnimationEffect, although it currently lacks some computed
1125         properties that will come in later patch as we implement various processes defined by the spec. We also update the
1126         existing duration() method on AnimationEffectTiming to be called iterationDuration() to match the terms used in the
1127         specification.
1128
1129         Finally, we make all new properties, and update existing ones, that expose a time value go through the new utility
1130         function secondsToWebAnimationsAPITime() to guarantee rounded values with microseconds precision, as advised by
1131         the Web Animations specification.
1132
1133         * CMakeLists.txt:
1134         * DerivedSources.make:
1135         * Sources.txt:
1136         * WebCore.xcodeproj/project.pbxproj:
1137         * animation/AnimationEffect.cpp:
1138         (WebCore::AnimationEffect::localTime const):
1139         (WebCore::AnimationEffect::getComputedTiming):
1140         * animation/AnimationEffect.h:
1141         * animation/AnimationEffect.idl:
1142         * animation/AnimationEffectTiming.cpp:
1143         (WebCore::AnimationEffectTiming::AnimationEffectTiming):
1144         (WebCore::AnimationEffectTiming::setIterationStart):
1145         (WebCore::AnimationEffectTiming::setIterations):
1146         (WebCore::AnimationEffectTiming::bindingsDuration const):
1147         (WebCore::AnimationEffectTiming::setBindingsDuration):
1148         (WebCore::AnimationEffectTiming::endTime const):
1149         (WebCore::AnimationEffectTiming::activeDuration const):
1150         * animation/AnimationEffectTiming.h:
1151         * animation/AnimationEffectTiming.idl:
1152         * animation/AnimationPlaybackEvent.cpp:
1153         (WebCore::AnimationPlaybackEvent::bindingsCurrentTime const):
1154         (WebCore::AnimationPlaybackEvent::bindingsTimelineTime const):
1155         * animation/AnimationTimeline.cpp:
1156         (WebCore::AnimationTimeline::bindingsCurrentTime):
1157         * animation/ComputedTimingProperties.h: Added.
1158         * animation/ComputedTimingProperties.idl: Added. We set nullable double values to a default value of "null" since
1159         otherwise setting those properties to a null value would not set the properties in the converted JS dictionary.
1160         * animation/KeyframeEffect.cpp:
1161         (WebCore::KeyframeEffect::create): Handle new timing properties passed in the KeyframeEffectOptions dictionary.
1162         (WebCore::KeyframeEffect::applyAtLocalTime):
1163         (WebCore::KeyframeEffect::getAnimatedStyle):
1164         (WebCore::KeyframeEffect::startOrStopAccelerated):
1165         * animation/WebAnimation.cpp:
1166         (WebCore::WebAnimation::bindingsStartTime const):
1167         (WebCore::WebAnimation::bindingsCurrentTime const):
1168         (WebCore::WebAnimation::effectEndTime const):
1169         (WebCore::WebAnimation::timeToNextRequiredTick const):
1170         * animation/WebAnimationUtilities.h: Added.
1171         (WebCore::secondsToWebAnimationsAPITime):
1172
1173 2018-01-19  Alex Christensen  <achristensen@webkit.org>
1174
1175         Remove dead networking code
1176         https://bugs.webkit.org/show_bug.cgi?id=181813
1177
1178         Reviewed by Tim Horton.
1179
1180         CFURLConnection is only used on Windows.
1181
1182         * platform/network/cf/ResourceError.h:
1183         * platform/network/cf/ResourceRequest.h:
1184         (WebCore::ResourceRequest::encodingRequiresPlatformData const):
1185         * platform/network/cf/ResourceRequestCFNet.cpp:
1186         (WebCore::findCFURLRequestCopyContentDispositionEncodingFallbackArrayFunction):
1187         (WebCore::ResourceRequest::doUpdatePlatformRequest):
1188         (WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
1189         (WebCore::ResourceRequest::doUpdateResourceRequest):
1190         (WebCore::ResourceRequest::setStorageSession):
1191         * platform/network/cf/ResourceResponse.h:
1192         (WebCore::ResourceResponse::ResourceResponse):
1193
1194 2018-01-19  Alex Christensen  <achristensen@webkit.org>
1195
1196         Remove unused WebViewPrivate _allowCookies
1197         https://bugs.webkit.org/show_bug.cgi?id=181812
1198
1199         Reviewed by Tim Horton.
1200
1201         This SPI was in the original iOS upstreaming and has not been used in many years.
1202
1203         * platform/network/ResourceRequestBase.cpp:
1204         (WebCore::ResourceRequestBase::setDefaultAllowCookies): Deleted.
1205         (WebCore::ResourceRequestBase::defaultAllowCookies): Deleted.
1206         * platform/network/ResourceRequestBase.h:
1207         (WebCore::ResourceRequestBase::ResourceRequestBase):
1208
1209 2018-01-18  Brady Eidson  <beidson@apple.com>
1210
1211         Make in-process MessagePorts be (mostly) asynchronous
1212         https://bugs.webkit.org/show_bug.cgi?id=181454
1213
1214         Reviewed by Alex Christensen.
1215
1216         No new tests (Covered *brutally* by existing tests)
1217
1218         Part of making MessagePorts be a thing we can pass across processes is making them work async.
1219         
1220         The existing "MessagePortChannel" method of abstraction was not cut out for this.
1221         This patch gets rid of MessagePortChannel and adds a new MessagePortChannelProvider abstraction.
1222         It then gets the new machinery working in-process (with some pieces of out-of-process in place)
1223
1224         One synchronous behavior this patch maintains is the hasPendingActivity() check used to support GC.
1225         That will (creatively) be made async in the next followup.
1226         
1227         More generally from MessagePorts, this patch also adds a "MessageWithMessagePorts" object to be used
1228         with all forms of postMessage(). Much better.
1229         
1230         * CMakeLists.txt:
1231         * Sources.txt:
1232         * WebCore.xcodeproj/project.pbxproj:
1233
1234         * dom/InProcessMessagePortChannel.cpp: Removed.
1235         * dom/InProcessMessagePortChannel.h: Removed.
1236         * dom/MessagePortChannel.cpp: Removed.
1237         * dom/MessagePortChannel.h: Removed.
1238
1239         * dom/MessageChannel.cpp:
1240         (WebCore::MessageChannel::create):
1241         (WebCore::MessageChannel::MessageChannel):
1242         (WebCore::m_port2): Deleted.
1243         * dom/MessageChannel.h:
1244         (WebCore::MessageChannel::create): Deleted.
1245
1246         * dom/MessagePort.cpp:
1247         (WebCore::MessagePort::create):
1248         (WebCore::MessagePort::MessagePort):
1249         (WebCore::MessagePort::~MessagePort):
1250         (WebCore::MessagePort::entangle):
1251         (WebCore::MessagePort::postMessage):
1252         (WebCore::MessagePort::disentangle):
1253         (WebCore::MessagePort::messageAvailable):
1254         (WebCore::MessagePort::start):
1255         (WebCore::MessagePort::close):
1256         (WebCore::MessagePort::contextDestroyed):
1257         (WebCore::MessagePort::dispatchMessages):
1258         (WebCore::MessagePort::hasPendingActivity const):
1259         (WebCore::MessagePort::locallyEntangledPort const):
1260         (WebCore::MessagePort::disentanglePorts):
1261         (WebCore::MessagePort::entanglePorts):
1262         (WebCore::MessagePort::entangleWithRemote): Deleted.
1263         * dom/MessagePort.h:
1264
1265         * dom/MessagePortIdentifier.h:
1266         (WebCore::MessagePortIdentifier::logString const):
1267
1268         * dom/ScriptExecutionContext.cpp:
1269         (WebCore::ScriptExecutionContext::processMessageWithMessagePortsSoon):
1270         (WebCore::ScriptExecutionContext::dispatchMessagePortEvents):
1271         (WebCore::ScriptExecutionContext::processMessagePortMessagesSoon): Deleted.
1272         * dom/ScriptExecutionContext.h:
1273
1274         Add a single object that represents two intertwined ports, tracks their pending
1275         messages, tracks which process they're in, etc etc:
1276         * dom/messageports/MessagePortChannel.cpp: Added.
1277         (WebCore::MessagePortChannel::create):
1278         (WebCore::MessagePortChannel::MessagePortChannel):
1279         (WebCore::MessagePortChannel::~MessagePortChannel):
1280         (WebCore::MessagePortChannel::includesPort):
1281         (WebCore::MessagePortChannel::entanglePortWithProcess):
1282         (WebCore::MessagePortChannel::disentanglePort):
1283         (WebCore::MessagePortChannel::closePort):
1284         (WebCore::MessagePortChannel::postMessageToRemote):
1285         (WebCore::MessagePortChannel::takeAllMessagesForPort):
1286         (WebCore::MessagePortChannel::hasAnyMessagesPendingOrInFlight const):
1287         * dom/messageports/MessagePortChannel.h: Added.
1288         (WebCore::MessagePortChannel::port1 const):
1289         (WebCore::MessagePortChannel::port2 const):
1290         (WebCore::MessagePortChannel::logString const):
1291
1292         Abstraction for creating and operating on MessagePorts in a potentially cross-process way:
1293         * dom/messageports/MessagePortChannelProvider.cpp: Added.
1294         (WebCore::MessagePortChannelProvider::singleton):
1295         (WebCore::MessagePortChannelProvider::setSharedProvider):
1296         * dom/messageports/MessagePortChannelProvider.h: Added.
1297         (WebCore::MessagePortChannelProvider::~MessagePortChannelProvider):
1298
1299         Adds a concrete implementation of that provider to be used in-process (e.g. WK1):
1300         * dom/messageports/MessagePortChannelProviderImpl.cpp: Added.
1301         (WebCore::MessagePortChannelProviderImpl::~MessagePortChannelProviderImpl):
1302         (WebCore::MessagePortChannelProviderImpl::performActionOnAppropriateThread):
1303         (WebCore::MessagePortChannelProviderImpl::createNewMessagePortChannel):
1304         (WebCore::MessagePortChannelProviderImpl::entangleLocalPortInThisProcessToRemote):
1305         (WebCore::MessagePortChannelProviderImpl::messagePortDisentangled):
1306         (WebCore::MessagePortChannelProviderImpl::messagePortClosed):
1307         (WebCore::MessagePortChannelProviderImpl::postMessageToRemote):
1308         (WebCore::MessagePortChannelProviderImpl::takeAllMessagesForPort):
1309         (WebCore::MessagePortChannelProviderImpl::hasMessagesForPorts_temporarySync):
1310         * dom/messageports/MessagePortChannelProviderImpl.h: Added.
1311
1312         Adds a main thread object to handle the set of all MessagePortChannels that are open.
1313         For now it lives in the WebProcess, but for out-of-process it will live in the UIProcess:
1314         * dom/messageports/MessagePortChannelRegistry.cpp: Added.
1315         (WebCore::MessagePortChannelRegistry::~MessagePortChannelRegistry):
1316         (WebCore::MessagePortChannelRegistry::didCreateMessagePortChannel):
1317         (WebCore::MessagePortChannelRegistry::messagePortChannelCreated):
1318         (WebCore::MessagePortChannelRegistry::messagePortChannelDestroyed):
1319         (WebCore::MessagePortChannelRegistry::didEntangleLocalToRemote):
1320         (WebCore::MessagePortChannelRegistry::didDisentangleMessagePort):
1321         (WebCore::MessagePortChannelRegistry::didCloseMessagePort):
1322         (WebCore::MessagePortChannelRegistry::didPostMessageToRemote):
1323         (WebCore::MessagePortChannelRegistry::takeAllMessagesForPort):
1324         (WebCore::MessagePortChannelRegistry::hasMessagesForPorts_temporarySync): This is named against style
1325           and weird on purpose - to call attention to how bad it is and how it's temporary.
1326         (WebCore::MessagePortChannelRegistry::existingChannelContainingPort):
1327         * dom/messageports/MessagePortChannelRegistry.h: Added.
1328
1329         Add an object that represents a "SerializedScriptValue for the message payload and the ports
1330         that are being transferred along with that payload". This is used in all forms of postMessage():
1331         * dom/messageports/MessageWithMessagePorts.cpp: Added.
1332         * dom/messageports/MessageWithMessagePorts.h: Added.
1333
1334         * page/DOMWindow.cpp:
1335         (WebCore::PostMessageTimer::PostMessageTimer):
1336         (WebCore::PostMessageTimer::event):
1337         (WebCore::DOMWindow::postMessage):
1338
1339         * platform/Logging.h:
1340
1341         * workers/DedicatedWorkerGlobalScope.cpp:
1342         (WebCore::DedicatedWorkerGlobalScope::postMessage):
1343
1344         * workers/Worker.cpp:
1345         (WebCore::Worker::postMessage):
1346
1347         * workers/WorkerGlobalScopeProxy.h:
1348
1349         * workers/WorkerMessagingProxy.cpp:
1350         (WebCore::WorkerMessagingProxy::postMessageToWorkerObject):
1351         (WebCore::WorkerMessagingProxy::postMessageToWorkerGlobalScope):
1352         * workers/WorkerMessagingProxy.h:
1353
1354         * workers/WorkerObjectProxy.h:
1355
1356         * workers/service/ServiceWorker.cpp:
1357         (WebCore::ServiceWorker::postMessage):
1358
1359         * workers/service/ServiceWorkerClient.cpp:
1360         (WebCore::ServiceWorkerClient::postMessage):
1361
1362         * workers/service/context/SWContextManager.cpp:
1363         (WebCore::SWContextManager::postMessageToServiceWorker):
1364
1365         * workers/service/context/ServiceWorkerThread.cpp:
1366         (WebCore::fireMessageEvent):
1367         (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
1368         * workers/service/context/ServiceWorkerThread.h:
1369
1370 2018-01-18  Ryan Haddad  <ryanhaddad@apple.com>
1371
1372         Unreviewed build fix, removed unused lambda capture.
1373
1374         * workers/service/context/SWContextManager.cpp:
1375         (WebCore::SWContextManager::ServiceWorkerTerminationRequest::ServiceWorkerTerminationRequest):
1376
1377 2018-01-18  Chris Dumez  <cdumez@apple.com>
1378
1379         We should be able to terminate service workers that are unresponsive
1380         https://bugs.webkit.org/show_bug.cgi?id=181563
1381         <rdar://problem/35280031>
1382
1383         Reviewed by Alex Christensen.
1384
1385         Test: http/tests/workers/service/postmessage-after-terminating-hung-worker.html
1386
1387         * workers/service/context/SWContextManager.cpp:
1388         (WebCore::SWContextManager::terminateWorker):
1389         Before calling WorkerThread::stop(), set a timer with the given timeout parameter.
1390         If the worker thread has not stopped when the timer fires, forcefully exit the
1391         service worker process. The StorageProcess will take care of relaunching the
1392         service worker process if it exits abruptly.
1393
1394         (WebCore::SWContextManager::serviceWorkerFailedToTerminate):
1395         Log error message if we failed to terminate a service worker and call exit().
1396
1397         (WebCore::SWContextManager::ServiceWorkerTerminationRequest::ServiceWorkerTerminationRequest):
1398
1399         * workers/service/context/SWContextManager.h:
1400
1401 2018-01-18  Youenn Fablet  <youenn@apple.com>
1402
1403         Do not go to the storage process when loading a main resource if there is no service worker registered
1404         https://bugs.webkit.org/show_bug.cgi?id=181395
1405
1406         Reviewed by Chris Dumez.
1407
1408         No observable behavior change.
1409         Instead of creating a connection to know whether there is a potential service worker,
1410         Ask the service worker provider that will use the connection if needed.
1411         Otherwise, it will use a default value provided by the UIProcess.
1412
1413         Tested by cleaning all service workers and checking the computed value of the default value,
1414         then observing whether pages registering service workers work well.
1415
1416         * loader/DocumentLoader.cpp:
1417         (WebCore::DocumentLoader::startLoadingMainResource):
1418         * workers/service/ServiceWorkerProvider.cpp:
1419         (WebCore::ServiceWorkerProvider::mayHaveServiceWorkerRegisteredForOrigin):
1420         * workers/service/ServiceWorkerProvider.h:
1421
1422 2018-01-18  Dan Bernstein  <mitz@apple.com>
1423
1424         [Xcode] Streamline and future-proof target-macOS-version-dependent build setting definitions
1425         https://bugs.webkit.org/show_bug.cgi?id=181803
1426
1427         Reviewed by Tim Horton.
1428
1429         * Configurations/Base.xcconfig: Updated.
1430         * Configurations/DebugRelease.xcconfig: Ditto.
1431         * Configurations/FeatureDefines.xcconfig: Adopted macOSTargetConditionals helpers.
1432         * Configurations/Version.xcconfig: Updated.
1433         * Configurations/macOSTargetConditionals.xcconfig: Added. Defines helper build settings
1434           useful for defining settings that depend on the target macOS version.
1435
1436 2018-01-18  Chris Dumez  <cdumez@apple.com>
1437
1438         Service Workers restored from persistent storage have 'redundant' state
1439         https://bugs.webkit.org/show_bug.cgi?id=181749
1440         <rdar://problem/36556486>
1441
1442         Reviewed by Youenn Fablet.
1443
1444         Tested by new API test.
1445
1446         * workers/service/server/SWServer.cpp:
1447         (WebCore::SWServer::installContextData):
1448         Make sure the SWServerWorker's state is set to "activated" after it is assigned to
1449         the registrations' active slot. Otherwise, it stays in its default state (redundant).
1450
1451 2018-01-18  Antti Koivisto  <antti@apple.com>
1452
1453         REGRESSION(r225650): The scores of MotionMark tests Multiply and Leaves dropped by 8%
1454         https://bugs.webkit.org/show_bug.cgi?id=181460
1455         <rdar://problem/36379776>
1456
1457         Reviewed by Ryosuke Niwa.
1458
1459         * css/parser/CSSParser.cpp:
1460         (WebCore::CSSParserContext::CSSParserContext):
1461
1462         Don't do the expensive security origin test if the supplied sheet base URL is null. This
1463         is true for rules coming from the same document.
1464
1465 2018-01-18  Antti Koivisto  <antti@apple.com>
1466
1467         REGRESSION (r223604): Setting :before/after pseudo element on <noscript> asserts
1468         https://bugs.webkit.org/show_bug.cgi?id=181795
1469         <rdar://problem/36334524>
1470
1471         Reviewed by David Kilzer.
1472
1473         <noscript> disallows renderer generation outside CSS mechanisms, however we would still construct
1474         PseudoElements for them during style resolution. These were never removed properly because the
1475         pseudo element removal was tied to render tree teardown. Without proper removal the associated
1476         animations were also not canceled.
1477
1478         Test: fast/css-generated-content/noscript-pseudo-anim-crash.html
1479
1480         * dom/Element.cpp:
1481         (WebCore::Element::removedFromAncestor):
1482
1483         Take care to get rid of PseudoElements when the element is removed from the tree.
1484         This also cancels any associated animations.
1485
1486 2018-01-18  Chris Fleizach  <cfleizach@apple.com>
1487
1488         AX: Aria-activedescendant not supported
1489         https://bugs.webkit.org/show_bug.cgi?id=161734
1490         <rdar://problem/28202679>
1491
1492         Reviewed by Joanmarie Diggs.
1493
1494         When a combo-box owns/controls a list/listbox/grid/tree, the owned element needs to check the active-descendant of the combobox when
1495         checking if it has selected children. 
1496         The target of the selection change notification should also be the owned element in these cases.
1497
1498         Test: accessibility/aria-combobox-controlling-list.html
1499
1500         * accessibility/AccessibilityObject.cpp:
1501         (WebCore::AccessibilityObject::selectedListItem):
1502         * accessibility/AccessibilityObject.h:
1503         * accessibility/AccessibilityRenderObject.cpp:
1504         (WebCore::AccessibilityRenderObject::targetElementForActiveDescendant const):
1505         (WebCore::AccessibilityRenderObject::handleActiveDescendantChanged):
1506         (WebCore::AccessibilityRenderObject::canHaveSelectedChildren const):
1507         (WebCore::AccessibilityRenderObject::selectedChildren):
1508         * accessibility/AccessibilityRenderObject.h:
1509         * accessibility/mac/AXObjectCacheMac.mm:
1510         (WebCore::AXObjectCache::postPlatformNotification):
1511
1512 2018-01-17  Per Arne Vollan  <pvollan@apple.com>
1513
1514         REGRESSION (r224780): Text stroke not applied to video captions.
1515         https://bugs.webkit.org/show_bug.cgi?id=181743
1516         <rdar://problem/35874338>
1517
1518         Reviewed by Simon Fraser.
1519
1520         Tests: media/track/track-css-visible-stroke-expected.html
1521                media/track/track-css-visible-stroke.html
1522
1523         After r224780, it is no longer possible to mix text stroke styles with webkit
1524         legacy text stroke styles.
1525
1526         * css/StyleResolver.cpp:
1527         (WebCore::isValidCueStyleProperty):
1528         * page/CaptionUserPreferencesMediaAF.cpp:
1529         (WebCore::CaptionUserPreferencesMediaAF::captionsTextEdgeCSS const):
1530
1531 2018-01-18  Andy Estes  <aestes@apple.com>
1532
1533         [Payment Request] Support a default shipping address for Apple Pay
1534         https://bugs.webkit.org/show_bug.cgi?id=181754
1535         <rdar://problem/36009733>
1536
1537         Reviewed by Brady Eidson.
1538
1539         Move shippingContact from ApplePayPaymentRequest to ApplePayRequestBase. This allows
1540         merchants to specify a default shipping address when using Apple Pay with Payment Request.
1541
1542         This also fixes a bug found during testing where
1543         +[NSPersonNameComponentsFormatter localizedStringFromPersonNameComponents:style:options:]
1544         would throw an exception when passed a nil NSPersonNameComponents.
1545
1546         Test: http/tests/ssl/applepay/ApplePayRequestShippingContact.https.html
1547
1548         * Modules/applepay/ApplePayPaymentRequest.h:
1549         * Modules/applepay/ApplePayPaymentRequest.idl:
1550         * Modules/applepay/ApplePayRequestBase.cpp:
1551         (WebCore::convertAndValidate):
1552         * Modules/applepay/ApplePayRequestBase.h:
1553         * Modules/applepay/ApplePayRequestBase.idl:
1554         * Modules/applepay/ApplePaySession.cpp:
1555         (WebCore::convertAndValidate):
1556         * Modules/applepay/ApplePaySessionPaymentRequest.h:
1557         (WebCore::ApplePaySessionPaymentRequest::version const):
1558         (WebCore::ApplePaySessionPaymentRequest::setVersion):
1559         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
1560         (WebCore::convert):
1561         * Modules/applepay/paymentrequest/ApplePayRequest.idl:
1562         * testing/MockPaymentCoordinator.cpp:
1563         (WebCore::MockPaymentCoordinator::showPaymentUI):
1564         (WebCore::MockPaymentCoordinator::completeMerchantValidation):
1565         * testing/MockPaymentCoordinator.h:
1566
1567 2018-01-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1568
1569         [iOS] Specify -[NSURL _title] for the associated URL when copying an image element
1570         https://bugs.webkit.org/show_bug.cgi?id=181783
1571         <rdar://problem/35785445>
1572
1573         Reviewed by Ryosuke Niwa.
1574
1575         Always specify the -[NSURL _title] to be either the title specified in a PasteboardImage's inner PasteboardURL,
1576         or if no title is specified, fall back to the user-visible URL string. This is because at least one internal
1577         client always tries to use the -_title property to determine the title of a pasted URL, or if none is specified,
1578         the -suggestedName. Since we need to set suggestedName to the preferred file name of the copied image and we
1579         don't want the suggested name to become the title of the link, we need to explicitly set the link title.
1580
1581         In doing so, this patch also fixes a bug wherein we forget to set the _title of the NSURL we're registering to
1582         an NSItemProvider.
1583
1584         Tests:  ActionSheetTests.CopyImageElementWithHREFAndTitle (new)
1585                 ActionSheetTests.CopyImageElementWithHREF (modified)
1586
1587         * platform/ios/PlatformPasteboardIOS.mm:
1588         (WebCore::PlatformPasteboard::write):
1589
1590 2018-01-17  Jer Noble  <jer.noble@apple.com>
1591
1592         WebVTT served via HLS never results in cues
1593         https://bugs.webkit.org/show_bug.cgi?id=181773
1594
1595         Reviewed by Eric Carlson.
1596
1597         Test: http/tests/media/hls/hls-webvtt-tracks.html
1598
1599         Three independant errors conspired to keep in-band WebVTT samples from parsing:
1600
1601         - The definition of ISOWebVTTCue::boxTypeName() was incorrect.
1602         - ISOWebVTTCue::parse() didn't call it's superclass's parse() method (leading to an incorrect size and offset).
1603         - Use String::fromUTF8() rather than String.adopt(StringVector&&).
1604
1605         * platform/graphics/iso/ISOVTTCue.cpp:
1606         (WebCore::ISOWebVTTCue::parse):
1607         * platform/graphics/iso/ISOVTTCue.h:
1608         (WebCore::ISOWebVTTCue::boxTypeName):
1609
1610 2018-01-17  John Wilander  <wilander@apple.com>
1611
1612         Resource Load Statistics: Block cookies for prevalent resources without user interaction
1613         https://bugs.webkit.org/show_bug.cgi?id=177394
1614         <rdar://problem/34613960>
1615
1616         Reviewed by Alex Christensen.
1617
1618         Tests: http/tests/resourceLoadStatistics/add-blocking-to-redirect.html
1619                http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html
1620                http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html
1621                http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html
1622
1623         * platform/network/NetworkStorageSession.h:
1624             Now exports NetworkStorageSession::nsCookieStorage().
1625         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1626         (WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies):
1627             Fixes the FIXME.
1628
1629 2018-01-17  Dean Jackson  <dino@apple.com>
1630
1631         Remove linked-on test for Snow Leopard
1632         https://bugs.webkit.org/show_bug.cgi?id=181770
1633
1634         Reviewed by Eric Carlson.
1635
1636         Remove a very old linked-on-or-after test.
1637
1638         * platform/graphics/ca/GraphicsLayerCA.cpp:
1639
1640 2018-01-17  Matt Lewis  <jlewis3@apple.com>
1641
1642         Unreviewed, rolling out r227098.
1643
1644         This broke the build.
1645
1646         Reverted changeset:
1647
1648         "Remove linked-on test for Snow Leopard"
1649         https://bugs.webkit.org/show_bug.cgi?id=181770
1650         https://trac.webkit.org/changeset/227098
1651
1652 2018-01-17  Dean Jackson  <dino@apple.com>
1653
1654         Remove linked-on test for Snow Leopard
1655         https://bugs.webkit.org/show_bug.cgi?id=181770
1656
1657         Reviewed by Eric Carlson.
1658
1659         Remove a very old linked-on-or-after test.
1660
1661         * platform/graphics/ca/GraphicsLayerCA.cpp:
1662
1663 2018-01-17  Stephan Szabo  <stephan.szabo@sony.com>
1664
1665         [Curl] Use ResourceRequest::encodeWithPlatformData()
1666         https://bugs.webkit.org/show_bug.cgi?id=181768
1667
1668         Reviewed by Alex Christensen.
1669
1670         No new tests, assertion hit in downstream port, should be covered by
1671         existing tests.
1672
1673         * platform/network/curl/ResourceRequest.h:
1674         (WebCore::ResourceRequest::encodeWithPlatformData const):
1675         (WebCore::ResourceRequest::decodeWithPlatformData):
1676
1677 2018-01-17  Eric Carlson  <eric.carlson@apple.com>
1678
1679         Use existing RGB colorspace instead of creating a new one
1680         https://bugs.webkit.org/show_bug.cgi?id=181765
1681         <rdar://problem/36595753>
1682
1683         Reviewed by Dean Jackson.
1684
1685         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
1686         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream): Use sRGBColorSpaceRef instead
1687         of creating a new static colorspace.
1688
1689 2018-01-17  Matt Lewis  <jlewis3@apple.com>
1690
1691         Unreviewed, rolling out r227076.
1692
1693         This breaks internal builds
1694
1695         Reverted changeset:
1696
1697         "Resource Load Statistics: Block cookies for prevalent
1698         resources without user interaction"
1699         https://bugs.webkit.org/show_bug.cgi?id=177394
1700         https://trac.webkit.org/changeset/227076
1701
1702 2018-01-17  Ryosuke Niwa  <rniwa@webkit.org>
1703
1704         input and textarea elements should reveal selection in setSelection when focused
1705         https://bugs.webkit.org/show_bug.cgi?id=181715
1706         <rdar://problem/36570546>
1707
1708         Reviewed by Zalan Bujtas.
1709
1710         Made input and textarea elements reveal selection in FrameSelection::setSelection instead of by directly
1711         invoking FrameSelection::revealSelection in their respective updateFocusAppearance to unify code paths.
1712
1713         Also added options to reveal selection up to the main frame to SetSelectionOption to be used in iOS.
1714
1715         * editing/FrameSelection.cpp:
1716         (WebCore::FrameSelection::FrameSelection):
1717         (WebCore::FrameSelection::moveWithoutValidationTo): Takes SelectionRevealMode as an argument and converts
1718         sets appropriate selection options.
1719         (WebCore::FrameSelection::setSelection): Reconstruct SelectionRevealMode out of selection option sets.
1720         (WebCore::FrameSelection::updateAndRevealSelection):
1721         * editing/FrameSelection.h:
1722         (WebCore::FrameSelection): Added RevealSelectionUpToMainFrame as a SelectionRevealMode and replaced
1723         m_shouldRevealSelection by m_selectionRevealMode.
1724         * html/HTMLInputElement.cpp:
1725         (WebCore::HTMLInputElement::updateFocusAppearance): Pass SelectionRevealMode to HTMLTextFormControlElement's
1726         select and restoreCachedSelection instead of directly invoking FrameSelection::revealSelection.
1727         * html/HTMLTextAreaElement.cpp:
1728         (WebCore::HTMLTextAreaElement::updateFocusAppearance): Ditto.
1729         * html/HTMLTextFormControlElement.cpp:
1730         (WebCore::HTMLTextFormControlElement::select):
1731         (WebCore::HTMLTextFormControlElement::setSelectionRange):
1732         (WebCore::HTMLTextFormControlElement::restoreCachedSelection):
1733         * html/HTMLTextFormControlElement.h:
1734
1735 2018-01-17  Michael Catanzaro  <mcatanzaro@igalia.com>
1736
1737         WEBKIT_FRAMEWORK should not modify file-global include directories
1738         https://bugs.webkit.org/show_bug.cgi?id=181656
1739
1740         Reviewed by Konstantin Tokarev.
1741
1742         * CMakeLists.txt:
1743         * PlatformWPE.cmake:
1744
1745 2018-01-17  Michael Catanzaro  <mcatanzaro@igalia.com>
1746
1747         [GTK] Try even harder not to static link WTF into libwebkit2gtk
1748         https://bugs.webkit.org/show_bug.cgi?id=181751
1749
1750         Reviewed by Alex Christensen.
1751
1752         We don't want two copies of WTF. It should only be in libjavascriptcoregtk.
1753
1754         * PlatformGTK.cmake:
1755
1756 2018-01-17  Zalan Bujtas  <zalan@apple.com>
1757
1758         Multicol: RenderMultiColumnFlow should not inherit the flow state
1759         https://bugs.webkit.org/show_bug.cgi?id=181762
1760         <rdar://problem/35448565>
1761
1762         Reviewed by Simon Fraser.
1763
1764         Do not compute the inherited flow state flag for RenderMultiColumnFlow.
1765         It is (by definition) always inside a fragmented flow.
1766
1767         Test: fast/multicol/crash-when-out-of-flow-positioned-becomes-in-flow.html
1768
1769         * rendering/RenderObject.cpp:
1770         (WebCore::RenderObject::computedFragmentedFlowState):
1771
1772 2018-01-17  Alex Christensen  <achristensen@webkit.org>
1773
1774         Deprecate Application Cache
1775         https://bugs.webkit.org/show_bug.cgi?id=181764
1776
1777         Reviewed by Geoffrey Garen.
1778
1779         * features.json:
1780
1781 2018-01-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1782
1783         [iOS simulator] API test WKAttachmentTests.InjectedBundleReplaceURLWhenPastingImage is failing
1784         https://bugs.webkit.org/show_bug.cgi?id=181758
1785
1786         Reviewed by Tim Horton.
1787
1788         This test is failing because Editor::clientReplacementURLForResource expects a MIME type, but on iOS, the type
1789         paramter passed into WebContentReader::readImage is a UTI; subsequently, the bundle editing delegate receives
1790         a MIME type that's actually a UTI, which is incorrect. To address this, ensure that a MIME type is passed to
1791         bundle SPI by converting the type in WebContentReader::readImage to a MIME type.
1792
1793         * editing/cocoa/WebContentReaderCocoa.mm:
1794         (WebCore::WebContentReader::readImage):
1795
1796 2018-01-17  Antti Koivisto  <antti@apple.com>
1797
1798         REGRESSION (r226385?): Crash in com.apple.WebCore: WebCore::MediaQueryEvaluator::evaluate const + 32
1799         https://bugs.webkit.org/show_bug.cgi?id=181742
1800         <rdar://problem/36334726>
1801
1802         Reviewed by David Kilzer.
1803
1804         Test: fast/media/mediaqueryevaluator-crash.html
1805
1806         * css/MediaQueryEvaluator.cpp:
1807         (WebCore::MediaQueryEvaluator::MediaQueryEvaluator):
1808
1809         Use WeakPtr<Document> instead of a plain Frame pointer.
1810
1811         (WebCore::MediaQueryEvaluator::evaluate const):
1812
1813         Get the frame via document.
1814
1815         * css/MediaQueryEvaluator.h:
1816         * dom/Document.cpp:
1817         (WebCore::Document::prepareForDestruction):
1818
1819         Take care to clear style resolver.
1820
1821 2018-01-17  Youenn Fablet  <youenn@apple.com>
1822
1823         Put fetch request keepAlive behind a runtime flag
1824         https://bugs.webkit.org/show_bug.cgi?id=181592
1825
1826         Reviewed by Chris Dumez.
1827
1828         No change of behavior.
1829
1830         * Modules/fetch/FetchRequest.idl:
1831         * page/RuntimeEnabledFeatures.h:
1832         (WebCore::RuntimeEnabledFeatures::fetchAPIKeepAliveEnabled const):
1833         (WebCore::RuntimeEnabledFeatures::setFetchAPIKeepAliveEnabled):
1834
1835 2018-01-17  Per Arne Vollan  <pvollan@apple.com>
1836
1837         [Win] Use switch when converting from ResourceRequestCachePolicy to platform cache policy.
1838         https://bugs.webkit.org/show_bug.cgi?id=181686
1839
1840         Reviewed by Alex Christensen.
1841
1842         No new tests, covered by existing tests.
1843
1844         A switch will make the function easier on the eyes. Also, use the function in places where the ResourceRequestCachePolicy
1845         is just casted to a platform cache policy.
1846
1847         * platform/network/cf/ResourceRequestCFNet.cpp:
1848         (WebCore::toPlatformRequestCachePolicy):
1849
1850 2018-01-17  John Wilander  <wilander@apple.com>
1851
1852         Resource Load Statistics: Block cookies for prevalent resources without user interaction
1853         https://bugs.webkit.org/show_bug.cgi?id=177394
1854         <rdar://problem/34613960>
1855
1856         Reviewed by Alex Christensen.
1857
1858         Tests: http/tests/resourceLoadStatistics/add-blocking-to-redirect.html
1859                http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html
1860                http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html
1861                http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html
1862
1863         * platform/network/NetworkStorageSession.h:
1864             Now exports NetworkStorageSession::nsCookieStorage().
1865         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1866         (WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies):
1867             Fixes the FIXME.
1868
1869 2018-01-17  Daniel Bates  <dabates@apple.com>
1870
1871         REGRESSION (r222795): Cardiogram never signs in
1872         https://bugs.webkit.org/show_bug.cgi?id=181693
1873         <rdar://problem/36286293>
1874
1875         Reviewed by Ryosuke Niwa.
1876
1877         Exempt Cardiogram from the XHR header restrictions in r222795.
1878
1879         Following r222795 only Dashboard widgets are allowed to set arbitrary XHR headers.
1880         However Cardiogram also depends on such functionality.
1881
1882         Test: fast/xmlhttprequest/set-dangerous-headers-from-file-when-setting-enabled.html
1883
1884         * page/Settings.yaml:
1885         * platform/RuntimeApplicationChecks.h:
1886         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
1887         (WebCore::IOSApplication::isCardiogram):
1888         * xml/XMLHttpRequest.cpp:
1889         (WebCore::XMLHttpRequest::setRequestHeader):
1890
1891 2018-01-17  Daniel Bates  <dabates@apple.com>
1892
1893         ASSERTION FAILED: !m_completionHandler in PingHandle::~PingHandle()
1894         https://bugs.webkit.org/show_bug.cgi?id=181746
1895         <rdar://problem/36586248>
1896
1897         Reviewed by Chris Dumez.
1898
1899         Call PingHandle::pingLoadComplete() with an error when NSURLConnection queries
1900         whether the ping is able to respond to an authentication request. (Pings do not
1901         respond to authenticate requests.) It will call the completion handler, nullify
1902         the completion handler, and deallocate the PingHandle. Nullifying the completion
1903         handler is necessary to avoid the assertion failure in ~PingHandle().
1904
1905         Test: http/tests/misc/before-unload-load-image.html
1906
1907         * platform/network/PingHandle.h:
1908
1909 2018-01-17  Daniel Bates  <dabates@apple.com>
1910
1911         WebCoreResourceHandleAsOperationQueueDelegate/ResourceHandleCFURLConnectionDelegateWithOperationQueue may
1912         be deleted in main thread callback
1913         https://bugs.webkit.org/show_bug.cgi?id=181747
1914         <rdar://problem/36588120>
1915
1916         Reviewed by Alex Christensen.
1917
1918         Retain the delegate (e.g. WebCoreResourceHandleAsOperationQueueDelegate) before scheduling
1919         a main thread callback and blocking on a semaphore for its reply because the main thread
1920         callback can do anything, including deleting the delegate, before the non-main thread
1921         has a chance to execute. For instance, a PingHandle will delete itself (and hence delete
1922         its resource handle delegate) in most of the code paths invoked by the delegate.
1923
1924         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
1925         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest):
1926         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
1927         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse):
1928         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
1929         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1930         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
1931         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
1932         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
1933         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
1934
1935 2018-01-17  Chris Dumez  <cdumez@apple.com>
1936
1937         'fetch' event may be sent to a service worker before its state is set to 'activated'
1938         https://bugs.webkit.org/show_bug.cgi?id=181698
1939         <rdar://problem/36554856>
1940
1941         Reviewed by Youenn Fablet.
1942
1943         'fetch' event may be sent to a service worker before its state is set to 'activated'.
1944         When the registration's active worker needs to intercept a load, and its state is 'activating',
1945         we queue the request to send the fetch event in SWServerWorker::m_whenActivatedHandlers.
1946         Once the SWServerWorker::setState() is called with 'activated' state, we then call the
1947         handlers in m_whenActivatedHandlers to make send the fetch event now that the worker is
1948         activated. The issue is that even though the worker is activated and its state was set to
1949         'activated' on Storage process side, we had not yet notified the ServiceWorker process
1950         of the service worker's new state yet.
1951
1952         To address the issue, we now make sure that SWServerWorker::m_whenActivatedHandlers are
1953         called *after* we've sent the IPC to the ServiceWorker process to update the worker's
1954         state to 'activated'. Also, we now call ServiceWorkerFetch::dispatchFetchEvent()
1955         asynchronously in a postTask() as the service worker's state is also updated asynchronously
1956         in a postTask. This is as per specification [1], which says to "queue a task" to fire
1957         the fetch event.
1958
1959         [1] https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm (step 18)
1960
1961         No new tests, covered by imported/w3c/web-platform-tests/service-workers/service-worker/fetch-waits-for-activate.https.html
1962         which hits the new assertion without the fix.
1963
1964         * workers/service/context/ServiceWorkerFetch.cpp:
1965         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
1966         Add assertions to make sure that we dispatch the fetch event on the right worker and
1967         that the worker is in 'activated' state.
1968
1969         * workers/service/context/ServiceWorkerThread.cpp:
1970         (WebCore::ServiceWorkerThread::postFetchTask):
1971         Queue a task to fire the fetch event as per:
1972         - https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm (step 18)
1973         We need to match the specification exactly here or things will happen in the wrong
1974         order. In particular, things like "update registration state" and "update worker state"
1975         might happen *after* firing the fetch event, even though the IPC for "update registration/worker
1976         state" was sent before the "fire fetch event" one, because the code for updating a registration/
1977         worker state already queues a task, as per the specification.
1978
1979         * workers/service/server/SWServerRegistration.cpp:
1980         (WebCore::SWServerRegistration::updateWorkerState):
1981         * workers/service/server/SWServerRegistration.h:
1982         * workers/service/server/SWServerWorker.cpp:
1983         (WebCore::SWServerWorker::setState):
1984         Move code to send the IPC to the Service Worker process whenever the service worker's state
1985         needs to be updated from SWServerRegistration::updateWorkerState() to SWServerWorker::setState().
1986         This way, we can make sure the IPC is sent *before* we call the m_whenActivatedHandlers handlers,
1987         as they may also send IPC to the Service Worker process, and we need to make sure this IPC happens
1988         after so that the service worker is in the right state.
1989
1990 2018-01-17  Stephan Szabo  <stephan.szabo@sony.com>
1991
1992         Page.cpp only sees forward declaration of ApplicationStateChangeListener when ENABLE(VIDEO) is off
1993         https://bugs.webkit.org/show_bug.cgi?id=181713
1994
1995         Reviewed by Darin Adler.
1996
1997         No new tests (build fix).
1998
1999         * page/Page.cpp: Add include for ApplicationStateChangeListener
2000
2001 2018-01-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2002
2003         Add injected bundle SPI to replace subresource URLs when dropping or pasting rich content
2004         https://bugs.webkit.org/show_bug.cgi?id=181637
2005         <rdar://problem/36508471>
2006
2007         Reviewed by Tim Horton.
2008
2009         Before carrying out blob URL conversion for pasted or dropped rich content, let the editor client replace
2010         subresource URLs in WebKit2 by calling out to new injected bundle SPI. See comments below for more detail.
2011
2012         Tests:  WKAttachmentTests.InjectedBundleReplaceURLsWhenPastingAttributedString
2013                 WKAttachmentTests.InjectedBundleReplaceURLWhenPastingImage
2014
2015         * editing/Editor.cpp:
2016         (WebCore::Editor::clientReplacementURLForResource):
2017         * editing/Editor.h:
2018
2019         Add a new helper to call out to the editor client for a URL string to replace a given ArchiveResource. In
2020         WebKit2, this calls out to the injected bundle's new `replacementURLForResource` SPI hook.
2021
2022         * editing/cocoa/WebContentReaderCocoa.mm:
2023         (WebCore::shouldReplaceSubresourceURL):
2024         (WebCore::replaceRichContentWithAttachments):
2025         (WebCore::replaceSubresourceURLsWithURLsFromClient):
2026
2027         Add a new static helper to replace subresource URLs in the given DocumentFragment with URLs supplied by the
2028         editor client. Additionally builds a list of ArchiveResources that have not been replaced, for use at call sites
2029         so that we don't unnecessarily create more Blobs for ArchiveResources that have already been replaced.
2030
2031         (WebCore::createFragmentAndAddResources):
2032         (WebCore::sanitizeMarkupWithArchive):
2033
2034         Tweak web content reading codepaths to first replace subresource URLs with editor-client-supplied URLs.
2035
2036         (WebCore::WebContentReader::readImage):
2037         (WebCore::shouldConvertToBlob): Deleted.
2038
2039         Rename this helper to shouldReplaceSubresourceURL, blob URL replacement is no longer the only scenario in which
2040         we replace resource URLs, but in both cases, we still want to ignore `http:`-family and `data:` URLs.
2041
2042         * loader/EmptyClients.cpp:
2043         * page/EditorClient.h:
2044
2045 2018-01-17  Yacine Bandou  <yacine.bandou_ext@softathome.com>
2046         [EME][GStreamer] Add the full-sample encryption support in the GStreamer ClearKey decryptor
2047         https://bugs.webkit.org/show_bug.cgi?id=180080
2048
2049         Reviewed by Xabier Rodriguez-Calvar.
2050
2051         Currently the GStreamer clearKey decryptor doesn't support the full-sample encryption,
2052         where the buffer is entirely encrypted, it supports only the sub-sample encryption.
2053
2054         Test: media/encrypted-media/clearKey/clearKey-cenc-audio-playback-mse.html
2055
2056         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
2057         (webKitMediaClearKeyDecryptorDecrypt):
2058
2059 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
2060
2061         Unreviewed follow-up to r227051.
2062
2063         * platform/graphics/cairo/CairoOperations.h: Fix declaration of the
2064         fillRoundedRect() function by removing the bool parameter that's not
2065         used at all in the definition. This went unspotted due to the unified
2066         source build including the implementation file before fillRoundedRect()
2067         usage in GrapihcsContextCairo.cpp, leaving the declaration undefined
2068         and instead using the definition directly.
2069
2070 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
2071
2072         [Cairo] Don't mirror global alpha and image interpolation quality state values in PlatformContextCairo
2073         https://bugs.webkit.org/show_bug.cgi?id=181725
2074
2075         Reviewed by Carlos Garcia Campos.
2076
2077         Don't duplicate global alpha and image interpolation quality state
2078         values on the PlatformContextCairo. Instead, retrieve them from
2079         the managing GraphicsContextState when necessary.
2080
2081         For Cairo operations, the FillSource and StrokeSource containers now
2082         store the global alpha value, using it during the operation executions.
2083         For drawNativeImage(), the global alpha and interpolation quality values
2084         are passed through arguments.
2085
2086         In PlatformContextCairo, the two values are no longer stored on the
2087         internally-managed stack, and the getter-setter pairs for the two values
2088         are removed. In drawSurfaceToContext(), the two values are now expected
2089         to be passed through the method arguments.
2090
2091         No new tests -- no change in behavior.
2092
2093         * platform/graphics/cairo/CairoOperations.cpp:
2094         (WebCore::Cairo::prepareForFilling):
2095         (WebCore::Cairo::prepareForStroking):
2096         (WebCore::Cairo::drawPathShadow):
2097         (WebCore::Cairo::fillCurrentCairoPath):
2098         (WebCore::Cairo::FillSource::FillSource):
2099         (WebCore::Cairo::StrokeSource::StrokeSource):
2100         (WebCore::Cairo::strokeRect):
2101         (WebCore::Cairo::strokePath):
2102         (WebCore::Cairo::drawGlyphs):
2103         (WebCore::Cairo::drawNativeImage):
2104         (WebCore::Cairo::State::setGlobalAlpha): Deleted.
2105         (WebCore::Cairo::State::setImageInterpolationQuality): Deleted.
2106         * platform/graphics/cairo/CairoOperations.h:
2107         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2108         (WebCore::GraphicsContext::drawNativeImage):
2109         (WebCore::GraphicsContext::setPlatformAlpha):
2110         (WebCore::GraphicsContext::setPlatformImageInterpolationQuality):
2111         * platform/graphics/cairo/PlatformContextCairo.cpp:
2112         (WebCore::PlatformContextCairo::save):
2113         (WebCore::PlatformContextCairo::drawSurfaceToContext):
2114         (WebCore::PlatformContextCairo::State::State): Deleted.
2115         (WebCore::PlatformContextCairo::setImageInterpolationQuality): Deleted.
2116         (WebCore::PlatformContextCairo::imageInterpolationQuality const): Deleted.
2117         (WebCore::PlatformContextCairo::globalAlpha const): Deleted.
2118         (WebCore::PlatformContextCairo::setGlobalAlpha): Deleted.
2119         * platform/graphics/cairo/PlatformContextCairo.h:
2120         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
2121         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
2122
2123 2018-01-17  Philippe Normand  <pnormand@igalia.com>
2124
2125         REGRESSION(r226973/r226974): Four multimedia tests failing
2126         https://bugs.webkit.org/show_bug.cgi?id=181696
2127
2128         Reviewed by Carlos Garcia Campos.
2129
2130         This patch reverts some of the changes of the above revisions so as to fix layout test failures.
2131
2132         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2133         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Properly
2134         prepare stalled event when an error was detected.
2135         (WebCore::MediaPlayerPrivateGStreamer::processBufferingStats): Revert to previous version.
2136         (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired): Ditto.
2137         (WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress const):
2138         Emit progress event also when streaming but not when an error was
2139         detected.
2140         (WebCore::MediaPlayerPrivateGStreamer::totalBytes const): use isLiveStream like everywhere else.
2141         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2142         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2143         (webkit_web_src_init): Revert to keep-alive FALSE by default.
2144
2145 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
2146
2147         [Cairo] Move prepareForFilling(), prepareForStroking() code to CairoOperations
2148         https://bugs.webkit.org/show_bug.cgi?id=181721
2149
2150         Reviewed by Carlos Garcia Campos.
2151
2152         Move the prepareForFilling() and prepareForStroking() code off of the
2153         PlatformContextCairo class and into static functions inside the
2154         CairoOperations implementation files. The original methods weren't
2155         called from any place other than the Cairo operations, and they only
2156         operated with the cairo_t object that's stored in and retrievable from
2157         the PlatformContextCairo object.
2158
2159         No new tests -- no change in behavior.
2160
2161         * platform/graphics/cairo/CairoOperations.cpp:
2162         (WebCore::Cairo::reduceSourceByAlpha):
2163         (WebCore::Cairo::prepareCairoContextSource):
2164         (WebCore::Cairo::clipForPatternFilling):
2165         (WebCore::Cairo::prepareForFilling):
2166         (WebCore::Cairo::prepareForStroking):
2167         (WebCore::Cairo::drawPathShadow):
2168         (WebCore::Cairo::fillCurrentCairoPath):
2169         (WebCore::Cairo::strokeRect):
2170         (WebCore::Cairo::strokePath):
2171         (WebCore::Cairo::drawGlyphs):
2172         * platform/graphics/cairo/PlatformContextCairo.cpp:
2173         (WebCore::reduceSourceByAlpha): Deleted.
2174         (WebCore::prepareCairoContextSource): Deleted.
2175         (WebCore::PlatformContextCairo::prepareForFilling): Deleted.
2176         (WebCore::PlatformContextCairo::prepareForStroking): Deleted.
2177         (WebCore::PlatformContextCairo::clipForPatternFilling): Deleted.
2178         * platform/graphics/cairo/PlatformContextCairo.h:
2179
2180 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
2181
2182         [Cairo] Use one-time ShadowBlur objects when performing shadowing
2183         https://bugs.webkit.org/show_bug.cgi?id=181720
2184
2185         Reviewed by Carlos Garcia Campos.
2186
2187         Don't maintain a ShadowBlur object in the PlatformContextCairo class.
2188         Instead, use temporary ShadowBlur objects whenever shadowing is needed,
2189         providing all the shadow state information to it and drawing shadow into
2190         the given GraphicsContext object.
2191
2192         ShadowBlur constructors are cleaned up. The 'shadows ignored' argument
2193         can now also be provided to the variant that accepts explicit shadow
2194         attributes, but the argument is false by default.
2195
2196         In CairoOperations, the ShadowBlurUsage functionality is rolled into the
2197         new ShadowState class. ShadowState parameter is now used for operations
2198         that might need to perform shadow painting. Call sites are modified
2199         accordingly.
2200
2201         Cairo::State::setShadowValues() and Cairo::State::clearShadow() are
2202         removed, since the ShadowBlur object that was modified through those is
2203         being removed from the PlatformContextCairo class. We still have to flip
2204         the Y-axis of the shadow offset in GraphicsContext::setPlatformShadow()
2205         when shadows are ignoring transformations.
2206
2207         No new tests -- no change in behavior.
2208
2209         * platform/graphics/ShadowBlur.cpp:
2210         (WebCore::ShadowBlur::ShadowBlur):
2211         * platform/graphics/ShadowBlur.h:
2212         * platform/graphics/cairo/CairoOperations.cpp:
2213         (WebCore::Cairo::drawPathShadow):
2214         (WebCore::Cairo::drawGlyphsShadow):
2215         (WebCore::Cairo::ShadowState::ShadowState):
2216         (WebCore::Cairo::ShadowState::isVisible const):
2217         (WebCore::Cairo::ShadowState::isRequired const):
2218         (WebCore::Cairo::fillRect):
2219         (WebCore::Cairo::fillRoundedRect):
2220         (WebCore::Cairo::fillRectWithRoundedHole):
2221         (WebCore::Cairo::fillPath):
2222         (WebCore::Cairo::strokeRect):
2223         (WebCore::Cairo::strokePath):
2224         (WebCore::Cairo::drawGlyphs):
2225         (WebCore::Cairo::drawNativeImage):
2226         (WebCore::Cairo::State::setShadowValues): Deleted.
2227         (WebCore::Cairo::State::clearShadow): Deleted.
2228         (WebCore::Cairo::ShadowBlurUsage::ShadowBlurUsage): Deleted.
2229         (WebCore::Cairo::ShadowBlurUsage::required const): Deleted.
2230         * platform/graphics/cairo/CairoOperations.h:
2231         * platform/graphics/cairo/FontCairo.cpp:
2232         (WebCore::FontCascade::drawGlyphs):
2233         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2234         (WebCore::GraphicsContext::restorePlatformState):
2235         (WebCore::GraphicsContext::drawNativeImage):
2236         (WebCore::GraphicsContext::fillPath):
2237         (WebCore::GraphicsContext::strokePath):
2238         (WebCore::GraphicsContext::fillRect):
2239         (WebCore::GraphicsContext::setPlatformShadow):
2240         (WebCore::GraphicsContext::clearPlatformShadow):
2241         (WebCore::GraphicsContext::strokeRect):
2242         (WebCore::GraphicsContext::platformFillRoundedRect):
2243         (WebCore::GraphicsContext::fillRectWithRoundedHole):
2244         * platform/graphics/cairo/PlatformContextCairo.cpp:
2245         (WebCore::PlatformContextCairo::drawSurfaceToContext):
2246         * platform/graphics/cairo/PlatformContextCairo.h:
2247         (WebCore::PlatformContextCairo::shadowBlur): Deleted.
2248         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
2249         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
2250
2251 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
2252
2253         CanvasImageData: createImageData() parameter should not be nullable
2254         https://bugs.webkit.org/show_bug.cgi?id=181670
2255
2256         Reviewed by Sam Weinig.
2257
2258         createImageData() method on the CanvasImageData interface should not
2259         treat the ImageData parameter as nullable, but should instead reject any
2260         null values with a TypeError, as demanded by the specification.
2261
2262         No new tests -- current tests covering createImageData(null) are updated
2263         to properly cover new behavior of throwing a TypeError exception.
2264
2265         * html/canvas/CanvasImageData.idl:
2266         * html/canvas/CanvasRenderingContext2DBase.cpp:
2267         (WebCore::CanvasRenderingContext2DBase::createImageData const):
2268         * html/canvas/CanvasRenderingContext2DBase.h:
2269
2270 2018-01-16  Fujii Hironori  <Hironori.Fujii@sony.com>
2271
2272         [CMake] Remove WebCoreDerivedSources library target
2273         https://bugs.webkit.org/show_bug.cgi?id=181664
2274
2275         Reviewed by Carlos Garcia Campos.
2276
2277         After unified source build has been introduced, CMake Visual
2278         Studio build suffers complicated unnecessary recompilation issues
2279         because Visual Studio invokes scripts twice in both WebCore and
2280         WebCoreDerivedSources projects (Bug 181117).
2281
2282         WebCoreDerivedSources library has been introduced in r198766 to
2283         avoid command line length limit of CMake Ninja build on macOS.
2284         Fortunately, unified source build has reduced the number of source
2285         files to compile, WebCore doesn't need to be split anymore.
2286
2287         No new tests (No behavior change)
2288
2289         * CMakeLists.txt: Replaced WebCore_DERIVED_SOURCES with WebCore_SOURCES. Removed WebCoreDerivedSources library target.
2290         Do not compile each JavaScript Builtins.cpp files because the unified source WebCoreJSBuiltins.cpp is already included.
2291         * PlatformGTK.cmake: Replaced WebCore_DERIVED_SOURCES with WebCore_SOURCES.
2292         * PlatformWin.cmake: Ditto.
2293
2294 2018-01-16  Simon Fraser  <simon.fraser@apple.com>
2295
2296         Can't scroll iframe after toggling it to display:none and back
2297         https://bugs.webkit.org/show_bug.cgi?id=181708
2298         rdar://problem/13234778
2299
2300         Reviewed by Tim Horton.
2301
2302         Nothing updated the FrameView's set of scrollable areas when a subframe came back from display:none.
2303         Mirror the existing virtual removeChild() by making addChild() virtual, and using it to mark
2304         the FrameView's scrollable area set as dirty.
2305
2306         Test: tiled-drawing/scrolling/non-fast-region/non-fast-scrollable-region-hide-show-iframe.html
2307
2308         * page/FrameView.cpp:
2309         (WebCore::FrameView::addChild):
2310         * page/FrameView.h:
2311         * platform/ScrollView.h:
2312
2313 2018-01-16  Chris Dumez  <cdumez@apple.com>
2314
2315         SWServerWorker::m_contextConnectionIdentifier may get out of date
2316         https://bugs.webkit.org/show_bug.cgi?id=181687
2317         <rdar://problem/36548111>
2318
2319         Reviewed by Brady Eidson.
2320
2321         SWServerWorker::m_contextConnectionIdentifier may get out of date. This happens when the
2322         context process crashes and is relaunched.
2323
2324         No new tests, added assertion in terminateWorkerInternal() that hits without this fix.
2325
2326         * workers/service/server/SWServer.cpp:
2327         (WebCore::SWServer::runServiceWorker):
2328         (WebCore::SWServer::terminateWorkerInternal):
2329         (WebCore::SWServer::unregisterServiceWorkerClient):
2330         * workers/service/server/SWServerWorker.h:
2331         (WebCore::SWServerWorker::setContextConnectionIdentifier):
2332
2333 2018-01-16  Jer Noble  <jer.noble@apple.com>
2334
2335         Reset MediaSourcePrivateAVFObjC's m_sourceBufferWithSelectedVideo when the underlying SourceBufferPrivate is removed.
2336         https://bugs.webkit.org/show_bug.cgi?id=181707
2337         <rdar://problem/34809474>
2338
2339         Reviewed by Eric Carlson.
2340
2341         Test: media/media-source/media-source-remove-unload-crash.html
2342
2343         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
2344         (WebCore::MediaSourcePrivateAVFObjC::removeSourceBuffer):
2345
2346 2018-01-12  Jiewen Tan  <jiewen_tan@apple.com>
2347
2348         [WebAuthN] Implement dummy WebAuthN IDLs
2349         https://bugs.webkit.org/show_bug.cgi?id=181627
2350         <rdar://problem/36459864>
2351
2352         Reviewed by Alex Christensen.
2353
2354         This patch implements dummy WebAuthN IDLs and connect them with Credential Management as well.
2355         All implementations in this patch are subject to change when real implementations land. The
2356         purpose here on the other hand is to have IDLs, bindings and implementations connected. This
2357         patch should handle all IDLs that we need.
2358
2359         No tests.
2360
2361         * CMakeLists.txt:
2362         * DerivedSources.make:
2363         * Modules/credentialmanagement/CredentialCreationOptions.h:
2364         * Modules/credentialmanagement/CredentialCreationOptions.idl:
2365         * Modules/credentialmanagement/CredentialRequestOptions.h:
2366         * Modules/credentialmanagement/CredentialRequestOptions.idl:
2367         * Modules/webauthn/AuthenticatorAssertionResponse.cpp: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.cpp.
2368         (WebCore::AuthenticatorAssertionResponse::AuthenticatorAssertionResponse):
2369         (WebCore::AuthenticatorAssertionResponse::~AuthenticatorAssertionResponse):
2370         (WebCore::AuthenticatorAssertionResponse::authenticatorData):
2371         (WebCore::AuthenticatorAssertionResponse::signature):
2372         (WebCore::AuthenticatorAssertionResponse::userHandle):
2373         * Modules/webauthn/AuthenticatorAssertionResponse.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
2374         * Modules/webauthn/AuthenticatorAssertionResponse.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
2375         * Modules/webauthn/AuthenticatorAttestationResponse.cpp: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h.
2376         (WebCore::AuthenticatorAttestationResponse::AuthenticatorAttestationResponse):
2377         (WebCore::AuthenticatorAttestationResponse::~AuthenticatorAttestationResponse):
2378         (WebCore::AuthenticatorAttestationResponse::attestationObject):
2379         * Modules/webauthn/AuthenticatorAttestationResponse.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
2380         * Modules/webauthn/AuthenticatorAttestationResponse.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
2381         * Modules/webauthn/AuthenticatorResponse.cpp: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h.
2382         (WebCore::AuthenticatorResponse::AuthenticatorResponse):
2383         (WebCore::AuthenticatorResponse::~AuthenticatorResponse):
2384         (WebCore::AuthenticatorResponse::clientDataJSON):
2385         * Modules/webauthn/AuthenticatorResponse.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
2386         * Modules/webauthn/AuthenticatorResponse.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
2387         * Modules/webauthn/PublicKeyCredential.cpp:
2388         (WebCore::PublicKeyCredential::rawId):
2389         (WebCore::PublicKeyCredential::response):
2390         (WebCore::PublicKeyCredential::getClientExtensionResults):
2391         (WebCore::PublicKeyCredential::isUserVerifyingPlatformAuthenticatorAvailable):
2392         * Modules/webauthn/PublicKeyCredential.h:
2393         * Modules/webauthn/PublicKeyCredential.idl:
2394         * Modules/webauthn/PublicKeyCredentialCreationOptions.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
2395         * Modules/webauthn/PublicKeyCredentialCreationOptions.idl: Added.
2396         * Modules/webauthn/PublicKeyCredentialDescriptor.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h.
2397         * Modules/webauthn/PublicKeyCredentialDescriptor.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
2398         * Modules/webauthn/PublicKeyCredentialRequestOptions.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h.
2399         * Modules/webauthn/PublicKeyCredentialRequestOptions.idl: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
2400         * Modules/webauthn/PublicKeyCredentialType.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
2401         * Modules/webauthn/PublicKeyCredentialType.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
2402         * Sources.txt:
2403         * WebCore.xcodeproj/project.pbxproj:
2404         * bindings/js/WebCoreBuiltinNames.h:
2405
2406 2018-01-16  Zalan Bujtas  <zalan@apple.com>
2407
2408         AX: Do not trigger layout in updateBackingStore() unless it is safe to do so
2409         https://bugs.webkit.org/show_bug.cgi?id=181703
2410         <rdar://problem/36365706>
2411
2412         Reviewed by Ryosuke Niwa.
2413
2414         Document::isSafeToUpdateStyleOrLayout() can tell whether it is safe to run layout.
2415
2416         Unable to create test with WebInspector involved. 
2417
2418         * accessibility/AccessibilityObject.cpp:
2419         (WebCore::AccessibilityObject::updateBackingStore):
2420         * dom/Document.cpp:
2421         (WebCore::Document::isSafeToUpdateStyleOrLayout const):
2422         (WebCore::Document::updateStyleIfNeeded):
2423         (WebCore::Document::updateLayout):
2424         (WebCore::isSafeToUpdateStyleOrLayout): Deleted.
2425         * dom/Document.h:
2426
2427 2018-01-16  Ryan Haddad  <ryanhaddad@apple.com>
2428
2429         Unreviewed, rolling out r226962.
2430
2431         The LayoutTest added with this change is a flaky timeout.
2432
2433         Reverted changeset:
2434
2435         "Support for preconnect Link headers"
2436         https://bugs.webkit.org/show_bug.cgi?id=181657
2437         https://trac.webkit.org/changeset/226962
2438
2439 2018-01-16  Simon Fraser  <simon.fraser@apple.com>
2440
2441         Text looks bad on some CSS spec pages
2442         https://bugs.webkit.org/show_bug.cgi?id=181700
2443         rdar://problem/36552107
2444
2445         Reviewed by Tim Horton.
2446
2447         When making new tiles in a TileController, we failed to set their "supports antialiased layer text"
2448         setting, so tile caches could end up with a mixture of layers that do and do not support
2449         antialiased layer text.
2450
2451         No tests because the tiled drawing tests don't dump out tiles inside of tile caches.
2452
2453         * platform/graphics/ca/TileController.cpp:
2454         (WebCore::TileController::createTileLayer):
2455
2456 2018-01-16  Said Abou-Hallawa  <sabouhallawa@apple.com>
2457
2458         REGRESSION(r221292): svg/animations/animateTransform-pattern-transform.html crashes with security assertion
2459         https://bugs.webkit.org/show_bug.cgi?id=179986
2460
2461         Reviewed by Simon Fraser.
2462
2463         This patch reverts all or parts of the following changes-sets
2464             <http://trac.webkit.org/changeset/221292>
2465             <http://trac.webkit.org/changeset/197967>
2466             <http://trac.webkit.org/changeset/196670>
2467
2468         A JS statement like this:
2469             var item = text.x.animVal.getItem(0);
2470
2471         Creates the following C++ objects:
2472             SVGAnimatedListPropertyTearOff<SVGLengthListValues> for 'text.x'
2473             SVGListPropertyTearOff<SVGLengthListValues> for 'text.x.animVal'
2474             SVGPropertyTearOff<SVGLengthValue> for 'text.x.animVal.getItem(0)'
2475
2476         If 'item' changes, the attribute 'x' of the element '<text>' will change
2477         as well. But this binding works only in one direction. If the attribute
2478         'x' of the element '<text>' changes, e.g.:
2479
2480             text.setAttribute('x', '10,20,30');
2481
2482         This will detach 'item' from the element <text> and any further changes 
2483         in 'item' won't affect the attribute 'x' of element <text>.
2484
2485         The one direction binding can only work if this chain of tear-off objects
2486         is kept connected. This is implemented by RefCounted back pointers from
2487         SVGPropertyTearOff and SVGListPropertyTearOff to SVGAnimatedListPropertyTearOff.
2488
2489         The security crashes and the memory leaks are happening because of the
2490         raw forward pointers:
2491             -- SVGAnimatedListPropertyTearOff maintains raw pointers of type
2492                SVGListPropertyTearOff for m_baseVal and m_animVal
2493             -- The m_wrappers and m_animatedWrappers of SVGAnimatedListPropertyTearOff
2494                are vectors of raw pointer Vector<SVGLength*>
2495
2496         To control the life cycle of the raw pointers, SVGListPropertyTearOff and
2497         SVGPropertyTearOff call SVGAnimatedListPropertyTearOff::propertyWillBeDeleted()
2498         to notify it they are going to be deleted. In propertyWillBeDeleted(), we
2499         clear the pointers so they are not used after being freed. This mechanism
2500         has been error-prone and we've never got it 100% right.
2501
2502         The solution we need to adopt with SVG tear-off objects is the following:
2503             -- All the forward pointers should be weak pointers.
2504             -- All the back pointers should be ref pointers.
2505
2506         This solution may not look intuitive but it solves the bugs and keeps the
2507         one direction binding. The forward weak pointers allows the tear-off
2508         objects to go aways if no reference from JS exists. The back ref pointers
2509         maintains the chain of objects and guarantees the correct binding.
2510
2511         * svg/SVGPathSegList.h:
2512         * svg/SVGTransformList.h:
2513         * svg/properties/SVGAnimatedListPropertyTearOff.h:
2514         (WebCore::SVGAnimatedListPropertyTearOff::baseVal):
2515         (WebCore::SVGAnimatedListPropertyTearOff::animVal):
2516         * svg/properties/SVGAnimatedPathSegListPropertyTearOff.h:
2517         * svg/properties/SVGAnimatedProperty.h:
2518         (WebCore::SVGAnimatedProperty::isAnimatedListTearOff const):
2519         (WebCore::SVGAnimatedProperty::propertyWillBeDeleted): Deleted.
2520         * svg/properties/SVGAnimatedPropertyTearOff.h:
2521         * svg/properties/SVGAnimatedTransformListPropertyTearOff.h:
2522         * svg/properties/SVGListProperty.h:
2523         (WebCore::SVGListProperty::initializeValuesAndWrappers):
2524         (WebCore::SVGListProperty::getItemValuesAndWrappers):
2525         (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers):
2526         (WebCore::SVGListProperty::replaceItemValuesAndWrappers):
2527         (WebCore::SVGListProperty::removeItemValuesAndWrappers):
2528         (WebCore::SVGListProperty::appendItemValuesAndWrappers):
2529         (WebCore::SVGListProperty::createWeakPtr const):
2530         * svg/properties/SVGListPropertyTearOff.h:
2531         (WebCore::SVGListPropertyTearOff::removeItemFromList):
2532         (WebCore::SVGListPropertyTearOff::~SVGListPropertyTearOff): Deleted.
2533         * svg/properties/SVGPropertyTearOff.h:
2534         (WebCore::SVGPropertyTearOff::createWeakPtr const):
2535         (WebCore::SVGPropertyTearOff::~SVGPropertyTearOff):
2536
2537 2018-01-16  Eric Carlson  <eric.carlson@apple.com>
2538
2539         AVSampleBufferDisplayLayer should be flushed when application activates
2540         https://bugs.webkit.org/show_bug.cgi?id=181623
2541         <rdar://problem/36487738>
2542
2543         Reviewed by Darin Adler.
2544
2545         No new tests, I wasn't able to reproduce it in a test.
2546
2547         * WebCore.xcodeproj/project.pbxproj:
2548         * dom/Document.cpp:
2549         (WebCore::Document::addApplicationStateChangeListener): New.
2550         (WebCore::Document::removeApplicationStateChangeListener): Ditto.
2551         (WebCore::Document::forEachApplicationStateChangeListener): Ditto.
2552         * dom/Document.h:
2553
2554         * html/HTMLMediaElement.cpp:
2555         (WebCore::HTMLMediaElement::registerWithDocument): Register for application state changes.
2556         (WebCore::HTMLMediaElement::unregisterWithDocument): Unregister.
2557         (WebCore::HTMLMediaElement::applicationWillResignActive): Pass through to the player.
2558         (WebCore::HTMLMediaElement::applicationDidBecomeActive): Ditto.
2559         * html/HTMLMediaElement.h:
2560
2561         * page/ApplicationStateChangeListener.h: Added.
2562         (WebCore::ApplicationStateChangeListener::applicationWillResignActive):
2563         (WebCore::ApplicationStateChangeListener::applicationDidBecomeActive):
2564         * page/Page.cpp:
2565         (WebCore::Page::forEachDocument):
2566         (WebCore::Page::applicationWillResignActive):
2567         (WebCore::Page::applicationDidEnterBackground):
2568         (WebCore::Page::applicationWillEnterForeground):
2569         (WebCore::Page::applicationDidBecomeActive):
2570         * page/Page.h:
2571         * platform/graphics/MediaPlayer.cpp:
2572         (WebCore::MediaPlayer::applicationWillResignActive):
2573         (WebCore::MediaPlayer::applicationDidBecomeActive):
2574         * platform/graphics/MediaPlayer.h:
2575         * platform/graphics/MediaPlayerPrivate.h:
2576         (WebCore::MediaPlayerPrivateInterface::applicationWillResignActive):
2577         (WebCore::MediaPlayerPrivateInterface::applicationDidBecomeActive):
2578
2579         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
2580         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2581         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): Switch
2582         to release logging.
2583         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC): Ditto.
2584         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueCorrectedVideoSample): Split out of enqueueVideoSample.
2585         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): Move code that updates
2586         the display later to enqueueCorrectedVideoSample. Rearrange logic to the image painter sample
2587         buffer has the correct timestamp.
2588         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerErrorDidChange): Switch to release logging.
2589         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerStatusDidChange): Ditto.
2590         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::applicationDidBecomeActive): f the display
2591         layer is in the "failed" state, flush the renderer and update the display mode.
2592         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers): Switch to release logging.
2593         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::load): Ditto.
2594         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::cancelLoad): Ditto.
2595         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::prepareToPlay): Ditto.
2596         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayMode): Ditto.
2597         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play): Ditto.
2598         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause): Ditto.
2599         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVolume): Ditto.
2600         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setMuted): Ditto.
2601         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateReadyState) Ditto.:
2602         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::logChannel const): Ditto.
2603         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateSampleTimes): Deleted.
2604
2605 2018-01-16  Michael Catanzaro  <mcatanzaro@igalia.com>
2606
2607         PAL should link to JavaScriptCore rather than WTF
2608         https://bugs.webkit.org/show_bug.cgi?id=181683
2609
2610         Reviewed by Konstantin Tokarev.
2611
2612         Do not link directly to JavaScriptCore. Get it via PAL.
2613
2614         * CMakeLists.txt:
2615
2616 2018-01-16  Zach Li  <zachli@apple.com>
2617
2618         Add pop-up policy support in website policies.
2619         https://bugs.webkit.org/show_bug.cgi?id=181544.
2620         rdar://problem/30521400.
2621
2622         Reviewed by Alex Christensen.
2623
2624         * loader/DocumentLoader.h:
2625         Introduce pop-up policy getter and setter. Initialize
2626         the policy as Default.
2627         (WebCore::DocumentLoader::popUpPolicy const):
2628         (WebCore::DocumentLoader::setPopUpPolicy):
2629         * page/DOMWindow.cpp:
2630         (WebCore::DOMWindow::allowPopUp):
2631         Pop-up policy specified on a per-page basis holds
2632         precedence over the global policy. If no pop-up policy
2633         is specified during navigation, global policy is used.
2634
2635 2018-01-16  Jer Noble  <jer.noble@apple.com>
2636
2637         Crash playing audio-only HLS stream via hls.js (MSE)
2638         https://bugs.webkit.org/show_bug.cgi?id=181691
2639         <rdar://problem/32967295>
2640
2641         Reviewed by Eric Carlson.
2642
2643         Add a weak-link check to the block called by -[AVSampleBufferDisplayLayer requestMediaDataWhenReadyOnQueue:usingBlock:].
2644
2645         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2646         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
2647         (WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples):
2648         (WebCore::SourceBufferPrivateAVFObjC::setVideoLayer):
2649
2650 2018-01-16  Simon Fraser  <simon.fraser@apple.com>
2651
2652         Rename applyHorizontalScale/applyVerticalScale in SVG filters, and related cleanup
2653         https://bugs.webkit.org/show_bug.cgi?id=181684
2654
2655         Reviewed by Alex Christensen.
2656
2657         Rename the confusing applyHorizontalScale/applyVerticalScale to scaledByFilterResolution(),
2658         and have it take and return a FloatSize. Change callers to do math in terms of FloatSizes.
2659
2660         Add inflate(size) to each of the rect classes.
2661
2662         * platform/graphics/FloatRect.h:
2663         (WebCore::FloatRect::inflate):
2664         * platform/graphics/IntRect.h:
2665         (WebCore::IntRect::inflate):
2666         * platform/graphics/LayoutRect.h:
2667         (WebCore::LayoutRect::inflate):
2668         * platform/graphics/filters/FEDisplacementMap.cpp:
2669         (WebCore::FEDisplacementMap::platformApplySoftware):
2670         * platform/graphics/filters/FEDropShadow.cpp:
2671         (WebCore::FEDropShadow::determineAbsolutePaintRect):
2672         (WebCore::FEDropShadow::platformApplySoftware):
2673         * platform/graphics/filters/FEGaussianBlur.cpp:
2674         (WebCore::FEGaussianBlur::calculateUnscaledKernelSize):
2675         (WebCore::FEGaussianBlur::calculateKernelSize):
2676         (WebCore::FEGaussianBlur::determineAbsolutePaintRect):
2677         (WebCore::FEGaussianBlur::platformApplySoftware):
2678         * platform/graphics/filters/FEGaussianBlur.h:
2679         * platform/graphics/filters/FEMorphology.cpp:
2680         (WebCore::FEMorphology::determineAbsolutePaintRect):
2681         (WebCore::FEMorphology::platformApplySoftware):
2682         * platform/graphics/filters/FEOffset.cpp:
2683         (WebCore::FEOffset::determineAbsolutePaintRect):
2684         (WebCore::FEOffset::platformApplySoftware):
2685         * platform/graphics/filters/Filter.h:
2686         (WebCore::Filter::setSourceImage):
2687         (WebCore::Filter::scaledByFilterResolution const):
2688         (WebCore::Filter::applyHorizontalScale const): Deleted.
2689         (WebCore::Filter::applyVerticalScale const): Deleted.
2690         * platform/graphics/filters/FilterOperations.cpp:
2691         (WebCore::outsetSizeForBlur):
2692         * rendering/FilterEffectRenderer.h:
2693         * svg/graphics/filters/SVGFilter.cpp:
2694         (WebCore::SVGFilter::scaledByFilterResolution const):
2695         (WebCore::SVGFilter::applyHorizontalScale const): Deleted.
2696         (WebCore::SVGFilter::applyVerticalScale const): Deleted.
2697         * svg/graphics/filters/SVGFilter.h:
2698
2699 2018-01-16  Fujii Hironori  <Hironori.Fujii@sony.com>
2700
2701         [CMake][Mac] Fix the build errors
2702         https://bugs.webkit.org/show_bug.cgi?id=181665
2703
2704         Reviewed by Alex Christensen.
2705
2706         No new tests (No behavior change)
2707
2708         * CMakeLists.txt: Added Modules/paymentrequest/MerchantValidationEvent.idl to compile.
2709         * PlatformMac.cmake: Added Modules/paymentrequest/MerchantValidationEvent.cpp to compile.
2710         Added workers/service/context and Modules/applicationmanifest as forwarding header paths.
2711
2712 2018-01-16  Wenson Hsieh  <wenson_hsieh@apple.com>
2713
2714         [Attachment Support] Provide the `src` of an attachment to the UI delegate when an attachment is inserted
2715         https://bugs.webkit.org/show_bug.cgi?id=181638
2716         <rdar://problem/36508702>
2717
2718         Reviewed by Dan Bernstein.
2719
2720         Adjust the `didInsertAttachment` codepath to additionally propagate the attachment element's `src`.
2721         Additionally, fix an issue with insertion and removal client notifications wherein the client can receive
2722         insertion calls without corresponding removal calls, or vice versa. This is an existing issue, but matters more
2723         now because we actually need to access the attachment element for its `src` when propagating changes to the
2724         client. See below for details.
2725
2726         Test: WKAttachmentTests.AttachmentUpdatesWhenInsertingRichMarkup
2727
2728         * dom/Document.h:
2729         (WebCore::Document::attachmentElementsByIdentifier const):
2730         * editing/Editor.cpp:
2731         (WebCore::Editor::notifyClientOfAttachmentUpdates):
2732         * page/EditorClient.h:
2733         (WebCore::EditorClient::didInsertAttachment):
2734         * page/Frame.cpp:
2735         (WebCore::Frame::setDocument):
2736
2737         When a Frame's document changes, inform the client that the attachments in the previous document are going away.
2738         For each attachment currently connected to the document, we have either (1) already informed the client that it
2739         was inserted, or (2) the attachment is pending an insertion call to the client. If (1) is the case, then we'll
2740         tell the client that the attachment is removed, which will balance out the earlier insertion call. If (2) is the
2741         case, then we'll remove the previously inserted attachment identifier from the set of attachment identifiers
2742         pending insertion, and the client won't be informed of insertions or removals.
2743
2744 2018-01-16  Antoine Quint  <graouts@apple.com>
2745
2746         Use traits for animation timing functions
2747         https://bugs.webkit.org/show_bug.cgi?id=181651
2748
2749         Reviewed by Dean Jackson.
2750
2751         Cleaning up Dean's previous patch as suggested by Darin's post-commit review comments. The
2752         downcast function can match const automatically and it's a better style to put the * inside
2753         the downcast call rather than outside.
2754
2755         * css/CSSComputedStyleDeclaration.cpp:
2756         (WebCore::createTimingFunctionValue):
2757         * platform/animation/TimingFunction.cpp:
2758         (WebCore::operator<<):
2759         (WebCore::TimingFunction::transformTime const):
2760         * platform/animation/TimingFunction.h:
2761         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
2762         (WebCore::toCAMediaTimingFunction):
2763
2764 2018-01-16  Philippe Normand  <pnormand@igalia.com>
2765
2766         [GStreamer] Live streaming cleanups
2767         https://bugs.webkit.org/show_bug.cgi?id=181672
2768
2769         Reviewed by Michael Catanzaro.
2770
2771         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2772         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Switch to
2773         streaming code path when no content-length was reported by the
2774         http source element.
2775         (WebCore::MediaPlayerPrivateGStreamer::totalBytes const): Return early when streaming.
2776         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2777         (CachedResourceStreamingClient::responseReceived): Emit headers as
2778         an element message, like souphttpsrc.
2779
2780 2018-01-15  Philippe Normand  <pnormand@igalia.com>
2781
2782         [GStreamer] misc fixes and cleanups
2783         https://bugs.webkit.org/show_bug.cgi?id=181647
2784
2785         Reviewed by Michael Catanzaro.
2786
2787         * platform/graphics/MediaPlayer.cpp:
2788         (WebCore::convertEnumerationToString): New utility function to convert preload enum to string.
2789         * platform/graphics/MediaPlayerEnums.h: Ditto.
2790         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2791         (WebCore::MediaPlayerPrivateGStreamer::load): Debug tweak
2792         (WebCore::MediaPlayerPrivateGStreamer::prepareToPlay): Ditto
2793         (WebCore::MediaPlayerPrivateGStreamer::play): Ditto
2794         (WebCore::MediaPlayerPrivateGStreamer::paused const): Ditto
2795         (WebCore::MediaPlayerPrivateGStreamer::processBufferingStats): Prevent useless state update.
2796         (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired): Ditto.
2797         (WebCore::MediaPlayerPrivateGStreamer::updateStates): Debug tweak.
2798         (WebCore::MediaPlayerPrivateGStreamer::setDownloadBuffering): Ditto.
2799         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2800         Remove useless handlesSyncMessage method.
2801         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2802         (WebCore::MediaPlayerPrivateGStreamerBase::setMuted): Prevent useless state update.
2803         (WebCore::MediaPlayerPrivateGStreamerBase::muted const): Debug tweak.
2804         (WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement): Ditto.
2805         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2806         (webkit_web_src_init): Enable keepAlive by default like in souphttpsrc.
2807         (webKitWebSrcStart): Debug tweak.
2808         (webKitWebSrcQueryWithParent): Ditto.
2809         (webKitWebSrcNeedData): Ditto.
2810         (CachedResourceStreamingClient::responseReceived): Change appsrc
2811         stream-type when we wan't seek. Also update caps like souphttpsrc
2812         does.
2813         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.h: Add forward declaration of MediaPlayer.
2814         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
2815         (WebCore::MediaSourceClientGStreamerMSE::append): Fix compilation warning.
2816
2817 2018-01-16  Yacine Bandou  <yacine.bandou_ext@softathome.com>
2818
2819         [WPE] Two clearkey tests failing since r226621
2820         https://bugs.webkit.org/show_bug.cgi?id=181532
2821
2822         Reviewed by Xabier Rodriguez-Calvar.
2823
2824         Whith a fake initData, we can have a pssh size nul, thus we should check it.
2825         We saw this issue in the subtest "initData longer than 64Kb characters" in
2826         the clearkey-generate-request-disallowed-input layout test.
2827
2828         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
2829         (WebCore::extractKeyidsLocationFromCencInitData):
2830
2831 2018-01-15  Yoav Weiss  <yoav@yoav.ws>
2832
2833         Support for preconnect Link headers
2834         https://bugs.webkit.org/show_bug.cgi?id=181657
2835
2836         Reviewed by Darin Adler.
2837
2838         Move the preconnect functionality into its own function, and
2839         also call this function when Link headers are processed.
2840
2841         Test: http/tests/preconnect/link-header-rel-preconnect-http.php
2842
2843         * loader/LinkLoader.cpp:
2844         (WebCore::LinkLoader::loadLinksFromHeader): Call preconnect.
2845         (WebCore::LinkLoader::preconnect): Preconnect to a host functionality moved here.
2846         (WebCore::LinkLoader::preload): Renamed `preloadIfNeeded` to `preload`.
2847         (WebCore::LinkLoader::loadLink): Call preconnect.
2848         * loader/LinkLoader.h:
2849
2850 2018-01-15  Michael Catanzaro  <mcatanzaro@igalia.com>
2851
2852         Improve use of ExportMacros
2853         https://bugs.webkit.org/show_bug.cgi?id=181652
2854
2855         Reviewed by Konstantin Tokarev.
2856
2857         Remove a comment.
2858
2859         * platform/PlatformExportMacros.h:
2860
2861 2018-01-15  Konstantin Tokarev  <annulen@yandex.ru>
2862
2863         image-rendering should affect scaling of border-image
2864         https://bugs.webkit.org/show_bug.cgi?id=169440
2865
2866         Reviewed by Michael Catanzaro.
2867
2868         Test: fast/borders/border-image-pixelated.html
2869
2870         * rendering/style/NinePieceImage.cpp:
2871         (WebCore::NinePieceImage::paint):
2872
2873 2018-01-15  Tomas Popela  <tpopela@redhat.com>
2874
2875         2.19.3 ACCELERATED_2D_CANVAS support is broken
2876         https://bugs.webkit.org/show_bug.cgi?id=180799
2877
2878         Reviewed by Michael Catanzaro.
2879
2880         * html/canvas/CanvasRenderingContext2DBase.cpp:
2881         (WebCore::CanvasRenderingContext2DBase::didDraw):
2882
2883 2018-01-15  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2884
2885         [Curl] Enable HTTP/2
2886         https://bugs.webkit.org/show_bug.cgi?id=181551
2887
2888         Reviewed by Michael Catanzaro.
2889
2890         Start supporting HTTP/2 protocol. The first step is just enabling the HTTP/2 on Curl backend.
2891         Next step will be to enable multiplexing feature.
2892
2893         No new tests because we don't have HTTP/2 test backend yet.
2894
2895         * platform/network/curl/CurlContext.cpp:
2896         (WebCore::CurlContext::isHttp2Enabled const):
2897         (WebCore::CurlHandle::enableHttp):
2898         (WebCore::CurlHandle::enableHttpGetRequest):
2899         (WebCore::CurlHandle::enableHttpHeadRequest):
2900         (WebCore::CurlHandle::enableHttpPostRequest):
2901         (WebCore::CurlHandle::enableHttpPutRequest):
2902         (WebCore::CurlHandle::setHttpCustomRequest):
2903         * platform/network/curl/CurlContext.h:
2904
2905 2018-01-15  Dean Jackson  <dino@apple.com>
2906
2907         Use a helper function for checked arithmetic in WebGL validation
2908         https://bugs.webkit.org/show_bug.cgi?id=181620
2909         <rdar://problem/36485879>
2910
2911         Reviewed by Eric Carlson.
2912
2913         Eric recommended using a templated helper function to do
2914         a common arithmetic check in WebGL validation.
2915
2916         * html/canvas/WebGL2RenderingContext.cpp:
2917         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative):
2918         * html/canvas/WebGLRenderingContext.cpp:
2919         (WebCore::WebGLRenderingContext::validateIndexArrayConservative):
2920         * html/canvas/WebGLRenderingContextBase.cpp:
2921         (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
2922         (WebCore::WebGLRenderingContextBase::validateDrawArrays):
2923         (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0):
2924         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0):
2925         * html/canvas/WebGLRenderingContextBase.h:
2926         (WebCore::WebGLRenderingContextBase::checkedAddAndMultiply): New helper.
2927
2928 2018-01-15  Dean Jackson  <dino@apple.com>
2929
2930         Use traits for animation timing functions
2931         https://bugs.webkit.org/show_bug.cgi?id=181651
2932         <rdar://problem/36525328>
2933
2934         Reviewed by Antoine Quint.
2935
2936         Use the type traits for TimingFunction classes, so
2937         we can is<> and downcast<>.
2938
2939         * css/CSSComputedStyleDeclaration.cpp:
2940         (WebCore::createTimingFunctionValue):
2941         * platform/animation/TimingFunction.cpp:
2942         (WebCore::TimingFunction::transformTime const):
2943         * platform/animation/TimingFunction.h:
2944         * platform/graphics/ca/GraphicsLayerCA.cpp:
2945         (WebCore::animationHasStepsTimingFunction):
2946         (WebCore::animationHasFramesTimingFunction):
2947         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
2948         (WebCore::toCAMediaTimingFunction):
2949
2950 2018-01-15  Youenn Fablet  <youenn@apple.com>
2951
2952         RealtimeMediaSource should be ThreadSafeRefCounted
2953         https://bugs.webkit.org/show_bug.cgi?id=181649
2954
2955         Reviewed by Eric Carlson.
2956
2957         Difficult to write a test as this is really racy.
2958         RealtimeIncomingVideoSourceCocoa::OnFrame is taking a reference on a background thread
2959         to send a task to the main thread.
2960         This requires it to be thread safe ref counted.
2961
2962         * platform/mediastream/RealtimeMediaSource.h:
2963
2964 2018-01-15  Philippe Normand  <pnormand@igalia.com>
2965
2966         Prevent useless MediaPlayer mute state notifications
2967         https://bugs.webkit.org/show_bug.cgi?id=181646
2968
2969         Reviewed by Carlos Garcia Campos.
2970
2971         On GTK port the mute change notification was triggering the test
2972         runner to think the whole page mute state had changed and that
2973         media elements were muted. The simplest solution is to propagate
2974         the notification only if the state actually changed.
2975
2976         * platform/graphics/MediaPlayer.cpp:
2977         (WebCore::MediaPlayer::muteChanged): Propagate mute notification
2978         only if the mute state actually changed.
2979
2980 2018-01-15  Sebastian Dröge  <sebastian@centricular.com>
2981
2982         [GStreamer] Don't wait for draw condition variable when shutting down.
2983         https://bugs.webkit.org/show_bug.cgi?id=180978
2984
2985         Reviewed by Carlos Garcia Campos.
2986
2987         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2988         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
2989         (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
2990         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2991         By also waiting for the draw condition variable while shutting down,
2992         it is possible that the GStreamer video sink is waiting for the main
2993         thread to actually render the current frame, while at the same time
2994         the main thread is waiting for the GStreamer video sink to shut down,
2995         resulting in a deadlock.
2996
2997 2018-01-13  Minsheng Liu  <lambda@liu.ms>
2998
2999         MathML Lengths should take zoom level into account
3000         https://bugs.webkit.org/show_bug.cgi?id=180029
3001
3002         Reviewed by Frédéric Wang.
3003
3004         The patch applies the effective zoom factor to physical units in toUserUnits().
3005
3006         Test: mathml/presentation/mspace-units-with-zoom.html
3007
3008         * rendering/mathml/RenderMathMLBlock.cpp:
3009         (WebCore::toUserUnits):
3010
3011 2018-01-12  Chris Dumez  <cdumez@apple.com>
3012
3013         ASSERTION FAILED: registration || isTerminating() in WebCore::SWServerWorker::skipWaiting()
3014         https://bugs.webkit.org/show_bug.cgi?id=181603
3015         <rdar://problem/36476050>
3016
3017         Reviewed by Youenn Fablet.
3018
3019         No new tests, covered by existing tests that crash flakily.
3020
3021         * workers/service/server/SWServer.cpp:
3022         (WebCore::SWServer::terminateWorkerInternal):
3023         If the connection to the context process is gone, make sure we make the worker as terminated
3024         so that it does not stay in Running state and in SWServer::m_runningOrTerminatingWorkers.
3025
3026         * workers/service/server/SWServerRegistration.cpp:
3027         (WebCore::SWServerRegistration::~SWServerRegistration):
3028         Add assertions to make sure none of the registration's workers are still running when
3029         the registration is destroyed.
3030
3031         (WebCore::SWServerRegistration::updateRegistrationState):
3032         Make sure registration workers that are overwritten are not still running.
3033
3034         * workers/service/server/SWServerWorker.cpp:
3035         (WebCore::SWServerWorker::setState):
3036         If a worker's state is set to redundant, make sure we also terminate it.
3037
3038 2018-01-12  Commit Queue  <commit-queue@webkit.org>
3039
3040         Unreviewed, rolling out r226927.
3041         https://bugs.webkit.org/show_bug.cgi?id=181621
3042
3043         Breaks 32-bit and iOS release for some reason that i don't
3044         understand yet (Requested by dino on #webkit).
3045
3046         Reverted changeset:
3047
3048         "Use a helper function for checked arithmetic in WebGL
3049         validation"
3050         https://bugs.webkit.org/show_bug.cgi?id=181620
3051         https://trac.webkit.org/changeset/226927
3052
3053 2018-01-12  Myles C. Maxfield  <mmaxfield@apple.com>
3054
3055         Data URL fonts split in the middle of an alphabet cause random letters to disappear
3056         https://bugs.webkit.org/show_bug.cgi?id=175845
3057         <rdar://problem/33996578>
3058
3059         Reviewed by Brent Fulgham.
3060
3061         It is fairly common practice for a font foundry to split a font up into two files such that a semi-random
3062         half of the alphabet is present in one of the files, and the other half is present in the other file. This
3063         practice involves representing the files as data URLs, so as to minimize the time it takes to load them.
3064
3065         Because resource loading is asynchronous (even for data URLs), it is possible today to get a paint after
3066         the first file is loaded but before the second file is loaded. Indeed, because of the way font fallback
3067         works, we will never start loading the second file until a layout has occurred with the first font.
3068
3069         Because a site usually only uses this pattern for a handful of fonts, and I've never seen this pattern
3070         being used for CJK fonts, it isn't very expensive to opportunistically decode these data URLs eagerly.
3071         Using this method doesn't actually guarantee that the two fonts will load in between successive paints,
3072         but it at least makes this much more likely. This patch implements this strategy, along with a size
3073         threshold to make sure that we won't decode any super large data URLs when it isn't necessary.
3074
3075         Test: fast/text/font-load-data-partitioned-alphabet.html
3076
3077         * css/CSSFontFace.cpp:
3078         (WebCore::CSSFontFace::opportunisticallyStartFontDataURLLoading):
3079         * css/CSSFontFace.h:
3080         * css/CSSFontFaceSource.cpp:
3081         (WebCore::CSSFontFaceSource::opportunisticallyStartFontDataURLLoading):
3082         * css/CSSFontFaceSource.h:
3083         * css/CSSFontSelector.cpp:
3084         (WebCore::CSSFontSelector::opportunisticallyStartFontDataURLLoading):
3085         * css/CSSFontSelector.h:
3086         * platform/graphics/FontCascadeFonts.cpp:
3087         (WebCore::opportunisticallyStartFontDataURLLoading):
3088         (WebCore::FontCascadeFonts::glyphDataForVariant):
3089         * platform/graphics/FontSelector.h:
3090
3091 2018-01-12  Alex Christensen  <achristensen@webkit.org>
3092
3093         History state should be updated during client redirects with asynchronous policy decisions
3094         https://bugs.webkit.org/show_bug.cgi?id=181358
3095         <rdar://problem/35547689>
3096
3097         Reviewed by Andy Estes.
3098
3099         When decidePolicyForNavigationAction is responded to asynchronously during a client redirect, 
3100         HistoryController::updateForRedirectWithLockedBackForwardList does not update the history because
3101         the document loader has not been marked as a client redirect because the FrameLoader only looks
3102         at its provisional document loader to mark it as a client redirect.  When decidePolicyForNavigationAction
3103         is responded to asynchronously, though, the FrameLoader's provisional document loader has moved to 
3104         its policy document loader.  To get both asynchronous and synchronous cases, let's just mark the document
3105         loader as a client redirect whether it's the provisional or policy document loader.
3106
3107         Covered by a new API test.
3108
3109         * loader/FrameLoader.cpp:
3110         (WebCore::FrameLoader::loadURL):
3111         (WebCore::FrameLoader::loadPostRequest):
3112
3113 2018-01-12  Dean Jackson  <dino@apple.com>
3114
3115         Use a helper function for checked arithmetic in WebGL validation
3116         https://bugs.webkit.org/show_bug.cgi?id=181620
3117         <rdar://problem/36485879>
3118
3119         Reviewed by Eric Carlson.
3120
3121         Eric recommended using a templated helper function to do
3122         a common arithmetic check in WebGL validation.
3123
3124         * html/canvas/WebGL2RenderingContext.cpp:
3125         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative):
3126         * html/canvas/WebGLRenderingContext.cpp:
3127         (WebCore::WebGLRenderingContext::validateIndexArrayConservative):
3128         * html/canvas/WebGLRenderingContextBase.cpp:
3129         (WebCore::WebGLRenderingContextBase::checkedAddAndMultiply): New helper.
3130         (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
3131         (WebCore::WebGLRenderingContextBase::validateDrawArrays):
3132         (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0):
3133         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0):
3134         * html/canvas/WebGLRenderingContextBase.h:
3135
3136 2018-01-12  Myles C. Maxfield  <mmaxfield@apple.com>
3137
3138         [Cocoa] CTFontCopyDefaultCascadeListForLanguages() can return nullptr
3139         https://bugs.webkit.org/show_bug.cgi?id=181615
3140         <rdar://problem/36334637>
3141
3142         Reviewed by Jon Lee.
3143
3144         Speculative fix. We are getting crash reports saying that this call can return nullptr, and we
3145         don't check for it.
3146
3147         No new tests because I couldn't find the specific input that causes it to return nullptr. (I
3148         tried running this code with every 0, 1, and 2 length locale string, every weight value, and
3149         every italic value, and couldn't get it to crash. I also inspected the code to figure out what
3150         values would cause it to return nullptr, and I couldn't find anything other than if the system
3151         has a totally busted font setup.)
3152
3153         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
3154         (WebCore::SystemFontDatabase::computeCascadeList):
3155
3156 2018-01-11  Dean Jackson  <dino@apple.com>
3157
3158         [WebGL] Simulated vertexAttrib0 can sometimes cause OUT_OF_MEMORY errors
3159         https://bugs.webkit.org/show_bug.cgi?id=181558
3160         <rdar://problem/36189833>
3161
3162         Reviewed by Eric Carlson.
3163
3164         Very large element indices in the ELEMENT_ARRAY_BUFFER meant that
3165         our simulated vertexAttrib0 buffer might be too large. We need
3166         to check for out-of-memory, but we can also detect some of the issues
3167         earlier in our validation code. Additionally, make sure that we don't
3168         accidentally cast an unsigned to a signed.
3169
3170         Test: fast/canvas/webgl/simulated-vertexAttrib0-invalid-indicies.html
3171
3172         * html/canvas/WebGL2RenderingContext.cpp:
3173         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative): Update validation
3174         code to look for overflow, rather than relying on looking for sign changes.
3175         * html/canvas/WebGLRenderingContext.cpp:
3176         (WebCore::WebGLRenderingContext::validateIndexArrayConservative): Ditto.
3177         * html/canvas/WebGLRenderingContextBase.cpp:
3178         (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
3179         (WebCore::WebGLRenderingContextBase::drawArrays): Check that we were able to simulate.
3180         (WebCore::WebGLRenderingContextBase::drawElements):
3181         (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0): Update validation code, and
3182         use GC3Duint, since that's what the indicies are.
3183         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): Ditto.
3184         (WebCore::WebGLRenderingContextBase::drawArraysInstanced): Check that we were able to simulate.
3185         (WebCore::WebGLRenderingContextBase::drawElementsInstanced):
3186         * html/canvas/WebGLRenderingContextBase.h:
3187
3188 2018-01-12  Wenson Hsieh  <wenson_hsieh@apple.com>
3189
3190         Large in-place attachment elements cause the document width to expand when inserted
3191         https://bugs.webkit.org/show_bug.cgi?id=181614
3192
3193         Reviewed by Dan Bernstein.
3194
3195         Make in-place images and videos have a max-width of 100%, so that large attachments aren't inserted with full
3196         display size, causing the document and viewport width to expand.
3197
3198         * html/HTMLAttachmentElement.cpp:
3199         (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary):
3200
3201 2018-01-12  Keith Rollin  <krollin@apple.com>
3202
3203         Logged JSON should escape "'s and \'s in strings.
3204         https://bugs.webkit.org/show_bug.cgi?id=181608
3205
3206         Reviewed by Brent Fulgham.
3207
3208         No new tests -- no new functionality, just changed logging. The
3209         efficacy of the logging was verified by inspecting its output.
3210
3211         * loader/ResourceLoadObserver.cpp:
3212         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
3213
3214 2018-01-12  Dean Jackson  <dino@apple.com>
3215
3216         drawElements should be invalid if vertexAttrib0 doesn't have data
3217         https://bugs.webkit.org/show_bug.cgi?id=181609
3218         <rdar://problem/36392883>
3219
3220         Reviewed by Antoine Quint.
3221
3222         If a vertex attribute has been enabled, but no data provided, then
3223         draw validation should fail.
3224
3225         Test: fast/canvas/webgl/drawElements-empty-vertex-data.html
3226
3227         * html/canvas/WebGLRenderingContextBase.cpp:
3228         (WebCore::WebGLRenderingContextBase::validateVertexAttributes): If there were
3229         never any data in the vertex buffer, then we incorrectly compared with 0.
3230
3231 2018-01-12  Youenn Fablet  <youenn@apple.com>
3232
3233         FormDataElement::lengthInBytes should use ThreadableBlobRegistry
3234         https://bugs.webkit.org/show_bug.cgi?id=181554
3235
3236         Reviewed by Chris Dumez.
3237
3238         Covered by updated test.
3239
3240         Fix blobRegistry() use and add support for creating a response that may trigger the issue.
3241
3242
3243         * platform/network/FormData.cpp:
3244         (WebCore::FormDataElement::lengthInBytes const): Was using directly blobRegistry() while ThreadableBlobRegistry is more appropriate
3245         in case this is called from workers.
3246         * Modules/fetch/FetchBody.h:
3247         * Modules/fetch/FetchResponse.h:
3248         * fileapi/Blob.h:
3249         * testing/ServiceWorkerInternals.cpp:
3250         (WebCore::ServiceWorkerInternals::createOpaqueWithBlobBodyResponse):
3251         * testing/ServiceWorkerInternals.h:
3252         * testing/ServiceWorkerInternals.idl:
3253
3254 2018-01-12  Jer Noble  <jer.noble@apple.com>
3255
3256         Wrap CDMFairPlayStreaming and related classes in ENABLE(ENCRYPTED_MEDIA) checks
3257         https://bugs.webkit.org/show_bug.cgi?id=181602
3258
3259         Reviewed by Maciej Stachowiak.
3260
3261         * platform/graphics/avfoundation/CDMFairPlayStreaming.h:
3262         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
3263         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
3264
3265 2018-01-12  Youenn Fablet  <youenn@apple.com>
3266
3267         WebProcess should pass the registration identifier and not the worker identifier for fetch events
3268         https://bugs.webkit.org/show_bug.cgi?id=181591
3269
3270         Reviewed by Chris Dumez.
3271
3272         Test: http/wpt/service-workers/update-service-worker.https.html
3273
3274         Store service worker registration identifier in ResourceLoaderOptions instead of service worker identifier.
3275
3276         * loader/DocumentThreadableLoader.cpp:
3277         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
3278         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
3279         * loader/ResourceLoaderOptions.h:
3280         * loader/WorkerThreadableLoader.cpp:
3281         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
3282         * loader/cache/CachedResourceLoader.cpp:
3283         (WebCore::CachedResourceLoader::prepareFetch):
3284         (WebCore::CachedResourceLoader::determineRevalidationPolicy const):
3285         * loader/cache/CachedResourceRequest.cpp:
3286         (WebCore::CachedResourceRequest::setSelectedServiceWorkerRegistrationIdentifierIfNeeded):
3287         (WebCore::CachedResourceRequest::setNavigationServiceWorkerRegistrationData):
3288         (WebCore::CachedResourceRequest::setSelectedServiceWorkerIdentifierIfNeeded): Deleted.
3289         * loader/cache/CachedResourceRequest.h:
3290         * workers/WorkerScriptLoader.cpp:
3291         (WebCore::WorkerScriptLoader::loadSynchronously):
3292         (WebCore::WorkerScriptLoader::loadAsynchronously):
3293         * workers/service/server/SWServer.cpp:
3294         (WebCore::SWServer::activeWorkerFromRegistrationID):
3295         * workers/service/server/SWServer.h:
3296
3297 2018-01-12  Fujii Hironori  <Hironori.Fujii@sony.com>
3298
3299         [Win][CMake] Remove all-in-one file for WebCore DerivedSources
3300         https://bugs.webkit.org/show_bug.cgi?id=181582
3301
3302         Reviewed by Alex Christensen.
3303
3304         Those source files are compiled in unified source build nowadays.
3305
3306         No new tests (No behavior change)
3307
3308         * CMakeLists.txt: Removed calling PROCESS_ALLINONE_FILE.
3309         * DerivedSources.cpp: Removed.
3310         * WebCoreMacros.cmake: Removed a macro PROCESS_ALLINONE_FILE.
3311
3312 2018-01-12  Fujii Hironori  <Hironori.Fujii@sony.com>
3313
3314         [WinCairo][CMake] Use ${CURL_LIBRARY} instead of specifying the library name libcurl_imp explicitly
3315         https://bugs.webkit.org/show_bug.cgi?id=181578
3316
3317         Reviewed by Alex Christensen.
3318
3319         vcpkg has libcurl.lib, not libcurl_imp.lib.
3320
3321         No new tests because no behavior change.
3322
3323         * PlatformWinCairo.cmake: Link ${CURL_LIBRARY} instead of libcurl_imp.
3324
3325 2018-01-12  Jer Noble  <jer.noble@apple.com>
3326
3327         WebGL video texture black in Safari 11.0.2 and wrong colored in Safari Preview 11.1
3328         https://bugs.webkit.org/show_bug.cgi?id=181445
3329         <rdar://problem/36383183>
3330
3331         Reviewed by Dean Jackson.
3332
3333         Tests: added compile-time correctness tests for YCbCrMatrix values.
3334
3335         Perform the derivation from YCbCr coefficients into matrices in constexpr expressions
3336         at compile-time. This allows us to also perform compile-time correctness checks to catch
3337         regressions which may cause incorrect color conversions.
3338
3339         Since we now have general-purpose derivation of matrix values from coefficients,
3340         adding missing specificed matrices is trivial, so add support for SMPTE 240M and BT.2020
3341         matrices.
3342
3343         * platform/graphics/cv/VideoTextureCopierCV.cpp:
3344         (WebCore::GLfloatColor::GLfloatColor):
3345         (WebCore::GLfloatColor::abs):
3346         (WebCore::GLfloatColor::isApproximatelyEqualTo const):
3347         (WebCore::YCbCrMatrix::operator Vector<GLfloat> const):
3348         (WebCore::YCbCrMatrix::YCbCrMatrix):
3349         (WebCore::YCbCrMatrix::operator* const):
3350         (WebCore::YCbCrToRGBMatrixForRangeAndTransferFunction):
3351
3352 2018-01-12  Antoine Quint  <graouts@apple.com>
3353
3354         Add support for the frames() timing function
3355         https://bugs.webkit.org/show_bug.cgi?id=181585
3356         <rdar://problem/36463317>
3357
3358         Reviewed by Dean.
3359
3360         Implement the frames() timing function as specified in the CSS Timing Functions Level 1
3361         specification, specifically https://www.w3.org/TR/css-timing-1/#frames-timing-functions.
3362         A frames timing function is a type of timing function that divides the input time into a
3363         specified number of intervals of equal length.
3364
3365         Test: transitions/frames-timing-function.html
3366
3367         * css/CSSComputedStyleDeclaration.cpp:
3368         (WebCore::createTimingFunctionValue):
3369         * css/CSSTimingFunctionValue.cpp:
3370         (WebCore::CSSFramesTimingFunctionValue::customCSSText const):
3371         (WebCore::CSSFramesTimingFunctionValue::equals const):
3372         * css/CSSTimingFunctionValue.h:
3373         * css/CSSToStyleMap.cpp:
3374         (WebCore::CSSToStyleMap::mapAnimationTimingFunction):
3375         * css/CSSValue.cpp:
3376         (WebCore::CSSValue::equals const):
3377         (WebCore::CSSValue::cssText const):
3378         (WebCore::CSSValue::destroy):
3379         * css/CSSValue.h:
3380         (WebCore::CSSValue::isFramesTimingFunctionValue const):
3381         * css/CSSValueKeywords.in:
3382         * css/parser/CSSPropertyParser.cpp:
3383         (WebCore::consumeSteps):
3384         (WebCore::consumeFrames):
3385         (WebCore::consumeAnimationTimingFunction):
3386         * platform/animation/TimingFunction.cpp:
3387         (WebCore::operator<<):
3388         (WebCore::TimingFunction::transformTime const):
3389         * platform/animation/TimingFunction.h:
3390         (WebCore::TimingFunction::isFramesTimingFunction const):
3391         * platform/graphics/ca/GraphicsLayerCA.cpp:
3392         (WebCore::animationHasFramesTimingFunction):
3393         (WebCore::GraphicsLayerCA::animationCanBeAccelerated const):
3394
3395 2018-01-12  Commit Queue  <commit-queue@webkit.org>
3396
3397         Unreviewed, rolling out r226721.
3398         https://bugs.webkit.org/show_bug.cgi?id=181583
3399
3400         Lets do a slightly different fix (Requested by anttik on
3401         #webkit).
3402
3403         Reverted changeset:
3404
3405         "REGRESSION(r225650): The scores of MotionMark tests Multiply
3406         and Leaves dropped by 8%"
3407         https://bugs.webkit.org/show_bug.cgi?id=181460
3408         https://trac.webkit.org/changeset/226721
3409
3410 2018-01-11  Keith Miller  <keith_miller@apple.com>