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