50f5d9106f4914c132c3564b8f1faa1b47c3edec
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-12-18  Chris Dumez  <cdumez@apple.com>
2
3         ExtendableMessageEvent constructor fails to initialize the 'source' attribute
4         https://bugs.webkit.org/show_bug.cgi?id=180954
5
6         Reviewed by Youenn Fablet.
7
8         No new tests, rebaselined existing test.
9
10         * workers/service/ExtendableMessageEvent.cpp:
11         (WebCore::ExtendableMessageEvent::ExtendableMessageEvent):
12
13 2017-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
14
15         [Attachment Support] Insert images as inline attachments when pasting and dropping
16         https://bugs.webkit.org/show_bug.cgi?id=180853
17         <rdar://problem/35756268>
18
19         Reviewed by Tim Horton.
20
21         Adds support for transforming dropped and pasted web content fragments prior to insertion, such that inline
22         elements (so far, only images) are replaced with attachment elements that have an inline representation. See
23         below comments for more detail.
24
25         Tests: WKAttachmentTests.InsertPastedImageAsAttachment
26                WKAttachmentTests.InsertPastedAttributedStringContainingImage
27                WKAttachmentTestsMac.InsertPastedFileURLsAsAttachments
28                WKAttachmentTestsIOS.InsertDroppedImageAsAttachment
29                WKAttachmentTestsIOS.InsertDroppedAttributedStringContainingAttachment
30
31         * editing/WebContentReader.h:
32         * editing/cocoa/EditorCocoa.mm:
33         (WebCore::Editor::replaceSelectionWithAttributedString):
34
35         Add a new helper to replace elements in a DOM fragment with inline attachment elements instead, using the given
36         Blobs. So far, we only replace image elements with these attachments, by mapping the source of each image to a
37         Blob, and constructing a replacement attachment backed by a File constructed from the image's corresponding
38         Blob. However, this mechanism can be generalized in the future to handle transformations from arbitrary elements
39         to attachment elements capable of representing the same elements using inline display mode.
40
41         This function is a noop if the attachment elements are disabled via runtime-enabled features.
42
43         * editing/cocoa/WebContentReaderCocoa.mm:
44         (WebCore::replaceRichContentWithAttachmentsIfNecessary):
45         (WebCore::createFragmentAndAddResources):
46         (WebCore::sanitizeMarkupWithArchive):
47
48         Add out-params to both of these helper functions that capture the map of blob URLs to Blobs being used to
49         replace subresource URLs in the pasted/dropped DOM fragment.
50
51         (WebCore::WebContentReader::readWebArchive):
52         (WebCore::WebContentMarkupReader::readWebArchive):
53         (WebCore::createFragmentFromAttributedString):
54         (WebCore::WebContentReader::readRTFD):
55         (WebCore::WebContentMarkupReader::readRTFD):
56         (WebCore::WebContentReader::readRTF):
57         (WebCore::WebContentMarkupReader::readRTF):
58         (WebCore::WebContentReader::readImage):
59
60         In these places where we swap out subresource URLs for blob URLs, collect a map of blob URL => Blob, and use it
61         to replace images in the DOM with attachments (if needed, and possible).
62
63         * editing/mac/WebContentReaderMac.mm:
64         (WebCore::WebContentReader::readFilenames):
65
66         Augment existing logic to generate attachment elements when pasting or dropping file URLs, so that the generated
67         attachment elements also have titles, subtitles, and content type information.
68
69         * html/HTMLAttachmentElement.cpp:
70         (WebCore::HTMLAttachmentElement::setFile):
71
72         Add an optional second param, UpdateDisplayAttributes. If UpdateDisplayAttributes::Yes is passed in, then we set
73         the elements's attributes that are displayed in the attachment representation (title, subtitle, and type) using
74         the given File.
75
76         (WebCore::HTMLAttachmentElement::updateFileWithData):
77         (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary):
78
79         Make a small tweak to correctly handle the case where an attachment with a content type that is a UTI is being
80         displayed inline. Content type can either be a UTI or a MIME type, but the code to construct the shadow tree of
81         an attachment element only handles MIME types.
82
83         * html/HTMLAttachmentElement.h:
84
85 2017-12-18  Youenn Fablet  <youenn@apple.com>
86
87         SameOrigin and CORS fetch should fail on opaque responses served from ServiceWorker
88         https://bugs.webkit.org/show_bug.cgi?id=180941
89
90         Reviewed by Chris Dumez.
91
92         Covered by rebased tests.
93
94         * loader/SubresourceLoader.cpp:
95         (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl):
96
97 2017-12-18  Dean Jackson  <dino@apple.com>
98
99         Make some functions in GraphicsContextCG use call_once for statics
100         https://bugs.webkit.org/show_bug.cgi?id=180841
101         <rdar://problem/36058448>
102
103         Reviewed by Antoine Quint.
104
105         In preparation for making OffscreenCanvas operate inside a Worker,
106         make sure GraphicsContext is thread safe. Change some functions
107         that use a static to call_once.
108
109         * platform/graphics/cg/GraphicsContextCG.cpp:
110         (WebCore::sRGBColorSpaceRef):
111         (WebCore::linearRGBColorSpaceRef):
112         (WebCore::extendedSRGBColorSpaceRef):
113         (WebCore::displayP3ColorSpaceRef):
114
115 2017-12-18  Chris Dumez  <cdumez@apple.com>
116
117         ExtendableMessageEvent.data should return the value it was initialized to
118         https://bugs.webkit.org/show_bug.cgi?id=180868
119
120         Reviewed by Geoffrey Garen.
121
122         No new tests, rebaselined existing test.
123
124         * bindings/js/JSExtendableMessageEventCustom.cpp:
125         (WebCore::constructJSExtendableMessageEvent):
126         * workers/service/ExtendableMessageEvent.cpp:
127         (WebCore::ExtendableMessageEvent::ExtendableMessageEvent):
128         * workers/service/ExtendableMessageEvent.idl:
129
130 2017-12-18  Megan Gardner  <megan_gardner@apple.com>
131
132         Support Autoscrolling in contenteditable for WK2
133         https://bugs.webkit.org/show_bug.cgi?id=180789
134
135         Reviewed by Simon Frasier and Wenson Hsieh..
136
137         Activate the autoscrollController to scroll to the position provided to us by the
138         UIProcess. Allows for scrolling in contentEditable for WebKit2
139
140         Test: fast/events/touch/ios/drag-to-autoscroll-in-single-line-editable.html
141
142         * page/AutoscrollController.cpp:
143         (WebCore::AutoscrollController::autoscrollTimerFired):
144         * page/EventHandler.cpp:
145         (WebCore::EventHandler::clearOrScheduleClearingLatchedStateIfNeeded):
146         (WebCore::EventHandler::targetPositionForSelectionAutoscroll const):
147         (WebCore::EventHandler::shouldUpdateAutoscroll):
148         (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll const): Deleted.
149         * page/EventHandler.h:
150         * page/ios/EventHandlerIOS.mm:
151         (WebCore::EventHandler::startTextAutoscroll):
152         (WebCore::EventHandler::cancelTextAutoscroll):
153         (WebCore::EventHandler::targetPositionForSelectionAutoscroll const):
154         (WebCore::EventHandler::shouldUpdateAutoscroll):
155         * page/mac/EventHandlerMac.mm:
156         (WebCore::EventHandler::targetPositionForSelectionAutoscroll const):
157         (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll const): Deleted.
158
159 2017-12-18  Youenn Fablet  <youenn@apple.com>
160
161         Add support for response blob given to fetch events
162         https://bugs.webkit.org/show_bug.cgi?id=180894
163
164         Reviewed by Darin Adler.
165
166         Covered by updated test expectations.
167
168         Adding support for getting a blob URL from a FormData that only contains one blob.
169         Adding support to create a FetcLoader from a ServiceWorkerThreadProxy
170
171         * Modules/fetch/FetchLoader.cpp:
172         (WebCore::FetchLoader::start):
173         (WebCore::FetchLoader::startLoadingBlobURL):
174         * Modules/fetch/FetchLoader.h:
175         * WebCore.xcodeproj/project.pbxproj:
176         * platform/network/FormData.cpp:
177         (WebCore::FormData::asBlobURL const):
178         * platform/network/FormData.h:
179         * workers/service/context/ServiceWorkerThreadProxy.cpp:
180         (WebCore::ServiceWorkerThreadProxy::createBlobLoader):
181         * workers/service/context/ServiceWorkerThreadProxy.h:
182
183 2017-12-18  Zalan Bujtas  <zalan@apple.com>
184
185         [SVG] Detach list wrappers before resetting the base value.
186         https://bugs.webkit.org/show_bug.cgi?id=180912
187         <rdar://problem/36017970>
188
189         Reviewed by Simon Fraser.
190
191         Before resetting the animation value (and destroying the assigned SVG object -SVGLengthValue in this case),
192         we need to check if there's an associated tear off wrapper for the said SVG object and make a copy of it.
193         This is currently done in the wrong order through animValDidChange.
194
195         Test: svg/animations/crash-when-animation-is-running-while-getting-value.html
196
197         * svg/SVGAnimatedTypeAnimator.h:
198         (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValue):
199         * svg/properties/SVGAnimatedPropertyTearOff.h:
200         * svg/properties/SVGAnimatedStaticPropertyTearOff.h:
201         (WebCore::SVGAnimatedStaticPropertyTearOff::synchronizeWrappersIfNeeded):
202
203 2017-12-18  Brady Eidson  <beidson@apple.com>
204
205         REGRESSION: ASSERTION FAILED: !m_importCompleted
206         https://bugs.webkit.org/show_bug.cgi?id=180935
207
208         Unreviewed bot gardening.
209
210         No new tests (Covered by existing tests)
211
212         The ASSERT was invalid for database pushes failing to open databases like this, so skip it for that scenario.
213
214         * workers/service/server/RegistrationStore.cpp:
215         (WebCore::RegistrationStore::databaseFailedToOpen):
216         * workers/service/server/SWServer.cpp:
217         (WebCore::SWServer::registrationStoreDatabaseFailedToOpen):
218         * workers/service/server/SWServer.h:
219
220 2017-12-18  Jer Noble  <jer.noble@apple.com>
221
222         Playing media elements which call "pause(); play()" will have the play promise rejected.
223         https://bugs.webkit.org/show_bug.cgi?id=180781
224
225         Reviewed by Eric Carlson.
226
227         Test: media/video-pause-play-resolve.html
228
229         When scheduling a rejection or resolution of existing play promises, move() the existing
230         promises into the block. This ensures that valid promises aren't added to the play promise
231         vector between when a rejection is scheduled and when it runs.
232
233         Drive-by fix: Don't return false from playInternal() just so the newly created promise will
234         get rejected. The pause() command will reject the promise, so just make sure it's added to
235         the m_pendingPlayPromises before calling playInternal().
236
237         Drive-by fix #2: The spec referenced by playInternal() and pauseInternal() doesn't say to
238         call the "Media Element Load Algorithm" (i.e., prepareForLoad()); it says to call the
239         "Resource Selection Algorithm" (i.e., selectMediaResource()). But fixing this bug caused
240         an assertion crash when the resource selection task was fired and m_player was null. This
241         was because the algorithm is being run at stop() time due to stop() calling pause(). The
242         solution to this ASSERT is to stop the m_resourceSelectionTaskQueue in stop().
243
244         * html/HTMLMediaElement.cpp:
245         (WebCore::HTMLMediaElement::scheduleRejectPendingPlayPromises):
246         (WebCore::HTMLMediaElement::rejectPendingPlayPromises):
247         (WebCore::HTMLMediaElement::resolvePendingPlayPromises):
248         (WebCore::HTMLMediaElement::scheduleNotifyAboutPlaying):
249         (WebCore::HTMLMediaElement::notifyAboutPlaying):
250         (WebCore::HTMLMediaElement::noneSupported):
251         (WebCore::HTMLMediaElement::cancelPendingEventsAndCallbacks):
252         (WebCore::HTMLMediaElement::play):
253         (WebCore::HTMLMediaElement::playInternal):
254         (WebCore::HTMLMediaElement::pauseInternal):
255         (WebCore::HTMLMediaElement::stop):
256         * html/HTMLMediaElement.h:
257
258 2017-12-18  Daniel Bates  <dabates@apple.com>
259
260         Add SPI to query for the current and last auto fill button type and pass user data object to _webView:focusShouldStartInputSession:
261         https://bugs.webkit.org/show_bug.cgi?id=180774
262         <rdar://problem/36033832>
263
264         Reviewed by Tim Horton.
265
266         Expose a way for an embedding client to query for the auto fill button type of a specific
267         input element as it may not be feasible for a client to track such state themselves. For
268         similar reasons track and expose SPI to query for the last auto fill button type for a
269         specific field.
270
271         Test: fast/forms/auto-fill-button/last-auto-fill-button-type.html
272
273         * html/HTMLInputElement.cpp:
274         (WebCore::HTMLInputElement::HTMLInputElement):
275         (WebCore::HTMLInputElement::setShowAutoFillButton):
276         Update the last auto fill button type.
277
278         * html/HTMLInputElement.h:
279         (WebCore::HTMLInputElement::lastAutoFillButtonType const): Added.
280
281         * testing/Internals.cpp:
282         (WebCore::toAutoFillButtonType):
283         (WebCore::toInternalsAutoFillButtonType):
284         (WebCore::Internals::autoFillButtonType):
285         (WebCore::Internals::lastAutoFillButtonType):
286         * testing/Internals.h:
287         * testing/Internals.idl:
288         Add functions for testing.
289
290 2017-12-17  John Wilander  <wilander@apple.com>
291
292         Storage Access API: Make document.hasStorageAccess() retrieve current status from the network process
293         https://bugs.webkit.org/show_bug.cgi?id=180681
294         <rdar://problem/35982161>
295
296         Reviewed by Alex Christensen.
297
298         Tests: http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction.html
299                http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html
300
301         This change makes an asynchronous request to the network process
302         to see if storage access has been granted for this frame, on this
303         page, for this domain.
304
305         * dom/Document.cpp:
306         (WebCore::Document::hasStorageAccess):
307         * page/ChromeClient.h:
308
309 2017-12-17  Chris Dumez  <cdumez@apple.com>
310
311         Strip fragment identifier from ServiceWorker's scriptURL
312         https://bugs.webkit.org/show_bug.cgi?id=180887
313
314         Reviewed by Darin Adler.
315
316         Strip fragment identifier from ServiceWorker's scriptURL to match Firefox and Chrome.
317         This behavior does not appear to be specified so I filed:
318         - https://github.com/w3c/ServiceWorker/issues/1249
319
320         No new tests, rebaselined existing test.
321
322         * workers/service/server/SWServerWorker.cpp:
323         (WebCore::m_script):
324
325 2017-12-17  Antti Koivisto  <antti@apple.com>
326
327         Move render tree updating related files under rendering/updating/
328         https://bugs.webkit.org/show_bug.cgi?id=180918
329
330         Reviewed by Darin Adler.
331
332         * CMakeLists.txt:
333         * Sources.txt:
334         * WebCore.xcodeproj/project.pbxproj:
335         * rendering/RenderTreeBuilder.cpp: Removed.
336         * rendering/RenderTreeBuilder.h: Removed.
337         * rendering/updating: Added.
338         * rendering/updating/RenderTreeBuilder.cpp: Copied from Source/WebCore/rendering/RenderTreeBuilder.cpp.
339         * rendering/updating/RenderTreeBuilder.h: Copied from Source/WebCore/rendering/RenderTreeBuilder.h.
340         * rendering/updating/RenderTreePosition.cpp: Copied from Source/WebCore/style/RenderTreePosition.cpp.
341         * rendering/updating/RenderTreePosition.h: Copied from Source/WebCore/style/RenderTreePosition.h.
342         * rendering/updating/RenderTreeUpdater.cpp: Copied from Source/WebCore/style/RenderTreeUpdater.cpp.
343         * rendering/updating/RenderTreeUpdater.h: Copied from Source/WebCore/style/RenderTreeUpdater.h.
344         * rendering/updating/RenderTreeUpdaterFirstLetter.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterFirstLetter.cpp.
345         * rendering/updating/RenderTreeUpdaterFirstLetter.h: Copied from Source/WebCore/style/RenderTreeUpdaterFirstLetter.h.
346         * rendering/updating/RenderTreeUpdaterGeneratedContent.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterGeneratedContent.cpp.
347         * rendering/updating/RenderTreeUpdaterGeneratedContent.h: Copied from Source/WebCore/style/RenderTreeUpdaterGeneratedContent.h.
348         * rendering/updating/RenderTreeUpdaterListItem.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterListItem.cpp.
349         * rendering/updating/RenderTreeUpdaterListItem.h: Copied from Source/WebCore/style/RenderTreeUpdaterListItem.h.
350         * rendering/updating/RenderTreeUpdaterMultiColumn.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterMultiColumn.cpp.
351         * rendering/updating/RenderTreeUpdaterMultiColumn.h: Copied from Source/WebCore/style/RenderTreeUpdaterMultiColumn.h.
352         * style/RenderTreePosition.cpp: Removed.
353         * style/RenderTreePosition.h: Removed.
354         * style/RenderTreeUpdater.cpp: Removed.
355         * style/RenderTreeUpdater.h: Removed.
356         * style/RenderTreeUpdaterFirstLetter.cpp: Removed.
357         * style/RenderTreeUpdaterFirstLetter.h: Removed.
358         * style/RenderTreeUpdaterGeneratedContent.cpp: Removed.
359         * style/RenderTreeUpdaterGeneratedContent.h: Removed.
360         * style/RenderTreeUpdaterListItem.cpp: Removed.
361         * style/RenderTreeUpdaterListItem.h: Removed.
362         * style/RenderTreeUpdaterMultiColumn.cpp: Removed.
363         * style/RenderTreeUpdaterMultiColumn.h: Removed.
364
365 2017-12-17  Yusuke Suzuki  <utatane.tea@gmail.com>
366
367         [JSC][WebCore][CSSJIT] Remove VM reference in CSSJIT
368         https://bugs.webkit.org/show_bug.cgi?id=180917
369
370         Reviewed by Sam Weinig.
371
372         Remove VM reference in CSSJIT. CSSJIT should not be
373         bound to a specific VM.
374
375         No behavior change.
376
377         * css/ElementRuleCollector.cpp:
378         (WebCore::ElementRuleCollector::ruleMatches):
379         * cssjit/SelectorCompiler.cpp:
380         (WebCore::SelectorCompiler::compileSelector):
381         * cssjit/SelectorCompiler.h:
382         * dom/SelectorQuery.cpp:
383         (WebCore::SelectorDataList::compileSelector):
384         (WebCore::SelectorDataList::execute const):
385         * dom/SelectorQuery.h:
386
387 2017-12-16  Dan Bernstein  <mitz@apple.com>
388
389         WKWebView has no equivalent of -[WebView setAlwaysShowVerticalScroller:]
390         https://bugs.webkit.org/show_bug.cgi?id=180613
391         <rdar://problem/35946124>
392
393         Reviewed by Geoff Garen.
394
395         Test: TestWebKitAPI/Tests/WebKitCocoa/WKWebViewAlwaysShowsScroller.mm
396
397         * platform/ScrollView.h: Exported setScrollbarModes.
398
399 2017-12-16  Antti Koivisto  <antti@apple.com>
400
401         Introduce RenderTreeBuilder
402         https://bugs.webkit.org/show_bug.cgi?id=180817
403
404         Reviewed by Zalan Bujtas.
405
406         RenderTreeBuilder is responsible of building the render tree, including construction of various anonymous
407         renderers. Renderer subtype specific render tree construction code will eventually move there.
408
409         This patch adds RenderTreeBuilder class and passes it as a parameter for all addChild implementations.
410         Future patches can then mechanically move the building code from renderers to RenderTreeBuilder.
411
412         It also moves one addChild implementation (RenderRuby::addChild -> RenderTreeBuilder::rubyRunInsertChild)
413         to RenderTreeBuilder as a test.
414
415         * WebCore.xcodeproj/project.pbxproj:
416         * rendering/RenderBlock.cpp:
417         (WebCore::RenderBlock::addChildToContinuation):
418         (WebCore::RenderBlock::addChild):
419         (WebCore::RenderBlock::addChildIgnoringContinuation):
420         * rendering/RenderBlock.h:
421         * rendering/RenderBlockFlow.cpp:
422         (WebCore::RenderBlockFlow::addChild):
423         * rendering/RenderBlockFlow.h:
424         * rendering/RenderBoxModelObject.cpp:
425         (WebCore::RenderBoxModelObject::moveChildTo):
426         * rendering/RenderButton.cpp:
427         (WebCore::RenderButton::addChild):
428         (WebCore::RenderButton::setText):
429         * rendering/RenderButton.h:
430         * rendering/RenderElement.cpp:
431         (WebCore::RenderElement::addChild):
432         * rendering/RenderElement.h:
433         (WebCore::RenderElement::addChildIgnoringContinuation):
434         * rendering/RenderFullScreen.cpp:
435         (WebCore::RenderFullScreen::wrapNewRenderer):
436         (WebCore::RenderFullScreen::wrapExistingRenderer):
437         (WebCore::RenderFullScreen::unwrapRenderer):
438         (WebCore::RenderFullScreen::createPlaceholder):
439         * rendering/RenderGrid.cpp:
440         (WebCore::RenderGrid::addChild):
441         * rendering/RenderGrid.h:
442         * rendering/RenderInline.cpp:
443         (WebCore::RenderInline::addChild):
444         (WebCore::RenderInline::addChildIgnoringContinuation):
445         (WebCore::RenderInline::splitInlines):
446         (WebCore::RenderInline::splitFlow):
447         (WebCore::RenderInline::addChildToContinuation):
448         (WebCore::RenderInline::childBecameNonInline):
449         * rendering/RenderInline.h:
450         * rendering/RenderMenuList.cpp:
451         (WebCore::RenderMenuList::createInnerBlock):
452         (RenderMenuList::addChild):
453         (RenderMenuList::setText):
454         * rendering/RenderMenuList.h:
455         * rendering/RenderMultiColumnFlow.cpp:
456         (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant):
457         * rendering/RenderQuote.cpp:
458         (WebCore::RenderQuote::updateTextRenderer):
459         (WebCore::RenderQuote::updateRenderer):
460         * rendering/RenderQuote.h:
461         * rendering/RenderRuby.cpp:
462         (WebCore::RenderRubyAsInline::addChild):
463         (WebCore::RenderRubyAsBlock::addChild):
464         * rendering/RenderRuby.h:
465         * rendering/RenderRubyBase.h:
466         * rendering/RenderRubyRun.cpp:
467         (WebCore::RenderRubyRun::rubyBaseSafe):
468         (WebCore::RenderRubyRun::addChild): Deleted.
469         * rendering/RenderRubyRun.h:
470         * rendering/RenderTable.cpp:
471         (WebCore::RenderTable::addChild):
472         * rendering/RenderTable.h:
473         * rendering/RenderTableRow.cpp:
474         (WebCore::RenderTableRow::addChild):
475         * rendering/RenderTableRow.h:
476         * rendering/RenderTableSection.cpp:
477         (WebCore::RenderTableSection::addChild):
478         * rendering/RenderTableSection.h:
479         * rendering/RenderTreeBuilder.cpp: Added.
480         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
481         (WebCore::RenderTreeBuilder::~RenderTreeBuilder):
482         (WebCore::RenderTreeBuilder::insertChild):
483         (WebCore::RenderTreeBuilder::rubyRunInsertChild):
484         * rendering/RenderTreeBuilder.h: Added.
485         (WebCore::RenderTreeBuilder::current):
486         * rendering/TextAutoSizing.cpp:
487         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
488         * rendering/mathml/RenderMathMLFenced.cpp:
489         (WebCore::RenderMathMLFenced::updateFromElement):
490         (WebCore::RenderMathMLFenced::makeFences):
491         (WebCore::RenderMathMLFenced::addChild):
492         * rendering/mathml/RenderMathMLFenced.h:
493         * rendering/svg/RenderSVGContainer.cpp:
494         (WebCore::RenderSVGContainer::addChild):
495         * rendering/svg/RenderSVGContainer.h:
496         * rendering/svg/RenderSVGInline.cpp:
497         (WebCore::RenderSVGInline::addChild):
498         * rendering/svg/RenderSVGInline.h:
499         * rendering/svg/RenderSVGRoot.cpp:
500         (WebCore::RenderSVGRoot::addChild):
501         * rendering/svg/RenderSVGRoot.h:
502         * rendering/svg/RenderSVGText.cpp:
503         (WebCore::RenderSVGText::addChild):
504         * rendering/svg/RenderSVGText.h:
505         * style/RenderTreePosition.cpp:
506         (WebCore::RenderTreePosition::insert): Deleted.
507         * style/RenderTreePosition.h:
508         (WebCore::RenderTreePosition::RenderTreePosition):
509         (WebCore::RenderTreePosition::nextSibling const):
510         (WebCore::RenderTreePosition::canInsert const): Deleted.
511         * style/RenderTreeUpdater.cpp:
512         (WebCore::RenderTreeUpdater::updateAfterDescendants):
513         (WebCore::RenderTreeUpdater::createRenderer):
514         (WebCore::RenderTreeUpdater::createTextRenderer):
515         (WebCore::RenderTreeUpdater::updateTextRenderer):
516         (WebCore::createTextRenderer): Deleted.
517         * style/RenderTreeUpdater.h:
518         * style/RenderTreeUpdaterFirstLetter.cpp:
519         (WebCore::updateFirstLetterStyle):
520         (WebCore::createFirstLetterRenderer):
521         * style/RenderTreeUpdaterGeneratedContent.cpp:
522         (WebCore::RenderTreeUpdater::GeneratedContent::updateQuotesUpTo):
523         (WebCore::createContentRenderers):
524         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
525         * style/RenderTreeUpdaterListItem.cpp:
526         (WebCore::RenderTreeUpdater::ListItem::updateMarker):
527         * style/RenderTreeUpdaterListItem.h:
528         * style/RenderTreeUpdaterMultiColumn.cpp:
529         (WebCore::RenderTreeUpdater::MultiColumn::createFragmentedFlow):
530         (WebCore::RenderTreeUpdater::MultiColumn::destroyFragmentedFlow):
531
532 2017-12-16  Romain Bellessort  <romain.bellessort@crf.canon.fr>
533
534         [Readable Streams API] Fix filling of descriptor from queue
535         https://bugs.webkit.org/show_bug.cgi?id=172717
536
537         Reviewed by Youenn Fablet.
538
539         Fixed the filling of descriptor from queue (step 10.d at [1]). When first implemented,
540         spec comprised a bug and code was not reachable. Spec has now been fixed and code can
541         now be reached.
542
543         [1] https://streams.spec.whatwg.org/#readable-byte-stream-controller-fill-pull-into-descriptor-from-queue
544
545         No new tests (covered by WPT tests, whose expectations have been updated).
546
547         * Modules/streams/ReadableByteStreamInternals.js:
548         (readableByteStreamControllerFillDescriptorFromQueue): Updated.
549
550 2017-12-16  Brady Eidson  <beidson@apple.com>
551
552         Implement getting ServiceWorker registrations for the WKWebsiteDataStore API
553         https://bugs.webkit.org/show_bug.cgi?id=180886
554
555         Reviewed by Chris Dumez.
556
557         No new tests (API test coming soon).
558
559         * workers/service/server/SWServer.cpp:
560         (WebCore::SWServer::registrationStoreImportComplete):
561         (WebCore::SWServer::SWServer):
562         (WebCore::SWServer::getOriginsWithRegistrations):
563         (WebCore::SWServer::performGetOriginsWithRegistrationsCallbacks):
564         * workers/service/server/SWServer.h:
565
566 2017-12-16  Yusuke Suzuki  <utatane.tea@gmail.com>
567
568         Remove unnecessary boolean result of start() functions
569         https://bugs.webkit.org/show_bug.cgi?id=180856
570
571         Reviewed by Darin Adler.
572
573         No behavior change.
574
575         * Modules/webaudio/AsyncAudioDecoder.cpp:
576         (WebCore::AsyncAudioDecoder::~AsyncAudioDecoder):
577         * Modules/webdatabase/DatabaseContext.cpp:
578         (WebCore::DatabaseContext::databaseThread):
579         * Modules/webdatabase/DatabaseThread.cpp:
580         (WebCore::DatabaseThread::start):
581         Now `Thread::create` always succeeds (if it fails, WebKit crashes).
582         DatabaseThread::start() now always returns true. So, we do not need
583         to return bool.
584
585         * Modules/webdatabase/DatabaseThread.h:
586         * platform/network/curl/CurlDownload.cpp:
587         (WebCore::CurlDownload::start):
588         * platform/network/curl/CurlDownload.h:
589         * platform/network/curl/ResourceHandleCurl.cpp:
590         (WebCore::ResourceHandle::start):
591         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
592         (WebCore::ResourceHandleCurlDelegate::start):
593         * platform/network/curl/ResourceHandleCurlDelegate.h:
594
595 2017-12-16  Chris Dumez  <cdumez@apple.com>
596
597         Add optimization when updating a SW registration results in the exact same script
598         https://bugs.webkit.org/show_bug.cgi?id=180891
599
600         Reviewed by Geoffrey Garen.
601
602         Add optimization when updating a SW registration results in the exact same script:
603         - https://w3c.github.io/ServiceWorker/#update-algorithm (step 8)
604
605         No new tests, rebaselined existing test.
606
607         * workers/service/server/SWServerJobQueue.cpp:
608         (WebCore::SWServerJobQueue::scriptFetchFinished):
609
610 2017-12-16  Youenn Fablet  <youenn@apple.com>
611
612         Service worker script fetch request should set the Service-Worker header
613         https://bugs.webkit.org/show_bug.cgi?id=180889
614
615         Reviewed by Chris Dumez.
616
617         Test: http/wpt/service-workers/check-service-worker-header.https.html
618
619         Update WorkerScriptLoader to take a request instead of an URL.
620         Updates Worker implementation and use it in ServiceWorkerJob to set the missing request header.
621
622         * workers/Worker.cpp:
623         (WebCore::Worker::create):
624         * workers/WorkerScriptLoader.cpp:
625         (WebCore::WorkerScriptLoader::loadAsynchronously):
626         * workers/WorkerScriptLoader.h:
627         * workers/service/ServiceWorkerJob.cpp:
628         (WebCore::ServiceWorkerJob::fetchScriptWithContext):
629
630 2017-12-15  Ryan Haddad  <ryanhaddad@apple.com>
631
632         Unreviewed, rolling out r225969.
633
634         This change introduced LayoutTest crashes.
635
636         Reverted changeset:
637
638         "Introduce RenderTreeBuilder"
639         https://bugs.webkit.org/show_bug.cgi?id=180817
640         https://trac.webkit.org/changeset/225969
641
642 2017-12-15  Chris Dumez  <cdumez@apple.com>
643
644         Support updating a service worker registration's updateViaCache flag
645         https://bugs.webkit.org/show_bug.cgi?id=180888
646
647         Reviewed by Brady Eidson.
648
649         Support updating a service worker registration's updateViaCache flag to match other browsers:
650         - https://github.com/w3c/ServiceWorker/issues/1189
651
652         No new tests, rebaselined existing test.
653
654         * workers/service/SWClientConnection.cpp:
655         (WebCore::SWClientConnection::setRegistrationUpdateViaCache):
656         * workers/service/SWClientConnection.h:
657         * workers/service/ServiceWorkerRegistration.cpp:
658         (WebCore::ServiceWorkerRegistration::setUpdateViaCache):
659         * workers/service/ServiceWorkerRegistration.h:
660         * workers/service/server/SWServer.h:
661         * workers/service/server/SWServerJobQueue.cpp:
662         (WebCore::SWServerJobQueue::runRegisterJob):
663         * workers/service/server/SWServerRegistration.cpp:
664         (WebCore::SWServerRegistration::setUpdateViaCache):
665         * workers/service/server/SWServerRegistration.h:
666
667 2017-12-15  Ryan Haddad  <ryanhaddad@apple.com>
668
669         Unreviewed, rolling out r225941.
670
671         This change introduced LayoutTest crashes and assertion
672         failures.
673
674         Reverted changeset:
675
676         "Web Inspector: replace HTMLCanvasElement with
677         CanvasRenderingContext for instrumentation logic"
678         https://bugs.webkit.org/show_bug.cgi?id=180770
679         https://trac.webkit.org/changeset/225941
680
681 2017-12-15  Ryosuke Niwa  <rniwa@webkit.org>
682
683         Add a release assert that Timer::m_wasDeleted is false in setNextFireTime
684         https://bugs.webkit.org/show_bug.cgi?id=180860
685         <rdar://problem/36066500>
686
687         Reviewed by David Kilzer.
688
689         Turn an exist debug-only assertion into a release assertion to help diagnose a crash
690         which appears to be caused by a freed timer getting scheduled back into the timer heap.
691
692         * platform/Timer.cpp:
693         (WebCore::TimerBase::~TimerBase):
694         (WebCore::TimerBase::setNextFireTime):
695         * platform/Timer.h:
696
697 2017-12-15  Simon Fraser  <simon.fraser@apple.com>
698
699         Elements animated on-screen are missing sometimes
700         https://bugs.webkit.org/show_bug.cgi?id=180773
701         rdar://problem/34923438
702
703         Reviewed by Zalan Bujtas.
704         
705         After r225310 it was still possible for elements to be missing backing store when brought
706         on-screen via an animation. This occurred if a child element was outside the bounds of the
707         element being animated.
708
709         Fix by making sure that GraphicsLayer's "animatedExtent" took composited child layers into account.
710
711         As for r225310, no test because this is timing sensitive and hard to reliably make a test for.
712
713         * rendering/RenderLayer.cpp:
714         (WebCore::RenderLayer::calculateClipRects const):
715         * rendering/RenderLayer.h:
716         * rendering/RenderLayerBacking.cpp:
717         (WebCore::RenderLayerBacking::updateGeometry):
718
719 2017-12-15  Chris Dumez  <cdumez@apple.com>
720
721         imported/w3c/web-platform-tests/service-workers/service-worker/update.https.html is sometimes crashing in Debug builds
722         https://bugs.webkit.org/show_bug.cgi?id=180867
723
724         Reviewed by Brady Eidson.
725
726         Fix assertion to make sure the worker is terminating if it is already in m_runningOrTerminatingWorkers.
727
728         * workers/service/server/SWServer.cpp:
729         (WebCore::SWServer::runServiceWorker):
730
731 2017-12-15  Chris Dumez  <cdumez@apple.com>
732
733         Service Worker Registration promise is sometimes not rejected when the script load fails
734         https://bugs.webkit.org/show_bug.cgi?id=180849
735
736         Reviewed by Brady Eidson.
737
738         Service Worker Registration promise is sometimes not rejected when the script load fails.
739         This was caused by the ServiceWorkerJob sometimes passing a null ResourceError to the
740         StorageProcess, even though the load failed.
741
742         No new tests, rebaselined exisiting tests.
743
744         * workers/WorkerScriptLoader.cpp:
745         (WebCore::WorkerScriptLoader::notifyError):
746         * workers/service/ServiceWorkerJob.cpp:
747         (WebCore::ServiceWorkerJob::notifyFinished):
748
749 2017-12-15  Youenn Fablet  <youenn@apple.com>
750
751         WebRTC Stats should not be console logged from a background thread
752         https://bugs.webkit.org/show_bug.cgi?id=180845
753
754         Reviewed by Eric Carlson.
755
756         Ensuring console log are done in the main thread.
757
758         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
759         (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered):
760
761 2017-12-15  Antti Koivisto  <antti@apple.com>
762
763         Introduce RenderTreeBuilder
764         https://bugs.webkit.org/show_bug.cgi?id=180817
765
766         Reviewed by Zalan Bujtas.
767
768         RenderTreeBuilder is responsible of building the render tree, including construction of various anonymous
769         renderers. Renderer subtype specific render tree construction code will eventually move there.
770
771         This patch adds RenderTreeBuilder class and passes it as a parameter for all addChild implementations.
772         Future patches can then mechanically move the building code from renderers to RenderTreeBuilder.
773
774         It also moves one addChild implementation (RenderRuby::addChild -> RenderTreeBuilder::rubyRunInsertChild)
775         to RenderTreeBuilder as a test.
776
777         * WebCore.xcodeproj/project.pbxproj:
778         * rendering/RenderBlock.cpp:
779         (WebCore::RenderBlock::addChildToContinuation):
780         (WebCore::RenderBlock::addChild):
781         (WebCore::RenderBlock::addChildIgnoringContinuation):
782         * rendering/RenderBlock.h:
783         * rendering/RenderBlockFlow.cpp:
784         (WebCore::RenderBlockFlow::addChild):
785         * rendering/RenderBlockFlow.h:
786         * rendering/RenderBoxModelObject.cpp:
787         (WebCore::RenderBoxModelObject::moveChildTo):
788         * rendering/RenderButton.cpp:
789         (WebCore::RenderButton::addChild):
790         (WebCore::RenderButton::setText):
791         * rendering/RenderButton.h:
792         * rendering/RenderElement.cpp:
793         (WebCore::RenderElement::addChild):
794         * rendering/RenderElement.h:
795         (WebCore::RenderElement::addChildIgnoringContinuation):
796         * rendering/RenderFullScreen.cpp:
797         (WebCore::RenderFullScreen::wrapNewRenderer):
798         (WebCore::RenderFullScreen::wrapExistingRenderer):
799         (WebCore::RenderFullScreen::unwrapRenderer):
800         (WebCore::RenderFullScreen::createPlaceholder):
801         * rendering/RenderGrid.cpp:
802         (WebCore::RenderGrid::addChild):
803         * rendering/RenderGrid.h:
804         * rendering/RenderInline.cpp:
805         (WebCore::RenderInline::addChild):
806         (WebCore::RenderInline::addChildIgnoringContinuation):
807         (WebCore::RenderInline::splitInlines):
808         (WebCore::RenderInline::splitFlow):
809         (WebCore::RenderInline::addChildToContinuation):
810         (WebCore::RenderInline::childBecameNonInline):
811         * rendering/RenderInline.h:
812         * rendering/RenderMenuList.cpp:
813         (WebCore::RenderMenuList::createInnerBlock):
814         (RenderMenuList::addChild):
815         (RenderMenuList::setText):
816         * rendering/RenderMenuList.h:
817         * rendering/RenderMultiColumnFlow.cpp:
818         (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant):
819         * rendering/RenderQuote.cpp:
820         (WebCore::RenderQuote::updateTextRenderer):
821         (WebCore::RenderQuote::updateRenderer):
822         * rendering/RenderQuote.h:
823         * rendering/RenderRuby.cpp:
824         (WebCore::RenderRubyAsInline::addChild):
825         (WebCore::RenderRubyAsBlock::addChild):
826         * rendering/RenderRuby.h:
827         * rendering/RenderRubyBase.h:
828         * rendering/RenderRubyRun.cpp:
829         (WebCore::RenderRubyRun::rubyBaseSafe):
830         (WebCore::RenderRubyRun::addChild): Deleted.
831         * rendering/RenderRubyRun.h:
832         * rendering/RenderTable.cpp:
833         (WebCore::RenderTable::addChild):
834         * rendering/RenderTable.h:
835         * rendering/RenderTableRow.cpp:
836         (WebCore::RenderTableRow::addChild):
837         * rendering/RenderTableRow.h:
838         * rendering/RenderTableSection.cpp:
839         (WebCore::RenderTableSection::addChild):
840         * rendering/RenderTableSection.h:
841         * rendering/RenderTreeBuilder.cpp: Added.
842         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
843         (WebCore::RenderTreeBuilder::~RenderTreeBuilder):
844         (WebCore::RenderTreeBuilder::insertChild):
845         (WebCore::RenderTreeBuilder::rubyRunInsertChild):
846         * rendering/RenderTreeBuilder.h: Added.
847         (WebCore::RenderTreeBuilder::current):
848         * rendering/TextAutoSizing.cpp:
849         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
850         * rendering/mathml/RenderMathMLFenced.cpp:
851         (WebCore::RenderMathMLFenced::updateFromElement):
852         (WebCore::RenderMathMLFenced::makeFences):
853         (WebCore::RenderMathMLFenced::addChild):
854         * rendering/mathml/RenderMathMLFenced.h:
855         * rendering/svg/RenderSVGContainer.cpp:
856         (WebCore::RenderSVGContainer::addChild):
857         * rendering/svg/RenderSVGContainer.h:
858         * rendering/svg/RenderSVGInline.cpp:
859         (WebCore::RenderSVGInline::addChild):
860         * rendering/svg/RenderSVGInline.h:
861         * rendering/svg/RenderSVGRoot.cpp:
862         (WebCore::RenderSVGRoot::addChild):
863         * rendering/svg/RenderSVGRoot.h:
864         * rendering/svg/RenderSVGText.cpp:
865         (WebCore::RenderSVGText::addChild):
866         * rendering/svg/RenderSVGText.h:
867         * style/RenderTreePosition.cpp:
868         (WebCore::RenderTreePosition::insert): Deleted.
869         * style/RenderTreePosition.h:
870         (WebCore::RenderTreePosition::RenderTreePosition):
871         (WebCore::RenderTreePosition::nextSibling const):
872         (WebCore::RenderTreePosition::canInsert const): Deleted.
873         * style/RenderTreeUpdater.cpp:
874         (WebCore::RenderTreeUpdater::updateAfterDescendants):
875         (WebCore::RenderTreeUpdater::createRenderer):
876         (WebCore::RenderTreeUpdater::createTextRenderer):
877         (WebCore::RenderTreeUpdater::updateTextRenderer):
878         (WebCore::createTextRenderer): Deleted.
879         * style/RenderTreeUpdater.h:
880         * style/RenderTreeUpdaterFirstLetter.cpp:
881         (WebCore::updateFirstLetterStyle):
882         (WebCore::createFirstLetterRenderer):
883         * style/RenderTreeUpdaterGeneratedContent.cpp:
884         (WebCore::RenderTreeUpdater::GeneratedContent::updateQuotesUpTo):
885         (WebCore::createContentRenderers):
886         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
887         * style/RenderTreeUpdaterListItem.cpp:
888         (WebCore::RenderTreeUpdater::ListItem::updateMarker):
889         * style/RenderTreeUpdaterListItem.h:
890         * style/RenderTreeUpdaterMultiColumn.cpp:
891         (WebCore::RenderTreeUpdater::MultiColumn::createFragmentedFlow):
892         (WebCore::RenderTreeUpdater::MultiColumn::destroyFragmentedFlow):
893
894 2017-12-14  Youenn Fablet  <youenn@apple.com>
895
896         Implement <iframe allow="camera; microphone">
897         https://bugs.webkit.org/show_bug.cgi?id=167430
898
899         Reviewed by Eric Carlson.
900
901         Tests: imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-default-feature-policy.https.sub.html
902
903         Adding allow attribute to HTMLIFrameElement as per https://wicg.github.io/feature-policy/#iframe-allow-attribute.
904         Cross-origin iframes will get access to camera/microphone based on this attribute value.
905         Same-origin iframes do not need any attribute.
906         In case getUserMedia requests both camera and microphone, and allow attribute is only one of these,
907         getUserMedia access is denied. This goes against the tests but is not very clear from the specification.
908
909         * Modules/mediastream/UserMediaRequest.cpp:
910         (WebCore::isSecure):
911         (WebCore::isAllowedToUse):
912         (WebCore::canCallGetUserMedia):
913         (WebCore::UserMediaRequest::start):
914         * html/HTMLAttributeNames.in:
915         * html/HTMLIFrameElement.cpp:
916         (WebCore::HTMLIFrameElement::parseAttribute):
917         * html/HTMLIFrameElement.h:
918         * html/HTMLIFrameElement.idl:
919
920 2017-12-14  Zalan Bujtas  <zalan@apple.com>
921
922         Inconsistent section grid could lead to CrashOnOverflow
923         https://bugs.webkit.org/show_bug.cgi?id=180850
924         <rdar://problem/34064811>
925
926         Reviewed by Simon Fraser.
927
928         Each RenderTableSection maintains a grid of rows and columns. The number of columns in this grid equals the
929         maximum number of columns in the entire table (taking spans and multiple sections into account).
930         Since the maximum number of columns might change while re-computing the sections, we need to
931         adjust them accordingly at the end (otherwise it could lead to inconsistent grids where rows have different number of columns).
932
933         Test: fast/table/table-row-oveflow-crash.html
934
935         * rendering/RenderTable.cpp:
936         (WebCore::RenderTable::recalcSections const):
937         * rendering/RenderTableSection.cpp:
938         (WebCore::RenderTableSection::removeRedundantColumns):
939         * rendering/RenderTableSection.h:
940
941 2017-12-14  David Kilzer  <ddkilzer@apple.com>
942
943         Enable -Wstrict-prototypes for WebKit
944         <https://webkit.org/b/180757>
945         <rdar://problem/36024132>
946
947         Rubber-stamped by Joseph Pecoraro.
948
949         * Configurations/Base.xcconfig:
950         (CLANG_WARN_STRICT_PROTOTYPES): Add. Set to YES.
951
952 2017-12-14  Youenn Fablet  <youenn@apple.com>
953
954         srflx and relay ICE candidates lack raddr (rel-addr) and rport (rel-port) attributes if getUserMedia access has not been granted
955         https://bugs.webkit.org/show_bug.cgi?id=180842
956
957         Reviewed by Jon Lee.
958
959         Manually tested since there is no way to gather reflexive or stun candidates in WebKit CI.
960
961         * Modules/mediastream/PeerConnectionBackend.cpp:
962         (WebCore::filterICECandidate):
963
964 2017-12-14  Commit Queue  <commit-queue@webkit.org>
965
966         Unreviewed, rolling out r225878.
967         https://bugs.webkit.org/show_bug.cgi?id=180855
968
969         Introduced a crash in HTMLPictureElement. We're taking a
970         different approach for webkit.org/b/180769 (Requested by rniwa
971         on #webkit).
972
973         Reverted changeset:
974
975         "Crash inside ImageLoader::updateFromElement()"
976         https://bugs.webkit.org/show_bug.cgi?id=180769
977         https://trac.webkit.org/changeset/225878
978
979 2017-12-14  Ryan Haddad  <ryanhaddad@apple.com>
980
981         Unreviewed, rolling out r225931.
982
983         Breaks internal builds.
984
985         Reverted changeset:
986
987         "Fix Mac CMake build"
988         https://bugs.webkit.org/show_bug.cgi?id=180835
989         https://trac.webkit.org/changeset/225931
990
991 2017-12-14  Simon Fraser  <simon.fraser@apple.com>
992
993         Another Windows build fix.
994
995         * platform/graphics/cg/GraphicsContextCG.cpp:
996         (WebCore::extendedSRGBColorSpaceRef):
997
998 2017-12-14  Simon Fraser  <simon.fraser@apple.com>
999
1000         Fix Windows build after r225915.
1001
1002         Windows doens't have dispatch_once with blocks. Switch to use lambda functions instead.
1003
1004         * platform/graphics/cg/GraphicsContextCG.cpp:
1005         (WebCore::sRGBColorSpaceRef):
1006         (WebCore::linearRGBColorSpaceRef):
1007         (WebCore::extendedSRGBColorSpaceRef):
1008         (WebCore::displayP3ColorSpaceRef):
1009
1010 2017-12-14  Devin Rousso  <webkit@devinrousso.com>
1011
1012         Web Inspector: replace HTMLCanvasElement with CanvasRenderingContext for instrumentation logic
1013         https://bugs.webkit.org/show_bug.cgi?id=180770
1014
1015         Reviewed by Joseph Pecoraro.
1016
1017         No change in functionality.
1018
1019         * html/canvas/CanvasRenderingContext.h:
1020         * html/canvas/CanvasRenderingContext.cpp:
1021         (WebCore::CanvasRenderingContext::~CanvasRenderingContext):
1022         Instead of waiting on the HTMLCanvasElement to destruct to call willDestroyCanvasRenderingContext
1023         we can call out in the destructor and know that the CanvasRenderingContext will be destroyed
1024         immediately thereafter.
1025
1026         * html/canvas/CanvasRenderingContext2D.h:
1027         * html/canvas/CanvasRenderingContext2D.cpp:
1028         (WebCore::CanvasRenderingContext2D::create):
1029         * html/canvas/ImageBitmapRenderingContext.h:
1030         * html/canvas/ImageBitmapRenderingContext.cpp:
1031         (WebCore::ImageBitmapRenderingContext::create):
1032         * html/canvas/WebGL2RenderingContext.h:
1033         * html/canvas/WebGL2RenderingContext.cpp:
1034         (WebCore::WebGL2RenderingContext::create):
1035         * html/canvas/WebGLRenderingContext.h:
1036         * html/canvas/WebGLRenderingContext.cpp:
1037         (WebCore::WebGLRenderingContext::create):
1038         * html/canvas/WebGLRenderingContextBase.cpp:
1039         (WebCore::WebGLRenderingContextBase::create):
1040         * html/canvas/WebGPURenderingContext.cpp:
1041         (WebCore::WebGPURenderingContext::create):
1042         * html/HTMLCanvasElement.cpp:
1043         (WebCore::HTMLCanvasElement::createContext2d):
1044         (WebCore::HTMLCanvasElement::createContextWebGL):
1045         (WebCore::HTMLCanvasElement::createContextWebGPU):
1046         (WebCore::HTMLCanvasElement::createContextBitmapRenderer):
1047         (WebCore::HTMLCanvasElement::paint):
1048         (WebCore::HTMLCanvasElement::setImageBuffer const):
1049         Instead of adding didCreateCanvasRenderingContext calls at the construction sites of each
1050         context, we can make the constructors private and force the usage of static `create` functions.
1051         This way, we have access to the fully constructed object and have a guaranteed path for creation.
1052
1053         * inspector/InspectorCanvas.h:
1054         * inspector/InspectorCanvas.cpp:
1055         (WebCore::InspectorCanvas::create):
1056         (WebCore::InspectorCanvas::InspectorCanvas):
1057         (WebCore::InspectorCanvas::canvasElement):
1058         (WebCore::InspectorCanvas::resetRecordingData):
1059         (WebCore::InspectorCanvas::recordAction):
1060         (WebCore::InspectorCanvas::buildObjectForCanvas):
1061         (WebCore::InspectorCanvas::getCanvasContentAsDataURL):
1062         (WebCore::InspectorCanvas::buildInitialState):
1063         
1064         * inspector/InspectorShaderProgram.h:
1065         * inspector/InspectorShaderProgram.cpp:
1066         (WebCore::InspectorShaderProgram::context const):
1067
1068         * inspector/agents/InspectorCanvasAgent.h:
1069         * inspector/agents/InspectorCanvasAgent.cpp:
1070         (WebCore::InspectorCanvasAgent::InspectorCanvasAgent):
1071         (WebCore::InspectorCanvasAgent::enable):
1072         (WebCore::InspectorCanvasAgent::disable):
1073         (WebCore::InspectorCanvasAgent::requestNode):
1074         (WebCore::InspectorCanvasAgent::requestContent):
1075         (WebCore::InspectorCanvasAgent::requestCSSCanvasClientNodes):
1076         (WebCore::contextAsScriptValue):
1077         (WebCore::InspectorCanvasAgent::resolveCanvasContext):
1078         (WebCore::InspectorCanvasAgent::startRecording):
1079         (WebCore::InspectorCanvasAgent::stopRecording):
1080         (WebCore::InspectorCanvasAgent::updateShader):
1081         (WebCore::InspectorCanvasAgent::frameNavigated):
1082         (WebCore::InspectorCanvasAgent::didChangeCSSCanvasClientNodes):
1083         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
1084         (WebCore::InspectorCanvasAgent::willDestroyCanvasRenderingContext):
1085         (WebCore::InspectorCanvasAgent::didChangeCanvasMemory):
1086         (WebCore::InspectorCanvasAgent::recordCanvasAction):
1087         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
1088         (WebCore::InspectorCanvasAgent::consoleStartRecordingCanvas):
1089         (WebCore::InspectorCanvasAgent::didEnableExtension):
1090         (WebCore::InspectorCanvasAgent::didCreateProgram):
1091         (WebCore::InspectorCanvasAgent::canvasDestroyedTimerFired):
1092         (WebCore::InspectorCanvasAgent::canvasRecordingTimerFired):
1093         (WebCore::InspectorCanvasAgent::clearCanvasData):
1094         (WebCore::InspectorCanvasAgent::unbindCanvas):
1095         (WebCore::InspectorCanvasAgent::findInspectorCanvas):
1096         (WebCore::InspectorCanvasAgent::unbindProgram):
1097         (WebCore::InspectorCanvasAgent::didCreateCSSCanvas): Deleted.
1098         (WebCore::InspectorCanvasAgent::canvasDestroyed): Deleted.
1099
1100         * inspector/InspectorInstrumentation.h:
1101         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext):
1102         (WebCore::InspectorInstrumentation::willDestroyCanvasRenderingContext):
1103         (WebCore::InspectorInstrumentation::didChangeCanvasMemory):
1104         (WebCore::InspectorInstrumentation::recordCanvasAction):
1105         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrame):
1106         (WebCore::InspectorInstrumentation::didEnableExtension):
1107         (WebCore::InspectorInstrumentation::didCreateProgram):
1108         (WebCore::InspectorInstrumentation::willDeleteProgram):
1109         (WebCore::InspectorInstrumentation::isShaderProgramDisabled):
1110         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvas):
1111         (WebCore::InspectorInstrumentation::didCreateCSSCanvas): Deleted.
1112         * inspector/InspectorInstrumentation.cpp:
1113         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvasImpl):
1114         (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodesImpl):
1115         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContextImpl):
1116         (WebCore::InspectorInstrumentation::willDestroyCanvasRenderingContextImpl):
1117         (WebCore::InspectorInstrumentation::didChangeCanvasMemoryImpl):
1118         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrameImpl):
1119         (WebCore::InspectorInstrumentation::didEnableExtensionImpl):
1120         (WebCore::InspectorInstrumentation::didCreateProgramImpl):
1121         (WebCore::InspectorInstrumentation::didCreateCSSCanvasImpl): Deleted.
1122
1123         * page/PageConsoleClient.cpp:
1124         (WebCore::PageConsoleClient::record):
1125         (WebCore::PageConsoleClient::recordEnd):
1126
1127         * dom/Document.h:
1128         * dom/Document.cpp:
1129         (WebCore::Document::getCSSCanvasElement):
1130         (WebCore::Document::nameForCSSCanvasElement const):
1131         We have no reason to save the CSS canvas name for each InspectorCanvas object, so instead we
1132         can just query for the name based on the CanvasRenderingContext's HTMLCanvasElement (assuming
1133         it is not an OffscreenCanvas) when we need it.
1134
1135 2017-12-14  Chris Dumez  <cdumez@apple.com>
1136
1137         self.importScripts() should obey updateViaCache inside service workers
1138         https://bugs.webkit.org/show_bug.cgi?id=180826
1139
1140         Reviewed by Youenn Fablet.
1141
1142         self.importScripts() should obey updateViaCache inside service workers, as per:
1143         - https://html.spec.whatwg.org/multipage/workers.html#dom-workerglobalscope-importscripts
1144
1145         Tests: http/tests/workers/service/registration-updateViaCache-all-importScripts.html
1146                http/tests/workers/service/registration-updateViaCache-imports-importScripts.html
1147                http/tests/workers/service/registration-updateViaCache-none-importScripts.html
1148
1149         * workers/WorkerGlobalScope.cpp:
1150         (WebCore::WorkerGlobalScope::importScripts):
1151         * workers/WorkerScriptLoader.cpp:
1152         (WebCore::WorkerScriptLoader::loadSynchronously):
1153         * workers/WorkerScriptLoader.h:
1154         * workers/service/SWClientConnection.cpp:
1155         (WebCore::SWClientConnection::setRegistrationLastUpdateTime):
1156         * workers/service/SWClientConnection.h:
1157         * workers/service/ServiceWorkerRegistration.cpp:
1158         (WebCore::ServiceWorkerRegistration::lastUpdateTime const):
1159         (WebCore::ServiceWorkerRegistration::setLastUpdateTime):
1160         * workers/service/ServiceWorkerRegistration.h:
1161         * workers/service/server/SWServer.h:
1162         * workers/service/server/SWServerRegistration.cpp:
1163         (WebCore::SWServerRegistration::setLastUpdateTime):
1164         * workers/service/server/SWServerRegistration.h:
1165
1166 2017-12-14  Yusuke Suzuki  <utatane.tea@gmail.com>
1167
1168         Drop Thread::tryCreate
1169         https://bugs.webkit.org/show_bug.cgi?id=180808
1170
1171         Reviewed by Darin Adler.
1172
1173         This change reveals that nobody cares the WorkerThread::start's failure.
1174         We should use `Thread::create` to ensure thread is actually starting.
1175
1176         * workers/WorkerThread.cpp:
1177         (WebCore::WorkerThread::start):
1178         * workers/WorkerThread.h:
1179
1180 2017-12-14  Alicia Boya García  <aboya@igalia.com>
1181
1182         [MSE] Add isValid() check before using trackBuffer.lastEnqueuedPresentationTime
1183         https://bugs.webkit.org/show_bug.cgi?id=180258
1184
1185         Reviewed by Jer Noble.
1186
1187         * Modules/mediasource/SourceBuffer.cpp:
1188         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
1189
1190 2017-12-14  John Wilander  <wilander@apple.com>
1191
1192         Storage Access API: Implement frame-specific access in the document.cookie layer
1193         https://bugs.webkit.org/show_bug.cgi?id=180682
1194         <rdar://problem/35982257>
1195
1196         Reviewed by Alex Christensen.
1197
1198         No new tests. Changed expected result from existing test.
1199
1200         CookiesStrategy::cookiesForDOM(), CookiesStrategy::setCookiesFromDOM(),
1201         CookiesStrategy::cookieRequestHeaderFieldValue(), and
1202         CookiesStrategy::getRawCookies() now take optional parameters for
1203         frameID and pageID to allow frame-specific scoping of cookies.
1204
1205         This change makes the return values of FrameLoaderClient::frameID()
1206         and FrameLoaderClient::pageID() std::optional<uint64_t> so that
1207         WebCore can call those getters and get the right return values in
1208         WebKit and std:nullopt in WebKitLegacy.
1209
1210         * dom/Document.cpp:
1211         (WebCore::Document::requestStorageAccess):
1212         * loader/CookieJar.cpp:
1213         (WebCore::cookies):
1214         (WebCore::setCookies):
1215         (WebCore::cookieRequestHeaderFieldValue):
1216         (WebCore::getRawCookies):
1217         * loader/EmptyFrameLoaderClient.h:
1218         * loader/FrameLoaderClient.h:
1219         * platform/CookiesStrategy.h:
1220         * platform/network/CacheValidation.cpp:
1221         (WebCore::headerValueForVary):
1222         * platform/network/PlatformCookieJar.h:
1223         * platform/network/cf/CookieJarCFNet.cpp:
1224         (WebCore::setCookiesFromDOM):
1225         (WebCore::cookiesForDOM):
1226         (WebCore::cookieRequestHeaderFieldValue):
1227         (WebCore::getRawCookies):
1228         * platform/network/curl/CookieJarCurl.cpp:
1229         (WebCore::CookieJarCurlFileSystem::setCookiesFromDOM):
1230         (WebCore::CookieJarCurlFileSystem::cookiesForDOM):
1231         (WebCore::CookieJarCurlFileSystem::cookieRequestHeaderFieldValue):
1232         (WebCore::CookieJarCurlFileSystem::getRawCookies):
1233         (WebCore::cookiesForDOM):
1234         (WebCore::setCookiesFromDOM):
1235         (WebCore::cookieRequestHeaderFieldValue):
1236         (WebCore::getRawCookies):
1237         * platform/network/curl/CookieJarCurl.h:
1238         * platform/network/mac/CookieJarMac.mm:
1239         (WebCore::cookiesInPartitionForURL):
1240         (WebCore::cookiesForURL):
1241         (WebCore::cookiesForSession):
1242         (WebCore::cookiesForDOM):
1243         (WebCore::cookieRequestHeaderFieldValue):
1244         (WebCore::setCookiesFromDOM):
1245         (WebCore::getRawCookies):
1246         * platform/network/soup/CookieJarSoup.cpp:
1247         (WebCore::setCookiesFromDOM):
1248         (WebCore::cookiesForDOM):
1249         (WebCore::cookieRequestHeaderFieldValue):
1250         (WebCore::getRawCookies):
1251
1252 2017-12-14  Alex Christensen  <achristensen@webkit.org>
1253
1254         Fix Mac CMake build
1255         https://bugs.webkit.org/show_bug.cgi?id=180835
1256
1257         Reviewed by Andy Estes.
1258
1259         * PlatformMac.cmake:
1260         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
1261
1262 2017-12-14  Antoine Quint  <graouts@apple.com>
1263
1264         [Web Animations] Use is<> when possible
1265         https://bugs.webkit.org/show_bug.cgi?id=180832
1266
1267         Reviewed by Dean Jackson.
1268
1269         Adopt is<> when possible.
1270
1271         * animation/WebAnimation.cpp:
1272         (WebCore::WebAnimation::setEffect):
1273         (WebCore::WebAnimation::setTimeline):
1274         (WebCore::WebAnimation::startOrStopAccelerated):
1275
1276 2017-12-14  Antoine Quint  <graouts@apple.com>
1277
1278         [Web Animations] Bring timeline and currentTime setters closer to compliance
1279         https://bugs.webkit.org/show_bug.cgi?id=180834
1280
1281         Reviewed by Dean Jackson.
1282
1283         Now that we've added support for the concept of a hold time, pending tasks
1284         and updating the finished state, adopt those in places we had already implemented
1285         but weren't fully compliant.
1286
1287         Web Platform Tests cover these behaviors, but we're currently failing those tests
1288         due to lacking an implementation for Element.animate().
1289
1290         * animation/WebAnimation.cpp:
1291         (WebCore::WebAnimation::setTimeline): Add some spec comments to clarify the code behavior
1292         and implement step 4 of the "setting the timeline" procedure where we reset the hold time
1293         to an unresolved value if the start time is resolved, as well as step 5 where we update the
1294         finished state. Finally, we also ensure we update the pending tasks as the ready state is
1295         dependent on a timeline being set.
1296         (WebCore::WebAnimation::bindingsStartTime const): Invert the way we test for an unresolved
1297         value to match prior review comments by Dean Jackson.
1298         (WebCore::WebAnimation::setBindingsStartTime): Use a boolean check rather than checking
1299         equality with std::nullopt.
1300         (WebCore::WebAnimation::setBindingsCurrentTime): Do not raise an exception when setting
1301         an unresolved time.
1302
1303 2017-12-14  Antoine Quint  <graouts@apple.com>
1304
1305         [Web Animations] Implement the cancel() method on Animation
1306         https://bugs.webkit.org/show_bug.cgi?id=180830
1307         <rdar://problem/36055816>
1308
1309         Reviewed by Dean Jackson.
1310
1311         We implement the cancel() method on the Animation interface with full spec text defining
1312         the normative behavior of those methods and code matching those steps. Implementing the
1313         cancel() method required implementing the notion of "resetting pending tasks",
1314         which the Web Animations spec defines as well.
1315
1316         * animation/WebAnimation.cpp:
1317         (WebCore::WebAnimation::setEffect):
1318         (WebCore::WebAnimation::cancel):
1319         (WebCore::WebAnimation::resetPendingTasks):
1320         * animation/WebAnimation.h:
1321         * animation/WebAnimation.idl:
1322
1323 2017-12-14  Jer Noble  <jer.noble@apple.com>
1324
1325         "Click to exit fullscreen" text not legible on High Sierra
1326         https://bugs.webkit.org/show_bug.cgi?id=180825
1327         <rdar://problem/32839983>
1328
1329         Reviewed by Eric Carlson.
1330
1331         Explicitly set the NSVisualAffectView's .appearance property.
1332
1333         * platform/mac/WebCoreFullScreenPlaceholderView.mm:
1334         (-[WebCoreFullScreenPlaceholderView initWithFrame:]):
1335
1336 2017-12-14  Antoine Quint  <graouts@apple.com>
1337
1338         [Web Animations] Implement the finish() method on Animation
1339         https://bugs.webkit.org/show_bug.cgi?id=180822
1340         <rdar://problem/36053282>
1341
1342         Reviewed by Dean Jackson.
1343
1344         We implement the finish() method on the Animation interface with full spec text defining
1345         the normative behavior of those methods and code matching those steps. Implementing the
1346         finish() method required implementing the notion of "silently setting the current time",
1347         which the Web Animations spec defines as well.
1348
1349         * animation/WebAnimation.cpp:
1350         (WebCore::WebAnimation::silentlySetCurrentTime):
1351         (WebCore::WebAnimation::setCurrentTime):
1352         (WebCore::WebAnimation::finish):
1353         * animation/WebAnimation.h:
1354         * animation/WebAnimation.idl:
1355
1356 2017-12-14  Chris Dumez  <cdumez@apple.com>
1357
1358         Service worker script fetching currently always uses the network cache
1359         https://bugs.webkit.org/show_bug.cgi?id=180816
1360
1361         Reviewed by Alex Christensen.
1362
1363         Service worker script fetching currently always uses the network cache. This is incorrect as per:
1364         - https://w3c.github.io/ServiceWorker/#update-algorithm (step 7.2)
1365
1366         Tests: http/tests/workers/service/registration-updateViaCache-all.html
1367                http/tests/workers/service/registration-updateViaCache-none.html
1368
1369         * workers/Worker.cpp:
1370         (WebCore::Worker::create):
1371         * workers/WorkerScriptLoader.cpp:
1372         (WebCore::WorkerScriptLoader::loadAsynchronously):
1373         * workers/WorkerScriptLoader.h:
1374         * workers/service/SWClientConnection.cpp:
1375         (WebCore::SWClientConnection::startScriptFetchForServer):
1376         * workers/service/SWClientConnection.h:
1377         * workers/service/ServiceWorkerContainer.cpp:
1378         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
1379         * workers/service/ServiceWorkerContainer.h:
1380         * workers/service/ServiceWorkerJob.cpp:
1381         (WebCore::ServiceWorkerJob::startScriptFetch):
1382         (WebCore::ServiceWorkerJob::fetchScriptWithContext):
1383         * workers/service/ServiceWorkerJob.h:
1384         * workers/service/ServiceWorkerJobClient.h:
1385         * workers/service/server/SWServer.cpp:
1386         (WebCore::SWServer::startScriptFetch):
1387         * workers/service/server/SWServer.h:
1388         * workers/service/server/SWServerJobQueue.cpp:
1389         (WebCore::SWServerJobQueue::runUpdateJob):
1390         * workers/service/server/SWServerRegistration.h:
1391         (WebCore::SWServerRegistration::lastUpdateTime const):
1392
1393 2017-12-14  Simon Fraser  <simon.fraser@apple.com>
1394
1395         Remove ColorSpaceDeviceRGB and most users of the obsolete deviceRGB colorspace
1396         https://bugs.webkit.org/show_bug.cgi?id=180689
1397
1398         Reviewed by Darin Adler.
1399         
1400         Address issues noted by Darin in r225797:
1401         
1402         Existing and new code mistakenly allocated colorspaces on every call, because
1403         they didn't initialize the static variable on the first call. Avoid this mistake
1404         by using dispatch_once() in these functions.
1405
1406         Fix a case where the extendedSRGBColorSpaceRef() fallback was returning deviceRGB
1407         instead of sRGB.
1408
1409         * platform/graphics/cg/GraphicsContextCG.cpp:
1410         (WebCore::sRGBColorSpaceRef):
1411         (WebCore::linearRGBColorSpaceRef):
1412         (WebCore::extendedSRGBColorSpaceRef):
1413         (WebCore::displayP3ColorSpaceRef):
1414         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
1415         (WebCore::linearRGBColorSpaceRef):
1416
1417 2017-12-13  Keith Miller  <keith_miller@apple.com>
1418
1419         JSObjects should have a mask for loading indexed properties
1420         https://bugs.webkit.org/show_bug.cgi?id=180768
1421
1422         Reviewed by Mark Lam.
1423
1424         * bindings/js/JSDOMConvertSequences.h:
1425         (WebCore::Detail::NumericSequenceConverter::convertArray):
1426         (WebCore::Detail::SequenceConverter::convertArray):
1427
1428 2017-12-13  Antoine Quint  <graouts@apple.com>
1429
1430         [Web Animations] Implement the play() and pause() methods on Animation
1431         https://bugs.webkit.org/show_bug.cgi?id=178932
1432         <rdar://problem/35271069>
1433
1434         Reviewed by Eric Carlson.
1435
1436         We implement the play() and pause() methods of the Animation interface with full spec text defining
1437         the normative behavior of those methods and code matching those steps. Playing and pausing animations
1438         incur running a play or pause task when conditions are met, specifically here when the timeline is ready.
1439         So we add the notion of pending tasks and provide a proper implementation of pending() which we had
1440         introduced in an earlier patch with a constant false return value.
1441
1442         Note that the play() method exposes an auto-rewinding flag which we always set to true, but other specs,
1443         namely CSS Animations, do not require the rewinding behavior, so we expose it for future use.
1444
1445         * animation/WebAnimation.cpp:
1446         (WebCore::WebAnimation::play):
1447         (WebCore::WebAnimation::setTimeToRunPendingPlayTask):
1448         (WebCore::WebAnimation::runPendingPlayTask):
1449         (WebCore::WebAnimation::pause):
1450         (WebCore::WebAnimation::setTimeToRunPendingPauseTask):
1451         (WebCore::WebAnimation::runPendingPauseTask):
1452         (WebCore::WebAnimation::updatePendingTasks):
1453         * animation/WebAnimation.h:
1454         * animation/WebAnimation.idl:
1455
1456 2017-12-14  Frederic Wang  <fwang@igalia.com>
1457
1458         Make GraphicsLayer::dumpProperties dump m_offsetFromRenderer
1459         https://bugs.webkit.org/show_bug.cgi?id=180473
1460
1461         Reviewed by Antonio Gomes.
1462
1463         No new tests, this is just a new debug info.
1464
1465         * platform/graphics/GraphicsLayer.cpp:
1466         (WebCore::GraphicsLayer::dumpProperties const): Dump the offset from renderer if nonzero.
1467
1468 2017-12-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1469
1470         REGRESSION(r225769): Build errors with constexpr std::tie on older gcc
1471         https://bugs.webkit.org/show_bug.cgi?id=180692
1472
1473         Reviewed by Carlos Garcia Campos.
1474
1475         * platform/graphics/FontSelectionAlgorithm.h:
1476         (WebCore::FontSelectionRange::operator== const):
1477         (WebCore::FontSelectionRequest::tied const):
1478         (WebCore::FontSelectionCapabilities::tied const):
1479         (WebCore::FontSelectionSpecifiedCapabilities:: const):
1480
1481 2017-12-13  Daniel Bates  <dabates@apple.com>
1482
1483         Fix the Windows build after <https://trac.webkit.org/changeset/225879>
1484         (https://bugs.webkit.org/show_bug.cgi?id=180651)
1485
1486         * html/TextFieldInputType.cpp:
1487         (WebCore::autoFillButtonTypeToAccessibilityLabel):
1488         (WebCore::autoFillButtonTypeToAutoFillButtonText):
1489         (WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName):
1490
1491 2017-12-13  Devin Rousso  <webkit@devinrousso.com>
1492
1493         Web Inspector: add instrumentation for ImageBitmapRenderingContext
1494         https://bugs.webkit.org/show_bug.cgi?id=180736
1495
1496         Reviewed by Joseph Pecoraro.
1497
1498         Tests: inspector/canvas/create-context-bitmaprenderer.html
1499                inspector/canvas/requestContent-bitmaprenderer.html
1500                inspector/canvas/resolveCanvasContext-bitmaprenderer.html
1501
1502         * CMakeLists.txt:
1503         * Sources.txt:
1504         * WebCore.xcodeproj/project.pbxproj:
1505
1506         * html/HTMLCanvasElement.cpp:
1507         (WebCore::HTMLCanvasElement::getContext):
1508         (WebCore::HTMLCanvasElement::createContextBitmapRenderer):
1509         Support passing an optional settings dictionary when creating an ImageBitmapRenderingContext.
1510
1511         * inspector/agents/InspectorCanvasAgent.cpp:
1512         (WebCore::InspectorCanvasAgent::requestContent):
1513         (WebCore::contextAsScriptValue):
1514
1515         * bindings/js/CallTracerTypes.h:
1516
1517         * inspector/InspectorCanvas.h:
1518         * inspector/InspectorCanvas.cpp:
1519         (WebCore::InspectorCanvas::buildObjectForCanvas):
1520         (WebCore::InspectorCanvas::indexForData):
1521         (WebCore::InspectorCanvas::buildAction):
1522         (WebCore::InspectorCanvas::buildArrayForImageBitmap): Deleted.
1523
1524 2017-12-13  Daniel Bates  <dabates@apple.com>
1525
1526         Add more auto fill button types
1527         https://bugs.webkit.org/show_bug.cgi?id=180651
1528         <rdar://problem/35891125>
1529         And
1530         <rdar://problem/35977943>
1531
1532         Reviewed by Brent Fulgham.
1533
1534         Tests: fast/forms/auto-fill-button/input-autofilled-disabled-strong-password-auto-fill-button.html
1535                fast/forms/auto-fill-button/input-autofilled-readonly-strong-password-auto-fill-button.html
1536                fast/forms/auto-fill-button/input-disabled-strong-password-and-strong-confirmation-password-auto-fill-buttons.html
1537                fast/forms/auto-fill-button/input-readonly-strong-password-and-strong-confirmation-password-auto-fill-buttons.html
1538                fast/forms/auto-fill-button/input-strong-confirmation-password-auto-fill-button.html
1539                fast/forms/auto-fill-button/input-strong-password-auto-fill-button.html
1540
1541         * English.lproj/Localizable.strings:
1542         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1543         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): Add strings for new auto fill button types.
1544
1545         * css/CSSSelector.cpp:
1546         (WebCore::CSSSelector::selectorText const):
1547         * css/CSSSelector.h:
1548         * css/SelectorChecker.cpp:
1549         (WebCore::SelectorChecker::checkOne const):
1550         * css/SelectorCheckerTestFunctions.h:
1551         (WebCore::isAutofilledStrongPassword):
1552         * css/SelectorPseudoClassAndCompatibilityElementMap.in:
1553         * css/html.css:
1554         (input::-webkit-strong-password-auto-fill-button):
1555         (input:-webkit-autofill-strong-password):
1556         (input:-webkit-autofill, input:-webkit-autofill-strong-password):
1557         (input:-webkit-autofill): Deleted.
1558         * cssjit/SelectorCompiler.cpp:
1559         (WebCore::SelectorCompiler::addPseudoClassType):
1560         Add new CSS pseudo class and CSS styles.
1561
1562         * html/HTMLInputElement.cpp:
1563         (WebCore::HTMLInputElement::reset): Hide the auto fill button when the form is reset. This is also called
1564         whenever we suspend the page to put it into the page cache.
1565         (WebCore::HTMLInputElement::setShowAutoFillButton): Modified to update the editability of the inner text element
1566         and invalidate styles for the subtree as the editability may have changed depending on the auto fill button type.
1567
1568         (WebCore::autoFillStrongPasswordMaskImage):
1569         (WebCore::HTMLInputElement::createInnerTextStyle):
1570         (WebCore::HTMLInputElement::createInnerTextStyle const): Deleted.
1571         Adjust the look of the inner text field. This function is not const because we may need to resolve style to
1572         generate a mask image.
1573
1574         * html/HTMLInputElement.h:
1575         (WebCore::HTMLInputElement::autoFillButtonType const): Fix style nit; use a C++ style cast while I am in
1576         this area.
1577         (WebCore::HTMLInputElement::hasAutoFillStrongPasswordButton const): Added.
1578
1579         * html/HTMLTextAreaElement.cpp:
1580         (WebCore::HTMLTextAreaElement::createInnerTextStyle):
1581         (WebCore::HTMLTextAreaElement::createInnerTextStyle const): Deleted.
1582         Made this non-const because HTMLInputElement::createInnerTextStyle() needs to be non-const. See above.
1583
1584         * html/HTMLTextAreaElement.h:
1585         * html/HTMLTextFormControlElement.cpp:
1586         (WebCore::HTMLTextFormControlElement::isInnerTextElementEditable const):
1587         (WebCore::HTMLTextFormControlElement::updateInnerTextElementEditability):
1588         Extract out the query to determine if the inner text element is editable into a virtual function isInnerTextElementEditable()
1589         and have updateInnerTextElementEditability() make use of it. By default a field is considered editable if it is not disabled
1590         or read-only. We override updateInnerTextElementEditability() in HTMLInputElement to also consider the auto fill button type.
1591
1592         * html/HTMLTextFormControlElement.h:
1593         * html/TextFieldInputType.cpp:
1594         (WebCore::autoFillButtonTypeToAccessibilityLabel):
1595         (WebCore::autoFillButtonTypeToAutoFillButtonText):
1596         (WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName):
1597         (WebCore::isAutoFillButtonTypeChanged):
1598         (WebCore::TextFieldInputType::createAutoFillButton):
1599         (WebCore::TextFieldInputType::updateAutoFillButton):
1600         Support having text for the auto fill button.
1601
1602         * platform/LocalizedStrings.cpp:
1603         (WebCore::AXAutoFillStrongPasswordLabel):
1604         (WebCore::AXAutoFillStrongConfirmationPasswordLabel):
1605         (WebCore::autoFillStrongPasswordLabel):
1606         * platform/LocalizedStrings.h:
1607         Add localized strings.
1608
1609         * rendering/RenderTextControlSingleLine.h: Disallow scrolling depending on the auto fill button type.
1610
1611         * testing/Internals.cpp:
1612         (WebCore::toAutoFillButtonType):
1613         * testing/Internals.h:
1614         * testing/Internals.idl:
1615         Add support for testing.
1616
1617 2017-12-13  Ryosuke Niwa  <rniwa@webkit.org>
1618
1619         Crash inside ImageLoader::updateFromElement()
1620         https://bugs.webkit.org/show_bug.cgi?id=180769
1621         <rdar://problem/35278782>
1622
1623         Reviewed by Antti Koivisto.
1624
1625         Fixed the crash by moving all call sites of ImageLoader::updateFromElement() to be post insertion callbacks
1626         where it's safe to execute arbitrary scripts.
1627
1628         No new test since existing tests cover this with a newly added release assert in ImageLoader.
1629
1630         * html/HTMLImageElement.cpp:
1631         (WebCore::HTMLImageElement::insertedIntoAncestor):
1632         (WebCore::HTMLImageElement::didFinishInsertingNode): Extracted from insertedIntoAncestor to call
1633         selectImageSource or updateFromElement.
1634         * html/HTMLImageElement.h: Made many member functions final.
1635         * html/HTMLInputElement.cpp:
1636         (WebCore::HTMLInputElement::didAttachRenderers): Delay the call to ImageLoader::updateFromElement() in
1637         ImageInputType using a post style resolution callback.
1638         * html/HTMLMetaElement.h:
1639         * html/HTMLPictureElement.cpp:
1640         (WebCore::HTMLPictureElement::sourcesChanged): Store the list of child image elements into a vector before
1641         calling selectImageSource since each call may execute arbitrary scripts.
1642         * html/HTMLSourceElement.cpp:
1643         (WebCore::HTMLSourceElement::insertedIntoAncestor): Delay the call to ImageLoader::updateFromElement()
1644         using a post style resolution callback.
1645         (WebCore::HTMLSourceElement::didFinishInsertingNode): Extracted from insertedIntoAncestor.
1646         * html/HTMLSourceElement.h:
1647         * html/HTMLVideoElement.cpp:
1648         (WebCore::HTMLVideoElement::didAttachRenderers):
1649         (WebCore::HTMLVideoElement::updateAfterStyleResolution): Extracted from didAttachRenderers.
1650         * html/HTMLVideoElement.h:
1651         * html/ImageInputType.cpp:
1652         (WebCore::ImageInputType::needsPostStyleResolutionCallback): Added. Returns true so that HTMLInputElement's
1653         didAttachRenderers would register a post style resolution callback.
1654         (WebCore::ImageInputType::updateAfterStyleResolution): Extracted from attach.
1655         (WebCore::ImageInputType::attach): Deleted.
1656         * html/ImageInputType.h:
1657         * html/InputType.cpp:
1658         (WebCore::InputType::needsPostStyleResolutionCallback): Added. All but ImageInputType returns false.
1659         (WebCore::InputType::updateAfterStyleResolution): Added.
1660         (WebCore::InputType::attach): Deleted.
1661         * html/InputType.h:
1662         * loader/ImageLoader.cpp:
1663         (WebCore::ImageLoader::updateFromElement): Added a release assertion. There is no direct security implication
1664         so there is no need to use RELEASE_ASSERT_WITH_SECURITY_IMPLICATION here.
1665         * svg/SVGImageElement.cpp:
1666         (WebCore::SVGImageElement::insertedIntoAncestor):
1667         (WebCore::SVGImageElement::didFinishInsertingNode):
1668         * svg/SVGImageElement.h:
1669
1670 2017-12-13  Zalan Bujtas  <zalan@apple.com>
1671
1672         RenderImage can be destroyed even before setting the style on it.
1673         https://bugs.webkit.org/show_bug.cgi?id=180767
1674         <rdar://problem/33965995>
1675
1676         Reviewed by Simon Fraser.
1677
1678         In certain cases, when the newly constructed renderer can't be inserted into the tree (parent can only have specific type of children etc),
1679         RenderTreeUpdater destroys it right away. While destroying a RenderImage, the associated image resource assumes
1680         that the image renderer has been initialized through RenderElement::initializeStyle(). This is an incorrect
1681         assumption.
1682         This patch also makes RenderImageResource's m_renderer a weak pointer.
1683            
1684         Test: fast/images/crash-when-image-renderer-is-destroyed-before-calling-initializeStyle.html
1685
1686         * rendering/RenderImageResource.cpp:
1687         (WebCore::RenderImageResource::initialize):
1688         (WebCore::RenderImageResource::setCachedImage):
1689         (WebCore::RenderImageResource::resetAnimation):
1690         (WebCore::RenderImageResource::image const):
1691         (WebCore::RenderImageResource::setContainerContext):
1692         (WebCore::RenderImageResource::imageSize const):
1693         * rendering/RenderImageResource.h:
1694         (WebCore::RenderImageResource::renderer const):
1695         * rendering/RenderImageResourceStyleImage.cpp:
1696         (WebCore::RenderImageResourceStyleImage::shutdown):
1697
1698 2017-12-13  Ryosuke Niwa  <rniwa@webkit.org>
1699
1700         Update the SVG use element's shadow trees explicitly before the style recall
1701         https://bugs.webkit.org/show_bug.cgi?id=180729
1702         <rdar://problem/36009806>
1703
1704         Reviewed by Antti Koivisto.
1705
1706         Update the SVG use element's shadow trees before start resolving styles. Document now has a hash set of all
1707         connected SVG use elements with invalidated shadow trees. SVGUseElement adds itself to this set when its
1708         shadow tree gets invalidated, or it gets newly connected to a document with the invalidated shadow tree.
1709         SVGUseElement removes itself from this set when it updates its shadow tree or it gets disconnected from
1710         a document with the invalidated shadow tree.
1711
1712         No new tests. Covered by existing tests.
1713
1714         * dom/Document.cpp:
1715         (WebCore::Document::~Document): Assert that m_svgUseElements has been cleared.
1716         (WebCore::Document::resolveStyle): Update the shadow trees of SVG use elements with invalidated shadow trees.
1717         (WebCore::Document::addSVGUseElement): Added.
1718         (WebCore::Document::removeSVGUseElement): Added.
1719         * dom/Document.h:
1720         (WebCore::Document::svgUseElements const): Added.
1721         * dom/Element.cpp:
1722         (WebCore::Element::cloneElementWithChildren): Removed EventAllowedScope since the SVG use element's shadow
1723         tree is no longer updated when there is a NoEventDispatchAssertion in the stack.
1724         (WebCore::Element::cloneElementWithoutChildren): Ditto.
1725         * style/StyleTreeResolver.cpp:
1726         (WebCore::Style::TreeResolver::resolveComposedTree): No longer drops the assertion now that SVG use element's
1727         shadow tree is updated before calling this function.
1728         * svg/SVGUseElement.cpp:
1729         (WebCore::SVGUseElement::insertedIntoAncestor): Add the element to the document's hash set if this use element's
1730         shadow tree needs to be updated (m_shadowTreeNeedsUpdate is set), and it got newly connected.
1731         (WebCore::SVGUseElement::removedFromAncestor): Ditto for removal. We have to check m_shadowTreeNeedsUpdate before
1732         calling SVGGraphicsElement::removedFromAncestor or updateExternalDocument since either function can invoke
1733         m_shadowTreeNeedsUpdate to true.
1734         (WebCore::SVGUseElement::willRecalcStyle): Deleted. We no longer call updateShadowTree during style recalc.
1735         (WebCore::SVGUseElement::updateShadowTree): Remove this element from the document's hah set. We can't clear all
1736         the entries in the map at once in Document::resolveStyle because updating the shadow trees of a SVG use element
1737         can result in a sync IPC in ImageLoader::updateFromElement, which end up executing arbitrary author scripts.
1738         (WebCore::SVGUseElement::cloneTarget const): Removed EventAllowedScope since the SVG use element's shadow tree
1739         is no longer updated when there is a NoEventDispatchAssertion in the stack.
1740         (WebCore::SVGUseElement::expandUseElementsInShadowTree const): Ditto.
1741         (WebCore::SVGUseElement::expandSymbolElementsInShadowTree const): Ditto.
1742         (WebCore::SVGUseElement::invalidateShadowTree): Add the element to the document's hash set if it's connected.
1743         * svg/SVGUseElement.h:
1744
1745 2017-12-13  Per Arne Vollan  <pvollan@apple.com>
1746
1747         REGRESSION(225597): Can't select a text box or web view on a page when VO is on.
1748         https://bugs.webkit.org/show_bug.cgi?id=180756
1749         <rdar://problem/35996158>
1750
1751         Reviewed by Brent Fulgham.
1752
1753         No new tests.
1754
1755         * platform/mac/EventLoopMac.mm:
1756         (WebCore::EventLoop::cycle):
1757
1758 2017-12-13  Antoine Quint  <graouts@apple.com>
1759
1760         [Web Animations] Implement the "updating the finished state" procedure
1761         https://bugs.webkit.org/show_bug.cgi?id=180743
1762         <rdar://problem/36017232>
1763
1764         Reviewed by Simon Fraser.
1765
1766         The Web Animations spec defines a procedure for "updating the finished state", which should run as the timeline time
1767         changes and is responsible for ultimately triggering finish events and fulfil the "finished" promise. The procedure
1768         allows for two flags to control its behavior: didSeek and synchronouslyNotify. When synchronouslyNotify is true, the
1769         "finish notification steps" procedure is ran right away, otherwise it's queued as a microtask.
1770
1771         In this patch we introduce the notion of "hold time", which is the time held while an animation is paused. It will be
1772         set by the pause() and play() method in future patches.
1773
1774         * animation/DocumentTimeline.cpp:
1775         (WebCore::DocumentTimeline::updateAnimations): Update the finished state as the timeline time changes with both flags
1776         set to false.
1777         * animation/WebAnimation.cpp:
1778         (WebCore::WebAnimation::currentTime const): Add a private currentTime(bool) variant which allows for the hold time to
1779         be ignored in case updateFinishedState() was called with the didSeek flag set to false.
1780         (WebCore::WebAnimation::updateFinishedState): Implement the procedure as specified with all spec-mandated steps inline.
1781         (WebCore::WebAnimation::scheduleMicrotaskIfNeeded): Schedule a microtask to complete the "finish notification steps"
1782         if we haven't scheduled a microtask before.
1783         (WebCore::WebAnimation::performMicrotask): Perform the microtask if the "finish notification steps" procedure hasn't
1784         been canceled after it was originally scheduled, as tracked by the m_finishNotificationStepsMicrotaskPending flag, since
1785         microtasks are not presently cancelable.
1786         (WebCore::WebAnimation::finishNotificationSteps): Implement the procedure as specified with all spec-mandated steps inline,
1787         dispatching a "finish" events and fulfilling the "finished" promise.
1788         * animation/WebAnimation.h:
1789         * animation/WebAnimation.idl:
1790         * dom/EventNames.h:
1791
1792 2017-12-13  Simon Fraser  <simon.fraser@apple.com>
1793
1794         Fix crash under Document::visualUpdatesSuppressionTimerFired()
1795         https://bugs.webkit.org/show_bug.cgi?id=180758
1796         Document::visualUpdatesSuppressionTimerFired
1797
1798         Reviewed by Zalan Bujtas.
1799
1800         Speculative fix for crash under visualUpdatesSuppressionTimerFired() where view()
1801         can be null. Add null checks for the view() in all code called from this function.
1802
1803         * dom/Document.cpp:
1804         (WebCore::Document::setVisualUpdatesAllowed):
1805         (WebCore::Document::visualUpdatesSuppressionTimerFired):
1806
1807 2017-12-13  Zalan Bujtas  <zalan@apple.com>
1808
1809         ASSERT(LayoutDisallowedScope::isLayoutAllowed()) whenever hitting Enter in Web Inspector console
1810         https://bugs.webkit.org/show_bug.cgi?id=180690
1811
1812         Reviewed by Simon Fraser.
1813
1814         Defer text replacement notification until after layout is done to avoid unexpected forced layouts.
1815
1816         Covered by existing tests.
1817
1818         * accessibility/AXObjectCache.cpp:
1819         (WebCore::AXObjectCache::disableAccessibility):
1820         (WebCore::AXObjectCache::remove):
1821         (WebCore::filterMapForRemoval):
1822         (WebCore::filterListForRemoval):
1823         (WebCore::AXObjectCache::prepareForDocumentDestruction):
1824         (WebCore::AXObjectCache::performDeferredCacheUpdate):
1825         (WebCore::AXObjectCache::deferTextReplacementNotificationForTextControl):
1826         (WebCore::filterForRemoval): Deleted.
1827         * accessibility/AXObjectCache.h: Need to use the base (Element) class since
1828         we can't call is<HTMLTextFormControlElement> in Node d'tor.
1829         (WebCore::AXObjectCache::deferTextReplacementNotificationForTextControl):
1830         * html/HTMLTextFormControlElement.cpp:
1831         (WebCore::HTMLTextFormControlElement::setInnerTextValue):
1832
1833 2017-12-13  Ryan Haddad  <ryanhaddad@apple.com>
1834
1835         Unreviewed, rolling out r225836.
1836
1837         Broke the Windows build.
1838
1839         Reverted changeset:
1840
1841         "Unify some WebGL sources"
1842         https://bugs.webkit.org/show_bug.cgi?id=180726
1843         https://trac.webkit.org/changeset/225836
1844
1845 2017-12-13  Andy Estes  <aestes@apple.com>
1846
1847         [Payment Request] Remove ApplePayPaymentMethodUpdateEvent and use PaymentDetailsModifiers instead
1848         https://bugs.webkit.org/show_bug.cgi?id=180737
1849         <rdar://problem/36013152>
1850
1851         Reviewed by Brady Eidson.
1852
1853         Instead of firing a non-standard "applepaypaymentmethodupdate" event when the payment method
1854         changes, use the PaymentDetailsModifier mechanism to allow the merchant to specify override
1855         totals and additional display items per payment method type.
1856
1857         Test: http/tests/ssl/applepay/ApplePayPaymentDetailsModifier.https.html
1858
1859         * DerivedSources.make:
1860         * Modules/applepay/ApplePayLineItem.idl:
1861         * Modules/applepay/ApplePayPaymentMethod.h:
1862         * Modules/applepay/ApplePayPaymentMethod.idl:
1863         * Modules/applepay/ApplePayPaymentMethodType.h: Added.
1864         * Modules/applepay/ApplePayPaymentMethodType.idl: Added.
1865         * Modules/applepay/cocoa/PaymentMethodCocoa.mm:
1866         * Modules/applepay/paymentrequest/ApplePayModifier.h: Added.
1867         * Modules/applepay/paymentrequest/ApplePayModifier.idl: Added.
1868         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
1869         (WebCore::ApplePayPaymentHandler::show):
1870         (WebCore::ApplePayPaymentHandler::computeTotalAndLineItems):
1871         (WebCore::ApplePayPaymentHandler::detailsUpdated):
1872         (WebCore::ApplePayPaymentHandler::shippingAddressUpdated):
1873         (WebCore::ApplePayPaymentHandler::shippingOptionUpdated):
1874         (WebCore::ApplePayPaymentHandler::paymentMethodUpdated):
1875         (WebCore::ApplePayPaymentHandler::didSelectPaymentMethod):
1876         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
1877         * Modules/applepay/paymentrequest/ApplePayPaymentMethodUpdateEvent.cpp: Removed.
1878         * Modules/applepay/paymentrequest/ApplePayPaymentMethodUpdateEvent.h: Removed.
1879         * Modules/paymentrequest/PaymentRequest.h:
1880         * Modules/paymentrequest/PaymentRequest.idl:
1881         * WebCore.xcodeproj/project.pbxproj:
1882         * dom/EventNames.h:
1883         * dom/EventNames.in:
1884         * testing/MockPaymentCoordinator.cpp:
1885         (WebCore::convert):
1886         (WebCore::MockPaymentCoordinator::updateTotalAndLineItems):
1887         (WebCore::MockPaymentCoordinator::completeShippingMethodSelection):
1888         (WebCore::MockPaymentCoordinator::completeShippingContactSelection):
1889         (WebCore::MockPaymentCoordinator::completePaymentMethodSelection):
1890         * testing/MockPaymentCoordinator.h:
1891         * testing/MockPaymentCoordinator.idl:
1892
1893 2017-12-12  Zalan Bujtas  <zalan@apple.com>
1894
1895         is<HTMLTextFormControlElement> reports the input type.
1896         https://bugs.webkit.org/show_bug.cgi?id=180721
1897         <rdar://problem/36005123>
1898
1899         Reviewed by Ryosuke Niwa.
1900
1901         This patch ensures that is<HTMLTextFormControlElement> consistently returns true even
1902         when the input type changes from text to non-text (checkbox etc).
1903
1904         * accessibility/AccessibilityObject.cpp:
1905         (WebCore::AccessibilityObject::selectText):
1906         * dom/Element.h:
1907         (WebCore::Element::isTextFormControlElement const):
1908         (WebCore::Element::isTextField const):
1909         (WebCore::Element::isTextFormControl const): Deleted.
1910         * editing/Editor.cpp:
1911         (WebCore::Editor::selectionForCommand):
1912         (WebCore::Editor::setBaseWritingDirection):
1913         (WebCore::findFirstMarkable):
1914         * editing/FrameSelection.cpp:
1915         (WebCore::FrameSelection::selectAll):
1916         * html/FormController.cpp:
1917         (WebCore::FormController::formElementsCharacterCount const):
1918         * html/HTMLElement.cpp:
1919         (WebCore::HTMLElement::directionality const):
1920         * html/HTMLInputElement.h:
1921         * html/HTMLTextAreaElement.h:
1922         * html/HTMLTextFormControlElement.cpp:
1923         (WebCore::HTMLTextFormControlElement::didEditInnerTextValue):
1924         (WebCore::HTMLTextFormControlElement::selectedText const):
1925         (WebCore::HTMLTextFormControlElement::setSelectionRange):
1926         (WebCore::HTMLTextFormControlElement::selectionStart const):
1927         (WebCore::HTMLTextFormControlElement::computeSelectionStart const):
1928         (WebCore::HTMLTextFormControlElement::selectionEnd const):
1929         (WebCore::HTMLTextFormControlElement::computeSelectionEnd const):
1930         (WebCore::HTMLTextFormControlElement::selectionDirection const):
1931         (WebCore::HTMLTextFormControlElement::computeSelectionDirection const):
1932         (WebCore::HTMLTextFormControlElement::selection const):
1933         (WebCore::HTMLTextFormControlElement::selectionChanged):
1934         (WebCore::HTMLTextFormControlElement::lastChangeWasUserEdit const):
1935         (WebCore::HTMLTextFormControlElement::setInnerTextValue):
1936         (WebCore::HTMLTextFormControlElement::valueWithHardLineBreaks const):
1937         (WebCore::enclosingTextFormControl):
1938         * html/HTMLTextFormControlElement.h:
1939         (isType):
1940         * rendering/HitTestResult.cpp:
1941         (WebCore::HitTestResult::isOverTextInsideFormControlElement const):
1942
1943 2017-12-12  Dean Jackson  <dino@apple.com>
1944
1945         Unify some WebGL sources
1946         https://bugs.webkit.org/show_bug.cgi?id=180726
1947
1948         Rubber-stamped by Keith, weeks ago.
1949
1950         * Sources.txt:
1951         * WebCore.xcodeproj/project.pbxproj:
1952         * html/canvas/WebGLRenderingContextBase.cpp:
1953
1954 2017-12-12  Michael Catanzaro  <mcatanzaro@igalia.com>
1955
1956         Unreviewed, fix !ENABLE(MEDIA_STREAM) build after r225822
1957         https://bugs.webkit.org/show_bug.cgi?id=180666
1958         <rdar://problem/36008948>
1959
1960         * html/HTMLMediaElement.cpp:
1961
1962 2017-12-12  Alex Christensen  <achristensen@webkit.org>
1963
1964         Fix possible out-of-bounds read in protocolIsInHTTPFamily
1965         https://bugs.webkit.org/show_bug.cgi?id=180688
1966
1967         Reviewed by Daniel Bates.
1968
1969         It wouldn't read very far out of bounds, and it would just change a bool return value,
1970         but it's still out of bounds.  Covered by an API test that ASAN wouldn't like.
1971
1972         * platform/URL.cpp:
1973         (WebCore::protocolIsInHTTPFamily):
1974         Check bounds before reading a string.
1975
1976 2017-12-12  Youenn Fablet  <youenn@apple.com>
1977
1978         getUserMedia is resolving before the document knows it is capturing
1979         https://bugs.webkit.org/show_bug.cgi?id=180699
1980
1981         Reviewed by Eric Carlson.
1982
1983         Covered by updated test.
1984
1985         Ensure the document state is capturing when getUserMedia promise is resolved by doing the following:
1986         - Promise is resolved when MediaStream is producing data.
1987         - MediaStream asks Document to update its state when MediaStream state is updated.
1988
1989         Introduce PendingActivationMediaStream for waiting for the MediaStream to produce data.
1990
1991         * Modules/mediastream/MediaStream.cpp:
1992         (WebCore::MediaStream::statusDidChange):
1993         * Modules/mediastream/UserMediaRequest.cpp:
1994         (WebCore::UserMediaRequest::allow):
1995         (WebCore::UserMediaRequest::contextDestroyed):
1996         (WebCore::UserMediaRequest::PendingActivationMediaStream::PendingActivationMediaStream):
1997         (WebCore::UserMediaRequest::PendingActivationMediaStream::~PendingActivationMediaStream):
1998         (WebCore::UserMediaRequest::PendingActivationMediaStream::characteristicsChanged):
1999         (WebCore::UserMediaRequest::mediaStreamIsReady):
2000         * Modules/mediastream/UserMediaRequest.h:
2001         (WebCore::UserMediaRequest::PendingActivationMediaStream::create):
2002         * platform/mediastream/RealtimeMediaSourceCenter.h:
2003         * WebCore/WebCore.xcodeproj/project.pbxproj:
2004
2005 2017-12-12  John Wilander  <wilander@apple.com>
2006
2007         Storage Access API: Implement frame-specific access in the network storage session layer
2008         https://bugs.webkit.org/show_bug.cgi?id=180679
2009         <rdar://problem/35982116>
2010
2011         Reviewed by Alex Christensen.
2012
2013         Tests: http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-and-try-access-from-right-frame.html
2014                http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-but-try-access-from-wrong-frame.html
2015
2016         This changes adds frameID and pageID to what is communicated for
2017         storage access and also stored in the network process' table of
2018         partitioning exceptions.
2019
2020         * dom/Document.cpp:
2021         (WebCore::Document::hasStorageAccess):
2022             Now makes use of the new m_hasFrameSpecificStorageAccess to check
2023             if access has already been granted to this document's domain and
2024             frame.
2025         (WebCore::Document::requestStorageAccess):
2026             Now submits frameID and pageID in the request call and sets
2027             m_hasFrameSpecificStorageAccess upon granted access callback.
2028         * dom/Document.h:
2029         * page/ChromeClient.h:
2030         * platform/network/NetworkStorageSession.h:
2031         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2032         (WebCore::NetworkStorageSession::cookieStoragePartition const):
2033         (WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies):
2034         (WebCore::NetworkStorageSession::isStorageAccessGranted const):
2035         (WebCore::NetworkStorageSession::setStorageAccessGranted):
2036             Now makes use of frameID and pageID for partitioning exceptions.
2037         * platform/network/mac/CookieJarMac.mm:
2038         (WebCore::cookiesInPartitionForURL):
2039         (WebCore::setCookiesFromDOM):
2040             Submits std::nullopt for frameID and pageID.
2041             Follow-up work tracked in https://bugs.webkit.org/show_bug.cgi?id=180682. 
2042         * platform/network/mac/ResourceHandleMac.mm:
2043         (WebCore::ResourceHandle::applySniffingPoliciesAndStoragePartitionIfNeeded):
2044             Submits std::nullopt for frameID and pageID.
2045             Follow-up work tracked in https://bugs.webkit.org/show_bug.cgi?id=180682. 
2046
2047 2017-12-12  Youenn Fablet  <youenn@apple.com>
2048
2049         Playing webrtc video tracks should prevent from display to got to sleep
2050         https://bugs.webkit.org/show_bug.cgi?id=180666
2051
2052         Reviewed by Darin Adler.
2053
2054         Done through manual testing by checking screen assertions taken on webrtc sites.
2055
2056         * html/HTMLMediaElement.cpp:
2057         (WebCore::HTMLMediaElement::shouldDisableSleep const):
2058
2059 2017-12-12  Dean Jackson  <dino@apple.com>
2060
2061         Add CanvasRenderingContext2DBase class and OffscreenCanvasRenderingContext2D
2062         https://bugs.webkit.org/show_bug.cgi?id=180718
2063         <rdar://problem/36004015>
2064
2065         Reviewed by Sam Weinig.
2066
2067         Add an OffscreenCanvasRenderingContext2D class, and in the process create a shared
2068         base class for it and CanvasRenderingContext2D, called CanvasRenderingContext2DBase.
2069         The base class has nearly all the functionality, with the exception of the text
2070         and focus rendering APIs, which are only exposed on CanvasRenderingContext2D.
2071
2072         At the moment CanvasRenderingContext2DBase's implementation still expects the attached
2073         canvas to be an HTMLCanvasElement, but that's ok since you can't yet create an
2074         OffscreenCanvasRenderingContext2D. A subsequent patch will do the right thing.
2075
2076         No change in functionality at the moment, so covered by the existing tests.
2077
2078         * DerivedSources.make: Add the new IDL file.
2079
2080         * Sources.txt: Add all the new files to compile.
2081         * WebCore.xcodeproj/project.pbxproj:
2082
2083         * bindings/js/JSCanvasRenderingContext2DCustom.cpp: Removed some unnecessary headers, and
2084         added JSC:: where appropriate.
2085         (WebCore::JSCanvasRenderingContext2DOwner::isReachableFromOpaqueRoots):
2086         (WebCore::JSCanvasRenderingContext2D::visitAdditionalChildren):
2087
2088         * bindings/js/JSOffscreenCanvasRenderingContext2DCustom.cpp: Copied from Source/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp.
2089         (WebCore::root): New root function that just returns the address of the OffscreenCanvas.
2090         (WebCore::JSOffscreenCanvasRenderingContext2DOwner::isReachableFromOpaqueRoots):
2091         (WebCore::JSOffscreenCanvasRenderingContext2D::visitAdditionalChildren):
2092
2093         * bindings/js/JSWorkerNavigatorCustom.cpp: Add JSC:: to fix a compilation error.
2094         (WebCore::JSWorkerNavigator::visitAdditionalChildren):
2095
2096         * bindings/js/WebCoreBuiltinNames.h: New IDL types.
2097
2098         * html/OffscreenCanvas.idl: Explicitly generates an IsReachable.
2099
2100         * html/canvas/CanvasRenderingContext.h:
2101         (WebCore::CanvasRenderingContext::isOffscreen2d const): Helper for is<> trait.
2102
2103         * html/canvas/CanvasRenderingContext2D.cpp: Nearly everything has been moved to the Base class.
2104         * html/canvas/CanvasRenderingContext2D.h:
2105         * html/canvas/CanvasRenderingContext2DBase.cpp: Copied from Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp.
2106         * html/canvas/CanvasRenderingContext2DBase.h: Copied from Source/WebCore/html/canvas/CanvasRenderingContext2D.h.
2107
2108         * html/canvas/OffscreenCanvasRenderingContext2D.cpp: Added. Basic implementation that
2109         just uses the Base class.
2110         (WebCore::OffscreenCanvasRenderingContext2D::OffscreenCanvasRenderingContext2D):
2111         * html/canvas/OffscreenCanvasRenderingContext2D.h: Added.
2112         * html/canvas/OffscreenCanvasRenderingContext2D.idl: Added.
2113
2114 2017-12-12  Jer Noble  <jer.noble@apple.com>
2115
2116         [EME] Support FPS-over-HLS in the Modern EME API
2117         https://bugs.webkit.org/show_bug.cgi?id=180707
2118
2119         Reviewed by Eric Carlson.
2120
2121         Add support for the "skd" initDataType, where the initData is the URI provided in the 
2122         EXT-X-KEY tag in a HLS manifest:
2123
2124         * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
2125         (WebCore::CDMPrivateFairPlayStreaming::sinfName):
2126         (WebCore::CDMPrivateFairPlayStreaming::skdName):
2127         (WebCore::extractSinfData):
2128         (WebCore::CDMPrivateFairPlayStreaming::sanitizeSkd):
2129         (WebCore::CDMPrivateFairPlayStreaming::extractKeyIDsSkd):
2130         (WebCore::validInitDataTypes):
2131         (WebCore::CDMFactory::platformRegisterFactories):
2132         (WebCore::CDMPrivateFairPlayStreaming::supportsInitDataType const):
2133         (WebCore::CDMPrivateFairPlayStreaming::supportsConfiguration const):
2134         (WebCore::CDMPrivateFairPlayStreaming::supportsInitData const):
2135         (WebCore::sinfName): Deleted.
2136
2137         Add support for creating a AVContentKeyRequest from a skd key URI rather than from
2138         initialization data, and for extracting keyIDs from the AVContentKeyRequest identifier.
2139
2140         * platform/graphics/avfoundation/CDMFairPlayStreaming.h:
2141         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
2142         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
2143         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::keyIDs):
2144         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::requestLicense):
2145         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense):
2146         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest):
2147
2148         Add support for AVContentKeySession to MediaPlayerPrivateAVFoundationObjC, and for emitting
2149         initializationData messages when encountering a loading request for a "skd" URI.
2150
2151         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
2152         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2153         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
2154         (WebCore::MediaPlayerPrivateAVFoundationObjC::cdmInstanceAttached):
2155         (WebCore::MediaPlayerPrivateAVFoundationObjC::cdmInstanceDetached):
2156         (WebCore::MediaPlayerPrivateAVFoundationObjC::attemptToDecryptWithInstance):
2157
2158 2017-12-12  Antoine Quint  <graouts@apple.com>
2159
2160         [Web Animations] Expose promises on Animation interface
2161         https://bugs.webkit.org/show_bug.cgi?id=180710
2162         <rdar://problem/36000604>
2163
2164         Reviewed by Dean Jackson.
2165
2166         Expose the "ready" and "finished" promises on Animation. A future patch will fulfil or reject them.
2167
2168         * animation/WebAnimation.cpp:
2169         (WebCore::WebAnimation::WebAnimation):
2170         (WebCore::WebAnimation::readyPromiseResolve):
2171         (WebCore::WebAnimation::finishedPromiseResolve):
2172         * animation/WebAnimation.h:
2173         * animation/WebAnimation.idl:
2174
2175 2017-12-12  Youenn Fablet  <youenn@apple.com>
2176
2177         Fetch Event header filtering should apply in CORS mode only
2178         https://bugs.webkit.org/show_bug.cgi?id=180708
2179
2180         Reviewed by Alex Christensen.
2181
2182         Covered by no-longer failing test.
2183
2184         * workers/service/context/ServiceWorkerFetch.cpp: cleaning headers only in case of CORS mode.
2185
2186 2017-12-12  Myles C. Maxfield  <mmaxfield@apple.com>
2187
2188         REGRESSION (Safari 11): custom <font-face> tag crashes a page
2189         https://bugs.webkit.org/show_bug.cgi?id=177848
2190
2191         Reviewed by Darin Adler.
2192
2193         We currently use the CSS property parsers to parse SVG's <font-face> element attributes. Instead,
2194         we should be using the CSS descriptor parsers to parse these attributes. However, this is a
2195         fairly involved task, so until I can finish that, this patch fixes the crash. The crash is simple;
2196         the descriptors shouldn't accept the universal keywords ("initial", "inherit", etc.) and our
2197         font-face machinery assumes this. So the fix is just detect these keywords and explicitly disallow
2198         them.
2199
2200         Test: svg/text/font-style-keyword.html
2201
2202         * svg/SVGFontFaceElement.cpp:
2203         (WebCore::SVGFontFaceElement::parseAttribute):
2204
2205 2017-12-12  Antoine Quint  <graouts@apple.com>
2206
2207         [Web Animations] Implement the playState property on Animation
2208         https://bugs.webkit.org/show_bug.cgi?id=180711
2209         <rdar://problem/36000982>
2210
2211         Reviewed by Dean Jackson.
2212
2213         Expose the playState and pending properties. The playState property has a complete implementation but
2214         has some test failures due to Animation lacking correct behavior while running animations which will
2215         be fixed in a followup patch. The pending property is a placeholder until we implement pending play
2216         and pause tasks in followup patches.
2217
2218         * animation/WebAnimation.cpp:
2219         (WebCore::WebAnimation::playState const):
2220         (WebCore::WebAnimation::effectEndTime const):
2221         * animation/WebAnimation.h:
2222         * animation/WebAnimation.idl:
2223
2224 2017-12-12  Javier Fernandez  <jfernandez@igalia.com>
2225
2226         [css-grid] Implement alignment for absolute positioned grid items
2227         https://bugs.webkit.org/show_bug.cgi?id=180632
2228
2229         Reviewed by Manuel Rego Casasnovas.
2230
2231         We are changing how we compute the grid area's size of positioned
2232         items, trying to make the logic as independent as possible of the
2233         grid container's direction.
2234
2235         The new way of placing absolute positioned elements in their grid area
2236         is based on the previously computed area's size. This provide a
2237         mechanism to place an item in its area respecting the offsets derived
2238         from the Content Alignment CSS properties and, which is more important,
2239         ignoring the grid container's direction.
2240
2241         Additionally, we use the already implemented alignment logic that's
2242         used for regular grid items. This patch provides almost full alignment
2243         capabilities for positioned objects, with the exception of 'stretch'.
2244
2245         It's worth mentioning that some of the test cases using vertical-rl
2246         writing mode will fail because of the bug 180633.
2247
2248         Updated web-platform-tests results of the test cases that pass now.
2249
2250         * rendering/GridLayoutFunctions.cpp:
2251        (WebCore::GridLayoutFunctions::hasOverrideContainingBlockContentSizeForChild):
2252         (WebCore::GridLayoutFunctions::overrideContainingBlockContentSizeForChild):
2253         * rendering/GridLayoutFunctions.h:
2254         * rendering/GridTrackSizingAlgorithm.cpp:
2255         (WebCore::GridTrackSizingAlgorithmStrategy::updateOverrideContainingBlockContentSizeForChild const):
2256         * rendering/RenderGrid.cpp:
2257         (WebCore::RenderGrid::layoutBlock):
2258         (WebCore::RenderGrid::gridItemOffset const):
2259         (WebCore::RenderGrid::hasStaticPositionForChild const):
2260         (WebCore::RenderGrid::layoutPositionedObject):
2261         (WebCore::RenderGrid::applyStretchAlignmentToChildIfNeeded):
2262         (WebCore::RenderGrid::columnAxisPositionForChild const):
2263         (WebCore::RenderGrid::rowAxisPositionForChild const):
2264         (WebCore::RenderGrid::columnAxisOffsetForChild const):
2265         (WebCore::RenderGrid::rowAxisOffsetForChild const):
2266         (WebCore::RenderGrid::gridPositionIsAutoForOutOfFlow const):
2267         (WebCore::RenderGrid::resolveAutoStartGridPosition const):
2268         (WebCore::RenderGrid::resolveAutoEndGridPosition const):
2269         (WebCore::RenderGrid::gridAreaBreadthForOutOfFlowChild):
2270         (WebCore::RenderGrid::logicalOffsetForChild const):
2271         (WebCore::RenderGrid::gridAreaPositionForOutOfFlowChild const):
2272         (WebCore::RenderGrid::gridAreaPositionForInFlowChild const):
2273         (WebCore::RenderGrid::gridAreaPositionForChild const):
2274         (WebCore::RenderGrid::translateOutOfFlowRTLCoordinate const):
2275         (WebCore::RenderGrid::findChildLogicalPosition const):
2276         * rendering/RenderGrid.h:
2277         * rendering/style/GridPositionsResolver.cpp:
2278         (WebCore::adjustGridPositionsFromStyle):
2279         (WebCore::GridPositionsResolver::initialPositionSide):
2280         (WebCore::GridPositionsResolver::finalPositionSide):
2281         * rendering/style/GridPositionsResolver.h:
2282
2283 2017-12-12  Jer Noble  <jer.noble@apple.com>
2284
2285         [EME] Support reporting and restoring persistent usage data.
2286         https://bugs.webkit.org/show_bug.cgi?id=180684
2287
2288         Reviewed by Eric Carlson.
2289
2290         Add support for reading and acknowledging persistent usage data from the MediaKeys storage
2291         directory.
2292
2293         Add a mechanism for passing the storage location down to CDMPrivate and CDMInstance objects
2294         inside of the CDM class itself:
2295
2296         * Modules/encryptedmedia/CDM.cpp:
2297         (WebCore::CDM::createInstance):
2298         (WebCore::CDM::storageDirectory const):
2299         * Modules/encryptedmedia/CDM.h:
2300
2301         Support loading expired session data, acknowledging expired session data, closing sessions
2302         and removing usable key data.
2303
2304         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
2305         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
2306         (WebCore::isEqual):
2307         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense):
2308         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::loadSession):
2309         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::closeSession):
2310         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::removeSessionData):
2311
2312 2017-12-12  Christopher Reid  <chris.reid@sony.com>
2313
2314         WebGL TextureMapperShaderProgram shaders don't compile in MSVC
2315         https://bugs.webkit.org/show_bug.cgi?id=180709
2316
2317         Reviewed by Myles C. Maxfield.
2318
2319         No new tests, no change in behavior.
2320
2321         Vertex and Fragment shaders were not compiling because TextureMapperShaderProgram.cpp was
2322         stringifying "#if USE(OPENGL_ES_2) ... #endif" into the shaders rather than evaluating these
2323         preprocessor directives before the STRINGIFY expansion.
2324
2325         Moved these #if conditions outside of STRINGIFY to remove compiler ambiguity.
2326
2327         * platform/graphics/texmap/TextureMapperShaderProgram.cpp:
2328
2329 2017-12-12  Zach Li  <zachli@apple.com>
2330         [WK2] Expose image via WKBundleHitTestResult API.
2331         https://bugs.webkit.org/show_bug.cgi?id=180552.
2332         rdar://problem/23951521
2333
2334         Reviewed by Simon Fraser.
2335
2336         * platform/graphics/ImageSource.h:
2337         This method will be used by clients outside WebCore, so
2338         add WEBCORE_EXPORT.
2339
2340 2017-12-12  Simon Fraser  <simon.fraser@apple.com>
2341
2342         Remove ColorSpaceDeviceRGB and most users of the obsolete deviceRGB colorspace
2343         https://bugs.webkit.org/show_bug.cgi?id=180689
2344
2345         Reviewed by Tim Horton.
2346
2347         Remove the ColorSpaceDeviceRGB enum and users.
2348
2349         ImageBuffer now uses sRGB instead of deviceRGB in the few cases that used the latter.
2350
2351         Switch Windows CG code to use sRGBColorSpaceRef() instead of deviceRGBColorSpaceRef().
2352
2353         Have linearRGBColorSpaceRef() use kCGColorSpaceLinearSRGB, which is present in iOS 9 and 10.11 and later.
2354
2355         * page/win/FrameCGWin.cpp:
2356         (WebCore::imageFromRect):
2357         * platform/graphics/Color.cpp:
2358         (WebCore::operator<<):
2359         * platform/graphics/ColorSpace.h:
2360         * platform/graphics/ImageBuffer.cpp:
2361         (WebCore::ImageBuffer::transformColorSpace):
2362         * platform/graphics/cg/ColorCG.cpp:
2363         (WebCore::Color::Color):
2364         (WebCore::leakCGColor):
2365         (WebCore::createCGColorWithDeviceRGBA): Deleted.
2366         * platform/graphics/cg/GraphicsContextCG.cpp:
2367         (WebCore::sRGBColorSpaceRef):
2368         (WebCore::linearRGBColorSpaceRef):
2369         (WebCore::extendedSRGBColorSpaceRef):
2370         (WebCore::displayP3ColorSpaceRef):
2371         (WebCore::deviceRGBColorSpaceRef): Deleted.
2372         * platform/graphics/cg/GraphicsContextCG.h:
2373         (WebCore::cachedCGColorSpace):
2374         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
2375         * platform/graphics/win/GraphicsContextCGWin.cpp:
2376         (WebCore::CGContextWithHDC):
2377         (WebCore::GraphicsContext::releaseWindowsContext):
2378         (WebCore::GraphicsContext::drawWindowsBitmap):
2379         * platform/graphics/win/ImageCGWin.cpp:
2380         (WebCore::BitmapImage::create):
2381         (WebCore::BitmapImage::getHBITMAPOfSize):
2382         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
2383         (WebCore::MockRealtimeVideoSourceMac::pixelBufferFromCGImage const):
2384         * platform/win/DragImageCGWin.cpp:
2385         (WebCore::allocImage):
2386         (WebCore::createCgContextFromBitmap):
2387         * rendering/svg/RenderSVGResourceFilter.cpp:
2388         (WebCore::RenderSVGResourceFilter::postApplyResource):
2389         * rendering/svg/RenderSVGResourceMasker.cpp:
2390         (WebCore::RenderSVGResourceMasker::drawContentIntoMaskImage):
2391
2392 2017-12-12  Youenn Fablet  <youenn@apple.com>
2393
2394         Navigation requests should use navigate fetch mode
2395         https://bugs.webkit.org/show_bug.cgi?id=179808
2396
2397         Reviewed by Chris Dumez.
2398
2399         Covered by existing tests.
2400
2401         * Modules/fetch/FetchRequest.cpp:
2402         (WebCore::buildOptions): Update to throw only if init.mode is Navigate.
2403         * Modules/fetch/FetchRequestInit.h:
2404         (WebCore::FetchRequestInit::hasMembers const): If init is present, set default values as per spec.
2405         * loader/DocumentLoader.cpp:
2406         (WebCore::DocumentLoader::loadMainResource): Set fetch mode to navigate.
2407         * loader/DocumentThreadableLoader.cpp:
2408         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Bypass preflight in case fetch mode is navigate.
2409
2410 2017-12-12  Simon Fraser  <simon.fraser@apple.com>
2411
2412         HTML-page with <object type="image/svg+xml" data="foo.svg"> often is blank
2413         https://bugs.webkit.org/show_bug.cgi?id=180524
2414         <rdar://problem/35920554>
2415
2416         Reviewed by Antti Koivisto.
2417
2418         The test case has script that conditionalizes behavior on whether window.innerWidth/Height
2419         are zero during the load event. We didn't force layout in innerWidth/Height, so whether
2420         they would zero depended on whether the parent frame had laid out, which was timing-sensitive.
2421
2422         Fix by triggering enough layout in the parent document so that the FrameView is resized before
2423         fetching its dimensions in innerWidth/Height. This causes our behavior to match Chrome and Firefox.
2424
2425         Test: fast/dom/iframe-innerWidth.html
2426
2427         * dom/EventDispatcher.cpp:
2428         (WebCore::EventDispatcher::dispatchEvent): Add some logging that helped me diagnose this.
2429         * page/DOMWindow.cpp:
2430         (WebCore::DOMWindow::innerHeight const):
2431         (WebCore::DOMWindow::innerWidth const):
2432
2433 2017-12-11  Antoine Quint  <graouts@apple.com>
2434
2435         [Web Animations] Enqueue and dispatch animation events
2436         https://bugs.webkit.org/show_bug.cgi?id=180657
2437         <rdar://problem/35970103>
2438
2439         Reviewed by Chris Dumez.
2440
2441         Now that we have support for the AnimationPlaybackEvent interface, we need a way to enqueue
2442         such events for dispatch at the opportune time. The Web Animations spec defines two ways
2443         to queue and dispatch events.
2444
2445         If the animation has a "document for timing", it should enqueue events on this document.
2446         In our implementation, if the animation timeline is set to a DocumentTimeline, that means
2447         it has a document for timing, and we let the DocumentTimeline enqueue those events, which
2448         will be dispatched through a dedicated GenericTaskQueue<Timer>. These events will be sorted
2449         by their respective timeline time before being dispatched.
2450
2451         If there is no document for timing, events should be dispatched as a standalone task.
2452
2453         * animation/DocumentTimeline.cpp:
2454         (WebCore::DocumentTimeline::~DocumentTimeline): Close the event dispatch task queue when the
2455         document timeline is torn down.
2456         (WebCore::DocumentTimeline::enqueueAnimationPlaybackEvent): Add the provided event to the
2457         pending animation events queue and, if one hasn't been registered yet, enqueue a task to
2458         dispatch events using a GenericTaskQueue<Timer>.
2459         (WebCore::compareAnimationPlaybackEvents): Comparator used to sort events in performEventDispatchTask()
2460         where events are sorted such that unresolved timeline times come first, and then from the
2461         earlier resolved timeline times to the later resolved timeline times. Events with unresolved
2462         timeline times and equal resolved timeline times are sorted in the order they were enqueued.
2463         (WebCore::DocumentTimeline::performEventDispatchTask): Run a stable sort on a copy of the pending list
2464         of events to dispatch and dispatch the events individually on their respective animations.
2465         * animation/DocumentTimeline.h:
2466         * animation/WebAnimation.cpp:
2467         (WebCore::WebAnimation::create): Pass in the document to the constructor.
2468         (WebCore::WebAnimation::WebAnimation): Use the provided document to initialize ActiveDOMObject.
2469         (WebCore::WebAnimation::enqueueAnimationPlaybackEvent): Create an AnimationPlaybackEvent with
2470         the provided type, timeline time and animation time and enqueue it on the document timeline,
2471         if one is available, or dispatch on this animation as a standalone task.
2472         (WebCore::WebAnimation::acceleratedRunningStateDidChange):
2473         (WebCore::WebAnimation::activeDOMObjectName const):
2474         (WebCore::WebAnimation::canSuspendForDocumentSuspension const):
2475         (WebCore::WebAnimation::stop):
2476         * animation/WebAnimation.h: Define WebAnimation to be an EventTarget and an ActiveDOMObject.
2477         * animation/WebAnimation.idl: Define WebAnimation to be an EventTarget and an ActiveDOMObject.
2478         * dom/EventTargetFactory.in:
2479
2480 2017-12-12  Chris Dumez  <cdumez@apple.com>
2481
2482         Simplify IPC code between WebProcess and StorageProcess for serviceWorker.postMessage()
2483         https://bugs.webkit.org/show_bug.cgi?id=180683
2484
2485         Reviewed by Brady Eidson.
2486
2487         Merge the 2 code paths from calling postMessage() from a ServiceWorkerClient and from
2488         a ServiceWorker. Also, postMessage() now only IPCs an identifier from the WebContent
2489         process to the StorageProcess. The ServiceWorkerClientData is looked up on Storage
2490         process side from the identifier before being sent to the context process.
2491
2492         * workers/service/SWClientConnection.h:
2493         * workers/service/ServiceWorker.cpp:
2494         (WebCore::ServiceWorker::postMessage):
2495         * workers/service/ServiceWorkerTypes.h:
2496         * workers/service/server/SWServer.cpp:
2497         (WebCore::SWServer::clientByID const):
2498         (WebCore::SWServer::matchAll):
2499         (WebCore::SWServer::forEachClientForOrigin):
2500         (WebCore::SWServer::claim):
2501         (WebCore::SWServer::registerServiceWorkerClient):
2502         (WebCore::SWServer::unregisterServiceWorkerClient):
2503         * workers/service/server/SWServer.h:
2504         * workers/service/server/SWServerWorker.cpp:
2505         (WebCore::SWServerWorker::findClientByIdentifier):
2506         * workers/service/server/SWServerWorker.h:
2507
2508 2017-12-12  Youenn Fablet  <youenn@apple.com>
2509
2510         Allow AudioContext to start when getUserMedia is on
2511         https://bugs.webkit.org/show_bug.cgi?id=180680
2512
2513         Reviewed by Eric Carlson.
2514
2515         Test: webrtc/getUserMedia-webaudio-autoplay.html
2516
2517         * Modules/webaudio/AudioContext.cpp:
2518         (WebCore::AudioContext::willBeginPlayback):
2519
2520 2017-12-12  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2521
2522         [Readable Streams API] Throw RangeError if a size is provided when creating a readable byte stream
2523         https://bugs.webkit.org/show_bug.cgi?id=180470
2524
2525         Reviewed by Youenn Fablet.
2526
2527         Throw a RangeError if a ReadableStream is created with type 'bytes' and with a
2528         non-undefined strategy size, as per latest spec:
2529         - https://github.com/whatwg/streams/pull/856
2530         - https://streams.spec.whatwg.org/#rs-constructor (step 4.c)
2531
2532         One new test imported from WPT to check that RangeError is thrown.
2533
2534         * Modules/streams/ReadableStream.js:
2535         (initializeReadableStream): Check strategy size and throw RangeError if needed.
2536
2537 2017-12-12  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2538
2539         [GTK][WebRTC] Stop warning with so much verbosity about not implemented RealtimeMediaSourceCenter
2540         https://bugs.webkit.org/show_bug.cgi?id=180694
2541
2542         Reviewed by Youenn Fablet.
2543
2544         No new tests -- no change in functionality.
2545
2546         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2547         (WebCore::RealtimeMediaSourceCenter::singleton):
2548
2549 2017-12-12  Ms2ger  <Ms2ger@igalia.com>
2550
2551         Implement {DOMMimeTypeArray, DOMPluginArray}::supportedPropertyNames().
2552         https://bugs.webkit.org/show_bug.cgi?id=180471
2553
2554         Reviewed by Darin Adler.
2555
2556         Test: imported/w3c/web-platform-tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator-pluginarray.html
2557
2558         * plugins/DOMMimeTypeArray.cpp:
2559         (WebCore::DOMMimeTypeArray::supportedPropertyNames):
2560         * plugins/DOMPluginArray.cpp:
2561         (WebCore::DOMPluginArray::supportedPropertyNames):
2562
2563 2017-12-12  Yusuke Suzuki  <utatane.tea@gmail.com>
2564
2565         [WTF] Thread::create should have Thread::tryCreate
2566         https://bugs.webkit.org/show_bug.cgi?id=180333
2567
2568         Reviewed by Darin Adler.
2569
2570         No behavior change.
2571
2572         * bindings/js/GCController.cpp:
2573         (WebCore::GCController::garbageCollectOnAlternateThreadForDebugging):
2574         * platform/audio/ReverbConvolver.cpp:
2575         (WebCore::ReverbConvolver::ReverbConvolver):
2576         * platform/audio/ReverbConvolver.h:
2577         * workers/WorkerThread.cpp:
2578         (WebCore::WorkerThread::start):
2579
2580 2017-12-11  Manuel Rego Casasnovas  <rego@igalia.com>
2581
2582         [css-grid] Automatic minimum size is not clamped if min track sizing function is auto
2583         https://bugs.webkit.org/show_bug.cgi?id=180283
2584
2585         Reviewed by Darin Adler.
2586
2587         We were not clamping the automatic minimum size when
2588         the min track sizing function was intrinsic (e.g. minmax(auto, 0px)).
2589         However the spec (https://drafts.csswg.org/css-grid/#min-size-auto)
2590         is very clear regarding that.
2591
2592         This patch modifies
2593         GridTrackSizingAlgorithm::sizeTrackToFitNonSpanningItem(),
2594         so in the case of a fixed max track sizing function it clamps
2595         the automatic minimum size of the item to the stretch fit
2596         of the grid area's size.
2597         It needs to take into account if the item has fixed size, margin, border
2598         and/or padding as those cannot be clamped.
2599
2600         Using WPT tests to verify this behavior,
2601         and corrected a bunch of other tests that were wrong.
2602
2603         Test: imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-minimum-size-grid-items-017.html
2604               imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-minimum-size-grid-items-022.html
2605               imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-minimum-size-grid-items-023.html
2606
2607         * rendering/GridTrackSizingAlgorithm.cpp:
2608         (WebCore::GridTrackSizingAlgorithm::sizeTrackToFitNonSpanningItem):
2609         * rendering/GridTrackSizingAlgorithm.h:
2610         (WebCore::GridTrack::growthLimitIsInfinite const):
2611         * rendering/style/GridTrackSize.h:
2612         (WebCore::GridTrackSize::cacheMinMaxTrackBreadthTypes):
2613         (WebCore::GridTrackSize::hasFixedMaxTrackBreadth const):
2614
2615 2017-12-11  Zan Dobersek  <zdobersek@igalia.com>
2616
2617         [Cairo] Cairo::clipToImageBuffer() should operate on a cairo_surface_t
2618         https://bugs.webkit.org/show_bug.cgi?id=180665
2619
2620         Reviewed by Michael Catanzaro.
2621
2622         Have the Cairo::clipToImageBuffer() function in the CairoUtilities code
2623         operate on a cairo_surface_t object, instead of an Image object.
2624
2625         Call site in GraphicsContext::clipToImageBuffer() is adjusted to first
2626         ensure a non-null Image object, and then retrieve a cairo_surface_t
2627         object from that, passing it on to Cairo::clipToImageBuffer().
2628
2629         No new tests -- no change in functionality.
2630
2631         * platform/graphics/cairo/CairoOperations.cpp:
2632         (WebCore::Cairo::clipToImageBuffer):
2633         * platform/graphics/cairo/CairoOperations.h:
2634         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2635         (WebCore::GraphicsContext::clipToImageBuffer):
2636
2637 2017-12-11  Zan Dobersek  <zdobersek@igalia.com>
2638
2639         [Cairo] Don't use a static cairo_surface_t object for CairoPath contexts
2640         https://bugs.webkit.org/show_bug.cgi?id=180663
2641
2642         Reviewed by Michael Catanzaro.
2643
2644         Instead of using a single cairo_surface_t object and sharing it between
2645         different cairo_t objects handled by CairoPath, create a new mock 1x1px
2646         alpha-only surface for each cairo_t object that's allocated in the
2647         CairoPath constructor.
2648
2649         This avoids potential issues in how Cairo's state handling internally
2650         uses these surfaces, which is completely opaque to us and out of our
2651         control. This also avoids crashes when using this one cairo_surface_t
2652         object through different CairoPath objects across different threads.
2653
2654         No new tests -- no change in behavior.
2655
2656         * platform/graphics/cairo/PlatformPathCairo.cpp:
2657         (WebCore::CairoPath::CairoPath):
2658         (WebCore::pathSurface): Deleted.
2659         * platform/graphics/cairo/PlatformPathCairo.h:
2660         (WebCore::CairoPath::context):
2661
2662 2017-12-11  Zan Dobersek  <zdobersek@igalia.com>
2663
2664         [CoordGraphics] Move UpdateAtlas, AreaAllocator into the platform layer
2665         https://bugs.webkit.org/show_bug.cgi?id=180641
2666
2667         Reviewed by Michael Catanzaro.
2668
2669         Move the UpdateAtlas and AreaAllocator classes and their source files
2670         into the platform layer. This still means using the WebCore namespace,
2671         but apart from that these two classes have no dependency on anything in
2672         the WebKit layer, so they can be moved from there.
2673
2674         No new tests -- no change in functionality.
2675
2676         * platform/TextureMapper.cmake:
2677         * platform/graphics/texmap/coordinated/AreaAllocator.cpp: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.cpp.
2678         (WebCore::AreaAllocator::AreaAllocator):
2679         (WebCore::AreaAllocator::~AreaAllocator):
2680         (WebCore::AreaAllocator::expand):
2681         (WebCore::AreaAllocator::expandBy):
2682         (WebCore::AreaAllocator::release):
2683         (WebCore::AreaAllocator::overhead const):
2684         (WebCore::AreaAllocator::roundAllocation const):
2685         (WebCore::GeneralAreaAllocator::GeneralAreaAllocator):
2686         (WebCore::GeneralAreaAllocator::~GeneralAreaAllocator):
2687         (WebCore::GeneralAreaAllocator::freeNode):
2688         (WebCore::GeneralAreaAllocator::expand):
2689         (WebCore::fitsWithin):
2690         (WebCore::GeneralAreaAllocator::allocate):
2691         (WebCore::GeneralAreaAllocator::allocateFromNode):
2692         (WebCore::GeneralAreaAllocator::splitNode):
2693         (WebCore::GeneralAreaAllocator::updateLargestFree):
2694         (WebCore::GeneralAreaAllocator::release):
2695         (WebCore::GeneralAreaAllocator::overhead const):
2696         * platform/graphics/texmap/coordinated/AreaAllocator.h: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.h.
2697         (WebCore::nextPowerOfTwo):
2698         (WebCore::AreaAllocator::size const):
2699         (WebCore::AreaAllocator::minimumAllocation const):
2700         (WebCore::AreaAllocator::setMinimumAllocation):
2701         (WebCore::AreaAllocator::margin const):
2702         (WebCore::AreaAllocator::setMargin):
2703         * platform/graphics/texmap/coordinated/UpdateAtlas.cpp: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp.
2704         (WebCore::UpdateAtlas::UpdateAtlas):
2705         (WebCore::UpdateAtlas::~UpdateAtlas):
2706         (WebCore::UpdateAtlas::buildLayoutIfNeeded):
2707         (WebCore::UpdateAtlas::didSwapBuffers):
2708         (WebCore::UpdateAtlas::getCoordinatedBuffer):
2709         * platform/graphics/texmap/coordinated/UpdateAtlas.h: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h.
2710         (WebCore::UpdateAtlas::size const):
2711         (WebCore::UpdateAtlas::supportsAlpha const):
2712         (WebCore::UpdateAtlas::addTimeInactive):
2713         (WebCore::UpdateAtlas::isInactive const):
2714         (WebCore::UpdateAtlas::isInUse const):
2715
2716 2017-12-11  Ryosuke Niwa  <rniwa@webkit.org>
2717
2718         Disable NoEventDispatchAssertion release assertion in WebKit1
2719         https://bugs.webkit.org/show_bug.cgi?id=180616
2720
2721         Reviewed by Zalan Bujtas.
2722
2723         Disabled the release assertion for NoEventDispatchAssertion in WebKit1 since there are many
2724         delegate callbacks that happen at unsafe timing, and we don't have any hope of fixing them
2725         in short term.
2726
2727         * bindings/js/ScriptController.cpp:
2728         (WebCore::ScriptController::canExecuteScripts):
2729         * dom/Document.cpp:
2730         (WebCore::isSafeToUpdateStyleOrLayout):
2731         * dom/ScriptElement.cpp:
2732         (WebCore::ScriptElement::executeClassicScript):
2733         * platform/RuntimeApplicationChecks.h:
2734         (WebCore::isInWebProcess):
2735         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
2736         (WebCore::isInWebProcess): Extracted from IOSApplication::isWebProcess.
2737         (WebCore::IOSApplication::isWebProcess):
2738
2739 2017-12-11  Darin Adler  <darin@apple.com>
2740
2741         Improve FontSelectionAlgorithm, including moving from IntegerHasher to Hasher
2742         https://bugs.webkit.org/show_bug.cgi?id=180340
2743
2744         Reviewed by Dan Bates.
2745
2746         * css/CSSFontFaceSet.h: Moved FontSelectionRequestKey and FontSelectionRequestKeyHash
2747         here to be private members, and used a std::optional instead of a class for this.
2748         Also use the new Hasher to compute the hash. Also added FontSelectionRequestKeyHashTraits.
2749
2750         * platform/graphics/FontDescription.cpp:
2751         (WebCore::FontDescription::FontDescription): Updated since FontSelectionRequest
2752         does not always have a constructor any more.
2753
2754         * platform/graphics/FontSelectionAlgorithm.h: Tweaked comments. Used "using" instead
2755         of typedef. Formatted some trivial functions as single lines. Stopped using
2756         NeverDestroyed for simple classes like FontSelectionValue; it's not needed unless
2757         there is a destructor. Got rid of some incorrect use of const. Replaced some member
2758         functions with non-member functions. Moved some function bodies out of class definitions.
2759         Used a lot of constexpr functions.
2760         (WebCore::FontSelectionRequest::tied const): Added so we can easily write both == and the
2761         hash function without listing the data members.
2762         (WebCore::add): Added an overload so we can hash things that include FontSelectionRequest.
2763         (WebCore::FontSelectionRequestKey::FontSelectionRequestKey): Changed this class to
2764         use std::optional instead of a separate boolean for deleted values.
2765         (WebCore::FontSelectionRequestKey::isHashTableDeletedValue const): Ditto.
2766         (WebCore::FontSelectionRequestKey::operator== const): Ditto.
2767         (WebCore::FontSelectionRequestKeyHash::hash): Ditto.
2768         (WebCore::FontSelectionRequestKeyHash::equal): Ditto.
2769         (WebCore::FontSelectionCapabilities::tied const): Added so we can easily write both ==
2770         and the hash function without listing the data members.
2771         (WebCore::FontSelectionSpecifiedCapabilities::tied const): Ditto.
2772         (WebCore::FontSelectionAlgorithm::FontSelectionAlgorithm): Use make_unique instead of new.
2773
2774         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2775         (WebCore::findClosestFont): Move in the vector instead of copying it when creating a
2776         FontSelectionAlgorithm object.
2777
2778 2017-12-11  Jer Noble  <jer.noble@apple.com>
2779
2780         [EME] support update() for FairPlayStreaming in Modern EME API
2781         https://bugs.webkit.org/show_bug.cgi?id=180542
2782
2783         Reviewed by Eric Carlson.
2784
2785         Support the updateLicense() method in CDMInstanceFairPlayStreaming. Also, support adding a
2786         AVStreamDataParser to the AVContentKeySession.
2787
2788         Drive-by fixes:
2789
2790         - Sometimes, AVFoundation will give us a base64 encoded string with spaces url-disallowed
2791         characters, so use base64Decode() rather than base64URLDecode().
2792
2793         * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
2794         (WebCore::validFairPlayStreamingSchemes):
2795         (WebCore::extractSinfData):
2796         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
2797         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
2798         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense):
2799         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest):
2800         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didFailToProvideRequest):
2801         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2802         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstance const):
2803         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2804         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceAttached):
2805         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceDetached):
2806         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::attemptToDecryptWithInstance):
2807         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
2808         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2809         (WebCore::SourceBufferPrivateAVFObjC::destroyParser):
2810         (WebCore::SourceBufferPrivateAVFObjC::setCDMInstance):
2811
2812 2017-12-11  Eric Carlson  <eric.carlson@apple.com>
2813
2814         Web Inspector: Optionally log WebKit log parameters as JSON
2815         https://bugs.webkit.org/show_bug.cgi?id=180529
2816         <rdar://problem/35909462>
2817
2818         Reviewed by Joseph Pecoraro.
2819
2820         * dom/Document.cpp:
2821         (WebCore::Document::didLogMessage):Update for API change. Don't check for main thread, that
2822         is already done in addConsoleMessage.
2823         * dom/Document.h:
2824
2825         * html/HTMLMediaElement.cpp:
2826         (WebCore::HTMLMediaElement::updatePlayState): Cleanup logging.
2827
2828         * html/track/DataCue.cpp:
2829         (WebCore::DataCue::toJSONString const): Serialize to JSON string.
2830         (WebCore::DataCue::toString const): Deleted.
2831         * html/track/DataCue.h:
2832         (WTF::LogArgument<WebCore::DataCue>::toString):
2833
2834         * html/track/TextTrackCue.cpp:
2835         (WebCore::TextTrackCue::toJSON const): Ditto.
2836         (WebCore::TextTrackCue::toJSONString const):
2837         (WebCore::TextTrackCue::toString const): Deleted.
2838         * html/track/TextTrackCue.h:
2839         (WTF::LogArgument<WebCore::TextTrackCue>::toString):
2840
2841         * html/track/TextTrackCueGeneric.cpp:
2842         (WebCore::TextTrackCueGeneric::toJSONString const): Ditto.
2843         (WebCore::TextTrackCueGeneric::toString const): Deleted.
2844         * html/track/TextTrackCueGeneric.h:
2845         (WTF::LogArgument<WebCore::TextTrackCueGeneric>::toString):
2846
2847         * html/track/VTTCue.cpp:
2848         (WebCore::VTTCue::toJSONString const): Ditto.
2849         (WebCore::VTTCue::toString const): Deleted.
2850         * html/track/VTTCue.h:
2851         (WTF::LogArgument<WebCore::VTTCue>::toString):
2852
2853         * platform/graphics/InbandTextTrackPrivateClient.h:
2854         (WebCore::GenericCueData::toJSONString const): Ditto.
2855         (WTF::LogArgument<WebCore::GenericCueData>::toString):
2856         (WebCore::GenericCueData::toString const): Deleted.
2857
2858         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
2859         (WebCore::InbandTextTrackPrivateAVF::processAttributedStrings): Cleanup logging.
2860         (WebCore::InbandTextTrackPrivateAVF::removeCompletedCues): Ditto.
2861         (WebCore::InbandTextTrackPrivateAVF::processNativeSamples): Log the entire cue.
2862         (WebCore::InbandTextTrackPrivateAVF::readNativeSampleBuffer): Cleanup logging.
2863
2864         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
2865         (WebCore::MediaPlayerPrivateAVFoundation::maxMediaTimeSeekable const): Don't log, it isn't
2866         interesting and happens frequently.
2867         (WebCore::MediaPlayerPrivateAVFoundation::minMediaTimeSeekable const): Ditto.
2868
2869         * platform/graphics/iso/ISOVTTCue.cpp:
2870         (WebCore::ISOWebVTTCue::toJSONString const): Serialize to JSON string.
2871
2872         * platform/graphics/iso/ISOVTTCue.h:
2873         (WTF::LogArgument<WebCore::ISOWebVTTCue>::toString): Ditto.
2874
2875 2017-12-11  Youenn Fablet  <youenn@apple.com>
2876
2877         Use VCP H264 encoder for platforms supporting it
2878         https://bugs.webkit.org/show_bug.cgi?id=179076
2879         rdar://problem/35180773
2880
2881         Reviewed by Eric Carlson.
2882
2883         Covered by existing test coverage.
2884
2885         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.cpp:
2886         (WebCore::VideoToolboxVideoEncoderFactory::setActive):
2887         (WebCore::VideoToolboxVideoEncoderFactory::CreateSupportedVideoEncoder):
2888         (WebCore::VideoToolboxVideoEncoderFactory::DestroyVideoEncoder):
2889         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.h:
2890
2891 2017-12-11  Chris Dumez  <cdumez@apple.com>
2892
2893         Merge ServiceWorkerClientIdentifier into ServiceWorkerClientData
2894         https://bugs.webkit.org/show_bug.cgi?id=180669
2895
2896         Reviewed by Youenn Fablet.
2897
2898         Merge ServiceWorkerClientIdentifier into ServiceWorkerClientData, for consistency with
2899         ServiceWorkerIdentifier / ServiceWorkerData, and start simplifying the postMessage() code.
2900
2901         * WebCore.xcodeproj/project.pbxproj:
2902         * dom/Document.cpp:
2903         (WebCore::Document::setServiceWorkerConnection):
2904         * workers/service/SWClientConnection.h:
2905         * workers/service/ServiceWorker.cpp:
2906         (WebCore::ServiceWorker::postMessage):
2907         * workers/service/ServiceWorkerClient.cpp:
2908         (WebCore::ServiceWorkerClient::getOrCreate):
2909         (WebCore::ServiceWorkerClient::ServiceWorkerClient):
2910         * workers/service/ServiceWorkerClient.h:
2911         (WebCore::ServiceWorkerClient::identifier const):
2912         * workers/service/ServiceWorkerClientData.cpp:
2913         (WebCore::ServiceWorkerClientData::isolatedCopy const):
2914         (WebCore::ServiceWorkerClientData::from):
2915         * workers/service/ServiceWorkerClientData.h:
2916         (WebCore::ServiceWorkerClientData::encode const):
2917         (WebCore::ServiceWorkerClientData::decode):
2918         * workers/service/ServiceWorkerClientInformation.h: Removed.
2919         * workers/service/ServiceWorkerClients.cpp:
2920         (WebCore::didFinishGetRequest):
2921         (WebCore::ServiceWorkerClients::get):
2922         (WebCore::matchAllCompleted):
2923         * workers/service/ServiceWorkerTypes.h:
2924         * workers/service/ServiceWorkerWindowClient.cpp:
2925         (WebCore::ServiceWorkerWindowClient::ServiceWorkerWindowClient):
2926         * workers/service/ServiceWorkerWindowClient.h:
2927         * workers/service/context/SWContextManager.cpp:
2928         (WebCore::SWContextManager::postMessageToServiceWorker):
2929         * workers/service/context/SWContextManager.h:
2930         * workers/service/context/ServiceWorkerThread.cpp:
2931         (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
2932         * workers/service/context/ServiceWorkerThread.h:
2933         * workers/service/server/SWServer.cpp:
2934         (WebCore::SWServer::findClientByIdentifier):
2935         (WebCore::SWServer::matchAll):
2936         (WebCore::SWServer::claim):
2937         (WebCore::SWServer::registerServiceWorkerClient):
2938         * workers/service/server/SWServer.h:
2939         * workers/service/server/SWServerToContextConnection.h:
2940         * workers/service/server/SWServerWorker.h:
2941
2942 2017-12-11  Daniel Bates  <dabates@apple.com>
2943
2944         Fix the macOS Sierra build following r225179
2945         (https://bugs.webkit.org/show_bug.cgi?id=180011)
2946
2947         Substitute TARGET_MAC_OS_X_VERSION_LESS_THAN_101300 for TARGET_MAC_OS_X_VERSION_LESS_THAN_1013000.
2948
2949         * Configurations/WebCore.xcconfig:
2950
2951 2017-12-11  Zalan Bujtas  <zalan@apple.com>
2952
2953         Make FrameView objects IsoHeap allocated
2954         https://bugs.webkit.org/show_bug.cgi?id=180668
2955         <rdar://problem/35976738>
2956
2957         Reviewed by Simon Fraser.
2958
2959         Related to <https://trac.webkit.org/changeset/225719/webkit>
2960
2961         * page/FrameView.cpp:
2962         * page/FrameView.h:
2963
2964 2017-12-11  Antoine Quint  <graouts@apple.com>
2965
2966         [Web Animations] Implement AnimationPlaybackEvent and AnimationPlaybackEventInit
2967         https://bugs.webkit.org/show_bug.cgi?id=180647
2968
2969         Reviewed by Dean Jackson.
2970
2971         Actually fix Windows build this time.
2972
2973         * animation/AnimationPlaybackEventInit.h:
2974
2975 2017-12-11  Antoine Quint  <graouts@apple.com>
2976
2977         [Web Animations] Implement AnimationPlaybackEvent and AnimationPlaybackEventInit
2978         https://bugs.webkit.org/show_bug.cgi?id=180647
2979         <rdar://problem/35966325>
2980
2981         Reviewed by Dean Jackson.
2982
2983         Unreviewed, fix Windows build.
2984
2985         * animation/AnimationPlaybackEventInit.h:
2986
2987 2017-12-11  Zalan Bujtas  <zalan@apple.com>
2988
2989         FloatingObjects/FloatingObject classes should hold weak references to renderers
2990         https://bugs.webkit.org/show_bug.cgi?id=180627
2991         <rdar://problem/35954069>
2992
2993         Reviewed by Antti Koivisto.
2994
2995         * rendering/FloatingObjects.cpp:
2996         (WebCore::FloatingObject::FloatingObject):
2997         (WebCore::ComputeFloatOffsetAdapter::ComputeFloatOffsetAdapter):
2998         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter::ComputeFloatOffsetForFloatLayoutAdapter):
2999         (WebCore::ComputeFloatOffsetForLineLayoutAdapter::ComputeFloatOffsetForLineLayoutAdapter):
3000         (WebCore::FindNextFloatLogicalBottomAdapter::FindNextFloatLogicalBottomAdapter):
3001         (WebCore::FindNextFloatLogicalBottomAdapter::collectIfNeeded):
3002         (WebCore::FloatingObjects::findNextFloatLogicalBottomBelow):
3003         (WebCore::FloatingObjects::findNextFloatLogicalBottomBelowForBlock):
3004         (WebCore::FloatingObjects::FloatingObjects):
3005         (WebCore::FloatingObjects::clearLineBoxTreePointers):
3006         (WebCore::FloatingObjects::logicalLeftOffsetForPositioningFloat):
3007         (WebCore::FloatingObjects::logicalRightOffsetForPositioningFloat):
3008         (WebCore::FloatingObjects::logicalLeftOffset):
3009         (WebCore::FloatingObjects::logicalRightOffset):
3010         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded):
3011         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded):
3012         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter<FloatTypeValue>::heightRemaining const):
3013         (WebCore::ComputeFloatOffsetAdapter<FloatTypeValue>::collectIfNeeded):
3014         (WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded):
3015         (WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded):
3016         * rendering/FloatingObjects.h:
3017         (WebCore::FloatingObject::renderer const):
3018         (WebCore::FloatingObjects::renderer const):
3019
3020 2017-12-11  David Quesada  <david_quesada@apple.com>
3021
3022         Turn on ENABLE_APPLICATION_MANIFEST
3023         https://bugs.webkit.org/show_bug.cgi?id=180562
3024         rdar://problem/35924737
3025
3026         Reviewed by Geoffrey Garen.
3027
3028         * Configurations/FeatureDefines.xcconfig:
3029         * loader/LinkLoader.cpp:
3030         (WebCore::createLinkPreloadResourceClient):
3031         * loader/cached/CachedResourceRequest.cpp:
3032             Add a missing #include that was implicitly added in the unified source when
3033             the feature is disabled.
3034
3035 2017-12-11  Dean Jackson  <dino@apple.com>
3036
3037         Add a runtime feature flag for ImageBitmap and OffscreenCanvas
3038         https://bugs.webkit.org/show_bug.cgi?id=180652
3039         <rdar://problem/35969611>
3040
3041         Reviewed by Antoine Quint.
3042
3043         Add a RuntimeEnabledFeature for these interfaces, and link the bindings
3044         to the feature.
3045
3046         Test: fast/canvas/offscreen-enabled.html
3047
3048         * bindings/js/WebCoreBuiltinNames.h:
3049         * html/ImageBitmap.idl:
3050         * html/OffscreenCanvas.idl:
3051         * page/RuntimeEnabledFeatures.h:
3052         (WebCore::RuntimeEnabledFeatures::setImageBitmapOffscreenCanvasEnabled):
3053         (WebCore::RuntimeEnabledFeatures::imageBitmapOffscreenCanvasEnabled const):
3054         * page/WindowOrWorkerGlobalScope.idl:
3055
3056 2017-12-11  Antoine Quint  <graouts@apple.com>
3057
3058         [Web Animations] Implement AnimationPlaybackEvent and AnimationPlaybackEventInit
3059         https://bugs.webkit.org/show_bug.cgi?id=180647
3060         <rdar://problem/35966325>
3061
3062         Reviewed by Dean Jackson.
3063
3064         We implement the AnimationPlaybackEvent interface and AnimationPlaybackEventInit dictionary
3065         as the first step towards dispatching animation "finish" and "cancel" events.
3066
3067         Animation playback events will be dispatched on Animation objects and expose the timeline time
3068         and animation current time at the time they were constructed. Dispatch itself, which will be
3069         the focus of the next patch, is not synchronous, so it's important to track those values
3070         at creation time.
3071
3072         No new tests yet, followup patches will enable event dispatch and existing Web Platform Tests
3073         will show progressions.
3074
3075         * CMakeLists.txt:
3076         * DerivedSources.make:
3077         * Sources.txt:
3078         * WebCore.xcodeproj/project.pbxproj:
3079         * animation/AnimationPlaybackEvent.cpp: Added.
3080         (WebCore::AnimationPlaybackEvent::AnimationPlaybackEvent):
3081         (WebCore::AnimationPlaybackEvent::bindingsCurrentTime const):
3082         (WebCore::AnimationPlaybackEvent::bindingsTimelineTime const):
3083         * animation/AnimationPlaybackEvent.h: Added.
3084         * animation/AnimationPlaybackEvent.idl: Added.
3085         * animation/AnimationPlaybackEventInit.h: Added.
3086         * animation/AnimationPlaybackEventInit.idl: Added.
3087         * bindings/js/WebCoreBuiltinNames.h:
3088         * dom/EventNames.in:
3089
3090 2017-12-11  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3091
3092         [WinCairo] DumpRenderTree times out for all non-http tests
3093         https://bugs.webkit.org/show_bug.cgi?id=180571
3094
3095         Reviewed by Alex Christensen.
3096
3097         Bug fix on processing the curl event for file protocol.
3098
3099         No new tests. This fix is to run existing tests.
3100
3101         * platform/network/curl/CurlRequest.cpp:
3102         (WebCore::CurlRequest::completeDidReceiveResponse):
3103         * platform/network/curl/CurlRequest.h:
3104         (WebCore::CurlRequest::isCompleted const):
3105         (WebCore::CurlRequest::isCancelled const):
3106         (WebCore::CurlRequest::isCompletedOrCancelled const):
3107
3108 2017-12-11  Manuel Rego Casasnovas  <rego@igalia.com>
3109
3110         REGRESSION(r221931): Row stretch doesn't work for grid container with min-height
3111         https://bugs.webkit.org/show_bug.cgi?id=180287
3112
3113         Reviewed by Darin Adler.
3114
3115         In r221931 we moved the stretch phase as the last step of
3116         the track sizing algorithm.
3117         However this introduced a regression as we were no longer
3118         taking into account the grid container min-width|height constraints
3119         during this step.
3120
3121         The CSS WG modified the spec so it now defines what to do
3122         in these situations (https://drafts.csswg.org/css-grid/#algo-stretch):
3123           "If the free space is indefinite, but the grid container
3124            has a definite min-width/height, use that size to calculate
3125            the free space for this step instead."
3126
3127         This patch adds a new method
3128         GridTrackSizingAlgorithmStrategy::freeSpaceForStretchAutoTracksStep().
3129         When we're in the DefiniteSizeStrategy it just returns the current
3130         free space.
3131         For the IndefiniteSizeStrategy in the columns case we don't need
3132         any special computation (the same that happens in
3133         recomputeUsedFlexFractionIfNeeded()); for rows it uses the min size
3134         of the grid container (respecting min-width|height properties)
3135         to calculate the free space.
3136
3137         Test: imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-stretch-respects-min-size-001.html
3138
3139         * rendering/GridTrackSizingAlgorithm.cpp:
3140         (WebCore::IndefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep const):
3141         (WebCore::DefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep const):
3142         (WebCore::GridTrackSizingAlgorithm::stretchAutoTracks):
3143         * rendering/GridTrackSizingAlgorithm.h:
3144
3145 2017-12-10  Minsheng Liu  <lambda@liu.ms>
3146
3147         Incorrect bounds inside <mover>/<munder> when a stretchy operator is present
3148         https://bugs.webkit.org/show_bug.cgi?id=179682
3149
3150         Reviewed by Frédéric Wang.
3151
3152         Currently a stretchy operator inside <mover>/<munder>/<munderover> is stretched
3153         during paint() rather than layout(), which leads to both end user confusion
3154         and many unexpected behaviors. This patch rewrites
3155         RenderMathMLUnderOver::stretchHorizontalOperatorsAndLayoutChildren()
3156         to both eliminate the issue and make operator stretching more standard
3157         conforming.
3158
3159         A test is added to check the stretch width of stretchy operators in various
3160         scenarios:
3161         mathml/opentype/munderover-stretch-width.html
3162
3163         A previous test is updated:
3164         mathml/opentype/opentype-stretchy-horizontal.html
3165
3166         * rendering/mathml/RenderMathMLOperator.cpp:
3167         (WebCore::RenderMathMLOperator::stretchTo):
3168         (WebCore::RenderMathMLOperator::resetStretchSize):
3169         (WebCore::RenderMathMLOperator::paint):
3170         * rendering/mathml/RenderMathMLOperator.h:
3171         (WebCore::RenderMathMLOperator::setStretchWidthLocked):
3172         (WebCore::RenderMathMLOperator::isStretchWidthLocked const):
3173         * rendering/mathml/RenderMathMLUnderOver.cpp:
3174         (WebCore::toHorizontalStretchyOperator):
3175         (WebCore::fixLayoutAfterStretch):
3176         (WebCore::RenderMathMLUnderOver::stretchHorizontalOperatorsAndLayoutChildren):
3177
3178 2017-12-10  Yusuke Suzuki  <utatane.tea@gmail.com>
3179
3180         Unreviewed, follow-up patch after r225470
3181         https://bugs.webkit.org/show_bug.cgi?id=180308
3182
3183         * Modules/webdatabase/SQLTransaction.cpp:
3184         (WebCore::SQLTransaction::checkAndHandleClosedDatabase):
3185         Use consistent operands.
3186
3187         * bindings/js/JSCallbackData.h:
3188         (WebCore::JSCallbackData::JSCallbackData):
3189         Use class field initializer.
3190
3191         * xml/parser/XMLDocumentParserLibxml2.cpp:
3192         (WebCore::openFunc):
3193         Use consistent operands.
3194
3195 2017-12-09  Ryosuke Niwa  <rniwa@webkit.org>
3196
3197         iOS: Crash in Document::updateLayout() via Document::processViewport
3198         https://bugs.webkit.org/show_bug.cgi?id=180619
3199         <rdar://problem/35717575>
3200
3201         Reviewed by Zalan Bujtas.
3202
3203         The crash is caused by modern media controls updating the layout in the middle of insertedIntoAncestor
3204         via HTMLMediaElement::setControllerJSProperty inside Document::pageScaleFactorChangedAndStable.
3205
3206         Fixed the crash by delaying the work to update the viewport configuration until didFinishInsertingNode
3207         since updating the viewport configuration results in a lot of related code running in response,
3208         and making sure all that code never tries to execute an author script is not attainable in the short term,
3209         and a maintenance nightmare in the long term.
3210
3211         Test: media/ios/viewport-change-with-video.html
3212
3213         * html/HTMLMetaElement.cpp:
3214         (WebCore::HTMLMetaElement::insertedIntoAncestor):
3215         (WebCore::HTMLMetaElement::didFinishInsertingNode): Added.
3216         * html/HTMLMetaElement.h:
3217
3218 2017-12-08  Zalan Bujtas  <zalan@apple.com>
3219
3220         Document::updateLayout() could destroy current frame.
3221         https://bugs.webkit.org/show_bug.cgi?id=180525
3222         <rdar://problem/35906836>
3223
3224         Reviewed by Simon Fraser.
3225
3226         Early return when Document::updateLayout() triggers Frame destruction.
3227
3228         Test: fast/frames/crash-when-iframe-is-remove-in-eventhandler.html
3229
3230         * dom/TreeScope.cpp:
3231         (WebCore::absolutePointIfNotClipped):
3232
3233 2017-12-08  Chris Dumez  <cdumez@apple.com>
3234
3235         ServiceWorkerGlobalScope is a global object and should be marked as [ImplicitThis] in the IDL
3236         https://bugs.webkit.org/show_bug.cgi?id=180615
3237
3238         Reviewed by Brady Eidson.
3239
3240         ServiceWorkerGlobalScope is a global object and should be marked as [ImplicitThis] in the IDL, similarly to what we do for Window.
3241         This allows a getter to be fallback to the global object as ThisValue when the cast of the ThisValue to the expected type fails.
3242
3243         No new tests, rebaselined existing test.
3244
3245         * workers/DedicatedWorkerGlobalScope.idl:
3246         * workers/WorkerGlobalScope.idl:
3247         * workers/service/ServiceWorkerGlobalScope.idl:
3248
3249 2017-12-08  Brady Eidson  <beidson@apple.com>
3250
3251         Delay some service worker operations until after the database import completes.
3252         https://bugs.webkit.org/show_bug.cgi?id=180573
3253
3254         Reviewed by Chris Dumez.
3255
3256         No new tests (Not testable yet).
3257
3258         Right after the storage process launches it starts importing registration records.
3259         During this time, a lot of the decisions we make regarding registrations, fetch, etc.
3260         are invalid, as they rely on those in-memory records being in place.
3261         
3262         This patch delays certain things until after the initial origin table import is complete.
3263         
3264         * workers/service/server/RegistrationStore.cpp:
3265         (WebCore::RegistrationStore::databaseOpenedAndRecordsImported):
3266
3267         * workers/service/server/SWOriginStore.h:
3268
3269         * workers/service/server/SWServer.cpp:
3270         (WebCore::SWServer::registrationStoreImportComplete): Tell the origin store the initial
3271           import was completed.
3272         (WebCore::SWServer::addRegistrationFromStore):
3273         * workers/service/server/SWServer.h:
3274
3275 2017-12-08  Youenn Fablet  <youenn@apple.com>
3276
3277         Service Worker should use a correct user agent
3278         https://bugs.webkit.org/show_bug.cgi?id=180566
3279         <rdar://problem/35926295>
3280
3281         Reviewed by Chris Dumez.
3282
3283         Test: http/wpt/service-workers/useragent.https.html
3284
3285         Make ServiceWorkerFrameLoaderClient return a valid UserAgent.
3286         Pass user agent to ServiceWorkerThread so that navigation.userAgent is correctly initialized.
3287         Allow ServiceWorkerFrameLoaderClient to clean itself when no longer needed.
3288
3289         * loader/EmptyFrameLoaderClient.h:
3290         * workers/service/context/ServiceWorkerThread.cpp:
3291         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
3292         * workers/service/context/ServiceWorkerThread.h:
3293         * workers/service/context/ServiceWorkerThreadProxy.cpp:
3294         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
3295         (WebCore::ServiceWorkerThreadProxy::frameLoaderClient):
3296         * workers/service/context/ServiceWorkerThreadProxy.h:
3297
3298 2017-12-07  Simon Fraser  <simon.fraser@apple.com>
3299
3300         Wrong caret position for input field inside a fixed position parent on iOS 11
3301         https://bugs.webkit.org/show_bug.cgi?id=176896
3302         rdar://problem/33726145
3303
3304         Reviewed by Tim Horton.
3305
3306         In r219668 I added code to compute a layout viewport rect in the web process, so that
3307         after programmatic scrolling, getBoundingClientRect() would return the correct values.
3308         However, that computation sometimes used a different visual viewport than the UI process,
3309         resulting in a different layout viewport being set. This would happen when the keyboard
3310         was visible, and the combination of this and zooming when focusing an input would result
3311         in a state where the scrolling tree contained notes computed with the bad layout viewport.
3312         This could cause apparently offset fixed elements, and bad caret positioning if those fixed
3313         elements contained the focused input.
3314
3315         Fix by passing to the web process the same visual viewport rect that the UI process is using,
3316         namely "unobscuredContentRectRespectingInputViewBounds". This was already being set in
3317         VisibleContentRectUpdateInfo but wasn't encoded/decoded, so fix that. Set it as an optional<>
3318         on FrameView when different from the normal visual viewport, and return it from
3319         visualViewportRect().
3320
3321         Some other minor logging changes.
3322
3323         Test: fast/visual-viewport/ios/caret-after-focus-in-fixed.html
3324
3325         * page/FrameView.cpp:
3326         (WebCore::FrameView::setVisualViewportOverrideRect):
3327         (WebCore::FrameView::updateLayoutViewport):
3328         (WebCore::FrameView::visualViewportRect const):
3329         * page/FrameView.h:
3330         * page/scrolling/mac/ScrollingTreeFixedNode.mm:
3331         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange):
3332
3333 2017-12-08  Zalan Bujtas  <zalan@apple.com>
3334
3335         Make inline box objects IsoHeap allocated.
3336         https://bugs.webkit.org/show_bug.cgi?id=180556
3337         <rdar://problem/35923629>
3338
3339         Reviewed by Filip Pizlo.
3340
3341         * rendering/EllipsisBox.cpp:
3342         * rendering/EllipsisBox.h:
3343         * rendering/InlineBox.cpp:
3344         * rendering/InlineBox.h:
3345         * rendering/InlineElementBox.cpp:
3346         * rendering/InlineElementBox.h:
3347         * rendering/InlineFlowBox.cpp:
3348         * rendering/InlineFlowBox.h:
3349         * rendering/InlineTextBox.cpp:
3350         * rendering/InlineTextBox.h:
3351         * rendering/RootInlineBox.cpp:
3352         * rendering/RootInlineBox.h:
3353         * rendering/TrailingFloatsRootInlineBox.h:
3354         * rendering/svg/SVGInlineFlowBox.cpp:
3355         * rendering/svg/SVGInlineFlowBox.h:
3356         * rendering/svg/SVGInlineTextBox.cpp:
3357         * rendering/svg/SVGInlineTextBox.h:
3358         * rendering/svg/SVGRootInlineBox.cpp:
3359         * rendering/svg/SVGRootInlineBox.h:
3360
3361 2017-12-08  Chris Dumez  <cdumez@apple.com>
3362
3363         Clearing all Website Data should remove service worker registrations on disk
3364         https://bugs.webkit.org/show_bug.cgi?id=180558
3365
3366         Reviewed by Youenn Fablet.
3367
3368         Clear service worker registrations on disk in addition to the ones in memory.
3369
3370         * workers/service/server/RegistrationDatabase.cpp:
3371         (WebCore::v1RecordsTableSchema):
3372         (WebCore::v1RecordsTableSchemaAlternate):
3373         (WebCore::databaseFilename):
3374         Make sure these always get called from the background thread since they use
3375         a static string.
3376
3377         (WebCore::RegistrationDatabase::RegistrationDatabase):
3378         Call importRecordsIfNecessary() instead of openSQLiteDatabase(). importRecordsIfNecessary()
3379         only calls openSQLiteDatabase() if the database file exists, to avoid creating a database
3380         file unnecessarily.
3381
3382         (WebCore::RegistrationDatabase::databasePath const):
3383         New method which returns the database file path.
3384
3385         (WebCore::RegistrationDatabase::openSQLiteDatabase):
3386
3387         (WebCore::RegistrationDatabase::importRecordsIfNecessary):
3388         New methods which imports records if the database file exist. It the database file does
3389         not exist, it does not create it.
3390
3391         (WebCore::RegistrationDatabase::pushChanges):
3392         Call completion handler when changes are pushed.
3393
3394         (WebCore::RegistrationDatabase::clearAll):
3395         Close the database if it is open, then remove the database files.
3396
3397         (WebCore::RegistrationDatabase::doPushChanges):
3398         If the database is not already open, we now open it when trying to write changes for
3399         the first time.
3400
3401         * workers/service/server/RegistrationDatabase.h:
3402         * workers/service/server/RegistrationStore.cpp:
3403         (WebCore::RegistrationStore::clearAll):
3404         (WebCore::RegistrationStore::flushChanges):
3405         * workers/service/server/RegistrationStore.h:
3406
3407         * workers/service/server/SWServer.cpp:
3408         (WebCore::SWServer::clearAll):
3409         (WebCore::SWServer::clear):
3410         Also clear the database.
3411
3412         * workers/service/server/SWServer.h:
3413
3414         * workers/service/server/SWServerWorker.cpp:
3415         (WebCore::SWServerWorker::terminate):
3416         Only call SWServer::terminateWorker() if the worker is running. Otherwise, we hit
3417         an assertion when clearing a registration would worker was already terminated.
3418
3419 2017-12-08  Joseph Pecoraro  <pecoraro@apple.com>
3420
3421         ServiceWorker Inspector: Various issues inspecting service worker on mobile.twitter.com
3422         https://bugs.webkit.org/show_bug.cgi?id=180520
3423         <rdar://problem/35900764>
3424
3425         Reviewed by Brian Burg.
3426
3427         * inspector/agents/worker/ServiceWorkerAgent.cpp:
3428         (WebCore::ServiceWorkerAgent::getInitializationInfo):
3429         * inspector/agents/worker/ServiceWorkerAgent.h:
3430         Add initial script content to initialization so we always at least have main resource content.
3431
3432 2017-12-08  Joseph Pecoraro  <pecoraro@apple.com>
3433
3434         ServiceWorker Inspector: Should be able to see image content from CacheStorage.add(url) network request
3435         https://bugs.webkit.org/show_bug.cgi?id=180506
3436
3437         Reviewed by Brian Burg.
3438
3439         No test as this only happens inside a ServiceWorker inspector which
3440         we don't yet have a way to test. In a Page Inspector, the
3441         CacheStorage.add network request already behaves as expected.
3442
3443         * inspector/NetworkResourcesData.cpp:
3444         (WebCore::NetworkResourcesData::responseReceived):
3445         (WebCore::shouldBufferResourceData):
3446         * inspector/NetworkResourcesData.h:
3447         (WebCore::NetworkResourcesData::ResourceData::forceBufferData const):
3448         (WebCore::NetworkResourcesData::ResourceData::setForceBufferData):
3449         Provide a way to force buffering in NetworkResourceData.
3450
3451         * inspector/agents/InspectorNetworkAgent.cpp:
3452         (WebCore::InspectorNetworkAgent::didReceiveResponse):
3453         * inspector/agents/InspectorNetworkAgent.h:
3454         * inspector/agents/page/PageNetworkAgent.h:
3455         * inspector/agents/worker/WorkerNetworkAgent.h:
3456         Enable force buffering in a Worker Network Agent.
3457
3458 2017-12-08  Daniel Bates  <dabates@apple.com>
3459
3460         Remove unnecessary prefix from AutoFillButtonType enumerators
3461         https://bugs.webkit.org/show_bug.cgi?id=180512
3462
3463         Reviewed by Tim Horton.
3464
3465         * testing/Internals.cpp:
3466         (WebCore::toAutoFillButtonType):
3467         * testing/Internals.h:
3468         * testing/Internals.idl:
3469
3470 2017-12-08  Dean Jackson  <dino@apple.com>
3471
3472         Implement transferToImageBitmap for WebGL offscreen canvas objects
3473         https://bugs.webkit.org/show_bug.cgi?id=180603
3474         <rdar://problem/34147143>
3475
3476         Reviewed by Sam Weinig.
3477
3478         Implement the basic version of creating an ImageBitmap from an
3479         OffscreenCanvas that is using a WebGL context.
3480
3481         Tests: http/wpt/offscreen-canvas/transferToImageBitmap-empty.html
3482                http/wpt/offscreen-canvas/transferToImageBitmap-webgl.html
3483
3484         * html/ImageBitmap.cpp:
3485         (WebCore::ImageBitmap::create): Add a new constructor to be used by OffscreenCanvas.
3486         Creates a blank ImageBitmap.
3487         * html/ImageBitmap.h:
3488
3489         * html/OffscreenCanvas.cpp:
3490         (WebCore::OffscreenCanvas::transferToImageBitmap): Create a new ImageBitmap
3491         and paint the current canvas into it.
3492
3493 2017-12-08  Youenn Fablet  <youenn@apple.com>
3494
3495         WebServiceWorkerProvider should use Cancellation error to notify DTL that it cannot handle a fetch
3496         https://bugs.webkit.org/show_bug.cgi?id=180584
3497
3498         Reviewed by Alex Christensen.
3499
3500         Previously, for each cross origin fetch that is going through a service worker and service worker is not handling the fetch,
3501         we return an AccessControl error so that DocumentThreadableLoader will do preflight and regular load through the network.
3502         This error is wrongly logged in the Inspector.
3503         Change error type to Cancellation so that the Inspector does not log it.
3504
3505         * loader/DocumentThreadableLoader.cpp:
3506         (WebCore::DocumentThreadableLoader::didFail):
3507
3508 2017-12-08  Youenn Fablet  <youenn@apple.com>
3509
3510         Service Worker should use a correct SessionID
3511         https://bugs.webkit.org/show_bug.cgi?id=180585
3512
3513         Reviewed by Alex Christensen.
3514
3515         Test: http/tests/workers/service/serviceworker-private-browsing.https.html
3516
3517         Store SessionID in SWServer and send it as part of service worker instantiation.
3518
3519         * workers/service/server/SWServer.cpp:
3520         (WebCore::SWServer::SWServer):
3521         (WebCore::SWServer::installContextData):
3522         (WebCore::SWServer::runServiceWorker):
3523         * workers/service/server/SWServer.h:
3524         * workers/service/server/SWServerToContextConnection.h:
3525
3526 2017-12-08  Youenn Fablet  <youenn@apple.com>
3527
3528         FetchResponse should keep unfiltered ResourceResponse so that it can be used in Service Worker
3529         https://bugs.webkit.org/show_bug.cgi?id=179641
3530         <rdar://problem/35923570>
3531
3532         Reviewed by Alex Christensen.
3533
3534         Covered by existing rebased tests.
3535
3536         FetchResponse will now store an unfiltered response.
3537         If it needs to expose it to JavaScript, it will create a filtered response lazily.
3538         This allows service worker to send back to web pages, opaque responses containing every information.
3539
3540         Updating Document::initSecurityContext so that any document loaded with a response whose tainting is Opaque gets a unique origin.
3541         This ensures cross-origin checks to work if service worker returns such a response on a same origin URL.
3542
3543         Updated SubresourceLoader to check cross origin service worker responses based on their tainting.
3544
3545         * Modules/fetch/FetchResponse.cpp:
3546         (WebCore::FetchResponse::create):
3547         (WebCore::FetchResponse::error):
3548         (WebCore::FetchResponse::redirect):
3549         (WebCore::FetchResponse::FetchResponse):
3550         (WebCore::FetchResponse::clone):
3551         (WebCore::FetchResponse::url const):
3552         (WebCore::FetchResponse::filteredResponse const):
3553         (WebCore::FetchResponse::BodyLoader::didReceiveResponse):
3554         (WebCore::FetchResponse::resourceResponse const):
3555         * Modules/fetch/FetchResponse.h:
3556         (WebCore::FetchResponse::create): Deleted.
3557         * dom/Document.cpp:
3558         (WebCore::Document::initSecurityContext):
3559         * loader/SubresourceLoader.cpp:
3560         (WebCore::SubresourceLoader::willSendRequestInternal):
3561         (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl):
3562
3563 2017-12-08  David Quesada  <david_quesada@apple.com>
3564
3565         ApplicationManifestParser should strip whitespace from the raw input
3566         https://bugs.webkit.org/show_bug.cgi?id=180539
3567         rdar://problem/35915075
3568
3569         Reviewed by Joseph Pecoraro.
3570
3571         * Modules/applicationmanifest/ApplicationManifestParser.cpp:
3572         (WebCore::ApplicationManifestParser::parseManifest):
3573
3574 2017-12-08  Eric Carlson  <eric.carlson@apple.com>
3575
3576         Move Logger from PAL to WTF so it can be used outside of WebCore
3577         https://bugs.webkit.org/show_bug.cgi?id=180561
3578
3579         Reviewed by Alex Christensen.
3580
3581         No new tests, existing API test updated.
3582
3583         * Modules/mediastream/PeerConnectionBackend.h:
3584         * Modules/mediastream/RTCPeerConnection.h:
3585         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
3586         (PAL::LogArgument<webrtc::RTCStats>::toString): Deleted.
3587         * dom/Document.cpp:
3588         * dom/Document.h:
3589         * html/HTMLMediaElement.cpp:
3590         (PAL::LogArgument<WebCore::URL>::toString): Deleted.
3591         * html/HTMLMediaElement.h:
3592         * html/HTMLMediaElementEnums.h:
3593         (PAL::LogArgument<WebCore::HTMLMediaElementEnums::ReadyState>::toString): Deleted.
3594         (PAL::LogArgument<WebCore::HTMLMediaElementEnums::NetworkState>::toString): Deleted.
3595         * html/MediaElementSession.cpp:
3596         (WebCore::MediaElementSession::logger const):
3597         * html/MediaElementSession.h:
3598         * html/track/DataCue.h:
3599         (PAL::LogArgument<WebCore::DataCue>::toString): Deleted.
3600         * html/track/TextTrackCue.h:
3601         (PAL::LogArgument<WebCore::TextTrackCue>::toString): Deleted.
3602         * html/track/TextTrackCueGeneric.h:
3603         (PAL::LogArgument<WebCore::TextTrackCueGeneric>::toString): Deleted.
3604         * html/track/TrackBase.cpp:
3605         (WebCore::nullLogger):
3606         (WebCore::TrackBase::TrackBase):
3607         * html/track/TrackBase.h:
3608         * html/track/VTTCue.h:
3609         (PAL::LogArgument<WebCore::VTTCue>::toString): Deleted.
3610         * platform/graphics/InbandTextTrackPrivate.h:
3611         * platform/graphics/InbandTextTrackPrivateClient.h:
3612         (PAL::LogArgument<WebCore::GenericCueData>::toString): Deleted.
3613         * platform/graphics/MediaPlayer.cpp:
3614         (WebCore::nullLogger):
3615         (WebCore::MediaPlayer::mediaPlayerLogger):
3616         * platform/graphics/MediaPlayer.h:
3617         (WTF::LogArgument<MediaTime>::toString):
3618         (PAL::LogArgument<WTF::MediaTime>::toString): Deleted.
3619         * platform/graphics/MediaPlayerEnums.h:
3620         (PAL::LogArgument<WebCore::MediaPlayerEnums::ReadyState>::toString): Deleted.
3621         (PAL::LogArgument<WebCore::MediaPlayerEnums::NetworkState>::toString): Deleted.
3622         * platform/graphics/TrackPrivateBase.cpp:
3623         (WebCore::TrackPrivateBase::setLogger):
3624         * platform/graphics/TrackPrivateBase.h:
3625         * platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm:
3626         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
3627         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
3628         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3629         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
3630         * platform/mediastream/RTCIceConnectionState.h:
3631         (PAL::LogArgument<WebCore::RTCIceConnectionState>::toString): Deleted.
3632         * platform/mediastream/RTCIceGatheringState.h:
3633         (PAL::LogArgument<WebCore::RTCIceGatheringState>::toString): Deleted.
3634         * platform/mediastream/RTCPeerConnectionState.h:
3635         (PAL::LogArgument<WebCore::RTCPeerConnectionState>::toString): Deleted.
3636         * platform/mediastream/RTCSignalingState.h:
3637         (PAL::LogArgument<WebCore::RTCSignalingState>::toString): Deleted.
3638         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
3639
3640 2017-12-08  Yusuke Suzuki  <utatane.tea@gmail.com>
3641
3642         Remove pthread_once in favor of dispatch_once
3643         https://bugs.webkit.org/show_bug.cgi?id=180591
3644
3645         Reviewed by Saam Barati.
3646
3647         No behavior change.
3648
3649         * platform/mac/WebCoreNSURLExtras.mm:
3650         (WebCore::allCharactersInIDNScriptWhiteList):
3651         (WebCore::readIDNScriptWhiteList): Deleted.
3652
3653 2017-12-08  Chris Dumez  <cdumez@apple.com>
3654
3655         Improve error handling in RegistrationDatabase
3656         https://bugs.webkit.org/show_bug.cgi?id=180587
3657
3658         Reviewed by Brady Eidson.
3659
3660         * workers/service/server/RegistrationDatabase.cpp:
3661         (WebCore::RegistrationDatabase::openSQLiteDatabase):
3662         (WebCore::RegistrationDatabase::doPushChanges):
3663
3664 2017-12-07  Darin Adler  <darin@apple.com>
3665
3666         Simplify and streamline some Color-related code to prepare for some Color/ExtendedColor work
3667         https://bugs.webkit.org/show_bug.cgi?id=180569
3668
3669         Reviewed by Sam Weinig.
3670
3671         * accessibility/AccessibilityNodeObject.cpp:
3672         (WebCore::AccessibilityNodeObject::colorValue const): Use valueAsColor instead of
3673         having custom code here to parse the color string.
3674
3675         * css/CSSGradientValue.cpp:
3676         (WebCore::interpolate): Deleted.
3677         (WebCore::CSSGradientValue::computeStops): Call blend instead of interpolate. The only
3678         difference is that the interpolate function truncated when converting from floating point
3679         to integer, and the blend function rounds instead.
3680
3681         * css/StyleResolver.cpp:
3682         (WebCore::StyleResolver::colorFromPrimitiveValue const): Removed unneeded special case
3683         for identifier of 0, since StyleColor::colorFromKeyword already handles that correctly.
3684         Also got rid of unneded local variable "state".
3685
3686         * html/ColorInputType.cpp:
3687         (WebCore::isValidSimpleColor): Rewrote to take a StringView instead of a String and
3688         to stay with a single loop since this does not need the extra efficiency of a separate
3689         8-bit and 16-bit character version. Renamed to more closely match what the specification
3690         calls this algorithm.
3691         (WebCore::parseSimpleColorValue): Added. To be used instead of relying on the behavior of
3692         the Color constructor that takes a String, so we can remove that later.
3693         (WebCore::ColorInputType::sanitizeValue const): Updated for name change.
3694         (WebCore::ColorInputType::valueAsColor const): Use parseSimpleColorValue instead of the
3695         Color constructor that takes a string.
3696         (WebCore::ColorInputType::typeMismatchFor const): Updated for name change.
3697         (WebCore::ColorInputType::selectColor): Updated to take a StringView instead of a Color.
3698         Note that this function is used for testing only.
3699
3700         * html/ColorInputType.h: Marked everything final instead of override. Updated the
3701         selectColor function to take a StringView instead of a Color.
3702
3703         * html/HTMLInputElement.cpp:
3704         (WebCore::HTMLInputElement::selectColor): Take a StringView instead of a Color.
3705         * html/HTMLInputElement.h: Ditto.
3706
3707         * html/InputType.cpp:
3708         (WebCore::InputType::selectColor): Take a StringView instead of a Color.
3709         * html/InputType.h: Ditto.
3710
3711         * testing/Internals.cpp:
3712         (WebCore::Internals::selectColorInColorChooser): Pass the string directly instead of
3713         constructing a Color with it.
3714         (WebCore::Internals::setViewBaseBackgroundColor): Instead of pasring the passed in string
3715         with the Color constructor, implemented the two names that are actually used with this
3716         function in tests: "transparent" and "white".
3717
3718 2017-12-08  Konstantin Tokarev  <annulen@yandex.ru>
3719
3720         Unreviewed, fix wrong letter case in #import HTMLIframeElement.h
3721
3722         * editing/cocoa/WebContentReaderCocoa.mm:
3723
3724 2017-12-07  Yusuke Suzuki  <utatane.tea@gmail.com>
3725
3726         Use WTF::RecursiveLockAdapter instead of using pthread_mutex_t with recursive lock option
3727         https://bugs.webkit.org/show_bug.cgi?id=180449
3728
3729         Reviewed by Mark Lam.
3730
3731         Use WTF::RecursiveLockAdapter<StaticLock> instead. We can remove pthread_mutex_xxx,
3732         pthread_once and FontLocker wrapper.
3733
3734         * platform/graphics/FontCache.cpp:
3735         (WebCore::FontCache::getCachedFontPlatformData):
3736         (WebCore::FontCache::fontForPlatformData):
3737         (WebCore::FontCache::purgeInactiveFontData):
3738         (WebCore::FontCache::inactiveFontCount):
3739         (initFontCacheLockOnce): Deleted.
3740         (FontLocker::FontLocker): Deleted.
3741         (FontLocker::~FontLocker): Deleted.
3742
3743 2017-12-07  Eric Carlson  <eric.carlson@apple.com>
3744
3745         Simplify log channel configuration UI
3746         https://bugs.webkit.org/show_bug.cgi?id=180527
3747         <rdar://problem/35908382>
3748
3749         Reviewed by Joseph Pecoraro.
3750
3751         No new tests, updated existing test.
3752
3753         * inspector/agents/WebConsoleAgent.cpp:
3754         (WebCore::WebConsoleAgent::getLoggingChannels):
3755         (WebCore::channelConfigurationForString):
3756
3757 2017-12-07  Yusuke Suzuki  <utatane.tea@gmail.com>
3758
3759         Use StaticLock instead of NeverDestroyed<Lock>
3760         https://bugs.webkit.org/show_bug.cgi?id=180507
3761
3762         Reviewed by Saam Barati.
3763
3764         StaticLock can be used instead of using NeverDestroyed<Lock>.
3765
3766         No behavior change.
3767
3768         * Modules/webdatabase/Database.cpp:
3769         (WebCore::Database::performOpenAndVerify):
3770         * Modules/webdatabase/DatabaseTracker.cpp:
3771         (WebCore::DatabaseTracker::openDatabaseMutex):
3772         (WebCore::DatabaseTracker::emptyDatabaseFilesRemovalTaskWillBeScheduled):
3773         (WebCore::DatabaseTracker::emptyDatabaseFilesRemovalTaskDidFinish):
3774         (WebCore::DatabaseTracker::scheduleNotifyDatabaseChanged):
3775         (WebCore::DatabaseTracker::scheduleForNotification):
3776         (WebCore::DatabaseTracker::notifyDatabasesChanged):
3777         (WebCore::notificationMutex): Deleted.
3778         * Modules/webdatabase/DatabaseTracker.h:
3779         * platform/URL.cpp:
3780         (WebCore::registerDefaultPortForProtocolForTesting):
3781         (WebCore::clearDefaultPortForProtocolMapForTesting):
3782         (WebCore::defaultPortForProtocol):
3783         (WebCore::defaultPortForProtocolMapForTestingLock): Deleted.
3784         * platform/graphics/MediaPlayer.cpp:
3785         (WebCore::buildMediaEnginesVector):
3786         (WebCore::installedMediaEngines):
3787         (WebCore::MediaPlayer::resetMediaEngines):
3788         (WebCore::mediaEngineVectorLock): Deleted.
3789         * platform/ios/QuickLook.mm:
3790         (WebCore::removeQLPreviewConverterForURL):
3791         (WebCore::addQLPreviewConverterWithFileForURL):
3792         (WebCore::qlPreviewConverterDictionaryMutex): Deleted.
3793         * platform/ios/WebSQLiteDatabaseTrackerClient.mm:
3794         (+[WebDatabaseTransactionBackgroundTaskController startBackgroundTask]):
3795         (+[WebDatabaseTransactionBackgroundTaskController endBackgroundTask]):
3796         (transactionBackgroundTaskIdentifierLock): Deleted.
3797         * platform/network/curl/CurlContext.cpp:
3798         (WebCore::CurlShareHandle::lockCallback):
3799         (WebCore::CurlShareHandle::unlockCallback):
3800         (WebCore::CurlShareHandle::mutexFor):
3801         * platform/network/curl/CurlContext.h:
3802
3803 2017-12-07  Brady Eidson  <beidson@apple.com>
3804
3805         Read registrations in from disk.
3806         https://bugs.webkit.org/show_bug.cgi?id=180543
3807
3808         Reviewed by Andy Estes.
3809
3810         No new tests (Not testable quite yet)
3811
3812         On launch, read through the database.
3813
3814         Set up enough objects in the SWServer necessary to cause fetches and postMessages to
3815         go to a worker that has never run before.
3816
3817         * workers/service/ServiceWorkerContextData.cpp:
3818         (WebCore::ServiceWorkerContextData::isolatedCopy const):
3819         * workers/service/ServiceWorkerContextData.h:
3820         (WebCore::ServiceWorkerContextData::encode const):
3821         (WebCore::ServiceWorkerContextData::decode):
3822
3823         * workers/service/ServiceWorkerRegistrationKey.cpp:
3824         (WebCore::ServiceWorkerRegistrationKey::toDatabaseKey const):
3825         (WebCore::ServiceWorkerRegistrationKey::fromDatabaseKey):
3826         * workers/service/ServiceWorkerRegistrationKey.h:
3827
3828         * workers/service/server/RegistrationDatabase.cpp:
3829         (WebCore::stringToUpdateViaCache):
3830         (WebCore::stringToWorkerType):
3831         (WebCore::RegistrationDatabase::doPushChanges):
3832         (WebCore::RegistrationDatabase::importRecords):
3833         (WebCore::RegistrationDatabase::addRegistrationToStore):
3834         * workers/service/server/RegistrationDatabase.h:
3835
3836         * workers/service/server/RegistrationStore.cpp:
3837         (WebCore::RegistrationStore::RegistrationStore):
3838         (WebCore::RegistrationStore::addRegistrationFromDatabase):
3839         * workers/service/server/RegistrationStore.h:
3840
3841         * workers/service/server/SWServer.cpp:
3842         (WebCore::SWServer::addRegistrationFromStore):
3843         (WebCore::SWServer::SWServer):
3844         (WebCore::SWServer::updateWorker):
3845         (WebCore::SWServer::tryInstallContextData):
3846         (WebCore::SWServer::installContextData):
3847         (WebCore::generateServiceWorkerIdentifier): Deleted.
3848         * workers/service/server/SWServer.h:
3849
3850         * workers/service/server/SWServerRegistration.h:
3851
3852         * workers/service/server/SWServerWorker.cpp:
3853         (WebCore::SWServerWorker::contextData const):
3854
3855 2017-12-07  Yusuke Suzuki  <utatane.tea@gmail.com>
3856
3857         Use WTF Locking primitives in WebThread and drop pthread_xxx use
3858         https://bugs.webkit.org/show_bug.cgi?id=180445
3859
3860         Reviewed by Saam Barati.
3861
3862         We remove use of pthread locking primitives from WebThread implementation,
3863         and use WTF Lock and Condition instead.
3864
3865         No behavior change.
3866
3867         * platform/ios/wak/WebCoreThread.mm:
3868         (HandleDelegateSource):
3869         (SendDelegateMessage):
3870         (WebThreadRunOnMainThread):
3871         (WebThreadAdoptAndRelease):
3872         (WebCoreObjCDeallocOnWebThreadImpl):
3873         (WebCoreObjCDeallocWithWebThreadLockImpl):
3874         (HandleWebThreadReleaseSource):
3875         (_WebThreadAutoLock):
3876         (WebRunLoopLockInternal):
3877         (CurrentThreadContext):
3878         Use WTF::ThreadSpecific.
3879
3880         (StartWebThread):
3881         (_WebThreadLock):
3882         Remove `shouldTry` parameter since it is always `false`. We clean up code based on `shouldTry = false`,
3883         and rename it from _WebTryThreadLock to _WebThreadLock since it does not try now.
3884
3885         (_WebThreadLockFromAnyThread):
3886         (WebThreadUnlockFromAnyThread):
3887         (_WebThreadUnlock):
3888         (lockWebCoreReleaseLock): Deleted.
3889         (unlockWebCoreReleaseLock): Deleted.
3890         (WebTimedConditionLock): Deleted.
3891         (_WebTryThreadLock): Deleted.
3892
3893 2017-12-07  Alex Christensen  <achristensen@webkit.org>
3894
3895         Fix API test after r225645.
3896         https://bugs.webkit.org/show_bug.cgi?id=180544
3897
3898         * loader/FrameLoader.cpp:
3899         (WebCore::FrameLoader::loadURL):
3900         (WebCore::FrameLoader::loadWithDocumentLoader):
3901         The API test WebKitLegacy.FragmentNavigation started failing after r225645.
3902         It does call the completion handler with ignore to cancel fragment navigation.
3903         To make this work and increase compatibility, only synchronously continue with
3904         fragment navigations if we haven't received a synchronous answer to the
3905         decidePolicyForNavigationAction callback.
3906
3907 2017-12-07  Oleksandr Skachkov  <gskachkov@gmail.com>
3908
3909         WebAssembly: sending module to iframe fails
3910         https://bugs.webkit.org/show_bug.cgi?id=179263
3911
3912         Reviewed by JF Bastien.
3913
3914         Allow use WebAssembly.Module as input parameters for postMessage 
3915         in window and iframe object.
3916
3917         Tests: wasm/iframe-postmessage.html
3918                wasm/window-postmessage.html
3919
3920         * bindings/js/SerializedScriptValue.cpp:
3921         (WebCore::CloneSerializer::dumpIfTerminal):
3922         * bindings/js/SerializedScriptValue.h:
3923         * page/DOMWindow.cpp:
3924         (WebCore::DOMWindow::postMessage):
3925
3926 2017-12-07  Joseph Pecoraro  <pecoraro@apple.com>
3927
3928         Web Inspector: Fix style in remote inspector classes
3929         https://bugs.webkit.org/show_bug.cgi?id=180545
3930
3931         Reviewed by Youenn Fablet.
3932
3933         * page/PageDebuggable.h:
3934         * workers/service/context/ServiceWorkerDebuggable.h:
3935
3936 2017-12-07  Antti Koivisto  <antti@apple.com>
3937
3938         Move security origin filtering for getMatchedCSSRules out of StyleResolver
3939         https://bugs.webkit.org/show_bug.cgi?id=180468
3940
3941         Reviewed by Zalan Bujtas.
3942
3943         The non-standard getMatchedCSSRules API should not return rules from stylesheets in different security origins.
3944         To implement this we currently have lots of invasive code in StyleResolver, RuleSets and ElementRuleCollector
3945         basically passing around a bit. This also makes RuleSets document specific blocking optimizations.
3946
3947         This patches replaces the mechanism with a bit in StyleRule which is much simpler.
3948
3949         * css/DocumentRuleSets.cpp:
3950         (WebCore::makeRuleSet):
3951         * css/ElementRuleCollector.cpp:
3952         (WebCore::ElementRuleCollector::collectMatchingRulesForList):
3953         * css/ElementRuleCollector.h:
3954         (WebCore::ElementRuleCollector::setPseudoStyleRequest):
3955         (WebCore::ElementRuleCollector::setSameOriginOnly): Deleted.
3956         * css/RuleFeature.cpp:
3957         (WebCore::RuleFeatureSet::collectFeatures):
3958         * css/RuleFeature.h:
3959         (WebCore::RuleFeature::RuleFeature):
3960         * css/RuleSet.cpp:
3961         (WebCore::RuleData::RuleData):
3962         (WebCore::RuleSet::addRule):
3963         (WebCore::RuleSet::addChildRules):
3964         (WebCore::RuleSet::addRulesFromSheet):
3965         (WebCore::RuleSet::addStyleRule):
3966         * css/RuleSet.h:
3967         (WebCore::RuleData::linkMatchType const):
3968         (WebCore::RuleData::hasDocumentSecurityOrigin const): Deleted.
3969         * css/StyleResolver.cpp:
3970         (WebCore::StyleResolver::pseudoStyleRulesForElement):
3971         * css/StyleResolver.h:
3972         * css/StyleRule.cpp:
3973         (WebCore::StyleRule::StyleRule):
3974         (WebCore::StyleRule::createForSplitting):
3975         (WebCore::StyleRule::splitIntoMultipleRulesWithMaximumSelectorComponentCount const):
3976         (WebCore::StyleRule::create): Deleted.
3977         * css/StyleRule.h:
3978         (WebCore::StyleRuleBase::StyleRuleBase):
3979         (WebCore::StyleRuleBase::hasDocumentSecurityOrigin const):
3980
3981             Add a bit.
3982
3983         * css/parser/CSSParser.cpp:
3984         (WebCore::CSSParserContext::CSSParserContext):
3985
3986             Include hasDocumentSecurityOrigin bit to parser context. This means that a stylesheet data structures
3987             can't be shared between a contexts where this differs. This likely very rare in practice.
3988
3989         (WebCore::operator==):
3990         * css/parser/CSSParserImpl.cpp:
3991         (WebCore::CSSParserImpl::consumeStyleRule):
3992         * css/parser/CSSParserMode.h:
3993         (WebCore::CSSParserContextHash::hash):
3994         * editing/EditingStyle.cpp:
3995         (WebCore::EditingStyle::mergeStyleFromRules):
3996         * page/DOMWindow.cpp:
3997         (WebCore::DOMWindow::getMatchedCSSRules const):
3998
3999             Filter out rules from different security origin after getting them from style resolver.
4000
4001 2017-12-07  Zalan Bujtas  <zalan@apple.com>
4002
4003         AX: Document::existingAXObjectCache() should always return the existing AXObjectCache.
4004         https://bugs.webkit.org/show_bug.cgi?id=180548
4005         <rdar://problem/35917755>
4006
4007         Reviewed by Chris Fleizach.
4008
4009         Currently the AX cache becomes unreachable through Document::existingAXObjectCache soon after the render tree is destroyed.
4010         From this point, the Node objects can't deregister themselves from the AX cache anymore. In some cases, it's
4011         redundant/not advised to notify the cache about certain changes when the document is being destroyed, but the
4012         callsites should make that decision.
4013
4014         Covered by existing tests.
4015
4016         * dom/Document.cpp:
4017         (WebCore::Document::existingAXObjectCacheSlow const):
4018         * rendering/RenderElement.cpp:
4019         (WebCore::RenderElement::takeChildInternal):
4020
4021 2017-12-07  Youenn Fablet  <youenn@apple.com>
4022
4023         Fix erroneous ASSERT in DocumentThreadableLoader::didFail
4024         https://bugs.webkit.org/show_bug.cgi?id=180549
4025
4026         Reviewed by Alex Christensen.
4027
4028         * loader/DocumentThreadableLoader.cpp: