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