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