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