Remove FrameView::serviceScriptedAnimations and Document::serviceScriptedAnimations
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-10-26  Antoine Quint  <graouts@apple.com>
2
3         Remove FrameView::serviceScriptedAnimations and Document::serviceScriptedAnimations
4         https://bugs.webkit.org/show_bug.cgi?id=178879
5
6         Reviewed by Dean Jackson.
7
8         There are no call sites for FrameView::serviceScriptedAnimations() and that method is the
9         only call site for Document::serviceScriptedAnimations(), so both can go.
10
11         * dom/Document.cpp:
12         (WebCore::Document::serviceScriptedAnimations): Deleted.
13         * dom/Document.h:
14         * page/FrameView.cpp:
15         (WebCore::FrameView::serviceScriptedAnimations): Deleted.
16         * page/FrameView.h:
17
18 2017-10-26  Chris Dumez  <cdumez@apple.com>
19
20         Bring back SWContextManager abstraction in WebCore
21         https://bugs.webkit.org/show_bug.cgi?id=178876
22
23         Reviewed by Geoffrey Garen.
24
25         Bring back SWContextManager abstraction in WebCore. It was killed in <https://trac.webkit.org/changeset/223718> but
26         is actually useful when the ServiceWorker wants to message the storage process.
27
28         * Sources.txt:
29         * WebCore.xcodeproj/project.pbxproj:
30         * workers/service/context/SWContextManager.cpp: Added.
31         (WebCore::SWContextManager::singleton):
32         (WebCore::SWContextManager::setConnection):
33         (WebCore::SWContextManager::connection const):
34         (WebCore::SWContextManager::registerServiceWorkerThread):
35         (WebCore::SWContextManager::serviceWorkerThreadProxy const):
36         (WebCore::SWContextManager::postMessageToServiceWorkerGlobalScope):
37         * workers/service/context/SWContextManager.h: Copied from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h.
38         (WebCore::SWContextManager::Connection::~Connection):
39
40 2017-10-26  Basuke Suzuki  <Basuke.Suzuki@sony.com>
41
42         [Curl] Rename CurlJobManager to CurlRequestScheduler
43         https://bugs.webkit.org/show_bug.cgi?id=178775
44
45         To match the meaning of the class.
46         It was originally meant to be more generic purpose, but as
47         other classes was introduced, the objective of the class is
48         now only to handle the life cycle of curl requests.
49
50         The delegate is also renamed to CurlRequestSchedulerClient.
51
52         Reviewed by Alex Christensen.
53
54         * platform/Curl.cmake:
55         * platform/network/curl/CurlDownload.cpp:
56         (WebCore::CurlDownload::~CurlDownload):
57         (WebCore::CurlDownload::willSendRequest):
58         * platform/network/curl/CurlDownload.h:
59         * platform/network/curl/CurlRequest.cpp:
60         (WebCore::CurlRequest::CurlRequest):
61         (WebCore::CurlRequest::start):
62         (WebCore::CurlRequest::startWithJobManager):
63         (WebCore::CurlRequest::cancel):
64         (WebCore::CurlRequest::callClient):
65         (WebCore::CurlRequest::didReceiveData):
66         (WebCore::CurlRequest::didCompleteTransfer):
67         (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
68         (WebCore::CurlRequest::invokeDidReceiveResponse):
69         (WebCore::CurlRequest::completeDidReceiveResponse):
70         (WebCore::CurlRequest::pausedStatusChanged):
71         (WebCore::CurlRequest::callDelegate): Deleted.
72         * platform/network/curl/CurlRequest.h:
73         (WebCore::CurlRequest::create):
74         (WebCore::CurlRequest::setClient):
75         (WebCore::CurlRequest::setDelegate): Deleted.
76         * platform/network/curl/CurlRequestClient.h: Renamed from Source/WebCore/platform/network/curl/CurlRequestDelegate.h.
77         * platform/network/curl/CurlRequestScheduler.cpp: Renamed from Source/WebCore/platform/network/curl/CurlJobManager.cpp.
78         (WebCore::CurlJobList::startJobs):
79         (WebCore::CurlJobList::finishJobs):
80         (WebCore::CurlRequestScheduler::singleton):
81         (WebCore::CurlRequestScheduler::add):
82         (WebCore::CurlRequestScheduler::cancel):
83         (WebCore::CurlRequestScheduler::callOnWorkerThread):
84         (WebCore::CurlRequestScheduler::startThreadIfNeeded):
85         (WebCore::CurlRequestScheduler::stopThreadIfNoMoreJobRunning):
86         (WebCore::CurlRequestScheduler::stopThread):
87         (WebCore::CurlRequestScheduler::updateJobList):
88         (WebCore::CurlRequestScheduler::workerThread):
89         * platform/network/curl/CurlRequestScheduler.h: Renamed from Source/WebCore/platform/network/curl/CurlJobManager.h.
90         (WebCore::CurlRequestScheduler::~CurlRequestScheduler):
91         * platform/network/curl/CurlRequestSchedulerClient.h: Added.
92         (WebCore::CurlRequestSchedulerClient::~CurlRequestSchedulerClient):
93         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
94         (WebCore::ResourceHandleCurlDelegate::~ResourceHandleCurlDelegate):
95         (WebCore::ResourceHandleCurlDelegate::setAuthentication):
96         (WebCore::ResourceHandleCurlDelegate::continueAfterWillSendRequest):
97         * platform/network/curl/ResourceHandleCurlDelegate.h:
98
99 2017-10-26  Antti Koivisto  <antti@apple.com>
100
101         Remove unnecessary whitespace invalidation logic from RenderTreeUpdater
102         https://bugs.webkit.org/show_bug.cgi?id=178786
103
104         Reviewed by Zalan Bujtas.
105
106         RenderTreeUpdater::invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded is a somewhat complex
107         and confusing function for figuring out if some whitespace-only text node might need to have its
108         rendering status recomputed. However actually computing if a text renderer is needed is not expensive.
109         We can simply do it for all whitespace nodes after a sibling mutation.
110
111         This also removes a set that could have stale renderer pointers in it (they were never dereferenced).
112
113         * rendering/RenderBlock.cpp:
114         (WebCore::RenderBlock::addChildIgnoringContinuation):
115
116             Fix a display:contents bug exposed by this change. With display:contents a text renderer may have an anonymous
117             inline wrapper and we need to take it into account when the text renderer is the beforeChild.
118
119             Tested by imported/w3c/web-platform-tests/css/css-display-3/display-contents-state-change-001.html
120
121         * style/RenderTreeUpdater.cpp:
122         (WebCore::RenderTreeUpdater::updateRenderTree):
123
124             Call updateTextRenderer() for all whitespace-only text nodes after a change in siblings.
125             In normal update case it just figures out quickly (by calling textRendererIsNeeded)
126             that there are no changes and bails out.
127
128         (WebCore::RenderTreeUpdater::updateElementRenderer):
129         (WebCore::RenderTreeUpdater::updateTextRenderer):
130         (WebCore::RenderTreeUpdater::invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded): Deleted.
131
132             No longer needed. Just mark that there have been changes to siblings instead.
133
134         * style/RenderTreeUpdater.h:
135
136 2017-10-26  Myles C. Maxfield  <mmaxfield@apple.com>
137
138         Mark font palettes as in development
139         https://bugs.webkit.org/show_bug.cgi?id=178590
140
141         Unreviewed.
142
143         * features.json:
144
145 2017-10-26  Ryan Haddad  <ryanhaddad@apple.com>
146
147         Unreviewed, rolling out r223984.
148
149         Caused LayoutTest assertion failures.
150
151         Reverted changeset:
152
153         "When navigating back to a page, compositing layers may not
154         use accelerated drawing"
155         https://bugs.webkit.org/show_bug.cgi?id=178749
156         https://trac.webkit.org/changeset/223984
157
158 2017-10-26  Youenn Fablet  <youenn@apple.com>
159
160         Add inspector logging for MediaElementSession autoplay
161         https://bugs.webkit.org/show_bug.cgi?id=178846
162
163         Reviewed by Eric Carlson.
164
165         No change of behavior.
166         Making use of pal Logger in MediaElementSession.
167         This new logging is limited to autoplay/playback for now.
168
169         * html/MediaElementSession.cpp:
170         (WebCore::MediaElementSession::MediaElementSession):
171         (WebCore::MediaElementSession::playbackPermitted const):
172         (WebCore::MediaElementSession::autoplayPermitted const):
173         (WebCore::MediaElementSession::willLog const):
174         (WebCore::MediaElementSession::logChannel const):
175         * html/MediaElementSession.h:
176
177 2017-10-26  Keith Miller  <keith_miller@apple.com>
178
179         Move ApplePay to unified sources
180         https://bugs.webkit.org/show_bug.cgi?id=178871
181
182         Rubber-stamped by Tim Horton.
183
184         Also, add some other missing files.
185
186         * SourcesCocoa.txt:
187         * WebCore.xcodeproj/project.pbxproj:
188
189 2017-10-26  Ryan Haddad  <ryanhaddad@apple.com>
190
191         Unreviewed, rolling out r224019.
192
193         This change caused API test WebKit.MSEIsPlayingAudio to time
194         out.
195
196         Reverted changeset:
197
198         "XMLHttpRequest should not treat file URLs as same origin"
199         https://bugs.webkit.org/show_bug.cgi?id=178565
200         https://trac.webkit.org/changeset/224019
201
202 2017-10-26  Ryan Haddad  <ryanhaddad@apple.com>
203
204         Unreviewed, rolling out r223994.
205
206         The LayoutTest for this change is failing.
207
208         Reverted changeset:
209
210         "Add service worker handle fetch support for all subresource
211         requests"
212         https://bugs.webkit.org/show_bug.cgi?id=178769
213         https://trac.webkit.org/changeset/223994
214
215 2017-10-26  Ryan Haddad  <ryanhaddad@apple.com>
216
217         Unreviewed, rolling out r223908.
218
219         Causes LayoutTest crashes with newer SDKs.
220
221         Reverted changeset:
222
223         "Adopt new secure coding APIs"
224         https://bugs.webkit.org/show_bug.cgi?id=178484
225         https://trac.webkit.org/changeset/223908
226
227 2017-10-25  Brent Fulgham  <bfulgham@apple.com>
228
229         XMLHttpRequest should not treat file URLs as same origin
230         https://bugs.webkit.org/show_bug.cgi?id=178565
231         <rdar://problem/11115901>
232
233         Reviewed by Ryosuke Niwa.
234
235         Do not treat file URLs as same-origin for XHR requests.
236
237         Test: fast/xmlhttprequest/xmlhttprequest-access-self-as-file.html
238
239         * loader/DocumentThreadableLoader.cpp:
240         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Use new helper method.
241         * page/SecurityOrigin.cpp:
242         (WebCore::SecurityOrigin::requestIsSameOrigin): New method to recognize same-origin
243         requests, with special handling for XHR.
244         * page/SecurityOrigin.h:
245
246 2017-10-26  Christopher Reid  <chris.reid@sony.com>
247
248         Remove scopeguard from platform
249         https://bugs.webkit.org/show_bug.cgi?id=178681
250
251         Reviewed by Brady Eidson.
252
253         Replacing platform/ScopeGuard with WTF::ScopeExit.
254         No new tests, no change in behavior.
255
256         * Modules/indexeddb/IDBRequest.cpp:
257         * Modules/indexeddb/IDBRequest.h:
258         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
259         * WebCore.xcodeproj/project.pbxproj:
260         * platform/FileSystem.cpp:
261         * platform/ScopeGuard.h: Removed.
262         * platform/network/BlobRegistryImpl.cpp:
263         * workers/service/ServiceWorkerContainer.cpp:
264
265 2017-10-26  Carlos Garcia Campos  <cgarcia@igalia.com>
266
267         REGRESSION(r222090): [HarfBuzz] Arabic shaping is broken except for first word in line
268         https://bugs.webkit.org/show_bug.cgi?id=178625
269
270         Reviewed by Michael Catanzaro.
271
272         Once we find the first space, which has the COMMON script, we split the run, and the next ones keep using
273         COMMON instead of ARABIC because we don't update the current script on every loop iteration. This patch
274         simplifies the script handling by moving the code back to the loop and always breaking in case of different
275         scripts, correctly handling INHERITED and COMMON cases and updating the current script when needed.
276
277         Covered by existing tests. This improves several tests that have been rebaselined.
278
279         * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
280         (WebCore::findNextRun):
281         (WebCore::scriptsAreCompatibleForCharacters): Deleted.
282
283 2017-10-26  Enrique Ocaña González  <eocanha@igalia.com>
284
285         [MSE][GStreamer] Fix hang on clearing/destroying AppendPipeline
286         https://bugs.webkit.org/show_bug.cgi?id=178819
287
288         Reviewed by Xabier Rodriguez-Calvar.
289
290         The deadlock may occur when UI thread tries to clear pipeline in
291         AppendPipeline::clearPlayerPrivate() while parser thread tries to change
292         pipeline state to pause holding the stream lock in
293         AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread()
294
295         This patch is authored by Eugene Mutavchi <Ievgen_Mutavchi@comcast.com>
296
297         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
298         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
299         Return if there's no player private.
300
301 2017-10-26  Ryosuke Niwa  <rniwa@webkit.org>
302
303         Assert that no script is executed during style recalc
304         https://bugs.webkit.org/show_bug.cgi?id=178845
305         <rdar://problem/35106129>
306
307         Reviewed by Antti Koivisto.
308
309         This patch adds NoEventDispatchAssertion to Document::updateStyle and Document::updateStyleIfNeeded
310         to make sure we don't start mutating DOM in the middle of a style update.
311
312         Added NoEventDispatchAssertion::EventAllowedScope for various places in SVGUseElement to update its
313         shadow tree since that happens while updating the style.
314
315         No new tests since there should be no behavioral change.
316
317         * dom/Document.cpp:
318         (WebCore::Document::resolveStyle): Added NoEventDispatchAssertion while flushing pending stylesheets
319         and calling FrameView::willRecalcStyle, and while the style tree solver is in works. Also moved in
320         the code to update the selection and schedule to dispatch a fake mouse event into the same scope.
321         Also increment m_styleRecalcCount in the same code since post resolution callbacks could run author
322         scripts which in turn trigger another (recursive) style recalc.
323         (WebCore::Document::updateStyleIfNeeded): Put everything but the call to resolveStyle in a scope with
324         NoEventDispatchAssertion.
325         * dom/Element.cpp:
326         (WebCore::Element::cloneElementWithChildren): Added NoEventDispatchAssertion::EventAllowedScope to the
327         newly cloned element for SVG use element's shadow tree.
328         (WebCore::Element::cloneElementWithoutChildren): Ditto.
329         * dom/EventDispatcher.cpp:
330         (WebCore::EventDispatcher::dispatchEvent): Make the assertion more precise to workaround the fact SVG
331         use elements update its shadow tree in the middle of style updates. Also removed a redundant assertion
332         since the result of NoEventDispatchAssertion::isEventDispatchAllowedInSubtree cannot chance without
333         pushing or popoing the stack frame.
334         * svg/SVGUseElement.cpp:
335         (WebCore::SVGUseElement::clearShadowTree):
336         (WebCore::SVGUseElement::updateShadowTree): Added NoEventDispatchAssertion to the user-agent shadow root
337         of a SVG use element. Since this is a newly created shadow tree which hasn't been exposed to author
338         scripts, it's safe to mutate them during the style recalc even though it's not the best design.
339         (WebCore::SVGUseElement::cloneTarget const): Ditto.
340         (WebCore::SVGUseElement::expandUseElementsInShadowTree const): Ditto.
341         (WebCore::SVGUseElement::expandSymbolElementsInShadowTree const): Ditto.
342         (WebCore::SVGUseElement::transferEventListenersToShadowTree const):
343
344 2017-10-25  Keith Miller  <keith_miller@apple.com>
345
346         Move platform Cocoa sources to unified sources
347         https://bugs.webkit.org/show_bug.cgi?id=178851
348
349         Rubber-stamped by Tim Horton.
350
351         * SourcesCocoa.txt:
352         * WebCore.xcodeproj/project.pbxproj:
353
354 2017-10-25  Keith Miller  <keith_miller@apple.com>
355
356         Start moving Cocoa specific unified sources
357         https://bugs.webkit.org/show_bug.cgi?id=178850
358
359         Rubber-stamped by Tim Horton.
360
361         * PlatformMac.cmake:
362         * SourcesCocoa.txt:
363         * WebCore.xcodeproj/project.pbxproj:
364
365 2017-10-25  Carlos Garcia Campos  <cgarcia@igalia.com>
366
367         [HarfBuzz] ComplexTextRun should initialize direction from the harfbuzz buffer
368         https://bugs.webkit.org/show_bug.cgi?id=178788
369
370         Reviewed by Michael Catanzaro.
371
372         Instead of using the TextRun direction. If the TextRun is ltr, but the harfbuzz buffer is rtl, the character
373         indexes will be swapped in m_coreTextIndices.
374
375         * platform/graphics/ComplexTextController.h:
376         (WebCore::ComplexTextController::ComplexTextRun::create): Remove the ltr parameter.
377         * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
378         (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Initialize m_isLTR using hb_buffer_get_direction().
379         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Do not pass ltr to ComplexTextRun::create().
380
381 2017-10-25  Keith Miller  <keith_miller@apple.com>
382
383         Move remaining platform independent sources to unified sources
384         https://bugs.webkit.org/show_bug.cgi?id=178849
385
386         Rubber-stamped by Tim Horton.
387
388         * CMakeLists.txt:
389         * Sources.txt:
390         * WebCore.xcodeproj/project.pbxproj:
391
392 2017-10-25  Keith Miller  <keith_miller@apple.com>
393
394         Move plugins and rendering to unified sources
395         https://bugs.webkit.org/show_bug.cgi?id=178848
396
397         Rubber-stamped by Tim Horton.
398
399         * CMakeLists.txt:
400         * Sources.txt:
401         * WebCore.xcodeproj/project.pbxproj:
402
403 2017-10-25  Keith Miller  <keith_miller@apple.com>
404
405         Unreviewed, add FEMorphology.cpp back to the regular build after r224003.
406
407         * WebCore.xcodeproj/project.pbxproj:
408
409 2017-10-25  Keith Miller  <keith_miller@apple.com>
410
411         Unreviewed, Windows build fix.
412
413         * Sources.txt:
414
415 2017-10-25  Devin Rousso  <webkit@devinrousso.com>
416
417         Web Inspector: provide a way to enable/disable event listeners
418         https://bugs.webkit.org/show_bug.cgi?id=177451
419         <rdar://problem/34994925>
420
421         Reviewed by Joseph Pecoraro.
422
423         Test: inspector/dom/setEventListenerDisabled.html
424
425         * dom/EventTarget.cpp:
426         (WebCore::EventTarget::fireEventListeners):
427         Add InspectorInstrumentation call to isEventListenerDisabled. If true, the event listener's
428         callback will not be called.
429
430         * inspector/InspectorDOMAgent.h:
431         * inspector/InspectorDOMAgent.cpp:
432         (WebCore::InspectorDOMAgent::discardBindings):
433         (WebCore::InspectorDOMAgent::getEventListenersForNode):
434         (WebCore::InspectorDOMAgent::setEventListenerDisabled):
435         (WebCore::InspectorDOMAgent::buildObjectForEventListener):
436         (WebCore::InspectorDOMAgent::willRemoveEventListener):
437         (WebCore::InspectorDOMAgent::isEventListenerDisabled):
438         Introduce a mapping of `EventListener*` to `InspectorEventListener`, a struct for uniquely
439         identifying event listeners so they can be referenced from the frontend. We only add items
440         to this mapping when `getEventListenersForNode` is called, as that is when EventListener
441         data is sent to the frontend. This allows us to defer creating an Inspector "mirror" object
442         for each EventListener until it is needed. Items are removed whenever an event listener is
443         removed or when the document changes.
444
445         * inspector/InspectorInstrumentation.h:
446         (WebCore::InspectorInstrumentation::isEventListenerDisabled):
447         * inspector/InspectorInstrumentation.cpp:
448         (WebCore::InspectorInstrumentation::willRemoveEventListenerImpl):
449         (WebCore::InspectorInstrumentation::isEventListenerDisabledImpl):
450         Pass additional parameters to InspectorDOMAgent so it can determine if the event listener
451         actually exists. If not, don't dispatch an event to the frontend as nothing will change.
452
453 2017-10-25  Keith Miller  <keith_miller@apple.com>
454
455         Move Platform to unified sources.
456         https://bugs.webkit.org/show_bug.cgi?id=178829
457
458         Rubber-stamped by Tim Horton.
459
460         * CMakeLists.txt:
461         * Sources.txt:
462         * WebCore.xcodeproj/project.pbxproj:
463         * platform/Cursor.cpp:
464         * platform/sql/SQLiteDatabase.h:
465
466 2017-10-25  Chris Dumez  <cdumez@apple.com>
467
468         messageEvent.source can also be a ServiceWorker
469         https://bugs.webkit.org/show_bug.cgi?id=178839
470
471         Reviewed by Brady Eidson.
472
473         messageEvent.source can also be a ServiceWorker:
474         - https://html.spec.whatwg.org/multipage/comms.html#messageeventsource
475
476         This enables calling postMessage() from a ServiceWorker via Bug 178794.
477
478         * dom/MessageEvent.cpp:
479         (WebCore::MessageEvent::source const): Deleted.
480         * dom/MessageEvent.h:
481         * dom/MessageEvent.idl:
482
483 2017-10-25  Ryosuke Niwa  <rniwa@webkit.org>
484
485         Style::Scope::flushPendingUpdate() can replace the entire document in XSLTProcessor::createDocumentFromSource
486         https://bugs.webkit.org/show_bug.cgi?id=178715
487         <rdar://problem/35144665>
488
489         Reviewed by Brent Fulgham.
490
491         Apply XLS tranforms when a 0s timer fires or the document finishes parsing or loading whichever comes first
492         instead of in the middle of collecting a list of stylesheets.
493
494         * dom/Document.cpp:
495         (WebCore::Document::Document): Initialize the newly added timer.
496         (WebCore::Document::implicitClose): Apply any pending XSLT before we fire load events since some of the event
497         handlers may be expecting to see the document after XSLT had been applied.
498         (WebCore::Document::scheduleToApplyXSLTransforms): Added.
499         (WebCore::Document::applyPendingXSLTransformsNowIfScheduled): Added.
500         (WebCore::Document::applyPendingXSLTransformsTimerFired): Added. Moved the logic to apply XSL transforms from
501         Style::Scope::collectActiveStyleSheets, and merged applyXSLTransform into this function.
502         (WebCore::Document::applyXSLTransform): Deleted.
503         (WebCore::Document::finishedParsing): Apply XSLT right before updating the style. This is where used to apply
504         inline XSLT and it happens much earlier than implicitClose.
505         * dom/Document.h:
506         * dom/ProcessingInstruction.cpp:
507         (WebCore::ProcessingInstruction::checkStyleSheet): Schedule XSLT in the document instead of flushing pending
508         stylesheets, which would have synchronously applied XSLT. We can't apply XSLT synchronously here because this
509         function can be called from a non-script-resilient call stack.
510         (WebCore::ProcessingInstruction::sheetLoaded): Ditto.
511         * style/StyleScope.cpp:
512         (WebCore::Style::Scope::collectXSLTransforms): Added.
513         (WebCore::Style::Scope::collectActiveStyleSheets): Removed the code to apply XSLT. Skip ProcessingInstructions
514         that applies XSLT. Also use RefPtr<StyleSheet> instead of a raw pointer to store StyleSheet.
515         * style/StyleScope.h:
516         * xml/parser/XMLDocumentParserLibxml2.cpp:
517         (WebCore::XMLDocumentParser::doEnd): Apply any pending XSLTs synchronously here as the comment suggests.
518
519 2017-10-25  Devin Rousso  <webkit@devinrousso.com>
520
521         Web Inspector: Canvas Tab: starting a second recording doesn't show red titlebar if the first recording was empty
522         https://bugs.webkit.org/show_bug.cgi?id=178805
523         <rdar://problem/35176303>
524
525         Reviewed by Brian Burg.
526
527         No new tests, updated existing tests.
528
529         * inspector/InspectorCanvasAgent.cpp:
530         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
531         If the recording was stopped and had no data, reset the CallTracingActive flag to false.
532
533 2017-10-25  Keith Miller  <keith_miller@apple.com>
534
535         Move html to unified sources
536         https://bugs.webkit.org/show_bug.cgi?id=178709
537
538         Reviewed by Alex Christensen.
539
540         * CMakeLists.txt:
541         * Sources.txt:
542         * WebCore.xcodeproj/project.pbxproj:
543
544 2017-10-25  Basuke Suzuki  <Basuke.Suzuki@sony.com>
545
546         [Curl] Delete temporally downloaded file when it cancelled
547         https://bugs.webkit.org/show_bug.cgi?id=134393
548
549         Reviewed by Alex Christensen.
550
551         * platform/network/curl/CurlRequest.cpp:
552         (WebCore::CurlRequest::didCancelTransfer):
553         (WebCore::CurlRequest::writeDataToDownloadFileIfEnabled):
554         (WebCore::CurlRequest::closeDownloadFile):
555         (WebCore::CurlRequest::cleanupDownloadFile):
556         * platform/network/curl/CurlRequest.h:
557
558 2017-10-25  Youenn Fablet  <youenn@apple.com>
559
560         Add service worker handle fetch support for all subresource requests
561         https://bugs.webkit.org/show_bug.cgi?id=178769
562
563         Reviewed by Chris Dumez.
564
565         Test: http/tests/workers/service/image-fetch.https.html
566
567         Moving DocumentThreadableLoader logic to CachedResourceLoader to apply it for all resource loads.
568         Setting the selected service worker identifier for subresource only at the moment.
569
570         Testing is limited to images, future wpt tests should cover other subresource cases.
571
572         * loader/DocumentThreadableLoader.cpp:
573         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
574         * loader/cache/CachedResourceLoader.cpp:
575         (WebCore::CachedResourceLoader::prepareFetch):
576         * loader/cache/CachedResourceRequest.cpp:
577         (WebCore::CachedResourceRequest::setSelectedServiceWorkerIdentifierIfNeeded):
578         * loader/cache/CachedResourceRequest.h:
579
580 2017-10-25  Simon Fraser  <simon.fraser@apple.com>
581
582         Aliasing of text in CSS specs is blocky and ugly
583         https://bugs.webkit.org/show_bug.cgi?id=174946
584         rdar://problem/33594542
585
586         Reviewed by Dean Jackson.
587
588         The PaintedContentRequest relating to subpixel-antialiased text was failing to be
589         satisfied if the text content in a composited layer was nested inside descendant
590         RenderLayers, because RenderLayer::isVisuallyNonEmpty() returned early. If this
591         function is passed a request, we can't return until we've satisfied the request
592         (which triggers the checking of descendant layers).
593
594         Test: compositing/contents-format/subpixel-antialiased-nested-layer.html
595
596         * rendering/RenderLayer.cpp:
597         (WebCore::RenderLayer::calculateClipRects const):
598
599 2017-10-25  Chris Dumez  <cdumez@apple.com>
600
601         Unreviewed, add missing copyright header to ServiceWorkerClientType.idl.
602
603         * workers/service/ServiceWorkerClientType.idl:
604 =======
605         * platform/Cursor.cpp: Previously, excluded on iOS now wrapped in #if
606         * platform/sql/SQLiteDatabase.h: remove debugging data member from release builds.
607 >>>>>>> build fixes
608
609 2017-10-25  Chris Dumez  <cdumez@apple.com>
610
611         Make toJS() do the right thing for ServiceWorkerClient
612         https://bugs.webkit.org/show_bug.cgi?id=178816
613
614         Reviewed by Youenn Fablet.
615
616         Make toJS() do the right thing for ServiceWorkerClient. In particular,
617         it needs to construct a JSServiceWorkerWindowClient wrapper if the
618         implementation object is a ServiceWorkerWindowClient.
619
620         Also, ServiceWorkerClient does not need to be an ActiveDOMObject as
621         it does not have any long-running tasks. Make it a ContextDestructionObject
622         instead for now.
623
624         * CMakeLists.txt:
625         * DerivedSources.make:
626         * Sources.txt:
627         * WebCore.xcodeproj/project.pbxproj:
628         * workers/service/ServiceWorkerClient.cpp:
629         (WebCore::ServiceWorkerClient::postMessage):
630         * workers/service/ServiceWorkerClient.h:
631         (WebCore::ServiceWorkerClient::create):
632         * workers/service/ServiceWorkerClient.idl:
633         * workers/service/ServiceWorkerClientType.h: Copied from Source/WebCore/workers/service/ServiceWorkerClient.idl.
634         * workers/service/ServiceWorkerClientType.idl: Added.
635         * workers/service/ServiceWorkerClients.h:
636         * workers/service/ServiceWorkerClients.idl:
637
638 2017-10-25  Simon Fraser  <simon.fraser@apple.com>
639
640         When navigating back to a page, compositing layers may not use accelerated drawing
641         https://bugs.webkit.org/show_bug.cgi?id=178749
642         rdar://problem/35158946
643
644         Reviewed by Dean Jackson.
645
646         There were two issues with setting GraphicsLayerCA's "acceleratesDrawing" state which
647         occurred on back navigation, related to the ordering of style recalcs and layout.
648
649         First, at style recalc time, we created a RenderLayerCompositor but hadn't yet called
650         its cacheAcceleratedCompositingFlags(), so any layers created during style update
651         didn't get accelerated drawing. Fix by making cacheAcceleratedCompositingFlags() internal
652         to RenderLayerCompositor and calling it from willRecalcStyle() and updateCompositingLayers().
653
654         Secondly, GraphicsLayerCA::commitLayerChangesBeforeSublayers() needs to updateAcceleratesDrawing()
655         before updating tiles, so that new tiles fetch the right acceleratesDrawing state from
656         the TileController.
657
658         Test: compositing/accelerated-layers-after-back.html
659
660         * page/FrameView.cpp:
661         (WebCore::FrameView::updateCompositingLayersAfterLayout):
662         * platform/graphics/ca/GraphicsLayerCA.cpp:
663         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
664         * rendering/RenderLayerCompositor.cpp:
665         (WebCore::RenderLayerCompositor::willRecalcStyle):
666         (WebCore::RenderLayerCompositor::didRecalcStyleWithNoPendingLayout):
667         (WebCore::RenderLayerCompositor::updateCompositingLayers):
668         * rendering/RenderLayerCompositor.h:
669
670 2017-10-25  Youenn Fablet  <youenn@apple.com>
671
672         Enable ServiceWorker to fetch resources
673         https://bugs.webkit.org/show_bug.cgi?id=178673
674
675         Reviewed by Brady Eidson.
676
677         Test: http/tests/workers/service/service-worker-fetch.html
678
679         Allow reusing of EmptyFrameLoaderClient for network loading in WebKit Service Worker environment.
680         Allow overriding the creation of a document loader, pageID, frameID and sessionID getters.
681
682         Allow the possibility to create synthetic documents for all ports.
683
684         Beefing up ServiceWorkerThreadProxy as it owns a Document and a Page that do nothing but server
685         the purpose of loading resources for a service worker thread.
686
687         * WebCore.xcodeproj/project.pbxproj:
688         * loader/DocumentLoader.h:
689         (WebCore::DocumentLoader::setResponse):
690         * loader/EmptyClients.cpp:
691         (WebCore::EmptyFrameLoaderClient::sessionID const):
692         (WebCore::EmptyFrameLoaderClient::createNetworkingContext):
693         (WebCore::createEmptyFrameNetworkingContext):
694         * loader/EmptyClients.h:
695         * loader/EmptyFrameLoaderClient.h: Added.
696         * loader/FrameLoader.cpp:
697         (WebCore::FrameLoader::initForSynthesizedDocument):
698         * loader/FrameLoader.h:
699         * loader/FrameLoaderClient.h:
700         * workers/service/context/ServiceWorkerThread.cpp:
701         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
702         (WebCore::m_workerObjectProxy):
703         * workers/service/context/ServiceWorkerThread.h:
704         * workers/service/context/ServiceWorkerThreadProxy.cpp:
705         (WebCore::ServiceWorkerThreadProxy::create):
706         (WebCore::createPageForServiceWorker):
707         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
708         (WebCore::ServiceWorkerThreadProxy::postTaskToLoader):
709         * workers/service/context/ServiceWorkerThreadProxy.h:
710         Test: http/tests/workers/service/service-worker-fetch.html
711
712 2017-10-25  Jer Noble  <jer.noble@apple.com>
713
714         UNPACK_FLIP_Y is broken for MSE-backed videos
715         https://bugs.webkit.org/show_bug.cgi?id=178774
716
717         Reviewed by Dean Jackson.
718
719         The global GLSL variable gl_Position can apparently only be set once, and any modifications
720         made after that initial set are ignored. So rather than implement flipping by changing
721         gl_Position.y, flip the texture coordinates instead.
722
723         Drive-by fix: some of the constants used in VideoTextureCopierCV are not defined on older
724         macOS versions, so make them optional.
725
726         Tests: fast/canvas/webgl/texImage2D-mse-flipY-false.html
727                fast/canvas/webgl/texImage2D-mse-flipY-true.html
728
729         * platform/graphics/cv/VideoTextureCopierCV.cpp:
730         (WebCore::transferFunctionFromString):
731         (WebCore::VideoTextureCopierCV::initializeUVContextObjects):
732         * platform/cocoa/CoreVideoSoftLink.cpp:
733         * platform/cocoa/CoreVideoSoftLink.h:
734
735 2017-10-25  Chris Dumez  <cdumez@apple.com>
736
737         [Service Worker] Add stubs for serviceWorkerClient.type
738         https://bugs.webkit.org/show_bug.cgi?id=178812
739
740         Reviewed by Youenn Fablet.
741
742         Add stubs for serviceWorkerClient.type to match the latest specification:
743         - https://w3c.github.io/ServiceWorker/#enumdef-clienttype
744
745         * CMakeLists.txt:
746         * DerivedSources.make:
747         * Sources.txt:
748         * WebCore.xcodeproj/project.pbxproj:
749         * workers/service/ServiceWorkerClient.cpp:
750         (WebCore::ServiceWorkerClient::type const):
751         * workers/service/ServiceWorkerClient.h:
752         * workers/service/ServiceWorkerClient.idl:
753         * workers/service/ServiceWorkerClientType.h: Added.
754         * workers/service/ServiceWorkerClientType.idl: Added.
755         * workers/service/ServiceWorkerClients.h:
756         * workers/service/ServiceWorkerClients.idl:
757
758 2017-10-24  Keith Miller  <keith_miller@apple.com>
759
760         Move mathml and page to unified souces
761         https://bugs.webkit.org/show_bug.cgi?id=178770
762
763         Rubber-stamped by Tim Horton.
764
765         * CMakeLists.txt:
766         * Sources.txt:
767         * WebCore.xcodeproj/project.pbxproj:
768
769 2017-10-25  Fujii Hironori  <Hironori.Fujii@sony.com>
770
771         fast/images/animated-gif-paint-after-animation.html flaky crash
772         https://bugs.webkit.org/show_bug.cgi?id=178510
773
774         Reviewed by Said Abou-Hallawa.
775
776         ScalableImageDecoder was accessed from the main thread and the
777         image decoding thread without a mutex.
778
779         No new tests because there is no behavior change.
780
781         * platform/image-decoders/ScalableImageDecoder.h: Add m_mutex. Lock the mutex in setData.
782         * platform/image-decoders/ScalableImageDecoder.cpp:
783         (WebCore::ScalableImageDecoder::frameIsCompleteAtIndex const): Lock the mutex.
784         (WebCore::ScalableImageDecoder::frameHasAlphaAtIndex const): Ditto.
785         (WebCore::ScalableImageDecoder::frameBytesAtIndex const): Ditto.
786         (WebCore::ScalableImageDecoder::frameDurationAtIndex const): Ditto.
787         (WebCore::ScalableImageDecoder::createFrameImageAtIndex): Ditto.
788
789 2017-10-25  Chris Dumez  <cdumez@apple.com>
790
791         Add support for unregistering a service worker
792         https://bugs.webkit.org/show_bug.cgi?id=178735
793
794         Reviewed by Brady Eidson.
795
796         Add support for unregistering a service worker:
797         - https://w3c.github.io/ServiceWorker/#navigator-service-worker-unregister
798
799         Test: http/tests/workers/service/basic-unregister.https.html
800
801         * workers/service/ServiceWorkerContainer.cpp:
802         (WebCore::ServiceWorkerContainer::addRegistration):
803         (WebCore::ServiceWorkerContainer::removeRegistration):
804         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
805         * workers/service/ServiceWorkerContainer.h:
806         * workers/service/ServiceWorkerJob.cpp:
807         (WebCore::ServiceWorkerJob::resolvedWithUnregistrationResult):
808         * workers/service/ServiceWorkerJob.h:
809         * workers/service/ServiceWorkerJobClient.h:
810         * workers/service/ServiceWorkerJobData.h:
811         (WebCore::ServiceWorkerJobData::encode const):
812         (WebCore::ServiceWorkerJobData::decode):
813         * workers/service/ServiceWorkerJobType.h:
814         * workers/service/ServiceWorkerRegistration.cpp:
815         (WebCore::containerForScriptExecutionContext):
816         (WebCore::ServiceWorkerRegistration::unregister):
817         * workers/service/server/SWClientConnection.cpp:
818         (WebCore::SWClientConnection::registrationJobResolvedInServer):
819         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
820         * workers/service/server/SWClientConnection.h:
821         * workers/service/server/SWServer.cpp:
822         (WebCore::SWServer::resolveRegistationJob):
823         (WebCore::SWServer::resolveUnregistrationJob):
824         * workers/service/server/SWServer.h:
825         * workers/service/server/SWServerRegistration.cpp:
826         (WebCore::SWServerRegistration::scriptContextStarted):
827         (WebCore::SWServerRegistration::startNextJob):
828         (WebCore::SWServerRegistration::runUnregisterJob):
829         (WebCore::SWServerRegistration::resolveWithRegistrationOnMainThread):
830         (WebCore::SWServerRegistration::resolveWithUnregistrationResultOnMainThread):
831         (WebCore::SWServerRegistration::resolveCurrentRegistrationJob):
832         (WebCore::SWServerRegistration::resolveCurrentUnregistrationJob):
833         * workers/service/server/SWServerRegistration.h:
834
835 2017-10-25  Simon Fraser  <simon.fraser@apple.com>
836
837         MediaSessionManager* needs to catch Obj-C exceptions
838         https://bugs.webkit.org/show_bug.cgi?id=178813
839
840         Reviewed by Tim Horton.
841
842         Wrap all calls out to Objective-C with BEGIN_BLOCK_OBJC_EXCEPTIONS/END_BLOCK_OBJC_EXCEPTIONS.
843
844         * platform/audio/ios/MediaSessionManagerIOS.mm:
845         (WebCore::MediaSessionManageriOS::MediaSessionManageriOS):
846         (WebCore::MediaSessionManageriOS::~MediaSessionManageriOS):
847         (WebCore::MediaSessionManageriOS::hasWirelessTargetsAvailable):
848         (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring):
849         (WebCore::MediaSessionManageriOS::updateNowPlayingInfo):
850         (WebCore::MediaSessionManageriOS::externalOutputDeviceAvailableDidChange):
851         (-[WebMediaSessionHelper allocateVolumeView]):
852         (-[WebMediaSessionHelper initWithCallback:]):
853         * platform/audio/mac/MediaSessionManagerMac.mm:
854         (WebCore::MediaSessionManagerMac::updateNowPlayingInfo):
855
856 2017-10-25  Andy Estes  <aestes@apple.com>
857
858         [Payment Request] Implement the "user aborts the payment request" algorithm
859         https://bugs.webkit.org/show_bug.cgi?id=178810
860
861         Reviewed by Tim Horton.
862
863         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
864         (WebCore::ApplePayPaymentHandler::didCancelPaymentSession):
865         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
866         * Modules/paymentrequest/PaymentRequest.cpp:
867         (WebCore::PaymentRequest::cancel):
868         * Modules/paymentrequest/PaymentRequest.h:
869         * testing/MockPaymentCoordinator.cpp:
870         (WebCore::MockPaymentCoordinator::cancelPayment):
871         * testing/MockPaymentCoordinator.h:
872         * testing/MockPaymentCoordinator.idl:
873
874 2017-10-25  Jer Noble  <jer.noble@apple.com>
875
876         Autoplay muted videos still stop playback of other streaming apps in the background
877         https://bugs.webkit.org/show_bug.cgi?id=177920
878
879         Reviewed by Eric Carlson.
880
881         When creating a new <video> or <audio> element, the global AudioSession can sometimes have
882         its sessionCategory() set to "MediaPlayback", even if the element does not yet have a
883         source. This is because the constructor for the MediaElementSession is called before
884         m_isPlayingToWirelessTarget is initialized, and so in the MediaElementSession constructor,
885         the media element's m_isPlayingToWirelessTarget ivar is sometimes (uninitialized) true.
886
887         We could move the MediaElementSession ivar to the very end of the header, so it's
888         initialized last, but that still leaves the possibility of the MediaElementSession et. all
889         calling into the HTMLMediaElement before it's subclass's constructors have a chance to
890         initialize their own ivars (much less their vtables). So instead, we'll create and set the
891         MediaElementSession in a finishInitialization() method called from the HTMLVideoElement and
892         HTMLAudioElement's create() factory methods.
893
894         * html/HTMLAudioElement.cpp:
895         (WebCore::HTMLAudioElement::create):
896         * html/HTMLMediaElement.cpp:
897         (WebCore::HTMLMediaElement::HTMLMediaElement):
898         (WebCore::HTMLMediaElement::finishInitialization):
899         * html/HTMLMediaElement.h:
900         * html/HTMLVideoElement.cpp:
901         (WebCore::HTMLVideoElement::create):
902
903 2017-10-25  Javier Fernandez  <jfernandez@igalia.com>
904
905         [css-grid] Avoid clearing the overrideContainingBlockWidth if possible
906         https://bugs.webkit.org/show_bug.cgi?id=178260
907
908         Reviewed by Sergio Villar Senin.
909
910         Since the intrinsic width computation uses the same logic than the
911         track sizing algorithm we are clearing the overrideContainingBlockWidth
912         of some grid items that are required to laid out them properly.
913
914         It's very uncommon that any intrinsic size computation isn't performed
915         as part of a layout process. However, if it happens, once cleared the
916         overrideContainingBlockWidth it may lead to an incorrect layout of the
917         affected grid items.
918
919         This change is a defensive approach to avoid the issues caused by
920         such off-layout preferred size requests, which may imply recomputing
921         the grid container intrinsic size.
922
923         No new tests, because we are only removing some redundant logic.
924
925         * rendering/GridTrackSizingAlgorithm.cpp:
926         (WebCore::GridTrackSizingAlgorithmStrategy::minContentForChild const):
927         (WebCore::GridTrackSizingAlgorithmStrategy::maxContentForChild const):
928         (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild const):
929         (WebCore::GridTrackSizingAlgorithmStrategy::updateOverrideContainingBlockContentSizeForChild const):
930         (WebCore::IndefiniteSizeStrategy::minLogicalWidthForChild const):
931         (WebCore::DefiniteSizeStrategy::minLogicalWidthForChild const):
932         * rendering/GridTrackSizingAlgorithm.h:
933
934 2017-10-25  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
935
936         Unreviewed follow up changing one more enum value as discussed in the bug
937         https://bugs.webkit.org/show_bug.cgi?id=177810
938
939         * platform/glib/LowPowerModeNotifierGLib.cpp:
940         (WebCore::LowPowerModeNotifier::updateState): use NONE instead of DISCHARGING, to ensure
941         it will build even with older upower.
942
943 2017-10-25  Zan Dobersek  <zdobersek@igalia.com>
944
945         Make SERVICE_WORKER feature buildable on GTK, WPE
946         https://bugs.webkit.org/show_bug.cgi?id=178574
947
948         Reviewed by Carlos Garcia Campos.
949
950         * CMakeLists.txt: Add missing include paths and files to the build.
951         * Sources.txt: Add missing files to the build.
952         * WebCore.xcodeproj/project.pbxproj: Remove the JSDOMPromise.cpp and
953         JSFetchEventCustom.cpp targets, they're now built via unified sources.
954         * bindings/js/JSFetchEventCustom.cpp: Guard custom JSFetchEvent code
955         with the ENABLE(SERVICE_WORKER) guards.
956
957 2017-10-24  Alejandro G. Castro  <alex@igalia.com>
958
959         Clean up gcc build warnings about reaching the end of a non void function for webrtc classes
960         https://bugs.webkit.org/show_bug.cgi?id=178721
961
962         Reviewed by Youenn Fablet.
963
964         Assert when we reach those situations and return some value after that to avoid warning.
965
966         No new tests, this is a clean up.
967
968         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
969         (WebCore::sessionDescriptionType):
970         (WebCore::signalingState):
971         (WebCore::toRTCIceConnectionState):
972         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
973         (WebCore::bundlePolicyfromConfiguration):
974         (WebCore::iceTransportPolicyfromConfiguration):
975
976 2017-10-24  Ryosuke Niwa  <rniwa@webkit.org>
977
978         RenderSVGModelObject::checkIntersection triggers layout
979         https://bugs.webkit.org/show_bug.cgi?id=178710
980
981         Reviewed by Simon Fraser.
982
983         Fixed the bug that checkIntersection and checkEnclosure no longer updates the layout after r223882.
984
985         Test: svg/custom/check-intersection-basic.svg
986
987         * svg/SVGSVGElement.cpp:
988         (WebCore::SVGSVGElement::collectIntersectionOrEnclosureList):
989         (WebCore::SVGSVGElement::checkIntersection):
990         (WebCore::SVGSVGElement::checkEnclosure):
991         * svg/SVGSVGElement.h:
992
993 2017-10-24  Andy Estes  <aestes@apple.com>
994
995         [Apple Pay] Implement a paymentmethodselected event for PaymentRequest
996         https://bugs.webkit.org/show_bug.cgi?id=178765
997
998         Reviewed by Tim Horton.
999
1000         When the Apple Pay payment method changes, fire an applepaypaymentmethodchanged event on the
1001         PaymentRequest object. The event has a paymentMethod property and an updateWith() method
1002         which behaves identically to PaymentRequestUpdateEvent.updateWith().
1003
1004         Test: http/tests/ssl/applepay/ApplePayPaymentMethodUpdateEvent.https.html
1005
1006         * DerivedSources.make:
1007         * Modules/applepay/ApplePayPaymentMethod.idl:
1008         * Modules/applepay/ApplePayPaymentMethodSelectedEvent.h:
1009         * Modules/applepay/PaymentMethod.h:
1010         (WebCore::PaymentMethod::PaymentMethod): Deleted.
1011         (WebCore::PaymentMethod::pkPaymentMethod const): Deleted.
1012         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
1013         (WebCore::ApplePayPaymentHandler::detailsUpdated):
1014         (WebCore::ApplePayPaymentHandler::paymentMethodUpdated):
1015         (WebCore::ApplePayPaymentHandler::didSelectPaymentMethod):
1016         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
1017         * Modules/applepay/paymentrequest/ApplePayPaymentMethodUpdateEvent.cpp: Added.
1018         (WebCore::ApplePayPaymentMethodUpdateEvent::ApplePayPaymentMethodUpdateEvent):
1019         (WebCore::ApplePayPaymentMethodUpdateEvent::eventInterface const):
1020         * Modules/applepay/paymentrequest/ApplePayPaymentMethodUpdateEvent.h: Added.
1021         * Modules/applepay/paymentrequest/ApplePayPaymentMethodUpdateEvent.idl: Added.
1022         * Modules/paymentrequest/PaymentHandler.h:
1023         * Modules/paymentrequest/PaymentRequest.cpp:
1024         (WebCore::PaymentRequest::shippingAddressChanged):
1025         (WebCore::PaymentRequest::shippingOptionChanged):
1026         (WebCore::PaymentRequest::dispatchEvent):
1027         (WebCore::PaymentRequest::updateWith):
1028         (WebCore::PaymentRequest::settleDetailsPromise):
1029         (WebCore::PaymentRequest::dispatchUpdateEvent): Deleted.
1030         * Modules/paymentrequest/PaymentRequest.h:
1031         * Modules/paymentrequest/PaymentRequest.idl:
1032         * Modules/paymentrequest/PaymentRequestUpdateEvent.cpp:
1033         (WebCore::PaymentRequestUpdateEvent::updateWith):
1034         * Modules/paymentrequest/PaymentRequestUpdateEvent.h:
1035         * WebCore.xcodeproj/project.pbxproj:
1036         * dom/EventNames.h:
1037         * dom/EventNames.in:
1038         * testing/MockPaymentCoordinator.cpp:
1039         (WebCore::MockPaymentCoordinator::changePaymentMethod):
1040         * testing/MockPaymentCoordinator.h:
1041         * testing/MockPaymentCoordinator.idl:
1042         * testing/MockPaymentMethod.h: Added.
1043
1044 2017-10-24  Youenn Fablet  <youenn@apple.com>
1045
1046         ServiceWorkerClientFetch should return an error that is not null in case of failure
1047         https://bugs.webkit.org/show_bug.cgi?id=178761
1048
1049         Reviewed by Geoffrey Garen.
1050
1051         Covered by existing tests.
1052
1053         As per spec, ServiceWorkerJob should not go through Service Worker Handle Fetch
1054         for fetching scripts.
1055
1056         * workers/WorkerScriptLoader.cpp:
1057         (WebCore::WorkerScriptLoader::loadAsynchronously):
1058         * workers/WorkerScriptLoaderClient.h:
1059         (WebCore::WorkerScriptLoaderClient::isServiceWorkerClient const):
1060         * workers/service/ServiceWorkerJob.h:
1061
1062 2017-10-24  Keith Miller  <keith_miller@apple.com>
1063
1064         Move inspector and loader to unified sources.
1065         https://bugs.webkit.org/show_bug.cgi?id=178760
1066
1067         Rubber-stamped by Tim Horton.
1068
1069         * CMakeLists.txt:
1070         * Sources.txt:
1071         * WebCore.xcodeproj/project.pbxproj:
1072
1073 2017-10-24  Alex Christensen  <achristensen@webkit.org>
1074
1075         Fix build after r223940
1076
1077         * inspector/WebConsoleAgent.cpp:
1078
1079 2017-10-24  Alex Christensen  <achristensen@webkit.org>
1080
1081         Fix Windows build after r223929.
1082         https://bugs.webkit.org/show_bug.cgi?id=177027
1083
1084         * inspector/WebConsoleAgent.cpp:
1085         (WebCore::WebConsoleAgent::getLoggingChannels):
1086         Always initialize the variable "level".  Visual studio was complaining about the possibility of not initializing it
1087         but this is only possible if logChannel->level is an invalid enum value.
1088
1089 2017-10-24  Alex Christensen  <achristensen@webkit.org>
1090
1091         Fix Windows build after r223925
1092         https://bugs.webkit.org/show_bug.cgi?id=178687
1093
1094         * html/ImageBitmap.cpp:
1095         (WebCore::interpolationQualityForResizeQuality):
1096         Visual Studio was complaining that not all control paths returned a value.
1097
1098 2017-10-24  Youenn Fablet  <youenn@apple.com>
1099
1100         Enable service worker to use cache storage api
1101         https://bugs.webkit.org/show_bug.cgi?id=178684
1102
1103         Reviewed by Brady Eidson.
1104
1105         Test: http/tests/workers/service/service-worker-cache-api.https.html
1106
1107         Updated WorkerLoaderProxy so that it can create a CacheStorageConnection.
1108         Update WorkerCacheStorageConnection to take benefit of that.
1109         This allows creating a CacheStorageConnection based on the page for regular workers and differently for Service Worker context.
1110
1111         Added ServiceWorkerThreadProxy as a proxy to ServiceWorkerThread.
1112         It is in particular responsible to do proxy for loading tasks.
1113         It implements cache API support for service worker by creating a dedicated CacheStorageConnection.
1114
1115         * Modules/cache/WorkerCacheStorageConnection.cpp:
1116         (WebCore::WorkerCacheStorageConnection::create):
1117         (WebCore::WorkerCacheStorageConnection::~WorkerCacheStorageConnection):
1118         (WebCore::WorkerCacheStorageConnection::doOpen):
1119         (WebCore::WorkerCacheStorageConnection::doRemove):
1120         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
1121         (WebCore::WorkerCacheStorageConnection::reference):
1122         (WebCore::WorkerCacheStorageConnection::dereference):
1123         (WebCore::WorkerCacheStorageConnection::doRetrieveRecords):
1124         (WebCore::WorkerCacheStorageConnection::doBatchDeleteOperation):
1125         (WebCore::WorkerCacheStorageConnection::doBatchPutOperation):
1126         * WebCore.xcodeproj/project.pbxproj:
1127         * workers/WorkerLoaderProxy.h:
1128         * workers/WorkerMessagingProxy.cpp:
1129         (WebCore::WorkerMessagingProxy::createCacheStorageConnection):
1130         * workers/WorkerMessagingProxy.h:
1131         * workers/service/context/ServiceWorkerThread.cpp:
1132         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
1133         * workers/service/context/ServiceWorkerThread.h:
1134         * workers/service/context/ServiceWorkerThreadProxy.cpp: Added.
1135         (WebCore::ServiceWorkerThreadProxy::create):
1136         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
1137         (WebCore::ServiceWorkerThreadProxy::postTaskForModeToWorkerGlobalScope):
1138         (WebCore::ServiceWorkerThreadProxy::postTaskToLoader):
1139         (WebCore::ServiceWorkerThreadProxy::createCacheStorageConnection):
1140         * workers/service/context/ServiceWorkerThreadProxy.h: Added.
1141
1142 2017-10-24  Alex Christensen  <achristensen@webkit.org>
1143
1144         Optionally store entire ResourceRequest for ping loads
1145         https://bugs.webkit.org/show_bug.cgi?id=178756
1146
1147         Reviewed by Tim Horton.
1148
1149         No change in behavior.
1150         This uses less memory in the common loading case.
1151         This will be needed for moving appcache loading to the Networking Process.
1152         See https://bugs.webkit.org/show_bug.cgi?id=178540
1153
1154         * loader/cache/CachedResource.cpp:
1155         (WebCore::CachedResource::load):
1156         * loader/cache/CachedResource.h:
1157         (WebCore::CachedResource::setOriginalRequest):
1158         (WebCore::CachedResource::originalRequest const):
1159         (WebCore::CachedResource::setOriginalRequestHeaders): Deleted.
1160         * loader/cache/CachedResourceLoader.cpp:
1161         (WebCore::CachedResourceLoader::requestResource):
1162
1163 2017-10-24  Andy Estes  <aestes@apple.com>
1164
1165         [WebIDL] Support the ExportMacro attribute for dictionaries
1166         https://bugs.webkit.org/show_bug.cgi?id=178752
1167
1168         Reviewed by Sam Weinig.
1169
1170         * bindings/scripts/CodeGeneratorJS.pm:
1171         (GenerateDictionaryHeaderContent):
1172         * bindings/scripts/test/JS/JSTestStandaloneDictionary.h:
1173         * bindings/scripts/test/TestStandaloneDictionary.idl:
1174
1175 2017-10-24  Eric Carlson  <eric.carlson@apple.com>
1176
1177         Web Inspector: Enable WebKit logging configuration and display
1178         https://bugs.webkit.org/show_bug.cgi?id=177027
1179         <rdar://problem/33964767>
1180
1181         Reviewed by Joseph Pecoraro.
1182
1183         Test: inspector/console/webcore-logging.html
1184
1185         * dom/Document.cpp:
1186         (WebCore::Document::~Document): Stop observing the logger.
1187         (WebCore::Document::logger): Observe the logger.
1188         (WebCore::Document::didLogMessage): Forward logging messages to the inspector.
1189         * dom/Document.h:
1190
1191         * inspector/WebConsoleAgent.cpp:
1192         (WebCore::WebConsoleAgent::getLoggingChannels): New, return the state of log runtime channels.
1193         (WebCore::WebConsoleAgent::setLoggingChannelLevel): New, set the state of a channel.
1194         * inspector/WebConsoleAgent.h:
1195
1196         * platform/Logging.cpp:
1197         (WebCore::getLogChannel): New, get a log channel by name.
1198         * platform/Logging.h:
1199
1200 2017-10-24  Dean Jackson  <dino@apple.com>
1201
1202         Attempted build fix for Sierra.
1203
1204         * html/ImageBitmap.cpp:
1205         (WebCore::croppedSourceRectangleWithFormatting):
1206
1207 2017-10-24  Dean Jackson  <dino@apple.com>
1208
1209         Implement resizing options for ImageBitmap rendering
1210         https://bugs.webkit.org/show_bug.cgi?id=178687
1211         <rdar://problem/35135417>
1212
1213         Reviewed by Sam Weinig.
1214
1215         Implement many of the sizing options for createImageBitmap.
1216
1217         Test: http/wpt/2dcontext/imagebitmap/createImageBitmap-sizing.html
1218
1219         * html/ImageBitmap.cpp:
1220         (WebCore::croppedSourceRectangleWithFormatting):
1221
1222             Implement the first bit of the algorithm from
1223             the HTML specification.
1224
1225         (WebCore::outputSizeForSourceRectangle):
1226
1227             ... and then the second bit. Leave the rest in
1228             comments for now.
1229
1230         (WebCore::interpolationQualityForResizeQuality):
1231
1232             Helper function to map ImageBitmapOptions to
1233             GraphicsContext.
1234
1235         (WebCore::ImageBitmap::createPromise):
1236
1237             Implement more of the sizing algorithm.
1238
1239         * html/ImageBitmap.h: Origin tainting is defined to be false by default.
1240
1241 2017-10-24  Chris Dumez  <cdumez@apple.com>
1242
1243         Add initial implementation for serviceWorker.postMessage()
1244         https://bugs.webkit.org/show_bug.cgi?id=178534
1245
1246         Reviewed by Youenn Fablet.
1247
1248         Add initial implementation for serviceWorker.postMessage():
1249         - https://w3c.github.io/ServiceWorker/#service-worker-postmessage
1250
1251         Test: http/tests/workers/service/basic-ServiceWorker-postMessage.https.html
1252
1253         * CMakeLists.txt:
1254         * DerivedSources.make:
1255         * Sources.txt:
1256         * WebCore.xcodeproj/project.pbxproj:
1257         * bindings/js/JSBindingsAllInOne.cpp:
1258         * bindings/js/JSExtendableMessageEvent.cpp: Added.
1259         (WebCore::JSExtendableMessageEvent::data const):
1260         * bindings/js/WebCoreBuiltinNames.h:
1261         * dom/Document.h:
1262         * dom/EventNames.in:
1263         * dom/MessagePortChannel.h:
1264         * dom/ScriptExecutionContext.h:
1265         * workers/WorkerGlobalScope.h:
1266         * workers/service/ExtendableEvent.cpp:
1267         (WebCore::ExtendableEvent::ExtendableEvent):
1268         (WebCore::ExtendableEvent::~ExtendableEvent):
1269         * workers/service/ExtendableEvent.h:
1270         * workers/service/ExtendableMessageEvent.cpp: Added.
1271         (WebCore::ExtendableMessageEvent::create):
1272         (WebCore::ExtendableMessageEvent::ExtendableMessageEvent):
1273         (WebCore::ExtendableMessageEvent::~ExtendableMessageEvent):
1274         * workers/service/ExtendableMessageEvent.h: Added.
1275         * workers/service/ExtendableMessageEvent.idl: Added.
1276         * workers/service/ServiceWorker.cpp:
1277         (WebCore::ServiceWorker::ServiceWorker):
1278         (WebCore::ServiceWorker::postMessage):
1279         (WebCore::ServiceWorker::state const):
1280         (WebCore::ServiceWorker::scriptExecutionContext const):
1281         * workers/service/ServiceWorker.h:
1282         * workers/service/ServiceWorkerContainer.cpp:
1283         (WebCore::ServiceWorkerContainer::controller const):
1284         * workers/service/ServiceWorkerContainer.h:
1285         * workers/service/ServiceWorkerGlobalScope.cpp:
1286         (WebCore::ServiceWorkerGlobalScope::thread):
1287         * workers/service/ServiceWorkerGlobalScope.h:
1288         (isType):
1289         * workers/service/context/ServiceWorkerThread.cpp:
1290         (WebCore::ServiceWorkerThread::postMessageToServiceWorkerGlobalScope):
1291         * workers/service/context/ServiceWorkerThread.h:
1292         * workers/service/server/SWClientConnection.h:
1293
1294 2017-10-24  Andy Estes  <aestes@apple.com>
1295
1296         [Payment Request] Implement the "PaymentRequest updated" algorithm
1297         https://bugs.webkit.org/show_bug.cgi?id=178689
1298
1299         Reviewed by Alex Christensen.
1300
1301         Implemented the "PaymentRequest updated" algorithm by firing shippingaddresschange and
1302         shippingoptionchange events at the right times and implementing
1303         PaymentRequestUpdateEvent.updateWith().
1304
1305         Tests: http/tests/paymentrequest/payment-request-change-shipping-address.https.html
1306                http/tests/paymentrequest/payment-request-change-shipping-option.https.html
1307                http/tests/paymentrequest/updateWith-method-pmi-handling.https.html
1308
1309         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
1310         (WebCore::convertAndValidate): Added. Converts a PaymentDetailsInit to a
1311         ApplePaySessionPaymentRequest::TotalAndLineItems.
1312         (WebCore::ApplePayPaymentHandler::shippingAddressUpdated): Created a ShippingContactUpdate
1313         and passed it to PaymentCoordinator::completeShippingContactSelection().
1314         (WebCore::ApplePayPaymentHandler::shippingOptionUpdated): Created a ShippingMethodUpdate and
1315         passed it to PaymentCoordinator::completeShippingMethodSelection().
1316         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
1317         * Modules/paymentrequest/PaymentHandler.h:
1318         * Modules/paymentrequest/PaymentRequest.cpp:
1319         (WebCore::checkAndCanonicalizeDetails): Moved the logic for checking and canonicalizing a
1320         PaymentDetailsBase from PaymentRequest::create() to here.
1321         (WebCore::PaymentRequest::create): Called checkAndCanonicalizeDetails().
1322         (WebCore::PaymentRequest::abortWithException): Moved the body of stop() to here and
1323         parameterized the Exception with which to abort m_showPromise.
1324         (WebCore::PaymentRequest::stop): Called abortWithException() with an AbortError.
1325         (WebCore::PaymentRequest::shippingAddressChanged): Called dispatchUpdateEvent() with
1326         shippingaddresschangeEvent.
1327         (WebCore::PaymentRequest::shippingOptionChanged): Ditto with shippingoptionchangeEvent.
1328         (WebCore::PaymentRequest::dispatchUpdateEvent): Created a PaymentRequestUpdateEvent and
1329         dispatched it.
1330         (WebCore::PaymentRequest::updateWith): Added a settle handler to m_detailsPromise.
1331         (WebCore::PaymentRequest::settleDetailsPromise): Updated the PaymentRequest with the new
1332         details and called PaymentHandler::shippingAddressUpdated() or
1333         PaymentHandler::shippingOptionUpdated().
1334         * Modules/paymentrequest/PaymentRequest.h:
1335         * Modules/paymentrequest/PaymentRequestUpdateEvent.cpp:
1336         (WebCore::PaymentRequestUpdateEvent::PaymentRequestUpdateEvent):
1337         (WebCore::PaymentRequestUpdateEvent::updateWith): Called PaymentRequest::updateWith().
1338         (WebCore::PaymentRequestUpdateEvent::eventInterface const): Returned
1339         PaymentRequestUpdateEventInterfaceType.
1340         * Modules/paymentrequest/PaymentRequestUpdateEvent.h:
1341         * Modules/paymentrequest/PaymentRequestUpdateEvent.idl:
1342         * testing/MockPaymentCoordinator.cpp:
1343         (WebCore::MockPaymentCoordinator::canMakePaymentsWithActiveCard):
1344         (WebCore::MockPaymentCoordinator::openPaymentSetup):
1345         (WebCore::MockPaymentCoordinator::completeMerchantValidation): Stopped calling
1346         PaymentCoordinator::didAuthorizePayment().
1347         (WebCore::MockPaymentCoordinator::changeShippingOption): Called
1348         PaymentCoordinator::didSelectShippingMethod().
1349         (WebCore::MockPaymentCoordinator::acceptPayment): Called
1350         PaymentCoordinator::didAuthorizePayment().
1351         * testing/MockPaymentCoordinator.h:
1352         * testing/MockPaymentCoordinator.idl:
1353
1354 2017-10-24  Alex Christensen  <achristensen@webkit.org>
1355
1356         Apply custom header fields from WebsitePolicies to same-domain requests
1357         https://bugs.webkit.org/show_bug.cgi?id=178356
1358         <rdar://problem/31073436>
1359
1360         Reviewed by Brady Eidson.
1361
1362         Covered by new API tests.
1363
1364         * loader/cache/CachedResourceLoader.cpp:
1365         (WebCore::CachedResourceLoader::requestResource):
1366         * platform/network/ResourceRequestBase.cpp:
1367         (WebCore::ResourceRequestBase::setCachePolicy):
1368         (WebCore::ResourceRequestBase::setTimeoutInterval):
1369         (WebCore::ResourceRequestBase::setHTTPMethod):
1370         (WebCore::ResourceRequestBase::setHTTPHeaderField):
1371         (WebCore::ResourceRequestBase::clearHTTPAuthorization):
1372         (WebCore::ResourceRequestBase::clearHTTPContentType):
1373         (WebCore::ResourceRequestBase::clearHTTPReferrer):
1374         (WebCore::ResourceRequestBase::clearHTTPOrigin):
1375         (WebCore::ResourceRequestBase::clearHTTPUserAgent):
1376         (WebCore::ResourceRequestBase::clearHTTPAccept):
1377         (WebCore::ResourceRequestBase::clearHTTPAcceptEncoding):
1378         (WebCore::ResourceRequestBase::setResponseContentDispositionEncodingFallbackArray):
1379         (WebCore::ResourceRequestBase::setHTTPBody):
1380         (WebCore::ResourceRequestBase::setAllowCookies):
1381         (WebCore::ResourceRequestBase::setPriority):
1382         (WebCore::ResourceRequestBase::addHTTPHeaderFieldIfNotPresent):
1383         (WebCore::ResourceRequestBase::addHTTPHeaderField):
1384         (WebCore::ResourceRequestBase::setHTTPHeaderFields):
1385         If we only update the platform request when headers are added (or other changes) for HTTP requests,
1386         then the changes will not affect the NSURLRequest that is sent over IPC or visible to the API.
1387         This is necessary for these new tests to work, but it's also of growing importance since our
1388         introduction of WKURLSchemeHandler.
1389
1390 2017-10-24  Brent Fulgham  <bfulgham@apple.com>
1391
1392         Adopt new secure coding APIs
1393         https://bugs.webkit.org/show_bug.cgi?id=178484
1394         <rdar://problem/34837193>
1395
1396         Reviewed by Tim Horton.
1397
1398         Switch to new NSKeyed[Un]Archiver methods that active and use
1399         NSSecureCoding by default.
1400
1401         Most of the new API is wrapped in a set of convenience methods so we can
1402         build without the new API on older systems.
1403
1404         No change in behavior.
1405
1406         * editing/cocoa/EditorCocoa.mm:
1407         (WebCore::archivedDataForAttributedString): Use new convenience method
1408         to archive the string object.
1409         * loader/archive/cf/LegacyWebArchiveMac.mm:
1410         (WebCore::LegacyWebArchive::createResourceResponseFromMacArchivedData): Update to
1411         use secure coding where possible.
1412         (WebCore::LegacyWebArchive::createPropertyListRepresentation): Ditto.
1413         * platform/ios/PlatformPasteboardIOS.mm:
1414         (WebCore::PlatformPasteboard::write): Use new secure API.
1415         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Ditto.
1416         * testing/cocoa/WebArchiveDumpSupport.mm:
1417         (WebCoreTestSupport::createCFURLResponseFromResponseData): Update to
1418         secure coding API where possible.
1419
1420 2017-10-24  Jeremy Jones  <jeremyj@apple.com>
1421
1422         HTMLMediaElement should iterate HTMLTrackElements consistently.
1423         https://bugs.webkit.org/show_bug.cgi?id=178423
1424         rdar://problem/35044967
1425
1426         Reviewed by Eric Carlson.
1427
1428         No new tests because no expected behavior change.
1429
1430         HTMLMediaElement iterates HTMLTrackElements as children in every place but one, where it iterates them
1431         as descendants. It should always iterate them as children.
1432
1433         * html/HTMLMediaElement.cpp:
1434         (WebCore::HTMLMediaElement::finishParsingChildren):
1435
1436 2017-10-24  Chris Dumez  <cdumez@apple.com>
1437
1438         SerializedScriptValue::deserialize() should take ports as a const Vector&
1439         https://bugs.webkit.org/show_bug.cgi?id=178727
1440
1441         Reviewed by Alex Christensen.
1442
1443         SerializedScriptValue::deserialize() should take ports as a const Vector&, not a Vector&.
1444         It does not modify the input vector.
1445
1446         * bindings/js/JSMessageEventCustom.cpp:
1447         (WebCore::JSMessageEvent::data const):
1448         * bindings/js/SerializedScriptValue.cpp:
1449         (WebCore::CloneDeserializer::deserialize):
1450         (WebCore::CloneDeserializer::CloneDeserializer):
1451         (WebCore::SerializedScriptValue::deserialize):
1452         * bindings/js/SerializedScriptValue.h:
1453
1454 2017-10-24  Konstantin Tokarev  <annulen@yandex.ru>
1455
1456         [MediaFoundation] Videos are always autoplaying for local files
1457         https://bugs.webkit.org/show_bug.cgi?id=178693
1458
1459         Patch by Doug Massay.
1460         Reviewed by Alex Christensen.
1461
1462         r199114 fixes autoplay issue only if starting session invokes
1463         buffering stage. However when local files are played, onBufferingStarted
1464         and onBufferingStopped are not called, and video is not paused.
1465
1466         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
1467         (WebCore::MediaPlayerPrivateMediaFoundation::endGetEvent):
1468         (WebCore::MediaPlayerPrivateMediaFoundation::onSessionStarted):
1469         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
1470
1471 2017-10-24  Matt Lewis  <jlewis3@apple.com>
1472
1473         Unreviewed, rolling out r223889.
1474
1475         This caused multiple crashes on all platforms
1476
1477         Reverted changeset:
1478
1479         "Adopt new secure coding APIs"
1480         https://bugs.webkit.org/show_bug.cgi?id=178484
1481         https://trac.webkit.org/changeset/223889
1482
1483 2017-10-24  Antti Koivisto  <antti@apple.com>
1484
1485         Create inline wrappers for before/after pseudo elements that have display:contents
1486         https://bugs.webkit.org/show_bug.cgi?id=178722
1487
1488         Reviewed by Ryosuke Niwa.
1489
1490         We can handle before and after pseudo elements with display:contents by giving them
1491         inline renderers with style inherited from display:contents style. This removes
1492         need for complicated logic for this case and handles everything correctly.
1493
1494         This is a better approach and replaces the one taken in bug 178584.
1495         It also fixes two display:contents WPTs.
1496
1497         * dom/PseudoElement.h:
1498
1499             There is no need to track content renderers separately anymore. They always descendants of
1500             pseudo element's renderer (which is an inline wrapper in case of display:contents).
1501
1502         * rendering/style/RenderStyle.cpp:
1503         (WebCore::RenderStyle::copyContentFrom):
1504         * rendering/style/RenderStyle.h:
1505         * style/RenderTreeUpdaterGeneratedContent.cpp:
1506         (WebCore::createContentRenderers):
1507         (WebCore::updateStyleForContentRenderers):
1508         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
1509         (WebCore::removeAndDestroyContentRenderers): Deleted.
1510
1511             Since content renderers are now always descendants of the pseudo renderer
1512             there is no need for a separate destruction path.
1513
1514         * style/StyleTreeResolver.cpp:
1515         (WebCore::Style::TreeResolver::resolvePseudoStyle):
1516
1517             Create ElementUpdate with a style that will produce an inline wrapper.
1518
1519 2017-10-24  Wenson Hsieh  <wenson_hsieh@apple.com>
1520
1521         [iOS] MediaPlayer::isAvailable() takes ~150 ms during web process initialization
1522         https://bugs.webkit.org/show_bug.cgi?id=178713
1523         <rdar://problem/35115906>
1524
1525         Reviewed by Eric Carlson.
1526
1527         Loading AVFoundation should not be required to answer the question of MediaPlayer::isAvailable() on iOS, where
1528         both AVFoundation and CoreMedia frameworks should always exist. As such, we can bail early and return true to
1529         avoid always dynamically loading AVFoundation and CoreMedia.
1530
1531         * platform/graphics/MediaPlayer.cpp:
1532         (WebCore::MediaPlayer::isAvailable):
1533
1534 2017-10-24  Antoine Quint  <graouts@apple.com>
1535
1536         RenderThemeCocoa::mediaControlsFormattedStringForDuration may cause a crash due to unhandled Obj-C exception
1537         https://bugs.webkit.org/show_bug.cgi?id=178716
1538         <rdar://problem/35112900>
1539
1540         Reviewed by Dean Jackson.
1541
1542         * rendering/RenderThemeCocoa.mm:
1543         (WebCore::RenderThemeCocoa::mediaControlsFormattedStringForDuration):
1544
1545 2017-10-24  Ryosuke Niwa  <rniwa@webkit.org>
1546
1547         SizesAttributeParser::SizesAttributeParser triggers layout
1548         https://bugs.webkit.org/show_bug.cgi?id=178712
1549
1550         Reviewed by Antti Koivisto.
1551
1552         Revert r213711 as this change introduced an unwated synchronous layout inside Node::insertedIntoAncestor.
1553
1554         The test had been marked as timing out since r191379 and changed to failing expectation in r199225
1555         as the test result's error message changes from run to run.
1556
1557         Disabled Tests: imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/environment-changes/viewport-change.html
1558                         had been marked failing since r199225, prior to which it was marked as timeout in r191379.
1559                         imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/sizes/parse-a-sizes-attribute.html
1560                         is now marked as flaky.
1561
1562         * css/parser/SizesAttributeParser.cpp:
1563         (WebCore::SizesAttributeParser::SizesAttributeParser):
1564
1565 2017-10-24  Keith Miller  <keith_miller@apple.com>
1566
1567         Unreviewed, fix internal iOS build.
1568
1569         * Sources.txt:
1570
1571 2017-10-24  Brent Fulgham  <bfulgham@apple.com>
1572
1573         Adopt new secure coding APIs
1574         https://bugs.webkit.org/show_bug.cgi?id=178484
1575         <rdar://problem/34837193>
1576
1577         Reviewed by Tim Horton.
1578
1579         Switch to new NSKeyed[Un]Archiver methods that active and use
1580         NSSecureCoding by default.
1581
1582         Most of the new API is wrapped in a set of convenience methods so we can
1583         build without the new API on older systems.
1584
1585         No change in behavior.
1586
1587         * editing/cocoa/EditorCocoa.mm:
1588         (WebCore::archivedDataForAttributedString): Use new convenience method
1589         to archive the string object.
1590         * loader/archive/cf/LegacyWebArchiveMac.mm:
1591         (WebCore::LegacyWebArchive::createResourceResponseFromMacArchivedData): Update to
1592         use secure coding where possible.
1593         (WebCore::LegacyWebArchive::createPropertyListRepresentation): Ditto.
1594         * platform/ios/PlatformPasteboardIOS.mm:
1595         (WebCore::PlatformPasteboard::write): Use new secure API.
1596         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Ditto.
1597         * testing/cocoa/WebArchiveDumpSupport.mm:
1598         (WebCoreTestSupport::createCFURLResponseFromResponseData): Update to
1599         secure coding API where possible.
1600
1601 2017-10-24  Miguel Gomez  <magomez@igalia.com>
1602
1603         [GTK][X11] Windy.com shows always straight wind lines
1604         https://bugs.webkit.org/show_bug.cgi?id=176718
1605
1606         Reviewed by Carlos Garcia Campos.
1607
1608         WebGL's GL_LUMINANCE_ALPHA format is not available in OpenGL when using a version >= 3.2
1609         and a core profile. In that case, we need to replace it with GL_RG and swizzle the color
1610         components appropriately.
1611
1612         No new behavior.
1613
1614         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
1615         (WebCore::GraphicsContext3D::texImage2D):
1616         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
1617         (WebCore::GraphicsContext3D::texSubImage2D):
1618
1619 2017-10-24  Ryosuke Niwa  <rniwa@webkit.org>
1620
1621         DocumentOrderedMap::add should release assert that tree scopes match
1622         https://bugs.webkit.org/show_bug.cgi?id=178708
1623
1624         Reviewed by Antti Koivisto.
1625
1626         Assert that the tree scope of element matches the given tree scope instead of asserting that
1627         element is in tree scope, and replaced the use of RELEASE_ASSERT by the newly added
1628         RELEASE_ASSERT_WITH_SECURITY_IMPLICATION to clarify the semantics of these assertions.
1629
1630         Also removed now redudnant early exits which would never execute due to release assertions.
1631
1632         * dom/DocumentOrderedMap.cpp:
1633         (WebCore::DocumentOrderedMap::add):
1634         (WebCore::DocumentOrderedMap::remove):
1635         (WebCore::DocumentOrderedMap::get const):
1636
1637 2017-10-24  Michael Catanzaro  <mcatanzaro@igalia.com>
1638
1639         -Wsubobject-linkage warning in InspectorIndexedDBAgent.cpp
1640         https://bugs.webkit.org/show_bug.cgi?id=178698
1641
1642         Reviewed by Joseph Pecoraro.
1643
1644         * inspector/InspectorIndexedDBAgent.cpp:
1645
1646 2017-10-24  Antoine Quint  <graouts@apple.com>
1647
1648         [Web Animations] Add basic timing and target properties
1649         https://bugs.webkit.org/show_bug.cgi?id=178674
1650
1651         Reviewed by Dean Jackson.
1652
1653         We add three new interfaces to expose enough properties to establish basic timing properties,
1654         a start time and duration, and the target of an animation. The startTime property is set on
1655         the Animation object, the target is set on the KeyframeEffect set as the effect property on
1656         the Animation object, and the duration is set on the AnimationEffectTiming set on the effect.
1657
1658         Tests: webanimations/animation-effect-timing.html
1659                webanimations/animation-effect.html
1660                webanimations/animation-interface-effect-property.html
1661                webanimations/animation-interface-start-time-property.html
1662                webanimations/keyframe-effect-interface-timing-duration.html
1663                webanimations/keyframe-effect.html
1664
1665         * CMakeLists.txt:
1666         * DerivedSources.make:
1667         * Sources.txt:
1668         * WebCore.xcodeproj/project.pbxproj:
1669         * animation/AnimationEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl.
1670         (WebCore::AnimationEffect::AnimationEffect):
1671         (WebCore::AnimationEffect::~AnimationEffect):
1672         * animation/AnimationEffect.h: Copied from Source/WebCore/animation/WebAnimation.h.
1673         (WebCore::AnimationEffect::isKeyframeEffect const):
1674         (WebCore::AnimationEffect::timing const):
1675         (WebCore::AnimationEffect::classType const):
1676         * animation/AnimationEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl.
1677         * animation/AnimationEffectTiming.cpp: Copied from Source/WebCore/animation/WebAnimation.idl.
1678         (WebCore::AnimationEffectTiming::create):
1679         (WebCore::AnimationEffectTiming::AnimationEffectTiming):
1680         (WebCore::AnimationEffectTiming::~AnimationEffectTiming):
1681         * animation/AnimationEffectTiming.h: Copied from Source/WebCore/animation/WebAnimation.h.
1682         * animation/AnimationEffectTiming.idl: Copied from Source/WebCore/animation/WebAnimation.idl.
1683         * animation/KeyframeEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl.
1684         (WebCore::KeyframeEffect::create):
1685         (WebCore::KeyframeEffect::KeyframeEffect):
1686         * animation/KeyframeEffect.h: Copied from Source/WebCore/animation/WebAnimation.h.
1687         * animation/KeyframeEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl.
1688         * animation/WebAnimation.cpp:
1689         (WebCore::WebAnimation::setEffect):
1690         * animation/WebAnimation.h:
1691         * animation/WebAnimation.idl:
1692         * bindings/js/JSAnimationEffectCustom.cpp: Copied from Source/WebCore/animation/WebAnimation.cpp.
1693         (WebCore::toJSNewlyCreated):
1694         (WebCore::toJS):
1695         * bindings/js/WebCoreBuiltinNames.h:
1696
1697 2017-10-24  Ryosuke Niwa  <rniwa@webkit.org>
1698
1699         RenderSVGModelObject::checkIntersection triggers layout
1700         https://bugs.webkit.org/show_bug.cgi?id=178710
1701
1702         Reviewed by Antti Koivisto.
1703
1704         Don't trigger a layout inside getElementCTM. Update the layout upfront in getEnclosureList.
1705
1706         * rendering/svg/RenderSVGModelObject.cpp:
1707         (WebCore::getElementCTM):
1708         * svg/SVGSVGElement.cpp:
1709         (WebCore::SVGSVGElement::getEnclosureList):
1710
1711 2017-10-24  Nan Wang  <n_wang@apple.com>
1712
1713         AX: Crash at -[WebAccessibilityObjectWrapper _accessibilityMinValue] + 24
1714         https://bugs.webkit.org/show_bug.cgi?id=178697
1715
1716         Reviewed by Chris Fleizach.
1717
1718         When we are calling _accessibilityMinValue and _accessibilityMaxValue on iOS, 
1719         it might cause crash if the AX object has already been detached. Fixed this 
1720         by adding the necessary checks.
1721
1722         Test: accessibility/ios-simulator/slider-min-value-crash.html
1723
1724         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1725         (-[WebAccessibilityObjectWrapper _accessibilityMinValue]):
1726         (-[WebAccessibilityObjectWrapper _accessibilityMaxValue]):
1727
1728 2017-10-23  Keith Miller  <keith_miller@apple.com>
1729
1730         Unreviewed, restore unneeded all in ones.
1731
1732         * CMakeLists.txt:
1733
1734 2017-10-23  Commit Queue  <commit-queue@webkit.org>
1735
1736         Unreviewed, rolling out r223870 and r223871.
1737         https://bugs.webkit.org/show_bug.cgi?id=178702
1738
1739         broke the windows build (Requested by keith_miller on
1740         #webkit).
1741
1742         Reverted changesets:
1743
1744         "Add html, inspector, loader to unified sources"
1745         https://bugs.webkit.org/show_bug.cgi?id=178695
1746         https://trac.webkit.org/changeset/223870
1747
1748         "Unrievwed, fix windows build."
1749         https://trac.webkit.org/changeset/223871
1750
1751 2017-10-23  Michael Catanzaro  <mcatanzaro@igalia.com>
1752
1753         Unreviewed, attempt to fix initializeSupportedImageMIMETypes after r223860
1754         https://bugs.webkit.org/show_bug.cgi?id=178618
1755         <rdar://problem/35108852>
1756
1757         * platform/MIMETypeRegistry.cpp:
1758         (WebCore::initializeSupportedImageMIMETypes):
1759
1760 2017-10-23  Keith Miller  <keith_miller@apple.com>
1761
1762         Unrievwed, fix windows build.
1763
1764         * CMakeLists.txt:
1765
1766 2017-10-23  Keith Miller  <keith_miller@apple.com>
1767
1768         Add html, inspector, loader to unified sources
1769         https://bugs.webkit.org/show_bug.cgi?id=178695
1770
1771         Rubber-stamped by Tim Horton.
1772
1773         * CMakeLists.txt:
1774         * Sources.txt:
1775         * WebCore.xcodeproj/project.pbxproj:
1776
1777 2017-10-23  Joseph Pecoraro  <pecoraro@apple.com>
1778
1779         Web Inspector: Remove unused Console.setMonitoringXHREnabled
1780         https://bugs.webkit.org/show_bug.cgi?id=178617
1781
1782         Reviewed by Sam Weinig.
1783
1784         * inspector/InspectorInstrumentation.cpp:
1785         (WebCore::InspectorInstrumentation::didFinishXHRLoadingImpl):
1786         * inspector/InspectorInstrumentation.h:
1787         (WebCore::InspectorInstrumentation::didFinishXHRLoading):
1788         * inspector/WebConsoleAgent.cpp:
1789         (WebCore::WebConsoleAgent::setMonitoringXHREnabled): Deleted.
1790         (WebCore::WebConsoleAgent::didFinishXHRLoading): Deleted.
1791         * inspector/WebConsoleAgent.h:
1792         Remove XHR monitoring code.
1793
1794         * xml/XMLHttpRequest.h:
1795         * xml/XMLHttpRequest.cpp:
1796         (WebCore::XMLHttpRequest::send):
1797         (WebCore::XMLHttpRequest::didFinishLoading):
1798         (WebCore::XMLHttpRequest::setLastSendLineAndColumnNumber): Deleted.
1799         * xml/XMLHttpRequest.idl:
1800         Remove now unused state on XHR and ExecState requirement for send().
1801
1802 2017-10-23  Keith Miller  <keith_miller@apple.com>
1803
1804         Add dom, editing, fileapi, and history to unified sources
1805         https://bugs.webkit.org/show_bug.cgi?id=178694
1806
1807         Rubber-stamped by Tim Horton.
1808
1809         * CMakeLists.txt:
1810         * Sources.txt:
1811         * WebCore.xcodeproj/project.pbxproj:
1812
1813 2017-10-23  Keith Miller  <keith_miller@apple.com>
1814
1815         Move bridge, contentextensions, crypto, and css to unified sources.
1816         https://bugs.webkit.org/show_bug.cgi?id=178691
1817
1818         Reviewed by Tim Horton.
1819
1820         * CMakeLists.txt:
1821         * Sources.txt:
1822         * WebCore.xcodeproj/project.pbxproj:
1823
1824 2017-10-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1825
1826         Unreviewed, fix the Windows build after r223860
1827
1828         UTIUtilities only exists on Cocoa platforms, so we need to guard it accordingly.
1829
1830         * platform/MIMETypeRegistry.cpp:
1831         (WebCore::initializeSupportedImageMIMETypes):
1832
1833 2017-10-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1834
1835         [iOS] DocumentWriter::createDocument can spend ~100ms unnecessarily converting image UTIs to MIME types
1836         https://bugs.webkit.org/show_bug.cgi?id=178618
1837         <rdar://problem/35108852>
1838
1839         Reviewed by Said Abou-Hallawa.
1840
1841         Currently, in setting up a new Document, DocumentWriter::createDocument() always asks whether or not the
1842         Document should be a PDF document by calling MIMETypeRegistry::isPDFMIMEType(), which forces lazy initialization
1843         of every MIME type dictionary (e.g. image types, PDF types, JavaScript types, etc.). As evidenced by traces,
1844         this can be an expensive operation on certain devices.
1845
1846         This patch implements two optimizations. First, we refactor the initializeSupportedImageMIMETypes() helper to
1847         stop asking for MIMETypeForImageSourceType for each of the supported UTIs. This is because the known MIME types
1848         corresponding to these hard-coded UTI types is a fixed set anyways, so we can simply iterate over a constant
1849         array of MIME types and populate the supported image (and image resource) types. Also, add assertions to ensure
1850         that we keep allowed image MIME types in sync with allowed image UTIs.
1851
1852         The second optimization removes initializeMIMETypeRegistry() altogether in favor of calling just the
1853         initialize*MIMETypes() functions needed to ensure the information required. For instance, getPDFMIMETypes()
1854         currently calls initializeMIMETypeRegistry() if the pdfMIMETypes dictionary doesn't exist, when it really only
1855         needs to ensure that the pdfMIMETypes is initialized, for which initializePDFMIMETypes() is sufficient.
1856
1857         * platform/MIMETypeRegistry.cpp:
1858         (WebCore::initializeSupportedImageMIMETypes):
1859         (WebCore::initializeSupportedJavaScriptMIMETypes):
1860         (WebCore::initializePDFMIMETypes):
1861         (WebCore::initializeSupportedNonImageMimeTypes):
1862         (WebCore::initializeUnsupportedTextMIMETypes):
1863
1864         Move MIME type dictionary creation into initialize*MIMETypes() helpers. Additionally, remove
1865         initializePDFAndPostScriptMIMETypes, which is no longer necessary.
1866
1867         (WebCore::MIMETypeRegistry::isSupportedImageMIMEType):
1868         (WebCore::MIMETypeRegistry::isSupportedImageResourceMIMEType):
1869         (WebCore::MIMETypeRegistry::isSupportedJavaScriptMIMEType):
1870         (WebCore::MIMETypeRegistry::isSupportedNonImageMIMEType):
1871         (WebCore::MIMETypeRegistry::isUnsupportedTextMIMEType):
1872         (WebCore::MIMETypeRegistry::isPDFOrPostScriptMIMEType):
1873
1874         Tweak to check that the type isPDFMIMEType(), or that it's otherwise "application/postscript".
1875
1876         (WebCore::MIMETypeRegistry::isPDFMIMEType):
1877         (WebCore::MIMETypeRegistry::getSupportedImageMIMETypes):
1878         (WebCore::MIMETypeRegistry::getSupportedImageResourceMIMETypes):
1879         (WebCore::MIMETypeRegistry::getSupportedNonImageMIMETypes):
1880         (WebCore::MIMETypeRegistry::getPDFMIMETypes):
1881         (WebCore::MIMETypeRegistry::getUnsupportedTextMIMETypes):
1882
1883         Call only the relevant MIME type initializers when needed.
1884
1885         (WebCore::initializePostScriptMIMETypes): Deleted.
1886         (WebCore::initializeMIMETypeRegistry): Deleted.
1887         (WebCore::MIMETypeRegistry::getPDFAndPostScriptMIMETypes): Deleted.
1888
1889         Remove an unused and unexported function.
1890
1891         * platform/MIMETypeRegistry.h:
1892
1893 2017-10-23  Andy Estes  <aestes@apple.com>
1894
1895         [Payment Request] Take the JSC API lock before creating the PaymentResponse.details object
1896         https://bugs.webkit.org/show_bug.cgi?id=178686
1897
1898         Reviewed by Keith Miller.
1899
1900         This fixes several flaky crashes in http/tests/paymentrequest/ after r223855.
1901
1902         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
1903         (WebCore::ApplePayPaymentHandler::didAuthorizePayment):
1904
1905 2017-10-23  Joseph Pecoraro  <pecoraro@apple.com>
1906
1907         Web Inspector: Please support HAR Export for network traffic
1908         https://bugs.webkit.org/show_bug.cgi?id=146692
1909         <rdar://problem/7463672>
1910
1911         Reviewed by Brian Burg.
1912
1913         Tests: http/tests/inspector/network/har/har-basic.html
1914                http/tests/inspector/network/har/har-page.html
1915
1916         * inspector/InspectorNetworkAgent.cpp:
1917         (WebCore::InspectorNetworkAgent::willSendRequest):
1918         Include the wall time when sending a request. This is needed for HAR to
1919         include a wall time, and can be used for Cookie expiration time calculation
1920         as well.
1921
1922 2017-10-23  Andy Estes  <aestes@apple.com>
1923
1924         [Payment Request] Resolve PaymentRequest.show()'s accept promise when a payment is authorized
1925         https://bugs.webkit.org/show_bug.cgi?id=178609
1926         <rdar://problem/33542813>
1927
1928         Reviewed by Alex Christensen.
1929
1930         This patch implements the logic for resolving PaymentRequest.show()'s accept promise when
1931         the user authorizes a payment, and implements PaymentResponse.complete().
1932
1933         Tests: http/tests/paymentrequest/payment-address-attributes-and-toJSON-method.https.html
1934                http/tests/paymentrequest/payment-response-complete-method.https.html
1935                http/tests/paymentrequest/payment-response-methodName-attribute.https.html
1936                http/tests/paymentrequest/payment-response-payerEmail-attribute.https.html
1937                http/tests/paymentrequest/payment-response-payerName-attribute.https.html
1938                http/tests/paymentrequest/payment-response-payerPhone-attribute.https.html
1939
1940         * DerivedSources.make:
1941         * Modules/applepay/ApplePayPaymentContact.h:
1942         * Modules/applepay/Payment.h:
1943         (WebCore::Payment::Payment): Deleted.
1944         (WebCore::Payment::pkPayment const): Deleted.
1945         * Modules/applepay/PaymentContact.h:
1946         (WebCore::PaymentContact::PaymentContact): Deleted.
1947         (WebCore::PaymentContact::pkContact const): Deleted.
1948         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
1949         (WebCore::convert):
1950         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
1951         (WebCore::ApplePayPaymentHandler::hasActiveSession):
1952         (WebCore::ApplePayPaymentHandler::ApplePayPaymentHandler):
1953         (WebCore::ApplePayPaymentHandler::document):
1954         (WebCore::ApplePayPaymentHandler::paymentCoordinator):
1955         (WebCore::ApplePayPaymentHandler::convertData):
1956         (WebCore::ApplePayPaymentHandler::show):
1957         (WebCore::ApplePayPaymentHandler::hide):
1958         (WebCore::ApplePayPaymentHandler::canMakePayment):
1959         (WebCore::ApplePayPaymentHandler::complete):
1960         (WebCore::convert):
1961         (WebCore::ApplePayPaymentHandler::didAuthorizePayment):
1962         (WebCore::ApplePayPaymentHandler::didSelectShippingMethod):
1963         (WebCore::ApplePayPaymentHandler::didSelectShippingContact):
1964         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
1965         * Modules/paymentrequest/PaymentAddress.h:
1966         * Modules/paymentrequest/PaymentAddress.idl:
1967         * Modules/paymentrequest/PaymentHandler.cpp:
1968         (WebCore::PaymentHandler::create):
1969         * Modules/paymentrequest/PaymentHandler.h:
1970         * Modules/paymentrequest/PaymentRequest.cpp:
1971         (WebCore::PaymentRequest::show):
1972         (WebCore::PaymentRequest::stop):
1973         (WebCore::PaymentRequest::canMakePayment):
1974         (WebCore::PaymentRequest::canSuspendForDocumentSuspension const):
1975         (WebCore::PaymentRequest::shippingAddressChanged):
1976         (WebCore::PaymentRequest::shippingOptionChanged):
1977         (WebCore::PaymentRequest::accept):
1978         (WebCore::PaymentRequest::complete):
1979         * Modules/paymentrequest/PaymentRequest.h:
1980         * Modules/paymentrequest/PaymentResponse.cpp:
1981         (WebCore::PaymentResponse::PaymentResponse):
1982         (WebCore::PaymentResponse::complete):
1983         * Modules/paymentrequest/PaymentResponse.h:
1984         * WebCore.xcodeproj/project.pbxproj:
1985         * testing/Internals.cpp:
1986         (WebCore::Internals::Internals):
1987         (WebCore::Internals::mockPaymentCoordinator const):
1988         * testing/Internals.h:
1989         * testing/Internals.idl:
1990         * testing/MockPayment.h: Added.
1991         * testing/MockPaymentAddress.h: Added.
1992         * testing/MockPaymentAddress.idl: Added.
1993         * testing/MockPaymentContact.h: Added.
1994         * testing/MockPaymentCoordinator.cpp:
1995         (WebCore::MockPaymentCoordinator::canMakePaymentsWithActiveCard):
1996         (WebCore::MockPaymentCoordinator::openPaymentSetup):
1997         (WebCore::dispatchIfShowing):
1998         (WebCore::MockPaymentCoordinator::showPaymentUI):
1999         (WebCore::MockPaymentCoordinator::completeMerchantValidation):
2000         (WebCore::MockPaymentCoordinator::completePaymentSession):
2001         (WebCore::MockPaymentCoordinator::abortPaymentSession):
2002         (WebCore::MockPaymentCoordinator::cancelPaymentSession):
2003         (WebCore::MockPaymentCoordinator::paymentCoordinatorDestroyed):
2004         * testing/MockPaymentCoordinator.h:
2005         * testing/MockPaymentCoordinator.idl: Added.
2006
2007 2017-10-23  Dean Jackson  <dino@apple.com>
2008
2009         Attempt to stop iOS Simulator tests from failing because
2010         we don't support Accelerated ImageBuffer.
2011
2012         * html/ImageBitmap.cpp:
2013
2014 2017-10-23  Zalan Bujtas  <zalan@apple.com>
2015
2016         [FrameView::layout cleanup] Make m_subtreeLayoutRoot weak.
2017         https://bugs.webkit.org/show_bug.cgi?id=178621
2018         <rdar://problem/35110321>
2019
2020         Reviewed by Simon Fraser.
2021
2022         This patch turn m_subtreeLayoutRoot into a weak pointer to handle both the optional and the mutation cases.
2023
2024         Covered by existing cases.
2025
2026         * page/FrameView.cpp:
2027         (WebCore::FrameView::reset):
2028         (WebCore::FrameView::willDestroyRenderTree):
2029         (WebCore::FrameView::didDestroyRenderTree):
2030         (WebCore::FrameView::calculateScrollbarModesForLayout):
2031         (WebCore::FrameView::handleLayoutWithFrameFlatteningIfNeeded):
2032         (WebCore::FrameView::canPerformLayout const):
2033         (WebCore::FrameView::layout): WeakPtr<RenderElement> protects us from recursive layouts triggering UAF on layoutRoot.
2034         (WebCore::FrameView::convertSubtreeLayoutToFullLayout):
2035         (WebCore::FrameView::scheduleRelayout):
2036         (WebCore::FrameView::scheduleRelayoutOfSubtree):
2037         (WebCore::FrameView::needsLayout const):
2038         (WebCore::FrameView::autoSizeIfEnabled):
2039         * page/FrameView.h:
2040
2041 2017-10-23  Keith Miller  <keith_miller@apple.com>
2042
2043         Unreviewed, fix windows build.
2044
2045         * CMakeLists.txt:
2046
2047 2017-10-23  Keith Miller  <keith_miller@apple.com>
2048
2049         Move shared accessibility and animiations files to unified sources.
2050         https://bugs.webkit.org/show_bug.cgi?id=178677
2051
2052         Reviewed by Tim Horton.
2053
2054         * Sources.txt:
2055         * WebCore.xcodeproj/project.pbxproj:
2056
2057 2017-10-23  Chris Dumez  <cdumez@apple.com>
2058
2059         Drop confusing Event::dispatched() method
2060         https://bugs.webkit.org/show_bug.cgi?id=178670
2061
2062         Reviewed by Youenn Fablet.
2063
2064         Drop confusing Event::dispatched() method. What the call sites want to do is check
2065         that the Event's "dispatch" flag is set:
2066         - https://dom.spec.whatwg.org/#dispatch-flag
2067
2068         This flag gets set at the beginning of dispatchEvent() and unset at the end of
2069         dispatchEvent():
2070         - https://dom.spec.whatwg.org/#ref-for-dispatch-flag③
2071
2072         See as an example event.initEvent():
2073         - https://dom.spec.whatwg.org/#dom-event-initevent
2074
2075         The right way to check the Event's "dispatch" flag is the Event::isBeingDispatched()
2076         method, so use this instead. One side effect of this change is that it is now
2077         possible to call the init*Event() method on events that have already been dispatched
2078         in order to dispatch them again, as per the specification.
2079
2080         Test: fast/events/initEvent-after-dispatching.html
2081
2082         * dom/CompositionEvent.cpp:
2083         (WebCore::CompositionEvent::initCompositionEvent):
2084         * dom/DeviceMotionEvent.cpp:
2085         (WebCore::DeviceMotionEvent::initDeviceMotionEvent):
2086         * dom/DeviceOrientationEvent.cpp:
2087         (WebCore::DeviceOrientationEvent::initDeviceOrientationEvent):
2088         * dom/Event.h:
2089         * dom/HashChangeEvent.h:
2090         * dom/KeyboardEvent.cpp:
2091         (WebCore::KeyboardEvent::initKeyboardEvent):
2092         * dom/MessageEvent.cpp:
2093         (WebCore::MessageEvent::initMessageEvent):
2094         * dom/MouseEvent.cpp:
2095         (WebCore::MouseEvent::initMouseEvent):
2096         * dom/OverflowEvent.cpp:
2097         (WebCore::OverflowEvent::initOverflowEvent):
2098         * dom/TextEvent.cpp:
2099         (WebCore::TextEvent::initTextEvent):
2100         * dom/TouchEvent.cpp:
2101         (WebCore::TouchEvent::initTouchEvent):
2102         * dom/UIEvent.cpp:
2103         (WebCore::UIEvent::initUIEvent):
2104         * dom/WheelEvent.cpp:
2105         (WebCore::WheelEvent::initWheelEvent):
2106         * storage/StorageEvent.cpp:
2107         (WebCore::StorageEvent::initStorageEvent):
2108
2109 2017-10-23  Antti Koivisto  <antti@apple.com>
2110
2111         Remember previous child renderer during render tree update
2112         https://bugs.webkit.org/show_bug.cgi?id=178659
2113
2114         Reviewed by Zalan Bujtas.
2115
2116         We shouldn't need to recompute the previous renderer, we know it already.
2117
2118         * style/RenderTreePosition.cpp:
2119         (WebCore::RenderTreePosition::previousSiblingRenderer const): Deleted.
2120
2121             No longer needed. This was also subtly wrong as doesn't take display:contents into account.
2122
2123         * style/RenderTreePosition.h:
2124         * style/RenderTreeUpdater.cpp:
2125         (WebCore::RenderTreeUpdater::updateRenderTree):
2126         (WebCore::RenderTreeUpdater::textRendererIsNeeded):
2127
2128             Use the saved previous renderer.
2129
2130         (WebCore::RenderTreeUpdater::updateTextRenderer):
2131         (WebCore::RenderTreeUpdater::storePreviousRenderer):
2132
2133             Save the previous renderere as we walk the tree.
2134
2135         (WebCore::textRendererIsNeeded): Deleted.
2136         * style/RenderTreeUpdater.h:
2137
2138 2017-10-23  Keith Miller  <keith_miller@apple.com>
2139
2140         Add Shared Modules files to the unified source build.
2141         https://bugs.webkit.org/show_bug.cgi?id=178675
2142
2143         Reviewed by Tim Horton.
2144
2145         This patch all the Modules sources files shared across all ports to
2146         unified sources.
2147
2148         * CMakeLists.txt:
2149         * Sources.txt:
2150         * WebCore.xcodeproj/project.pbxproj:
2151
2152 2017-10-22  Dean Jackson  <dino@apple.com>
2153
2154         Implement drawImage(ImageBitmap) on 2d canvas
2155         https://bugs.webkit.org/show_bug.cgi?id=178653
2156         <rdar://problem/35104360>
2157
2158         Reviewed by Antoine Quint.
2159
2160         Implement CanvasRenderingContext2D::drawImage with ImageBitmap.
2161         It's probably not going to be a very common operation, but
2162         it importantly allows us to test the ImageBitmap creation
2163         code.
2164
2165         Test: http/wpt/2dcontext/imagebitmap/drawImage-ImageBitmap.html
2166
2167         * html/ImageBitmap.cpp:
2168         (WebCore::taintsOrigin): New helper function to determine if a
2169         CachedImage would provide a clean origin.
2170         (WebCore::ImageBitmap::createPromise): Set the flag that records
2171         if this ImageBitmap has a clean origin.
2172         * html/ImageBitmap.h:
2173         (WebCore::ImageBitmap::buffer): Exposes the ImageBuffer backing
2174         store, allowing access to the data for drawing.
2175         (WebCore::ImageBitmap::originClean const): Is this ImageBitmap
2176         going to taint a destination.
2177         * html/canvas/CanvasRenderingContext.cpp:
2178         (WebCore::CanvasRenderingContext::wouldTaintOrigin): Implement
2179         the ImageBitmap version of this template function.
2180         * html/canvas/CanvasRenderingContext.h:
2181         * html/canvas/CanvasRenderingContext2D.cpp:
2182         (WebCore::CanvasRenderingContext2D::drawImage): Implement the
2183         actual drawing of an ImageBitmap.
2184
2185 2017-10-23  Daniel Bates  <dabates@apple.com>
2186
2187         Unreviewed, rolling out r223699.
2188
2189         Caused regressions with right-to-left text selection and
2190         painting of markers in flipped writing mode and in overlapping
2191         lines. Will investigate offline.
2192
2193         Reverted changeset:
2194
2195         "Share logic in InlineTextBox to compute selection rect"
2196         https://bugs.webkit.org/show_bug.cgi?id=178232
2197         https://trac.webkit.org/changeset/223699
2198
2199 2017-10-23  Youenn Fablet  <youenn@apple.com>
2200
2201         Create a Fetch event when ServiceWorker has to handle a fetch
2202         https://bugs.webkit.org/show_bug.cgi?id=178491
2203
2204         Reviewed by Chris Dumez.
2205
2206         Covered by existing test.
2207
2208         Updating FetchEvent to pass a FetchResponse* within its onResponse callback.
2209         Making it a CompletionHandler.
2210         Fixing a check on respondWith to ensure that event is dispatched when respondWith is called.
2211
2212         Adding ServiceWorkerFetch class to handle the creation of the fetch event, waiting for the fetch event to be responded
2213         and processing when fetch event is responded.
2214         ServiceWorkerFetchTask takes a client to which will be sent the response body or the error.
2215         WebKit implementation of it will be to send the related IPC message back to the WebProcess that made the fetch request.
2216
2217         Adding a method to ServiceWorkerThread to create the fetch event on worker thread and dispatch on the global scope.
2218
2219         * WebCore.xcodeproj/project.pbxproj:
2220         * platform/network/ResourceResponseBase.h:
2221         * testing/Internals.cpp:
2222         (WebCore::Internals::waitForFetchEventToFinish):
2223         * workers/service/FetchEvent.cpp:
2224         (WebCore::FetchEvent::~FetchEvent):
2225         (WebCore::FetchEvent::respondWith):
2226         (WebCore::FetchEvent::onResponse):
2227         (WebCore::FetchEvent::respondWithError):
2228         (WebCore::FetchEvent::processResponse):
2229         (WebCore::FetchEvent::promiseIsSettled):
2230         * workers/service/FetchEvent.h:
2231         * workers/service/context/ServiceWorkerFetch.cpp: Added.
2232         (WebCore::ServiceWorkerFetch::dispatchFetchTask):
2233         (WebCore::ServiceWorkerFetch::processResponse):
2234         * workers/service/context/ServiceWorkerFetch.h: Added.
2235         * workers/service/context/ServiceWorkerThread.cpp:
2236         (WebCore::m_workerObjectProxy):
2237         (WebCore::ServiceWorkerThread::dispatchFetchEvent):
2238         * workers/service/context/ServiceWorkerThread.h:
2239
2240 2017-10-23  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2241
2242         [Curl] Fix authentication related bugs
2243         https://bugs.webkit.org/show_bug.cgi?id=178652
2244
2245         Reviewed by Alex Christensen.
2246
2247         * platform/network/curl/AuthenticationChallengeCurl.cpp:
2248         (WebCore::AuthenticationChallenge::protectionSpaceFromHandle):
2249         * platform/network/curl/CurlContext.cpp:
2250         (WebCore::CurlHandle::setHttpAuthUserPass):
2251         * platform/network/curl/CurlRequest.cpp:
2252         (WebCore::CurlRequest::setUserPass):
2253         (WebCore::CurlRequest::setupTransfer):
2254         (WebCore::CurlRequest::didReceiveHeader):
2255         * platform/network/curl/CurlRequest.h:
2256
2257 2017-10-23  Matt Lewis  <jlewis3@apple.com>
2258
2259         Unreviewed, rolling out r223820.
2260
2261         This caused a build break on Windows.
2262
2263         Reverted changeset:
2264
2265         "Web Inspector: Remove unused Console.setMonitoringXHREnabled"
2266         https://bugs.webkit.org/show_bug.cgi?id=178617
2267         https://trac.webkit.org/changeset/223820
2268
2269 2017-10-23  Zalan Bujtas  <zalan@apple.com>
2270
2271         Call FrameView::scheduleSelectionUpdate when selection needs repainting after layout instead of setting the RenderView dirty.
2272         https://bugs.webkit.org/show_bug.cgi?id=178651
2273         <rdar://problem/35117448>
2274
2275         Reviewed by Antti Koivisto.
2276
2277         Calling setNeedsLayout() on the RenderView to trigger selection update is problematic in 2 different ways:
2278         1. marking the root renderer dirty does not trigger layout (this is very specific to the root,
2279         other renderers do trigger layout). It means that it works as long as someone else schedules a layout.
2280         2. when a subtree layout is already scheduled and we mark the root renderer dirty, the root gets stuck with
2281         the dirty flag (since the entry point for the subsequent layout is a descendant of the root and not the root itself).
2282
2283         This patch addresses these issues by scheduling/converting subtree layout when needed.  
2284
2285         Covered by fast/dynamic/remove-invisible-node-inside-selection.html/remove-node-inside-selection.html
2286
2287         * editing/FrameSelection.cpp:
2288         (WebCore::FrameSelection::respondToNodeModification):
2289         * page/FrameView.cpp:
2290         (WebCore::FrameView::scheduleSelectionUpdate):
2291         * page/FrameView.h:
2292
2293 2017-10-23  Miguel Gomez  <magomez@igalia.com>
2294
2295         [TexMap] Remove GraphicsContext3D usage from TextureMapperShaderProgram
2296         https://bugs.webkit.org/show_bug.cgi?id=175425
2297
2298         Reviewed by Žan Doberšek.
2299
2300         Remove usage of the GraphicsContext3D class in TextureMapperShaderProgram.
2301         Direct OpenGL API calls, types and constants are used instead.
2302
2303         By removing GraphicsContext3D, we don't use ANGLE anymore to perform the
2304         shader adaptation to the used OpenGL/GLES2 version, so we need to do that
2305         inside TextureMapperShaderProgram. The main changes required for this are
2306         adding the #version directive and use in/out to define input/output parameters
2307         when using OpenGL >= 3.2, and defining the default precision only when using
2308         GLES2.
2309
2310         Besides that, now that VideoTextureCopierGStreamer doesn't have its own
2311         GraphicsContext3D, we need to add a VAO to it when using OpenGL >= 3.2.
2312
2313         Based on a previous patch by Žan Doberšek <zdobersek@igalia.com>.
2314
2315         No behavior change.
2316
2317         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:
2318         (WebCore::VideoTextureCopierGStreamer::VideoTextureCopierGStreamer):
2319         (WebCore::VideoTextureCopierGStreamer::~VideoTextureCopierGStreamer):
2320         (WebCore::VideoTextureCopierGStreamer::copyVideoTextureToPlatformTexture):
2321         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.h:
2322         * platform/graphics/texmap/TextureMapperGL.cpp:
2323         (WebCore::TextureMapperGLData::getShaderProgram):
2324         (WebCore::prepareFilterProgram):
2325         (WebCore::TextureMapperGL::drawTexture):
2326         (WebCore::TextureMapperGL::drawFiltered):
2327         * platform/graphics/texmap/TextureMapperShaderProgram.cpp:
2328         (WebCore::TextureMapperShaderProgram::create):
2329         (WebCore::getShaderLog):
2330         (WebCore::getProgramLog):
2331         (WebCore::TextureMapperShaderProgram::TextureMapperShaderProgram):
2332         (WebCore::TextureMapperShaderProgram::~TextureMapperShaderProgram):
2333         (WebCore::TextureMapperShaderProgram::setMatrix):
2334         (WebCore::TextureMapperShaderProgram::getLocation):
2335         * platform/graphics/texmap/TextureMapperShaderProgram.h:
2336         (WebCore::TextureMapperShaderProgram::programID const):
2337
2338 2017-10-22  Sam Weinig  <sam@webkit.org>
2339
2340         [Settings] Replace current Settings generation with template file based approach
2341         https://bugs.webkit.org/show_bug.cgi?id=178634
2342
2343         Reviewed by Joseph Pecoraro.
2344
2345         This replaces the recently added python based Settings generation with a generator
2346         built in ruby, so we can take advantage of ERB for templating. The result has much
2347         of the logic in the templates and as a result feels much easier to follow and cleaner.
2348
2349         Since I was moving things to ruby, I took the opertunity to switch the Settings definition
2350         file from our .in format to yaml, which is quite a bit easier to read.
2351
2352         * CMakeLists.txt:
2353         * DerivedSources.make:
2354         * Scripts/GenerateSettings: Removed.
2355         * Scripts/GenerateSettings.py: Removed.
2356         * Scripts/GenerateSettings.rb: Added.
2357         * Scripts/GenerateSettings/GenerateInternalSettingsHeaderFile.py: Removed.
2358         * Scripts/GenerateSettings/GenerateInternalSettingsIDLFile.py: Removed.
2359         * Scripts/GenerateSettings/GenerateInternalSettingsImplementationFile.py: Removed.
2360         * Scripts/GenerateSettings/GenerateSettings.py: Removed.
2361         * Scripts/GenerateSettings/GenerateSettingsHeaderFile.py: Removed.
2362         * Scripts/GenerateSettings/GenerateSettingsImplementationFile.py: Removed.
2363         * Scripts/GenerateSettings/Settings.py: Removed.
2364         * Scripts/GenerateSettings/__init__.py: Removed.
2365         * Scripts/SettingsTemplates: Added.
2366         * Scripts/SettingsTemplates/InternalSettingsGenerated.cpp.erb: Added.
2367         * Scripts/SettingsTemplates/InternalSettingsGenerated.h.erb: Added.
2368         * Scripts/SettingsTemplates/InternalSettingsGenerated.idl.erb: Added.
2369         * Scripts/SettingsTemplates/Settings.cpp.erb: Added.
2370         * Scripts/SettingsTemplates/Settings.h.erb: Added.
2371         * WebCore.xcodeproj/project.pbxproj:
2372         * WebCoreMacros.cmake:
2373         * page/Settings.in: Removed.
2374         * page/Settings.yaml: Added.
2375
2376 2017-10-22  Joseph Pecoraro  <pecoraro@apple.com>
2377
2378         REGRESSION(r219675): Web Inspector: CommandLineAPI getEventListeners does not work
2379         https://bugs.webkit.org/show_bug.cgi?id=178650
2380         <rdar://problem/35116347>
2381
2382         Reviewed by Sam Weinig.
2383
2384         Test: inspector/console/command-line-api-getEventListeners.html
2385
2386         * inspector/CommandLineAPIHost.cpp:
2387         (WebCore::listenerEntriesFromListenerInfo):
2388         Fix typo.
2389
2390         (WebCore::CommandLineAPIHost::getEventListeners):
2391         Fix incorrect early return.
2392
2393         * inspector/CommandLineAPIHost.h:
2394         * inspector/CommandLineAPIHost.idl:
2395         Add more attributes about the listener. These new attributes match output from Chrome.
2396
2397 2017-10-22  Antoine Quint  <graouts@apple.com>
2398
2399         [Web Animations] Add animations to the timeline
2400         https://bugs.webkit.org/show_bug.cgi?id=178643
2401
2402         Reviewed by Dean Jackson.
2403
2404         If a timeline is provided as a parameter to the Animation constructor,
2405         add it to the timeline, and remove it when the object is destroyed.
2406
2407         We also start the basic mechanism to dump the contents of a timeline
2408         as text for testing purposes, currently only logging the number of
2409         animations in a timeline and just logging the class name for animation
2410         themselves.
2411
2412         Test: webanimations/animation-creation-addition.html
2413
2414         * animation/AnimationTimeline.cpp:
2415         (WebCore::AnimationTimeline::description):
2416         * animation/AnimationTimeline.h:
2417         * animation/AnimationTimeline.idl:
2418         * animation/WebAnimation.cpp:
2419         (WebCore::WebAnimation::create):
2420         (WebCore::WebAnimation::~WebAnimation):
2421         (WebCore::WebAnimation::description):
2422         * animation/WebAnimation.h:
2423         * testing/Internals.cpp:
2424         (WebCore::Internals::timelineDescription):
2425         * testing/Internals.h:
2426         * testing/Internals.idl:
2427
2428 2017-10-21  Zalan Bujtas  <zalan@apple.com>
2429
2430         [FrameView::layout cleanup] Drop allowSubtree parameter
2431         https://bugs.webkit.org/show_bug.cgi?id=178623
2432         <rdar://problem/35111012>
2433
2434         Reviewed by Sam Weinig.
2435
2436         This flag is only set through ::forceLayout(). Let's just convert the subtree layout
2437         to full layout right before calling ::layout().
2438
2439         No change in functionality.
2440
2441         * page/FrameView.cpp:
2442         (WebCore::FrameView::handleLayoutWithFrameFlatteningIfNeeded):
2443         (WebCore::FrameView::layout):
2444         (WebCore::FrameView::startLayoutAtMainFrameViewIfNeeded):
2445         (WebCore::FrameView::forceLayout):
2446         * page/FrameView.h:
2447
2448 2017-10-21  Joseph Pecoraro  <pecoraro@apple.com>
2449
2450         Web Inspector: Remove unused Console.setMonitoringXHREnabled
2451         https://bugs.webkit.org/show_bug.cgi?id=178617
2452
2453         Reviewed by Sam Weinig.
2454
2455         * inspector/InspectorInstrumentation.cpp:
2456         (WebCore::InspectorInstrumentation::didFinishXHRLoadingImpl):
2457         * inspector/InspectorInstrumentation.h:
2458         (WebCore::InspectorInstrumentation::didFinishXHRLoading):
2459         * inspector/WebConsoleAgent.cpp:
2460         (WebCore::WebConsoleAgent::setMonitoringXHREnabled): Deleted.
2461         (WebCore::WebConsoleAgent::didFinishXHRLoading): Deleted.
2462         * inspector/WebConsoleAgent.h:
2463         Remove XHR monitoring code.
2464
2465         * xml/XMLHttpRequest.h:
2466         * xml/XMLHttpRequest.cpp:
2467         (WebCore::XMLHttpRequest::send):
2468         (WebCore::XMLHttpRequest::didFinishLoading):
2469         (WebCore::XMLHttpRequest::setLastSendLineAndColumnNumber): Deleted.
2470         * xml/XMLHttpRequest.idl:
2471         Remove now unused state on XHR and ExecState requirement for send().
2472
2473 2017-10-21  Dean Jackson  <dino@apple.com>
2474
2475         createImageBitmap with basic HTMLImageElement
2476         https://bugs.webkit.org/show_bug.cgi?id=178619
2477         <rdar://problem/35104118>
2478
2479         Reviewed by Antoine Quint.
2480
2481         Implement the basic infrastructure for creating
2482         an ImageBitmap from an HTMLImageElement.
2483
2484         Test: http/wpt/2dcontext/imagebitmap/createImageBitmap.html
2485
2486         * html/ImageBitmap.cpp:
2487         (WebCore::ImageBitmap::createPromise): Create the image buffer
2488         and draw the image into its backing store.
2489         * html/ImageBitmap.h:
2490
2491 2017-10-21  Antoine Quint  <graouts@apple.com>
2492
2493         [Web Animations] Add bindings to unified sources
2494         https://bugs.webkit.org/show_bug.cgi?id=178620
2495
2496         Reviewed by Dean Jackson.
2497
2498         Removing the Web Animations bindings from the WebCore target and adding them to the unified sources list instead.
2499
2500         * Sources.txt:
2501         * WebCore.xcodeproj/project.pbxproj:
2502
2503 2017-10-21  Tim Horton  <timothy_horton@apple.com>
2504
2505         Fix the Mac CMake build
2506
2507         * PlatformMac.cmake:
2508
2509 2017-10-21  Antti Koivisto  <antti@apple.com>
2510
2511         Support ::before/::after pseudo elements with display:contents
2512         https://bugs.webkit.org/show_bug.cgi?id=178584
2513
2514         Reviewed by Ryosuke Niwa.
2515
2516         This is cases like
2517
2518         ::before { display:contents; content:'foo' }
2519
2520         * css/StyleResolver.cpp:
2521         (WebCore::StyleResolver::adjustDisplayContentsStyle): Added.
2522
2523             Allow display:contents on pseudo elements.
2524             Factor into function.
2525
2526         (WebCore::StyleResolver::adjustRenderStyle):
2527         * dom/PseudoElement.h:
2528
2529             Add a weak vector of content renderers.
2530
2531         * style/RenderTreePosition.h:
2532         (WebCore::RenderTreePosition::moveToLastChild):
2533
2534             Add a way to set a valid render tree position without a node.
2535
2536         * style/RenderTreeUpdaterGeneratedContent.cpp:
2537         (WebCore::createContentRenderers):
2538
2539             Take RenderTreePosition.
2540
2541         (WebCore::updateStyleForContentRenderers):
2542
2543             Update based on the content renderer vector instead of doing a tree walk.
2544
2545         (WebCore::removeAndDestroyContentRenderers):
2546
2547             Helper for destroying content renderers.
2548
2549         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
2550
2551             In the normal case create a render tree position for the pseudo element renderer and
2552             use RenderTreePosition::moveToLastChild to make it a valid position. (The existing
2553             RenderTreePosition interface didn't have way to move to positions in anonymous boxes)
2554
2555             In the case of a non box generating display:contents pseudo element, use the current
2556             render tree position instead.
2557
2558             Ensure that pseudo element renderers are destroyed before creating the new ones since in
2559             display:contents case they are not descendants of the pseudo renderer and don't get cleared
2560             automatically.
2561
2562 2017-10-20  Zalan Bujtas  <zalan@apple.com>
2563
2564         [FrameView::layout cleanup] Use SetForScope to ensure layout state correctness
2565         https://bugs.webkit.org/show_bug.cgi?id=178604
2566         <rdar://problem/35101890>
2567
2568         Reviewed by Simon Fraser.
2569
2570         SetForScope guarantees state correctness even with nested layouts. This is a lot less
2571         error prone than resetting the state value after each potential recursive call.
2572
2573         Covered by existing tests.
2574
2575         * page/FrameView.cpp:
2576         (WebCore::FrameView::handleDeferredScrollbarsUpdateAfterDirectionChange): This layout state does
2577         not look too useful.
2578         (WebCore::FrameView::layout):
2579         * page/FrameView.h: While performPostLayoutTasks() is somewhat special since it can either be sync or async,
2580         so painting should be allowed in both cases.
2581
2582 2017-10-20  Said Abou-Hallawa  <sabouhallawa@apple.com>
2583
2584         SVGPathElement should cache the built-up Path of its non animating pathByteStream()
2585         https://bugs.webkit.org/show_bug.cgi?id=178248
2586
2587         Reviewed by Simon Fraser.
2588
2589         Instead of creating a Path object from the non animating pathByteStream()
2590         every time we need to updatePathFromPathElement(), the Path object can be
2591         cached once it is created and used for later calls.
2592
2593         * html/canvas/Path2D.h: buildPathFromString() now returns a Path.
2594
2595         * platform/graphics/Path.h:
2596         * platform/graphics/cairo/PathCairo.cpp:
2597         (WebCore::Path::Path):
2598         (WebCore::Path::operator=):
2599         * platform/graphics/cg/PathCG.cpp:
2600         (WebCore::Path::Path):
2601         (WebCore::Path::operator=):
2602         * platform/graphics/win/PathDirect2D.cpp:
2603         (WebCore::Path::Path):
2604         (WebCore::Path::operator=):
2605         Define the move constructor and the move assignment operator for the the
2606         Path class so a statement like "Path path = buildPathFromString()" won't 
2607         go through the copy constructor and the copy assignment operator.
2608
2609         * rendering/style/BasicShapes.cpp:
2610         (WebCore::SVGPathTranslatedByteStream::path const):
2611         * rendering/svg/RenderSVGResourceClipper.cpp:
2612         (WebCore::RenderSVGResourceClipper::pathOnlyClipping):
2613         * rendering/svg/RenderSVGShape.cpp:
2614         (WebCore::RenderSVGShape::updateShapeFromElement):
2615         * rendering/svg/RenderSVGTextPath.cpp:
2616         (WebCore::RenderSVGTextPath::layoutPath const):
2617         * rendering/svg/SVGPathData.cpp:
2618         (WebCore::pathFromCircleElement):
2619         (WebCore::pathFromEllipseElement):
2620         (WebCore::pathFromLineElement):
2621         (WebCore::pathFromPathElement):
2622         (WebCore::pathFromPolygonElement):
2623         (WebCore::pathFromPolylineElement):
2624         (WebCore::pathFromRectElement):
2625         (WebCore::pathFromGraphicsElement):
2626         (WebCore::updatePathFromCircleElement): Deleted.
2627         (WebCore::updatePathFromEllipseElement): Deleted.
2628         (WebCore::updatePathFromLineElement): Deleted.
2629         (WebCore::updatePathFromPathElement): Deleted.
2630         (WebCore::updatePathFromPolygonElement): Deleted.
2631         (WebCore::updatePathFromPolylineElement): Deleted.
2632         (WebCore::updatePathFromRectElement): Deleted.
2633         (WebCore::updatePathFromGraphicsElement): Deleted.
2634         * rendering/svg/SVGPathData.h:
2635         * svg/SVGAnimateMotionElement.cpp:
2636         (WebCore::SVGAnimateMotionElement::parseAttribute):
2637         (WebCore::SVGAnimateMotionElement::updateAnimationPath):
2638         * svg/SVGGraphicsElement.cpp:
2639         (WebCore::SVGGraphicsElement::toClipPath):
2640         * svg/SVGGraphicsElement.h:
2641         Rename updatePathFromElement() to pathFromGraphicsElement().
2642
2643         * svg/SVGPathElement.cpp:
2644         (WebCore::SVGPathElement::parseAttribute): Clear the cache when
2645         m_pathByteStream changes.
2646         (WebCore::SVGPathElement::pathForByteStream const): Caches the m_cachedPath
2647         if it is null.
2648         (WebCore::SVGPathElement::pathSegListChanged): Clear the cache when
2649         m_pathByteStream changes.
2650
2651         * svg/SVGPathElement.h:
2652         * svg/SVGPathUtilities.cpp:
2653         (WebCore::buildPathFromString):
2654         (WebCore::buildPathFromByteStream):
2655         * svg/SVGPathUtilities.h:
2656         Make thes buildPathFromString() and buildPathFromByteStream() return Paths.
2657
2658         * svg/SVGUseElement.cpp:
2659         (WebCore::SVGUseElement::toClipPath):
2660         * svg/SVGUseElement.h:
2661         Make these toClipPath() return Path.
2662
2663 2017-10-20  Ryosuke Niwa  <rniwa@webkit.org>
2664
2665         Rename insertedInto and removedFrom to insertedIntoAncestor and removedFromAncestor
2666         https://bugs.webkit.org/show_bug.cgi?id=178605
2667
2668         Reviewed by Andy Estes.
2669
2670         Renamed insertedInto and removedFrom to insertedIntoAncestor and removedFromAncestor respectively
2671         to make it clear that these functions can be called even when node's immediate parent didn't change.
2672
2673         * dom/ContainerNodeAlgorithms.cpp:
2674         (WebCore::notifyNodeInsertedIntoDocument):
2675         (WebCore::notifyNodeInsertedIntoTree):
2676         (WebCore::notifyNodeRemovedFromDocument):
2677         (WebCore::notifyNodeRemovedFromTree):
2678         (WebCore::notifyChildNodeRemoved):
2679         * dom/ContainerNodeAlgorithms.h:
2680         * dom/Element.cpp:
2681         (WebCore::Element::insertedIntoAncestor): Renamed from insertedInto.
2682         (WebCore::Element::removedFromAncestor): Renamed from removedFrom.
2683         * dom/Element.h:
2684         * dom/Node.cpp:
2685         (WebCore::Node::insertedIntoAncestor): 
2686         (WebCore::Node::removedFromAncestor):
2687         (WebCore::Node::removedFrom): Deleted.
2688         * dom/Node.h:
2689         * dom/ProcessingInstruction.cpp:
2690         (WebCore::ProcessingInstruction::insertedIntoAncestor): Renamed from insertedInto.
2691         (WebCore::ProcessingInstruction::removedFromAncestor): Renamed from removedFrom.
2692         * dom/ProcessingInstruction.h:
2693         * dom/ScriptElement.h:
2694         (WebCore::ScriptElement::insertedIntoAncestor const): Renamed from insertedInto.
2695         * dom/ShadowRoot.cpp:
2696         (WebCore::ShadowRoot::insertedIntoAncestor): Renamed from insertedInto.
2697         (WebCore::ShadowRoot::removedFromAncestor): Renamed from removedFrom.
2698         * dom/ShadowRoot.h:
2699         * html/FormAssociatedElement.cpp:
2700         (WebCore::FormAssociatedElement::insertedIntoAncestor): Renamed from insertedInto.
2701         (WebCore::FormAssociatedElement::removedFromAncestor): Renamed from removedFrom.
2702         * html/FormAssociatedElement.h:
2703         * html/HTMLBaseElement.cpp:
2704         (WebCore::HTMLBaseElement::insertedIntoAncestor): Renamed from insertedInto.
2705         (WebCore::HTMLBaseElement::removedFromAncestor): Renamed from removedFrom.
2706         * html/HTMLBaseElement.h:
2707         * html/HTMLBodyElement.cpp:
2708         (WebCore::HTMLBodyElement::insertedIntoAncestor): Renamed from insertedInto.
2709         * html/HTMLBodyElement.h:
2710         * html/HTMLFormControlElement.cpp:
2711         (WebCore::HTMLFormControlElement::insertedIntoAncestor): Renamed from insertedInto.
2712         (WebCore::HTMLFormControlElement::removedFromAncestor): Renamed from removedFrom.
2713         * html/HTMLFormControlElement.h:
2714         * html/HTMLFormControlElementWithState.cpp:
2715         (WebCore::HTMLFormControlElementWithState::insertedIntoAncestor): Renamed from insertedInto.
2716         (WebCore::HTMLFormControlElementWithState::removedFromAncestor): Renamed from removedFrom.
2717         * html/HTMLFormControlElementWithState.h:
2718         * html/HTMLFormElement.cpp:
2719         (WebCore::HTMLFormElement::insertedIntoAncestor): Renamed from insertedInto.
2720         (WebCore::HTMLFormElement::removedFromAncestor): Renamed from removedFrom.
2721         * html/HTMLFormElement.h:
2722         * html/HTMLFrameElementBase.cpp:
2723         (WebCore::HTMLFrameElementBase::insertedIntoAncestor): Renamed from insertedInto.
2724         * html/HTMLFrameElementBase.h:
2725         * html/HTMLFrameSetElement.cpp:
2726         (WebCore::HTMLFrameSetElement::insertedIntoAncestor): Renamed from insertedInto.
2727         (WebCore::HTMLFrameSetElement::removedFromAncestor): Renamed from removedFrom.
2728         * html/HTMLFrameSetElement.h:
2729         * html/HTMLImageElement.cpp:
2730         (WebCore::HTMLImageElement::insertedIntoAncestor): Renamed from insertedInto.
2731         (WebCore::HTMLImageElement::removedFromAncestor): Renamed from removedFrom.
2732         * html/HTMLImageElement.h:
2733         * html/HTMLInputElement.cpp:
2734         (WebCore::HTMLInputElement::insertedIntoAncestor): Renamed from insertedInto.
2735         (WebCore::HTMLInputElement::removedFromAncestor): Renamed from removedFrom.
2736         * html/HTMLInputElement.h:
2737         * html/HTMLLinkElement.cpp:
2738         (WebCore::HTMLLinkElement::insertedIntoAncestor): Renamed from insertedInto.
2739         (WebCore::HTMLLinkElement::removedFromAncestor): Renamed from removedFrom.
2740         * html/HTMLLinkElement.h:
2741         * html/HTMLMapElement.cpp:
2742         (WebCore::HTMLMapElement::insertedIntoAncestor): Renamed from insertedInto.
2743         (WebCore::HTMLMapElement::removedFromAncestor): Renamed from removedFrom.
2744         * html/HTMLMapElement.h:
2745         * html/HTMLMediaElement.cpp:
2746         (WebCore::HTMLMediaElement::insertedIntoAncestor): Renamed from insertedInto.
2747         (WebCore::HTMLMediaElement::removedFromAncestor): Renamed from removedFrom.
2748         * html/HTMLMediaElement.h:
2749         * html/HTMLMetaElement.cpp:
2750         (WebCore::HTMLMetaElement::insertedIntoAncestor): Renamed from insertedInto.
2751         * html/HTMLMetaElement.h:
2752         * html/HTMLObjectElement.cpp:
2753         (WebCore::HTMLObjectElement::insertedIntoAncestor): Renamed from insertedInto.
2754         (WebCore::HTMLObjectElement::removedFromAncestor): Renamed from removedFrom.
2755         * html/HTMLObjectElement.h:
2756         * html/HTMLOptionElement.cpp:
2757         (WebCore::HTMLOptionElement::insertedIntoAncestor): Renamed from insertedInto.
2758         * html/HTMLOptionElement.h:
2759         * html/HTMLScriptElement.cpp:
2760         (WebCore::HTMLScriptElement::insertedIntoAncestor): Renamed from insertedInto.
2761         * html/HTMLScriptElement.h:
2762         * html/HTMLSelectElement.cpp:
2763         (WebCore::HTMLSelectElement::insertedIntoAncestor): Renamed from insertedInto.
2764         * html/HTMLSelectElement.h:
2765         * html/HTMLSlotElement.cpp:
2766         (WebCore::HTMLSlotElement::insertedIntoAncestor): Renamed from insertedInto.
2767         (WebCore::HTMLSlotElement::removedFromAncestor): Renamed from removedFrom.
2768         * html/HTMLSlotElement.h:
2769         * html/HTMLSourceElement.cpp:
2770         (WebCore::HTMLSourceElement::insertedIntoAncestor): Renamed from insertedInto.
2771         (WebCore::HTMLSourceElement::removedFromAncestor): Renamed from removedFrom.
2772         * html/HTMLSourceElement.h:
2773         * html/HTMLStyleElement.cpp:
2774         (WebCore::HTMLStyleElement::insertedIntoAncestor): Renamed from insertedInto.
2775         (WebCore::HTMLStyleElement::removedFromAncestor): Renamed from removedFrom.
2776         * html/HTMLStyleElement.h:
2777         * html/HTMLTextFormControlElement.cpp:
2778         (WebCore::HTMLTextFormControlElement::insertedIntoAncestor): Renamed from insertedInto.
2779         * html/HTMLTextFormControlElement.h:
2780         * html/HTMLTitleElement.cpp:
2781         (WebCore::HTMLTitleElement::insertedIntoAncestor): Renamed from insertedInto.
2782         (WebCore::HTMLTitleElement::removedFromAncestor): Renamed from removedFrom.
2783         * html/HTMLTitleElement.h:
2784         * html/HTMLTrackElement.cpp:
2785         (WebCore::HTMLTrackElement::insertedIntoAncestor): Renamed from insertedInto.
2786         (WebCore::HTMLTrackElement::removedFromAncestor): Renamed from removedFrom.
2787         * html/HTMLTrackElement.h:
2788         * svg/SVGElement.cpp:
2789         (WebCore::SVGElement::removedFromAncestor): Renamed from removedFrom.
2790         (WebCore::SVGElement::insertedIntoAncestor): Renamed from insertedInto.
2791         (WebCore::SVGElement::updateRelativeLengthsInformation):
2792         * svg/SVGElement.h:
2793         * svg/SVGFEImageElement.cpp:
2794         (WebCore::SVGFEImageElement::insertedIntoAncestor): Renamed from insertedInto.
2795         (WebCore::SVGFEImageElement::removedFromAncestor): Renamed from removedFrom.
2796         * svg/SVGFEImageElement.h:
2797         * svg/SVGFontFaceElement.cpp:
2798         (WebCore::SVGFontFaceElement::insertedIntoAncestor): Renamed from insertedInto.
2799         (WebCore::SVGFontFaceElement::removedFromAncestor): Renamed from removedFrom.
2800         * svg/SVGFontFaceElement.h:
2801         * svg/SVGFontFaceUriElement.cpp:
2802         (WebCore::SVGFontFaceUriElement::insertedIntoAncestor): Renamed from insertedInto.
2803         * svg/SVGFontFaceUriElement.h:
2804         * svg/SVGImageElement.cpp:
2805         (WebCore::SVGImageElement::insertedIntoAncestor): Renamed from insertedInto.
2806         * svg/SVGImageElement.h:
2807         * svg/SVGMPathElement.cpp:
2808         (WebCore::SVGMPathElement::insertedIntoAncestor): Renamed from insertedInto.
2809         (WebCore::SVGMPathElement::removedFromAncestor): Renamed from removedFrom.
2810         * svg/SVGMPathElement.h:
2811         * svg/SVGPathElement.cpp:
2812         (WebCore::SVGPathElement::insertedIntoAncestor): Renamed from insertedInto.
2813         (WebCore::SVGPathElement::removedFromAncestor): Renamed from removedFrom.
2814         * svg/SVGPathElement.h:
2815         * svg/SVGSVGElement.cpp:
2816         (WebCore::SVGSVGElement::insertedIntoAncestor): Renamed from insertedInto.
2817         (WebCore::SVGSVGElement::removedFromAncestor): Renamed from removedFrom.
2818         * svg/SVGSVGElement.h:
2819         * svg/SVGScriptElement.cpp:
2820         (WebCore::SVGScriptElement::insertedIntoAncestor): Renamed from insertedInto.
2821         * svg/SVGScriptElement.h:
2822         * svg/SVGStyleElement.cpp:
2823         (WebCore::SVGStyleElement::insertedIntoAncestor): Renamed from insertedInto.
2824         (WebCore::SVGStyleElement::removedFromAncestor): Renamed from removedFrom.
2825         * svg/SVGStyleElement.h:
2826         * svg/SVGTRefElement.cpp:
2827         (WebCore::SVGTRefElement::buildPendingResource):
2828         (WebCore::SVGTRefElement::insertedIntoAncestor): Renamed from insertedInto.
2829         (WebCore::SVGTRefElement::removedFromAncestor): Renamed from removedFrom.
2830         * svg/SVGTRefElement.h:
2831         * svg/SVGTextPathElement.cpp:
2832         (WebCore::SVGTextPathElement::insertedIntoAncestor): Renamed from insertedInto.
2833         (WebCore::SVGTextPathElement::removedFromAncestor): Renamed from removedFrom.
2834         * svg/SVGTextPathElement.h:
2835         * svg/SVGTitleElement.cpp:
2836         (WebCore::SVGTitleElement::insertedIntoAncestor): Renamed from insertedInto.
2837         (WebCore::SVGTitleElement::removedFromAncestor): Renamed from removedFrom.
2838         * svg/SVGTitleElement.h:
2839         * svg/SVGUseElement.cpp:
2840         (WebCore::SVGUseElement::insertedIntoAncestor): Renamed from insertedInto.
2841         (WebCore::SVGUseElement::removedFromAncestor): Renamed from removedFrom.
2842         * svg/SVGUseElement.h:
2843         * svg/animation/SVGSMILElement.cpp:
2844         (WebCore::SVGSMILElement::insertedIntoAncestor): Renamed from insertedInto.
2845         (WebCore::SVGSMILElement::removedFromAncestor): Renamed from removedFrom.
2846         * svg/animation/SVGSMILElement.h:
2847
2848 2017-10-20  Ryosuke Niwa  <rniwa@webkit.org>
2849
2850         Fix conditions in HTMLSourceElement and HTMLTrackElement's insertedInto and removedFrom
2851         https://bugs.webkit.org/show_bug.cgi?id=178607
2852
2853         Reviewed by Eric Carlson.
2854
2855         Fixed the conditions in insertedInto and removedFrom of HTMLSourceElement and HTMLTrackElement to be
2856         semantically sensisble. Since these elements are only functional when their immediate parents are
2857         HTMLMediaElement and HTMLPictureElement, we have to check that its immediate parent changed, not when
2858         some of its ancestor had changed by insertion or removal.
2859
2860         * html/HTMLSourceElement.cpp:
2861         (WebCore::HTMLSourceElement::insertedInto):
2862         (WebCore::HTMLSourceElement::removedFrom):
2863         * html/HTMLTrackElement.cpp:
2864         (WebCore::HTMLTrackElement::insertedInto):
2865         (WebCore::HTMLTrackElement::removedFrom):
2866
2867 2017-10-20  Keith Miller  <keith_miller@apple.com>
2868
2869         Unreviewed, fix windows build.
2870
2871         * Sources.txt:
2872         * WebCore.xcodeproj/project.pbxproj:
2873
2874 2017-10-20  Daniel Bates  <dabates@apple.com>
2875
2876         Use "= default" for more default constructors and destructors in WebCore
2877         https://bugs.webkit.org/show_bug.cgi?id=178585
2878
2879         Reviewed by Alex Christensen.
2880
2881         Also remove some destructors that would be implicitly generated.
2882
2883         * Modules/applepay/PaymentMerchantSession.h:
2884         (WebCore::PaymentMerchantSession::~PaymentMerchantSession): Deleted.
2885         * platform/ControlStates.h:
2886         (WebCore::ControlStates::~ControlStates): Deleted.
2887         * platform/PlatformEvent.h:
2888         (WebCore::PlatformEvent::~PlatformEvent): Use default.
2889         * platform/PlatformStrategies.h:
2890         (WebCore::PlatformStrategies::PlatformStrategies): Ditto.
2891         * platform/image-decoders/gif/GIFImageReader.h:
2892         (GIFFrameContext::GIFFrameContext):
2893         (GIFFrameContext::~GIFFrameContext): Deleted.
2894         (GIFImageReader::~GIFImageReader): Deleted.
2895         * rendering/RenderBlockFlow.h:
2896         (WebCore::RenderBlockFlow::RenderBlockFlowRareData::~RenderBlockFlowRareData): Deleted.
2897
2898 2017-10-20  Zalan Bujtas  <zalan@apple.com>
2899
2900         [FrameView::layout cleanup] Scheduling layout should be disabled for FrameView::layout
2901         https://bugs.webkit.org/show_bug.cgi?id=178562
2902         <rdar://problem/35089015>
2903
2904         Reviewed by Simon Fraser.
2905
2906         This patch extends the scope of m_layoutSchedulingEnabled. Now layout scheduling is disabled for the entire FrameView::layout(). 
2907         A scheduled layout at the end of FrameView::layout would indicated dirty tree (which is against FrameView::layout's contract).
2908
2909         Covered by existing tests.
2910
2911         * page/FrameView.cpp:
2912         (WebCore::FrameView::layout):
2913
2914 2017-10-20  Said Abou-Hallawa  <sabouhallawa@apple.com>
2915
2916         When destroying a resource, register "only" the clients who are losing their resource as having pending resources
2917         https://bugs.webkit.org/show_bug.cgi?id=178567
2918         <rdar://problem/35064781>
2919
2920         Reviewed by Simon Fraser.
2921
2922         SVGResources::resourceDestroyed() will return a bool indicating whether 
2923         it had a reference to the destroyed resource or not. If it returns true
2924         SVGResourcesCache::resourceDestroyed() will register the client Element
2925         as having pending resources.
2926
2927         * rendering/svg/SVGResources.cpp:
2928         (WebCore::paintingResourceFromSVGPaint):
2929         (WebCore::SVGResources::removeClientFromCache const):
2930         (WebCore::SVGResources::resourceDestroyed):
2931         (WebCore::SVGResources::buildSetOfResources):
2932         (WebCore::SVGResources::resetClipper):
2933         (WebCore::SVGResources::resetFilter):
2934         (WebCore::SVGResources::resetMarkerStart):
2935         (WebCore::SVGResources::resetMarkerMid):
2936         (WebCore::SVGResources::resetMarkerEnd):
2937         (WebCore::SVGResources::resetMasker):
2938         (WebCore::SVGResources::resetFill):
2939         (WebCore::SVGResources::resetStroke):
2940         (WebCore::SVGResources::resetLinkedResource):
2941         * rendering/svg/SVGResources.h:
2942         (WebCore::SVGResources::isEmpty const):
2943         (WebCore::SVGResources::ClipperFilterMaskerData::ClipperFilterMaskerData): Deleted.
2944         (WebCore::SVGResources::MarkerData::MarkerData): Deleted.
2945         (WebCore::SVGResources::FillStrokeData::FillStrokeData): Deleted.
2946         * rendering/svg/SVGResourcesCache.cpp:
2947         (WebCore::SVGResourcesCache::resourceDestroyed):
2948
2949 2017-10-20  Ryosuke Niwa  <rniwa@webkit.org>
2950
2951         Unify the node removal code in ContainerNode and expand the coverage of NoEventDispatchAssertion
2952         https://bugs.webkit.org/show_bug.cgi?id=178568
2953
2954         Reviewed by Antti Koivisto.
2955
2956         Consolidated the code to remove a child node in ContainerNode into removeAllChildrenWithScriptAssertion
2957         and removeNodeWithScriptAssertion to share code and make the semantics of when it becomes unsafe to run scripts.
2958
2959         Also renamed getChildNodes to collectChildNodes, and made it return NodeVector instead of taking an out argument.
2960
2961         No new tests since there should be no behavioral changes.
2962
2963         * dom/ContainerNode.cpp:
2964         (WebCore::ContainerNode::removeAllChildrenWithScriptAssertion): Added.
2965         (WebCore::ContainerNode::removeNodeWithScriptAssertion): Added.
2966         (WebCore::collectChildrenAndRemoveFromOldParent):
2967         (WebCore::ContainerNode::takeAllChildrenFrom): Deployed removeAllChildrenWithScriptAssertion.
2968         (WebCore::ContainerNode::notifyChildRemoved): Deleted. Merged into removeNodeWithScriptAssertion.
2969         (WebCore::willRemoveChild): Deleted. Ditto.
2970         (WebCore::willRemoveChildren): Deleted. Merged into removeAllChildrenWithScriptAssertion.
2971         (WebCore::ContainerNode::removeChild): Deployed removeNodeWithScriptAssertion.
2972         (WebCore::ContainerNode::parserRemoveChild): Ditto.
2973         (WebCore::ContainerNode::replaceAllChildren): Deployed removeAllChildrenWithScriptAssertion. Now removes the node
2974         outside executeNodeInsertionWithScriptAssertion but that's okay since executeNodeInsertionWithScriptAssertion
2975         doesn't execute any code with a side effect before invoking the callback.
2976         (WebCore::ContainerNode::removeChildren):
2977         (WebCore::dispatchChildRemovalEvents): Refactored to take Ref<Node>&.
2978         * dom/ContainerNode.h:
2979         (WebCore::collectChildNodes): Renamed from getChildNodes. Also removed the useless comment about NodeVector's
2980         initial size and instead prefer to webkit.org/b/80706 where the number 11 was picked.
2981         * editing/ApplyStyleCommand.cpp:
2982         (WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode):
2983         * editing/ReplaceNodeWithSpanCommand.cpp:
2984         (WebCore::swapInNodePreservingAttributesAndChildren):
2985         * svg/SVGUseElement.cpp:
2986         (WebCore::SVGUseElement::clearShadowTree): Added an assertion exception while tearing down the UA shadow tree.
2987
2988 2017-10-20  Youenn Fablet  <youenn@apple.com>
2989
2990         ResourceResponse should have a ServiceWorker source
2991         https://bugs.webkit.org/show_bug.cgi?id=178593
2992
2993         Reviewed by Alex Christensen.
2994
2995         Covered by updated tests.
2996
2997         Added ResourceResponse::Source::ServiceWorker.
2998         Added internals to get FetchResponse source.
2999
3000         * inspector/InspectorNetworkAgent.cpp:
3001         (WebCore::responseSource):
3002         * loader/ResourceLoader.cpp:
3003         (WebCore::logResourceResponseSource):
3004         * page/DiagnosticLoggingKeys.cpp:
3005         (WebCore::DiagnosticLoggingKeys::serviceWorkerKey):
3006         * page/DiagnosticLoggingKeys.h:
3007         * platform/network/ResourceResponseBase.h:
3008         * testing/Internals.cpp:
3009         (WebCore::responseSourceToString):
3010         (WebCore::Internals::fetchResponseSource):
3011         * testing/Internals.h:
3012         * testing/Internals.idl:
3013
3014 2017-10-20  Andy Estes  <aestes@apple.com>
3015
3016         Generated serializers do not properly handle optional interface attributes
3017         https://bugs.webkit.org/show_bug.cgi?id=178542
3018
3019         Reviewed by Sam Weinig.
3020
3021         * bindings/scripts/CodeGeneratorJS.pm:
3022         (GenerateSerializerDefinition):
3023         * bindings/scripts/test/JS/JSTestSerialization.cpp:
3024         (WebCore::JSTestSerialization::serialize):
3025
3026 2017-10-20  Antoine Quint  <graouts@apple.com>
3027
3028         [Web Animations] Provide basic timeline and animation interfaces
3029         https://bugs.webkit.org/show_bug.cgi?id=178526
3030
3031         Reviewed by Dean Jackson.
3032
3033         We're getting Web Animations work started by implementing a very minimal codebase which provides
3034         a DocumentTimeline class which has an instance created for each Document. The parent class,
3035         AnimationTimeline, allows for animations to be added and removed, and animations can be created
3036         using the Animation class, with an optional timeline as parameter.
3037
3038         Tests: webanimations/animation-creation-basic.html
3039                webanimations/document-timeline.html
3040
3041         * CMakeLists.txt:
3042         * Configurations/FeatureDefines.xcconfig:
3043         * DerivedSources.make:
3044         * PlatformWin.cmake:
3045         * WebCore.xcodeproj/project.pbxproj:
3046         * animation/AnimationTimeline.cpp: Added.
3047         (WebCore::AnimationTimeline::AnimationTimeline):
3048         (WebCore::AnimationTimeline::~AnimationTimeline):
3049         (WebCore::AnimationTimeline::addAnimation):
3050         (WebCore::AnimationTimeline::removeAnimation):
3051         * animation/AnimationTimeline.h: Added.
3052         (WebCore::AnimationTimeline::isDocumentTimeline const):
3053         (WebCore::AnimationTimeline::classType const):
3054         * animation/AnimationTimeline.idl: Added.
3055         * animation/DocumentTimeline.cpp: Added.
3056         (WebCore::DocumentTimeline::create):
3057         (WebCore::DocumentTimeline::DocumentTimeline):
3058         * animation/DocumentTimeline.h: Added.
3059         * animation/DocumentTimeline.idl: Added.
3060         * animation/WebAnimation.cpp: Added.
3061         (WebCore::WebAnimation::create):
3062         (WebCore::WebAnimation::WebAnimation):
3063         (WebCore::WebAnimation::~WebAnimation):
3064         * animation/WebAnimation.h: Added.
3065         * animation/WebAnimation.idl: Added.
3066         * bindings/js/JSAnimationTimelineCustom.cpp: Added.
3067         (WebCore::toJSNewlyCreated):
3068         (WebCore::toJS):
3069         * bindings/js/WebCoreBuiltinNames.h:
3070         * dom/Document.cpp:
3071         (WebCore::Document::timeline):
3072         * dom/Document.h:
3073         * dom/Document.idl:
3074         * page/RuntimeEnabledFeatures.h:
3075         (WebCore::RuntimeEnabledFeatures::webAnimationsEnabled const):
3076
3077 2017-10-20  Commit Queue  <commit-queue@webkit.org>
3078
3079         Unreviewed, rolling out r223744, r223750, and r223751.
3080         https://bugs.webkit.org/show_bug.cgi?id=178594
3081
3082         These caused consistent failures in test that existed and were
3083         added in the patches. (Requested by mlewis13 on #webkit).
3084
3085         Reverted changesets:
3086
3087         "[JSC] ScriptFetcher should be notified directly from module
3088         pipeline"
3089         https://bugs.webkit.org/show_bug.cgi?id=178340
3090         https://trac.webkit.org/changeset/223744
3091
3092         "Unreviewed, fix changed line number in test expect files"
3093         https://bugs.webkit.org/show_bug.cgi?id=178340
3094         https://trac.webkit.org/changeset/223750
3095
3096         "Unreviewed, follow up to reflect comments"
3097         https://bugs.webkit.org/show_bug.cgi?id=178340
3098         https://trac.webkit.org/changeset/223751
3099
3100 2017-10-20  Zalan Bujtas  <zalan@apple.com>
3101
3102         [FrameView::layout cleanup] Move can-enter-layout logic to a separate function
3103         https://bugs.webkit.org/show_bug.cgi?id=178546
3104         <rdar://problem/35083894>
3105
3106         Reviewed by Antti Koivisto.
3107
3108         No change in functionality.
3109
3110         * page/FrameView.cpp:
3111         (WebCore::FrameView::canPerformLayout const):
3112         (WebCore::FrameView::layout): We already assert on certain reentrancy conditions, loggig the reason
3113         does not seem to have high value.
3114         * page/FrameView.h:
3115
3116 2017-10-20  Dean Jackson  <dino@apple.com>
3117
3118         Add createImageBitmap to Window and Worker
3119         https://bugs.webkit.org/show_bug.cgi?id=178573
3120         <rdar://problem/35092692>
3121
3122         Reviewed by Sam Weinig.
3123
3124         Implement the createImageBitmap functions that are exposed on the Window
3125         and Worker objects.
3126
3127         Covered by the Web Platform Tests.
3128
3129         * html/ImageBitmap.cpp: Make sure to call suspendIfNeeded since this is
3130         an ActiveDOMObject.
3131         * html/ImageBitmap.h: Change the order of the classes in the Variant
3132         to match the order of definitions in the IDL.
3133         * page/DOMWindow.cpp:
3134         (WebCore::DOMWindow::createImageBitmap): Call ImageBitmap::createPromise.
3135         * page/DOMWindow.h:
3136         * page/WindowOrWorkerGlobalScope.idl: Add the createImageBitmap methods.
3137         * workers/WorkerGlobalScope.cpp:
3138         (WebCore::WorkerGlobalScope::createImageBitmap): Call ImageBitmap::createPromise.
3139         * workers/WorkerGlobalScope.h:
3140
3141 2017-10-20  Joanmarie Diggs  <jdiggs@igalia.com>
3142
3143         AX: [ATK] Events missing and state incorrect for aria-activedescendant
3144         https://bugs.webkit.org/show_bug.cgi?id=178523
3145
3146         Reviewed by Chris Fleizach.
3147
3148         When the aria-activedescendant of an element changes, emit object:state-changed:focused.
3149         When a focused element has a valid active descendant, do not expose the focused state on
3150         the element, but rather on the active descendant. Also expose the focusable state on the
3151         active descendant.
3152
3153         Tests: accessibility/gtk/aria-activedescendant-changed-notification.html
3154                accessibility/gtk/aria-activedescendant.html
3155
3156         * accessibility/AccessibilityObject.cpp:
3157         (WebCore::AccessibilityObject::isActiveDescendantOfFocusedContainer const):
3158         (WebCore::AccessibilityObject::ariaActiveDescendantReferencingElements const):
3159         * accessibility/AccessibilityObject.h:
3160         * accessibility/AccessibilityRenderObject.cpp:
3161         (WebCore::AccessibilityRenderObject::shouldNotifyActiveDescendant const):
3162         * accessibility/atk/AXObjectCacheAtk.cpp:
3163         (WebCore::AXObjectCache::postPlatformNotification):
3164         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
3165         (setAtkStateSetFromCoreObject):
3166
3167 2017-10-20  Ms2ger  <Ms2ger@igalia.com>
3168
3169         Add the MAX_CLIENT_WAIT_TIMEOUT_WEBGL constant to WebGL2RenderingContext.
3170         https://bugs.webkit.org/show_bug.cgi?id=178572
3171
3172         Reviewed by Žan Doberšek.
3173
3174         Test: fast/canvas/webgl/webgl2/constants.html
3175
3176         * html/canvas/WebGL2RenderingContext.idl:
3177
3178 2017-10-20  Miguel Gomez  <magomez@igalia.com>
3179
3180         [GTK][WPE] Fix review comments on WEBPImageDecoder
3181         https://bugs.webkit.org/show_bug.cgi?id=178080
3182
3183         Reviewed by Said Abou-Hallawa.
3184
3185         Properly free the demuxer in case of error, improve the code to detect the first
3186         required frame to decode, fix the usage of the DecodingStatus and some styling
3187         changes.
3188
3189         Covered by existent tests.
3190
3191         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
3192         (WebCore::webpFrameAtIndex):
3193         (WebCore::WEBPImageDecoder::findFirstRequiredFrameToDecode):
3194         (WebCore::WEBPImageDecoder::decode):
3195         (WebCore::WEBPImageDecoder::decodeFrame):
3196         (WebCore::WEBPImageDecoder::initFrameBuffer):
3197         (WebCore::WEBPImageDecoder::clearFrameBufferCache):
3198
3199 2017-10-20  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3200
3201         [Curl] Clean up old style code in old curl files.
3202         https://bugs.webkit.org/show_bug.cgi?id=178569
3203
3204         Reviewed by Ryosuke Niwa.
3205
3206         * platform/network/curl/AuthenticationChallenge.h:
3207         * platform/network/curl/CertificateInfo.h:
3208         * platform/network/curl/CookieJarCurl.h:
3209         * platform/network/curl/CurlCacheEntry.h:
3210         * platform/network/curl/CurlCacheManager.cpp:
3211         (WebCore::CurlCacheManager::singleton):
3212         (WebCore::CurlCacheManager::getInstance): Deleted.
3213         * platform/network/curl/CurlCacheManager.h:
3214         * platform/network/curl/CurlContext.cpp:
3215         (WebCore::CurlContext::singleton):
3216         * platform/network/curl/CurlContext.h:
3217         (WebCore::CurlContext::singleton): Deleted.
3218         * platform/network/curl/CurlJobManager.cpp:
3219         (WebCore::CurlJobManager::singleton):
3220         * platform/network/curl/CurlJobManager.h:
3221         (WebCore::CurlJobManager::singleton): Deleted.
3222         * platform/network/curl/CurlRequest.cpp:
3223         (WebCore::CurlRequest::setupTransfer):
3224         * platform/network/curl/CurlRequest.h:
3225         * platform/network/curl/CurlRequestDelegate.h:
3226         * platform/network/curl/CurlResponse.h:
3227         (WebCore::CurlResponse::isolatedCopy const):
3228         * platform/network/curl/CurlSSLHandle.h:
3229         * platform/network/curl/CurlSSLVerifier.h:
3230         * platform/network/curl/DownloadBundle.h:
3231         * platform/network/curl/MultipartHandle.h:
3232         * platform/network/curl/ResourceError.h:
3233         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
3234         (WebCore::ResourceHandleCurlDelegate::createCurlRequest):
3235         (WebCore::ResourceHandleCurlDelegate::curlDidReceiveResponse):
3236         (WebCore::ResourceHandleCurlDelegate::curlDidReceiveBuffer):
3237         (WebCore::ResourceHandleCurlDelegate::curlDidComplete):
3238         (WebCore::ResourceHandleCurlDelegate::curlDidFailWithError):
3239         * platform/network/curl/ResourceRequest.h:
3240         (WebCore::ResourceRequest::ResourceRequest):
3241         (WebCore::ResourceRequest::updateFromDelegatePreservingOldProperties):
3242         (WebCore::ResourceRequest::cfURLRequest const):
3243         (WebCore::ResourceRequest::httpPipeliningEnabled):
3244         (WebCore::ResourceRequest::setHTTPPipeliningEnabled):
3245         (WebCore::ResourceRequest::doUpdatePlatformRequest):
3246         (WebCore::ResourceRequest::doUpdateResourceRequest):
3247         (WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
3248         (WebCore::ResourceRequest::doUpdateResourceHTTPBody):
3249         (WebCore::ResourceRequest::doPlatformSetAsIsolatedCopy):
3250         * platform/network/curl/ResourceResponseCurl.cpp:
3251         (WebCore::ResourceResponse::isAppendableHeader):
3252         (WebCore::ResourceResponse::ResourceResponse):
3253
3254 2017-10-20  Frederic Wang  <fwang@igalia.com>
3255
3256         RenderLayerCompositor: Move implementation of simple methods into the header file.
3257         https://bugs.webkit.org/show_bug.cgi?id=178514
3258
3259         Reviewed by Darin Adler.
3260
3261         No new tests, behavior unchanged.
3262
3263 2017-10-19  Antti Koivisto  <antti@apple.com>
3264
3265         Support ::before/::after pseudo elements on elements with display:contents
3266         https://bugs.webkit.org/show_bug.cgi?id=178513
3267
3268         Reviewed by Ryosuke Niwa.
3269
3270         Add support for
3271
3272             div { display:contents }
3273             div::after { content:'foo' }
3274
3275         That is support non-box generating elements with generated content.
3276
3277         * style/RenderTreePosition.cpp:
3278         (WebCore::RenderTreePosition::nextSiblingRenderer const):
3279
3280             Implement full pseudo-inclusive traversal starting from any element (including pseudo)
3281             to locate the next rendering sibling. In case of display:content this may need to look
3282             into descendants.
3283
3284         * style/RenderTreeUpdater.cpp:
3285         (WebCore::textRendererIsNeeded):
3286
3287             RenderTreePosition::nextSiblingRenderer can no longer be called with a node that already has a renderer.
3288             Maintain the existing behavior.
3289
3290         * style/RenderTreeUpdaterGeneratedContent.cpp:
3291         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
3292         (WebCore::RenderTreeUpdater::GeneratedContent::needsPseudoElement):
3293
3294             Don't require for host to have a renderer.
3295
3296         * style/RenderTreeUpdaterGeneratedContent.h:
3297         * style/StyleTreeResolver.cpp:
3298         (WebCore::Style::TreeResolver::resolvePseudoStyle):
3299
3300 2017-10-20  Keith Miller  <keith_miller@apple.com>
3301
3302         Move common bindings files to unified sources
3303         https://bugs.webkit.org/show_bug.cgi?id=178561
3304
3305         Rubber-stamped by Ryosuke Niwa.
3306
3307         This patch moves most of the common bindings files to unified sources.
3308
3309         Additionally, it adds a change to make_names to unique a struct
3310         name that caused name conflicts that I missed when I made the
3311         source changes before.
3312
3313         Lastly, add missing reference to WebCoreJSBuiltins.cpp in CMake build.
3314
3315         No new behavior no tests.
3316
3317         * CMakeLists.txt:
3318         * Sources.txt:
3319         * WebCore.xcodeproj/project.pbxproj:
3320         * dom/make_names.pl:
3321         (printFactoryCppFile):
3322
3323 2017-10-20  Saam Barati  <sbarati@apple.com>
3324
3325         Optimize accesses to how we get the direct prototype
3326         https://bugs.webkit.org/show_bug.cgi?id=178548
3327
3328         Reviewed by Yusuke Suzuki.
3329
3330         No new tests: no functionality change.
3331
3332         * bindings/js/JSDOMAbstractOperations.h:
3333         (WebCore::isVisibleNamedProperty):
3334         (WebCore::accessVisibleNamedProperty):
3335         * bindings/js/JSDOMWindowBase.cpp:
3336         (WebCore::toJSDOMWindow):
3337         * bindings/js/JSDOMWindowProperties.cpp:
3338         (WebCore::JSDOMWindowProperties::getOwnPropertySlot):
3339         * bindings/js/JSPluginElementFunctions.cpp:
3340         (WebCore::pluginElementCustomGetOwnPropertySlot):
3341         * bindings/js/WorkerScriptController.cpp:
3342         (WebCore::WorkerScriptController::initScript):
3343         * bindings/scripts/CodeGeneratorJS.pm:
3344         (GeneratePut):
3345         (GeneratePutByIndex):
3346         (GenerateConstructorHelperMethods):
3347         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
3348         (WebCore::JSTestGlobalObjectConstructor::initializeProperties):
3349         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
3350         (WebCore::JSTestNamedAndIndexedSetterNoIdentifier::put):
3351         (WebCore::JSTestNamedAndIndexedSetterNoIdentifier::putByIndex):
3352         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
3353         (WebCore::JSTestNamedAndIndexedSetterThrowingException::put):
3354         (WebCore::JSTestNamedAndIndexedSetterThrowingException::putByIndex):
3355         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
3356         (WebCore::JSTestNamedAndIndexedSetterWithIdentifier::put):
3357         (WebCore::JSTestNamedAndIndexedSetterWithIdentifier::putByIndex):
3358         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
3359         (WebCore::JSTestNamedSetterNoIdentifier::put):
3360         (WebCore::JSTestNamedSetterNoIdentifier::putByIndex):
3361         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
3362         (WebCore::JSTestNamedSetterThrowingException::put):
3363         (WebCore::JSTestNamedSetterThrowingException::putByIndex):
3364         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
3365         (WebCore::JSTestNamedSetterWithIdentifier::put):
3366         (WebCore::JSTestNamedSetterWithIdentifier::putByIndex):
3367         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
3368         (WebCore::JSTestNamedSetterWithIndexedGetter::put):
3369         (WebCore::JSTestNamedSetterWithIndexedGetter::putByIndex):
3370         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
3371         (WebCore::JSTestNamedSetterWithIndexedGetterAndSetter::put):
3372         (WebCore::JSTestNamedSetterWithIndexedGetterAndSetter::putByIndex):
3373         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
3374         (WebCore::JSTestNamedSetterWithUnforgableProperties::put):
3375         (WebCore::JSTestNamedSetterWithUnforgableProperties::putByIndex):
3376
3377 2017-10-20  Yusuke Suzuki  <utatane.tea@gmail.com>
3378
3379         [JSC] ScriptFetcher should be notified directly from module pipeline
3380         https://bugs.webkit.org/show_bug.cgi?id=178340
3381
3382         Reviewed by Sam Weinig.
3383
3384         No behavior change.
3385
3386         * bindings/js/JSMainThreadExecState.h:
3387         (WebCore::JSMainThreadExecState::loadModule):
3388         * bindings/js/ScriptController.cpp:
3389         (WebCore::ScriptController::loadModuleScriptInWorld):
3390         (WebCore::jsValueToModuleKey): Deleted.
3391         (WebCore::ScriptController::setupModuleScriptHandlers): Deleted.
3392         * bindings/js/ScriptController.h:
3393         * dom/LoadableModuleScript.cpp:
3394         (WebCore::LoadableModuleScript::notifyLoadFailed):
3395         * dom/LoadableModuleScript.h:
3396
3397 2017-10-19  Ms2ger  <Ms2ger@igalia.com>
3398
3399         Remove proprietary constants from WebGL2RenderingContext.
3400         https://bugs.webkit.org/show_bug.cgi?id=178511
3401
3402         Reviewed by Ryosuke Niwa.
3403
3404         As far as I can tell, these constants are not in the specification,
3405         and no other browser supports them.
3406
3407         No new tests: just code removal.
3408
3409         * html/canvas/WebGL2RenderingContext.idl:
3410
3411 2017-10-19  Zalan Bujtas  <zalan@apple.com>
3412
3413         [FrameView::layout cleanup] Move style update related logic to a separate function
3414         https://bugs.webkit.org/show_bug.cgi?id=178558
3415         <rdar://problem/35088218>
3416
3417         Reviewed by Simon Fraser.
3418
3419         No change in functionality.
3420
3421         * page/FrameView.cpp:
3422         (WebCore::FrameView::ensureStyleIsUpToDateForLayout):
3423         (WebCore::FrameView::layout):
3424         * page/FrameView.h:
3425
3426 2017-10-19  JF Bastien  <jfbastien@apple.com>
3427
3428         WebAssembly: no VM / JS version of everything but Instance
3429         https://bugs.webkit.org/show_bug.cgi?id=177473
3430
3431         Reviewed by Filip Pizlo, Saam Barati.
3432
3433         * ForwardingHeaders/wasm/WasmModule.h: Added. This used to be
3434         included in JSWebAssemblyModule.h.
3435         * bindings/js/SerializedScriptValue.cpp: Update postMessage code
3436         according to C++ API changes.
3437
3438 2017-10-19  Chris Dumez  <cdumez@apple.com>
3439
3440         SerializedScriptValue passed to postMessage() cannot be null
3441         https://bugs.webkit.org/show_bug.cgi?id=178550
3442
3443         Reviewed by Youenn Fablet.
3444
3445         SerializedScriptValue passed to postMessage() cannot be null. Therefore, we
3446         should use Ref<> type, not RefPtr<>.
3447
3448         * dom/MessagePortChannel.h:
3449         * dom/default/PlatformMessagePortChannel.cpp:
3450         (WebCore::MessagePortChannel::postMessageToRemote):
3451         * workers/WorkerGlobalScopeProxy.h:
3452         * workers/WorkerMessagingProxy.cpp:
3453         (WebCore::WorkerMessagingProxy::postMessageToWorkerObject):
3454         (WebCore::WorkerMessagingProxy::postMessageToWorkerGlobalScope):
3455         * workers/WorkerMessagingProxy.h:
3456         * workers/WorkerObjectProxy.h:
3457         * workers/service/context/ServiceWorkerThread.cpp:
3458
3459 2017-10-19  Daniel Bates  <dabates@apple.com>
3460
3461         Use "= default" to denote default constructor or destructor
3462         https://bugs.webkit.org/show_bug.cgi?id=178528
3463
3464         Rubber-stamped by Andy Estes.
3465
3466         * Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.h:
3467         * Modules/applepay/ApplePayError.cpp:
3468         * Modules/applepay/ApplePayPaymentAuthorizedEvent.cpp:
3469         * Modules/applepay/ApplePayPaymentMethodSelectedEvent.cpp:
3470         * Modules/applepay/ApplePaySession.cpp:
3471         * Modules/applepay/ApplePaySessionPaymentRequest.cpp:
3472         * Modules/applepay/ApplePayShippingContactSelectedEvent.cpp:
3473         * Modules/applepay/ApplePayShippingMethodSelectedEvent.cpp:
3474         * Modules/applepay/ApplePayValidateMerchantEvent.cpp:
3475         * Modules/applepay/Payment.h:
3476         * Modules/applepay/PaymentCoordinatorClient.h:
3477         * Modules/credentials/BasicCredential.cpp:
3478         * Modules/credentials/FederatedCredential.cpp:
3479         * Modules/credentials/NavigatorCredentials.cpp:
3480         * Modules/credentials/PasswordCredential.cpp:
3481         * Modules/encryptedmedia/CDMClient.h:
3482         * Modules/encryptedmedia/legacy/LegacyCDM.cpp:
3483         * Modules/encryptedmedia/legacy/LegacyCDM.h:
3484         * Modules/encryptedmedia/legacy/LegacyCDMPrivate.h:
3485         * Modules/encryptedmedia/legacy/LegacyCDMPrivateClearKey.h:
3486         * Modules/encryptedmedia/legacy/LegacyCDMPrivateMediaPlayer.h:
3487         * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp:
3488         * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.cpp:
3489         * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.cpp:
3490         * Modules/entriesapi/DOMFileSystem.cpp:
3491         * Modules/entriesapi/FileSystemDirectoryReader.cpp:
3492         * Modules/entriesapi/FileSystemEntry.cpp:
3493         * Modules/fetch/FetchLoaderClient.h:
3494         * Modules/gamepad/Gamepad.cpp:
3495         * Modules/gamepad/GamepadEvent.h:
3496         * Modules/gamepad/deprecated/Gamepad.cpp:
3497         [ truncated ]
3498
3499 2017-10-19  Sam Weinig  <sam@webkit.org>
3500
3501         [Bindings] Standardize on DOMPromise as the way to store passed in promises
3502         https://bugs.webkit.org/show_bug.cgi?id=178533
3503
3504         Reviewed by Youenn Fablet.
3505
3506         This standardizes on RefPtr<DOMPromise> as the canonical way to store a promise
3507         that has been passed in from JS. This does not change promises that start off in
3508         WebCore and are passed to JS; they remain using DOMPromiseDeferred and DOMPromiseProxy.
3509
3510         * Modules/paymentrequest/PaymentRequestUpdateEvent.cpp:
3511         * Modules/paymentrequest/PaymentRequestUpdateEvent.h:
3512         * dom/PromiseRejectionEvent.cpp:
3513         * dom/PromiseRejectionEvent.h:
3514         * dom/RejectedPromiseTracker.cpp:
3515
3516             Use a RefPtr<DOMPromise> rather than a JSPromise* to hold onto the promise.
3517
3518         * bindings/IDLTypes.h:
3519
3520             Use IDLWrapper to get better defaults, since DOMPromise is refcounted.
3521
3522         * bindings/js/JSDOMConvertPromise.h:
3523         (WebCore::Converter<IDLPromise<T>>::convert):
3524
3525             Switch default conversion to return a RefPtr<DOMPromise> rather than a JSPromise*
3526
3527         (WebCore::JSConverter<IDLPromise<T>>::convert):
3528
3529             Add support for converting from a DOMPromise to a JSValue.
3530
3531         * bindings/js/JSDOMPromise.cpp:
3532         * bindings/js/JSDOMPromise.h:
3533         (WebCore::DOMPromise::create): Deleted.
3534
3535             Remove now unused constructor.    
3536
3537         * workers/service/ExtendableEvent.cpp:
3538         (WebCore::ExtendableEvent::waitUntil):
3539         * workers/service/ExtendableEvent.h:
3540         * workers/service/ExtendableEvent.idl:
3541         * workers/service/FetchEvent.cpp:
3542         (WebCore::FetchEvent::respondWith):
3543         (WebCore::FetchEvent::promiseIsSettled):
3544         * workers/service/FetchEvent.h:
3545         * workers/service/FetchEvent.idl:
3546
3547             Address FIXMEs and remove need for passing an ExecState to ExtendableEvent
3548             and FetchEvent by using the new default conversion to DOMPromise.
3549
3550 2017-10-19  Sam Weinig  <sam@webkit.org>
3551
3552         [Settings] Move global settings into their own file
3553         https://bugs.webkit.org/show_bug.cgi?id=178512
3554
3555         Reviewed by Darin Adler.
3556
3557         Moves all global settigns out of SettingsBase and into the new DeprecatedGlobalSettings.
3558         It's called DeprecatedGlobalSettings to indicate that this is an anti-pattern we would
3559         like to discourage, as WebCore can operate in a process with multiple clients, each of
3560         which should be able to set their own preferences.
3561
3562         * WebCore.xcodeproj/project.pbxproj:
3563         * CMakeLists.txt:
3564
3565             Add new files.
3566         
3567         * page/DeprecatedGlobalSettings.cpp: Copied from Source/WebCore/page/SettingsBase.cpp.
3568         * page/DeprecatedGlobalSettings.h: Copied from Source/WebCore/page/SettingsBase.h.
3569         * page/SettingsBase.cpp:
3570         * page/SettingsBase.h:
3571         
3572             Move all global settings out of SettingsBase and into the new DeprecatedGlobalSettings.
3573         
3574         * Modules/mediastream/UserMediaRequest.cpp:
3575         * bindings/js/CommonVM.cpp:
3576         * css/CSSStyleDeclaration.cpp:
3577         * dom/DataTransfer.cpp:
3578         * dom/DataTransferItemList.cpp:
3579         * editing/Editor.cpp:
3580         * loader/ResourceLoadObserver.cpp:
3581         * page/FrameView.cpp:
3582         * page/PerformanceMonitor.cpp:
3583         * platform/ScrollbarTheme.cpp:
3584         (WebCore::ScrollbarTheme::theme):
3585         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
3586         * platform/graphics/MediaPlayer.cpp:
3587         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
3588         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3589         * platform/mac/NSScrollerImpDetails.mm:
3590         * platform/mock/ScrollbarThemeMock.cpp:
3591         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
3592         * platform/network/ios/NetworkStateNotifierIOS.mm:
3593         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
3594         * platform/win/MainThreadSharedTimerWin.cpp:
3595         * rendering/RenderLayer.cpp:
3596         * rendering/RenderListBox.cpp:
3597         * testing/InternalSettings.cpp:
3598         * testing/Internals.cpp:
3599
3600             Update users of global settings to reference the new class name.
3601
3602 2017-10-19  Youenn Fablet  <youenn@apple.com>
3603
3604         Add preliminary support for ServiceWorker Handle Fetch
3605         https://bugs.webkit.org/show_bug.cgi?id=178475
3606         <rdar://problem/35066424>
3607
3608         Reviewed by Chris Dumez.
3609
3610         Test: http/tests/workers/service/basic-fetch.https.html
3611
3612         Adding parameters to allow WebKit to do loading through Service Worker or through regular networking.
3613         A script context is now storing its selected service worker identifier. This should be fully implemented later on.
3614         This selected service worker identifier is passed to loading code as a ResourceLoaderOptions field.
3615         Service workers mode is also added as a ResourceLoaderOptions field so that the service worker can be bypassed.
3616
3617         * WebCore.xcodeproj/project.pbxproj:
3618         * dom/ScriptExecutionContext.h:
3619         (WebCore::ScriptExecutionContext::selectedServiceWorkerIdentifier const):
3620         (WebCore::ScriptExecutionContext::setSelectedServiceWorkerIdentifier):
3621         * loader/DocumentThreadableLoader.cpp:
3622         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
3623         * loader/FetchOptions.h:
3624         (WebCore::isPotentialNavigationOrSubresourceRequest):
3625         (WebCore::isNonSubresourceRequest):
3626         * loader/ResourceLoaderOptions.h:
3627         * loader/WorkerThreadableLoader.cpp:
3628         (WebCore::WorkerThreadableLoader::WorkerThreadableLoader):
3629         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
3630         * loader/WorkerThreadableLoader.h:
3631         * platform/network/ResourceRequestBase.h:
3632         * platform/network/ResourceResponseBase.h:
3633         * workers/WorkerThread.h:
3634         * workers/service/ServiceWorkerContainer.cpp:
3635         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
3636         * workers/service/context/SWContextManager.cpp: Removed.
3637         * workers/service/context/ServiceWorkerThread.h:
3638
3639 2017-10-19  Zalan Bujtas  <zalan@apple.com>
3640
3641         [FrameView::layout cleanup] Move post layout task scheduling logic to a separate function
3642         https://bugs.webkit.org/show_bug.cgi?id=178538
3643         <rdar://problem/35080743>
3644
3645         Reviewed by Simon Fraser.
3646
3647         Move and reorganize post layout task scheduling code.
3648         
3649         Covered by existing tests.
3650
3651         * page/FrameView.cpp:
3652         (WebCore::FrameView::layout):
3653         (WebCore::FrameView::runOrSchedulePostLayoutTasks):
3654         * page/FrameView.h:
3655
3656 2017-10-19  Zalan Bujtas  <zalan@apple.com>
3657
3658         [FrameView::layout cleanup] Move scrollbars setup logic to a separate function
3659         https://bugs.webkit.org/show_bug.cgi?id=178394
3660         <rdar://problem/35031066>
3661
3662         Reviewed by Antti Koivisto.
3663
3664         Decouple scrollbars setup and the unrelated first-layout logic.
3665         FIXME: find out why m_firstLayout depends on the subtree flag (I'd assume we issue full layout the very first time). 
3666
3667         Covered by existing test cases.
3668
3669         * page/FrameView.cpp:
3670         (WebCore::FrameView::adjustScrollbarsForLayout):
3671         (WebCore::FrameView::layout):
3672         * page/FrameView.h:
3673
3674 2017-10-19  Tim Horton  <timothy_horton@apple.com>
3675
3676         Expand r209943 to suppress paste during provisional navigation as well
3677         https://bugs.webkit.org/show_bug.cgi?id=178429
3678         <rdar://problem/33952830>
3679
3680         Reviewed by Dean Jackson.
3681
3682         No new tests; adjusted an existing test to cover this case.
3683
3684         * editing/Editor.cpp:
3685         (WebCore::Editor::canPaste const):
3686         Disable pasting during provisional navigation, like r209943 did for
3687         various other forms of text input.
3688
3689         (WebCore::Editor::shouldInsertText const):
3690         * dom/EventDispatcher.cpp:
3691         (WebCore::shouldSuppressEventDispatchInDOM):
3692         * loader/FrameLoader.cpp:
3693         (WebCore::FrameLoader::shouldSuppressTextInputFromEditing const):
3694         (WebCore::FrameLoader::shouldSuppressKeyboardInput const): Deleted.
3695         * loader/FrameLoader.h:
3696         * page/Settings.in:
3697         Rename the setting to be about editing-related text input, not "keyboard" input.
3698
3699         * editing/EditorCommand.cpp:
3700         (WebCore::allowExecutionWhenDisabled):
3701         (WebCore::doNotAllowExecutionWhenDisabled):
3702         (WebCore::allowExecutionWhenDisabledCopyCut):
3703         (WebCore::allowExecutionWhenDisabledPaste):
3704         (WebCore::createCommandMap):
3705         (WebCore::Editor::Command::allowExecutionWhenDisabled const):
3706         Completely disable execution of paste events when in no-text-input-from-editing mode.
3707         Otherwise, even though canPaste was false and we wouldn't do a default paste action,
3708         we would still dispatch the paste event to the DOM.
3709
3710 2017-10-19  Dean Jackson  <dino@apple.com>
3711
3712         Avoid duplicate multisample resolve before WebGL compositing
3713         https://bugs.webkit.org/show_bug.cgi?id=178537
3714         <rdar://problem/35080724>
3715
3716         Fix iOS build.
3717
3718         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
3719         (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
3720
3721 2017-10-19  Dean Jackson  <dino@apple.com>
3722
3723         Avoid duplicate multisample resolve before WebGL compositing
3724         https://bugs.webkit.org/show_bug.cgi?id=178537
3725         <rdar://problem/35080724>
3726
3727         Reviewed by Jer Noble.
3728
3729         Both endPaint and prepareTexture were doing the MSAA resolve
3730         into the renderbuffer, and being called on macOS before compositing.
3731         Without that step, endPaint became unnecessary on iOS so I renamed
3732         it presentRenderbuffer.
3733
3734         Covered by existing tests.
3735
3736         * platform/graphics/GraphicsContext3D.h:
3737         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
3738         (WebCore::GraphicsContext3D::presentRenderbuffer):
3739         (WebCore::GraphicsContext3D::endPaint): Deleted.
3740         * platform/graphics/cocoa/WebGLLayer.mm:
3741         (-[WebGLLayer display]):
3742
3743 2017-10-19  Andy Estes  <aestes@apple.com>
3744
3745         [Payment Request] Only process shipping options if shipping is requested, and throw an exception on duplicate shipping option IDs
3746         https://bugs.webkit.org/show_bug.cgi?id=178535
3747
3748         Reviewed by Alex Christensen.
3749
3750         Progresses four tests in web-platform-tests/payment-request/payment-request-constructor.https.html.
3751
3752         * Modules/paymentrequest/PaymentRequest.cpp:
3753         (WebCore::PaymentRequest::create):
3754
3755 2017-10-19  Daniel Bates  <dabates@apple.com>
3756
3757         Share logic in InlineTextBox to compute selection rect
3758         https://bugs.webkit.org/show_bug.cgi?id=178232
3759         <rdar://problem/34963452>
3760
3761         Reviewed by Zalan Bujtas.
3762
3763         Currently each paint routine in InlineTextBox duplicates similar code to compute the selection
3764         rect it will paint. This change consolidates all the duplication into localSelectionRectWithClampedPositions()
3765         and writes all of the paint operations, except for paintCompositionUnderline(), in terms of it.
3766         We will write paintCompositionUnderline() in terms of localSelectionRectWithClampedPositions()
3767         in a subsequent patch.
3768
3769         We also write localSelectionRect() in terms of localSelectionRectWithClampedPositions(). Ideally
3770         we would have one way to compute the selection rect. However, localSelectionRect() and paintDocumentMarker()
3771         currently expect the enclosing integral rectangle of the selection rectangle. The function
3772         paintDocumentMarker() needs the enclosing integral rectangle to avoid truncating the dot pattern
3773         drawn under marked words (e.g. a spelling error) on Cocoa platforms. With regards to localSelectionRect()
3774         we should look to have it return the actual selection rectangle. See <https://bugs.webkit.org/show_bug.cgi?id=138913>
3775         for more details.
3776
3777         * rendering/InlineTextBox.cpp:
3778         (WebCore::InlineTextBox::localSelectionRect const): Move logic in common with paintSelection() into
3779         localSelectionRectWithClampedPositions() and modified code to use it.
3780         (WebCore::InlineTextBox::localSelectionRectWithClampedPositions const): Added.
3781         (WebCore::InlineTextBox::paint): Store the local paint offset as a LayoutPoint as it is the canonical
3782         data type for representing an offset when painting. Pass the local paint offset instead of the analagous boxOrigin value.
3783         (WebCore::InlineTextBox::paintSelection): Write in terms of localSelectionRectWithClampedPositions().
3784         (WebCore::InlineTextBox::paintTextSubrangeBackground): Ditto.
3785         (WebCore::InlineTextBox::paintCompositionBackground): Ditto.
3786         (WebCore::InlineTextBox::paintTextMatchMarker): Ditto.
3787         (WebCore::InlineTextBox::paintDocumentMarker): Ditto.
3788         (WebCore::InlineTextBox::paintDocumentMarkers): Pass paint offset instead of the analogous boxOrigin value.
3789         * rendering/InlineTextBox.h:
3790
3791 2017-10-19  Daniel Bates  <dabates@apple.com>
3792
3793         Referrer policy should be inherited from creator
3794         https://bugs.webkit.org/show_bug.cgi?id=178403
3795         <rdar://problem/31546136>
3796
3797         Reviewed by Andy Estes.
3798
3799         As per section Browsing contexts of the the HTML standard, <https://html.spec.whatwg.org/multipage/browsers.html>
3800         (17 October 2017), the referrer policy of a document should initially be inherited from its
3801         creator.
3802
3803         Tests: http/tests/security/referrer-policy-nested-subframe.html
3804                http/tests/security/referrer-policy-nested-window-open.html
3805                http/tests/security/referrer-policy-subframe-window-open.html
3806                http/tests/security/referrer-policy-window-open-subframe.html
3807
3808         * dom/Document.cpp:
3809         (WebCore::Document::initSecurityContext): Ask the loader for the effective referrer policy.
3810         * loader/FrameLoader.cpp:
3811         (WebCore::FrameLoader::effectiveReferrerPolicy const): Added. Returns the referrer policy
3812         of the creator document. The creator document is document of the parent frame or the document
3813         of the opener for a subframe or child window, respectively. If we do not have a creator frame
3814         then we return the default referrer policy, non-referrer-when-downgrade, by <https://www.w3.org/TR/2017/CR-referrer-policy-20170126/#referrer-policy-empty-string>.
3815         * loader/FrameLoader.h:
3816
3817 2017-10-19  Zalan Bujtas  <zalan@apple.com>
3818
3819         [FrameView::layout cleanup] Do not reenter FrameView::performPostLayoutTasks
3820         https://bugs.webkit.org/show_bug.cgi?id=178518
3821         <rdar://problem/35075409>
3822
3823         Reviewed by Antti Koivisto.
3824
3825         This patch tightens existing reentrancy policy on performPostLayoutTasks.
3826
3827         Covered by existing test cases.
3828
3829         * page/FrameView.cpp:
3830         (WebCore::FrameView::FrameView):
3831         (WebCore::FrameView::reset):
3832         (WebCore::FrameView::layout):
3833         (WebCore::FrameView::performPostLayoutTasks):
3834         * page/FrameView.h:
3835
3836 2017-10-19  Chris Dumez  <cdumez@apple.com>
3837
3838         Unreviewed, revert r223650 as it caused crashes on the bots.
3839
3840         * WebCore.xcodeproj/project.pbxproj:
3841         * dom/ScriptExecutionContext.h:
3842         * loader/DocumentThreadableLoader.cpp:
3843         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
3844         * loader/FetchOptions.h:
3845         * loader/ResourceLoaderOptions.h:
3846         * loader/WorkerThreadableLoader.cpp:
3847         (WebCore::WorkerThreadableLoader::WorkerThreadableLoader):
3848         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
3849         * loader/WorkerThreadableLoader.h:
3850         * platform/network/ResourceRequestBase.h:
3851         * platform/network/ResourceResponseBase.h:
3852         * workers/WorkerThread.h:
3853         * workers/service/ServiceWorkerContainer.cpp:
3854         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
3855         * workers/service/context/SWContextManager.cpp: Copied from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h.
3856         (WebCore::SWContextManager::singleton):
3857         (WebCore::SWContextManager::SWContextManager):
3858         (WebCore::SWContextManager::startServiceWorkerContext):
3859         * workers/service/context/SWContextManager.h: Renamed from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h.
3860         * workers/service/context/ServiceWorkerThread.h:
3861
3862 2017-10-19  Zalan Bujtas  <zalan@apple.com>
3863
3864         [FrameView::layout cleanup] Replace m_nestedLayoutCount with isLayoutNested()
3865         https://bugs.webkit.org/show_bug.cgi?id=178503
3866         <rdar://problem/35066561>
3867
3868         Reviewed by Antti Koivisto.
3869
3870         Covered by existing tests.
3871
3872         * page/FrameView.cpp:
3873         (WebCore::FrameView::reset):
3874         (WebCore::FrameView::layout):
3875         (WebCore::FrameView::updateLayerPositionsAfterScrolling):
3876         (WebCore::FrameView::updateCompositingLayersAfterScrolling):
3877         (WebCore::FrameView::updateEmbeddedObjects):
3878         (WebCore::FrameView::flushPostLayoutTasksQueue):
3879         (WebCore::FrameView::performPostLayoutTasks):
3880         (WebCore::FrameView::startLayoutAtMainFrameViewIfNeeded):
3881         * page/FrameView.h:
3882
3883 2017-10-19  Antti Koivisto  <antti@apple.com>
3884
3885         Overlapping text on all CSS fonts specs
3886         https://bugs.webkit.org/show_bug.cgi?id=177585
3887         <rdar://problem/34704078>
3888
3889         Reviewed by Daniel Bates.
3890
3891         We were resetting StyleResolver::overrideDocumentElementStyle too early when resolving slot elements.
3892         This resulted in 'rem' units being miscomputed.
3893
3894         Reduction by Zalan.
3895
3896         Test: fast/html/details-line-height-overlap.html
3897
3898         * style/StyleTreeResolver.cpp:
3899         (WebCore::Style::TreeResolver::Scope::Scope):
3900         (WebCore::Style::TreeResolver::Scope::~Scope):
3901
3902             Only reset overrideDocumentElementStyle when destroying the scope.
3903
3904         (WebCore::Style::TreeResolver::pushScope):
3905         (WebCore::Style::TreeResolver::pushEnclosingScope):
3906         (WebCore::Style::TreeResolver::popScope):
3907
3908             A scope can show up multiple times in scope stack.
3909
3910         * style/StyleTreeResolver.h:
3911
3912 2017-10-19  Ryosuke Niwa  <rniwa@webkit.org>
3913
3914         Consolidate calls to insertedInto and expand the coverage of NoEventDispatchAssertion
3915         https://bugs.webkit.org/show_bug.cgi?id=178504
3916
3917         Reviewed by Antti Koivisto.
3918
3919         Consolidated calls to notifyChildNodeInserted, childrenChanged, didFinishInsertingNode, and
3920         dispatchChildInsertionEvents for inserting a node by executeNodeInsertionWithScriptAssertion,
3921         a new templatefunction which takes a closure to do the node insertion to make exactly when
3922         the script becomes runnable clear.
3923
3924         Added an exception to SVGTRefElement::updateReferencedText since this code mutates user agent
3925         shadow root during insertedInto, and turned ChildChangeSource into an enum class.
3926
3927         * dom/CharacterData.cpp:
3928         (WebCore::CharacterData::parserAppendData):
3929         (WebCore::CharacterData::setDataAndUpdate):
3930         * dom/ContainerNode.cpp:
3931         (WebCore::executeNodeInsertionWithScriptAssertion): Extracted.
3932         (WebCore::ContainerNode::takeAllChildrenFrom): Deployed executeNodeInsertionWithScriptAssertion.
3933         (WebCore::ContainerNode::insertBefore): Ditto.
3934         (WebCore::ContainerNode::changeForChildInsertion): Deleted.
3935         (WebCore::ContainerNode::notifyChildInserted): Deleted.
3936         (WebCore::ContainerNode::parserInsertBefore): Deployed executeNodeInsertionWithScriptAssertion. 
3937         (WebCore::ContainerNode::replaceChild): Ditto.
3938         (WebCore::ContainerNode::removeChild):
3939         (WebCore::ContainerNode::parserRemoveChild):
3940         (WebCore::ContainerNode::replaceAllChildren): Ditto.
3941         (WebCore::ContainerNode::removeChildren):
3942         (WebCore::ContainerNode::appendChildWithoutPreInsertionValidityCheck): Ditto.
3943         (WebCore::ContainerNode::parserAppendChild): Ditto.
3944         (WebCore::ContainerNode::childrenChanged):
3945         (WebCore::ContainerNode::updateTreeAfterInsertion): Deleted.
3946         * dom/ContainerNode.h:
3947         * dom/Element.cpp:
3948         (WebCore::Element::childrenChanged):
3949         * html/HTMLOutputElement.cpp:
3950         (WebCore::HTMLOutputElement::childrenChanged):
3951         * svg/SVGClipPathElement.cpp:
3952         (WebCore::SVGClipPathElement::childrenChanged):
3953         * svg/SVGElement.cpp:
3954         (WebCore::SVGElement::childrenChanged):
3955         * svg/SVGFELightElement.cpp:
3956         (WebCore::SVGFELightElement::childrenChanged):
3957         * svg/SVGFilterElement.cpp:
3958         (WebCore::SVGFilterElement::childrenChanged):
3959         * svg/SVGFilterPrimitiveStandardAttributes.cpp:
3960         (WebCore::SVGFilterPrimitiveStandardAttributes::childrenChanged):
3961         * svg/SVGGradientElement.cpp:
3962         (WebCore::SVGGradientElement::childrenChanged):
3963         * svg/SVGMarkerElement.cpp:
3964         (WebCore::SVGMarkerElement::childrenChanged):
3965         * svg/SVGMaskElement.cpp:
3966         (WebCore::SVGMaskElement::childrenChanged):
3967         * svg/SVGPatternElement.cpp:
3968         (WebCore::SVGPatternElement::childrenChanged):
3969         * svg/SVGTRefElement.cpp:
3970         (WebCore::SVGTRefElement::updateReferencedText): Allow DOM mutations inside the user agent shadow tree here.
3971
3972 2017-10-19  Ryosuke Niwa  <rniwa@webkit.org>
3973
3974         Add an argument indicating the type of removal to Node::removedFrom
3975         https://bugs.webkit.org/show_bug.cgi?id=178505
3976
3977         Reviewed by Antti Koivisto.
3978
3979         Like r223628, added RemovalType as the first argument to Node::removedFrom, which contains two booleans indicating
3980         whether the node just become disconnected from a document, and whether node's tree scope had changed or not.
3981
3982         These boolean flags simplifies the logic in removedFrom implementations, and are required to have a better
3983         guarantee about the correctness of node flags during calls to removedFrom. Right now, Node::isConnected() and
3984         Node::isInShadowTree() are both outdated until Node::removedFrom is called.
3985
3986         Also renamed the second argument of removedFrom to parentOfRemovedTree to make the semantics clear.
3987
3988         Note that in some implementations of removedFrom, we check whether isConnected() was true to decide whether
3989         the node had already been disconnected from a document prior to calls to this particular call of removedFrom.
3990         This extra check is no longer necessary since no node will be removed from a document without first being inserted
3991         completely somewhere after r223458.
3992
3993         No new tests since there should be no behavioral changes.
3994
3995         * dom/ContainerNodeAlgorithms.cpp:
3996         (WebCore::notifyNodeInsertedIntoDocument): Replaced RELEASE_ASSERT with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION.
3997         (WebCore::notifyNodeRemovedFromDocument): Replaced the check that the node had not been re-connected by scripts
3998         by a release assert now that we believe we've eliminated all causes of these unwanted DOM mutations in r223458.
3999         Also moved the code to call setCSSTarget to Element::removedFrom. This random call to setCSSTarget predates r114351,
4000         as well as r40475. It was originally introduced by r29311 into Node::removedFromDocument() ten years ago.
4001         (WebCore::notifyNodeRemovedFromTree): Moved NoEventDispatchAssertion to notifyChildNodeRemoved.
4002         (WebCore::notifyChildNodeRemoved): Added NoEventDispatchAssertion.
4003         * dom/ContainerNodeAlgorithms.h:
4004         * dom/Element.cpp:
4005         (WebCore::Element::removedFrom): Replaced the complicated code to detect when this element is removed from a document
4006         and its tree scope had changed by removalType.disconnectedFromDocument and removalType.treeScopeChanged.
4007         * dom/Element.h:
4008         * dom/Node.cpp:
4009         (WebCore::Node::removedFrom):
4010         * dom/Node.h: Replaced a long block of comments above insertedInto by two lines of concise comments now that
4011         the semantics of insertedInto and didFinishInsertingNode are more clear, and enforced by assertions.
4012         (WebCore::Node::RemovalType::RemovalType): Addedl
4013         * dom/ProcessingInstruction.cpp:
4014         (WebCore::ProcessingInstruction::removedFrom):
4015         * dom/ProcessingInstruction.h:
4016         * dom/ShadowRoot.cpp:
4017         (WebCore::ShadowRoot::removedFrom): The extra !isConnected() check is no longer needed. See the description above.
4018         * dom/ShadowRoot.h:
4019         * html/FormAssociatedElement.cpp:
4020         (WebCore::FormAssociatedElement::removedFrom):
4021         * html/FormAssociatedElement.h:
4022         * html/HTMLBaseElement.cpp:
4023         (WebCore::HTMLBaseElement::removedFrom):
4024         * html/HTMLBaseElement.h:
4025         * html/HTMLFormControlElement.cpp:
4026         (WebCore::HTMLFormControlElement::removedFrom):
4027         * html/HTMLFormControlElement.h:
4028         * html/HTMLFormControlElementWithState.cpp:
4029         (WebCore::HTMLFormControlElementWithState::removedFrom):
4030         * html/HTMLFormControlElementWithState.h:
4031         * html/HTMLFormElement.cpp:
4032         (WebCore::HTMLFormElement::removedFrom):