32ae44bbaa84a9be061cb4d879c636e28887d073
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-11-03  Devin Rousso  <webkit@devinrousso.com>
2
3         Web Inspector: Canvas2D Profiling: highlight expensive context commands in the captured command log
4         https://bugs.webkit.org/show_bug.cgi?id=178302
5         <rdar://problem/33158849>
6
7         Reviewed by Brian Burg.
8
9         No new tests, updated existing tests.
10
11         * inspector/InspectorCanvas.h:
12         * inspector/InspectorCanvas.cpp:
13         (WebCore::InspectorCanvas::recordAction):
14         (WebCore::InspectorCanvas::finalizeFrame):
15         (WebCore::InspectorCanvas::markNewFrame): Deleted.
16
17         * inspector/InspectorCanvasAgent.cpp:
18         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
19
20 2017-11-02  Maciej Stachowiak  <mjs@apple.com>
21
22         Don't try to guess plugin MIME type from a file extension in a URL (no observable effect)
23         https://bugs.webkit.org/show_bug.cgi?id=178333
24
25         Reviewed by Darin Adler.
26
27         No test cases because I could not find an observable behavior difference,
28         even after trying many different plugin loading scenarios.
29         
30         * html/HTMLPlugInImageElement.cpp:
31         (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot): loadedMIMEType --> serviceType
32         (WebCore::HTMLPlugInImageElement::restartSimilarPlugIns): ditto
33         (WebCore::HTMLPlugInImageElement::userDidClickSnapshot): ditto
34         (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn): ditto
35         * html/HTMLPlugInImageElement.h:
36         (WebCore::HTMLPlugInImageElement::loadedMimeType const): Deleted. This was the one call site
37         for mimeTypeFromURL, and is otherwise just a wrapper for SerciceType()
38         * platform/URL.cpp:
39         (WebCore::mimeTypeFromURL): Deleted. This was the only use of MIMETypeDatabase in URL.
40         * platform/URL.h: Removed declaration for mimeTypeFromURL.
41         * WebCore.order: Removed mimeTypeFromURL.
42
43 2017-11-02  Basuke Suzuki  <Basuke.Suzuki@sony.com>
44
45         [Curl] Fix cancellation process implementation
46         https://bugs.webkit.org/show_bug.cgi?id=179199
47
48         Reviewed by Alex Christensen.
49
50         * platform/network/curl/CurlRequest.cpp:
51         (WebCore::CurlRequest::cancel):
52         (WebCore::CurlRequest::willSendData):
53         (WebCore::CurlRequest::didReceiveHeader):
54         (WebCore::CurlRequest::didReceiveData):
55         (WebCore::CurlRequest::completeDidReceiveResponse):
56         (WebCore::CurlRequest::pausedStatusChanged):
57         * platform/network/curl/CurlRequest.h:
58         (WebCore::CurlRequest::isSyncRequest const):
59         (WebCore::CurlRequest::isCompletedOrCancelled const):
60         (WebCore::CurlRequest::needToInvokeDidCancelTransfer const):
61         (WebCore::CurlRequest::isSyncRequest): Deleted.
62
63 2017-11-02  Brady Eidson  <beidson@apple.com>
64
65         SW: Implement "Update Registration State" algorithm (unused for now)
66         https://bugs.webkit.org/show_bug.cgi?id=179186
67
68         Reviewed by Chris Dumez.
69
70         No new tests (No behavior change yet).
71
72         This algorithm is very simple, and this patch plumbs it through.
73         But it's not useful to start using this algorithm without "Update Worker State" also.
74         So to keep this patch small, it's unused for now. Will be used in the next patch.
75
76         * WebCore.xcodeproj/project.pbxproj:
77
78         * workers/service/ServiceWorkerContainer.cpp:
79         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
80
81         * workers/service/ServiceWorkerRegistration.cpp:
82         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
83         (WebCore::ServiceWorkerRegistration::~ServiceWorkerRegistration):
84         (WebCore::ServiceWorkerRegistration::updateStateFromServer):
85         * workers/service/ServiceWorkerRegistration.h:
86
87         * workers/service/ServiceWorkerTypes.h: Copied from Source/WebCore/workers/service/server/SWServerRegistration.cpp.
88
89         * workers/service/server/SWClientConnection.cpp:
90         (WebCore::SWClientConnection::addServiceWorkerRegistration):
91         (WebCore::SWClientConnection::removeServiceWorkerRegistration):
92         (WebCore::SWClientConnection::updateRegistrationState):
93         * workers/service/server/SWClientConnection.h:
94
95         * workers/service/server/SWServer.cpp:
96         (WebCore::SWServer::Connection::addServiceWorkerRegistrationInServer):
97         (WebCore::SWServer::Connection::removeServiceWorkerRegistrationInServer):
98         (WebCore::SWServer::addClientServiceWorkerRegistration):
99         (WebCore::SWServer::removeClientServiceWorkerRegistration):
100         * workers/service/server/SWServer.h:
101         (WebCore::SWServer::getConnection):
102
103         * workers/service/server/SWServerJobQueue.cpp:
104         (WebCore::SWServerJobQueue::runRegisterJob):
105
106         * workers/service/server/SWServerRegistration.cpp:
107         (WebCore::SWServerRegistration::SWServerRegistration):
108         (WebCore::SWServerRegistration::updateRegistrationState):
109         (WebCore::SWServerRegistration::addClientServiceWorkerRegistration):
110         (WebCore::SWServerRegistration::removeClientServiceWorkerRegistration):
111         * workers/service/server/SWServerRegistration.h:
112
113 2017-11-01  Ryosuke Niwa  <rniwa@webkit.org>
114
115         Assert that updateStyle and updateLayout are only called when it's safe to dispatch events
116         https://bugs.webkit.org/show_bug.cgi?id=179157
117         <rdar://problem/35144778>
118
119         Reviewed by Zalan Bujtas.
120
121         Added assertions to Document::updateStyleIfNeeded and Document::updateLayout that these functions are
122         only called when NoEventDispatchAssertion::isEventAllowedInMainThread() is true with two exceptions:
123         1. Inside SVGImage::draw which triggers a layout on a separate document.
124         2. While doing a nested layout for a frame flattening.
125
126         No new tests since there should be no behavioral changes.
127
128         * dom/ContainerNode.cpp:
129         (NoEventDispatchAssertion::DisableAssertionsInScope::s_existingCount): Deleted. This is now an instance
130         variable of DisableAssertionsInScope.
131         (ContainerNode::removeNodeWithScriptAssertion): Moved childrenChanged out of the scope since it could
132         invoke respondToChangedSelection via HTMLTextAreaElement::childrenChanged.
133         * dom/Document.cpp:
134         (WebCore::Document::updateStyleIfNeeded): Added the assertion. Allow updateWidgetPositions() to call
135         this function but exit early when checking needsStyleRecalc().
136         (WebCore::Document::updateLayout): Added the assertion.
137         * dom/NoEventDispatchAssertion.h:
138         (WebCore::NoEventDispatchAssertion::DisableAssertionsInScope::DisableAssertionsInScope): Made this class
139         store the original value of s_count as an instance variable to support re-entrancy.
140         (WebCore::NoEventDispatchAssertion::DisableAssertionsInScope::~DisableAssertionsInScope): Ditto.
141         * page/LayoutContext.cpp:
142         (WebCore::LayoutContext::runOrScheduleAsynchronousTasks): Temporarily disable the assertion. This is safe
143         since SVGImage has its own document.
144         * svg/SVGSVGElement.cpp:
145         (WebCore::checkIntersectionWithoutUpdatingLayout): Extracted out of SVGSVGElement::checkIntersection.
146         (WebCore::checkEnclosureWithoutUpdatingLayout): Extracted out of SVGSVGElement::checkEnclosure.
147         (WebCore::SVGSVGElement::getIntersectionList): Use checkIntersectionWithoutUpdatingLayout to avoid
148         calling updateLayoutIgnorePendingStylesheets while iterating over elements.
149         (WebCore::SVGSVGElement::getEnclosureList): Ditto.
150         (WebCore::SVGSVGElement::checkIntersection):
151         (WebCore::SVGSVGElement::checkEnclosure):
152         * svg/graphics/SVGImage.cpp:
153         (WebCore::SVGImage::draw): Temporarily disable the assertion. This is safe as SVGImage has its own page.
154
155 2017-11-02  Alex Christensen  <achristensen@webkit.org>
156
157         Fix Windows debug build after r224371
158
159         * platform/graphics/win/DIBPixelData.h:
160
161 2017-11-02  Alex Christensen  <achristensen@webkit.org>
162
163         Use CompletionHandlers for redirects
164         https://bugs.webkit.org/show_bug.cgi?id=179163
165
166         Reviewed by Tim Horton.
167
168         Having functions sometimes have to remember to call client->continueWillSendRequest is fragile.
169         CompletionHandler asserts if it's not called once before destruction, and that's what we need here.
170         This will prevent future bugs, and make ResourceHandle look more like NetworkDataTask.
171
172         No change in behavior.
173
174         * loader/NetscapePlugInStreamLoader.cpp:
175         (WebCore::NetscapePlugInStreamLoader::willSendRequest):
176         * loader/NetscapePlugInStreamLoader.h:
177         * loader/ResourceLoader.cpp:
178         (WebCore::ResourceLoader::willSendRequest):
179         (WebCore::ResourceLoader::willSendRequestAsync):
180         * loader/ResourceLoader.h:
181         * loader/appcache/ApplicationCacheGroup.cpp:
182         (WebCore::ApplicationCacheGroup::willSendRequestAsync):
183         * loader/appcache/ApplicationCacheGroup.h:
184         * platform/network/BlobResourceHandle.cpp:
185         * platform/network/PingHandle.h:
186         * platform/network/ResourceHandle.h:
187         * platform/network/ResourceHandleClient.h:
188         * platform/network/SynchronousLoaderClient.cpp:
189         (WebCore::SynchronousLoaderClient::willSendRequestAsync):
190         * platform/network/SynchronousLoaderClient.h:
191         * platform/network/cf/ResourceHandleCFNet.cpp:
192         (WebCore::ResourceHandle::willSendRequest):
193         (WebCore::ResourceHandle::continueWillSendRequest): Deleted.
194         * platform/network/cf/ResourceHandleCFURLConnectionDelegate.h:
195         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
196         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest):
197         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueWillSendRequest): Deleted.
198         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h:
199         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
200         (WebCore::ResourceHandleCurlDelegate::willSendRequest):
201         * platform/network/mac/ResourceHandleMac.mm:
202         (WebCore::ResourceHandle::willSendRequest):
203         (WebCore::ResourceHandle::continueWillSendRequest): Deleted.
204         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
205         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
206         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
207         (-[WebCoreResourceHandleAsOperationQueueDelegate continueWillSendRequest:]): Deleted.
208         * platform/network/soup/ResourceHandleSoup.cpp:
209         (WebCore::doRedirect):
210         (WebCore::ResourceHandle::continueWillSendRequest): Deleted.
211
212 2017-11-02  Christopher Reid  <chris.reid@sony.com>
213
214         Add a FileSystem namespace to FileSystem.cpp
215         https://bugs.webkit.org/show_bug.cgi?id=179063
216
217         Reviewed by Darin Adler.
218
219         No new tests, no change in behavior.
220
221         Adding a FileSystem namespace so its functions aren't global in WebCore.
222
223         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
224         * Modules/entriesapi/DOMFileSystem.cpp:
225         * Modules/entriesapi/FileSystemEntry.cpp:
226         * Modules/indexeddb/IDBDatabaseIdentifier.cpp:
227         * Modules/indexeddb/server/IDBServer.cpp:
228         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
229         * Modules/indexeddb/server/SQLiteIDBTransaction.cpp:
230         * Modules/indexeddb/shared/InProcessIDBServer.cpp:
231         * Modules/webdatabase/DatabaseTracker.cpp:
232         * Modules/webdatabase/OriginLock.cpp:
233         * Modules/webdatabase/OriginLock.h:
234         * fileapi/File.cpp:
235         * fileapi/FileCocoa.mm:
236         * html/FileListCreator.cpp:
237         * html/HTMLMediaElement.cpp:
238         * loader/appcache/ApplicationCacheStorage.cpp:
239         * page/Page.cpp:
240         * page/SecurityOrigin.cpp:
241         * page/SecurityOriginData.cpp:
242         * platform/FileHandle.cpp:
243         * platform/FileHandle.h:
244         * platform/FileStream.cpp:
245         * platform/FileStream.h:
246         * platform/FileSystem.cpp: Added FileSystem namespace
247         * platform/FileSystem.h: Added FileSystem namespace
248         * platform/SharedBuffer.cpp:
249         * platform/SharedBuffer.h:
250         * platform/cf/FileSystemCF.cpp: Added FileSystem namespace
251         * platform/cocoa/FileMonitorCocoa.mm:
252         * platform/cocoa/FileSystemCocoa.mm: Added FileSystem namespace
253         * platform/glib/FileMonitorGLib.cpp:
254         * platform/glib/FileSystemGlib.cpp: Added FileSystem namespace
255         * platform/glib/SharedBufferGlib.cpp:
256         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
257         * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
258         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
259         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
260         * platform/graphics/win/DIBPixelData.h:
261         * platform/ios/QuickLook.mm:
262         * platform/ios/WebItemProviderPasteboard.mm:
263         * platform/mac/FileSystemMac.mm: Added FileSystem namespace
264         * platform/network/BlobDataFileReference.cpp:
265         * platform/network/BlobRegistryImpl.cpp:
266         * platform/network/FormData.cpp:
267         * platform/network/cf/FormDataStreamCFNet.cpp:
268         * platform/network/cocoa/ResourceRequestCocoa.mm:
269         * platform/network/curl/CurlCacheEntry.cpp:
270         * platform/network/curl/CurlCacheEntry.h:
271         * platform/network/curl/CurlCacheManager.cpp:
272         * platform/network/curl/CurlDownload.cpp:
273         * platform/network/curl/CurlRequest.cpp:
274         * platform/network/curl/CurlRequest.h:
275         * platform/network/curl/ResourceHandleCurl.cpp:
276         * platform/network/mac/BlobDataFileReferenceMac.mm:
277         * platform/network/soup/ResourceRequestSoup.cpp:
278         * platform/network/soup/SoupNetworkSession.cpp:
279         * platform/posix/FileSystemPOSIX.cpp: Added FileSystem namespace
280         * platform/posix/SharedBufferPOSIX.cpp:
281         * platform/sql/SQLiteFileSystem.cpp:
282         * platform/text/hyphen/HyphenationLibHyphen.cpp:
283         * platform/win/FileSystemWin.cpp: Added FileSystem namespace
284         * rendering/RenderThemeGtk.cpp:
285         * rendering/RenderThemeWin.cpp:
286
287 2017-11-02  Devin Rousso  <webkit@devinrousso.com>
288
289         Web Inspector: Canvas Tab: show supported GL extensions for selected canvas
290         https://bugs.webkit.org/show_bug.cgi?id=179070
291         <rdar://problem/35278276>
292
293         Reviewed by Brian Burg.
294
295         Test: inspector/canvas/extensions.html
296
297         * html/canvas/WebGL2RenderingContext.cpp:
298         (WebCore::WebGL2RenderingContext::getExtension):
299         * html/canvas/WebGLRenderingContext.cpp:
300         (WebCore::WebGLRenderingContext::getExtension):
301         Rework common logic into a macro for readability and to simplify adding calls to
302         InspectorInstrumentation functions.
303
304         * html/canvas/WebGLRenderingContextBase.h:
305         * html/canvas/WebGLRenderingContextBase.cpp:
306         (WebCore::WebGLRenderingContextBase::extensionIsEnabled):
307
308         * inspector/InspectorCanvasAgent.h:
309         * inspector/InspectorCanvasAgent.cpp:
310         (WebCore::InspectorCanvasAgent::enable):
311         (WebCore::InspectorCanvasAgent::didEnableExtension):
312
313         * inspector/InspectorInstrumentation.h:
314         (WebCore::InspectorInstrumentation::didEnableExtension):
315         * inspector/InspectorInstrumentation.cpp:
316         (WebCore::InspectorInstrumentation::didEnableExtensionImpl):
317
318 2017-11-02  Youenn Fablet  <youenn@apple.com>
319
320         Do not check for CORS in case response is coming from a service worker
321         https://bugs.webkit.org/show_bug.cgi?id=179177
322
323         Reviewed by Chris Dumez.
324
325         Test: http/tests/workers/service/cors-image-fetch.html
326
327         As per fetch spec, CORS check (https://fetch.spec.whatwg.org/#cors-check) is done
328         within HTTP fetch (https://fetch.spec.whatwg.org/#http-fetch).
329         It does not apply to fetches handled by service workers.
330
331         * loader/SubresourceLoader.cpp:
332         (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl):
333
334 2017-11-02  Joseph Pecoraro  <pecoraro@apple.com>
335
336         Make ServiceWorker a Remote Inspector debuggable target
337         https://bugs.webkit.org/show_bug.cgi?id=179043
338         <rdar://problem/34126008>
339
340         Reviewed by Brian Burg.
341
342         * Sources.txt:
343         * WebCore.xcodeproj/project.pbxproj:
344         New files.
345
346         * workers/service/context/ServiceWorkerDebuggable.h: Added.
347         * workers/service/context/ServiceWorkerDebuggable.cpp: Added.
348         (WebCore::ServiceWorkerDebuggable::ServiceWorkerDebuggable):
349         (WebCore::ServiceWorkerDebuggable::connect):
350         (WebCore::ServiceWorkerDebuggable::disconnect):
351         (WebCore::ServiceWorkerDebuggable::dispatchMessageFromRemote):
352         ServiceWorker remote inspector target, exposes the script url to debuggers.
353         Pass the channel on to the inspector proxy to hook it up to the worker.
354
355         * workers/service/context/ServiceWorkerInspectorProxy.h:
356         * workers/service/context/ServiceWorkerInspectorProxy.cpp: Added.
357         (WebCore::ServiceWorkerInspectorProxy::ServiceWorkerInspectorProxy):
358         (WebCore::ServiceWorkerInspectorProxy::~ServiceWorkerInspectorProxy):
359         (WebCore::ServiceWorkerInspectorProxy::serviceWorkerTerminated):
360         Handle interesting events throughout a Service Worker life cycle.
361
362         (WebCore::ServiceWorkerInspectorProxy::connectToWorker):
363         (WebCore::ServiceWorkerInspectorProxy::disconnectFromWorker):
364         (WebCore::ServiceWorkerInspectorProxy::sendMessageToWorker):
365         (WebCore::ServiceWorkerInspectorProxy::sendMessageFromWorkerToFrontend):
366         Implement existing worker debugger hooks for connection setup and sending messages.
367         Inspector protocol messages come in on the MainThread and hop over to the
368         WorkerThread to be handled on the expected context thread. Likewise outgoing
369         messages hop back to be sent through the InspectorFrontend channel on MainThread.
370
371         * workers/service/context/ServiceWorkerThread.cpp:
372         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
373         * workers/service/context/ServiceWorkerThread.h:
374         * workers/service/context/ServiceWorkerThreadProxy.h:
375         * workers/service/context/ServiceWorkerThreadProxy.cpp:
376         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
377         (WebCore::ServiceWorkerThreadProxy::postMessageToDebugger):
378         Construct the new inspector proxy and debuggable registration.
379         Call lifecycle events and debugger hooks when appropriate.
380
381 2017-11-02  Antti Koivisto  <antti@apple.com>
382
383         display:contents should work with dynamic table mutations
384         https://bugs.webkit.org/show_bug.cgi?id=179179
385
386         Reviewed by Ryosuke Niwa.
387
388         * rendering/RenderBlock.cpp:
389         (WebCore::RenderBlock::addChildIgnoringContinuation):
390
391             RenderText with inline text wrapper as beforeChild is now resolved in RenderTreePosition, covering all cases.
392             Verify this with assert.
393
394         * rendering/RenderElement.cpp:
395         (WebCore::RenderElement::insertChildInternal):
396
397             Add assertion.
398
399         * rendering/RenderTableSection.cpp:
400         (WebCore::RenderTableSection::addChild):
401
402             Fix cases where we did unchecked downcasts for anonymous beforeChild.
403
404         * style/RenderTreePosition.cpp:
405         (WebCore::RenderTreePosition::insert):
406
407             When inserting before a text rendeder with an display:contents inline wrapper, use the wrapper as beforeChild.
408
409         * style/RenderTreePosition.h:
410         (WebCore::RenderTreePosition::insert): Deleted.
411         * style/RenderTreeUpdater.cpp:
412         (WebCore::RenderTreeUpdater::updateRenderTree):
413         (WebCore::RenderTreeUpdater::renderingParent):
414
415             Add separate helper to get parent frame for the closest rendered (non display:contents) ancestor.
416
417         (WebCore::RenderTreeUpdater::renderTreePosition):
418         (WebCore::RenderTreeUpdater::updateElementRenderer):
419         (WebCore::RenderTreeUpdater::textRendererIsNeeded):
420         (WebCore::RenderTreeUpdater::updateTextRenderer):
421         (WebCore::RenderTreeUpdater::storePreviousRenderer):
422
423             Use it for tracking state related to render tree siblings. With this we compute whitespace nodes
424             correctly for display:contents. The test cases end up depending on that.
425
426         * style/RenderTreeUpdater.h:
427
428 2017-11-02  Tim Horton  <timothy_horton@apple.com>
429
430         Bump the size of SameAsRenderElement after r224324
431
432         * rendering/RenderElement.cpp:
433         RenderElement uses one more bit in the bitfield now.
434
435 2017-11-02  Ryan Haddad  <ryanhaddad@apple.com>
436
437         Unreviewed, rolling out r224353.
438
439         Breaks internal builds.
440
441         Reverted changeset:
442
443         "Ignore HSTS for partitioned, cross-origin subresource
444         requests"
445         https://bugs.webkit.org/show_bug.cgi?id=178993
446         https://trac.webkit.org/changeset/224353
447
448 2017-11-02  Joseph Pecoraro  <pecoraro@apple.com>
449
450         Inspector should display service worker served responses properly
451         https://bugs.webkit.org/show_bug.cgi?id=178597
452         <rdar://problem/35186111>
453
454         Reviewed by Brian Burg.
455
456         Test: http/tests/inspector/network/resource-response-service-worker.html
457
458         * inspector/InspectorNetworkAgent.cpp:
459         (WebCore::responseSource):
460         Use the new protocol enum.
461
462 2017-11-02  Ryosuke Niwa  <rniwa@webkit.org>
463
464         Eliminate isMainThread() checks in most call sites of NoEventDispatchAssertion
465         https://bugs.webkit.org/show_bug.cgi?id=179161
466
467         Reviewed by Zalan Bujtas.
468
469         Introduced NoEventDispatchAssertion::InMainThread which bypasses the expensive isMainThread() check
470         in order to turn NoEventDispatchAssertion into a release assertion in a separate patch.
471
472         Also removed instances of NoEventDispatchAssertion in notifyChildNodeInserted and notifyChildNodeRemoved
473         and asserted that the caller has instantiated NoEventDispatchAssertion instead.
474
475         No new tests since there should be no behavioral changes.
476
477         * bindings/js/ScriptController.cpp:
478         (WebCore::ScriptController::canExecuteScripts):
479         * dom/Attr.cpp:
480         * dom/CharacterData.cpp:
481         * dom/ContainerNode.cpp:
482         (WebCore::ContainerNode::removeAllChildrenWithScriptAssertion):
483         (WebCore::ContainerNode::removeNodeWithScriptAssertion):
484         (WebCore::executeNodeInsertionWithScriptAssertion):
485         (WebCore::ContainerNode::removeDetachedChildren): Instantiated NoEventDispatchAssertion::InMainThread
486         so that notifyChildNodeRemoved would be called inside NoEventDispatchAssertion. 
487         (WebCore::ContainerNode::insertBeforeCommon):
488         (WebCore::ContainerNode::appendChildCommon):
489         (WebCore::ContainerNode::removeBetween):
490         (WebCore::dispatchChildInsertionEvents):
491         (WebCore::dispatchChildRemovalEvents):
492         * dom/ContainerNodeAlgorithms.cpp:
493         (WebCore::notifyChildNodeInserted): Assert that the caller has instantiated NoEventDispatchAssertion.
494         (WebCore::notifyChildNodeRemoved): Ditto.
495         * dom/Document.cpp:
496         (WebCore::Document::resolveStyle):
497         (WebCore::Document::updateStyleIfNeeded):
498         (WebCore::Document::nodeChildrenWillBeRemoved):
499         (WebCore::Document::nodeWillBeRemoved):
500         (WebCore::Document::dispatchWindowEvent): Replaced RELEASE_ASSERT with ASSERT_WITH_SECURITY_IMPLICATION
501         for clarity since NoEventDispatchAssertion::isEventAllowedInMainThread() always returns true in release
502         builds right now.
503         (WebCore::Document::dispatchWindowLoadEvent): Ditto.
504         (WebCore::Document::applyPendingXSLTransformsTimerFired): Use ASSERT_WITH_SECURITY_IMPLICATION instead
505         of regular ASSERT.
506         * dom/Element.cpp:
507         (WebCore::Element::addShadowRoot): Instantiate NoEventDispatchAssertion::InMainThread to call
508         notifyChildNodeInserted will it.
509         (WebCore::Element::attachAttributeNodeIfNeeded):
510         (WebCore::Element::setAttributeNode): Fixed the indentation.
511         (WebCore::Element::setAttributeNodeNS): Ditto.
512         (WebCore::Element::dispatchFocusInEvent):
513         (WebCore::Element::dispatchFocusOutEvent):
514         * dom/EventDispatcher.cpp:
515         (WebCore::EventDispatcher::dispatchEvent):
516         * dom/NoEventDispatchAssertion.h:
517         (WebCore::NoEventDispatchAssertion::isEventDispatchAllowedInSubtree): Moved to InMainThread.
518         (WebCore::NoEventDispatchAssertion::InMainThread): Added.
519         (WebCore::NoEventDispatchAssertion::InMainThread::InMainThread): Assert that we're in the main thread
520         instead of exiting early.
521         (WebCore::NoEventDispatchAssertion::InMainThread::~InMainThread): Ditto.
522         (WebCore::NoEventDispatchAssertion::InMainThread::isEventDispatchAllowedInSubtree): Moved here.
523         (WebCore::NoEventDispatchAssertion::InMainThread::isEventAllowed):
524         * dom/Node.cpp:
525         (WebCore::Node::dispatchSubtreeModifiedEvent):
526         (WebCore::Node::dispatchDOMActivateEvent):
527         * dom/ScriptExecutionContext.cpp:
528         (WebCore::ScriptExecutionContext::canSuspendActiveDOMObjectsForDocumentSuspension):
529         (WebCore::ScriptExecutionContext::suspendActiveDOMObjects):
530         (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
531         * history/CachedPage.cpp:
532         (WebCore::CachedPage::restore):
533         * history/PageCache.cpp:
534         (WebCore::PageCache::addIfCacheable):
535         * page/LayoutContext.cpp:
536         (WebCore::LayoutContext::layout):
537         * rendering/RenderLayer.cpp:
538         (WebCore::RenderLayer::scrollRectToVisible):
539
540 2017-11-02  John Wilander  <wilander@apple.com>
541
542         Ignore HSTS for partitioned, cross-origin subresource requests
543         https://bugs.webkit.org/show_bug.cgi?id=178993
544         <rdar://problem/34962462>
545
546         Reviewed by Brent Fulgham and Alex Christensen.
547
548         No new tests. HSTS is not supported in layout tests.
549         Tested manually.
550
551         * platform/network/mac/WebCoreURLResponse.mm:
552         (WebCore::synthesizeRedirectResponseIfNecessary):
553             Now also synthesizes a response if
554             _schemeWasUpgradedDueToDynamicHSTS is set on the
555             request. Because in such cases the scheme might
556             have been downgraded and there the two schemes
557             match.
558
559 2017-11-02  Zalan Bujtas  <zalan@apple.com>
560
561         LayoutState::m_next is really the ancestor state.
562         https://bugs.webkit.org/show_bug.cgi?id=179187
563         <rdar://problem/35319525>
564
565         Reviewed by Simon Fraser.
566
567         No change in functionality.
568
569         * rendering/LayoutState.cpp:
570         (WebCore::LayoutState::LayoutState):
571         (WebCore::LayoutState::clearPaginationInformation):
572         (WebCore::LayoutState::propagateLineGridInfo):
573         (WebCore::LayoutState::establishLineGrid):
574         * rendering/LayoutState.h:
575         * rendering/RenderView.h:
576
577 2017-11-02  Alex Christensen  <achristensen@webkit.org>
578
579         Fix iOS WebKitLegacy after r224267
580         https://bugs.webkit.org/show_bug.cgi?id=179189
581
582         Reviewed by Tim Horton.
583
584         Use callOnMainThread instead of dispatch_async to work correctly on the web thread.
585
586         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
587         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
588         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveAuthenticationChallenge:]):
589         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
590         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
591         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveData:lengthReceived:]):
592         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:]):
593         (-[WebCoreResourceHandleAsOperationQueueDelegate connectionDidFinishLoading:]):
594         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didFailWithError:]):
595         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
596
597 2017-11-02  Adrian Perez de Castro  <aperez@igalia.com>
598
599         [WPE] Add some error reporting during EGL display/context creation
600         https://bugs.webkit.org/show_bug.cgi?id=178937
601
602         Reviewed by Carlos Alberto Lopez Perez.
603
604         Unconditionally log errors using WTFLogAlways during EGL context creation. This
605         provides a small degree of help for troubleshooting, and while eglGetError() only
606         returns numeric error codes, it's better than nothing.
607
608         No new tests needed.
609
610         * platform/graphics/PlatformDisplay.cpp:
611         (WebCore::PlatformDisplay::initializeEGLDisplay):
612         * platform/graphics/egl/GLContextEGL.cpp:
613         (WebCore::GLContextEGL::errorString):
614         (WebCore::GLContextEGL::lastErrorString):
615         (WebCore::GLContextEGL::createWindowContext):
616         (WebCore::GLContextEGL::createPbufferContext):
617         (WebCore::GLContextEGL::createSurfacelessContext):
618         (WebCore::GLContextEGL::createContext):
619         (WebCore::GLContextEGL::createSharingContext):
620         (WebCore::GLContextEGL::GLContextEGL):
621         * platform/graphics/egl/GLContextEGL.h:
622         * platform/graphics/egl/GLContextEGLWPE.cpp:
623         (WebCore::GLContextEGL::createWPEContext):
624         * platform/graphics/wpe/PlatformDisplayWPE.cpp:
625         (WebCore::PlatformDisplayWPE::initialize):
626
627 2017-11-02  Joseph Pecoraro  <pecoraro@apple.com>
628
629         Web Inspector: Move InspectorAgents into a folder
630         https://bugs.webkit.org/show_bug.cgi?id=179132
631
632         Reviewed by Devin Rousso.
633
634         * CMakeLists.txt:
635         * Sources.txt:
636         * WebCore.xcodeproj/project.pbxproj:
637         Move files around.
638
639         * inspector/agents/InspectorApplicationCacheAgent.cpp: Renamed from Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp.
640         * inspector/agents/InspectorApplicationCacheAgent.h: Renamed from Source/WebCore/inspector/InspectorApplicationCacheAgent.h.
641         * inspector/agents/InspectorCSSAgent.cpp: Renamed from Source/WebCore/inspector/InspectorCSSAgent.cpp.
642         * inspector/agents/InspectorCSSAgent.h: Renamed from Source/WebCore/inspector/InspectorCSSAgent.h.
643         * inspector/agents/InspectorCanvasAgent.cpp: Renamed from Source/WebCore/inspector/InspectorCanvasAgent.cpp.
644         * inspector/agents/InspectorCanvasAgent.h: Renamed from Source/WebCore/inspector/InspectorCanvasAgent.h.
645         * inspector/agents/InspectorDOMAgent.cpp: Renamed from Source/WebCore/inspector/InspectorDOMAgent.cpp.
646         * inspector/agents/InspectorDOMAgent.h: Renamed from Source/WebCore/inspector/InspectorDOMAgent.h.
647         * inspector/agents/InspectorDOMDebuggerAgent.cpp: Renamed from Source/WebCore/inspector/InspectorDOMDebuggerAgent.cpp.
648         * inspector/agents/InspectorDOMDebuggerAgent.h: Renamed from Source/WebCore/inspector/InspectorDOMDebuggerAgent.h.
649         * inspector/agents/InspectorDOMStorageAgent.cpp: Renamed from Source/WebCore/inspector/InspectorDOMStorageAgent.cpp.
650         * inspector/agents/InspectorDOMStorageAgent.h: Renamed from Source/WebCore/inspector/InspectorDOMStorageAgent.h.
651         * inspector/agents/InspectorDatabaseAgent.cpp: Renamed from Source/WebCore/inspector/InspectorDatabaseAgent.cpp.
652         * inspector/agents/InspectorDatabaseAgent.h: Renamed from Source/WebCore/inspector/InspectorDatabaseAgent.h.
653         * inspector/agents/InspectorIndexedDBAgent.cpp: Renamed from Source/WebCore/inspector/InspectorIndexedDBAgent.cpp.
654         * inspector/agents/InspectorIndexedDBAgent.h: Renamed from Source/WebCore/inspector/InspectorIndexedDBAgent.h.
655         * inspector/agents/InspectorLayerTreeAgent.cpp: Renamed from Source/WebCore/inspector/InspectorLayerTreeAgent.cpp.
656         * inspector/agents/InspectorLayerTreeAgent.h: Renamed from Source/WebCore/inspector/InspectorLayerTreeAgent.h.
657         * inspector/agents/InspectorMemoryAgent.cpp: Renamed from Source/WebCore/inspector/InspectorMemoryAgent.cpp.
658         * inspector/agents/InspectorMemoryAgent.h: Renamed from Source/WebCore/inspector/InspectorMemoryAgent.h.
659         * inspector/agents/InspectorNetworkAgent.cpp: Renamed from Source/WebCore/inspector/InspectorNetworkAgent.cpp.
660         * inspector/agents/InspectorNetworkAgent.h: Renamed from Source/WebCore/inspector/InspectorNetworkAgent.h.
661         * inspector/agents/InspectorPageAgent.cpp: Renamed from Source/WebCore/inspector/InspectorPageAgent.cpp.
662         * inspector/agents/InspectorPageAgent.h: Renamed from Source/WebCore/inspector/InspectorPageAgent.h.
663         * inspector/agents/InspectorTimelineAgent.cpp: Renamed from Source/WebCore/inspector/InspectorTimelineAgent.cpp.
664         * inspector/agents/InspectorTimelineAgent.h: Renamed from Source/WebCore/inspector/InspectorTimelineAgent.h.
665         * inspector/agents/InspectorWorkerAgent.cpp: Renamed from Source/WebCore/inspector/InspectorWorkerAgent.cpp.
666         * inspector/agents/InspectorWorkerAgent.h: Renamed from Source/WebCore/inspector/InspectorWorkerAgent.h.
667         * inspector/agents/WebConsoleAgent.cpp: Renamed from Source/WebCore/inspector/WebConsoleAgent.cpp.
668         * inspector/agents/WebConsoleAgent.h: Renamed from Source/WebCore/inspector/WebConsoleAgent.h.
669         * inspector/agents/WebDebuggerAgent.cpp: Renamed from Source/WebCore/inspector/WebDebuggerAgent.cpp.
670         * inspector/agents/WebDebuggerAgent.h: Renamed from Source/WebCore/inspector/WebDebuggerAgent.h.
671         * inspector/agents/WebHeapAgent.cpp: Renamed from Source/WebCore/inspector/WebHeapAgent.cpp.
672         * inspector/agents/WebHeapAgent.h: Renamed from Source/WebCore/inspector/WebHeapAgent.h.
673         * inspector/agents/page/PageConsoleAgent.cpp: Renamed from Source/WebCore/inspector/PageConsoleAgent.cpp.
674         * inspector/agents/page/PageConsoleAgent.h: Renamed from Source/WebCore/inspector/PageConsoleAgent.h.
675         * inspector/agents/page/PageDebuggerAgent.cpp: Renamed from Source/WebCore/inspector/PageDebuggerAgent.cpp.
676         * inspector/agents/page/PageDebuggerAgent.h: Renamed from Source/WebCore/inspector/PageDebuggerAgent.h.
677         * inspector/agents/page/PageHeapAgent.cpp: Renamed from Source/WebCore/inspector/PageHeapAgent.cpp.
678         * inspector/agents/page/PageHeapAgent.h: Renamed from Source/WebCore/inspector/PageHeapAgent.h.
679         * inspector/agents/page/PageRuntimeAgent.cpp: Renamed from Source/WebCore/inspector/PageRuntimeAgent.cpp.
680         * inspector/agents/page/PageRuntimeAgent.h: Renamed from Source/WebCore/inspector/PageRuntimeAgent.h.
681         * inspector/agents/worker/WorkerConsoleAgent.cpp: Renamed from Source/WebCore/inspector/WorkerConsoleAgent.cpp.
682         * inspector/agents/worker/WorkerConsoleAgent.h: Renamed from Source/WebCore/inspector/WorkerConsoleAgent.h.
683         * inspector/agents/worker/WorkerDebuggerAgent.cpp: Renamed from Source/WebCore/inspector/WorkerDebuggerAgent.cpp.
684         * inspector/agents/worker/WorkerDebuggerAgent.h: Renamed from Source/WebCore/inspector/WorkerDebuggerAgent.h.
685         * inspector/agents/worker/WorkerRuntimeAgent.cpp: Renamed from Source/WebCore/inspector/WorkerRuntimeAgent.cpp.
686         * inspector/agents/worker/WorkerRuntimeAgent.h: Renamed from Source/WebCore/inspector/WorkerRuntimeAgent.h.
687         Move agents into folders.
688
689 2017-11-02  Youenn Fablet  <youenn@apple.com>
690
691         Service Worker fetch should transmit headers to its client
692         https://bugs.webkit.org/show_bug.cgi?id=179156
693
694         Reviewed by Chris Dumez.
695
696         Covered by updated tests.
697
698         Making resourceResponse getter return a ResourceResponse with the headers of the FetchResponse Headers object.
699
700         * Modules/cache/DOMCache.cpp:
701         (WebCore::DOMCache::toConnectionRecord):
702         * Modules/fetch/FetchResponse.cpp:
703         (WebCore::FetchResponse::resourceResponse const):
704         * Modules/fetch/FetchResponse.h:
705
706 2017-11-02  Chris Dumez  <cdumez@apple.com>
707
708         Update SWServerJobQueue to follow the Service Worker specification more closely
709         https://bugs.webkit.org/show_bug.cgi?id=179147
710
711         Reviewed by Youenn Fablet.
712
713         Align naming with the specification.
714
715         Get rid of unnecessary m_currentJob as the current job is always the first
716         job in the queue.
717
718         Inline some of the tiny methods to simplify code. Those were leftovers from when
719         we used to have a background thread.
720
721         * workers/service/server/SWServer.cpp:
722         (WebCore::SWServer::scheduleJob):
723         * workers/service/server/SWServerJobQueue.cpp:
724         (WebCore::SWServerJobQueue::SWServerJobQueue):
725         (WebCore::SWServerJobQueue::scriptFetchFinished):
726         (WebCore::SWServerJobQueue::scriptContextStarted):
727         (WebCore::SWServerJobQueue::runNextJob):
728         (WebCore::SWServerJobQueue::runNextJobSynchronously):
729         (WebCore::SWServerJobQueue::runRegisterJob):
730         (WebCore::SWServerJobQueue::runUnregisterJob):
731         (WebCore::SWServerJobQueue::runUpdateJob):
732         (WebCore::SWServerJobQueue::rejectCurrentJob):
733         (WebCore::SWServerJobQueue::finishCurrentJob):
734         * workers/service/server/SWServerJobQueue.h:
735         (WebCore::SWServerJobQueue::firstJob const):
736         (WebCore::SWServerJobQueue::lastJob const):
737         (WebCore::SWServerJobQueue::enqueueJob):
738         (WebCore::SWServerJobQueue::size const):
739
740 2017-11-02  Konstantin Tokarev  <annulen@yandex.ru>
741
742         Unreviewed, removed useless semicolon at the end of namespace
743
744         * platform/graphics/texmap/BitmapTextureGL.cpp:
745
746 2017-11-02  Michael Catanzaro  <mcatanzaro@igalia.com>
747
748         WPE does not build with DragImage.cpp in unified sources.
749         https://bugs.webkit.org/show_bug.cgi?id=178844
750
751         Reviewed by Keith Miller.
752
753         Add a stub implementation of DragImage for WPE so that we can drop the @no-unify.
754
755         * Sources.txt:
756         * SourcesWPE.txt:
757         * WebCore.xcodeproj/project.pbxproj:
758         * platform/wpe/DragImageWPE.cpp: Added.
759         (WebCore::dragImageSize):
760         (WebCore::deleteDragImage):
761         (WebCore::scaleDragImage):
762         (WebCore::dissolveDragImageToFraction):
763         (WebCore::createDragImageFromImage):
764         (WebCore::createDragImageIconForCachedImageFilename):
765         (WebCore::createDragImageForLink):
766
767 2017-11-02  Eric Carlson  <eric.carlson@apple.com>
768
769         [MediaStream] audioTrack.label is always empty on macOS
770         https://bugs.webkit.org/show_bug.cgi?id=179175
771         <rdar://problem/35315438>
772
773         Reviewed by Youenn Fablet.
774
775         * platform/mediastream/RealtimeMediaSourceSettings.h:
776         (WebCore::RealtimeMediaSourceSettings::label const): New.
777         (WebCore::RealtimeMediaSourceSettings::setLabel): Ditto.
778         (WebCore::RealtimeMediaSourceSettings::encode const): Encode label.
779         (WebCore::RealtimeMediaSourceSettings::decode): Decode label.
780
781         * platform/mediastream/mac/AVMediaCaptureSource.mm:
782         (WebCore::AVMediaCaptureSource::initializeSettings): Set label.
783
784         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
785         (WebCore::CoreAudioCaptureSource::settings const): Ditto.
786
787         * platform/mock/MockRealtimeMediaSource.cpp:
788         (WebCore::MockRealtimeMediaSource::initializeSettings): Ditto.
789
790 2017-11-02  Chris Dumez  <cdumez@apple.com>
791
792         [Service Workers] Add initial implementation for try Clear Registration / Clear Registration algorithms
793         https://bugs.webkit.org/show_bug.cgi?id=179151
794
795         Reviewed by Youenn Fablet.
796
797         [Service Workers] Add initial implementation for try Clear Registration / Clear Registration algorithms:
798         - https://w3c.github.io/ServiceWorker/#try-clear-registration
799         - https://w3c.github.io/ServiceWorker/#clear-registration
800
801         * workers/service/server/SWServerJobQueue.cpp:
802         (WebCore::SWServerJobQueue::scriptFetchFinished):
803         (WebCore::SWServerJobQueue::runUnregisterJob):
804         (WebCore::SWServerJobQueue::tryClearRegistration):
805         (WebCore::SWServerJobQueue::clearRegistration):
806         * workers/service/server/SWServerJobQueue.h:
807
808 2017-11-02  Antti Koivisto  <antti@apple.com>
809
810         Clear Node renderer pointer when destroying RenderObject
811         https://bugs.webkit.org/show_bug.cgi?id=179112
812
813         Reviewed by Zalan Bujtas.
814
815         Make sure we don't leave renderer pointers behind in Nodes.
816         This could be done with WeakPtr but that would add extra indirection between DOM and render tree.
817
818         * rendering/RenderObject.cpp:
819         (WebCore::RenderObject::willBeDestroyed):
820
821             Null the node renderer pointer.
822             With continuations we have a case where renderer points to a node that has a different renderer.
823             This is is ok as we know no node points to a continuation (they should really be anonymous renderers).
824
825 2017-11-02  Antti Koivisto  <antti@apple.com>
826
827         Remove empty continuations in RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers
828         https://bugs.webkit.org/show_bug.cgi?id=179014
829
830         Remove overly optimistic non-critical assertion that is hit on WK1 debug.
831
832         * rendering/RenderBoxModelObject.cpp:
833         (WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations):
834
835 2017-11-02  Frederic Wang  <fwang@igalia.com>
836
837         Add references to bug 179167 in FIXME comments
838         https://bugs.webkit.org/show_bug.cgi?id=179168
839
840         Reviewed by Daniel Bates.
841
842         * Configurations/FeatureDefines.xcconfig:
843
844 2017-11-02  Antti Koivisto  <antti@apple.com>
845
846         Remove empty continuations in RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers
847         https://bugs.webkit.org/show_bug.cgi?id=179014
848
849         Reviewed by Geoff Garen.
850
851         Treat continuation similarly to other anonymous wrappers. This makes things more understandable
852         and allows removal of some questionable code in RenderBlock::takeChild.
853
854         The patch also makes continuation chain a double linked so we can efficiently remove single
855         continuations from the chain. It also gets rid of algorithms that recurse in continuation chain.
856
857         * accessibility/AccessibilityRenderObject.cpp:
858         (WebCore::firstChildInContinuation):
859         * rendering/RenderBlock.cpp:
860         (WebCore::RenderBlock::styleDidChange):
861
862             Don't add and remove continuations from the chain when updating style. Prevent recursion by walking
863             the chain only in the (non-continuation) head renderer.
864
865         (WebCore::RenderBlock::dropAnonymousBoxChild):
866
867             Make a member function.
868
869         (WebCore::RenderBlock::takeChild):
870
871             Remove code that destroyed empty continuations and caused the parent to destroy itself.
872             Empty continuations are now removed by RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers.
873
874         * rendering/RenderBlock.h:
875         * rendering/RenderBoxModelObject.cpp:
876         (WebCore::RenderBoxModelObject::ContinuationChainNode::ContinuationChainNode):
877         (WebCore::RenderBoxModelObject::ContinuationChainNode::~ContinuationChainNode):
878         (WebCore::RenderBoxModelObject::ContinuationChainNode::insertAfter):
879
880             Track continuations with double linked lists.
881
882         (WebCore::continuationChainNodeMap):
883         (WebCore::RenderBoxModelObject::willBeDestroyed):
884
885             Don't recurse to destroy continuation chain. 
886             Destroy all continuations iteratively if this is the head of the chain.
887             When destroying a continuation renderer simply remove it from the chain.
888
889         (WebCore::RenderBoxModelObject::continuation const):
890         (WebCore::RenderBoxModelObject::insertIntoContinuationChainAfter):
891         (WebCore::RenderBoxModelObject::removeFromContinuationChain):
892         (WebCore::RenderBoxModelObject::ensureContinuationChainNode):
893         (WebCore::continuationMap): Deleted.
894         (WebCore::RenderBoxModelObject::setContinuation): Deleted.
895         * rendering/RenderBoxModelObject.h:
896         * rendering/RenderElement.cpp:
897         (WebCore::RenderElement::RenderElement):
898         (WebCore::RenderElement::removeAnonymousWrappersForInlinesIfNecessary):
899
900             Make this a function of the parent renderer itself instead of getting 'parent()' as first operation and
901             then using it.
902             Don't remove continuations (isAnonymousBlockContinuation() test gives wrong result for the last continuation of the chain).
903
904         (WebCore::RenderElement::styleDidChange):
905
906             removeAnonymousWrappersForInlinesIfNecessary is no function of the parent.
907
908         (WebCore::RenderElement::updateOutlineAutoAncestor):
909         * rendering/RenderElement.h:
910         (WebCore::RenderElement::hasContinuationChainNode const):
911         (WebCore::RenderElement::setHasContinuationChainNode):
912         (WebCore::RenderElement::hasContinuation const): Deleted.
913         (WebCore::RenderElement::setHasContinuation): Deleted.
914         * rendering/RenderInline.cpp:
915         (WebCore::RenderInline::styleDidChange):
916
917             Don't add and remove continuations from the chain when updating style. Prevent recursion by walking
918             the chain only in the (non-continuation) head renderer.
919
920         (WebCore::RenderInline::addChildIgnoringContinuation):
921
922             Remove the old continuation from the chain. splitFlow() will add it back into the right place.
923
924         (WebCore::RenderInline::splitInlines):
925         (WebCore::RenderInline::addChildToContinuation):
926         (WebCore::RenderInline::childBecameNonInline):
927
928             Remove the old continuation from the chain. splitFlow() will add it back into the right place.
929
930         * rendering/RenderInline.h:
931         * rendering/RenderObject.cpp:
932         (WebCore::RenderObject::propagateRepaintToParentWithOutlineAutoIfNeeded const):
933         (WebCore::RenderObject::outputRenderObject const):
934         (WebCore::findDestroyRootIncludingAnonymous):
935
936             Allow anonymous continuations as destroy roots.
937
938         (WebCore::RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
939
940             Removing a continuation may leave behind unnecessary anonymous sibling wrappers.
941             Call removeAnonymousWrappersForInlinesIfNecessary() on parent after removal to get rid of them.
942             If takeChild/removeAnonymousWrappersForInlinesIfNecessary leaves us with empty anonymous parent destroy that too.
943
944         * rendering/RenderRubyRun.cpp:
945         (WebCore::RenderRubyRun::takeChild):
946
947             Similar to RenderBlock::takeChild, remove the code that would make the renderer destroy itself.
948             Cleaning up RenderRubyRuns is now handled by removeFromParentAndDestroyCleaningUpAnonymousWrappers.
949
950 2017-11-02  Ryosuke Niwa  <rniwa@webkit.org>
951
952         REGRESSION(r224053): Crash in WebCore::Node::moveTreeToNewScope
953         https://bugs.webkit.org/show_bug.cgi?id=179158
954
955         Reviewed by Antti Koivisto.
956
957         Call decrementReferencingNodeCount after checking the release assertion
958         since that could delete oldDocument.
959
960         * dom/Node.cpp:
961         (WebCore::Node::moveTreeToNewScope):
962
963 2017-11-02  Antti Koivisto  <antti@apple.com>
964
965         First letter text renderer should be anonymous
966         https://bugs.webkit.org/show_bug.cgi?id=179114
967
968         Reviewed by Darin Adler.
969
970         Currently both RenderTextFragment and RenderText for first letter point to the same Text node.
971         There should only be one non-anonymous renderer per node.
972
973         * accessibility/AccessibilityRenderObject.cpp:
974         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const):
975
976             Skip the first letter text renderer instead of the fragment.
977
978         * rendering/RenderBoxModelObject.cpp:
979         (WebCore::firstLetterRemainingTextMap):
980
981             Use WeakPtr.
982             Modernize.
983
984         (WebCore::RenderBoxModelObject::willBeDestroyed):
985         (WebCore::RenderBoxModelObject::firstLetterRemainingText const):
986
987             Avoid hash lookup with the new isFirstLetter bit.
988
989         (WebCore::RenderBoxModelObject::setFirstLetterRemainingText):
990
991         * rendering/RenderElement.cpp:
992         (WebCore::RenderElement::RenderElement):
993         * rendering/RenderElement.h:
994         (WebCore::RenderElement::isFirstLetter const):
995         (WebCore::RenderElement::setIsFirstLetter):
996
997             Add a bit for more explicit code.
998
999         * rendering/RenderTextFragment.cpp:
1000         (WebCore::RenderTextFragment::setText):
1001
1002             Assert that RenderTextFragment is always the non-anonymous renderer.
1003
1004         * style/RenderTreeUpdaterFirstLetter.cpp:
1005         (WebCore::updateFirstLetterStyle):
1006
1007             Set the isFirstLetter bit.
1008
1009         (WebCore::createFirstLetterRenderer):
1010
1011             Set the isFirstLetter bit.
1012             Remove the old text renderer before adding a new one.
1013
1014 2017-11-01  Frederic Wang  <fwang@igalia.com>
1015
1016         Remove ScrollableArea::isTouchScrollable and ScrollableArea::isOverflowScroll
1017         https://bugs.webkit.org/show_bug.cgi?id=179121
1018
1019         Reviewed by Alex Christensen.
1020
1021         These functions were introduced in r161589 and r160236 but it seems that they have never
1022         been used.
1023
1024         No new tests, behavior unchanged.
1025
1026         * platform/ScrollableArea.h:
1027         (WebCore::ScrollableArea::isTouchScrollable const): Deleted.
1028         (WebCore::ScrollableArea::isOverflowScroll const): Deleted.
1029         * rendering/RenderLayer.h:
1030
1031 2017-11-01  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1032
1033         [Curl] Make the order of scheduler job handling sequential 
1034         https://bugs.webkit.org/show_bug.cgi?id=179127
1035
1036         Reviewed by Alex Christensen.
1037
1038         * platform/network/curl/CurlRequestScheduler.cpp:
1039         (WebCore::CurlRequestScheduler::add):
1040         (WebCore::CurlRequestScheduler::cancel):
1041         (WebCore::CurlRequestScheduler::stopThreadIfNoMoreJobRunning):
1042         (WebCore::CurlRequestScheduler::executeTasks):
1043         (WebCore::CurlRequestScheduler::workerThread):
1044         (WebCore::CurlRequestScheduler::startTransfer):
1045         (WebCore::CurlRequestScheduler::completeTransfer):
1046         (WebCore::CurlRequestScheduler::cancelTransfer):
1047         (WebCore::CurlRequestScheduler::finalizeTransfer):
1048         (WebCore::CurlJobList::isEmpty const): Deleted.
1049         (WebCore::CurlJobList::startJobs): Deleted.
1050         (WebCore::CurlJobList::finishJobs): Deleted.
1051         (WebCore::CurlRequestScheduler::updateJobList): Deleted.
1052         * platform/network/curl/CurlRequestScheduler.h:
1053
1054 2017-11-01  Ryosuke Niwa  <rniwa@webkit.org>
1055
1056         NavigatorBase::onLine() accesses NetworkStateNotifier's singleton in a worker thread
1057         https://bugs.webkit.org/show_bug.cgi?id=179149
1058         <rdar://problem/35307552>
1059
1060         Reviewed by Jiewen Tan.
1061
1062         Fixed the bug making NavigatorBase::onLine a pure virtual function, and having two separate
1063         implementations for Navigator and WorkerNavigator. The former uses the singleton directly,
1064         and the latter returns the boolean stored in its instance. The boolean value is updated
1065         via WorkerMessagingProxy when the online status changes.
1066
1067         No new tests.
1068
1069         * page/Navigator.cpp:
1070         (WebCore::Navigator::onLine const):
1071         * page/Navigator.h:
1072         * page/NavigatorBase.cpp:
1073         (WebCore::NavigatorBase::onLine): Deleted.
1074         * page/NavigatorBase.h:
1075         * page/WorkerNavigator.cpp:
1076         (WebCore::WorkerNavigator::WorkerNavigator):
1077         (WebCore::WorkerNavigator::onLine const):
1078         * page/WorkerNavigator.h:
1079         * platform/network/NetworkStateNotifier.cpp:
1080         (WebCore::NetworkStateNotifier::singleton):
1081         * workers/DedicatedWorkerGlobalScope.cpp:
1082         (WebCore::DedicatedWorkerGlobalScope::create):
1083         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
1084         * workers/DedicatedWorkerGlobalScope.h:
1085         * workers/DedicatedWorkerThread.cpp:
1086         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
1087         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
1088         * workers/DedicatedWorkerThread.h:
1089         * workers/Worker.cpp:
1090         (WebCore::Worker::notifyFinished):
1091         * workers/WorkerGlobalScope.cpp:
1092         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
1093         (WebCore::WorkerGlobalScope::navigator):
1094         (WebCore::WorkerGlobalScope::setIsOnline):
1095         * workers/WorkerGlobalScope.h:
1096         * workers/WorkerGlobalScopeProxy.h:
1097         * workers/WorkerMessagingProxy.cpp:
1098         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
1099         (WebCore::WorkerMessagingProxy::notifyNetworkStateChange):
1100         * workers/WorkerMessagingProxy.h:
1101         * workers/WorkerThread.cpp:
1102         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
1103         (WebCore::WorkerThread::WorkerThread):
1104         (WebCore::WorkerThread::workerThread):
1105         * workers/WorkerThread.h:
1106         * workers/service/ServiceWorkerGlobalScope.cpp:
1107         (WebCore::ServiceWorkerGlobalScope::ServiceWorkerGlobalScope):
1108         * workers/service/ServiceWorkerGlobalScope.h:
1109         * workers/service/context/ServiceWorkerThread.cpp:
1110         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
1111         (WebCore::ServiceWorkerThread::createWorkerGlobalScope):
1112         * workers/service/context/ServiceWorkerThread.h:
1113
1114 2017-11-01  Jiewen Tan  <jiewen_tan@apple.com>
1115
1116         Let is<T>() accept RefPtrs
1117         https://bugs.webkit.org/show_bug.cgi?id=178612
1118         <rdar://problem/35102004>
1119
1120         Reviewed by Ryosuke Niwa.
1121
1122         Get rid of .get() for all is<T>() calls.
1123
1124         No changes in behaviors.
1125
1126         * bindings/js/JSElementCustom.cpp:
1127         (WebCore::createNewElementWrapper):
1128         * bindings/js/JSMediaStreamTrackCustom.cpp:
1129         (WebCore::toJSNewlyCreated):
1130         * bindings/js/JSNodeCustom.cpp:
1131         (WebCore::createWrapperInline):
1132         * bindings/js/JSTextCustom.cpp:
1133         (WebCore::toJSNewlyCreated):
1134         * css/CSSFilterImageValue.cpp:
1135         (WebCore::CSSFilterImageValue::loadSubimages):
1136         * css/CSSFontFaceSet.cpp:
1137         (WebCore::CSSFontFaceSet::matchingFaces):
1138         * css/CSSFontSelector.cpp:
1139         (WebCore::CSSFontSelector::addFontFaceRule):
1140         * css/CSSToStyleMap.cpp:
1141         (WebCore::CSSToStyleMap::mapNinePieceImage):
1142         * css/FontFace.cpp:
1143         (WebCore::FontFace::create):
1144         * css/StyleBuilderConverter.h:
1145         (WebCore::StyleBuilderConverter::createGridTrackList):
1146         * css/StyleBuilderCustom.h:
1147         (WebCore::StyleBuilderCustom::applyValueCursor):
1148         (WebCore::StyleBuilderCustom::applyValueContent):
1149         (WebCore::StyleBuilderCustom::applyValueWillChange):
1150         * css/StyleProperties.cpp:
1151         (WebCore::StyleProperties::propertyAsColor const):
1152         (WebCore::StyleProperties::propertyAsValueID const):
1153         * css/StyleResolver.cpp:
1154         (WebCore::StyleResolver::createFilterOperations):
1155         * css/TransformFunctions.cpp:
1156         (WebCore::transformsForValue):
1157         * css/ViewportStyleResolver.cpp:
1158         (WebCore::ViewportStyleResolver::getViewportArgumentValue const):
1159         * dom/Document.cpp:
1160         (WebCore::Document::setBodyOrFrameset):
1161         (WebCore::Document::setFocusedElement):
1162         (WebCore::Document::updateHoverActiveState):
1163         * dom/Element.cpp:
1164         (WebCore::Element::setOuterHTML):
1165         * dom/Range.cpp:
1166         (WebCore::Range::insertNode):
1167         * editing/ApplyStyleCommand.cpp:
1168         (WebCore::toIdentifier):
1169         (WebCore::ApplyStyleCommand::applyBlockStyle):
1170         (WebCore::ApplyStyleCommand::surroundNodeRangeWithElement):
1171         * editing/EditingStyle.cpp:
1172         (WebCore::identifierForStyleProperty):
1173         (WebCore::HTMLElementEquivalent::valueIsPresentInStyle const):
1174         (WebCore::EditingStyle::extractFontSizeDelta):
1175         (WebCore::EditingStyle::textDirection const):
1176         (WebCore::textDecorationValueList):
1177         (WebCore::EditingStyle::prepareToApplyAt):
1178         (WebCore::EditingStyle::legacyFontSize const):
1179         (WebCore::EditingStyle::textDirectionForSelection):
1180         (WebCore::StyleChange::StyleChange):
1181         (WebCore::StyleChange::extractTextStyles):
1182         (WebCore::diffTextDecorations):
1183         * html/BaseChooserOnlyDateAndTimeInputType.cpp:
1184         (WebCore::BaseChooserOnlyDateAndTimeInputType::updateAppearance):
1185         * html/FormAssociatedElement.cpp:
1186         (WebCore::FormAssociatedElement::findAssociatedForm):
1187         * html/HTMLAreaElement.cpp:
1188         (WebCore::HTMLAreaElement::imageElement const):
1189         * html/HTMLElement.cpp:
1190         (WebCore::HTMLElement::setOuterText):
1191         (WebCore::HTMLElement::dirAttributeChanged):
1192         * html/HTMLEmbedElement.cpp:
1193         (WebCore::HTMLEmbedElement::rendererIsNeeded):
1194         * html/HTMLFormControlElement.cpp:
1195         (WebCore::HTMLFormControlElement::computeIsDisabledByFieldsetAncestor const):
1196         * html/HTMLInputElement.cpp:
1197         (WebCore::HTMLInputElement::dataList const):
1198         * html/HTMLOptionElement.cpp:
1199         (WebCore::HTMLOptionElement::setText):
1200         (WebCore::HTMLOptionElement::textIndentedToRespectGroupLabel const):
1201         * html/HTMLPlugInElement.cpp:
1202         (WebCore::HTMLPlugInElement::isKeyboardFocusable const):
1203         (WebCore::HTMLPlugInElement::isUserObservable const):
1204         * html/HTMLSelectElement.cpp:
1205         (WebCore::HTMLSelectElement::selectOption):
1206         * html/HTMLSummaryElement.cpp:
1207         (WebCore::isClickableControl):
1208         * html/HTMLTextFormControlElement.cpp:
1209         (WebCore::HTMLTextFormControlElement::adjustInnerTextStyle const):
1210         * html/RadioInputType.cpp:
1211         (WebCore::RadioInputType::isKeyboardFocusable const):
1212         * html/parser/HTMLConstructionSite.cpp:
1213         (WebCore::HTMLConstructionSite::attachLater):
1214         (WebCore::HTMLConstructionSite::insertTextNode):
1215         * html/shadow/MediaControlElements.cpp:
1216         (WebCore::MediaControlClosedCaptionsTrackListElement::defaultEventHandler):
1217         * html/track/TextTrackList.cpp:
1218         (TextTrackList::append):
1219         * inspector/InspectorDOMAgent.cpp:
1220         (WebCore::InspectorDOMAgent::setNodeName):
1221         * inspector/PageScriptDebugServer.cpp:
1222         (WebCore::PageScriptDebugServer::setJavaScriptPaused):
1223         * page/FocusController.cpp:
1224         (WebCore::shouldClearSelectionWhenChangingFocusedElement):
1225         * page/FrameView.cpp:
1226         (WebCore::FrameView::hasCustomScrollbars const):
1227         * page/Page.cpp:
1228         (WebCore::Page::pluginViews):
1229         * page/mac/EventHandlerMac.mm:
1230         (WebCore::EventHandler::platformPrepareForWheelEvents):
1231         * rendering/RenderBoxModelObject.cpp:
1232         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
1233         * testing/Internals.cpp:
1234         (WebCore::deferredStyleRulesCountForList):
1235         (WebCore::deferredGroupRulesCountForList):
1236         (WebCore::deferredKeyframesRulesCountForList):
1237
1238 2017-11-01  Fujii Hironori  <Hironori.Fujii@sony.com>
1239
1240         [curl] Fix build after r224299
1241         https://bugs.webkit.org/show_bug.cgi?id=179155
1242
1243         Unreviewed.
1244
1245         Bug 175597 added the 6th argument of ResourceHandle constructor.
1246         Apply the same change of ResourceHandleCFNet.cpp to
1247         platformLoadResourceSynchronously of ResourceHandleCurl.cpp.
1248
1249         No new tests since there should be no behavioral change other
1250
1251         * platform/network/curl/ResourceHandleCurl.cpp:
1252         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
1253         Added the 6th arguemnt shouldContentEncodingSniff.
1254
1255 2017-11-01  Simon Fraser  <simon.fraser@apple.com>
1256
1257         Fix iOS build after r224312.
1258
1259         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
1260         (WebCore::GraphicsContext::drawFocusRing):
1261
1262 2017-11-01  Daniel Bates  <dabates@apple.com>
1263
1264         Change Element::didAddUserAgentShadowRoot() to take a reference instead of a pointer
1265         https://bugs.webkit.org/show_bug.cgi?id=179153
1266
1267         Reviewed by Ryosuke Niwa.
1268
1269         Element::didAddUserAgentShadowRoot() is always passed a non-null pointer to the added
1270         ShadowRoot. Therefore we should have didAddUserAgentShadowRoot() take a lvalue reference
1271         to a ShadowRoot.
1272
1273         No functionality changed. So, no new tests.
1274
1275         * dom/Element.cpp:
1276         (WebCore::Element::addShadowRoot):
1277         * dom/Element.h:
1278         (WebCore::Element::didAddUserAgentShadowRoot):
1279         * html/HTMLDetailsElement.cpp:
1280         (WebCore::HTMLDetailsElement::didAddUserAgentShadowRoot):
1281         * html/HTMLDetailsElement.h:
1282         * html/HTMLInputElement.cpp:
1283         (WebCore::HTMLInputElement::didAddUserAgentShadowRoot):
1284         * html/HTMLInputElement.h:
1285         * html/HTMLMediaElement.cpp:
1286         (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
1287         * html/HTMLMediaElement.h:
1288         * html/HTMLMeterElement.cpp:
1289         (WebCore::HTMLMeterElement::didAddUserAgentShadowRoot):
1290         * html/HTMLMeterElement.h:
1291         * html/HTMLPlugInElement.cpp:
1292         (WebCore::HTMLPlugInElement::didAddUserAgentShadowRoot):
1293         * html/HTMLPlugInElement.h:
1294         * html/HTMLPlugInImageElement.cpp:
1295         (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):
1296         * html/HTMLPlugInImageElement.h:
1297         * html/HTMLProgressElement.cpp:
1298         (WebCore::HTMLProgressElement::didAddUserAgentShadowRoot):
1299         * html/HTMLProgressElement.h:
1300         * html/HTMLSummaryElement.cpp:
1301         (WebCore::HTMLSummaryElement::didAddUserAgentShadowRoot):
1302         * html/HTMLSummaryElement.h:
1303         * html/HTMLTextAreaElement.cpp:
1304         (WebCore::HTMLTextAreaElement::didAddUserAgentShadowRoot):
1305         * html/HTMLTextAreaElement.h:
1306
1307 2017-11-01  Jeremy Jones  <jeremyj@apple.com>
1308
1309         Implement WKFullscreenWindowController for iOS.
1310         https://bugs.webkit.org/show_bug.cgi?id=178924
1311         rdar://problem/34697120
1312
1313         Reviewed by Simon Fraser.
1314
1315         Enable ENABLE_FULLSCREEN_API for iOS.
1316
1317         * Configurations/FeatureDefines.xcconfig:
1318
1319 2017-11-01  Simon Fraser  <simon.fraser@apple.com>
1320
1321         Misc display list and other cleanup
1322         https://bugs.webkit.org/show_bug.cgi?id=179150
1323
1324         Reviewed by Tim Horton.
1325
1326         A few functions in GraphicsContext would assert when using display lists, because they
1327         had no recording clause. Fix them (ellipse drawing, and focus ring drawing).
1328         
1329         Use #pragma once in more places.
1330
1331         Add system trace points for display list recording.
1332
1333         No behavior change for non-display list code.
1334
1335         * platform/graphics/GraphicsContext.cpp:
1336         (WebCore::GraphicsContext::fillEllipse):
1337         (WebCore::GraphicsContext::strokeEllipse):
1338         * platform/graphics/PlatformLayer.h:
1339         * platform/graphics/ca/GraphicsLayerCA.cpp:
1340         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
1341         * platform/graphics/ca/cocoa/WebSystemBackdropLayer.h:
1342         * platform/graphics/ca/cocoa/WebTiledBackingLayer.h:
1343         * platform/graphics/cg/GraphicsContextCG.h:
1344         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
1345         (WebCore::GraphicsContext::drawFocusRing):
1346         * platform/graphics/displaylists/DisplayList.h:
1347         * platform/graphics/displaylists/DisplayListItems.h:
1348         (WebCore::DisplayList::DrawFocusRingPath::create):
1349         (WebCore::DisplayList::DrawFocusRingPath::width const):
1350         (WebCore::DisplayList::DrawFocusRingPath::offset const):
1351         (WebCore::DisplayList::DrawFocusRingPath::DrawFocusRingPath):
1352         (WebCore::DisplayList::DrawFocusRingRects::create):
1353         (WebCore::DisplayList::DrawFocusRingRects::width const):
1354         (WebCore::DisplayList::DrawFocusRingRects::offset const):
1355         (WebCore::DisplayList::DrawFocusRingRects::DrawFocusRingRects):
1356         * platform/graphics/displaylists/DisplayListRecorder.cpp:
1357         (WebCore::DisplayList::Recorder::restore):
1358         (WebCore::DisplayList::Recorder::drawFocusRing):
1359         * platform/graphics/displaylists/DisplayListRecorder.h:
1360         * platform/graphics/displaylists/DisplayListReplayer.h:
1361         * platform/graphics/mac/WebLayer.h:
1362
1363 2017-11-01  Per Arne Vollan  <pvollan@apple.com>
1364
1365         [Win] Fix compile errors in MediaPlayerPrivateAVFoundationCF.cpp
1366         https://bugs.webkit.org/show_bug.cgi?id=179148
1367
1368         Reviewed by Ryosuke Niwa.
1369
1370         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
1371         (WebCore::MediaPlayerPrivateAVFoundationCF::resolvedURLChanged):
1372
1373 2017-11-01  Tim Horton  <timothy_horton@apple.com>
1374
1375         Adjust RenderElement size assertion to be more accurate
1376         https://bugs.webkit.org/show_bug.cgi?id=179146
1377
1378         Reviewed by Simon Fraser.
1379
1380         * rendering/RenderElement.cpp:
1381         Alignment rules for bitfields differ on different platforms. If we're
1382         more truthful in our mimicing the layout of RenderElement, we can avoid
1383         the assertion firing on more configurations.
1384
1385 2017-11-01  Mark Lam  <mark.lam@apple.com>
1386
1387         Add support to throw OOM if MarkedArgumentBuffer may overflow.
1388         https://bugs.webkit.org/show_bug.cgi?id=179092
1389         <rdar://problem/35116160>
1390
1391         Reviewed by Saam Barati.
1392
1393         No new tests.  The test for overflowing a MarkedArgumentBuffer will run for a
1394         ridiculously long time, which renders it unsuitable for automated tests.
1395
1396         * Modules/plugins/QuickTimePluginReplacement.mm:
1397         (WebCore::QuickTimePluginReplacement::installReplacement):
1398         * bindings/js/JSCustomElementInterface.cpp:
1399         (WebCore::constructCustomElementSynchronously):
1400         (WebCore::JSCustomElementInterface::upgradeElement):
1401         (WebCore::JSCustomElementInterface::invokeCallback):
1402         * bindings/js/JSCustomXPathNSResolver.cpp:
1403         (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
1404         * bindings/js/JSDOMBuiltinConstructorBase.cpp:
1405         (WebCore::JSDOMBuiltinConstructorBase::callFunctionWithCurrentArguments):
1406         * bindings/js/JSDOMConvertSequences.h:
1407         (WebCore::JSConverter<IDLSequence<T>>::convert):
1408         (WebCore::JSConverter<IDLFrozenArray<T>>::convert):
1409         * bindings/js/JSDOMConvertWebGL.cpp:
1410         (WebCore::convertToJSValue):
1411         * bindings/js/JSDOMIterator.h:
1412         (WebCore::jsPair):
1413         (WebCore::iteratorForEach):
1414         * bindings/js/JSDOMMapLike.cpp:
1415         (WebCore::forwardFunctionCallToBackingMap):
1416         (WebCore::forwardForEachCallToBackingMap):
1417         * bindings/js/JSDOMPromiseDeferred.cpp:
1418         (WebCore::DeferredPromise::callFunction):
1419         (WebCore::createRejectedPromiseWithTypeError):
1420         * bindings/js/JSErrorHandler.cpp:
1421         (WebCore::JSErrorHandler::handleEvent):
1422         * bindings/js/JSEventListener.cpp:
1423         (WebCore::JSEventListener::handleEvent):
1424         * bindings/js/JSLazyEventListener.cpp:
1425         (WebCore::JSLazyEventListener::initializeJSFunction const):
1426         * bindings/js/JSPluginElementFunctions.cpp:
1427         (WebCore::callPlugin):
1428         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
1429         (WebCore::constructJSReadableStreamReaderGeneric):
1430         * bindings/js/ReadableStream.cpp:
1431         (WebCore::ReadableStream::create):
1432         (WebCore::ReadableStream::pipeTo):
1433         (WebCore::ReadableStream::tee):
1434         (WebCore::ReadableStream::lock):
1435         (WebCore::checkReadableStream):
1436         * bindings/js/ReadableStreamDefaultController.cpp:
1437         (WebCore::ReadableStreamDefaultController::invoke):
1438         * bindings/js/ScheduledAction.cpp:
1439         (WebCore::ScheduledAction::executeFunctionInContext):
1440         * bindings/js/SerializedScriptValue.cpp:
1441         (WebCore::CloneSerializer::recordObject):
1442         (WebCore::CloneSerializer::serialize):
1443         (WebCore::CloneDeserializer::readTerminal):
1444         (WebCore::CloneDeserializer::deserialize):
1445         * bindings/scripts/CodeGeneratorJS.pm:
1446         (GenerateCallbackImplementationContent):
1447         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
1448         (WebCore::JSTestCallbackFunction::handleEvent):
1449         * bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.cpp:
1450         (WebCore::JSTestCallbackFunctionRethrow::handleEvent):
1451         * bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.cpp:
1452         (WebCore::JSTestCallbackFunctionWithThisObject::handleEvent):
1453         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
1454         (WebCore::JSTestCallbackFunctionWithTypedefs::handleEvent):
1455         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
1456         (WebCore::JSTestCallbackInterface::callbackWithNoParam):
1457         (WebCore::JSTestCallbackInterface::callbackWithArrayParam):
1458         (WebCore::JSTestCallbackInterface::callbackWithSerializedScriptValueParam):
1459         (WebCore::JSTestCallbackInterface::callbackWithStringList):
1460         (WebCore::JSTestCallbackInterface::callbackWithBoolean):
1461         (WebCore::JSTestCallbackInterface::callbackRequiresThisToPass):
1462         (WebCore::JSTestCallbackInterface::callbackWithAReturnValue):
1463         (WebCore::JSTestCallbackInterface::callbackThatRethrowsExceptions):
1464         (WebCore::JSTestCallbackInterface::callbackThatSkipsInvokeCheck):
1465         (WebCore::JSTestCallbackInterface::callbackWithThisObject):
1466         * bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp:
1467         (WebCore::JSTestVoidCallbackFunction::handleEvent):
1468         * bridge/NP_jsobject.cpp:
1469         * bridge/objc/WebScriptObject.mm:
1470         (-[WebScriptObject callWebScriptMethod:withArguments:]):
1471         * html/HTMLMediaElement.cpp:
1472         (WebCore::HTMLMediaElement::updateCaptionContainer):
1473         (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
1474         (WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange):
1475         (WebCore::HTMLMediaElement::getCurrentMediaControlsStatus):
1476         * html/HTMLPlugInImageElement.cpp:
1477         (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):
1478         * testing/Internals.cpp:
1479         (WebCore::Internals::cloneArrayBuffer):
1480
1481 2017-11-01  Andy Estes  <aestes@apple.com>
1482
1483         [Apple Pay] Update the enum traits for PaymentError::ContactField
1484         https://bugs.webkit.org/show_bug.cgi?id=179145
1485         <rdar://problem/35303108>
1486
1487         Reviewed by Tim Horton.
1488
1489         Account for the values added to PaymentError::ContactField in r220718 and r223580.
1490
1491         * Modules/applepay/ApplePaySessionPaymentRequest.h:
1492
1493 2017-11-01  Daniel Bates  <dabates@apple.com>
1494
1495         Remove unused Element::alwaysCreateUserAgentShadowRoot()
1496         https://bugs.webkit.org/show_bug.cgi?id=179141
1497
1498         Reviewed by Ryosuke Niwa.
1499
1500         In changeset r208135 Element::createShadowRoot() was removed. And Element::createShadowRoot()
1501         was the only caller of Element::alwaysCreateUserAgentShadowRoot(). We should remove
1502         Element::alwaysCreateUserAgentShadowRoot() as it is unused.
1503
1504         * dom/Element.h:
1505         (WebCore::Element::didAddUserAgentShadowRoot):
1506         (WebCore::Element::alwaysCreateUserAgentShadowRoot const): Deleted.
1507         * html/HTMLButtonElement.h:
1508         * html/HTMLFormControlElement.h:
1509         * html/HTMLMediaElement.h:
1510
1511 2017-11-01  Chris Dumez  <cdumez@apple.com>
1512
1513         Drop running Service Worker Jobs on a background thread
1514         https://bugs.webkit.org/show_bug.cgi?id=179142
1515
1516         Reviewed by Youenn Fablet.
1517
1518         Drop running Service Worker Jobs on a background thread. We don't really need to
1519         and this simplifies the logic a lot.
1520
1521         * workers/service/server/SWServer.cpp:
1522         (WebCore::SWServer::getRegistration):
1523         (WebCore::SWServer::addRegistration):
1524         (WebCore::SWServer::removeRegistration):
1525         * workers/service/server/SWServerJobQueue.cpp:
1526         (WebCore::SWServerJobQueue::scriptContextStarted):
1527         (WebCore::SWServerJobQueue::startNextJob):
1528         (WebCore::SWServerJobQueue::runRegisterJob):
1529         (WebCore::SWServerJobQueue::runUnregisterJob):
1530         (WebCore::SWServerJobQueue::runUpdateJob):
1531         (WebCore::SWServerJobQueue::finishCurrentJob):
1532         * workers/service/server/SWServerJobQueue.h:
1533
1534 2017-11-01  Per Arne Vollan  <pvollan@apple.com>
1535
1536         Unreviewed, try to fix Windows build.
1537
1538         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
1539         (WebCore::MediaPlayerPrivateAVFoundationCF::createAVAssetForURL):
1540
1541 2017-11-01  Chris Dumez  <cdumez@apple.com>
1542
1543         Split JobQueue logic out of SWServerRegistration
1544         https://bugs.webkit.org/show_bug.cgi?id=179126
1545
1546         Reviewed by Brady Eidson.
1547
1548         Split JobQueue logic out of SWServerRegistration and into a SWServerJobQueue class to match the Service Workers
1549         specification more closely.
1550
1551         * Sources.txt:
1552         * WebCore.xcodeproj/project.pbxproj:
1553         * workers/service/ServiceWorkerContainer.cpp:
1554         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
1555         * workers/service/ServiceWorkerRegistrationData.cpp:
1556         (WebCore::ServiceWorkerRegistrationData::isolatedCopy const):
1557         * workers/service/ServiceWorkerRegistrationData.h:
1558         (WebCore::ServiceWorkerRegistrationData::encode const):
1559         (WebCore::ServiceWorkerRegistrationData::decode):
1560         * workers/service/server/SWServer.cpp:
1561         (WebCore::SWServer::~SWServer):
1562         (WebCore::SWServer::getRegistration):
1563         (WebCore::SWServer::addRegistration):
1564         (WebCore::SWServer::removeRegistration):
1565         (WebCore::SWServer::Connection::scriptContextStarted):
1566         (WebCore::SWServer::scheduleJob):
1567         (WebCore::SWServer::scriptFetchFinished):
1568         (WebCore::SWServer::scriptContextFailedToStart):
1569         (WebCore::SWServer::scriptContextStarted):
1570         * workers/service/server/SWServer.h:
1571         * workers/service/server/SWServerJobQueue.cpp: Added.
1572         (WebCore::SWServerJobQueue::SWServerJobQueue):
1573         (WebCore::SWServerJobQueue::~SWServerJobQueue):
1574         (WebCore::SWServerJobQueue::enqueueJob):
1575         (WebCore::SWServerJobQueue::scriptFetchFinished):
1576         (WebCore::SWServerJobQueue::scriptContextFailedToStart):
1577         (WebCore::SWServerJobQueue::scriptContextStarted):
1578         (WebCore::SWServerJobQueue::startNextJob):
1579         (WebCore::SWServerJobQueue::runRegisterJob):
1580         (WebCore::SWServerJobQueue::runUnregisterJob):
1581         (WebCore::SWServerJobQueue::runUpdateJob):
1582         (WebCore::SWServerJobQueue::rejectWithExceptionOnMainThread):
1583         (WebCore::SWServerJobQueue::resolveWithRegistrationOnMainThread):
1584         (WebCore::SWServerJobQueue::resolveCurrentRegistrationJobOnMainThead):
1585         (WebCore::SWServerJobQueue::resolveWithUnregistrationResultOnMainThread):
1586         (WebCore::SWServerJobQueue::startScriptFetchFromMainThread):
1587         (WebCore::SWServerJobQueue::rejectCurrentJob):
1588         (WebCore::SWServerJobQueue::resolveCurrentRegistrationJob):
1589         (WebCore::SWServerJobQueue::resolveCurrentUnregistrationJob):
1590         (WebCore::SWServerJobQueue::startScriptFetchForCurrentJob):
1591         (WebCore::SWServerJobQueue::finishCurrentJob):
1592         * workers/service/server/SWServerJobQueue.h: Added.
1593         * workers/service/server/SWServerRegistration.cpp:
1594         (WebCore::SWServerRegistration::SWServerRegistration):
1595         (WebCore::SWServerRegistration::~SWServerRegistration):
1596         (WebCore::SWServerRegistration::data const):
1597         * workers/service/server/SWServerRegistration.h:
1598         (WebCore::SWServerRegistration::key const):
1599         (WebCore::SWServerRegistration::isUninstalling const):
1600         (WebCore::SWServerRegistration::setIsUninstalling):
1601         (WebCore::SWServerRegistration::setLastUpdateTime):
1602         (WebCore::SWServerRegistration::updateViaCache const):
1603         (WebCore::SWServerRegistration::setActiveServiceWorkerIdentifier):
1604
1605 2017-11-01  Daniel Bates  <dabates@apple.com>
1606
1607         XMLHttpRequest should not sniff content encoding
1608         https://bugs.webkit.org/show_bug.cgi?id=175597
1609         <rdar://problem/34912624>
1610
1611         Reviewed by Alex Christensen.
1612
1613         Fixes an issue where the body of an HTTP response with headers "Content-Type: application/octet-stream" and
1614         "Content-Encoding: gzip" associated with an XHR request to a .gz file would not be automatically gzipped
1615         decompressed. Specifically, such a response would be treated analogous to a response with headers
1616         "Content-Type: application/gzip" and "Content-Encoding: identity". This behavior does not conform to the
1617         behavior of the Content-Encoding header as defined in the HTTP 1.1 and later specs. Moreover this behavior
1618         breaks the Epic Zen Garden demo: <https://s3.amazonaws.com/mozilla-games/ZenGarden/EpicZenGarden.html>.
1619
1620         On macOS 10.13.2 opt out of content encoding sniffing when making an XHR request. We likely can
1621         selectively opt out of content encoding sniffing for other network requests. This will be done
1622         in subsequent commits to make it straightforward to identify site breakage (if any).
1623
1624         * loader/ResourceLoader.cpp:
1625         (WebCore::ResourceLoader::start): Pass content encoding policy.
1626         * loader/ResourceLoader.h:
1627         (WebCore::ResourceLoader::shouldSniffContentEncoding const): Added.
1628         * loader/ResourceLoaderOptions.h:
1629         * loader/appcache/ApplicationCacheGroup.cpp:
1630         (WebCore::ApplicationCacheGroup::createResourceHandle): Enable content encoding sniff to match existing behavior.
1631         * platform/network/BlobResourceHandle.cpp:
1632         (WebCore::BlobResourceHandle::BlobResourceHandle): Ditto. We should look to disable content encoding sniffing in
1633         a subsequent change.
1634         * platform/network/PingHandle.h: Ditto.
1635         * platform/network/ResourceHandle.cpp:
1636         (WebCore::ResourceHandle::ResourceHandle): Modified to take a boolean as to whether to enable content encoding sniffing.
1637         (WebCore::ResourceHandle::create): Ditto.
1638         (WebCore::ResourceHandle::shouldContentEncodingSniff const): Added.
1639         * platform/network/ResourceHandle.h:
1640         * platform/network/ResourceHandleInternal.h:
1641         (WebCore::ResourceHandleInternal::ResourceHandleInternal): Modified to take a boolean as to whether to enable content
1642         encoding sniffing.
1643         * platform/network/cf/ResourceHandleCFNet.cpp:
1644         (WebCore::ResourceHandle::createCFURLConnection): Modified to take a boolean as to whether to enable content encoding
1645         sniffing and apply this policy to the CFMutableURLRequestRef object when building on macOS 10.13.2.
1646         (WebCore::ResourceHandle::start):
1647         (WebCore::ResourceHandle::platformLoadResourceSynchronously): Enable content encoding sniff to match existing behavior.
1648         * platform/network/mac/ResourceHandleMac.mm:
1649         (WebCore::ResourceHandle::applySniffingPoliciesAndStoragePartitionIfNeeded): Added helper function to apply sniffing policies
1650         and storage partition, if applicable. 
1651         (WebCore::ResourceHandle::createNSURLConnection): Modified to take a boolean as to whether to enable content encoding
1652         sniffing. Calls adjustNSRequestApplyingPolicies() to apply this policy.
1653         (WebCore::ResourceHandle::start):
1654         (WebCore::ResourceHandle::platformLoadResourceSynchronously): Enable content encoding sniff to match existing behavior.
1655         * platform/network/soup/ResourceHandleSoup.cpp:
1656         (WebCore::ResourceHandle::create): Modified to take a boolean as to whether to enable content encoding sniffing.
1657         (WebCore::ResourceHandle::ResourceHandle): Ditto.
1658         (WebCore::ResourceHandle::releaseForDownload): Pass content encoding policy.
1659         * xml/XMLHttpRequest.cpp:
1660         (WebCore::XMLHttpRequest::createRequest): Do not enable content encoding sniffing for the request.
1661
1662 2017-11-01  Jer Noble  <jer.noble@apple.com>
1663
1664         [Performance] Painting <video> to canvas spends a lot of time in URL getting and parsing
1665         https://bugs.webkit.org/show_bug.cgi?id=179131
1666
1667         Reviewed by Eric Carlson.
1668
1669         Every time a <video> backed by MediaPlayerPrivateAVFoundation is asked to paint, it is first
1670         queried whether it has a single security origin. To do this, the media player asks
1671         AVFoundation what the "resolvedURL" of the asset is. This answer never changes after
1672         metadata is first fetched, so the answer should be cached. To do so, add a m_resolvedURL
1673         ivar to MediaPlayerPrivateAVFoundation, and add a setResolvedURL() and resolvedURLChanged()
1674         method to re-query the value. Also create ivars for the security origin rather than re-
1675         parsing them every time.
1676
1677         Drive-by fix: clean up all the instances where we pass a String rather than a URL (and thus
1678         have to re-parse the URL at each point).
1679
1680         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
1681         (WebCore::MediaPlayerPrivateAVFoundation::load):
1682         (WebCore::MediaPlayerPrivateAVFoundation::hasSingleSecurityOrigin const):
1683         (WebCore::MediaPlayerPrivateAVFoundation::setResolvedURL):
1684         (WebCore::MediaPlayerPrivateAVFoundation::metadataLoaded):
1685         (WebCore::MediaPlayerPrivateAVFoundation::setPreload):
1686         (WebCore::MediaPlayerPrivateAVFoundation::resolvedURL const): Deleted.
1687         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
1688         (WebCore::MediaPlayerPrivateAVFoundation::resolvedURL const):
1689         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
1690         (WebCore::MediaPlayerPrivateAVFoundationCF::resolvedURLChanged):
1691         (WebCore::AVFWrapper::createAssetForURL):
1692         (WebCore::MediaPlayerPrivateAVFoundationCF::resolvedURL const): Deleted.
1693         (WebCore::MediaPlayerPrivateAVFoundationCF::hasSingleSecurityOrigin const): Deleted.
1694         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h:
1695         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
1696         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1697         (WebCore::canonicalURL):
1698         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
1699         (WebCore::MediaPlayerPrivateAVFoundationObjC::sizeChanged):
1700         (WebCore::canonicalURL):
1701         (WebCore::MediaPlayerPrivateAVFoundationObjC::hasSingleSecurityOrigin const): Deleted.
1702
1703 2017-11-01  Ryosuke Niwa  <rniwa@webkit.org>
1704
1705         innerText->renderBox() can be null in HTMLTextFormControlElement::setSelectionRange
1706         https://bugs.webkit.org/show_bug.cgi?id=179103
1707
1708         Reviewed by Antti Koivisto.
1709
1710         Added a missing null check.
1711
1712         Unfortunately, no new tests since we don't have a working reproduction for trunk code.
1713
1714         * html/HTMLTextFormControlElement.cpp:
1715         (WebCore::HTMLTextFormControlElement::setSelectionRange): Added a null check.
1716
1717 2017-11-01  Brady Eidson  <beidson@apple.com>
1718
1719         Plumbing for handling SW scripts failing to evaluate
1720         https://bugs.webkit.org/show_bug.cgi?id=178926
1721
1722         Reviewed by Chris Dumez.
1723
1724         No new tests (Currently no observable behavior change).
1725
1726         In an upcoming patch we'll actually run the appropriate observable steps for when
1727         a ServiceWorker script fails to evaluate.
1728
1729         This is a standalone refactoring + plumbing patch that will make the observable changes
1730         easier to review.
1731
1732         * bindings/js/WorkerScriptController.cpp:
1733         (WebCore::WorkerScriptController::evaluate):
1734         * bindings/js/WorkerScriptController.h:
1735         (WebCore::WorkerScriptController::workerGlobalScopeWrapper):
1736         (WebCore::WorkerScriptController::vm):
1737         (WebCore::WorkerScriptController::initScriptIfNeeded):
1738
1739         * workers/WorkerMessagingProxy.cpp:
1740         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
1741
1742         * workers/WorkerThread.cpp:
1743         (WebCore::WorkerThread::start):
1744         (WebCore::WorkerThread::workerThread):
1745         * workers/WorkerThread.h:
1746
1747         * workers/service/context/SWContextManager.cpp:
1748         (WebCore::SWContextManager::registerServiceWorkerThreadForUpdate):
1749         (WebCore::SWContextManager::registerServiceWorkerThread): Deleted.
1750         * workers/service/context/SWContextManager.h:
1751
1752         * workers/service/context/ServiceWorkerThread.h:
1753         (WebCore::ServiceWorkerThread::serverConnectionIdentifier const):
1754         (WebCore::ServiceWorkerThread::contextData const):
1755
1756         * workers/service/context/ServiceWorkerThreadProxy.cpp:
1757         (WebCore::ServiceWorkerThreadProxy::create):
1758         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
1759
1760         * workers/service/server/SWServer.cpp:
1761         (WebCore::SWServer::updateWorker):
1762         (WebCore::SWServer::createWorker): Deleted.
1763         * workers/service/server/SWServer.h:
1764
1765         * workers/service/server/SWServerRegistration.cpp:
1766         (WebCore::SWServerRegistration::scriptFetchFinished):
1767         (WebCore::SWServerRegistration::scriptContextFailedToStart):
1768
1769 2017-11-01  Ryosuke Niwa  <rniwa@webkit.org>
1770
1771         Assert that NoEventDispatchAssertion is not in the stack when executing a script
1772         https://bugs.webkit.org/show_bug.cgi?id=179107
1773
1774         Reviewed by Simon Fraser.
1775
1776         Assert that NoEventDispatchAssertion::isEventAllowedInMainThread() is true when we're about to execute a script
1777         by adding the assertion in ScriptController::canExecuteScripts which gets called with AboutToExecuteScript
1778         whenever we're about to run scripts in event handlers, etc...
1779
1780         We don't assert the construction of event handlers in JSLazyEventListener since this happens while copying
1781         the DOM tree inside a SVG use element and creating a event handler's JS function won't execute arbitrary scripts.
1782
1783         No new tests since there should be no behavioral change other 
1784
1785         * bindings/js/JSLazyEventListener.cpp:
1786         (WebCore::JSLazyEventListener::initializeJSFunction const): Use newly added AboutToCreateEventListener.
1787         (WebCore::JSLazyEventListener::create): Ditto.
1788         * bindings/js/ScriptController.cpp:
1789         (WebCore::ScriptController::canExecuteScripts): Added the assertion.
1790         * bindings/js/ScriptController.h:
1791
1792 2017-11-01  Chris Dumez  <cdumez@apple.com>
1793
1794         Regression(r219659): Can no longer log into ifttt.com using Google account
1795         https://bugs.webkit.org/show_bug.cgi?id=179117
1796
1797         Reviewed by Geoffrey Garen.
1798
1799         After r219659, it is no longer possible to log into ifttt.com using a Google
1800         account:
1801         - Signed into a Google account already
1802         - Visit https://ifttt.com/login
1803         - Click "Continue with Google"
1804         - Select the signed in account
1805
1806         It turns out that this change to the HTML specification was not Web-compatible:
1807         See https://bugzilla.mozilla.org/show_bug.cgi?id=1412741 & https://github.com/whatwg/html/issues/3183
1808
1809         This patch reverts r219659 for now until we agree on what behavior should get
1810         specified.
1811
1812         No new tests, rebaselined existing tests.
1813
1814         * bindings/js/JSDOMWindowCustom.cpp:
1815         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
1816         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
1817         (WebCore::JSDOMWindow::getOwnPropertyNames):
1818         * bindings/js/JSLocationCustom.cpp:
1819         (WebCore::getOwnPropertySlotCommon):
1820         (WebCore::JSLocation::getOwnPropertyNames):
1821
1822 2017-10-31  Dean Jackson  <dino@apple.com>
1823
1824         transferFromImageBitmap should update canvas dimensions
1825         https://bugs.webkit.org/show_bug.cgi?id=179096
1826         <rdar://problem/35285218>
1827
1828         Reviewed by Sam Weinig.
1829
1830         When transferFromImageBitmap is called, the dimensions of the HTMLCanvasElement
1831         should be updated to reflect the size of the passed ImageBitmap.
1832
1833         Update an existing WPT result.
1834
1835         * html/HTMLCanvasElement.cpp:
1836         (WebCore::HTMLCanvasElement::setImageBuffer const): Update the
1837         size of the element based on the incoming buffer.
1838         * html/HTMLCanvasElement.h: Mark m_size as mutable so we can
1839         call it from the const function setImageBuffer.
1840
1841 2017-11-01  Yusuke Suzuki  <utatane.tea@gmail.com>
1842
1843         [JSC] Introduce @toObject
1844         https://bugs.webkit.org/show_bug.cgi?id=178726
1845
1846         Reviewed by Saam Barati.
1847
1848         Use @isObject instead. It is more efficient.
1849
1850         * Modules/mediastream/NavigatorUserMedia.js:
1851         (getUserMedia):
1852
1853 2017-11-01  Commit Queue  <commit-queue@webkit.org>
1854
1855         Unreviewed, rolling out r224273 and r224278.
1856         https://bugs.webkit.org/show_bug.cgi?id=179120
1857
1858         Some crashes under guard malloc (Requested by anttik on
1859         #webkit).
1860
1861         Reverted changesets:
1862
1863         "Remove empty continuations in
1864         RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers"
1865         https://bugs.webkit.org/show_bug.cgi?id=179014
1866         https://trac.webkit.org/changeset/224273
1867
1868         "Fix ContinuationChainNode::insertAfter assertion."
1869         https://bugs.webkit.org/show_bug.cgi?id=179115
1870         https://trac.webkit.org/changeset/224278
1871
1872 2017-11-01  Emilio Cobos Álvarez  <emilio@crisal.io>
1873
1874         Fix ContinuationChainNode::insertAfter assertion.
1875         https://bugs.webkit.org/show_bug.cgi?id=179115
1876
1877         Reviewed by Antti Koivisto.
1878
1879         The assertion was writing instead of reading next->previous.
1880
1881         Hopefully it's harmless because it was clobbered on the same line, but
1882         it's worth asserting what it was intending to assert.
1883
1884         No new tests (no behaviour change).
1885
1886         * rendering/RenderBoxModelObject.cpp:
1887         (WebCore::RenderBoxModelObject::ContinuationChainNode::insertAfter):
1888
1889 2017-11-01  Fujii Hironori  <Hironori.Fujii@sony.com>
1890
1891         Use LazyNeverDestroyed instead of DEFINE_GLOBAL
1892         https://bugs.webkit.org/show_bug.cgi?id=174979
1893
1894         Reviewed by Yusuke Suzuki.
1895
1896         No new tests since there should be no behavioral change.
1897
1898         * DerivedSources.cpp: Remove the warning of StaticConstructors.h.
1899         * WebCore.order: Removed
1900         * config.h: Removed definitions of SKIP_STATIC_CONSTRUCTORS_ON_MSVC and SKIP_STATIC_CONSTRUCTORS_ON_GCC.
1901         * dom/QualifiedName.cpp:
1902         (WebCore::createQualifiedName): Deleted.
1903         * dom/QualifiedName.h: Removed createQualifiedName.
1904         * dom/make_names.pl:
1905         (printCppHead): Do not include StaticConstructors.h.
1906
1907 2017-11-01  Michael Catanzaro  <mcatanzaro@igalia.com>
1908
1909         [GTK] Always include TextureMapper.cmake
1910         https://bugs.webkit.org/show_bug.cgi?id=179060
1911
1912         Reviewed by Carlos Garcia Campos.
1913
1914         * PlatformGTK.cmake:
1915
1916 2017-11-01  Antti Koivisto  <antti@apple.com>
1917
1918         Remove empty continuations in RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers
1919         https://bugs.webkit.org/show_bug.cgi?id=179014
1920
1921         Reviewed by Geoff Garen.
1922
1923         Treat continuation similarly to other anonymous wrappers. This makes things more understandable
1924         and allows removal of some questionable code in RenderBlock::takeChild.
1925
1926         The patch also makes continuation chain a double linked so we can efficiently remove single
1927         continuations from the chain. It also gets rid of algorithms that recurse in continuation chain.
1928
1929         * accessibility/AccessibilityRenderObject.cpp:
1930         (WebCore::firstChildInContinuation):
1931         * rendering/RenderBlock.cpp:
1932         (WebCore::RenderBlock::styleDidChange):
1933
1934             Don't add and remove continuations from the chain when updating style. Prevent recursion by walking
1935             the chain only in the (non-continuation) head renderer.
1936
1937         (WebCore::RenderBlock::dropAnonymousBoxChild):
1938
1939             Make a member function.
1940
1941         (WebCore::RenderBlock::takeChild):
1942
1943             Remove code that destroyed empty continuations and caused the parent to destroy itself.
1944             Empty continuations are now removed by RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers.
1945
1946         * rendering/RenderBlock.h:
1947         * rendering/RenderBoxModelObject.cpp:
1948         (WebCore::RenderBoxModelObject::ContinuationChainNode::ContinuationChainNode):
1949         (WebCore::RenderBoxModelObject::ContinuationChainNode::~ContinuationChainNode):
1950         (WebCore::RenderBoxModelObject::ContinuationChainNode::insertAfter):
1951
1952             Track continuations with double linked lists.
1953
1954         (WebCore::continuationChainNodeMap):
1955         (WebCore::RenderBoxModelObject::willBeDestroyed):
1956
1957             Don't recurse to destroy continuation chain. 
1958             Destroy all continuations iteratively if this is the head of the chain.
1959             When destroying a continuation renderer simply remove it from the chain.
1960
1961         (WebCore::RenderBoxModelObject::continuation const):
1962         (WebCore::RenderBoxModelObject::insertIntoContinuationChainAfter):
1963         (WebCore::RenderBoxModelObject::removeFromContinuationChain):
1964         (WebCore::RenderBoxModelObject::ensureContinuationChainNode):
1965         (WebCore::continuationMap): Deleted.
1966         (WebCore::RenderBoxModelObject::setContinuation): Deleted.
1967         * rendering/RenderBoxModelObject.h:
1968         * rendering/RenderElement.cpp:
1969         (WebCore::RenderElement::RenderElement):
1970         (WebCore::RenderElement::removeAnonymousWrappersForInlinesIfNecessary):
1971
1972             Make this a function of the parent renderer itself instead of getting 'parent()' as first operation and
1973             then using it.
1974             Don't remove continuations (isAnonymousBlockContinuation() test gives wrong result for the last continuation of the chain).
1975
1976         (WebCore::RenderElement::styleDidChange):
1977
1978             removeAnonymousWrappersForInlinesIfNecessary is no function of the parent.
1979
1980         (WebCore::RenderElement::updateOutlineAutoAncestor):
1981         * rendering/RenderElement.h:
1982         (WebCore::RenderElement::hasContinuationChainNode const):
1983         (WebCore::RenderElement::setHasContinuationChainNode):
1984         (WebCore::RenderElement::hasContinuation const): Deleted.
1985         (WebCore::RenderElement::setHasContinuation): Deleted.
1986         * rendering/RenderInline.cpp:
1987         (WebCore::RenderInline::styleDidChange):
1988
1989             Don't add and remove continuations from the chain when updating style. Prevent recursion by walking
1990             the chain only in the (non-continuation) head renderer.
1991
1992         (WebCore::RenderInline::addChildIgnoringContinuation):
1993
1994             Remove the old continuation from the chain. splitFlow() will add it back into the right place.
1995
1996         (WebCore::RenderInline::splitInlines):
1997         (WebCore::RenderInline::addChildToContinuation):
1998         (WebCore::RenderInline::childBecameNonInline):
1999
2000             Remove the old continuation from the chain. splitFlow() will add it back into the right place.
2001
2002         * rendering/RenderInline.h:
2003         * rendering/RenderObject.cpp:
2004         (WebCore::RenderObject::propagateRepaintToParentWithOutlineAutoIfNeeded const):
2005         (WebCore::RenderObject::outputRenderObject const):
2006         (WebCore::findDestroyRootIncludingAnonymous):
2007
2008             Allow anonymous continuations as destroy roots.
2009
2010         (WebCore::RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
2011
2012             Removing a continuation may leave behind unnecessary anonymous sibling wrappers.
2013             Call removeAnonymousWrappersForInlinesIfNecessary() on parent after removal to get rid of them.
2014
2015 2017-10-31  Said Abou-Hallawa  <sabouhallawa@apple.com>
2016
2017         updateMaskedAncestorShouldIsolateBlending() should check the Nullability of the computedStyle() of the element's ancestors
2018         https://bugs.webkit.org/show_bug.cgi?id=179085
2019         <rdar://problem/30888101>
2020
2021         Reviewed by Ryosuke Niwa.
2022
2023         This is a defensive change. The Element::computedStyle() can be null only
2024         if the element is not a connected to the DOM tree. This may happen if
2025         while the DOM tree is being changed, a different event is handled such
2026         that it requires styleReclac()/layout() to happen. In this case, the render
2027         tree will be in an incorrect state.
2028
2029         * rendering/svg/SVGRenderSupport.cpp:
2030         (WebCore::SVGRenderSupport::updateMaskedAncestorShouldIsolateBlending):
2031
2032 2017-10-31  Alex Christensen  <achristensen@webkit.org>
2033
2034         Use asynchronous ResourceHandleClient calls for WebKit1
2035         https://bugs.webkit.org/show_bug.cgi?id=160677
2036
2037         Reviewed by Brady Eidson.
2038
2039         Covered by existing tests.
2040
2041         * PlatformAppleWin.cmake:
2042         * PlatformMac.cmake:
2043         * WebCore.xcodeproj/project.pbxproj:
2044         * loader/ResourceLoader.cpp:
2045         (WebCore::ResourceLoader::willSendRequestAsync):
2046         (WebCore::ResourceLoader::didReceiveResponseAsync):
2047         (WebCore::ResourceLoader::canAuthenticateAgainstProtectionSpaceAsync):
2048         * loader/ResourceLoader.h:
2049         * loader/appcache/ApplicationCacheGroup.cpp:
2050         (WebCore::ApplicationCacheGroup::didReceiveResponseAsync):
2051         (WebCore::ApplicationCacheGroup::willSendRequestAsync):
2052         (WebCore::ApplicationCacheGroup::canAuthenticateAgainstProtectionSpaceAsync):
2053         (WebCore::ApplicationCacheGroup::didReceiveResponse): Deleted.
2054         * loader/appcache/ApplicationCacheGroup.h:
2055         * platform/network/BlobResourceHandle.cpp:
2056         (WebCore::BlobResourceHandle::continueDidReceiveResponse):
2057         (WebCore::BlobResourceHandle::getSizeForNext):
2058         (WebCore::BlobResourceHandle::notifyResponseOnSuccess):
2059         (WebCore::BlobResourceHandle::notifyResponseOnError):
2060         * platform/network/PingHandle.h:
2061         * platform/network/ResourceHandle.cpp:
2062         (WebCore::ResourceHandle::didReceiveResponse):
2063         (WebCore::ResourceHandle::usesAsyncCallbacks): Deleted.
2064         * platform/network/ResourceHandle.h:
2065         * platform/network/ResourceHandleClient.cpp:
2066         (WebCore::ResourceHandleClient::~ResourceHandleClient):
2067         (WebCore::ResourceHandleClient::willSendRequest): Deleted.
2068         (WebCore::ResourceHandleClient::willSendRequestAsync): Deleted.
2069         (WebCore::ResourceHandleClient::didReceiveResponseAsync): Deleted.
2070         (WebCore::ResourceHandleClient::canAuthenticateAgainstProtectionSpaceAsync): Deleted.
2071         * platform/network/ResourceHandleClient.h:
2072         (WebCore::ResourceHandleClient::didReceiveAuthenticationChallenge):
2073         (WebCore::ResourceHandleClient::didReceiveResponse): Deleted.
2074         (WebCore::ResourceHandleClient::usesAsyncCallbacks): Deleted.
2075         (WebCore::ResourceHandleClient::canAuthenticateAgainstProtectionSpace): Deleted.
2076         * platform/network/ResourceHandleInternal.h:
2077         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
2078         * platform/network/SynchronousLoaderClient.cpp:
2079         (WebCore::SynchronousLoaderClient::willSendRequestAsync):
2080         (WebCore::SynchronousLoaderClient::canAuthenticateAgainstProtectionSpaceAsync):
2081         (WebCore::SynchronousLoaderClient::didReceiveResponseAsync):
2082         (WebCore::SynchronousLoaderClient::didFinishLoading):
2083         (WebCore::SynchronousLoaderClient::didFail):
2084         (WebCore::SynchronousLoaderClient::willSendRequest): Deleted.
2085         (WebCore::SynchronousLoaderClient::canAuthenticateAgainstProtectionSpace): Deleted.
2086         (WebCore::SynchronousLoaderClient::didReceiveResponse): Deleted.
2087         * platform/network/SynchronousLoaderClient.h:
2088         * platform/network/cf/ResourceHandleCFNet.cpp:
2089         (WebCore::ResourceHandle::createCFURLConnection):
2090         (WebCore::ResourceHandle::start):
2091         (WebCore::ResourceHandle::willSendRequest):
2092         (WebCore::ResourceHandle::shouldUseCredentialStorage):
2093         (WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace):
2094         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
2095         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
2096         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::ResourceHandleCFURLConnectionDelegateWithOperationQueue):
2097         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::releaseHandle):
2098         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest):
2099         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
2100         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveData):
2101         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading):
2102         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFail):
2103         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse):
2104         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveChallenge):
2105         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didSendBodyData):
2106         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::shouldUseCredentialStorage):
2107         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
2108         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueCanAuthenticateAgainstProtectionSpace):
2109         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h:
2110         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp: Removed.
2111         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h: Removed.
2112         * platform/network/mac/ResourceHandleMac.mm:
2113         (WebCore::ResourceHandle::start):
2114         (WebCore::ResourceHandle::schedule):
2115         (WebCore::ResourceHandle::makeDelegate):
2116         (WebCore::ResourceHandle::delegate):
2117         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
2118         (WebCore::ResourceHandle::willSendRequest):
2119         (WebCore::ResourceHandle::continueWillSendRequest):
2120         (WebCore::ResourceHandle::continueDidReceiveResponse):
2121         (WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace):
2122         (WebCore::ResourceHandle::continueCanAuthenticateAgainstProtectionSpace):
2123         (WebCore::ResourceHandle::continueWillCacheResponse):
2124         (WebCore::ResourceHandle::shouldUseCredentialStorage): Deleted.
2125         * platform/network/mac/WebCoreResourceHandleAsDelegate.h: Removed.
2126         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm: Removed.
2127         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
2128         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
2129         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
2130         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveAuthenticationChallenge:]):
2131         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
2132         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
2133         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveData:lengthReceived:]):
2134         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:]):
2135         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didFailWithError:]):
2136         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
2137
2138 2017-10-31  Simon Fraser  <simon.fraser@apple.com>
2139
2140         Rubber-banding overflow-scrolling-touch shows black
2141         https://bugs.webkit.org/show_bug.cgi?id=179087
2142         rdar://problem/35260253
2143
2144         Reviewed by Sam Weinig.
2145
2146         The "backgroundIsKnownToBeObscured" optimization was kicking in for an overflow:scroll
2147         whose area was completely covered by its contents, which happens with overlay scrollbars.
2148
2149         However, this ignored the fact that you can rubber-band to reveal the background, and,
2150         on iOS, composited scrolling requires that the scroller background is painted since it goes
2151         into its own layer.
2152
2153         Fix by turning off the optimization for layers that scroll overflow, including those
2154         using composited scrolling.
2155
2156         Test: fast/scrolling/rubber-band-shows-background.html
2157
2158         * rendering/RenderBox.cpp:
2159         (WebCore::RenderBox::foregroundIsKnownToBeOpaqueInRect const):
2160         (WebCore::RenderBox::computeBackgroundIsKnownToBeObscured):
2161         * rendering/RenderLayer.cpp:
2162         (WebCore::RenderLayer::scrollTo):
2163         (WebCore::RenderLayer::calculateClipRects const):
2164         * rendering/RenderLayer.h:
2165
2166 2017-10-31  Tim Horton  <timothy_horton@apple.com>
2167
2168         Clean up some drag and drop feature flags
2169         https://bugs.webkit.org/show_bug.cgi?id=179082
2170
2171         Reviewed by Simon Fraser.
2172
2173         * Configurations/FeatureDefines.xcconfig:
2174
2175 2017-10-31  Simon Fraser  <simon.fraser@apple.com>
2176
2177         Make it possible to test rubber-banding in overflow scroll
2178         https://bugs.webkit.org/show_bug.cgi?id=179078
2179
2180         Reviewed by Sam Weinig.
2181
2182         Test: fast/scrolling/unconstrained-scrollto.html
2183         
2184         Add internals.unconstrainedScrollTo(element, x, y) and plumb through ScrollClamping
2185         (which replaces RenderLayer::ScrollOffsetClamping) to support it.
2186
2187         Flip the default from unclamped to clamped for various RenderLayer scrolling-related
2188         functions, since most callers want clamped.
2189
2190         * accessibility/AccessibilityRenderObject.cpp:
2191         (WebCore::AccessibilityRenderObject::scrollTo const):
2192         * dom/Element.cpp:
2193         (WebCore::Element::scrollTo):
2194         * dom/Element.h:
2195         * html/HTMLBodyElement.cpp:
2196         (WebCore::HTMLBodyElement::scrollTo):
2197         * html/HTMLBodyElement.h:
2198         * html/TextFieldInputType.cpp:
2199         (WebCore::TextFieldInputType::elementDidBlur):
2200         * page/DOMWindow.cpp:
2201         (WebCore::DOMWindow::scrollTo const):
2202         * page/DOMWindow.h:
2203         * page/Frame.cpp:
2204         (WebCore::Frame::scrollOverflowLayer):
2205         (WebCore::Frame::checkOverflowScroll):
2206         * platform/ScrollAnimator.cpp:
2207         (WebCore::ScrollAnimator::scrollToOffsetWithoutAnimation):
2208         * platform/ScrollAnimator.h:
2209         * platform/ScrollTypes.h:
2210         * platform/ScrollableArea.cpp:
2211         (WebCore::ScrollableArea::scrollToOffsetWithoutAnimation):
2212         * platform/ScrollableArea.h:
2213         * platform/cocoa/ScrollController.h:
2214         * platform/mac/ScrollAnimatorMac.h:
2215         * platform/mac/ScrollAnimatorMac.mm:
2216         (WebCore::ScrollAnimatorMac::scrollToOffsetWithoutAnimation):
2217         (WebCore::ScrollAnimatorMac::immediateScrollToPosition):
2218         * platform/mock/ScrollAnimatorMock.h:
2219         * rendering/RenderBox.cpp:
2220         (WebCore::RenderBox::setScrollLeft):
2221         (WebCore::RenderBox::setScrollTop):
2222         * rendering/RenderBox.h:
2223         * rendering/RenderLayer.cpp:
2224         (WebCore::RenderLayer::panScrollFromPoint):
2225         (WebCore::RenderLayer::scrollByRecursively):
2226         (WebCore::RenderLayer::applyPostLayoutScrollPositionIfNeeded):
2227         (WebCore::RenderLayer::scrollToXPosition):
2228         (WebCore::RenderLayer::scrollToYPosition):
2229         (WebCore::RenderLayer::scrollToOffset):
2230         * rendering/RenderLayer.h:
2231         * rendering/RenderListBox.cpp:
2232         (WebCore::RenderListBox::setScrollLeft):
2233         (WebCore::RenderListBox::setScrollTop):
2234         * rendering/RenderListBox.h:
2235         * rendering/RenderTextControlSingleLine.cpp:
2236         (WebCore::RenderTextControlSingleLine::setScrollLeft):
2237         (WebCore::RenderTextControlSingleLine::setScrollTop):
2238         * rendering/RenderTextControlSingleLine.h:
2239         * testing/Internals.cpp:
2240         (WebCore::Internals::unconstrainedScrollTo):
2241         * testing/Internals.h:
2242         * testing/Internals.idl:
2243
2244 2017-10-31  Dean Jackson  <dino@apple.com>
2245
2246         Accept Settings object in ImageBitmapRenderingContext constructor and getContext
2247         https://bugs.webkit.org/show_bug.cgi?id=179075
2248         <rdar://problem/35279965>
2249
2250         Reviewed by Sam Weinig.
2251
2252         Allow getContext("bitmaprenderer") to take a dictionary as another argument, and
2253         pass that on to the ImageBitmapRenderingContext constructor.
2254
2255         Unfortunately this meant having to move ImageBitmapRenderingContext::Settings out into
2256         a stand-alone struct, since it needs to be defined in HTMLCanvasElement, which itself
2257         needs to be defined for ImageBitmapRenderingContext.
2258
2259         * DerivedSources.make: Add new IDL.
2260         * WebCore.xcodeproj/project.pbxproj: New files.
2261
2262         * html/HTMLCanvasElement.cpp:
2263         (WebCore::HTMLCanvasElement::createContextBitmapRenderer):
2264         (WebCore::HTMLCanvasElement::getContextBitmapRenderer):
2265
2266             Accept the ImageBitmapRenderingContextSettings object, and pass it on.
2267
2268         * html/HTMLCanvasElement.h:
2269         * html/canvas/ImageBitmapRenderingContext.cpp:
2270         (WebCore::ImageBitmapRenderingContext::ImageBitmapRenderingContext):
2271         * html/canvas/ImageBitmapRenderingContext.h:
2272         * html/canvas/ImageBitmapRenderingContext.idl:
2273         * html/canvas/ImageBitmapRenderingContextSettings.h: Copied from Source/WebCore/html/canvas/ImageBitmapRenderingContext.idl.
2274         * html/canvas/ImageBitmapRenderingContextSettings.idl: Added.
2275
2276 2017-10-31  Tim Horton  <timothy_horton@apple.com>
2277
2278         Fix up some content filtering feature flags
2279         https://bugs.webkit.org/show_bug.cgi?id=179079
2280
2281         Reviewed by Simon Fraser.
2282
2283         * Configurations/FeatureDefines.xcconfig:
2284
2285 2017-10-31  Chris Dumez  <cdumez@apple.com>
2286
2287         navigator.serviceWorker should always return the same object
2288         https://bugs.webkit.org/show_bug.cgi?id=179067
2289
2290         Reviewed by Youenn Fablet.
2291
2292         navigator.serviceWorker should always return the same object:
2293         - https://www.w3.org/TR/service-workers-1/#navigator-service-worker
2294
2295         Add visitor to make sure we don't gc() the ServiceWorkerContainer wrapper too early.
2296
2297         Test: http/tests/workers/service/navigator-serviceWorker-same-object.html
2298
2299         * Sources.txt:
2300         * WebCore.xcodeproj/project.pbxproj:
2301         * bindings/js/JSNavigatorCustom.cpp: Copied from Source/WebCore/workers/service/ServiceWorkerContainer.idl.
2302         (WebCore::JSNavigator::visitAdditionalChildren):
2303         * page/Navigator.idl:
2304         * workers/service/ServiceWorkerContainer.idl:
2305
2306 2017-10-31  Antoine Quint  <graouts@apple.com>
2307
2308         [Web Animations] Support AnimationEffect parameter in Animation constructor and read-write timeline property
2309         https://bugs.webkit.org/show_bug.cgi?id=179066
2310
2311         Reviewed by Dean Jackson.
2312
2313         We update the Animation constructor signature and behavior to allow for an AnimationEffect as its first,
2314         null by default, parameter and implement the spec behavior where an omitted AnimationTimeline parameter
2315         should default to the document timeline. We also make the timeline property read-write.
2316
2317         Existing tests are rebaselined and amended for this new behavior.
2318
2319         * animation/WebAnimation.cpp:
2320         (WebCore::WebAnimation::create):
2321         (WebCore::WebAnimation::WebAnimation):
2322         (WebCore::WebAnimation::setEffect):
2323         (WebCore::WebAnimation::setTimeline):
2324         * animation/WebAnimation.h:
2325         * animation/WebAnimation.idl:
2326
2327 2017-10-31  Ali Juma  <ajuma@chromium.org>
2328
2329         Layout viewport rect is too wide after window resize
2330         https://bugs.webkit.org/show_bug.cgi?id=175235
2331
2332         Reviewed by Dave Hyatt.
2333
2334         After a window resize, ScrollView::updateScrollbars adds/removes scrollbars and triggers
2335         layout. Each addition or removal triggers another pass, but at most 2 additional passes
2336         are allowed. If a scrollbar is added or removed in the final allowed pass, layout is
2337         left in an inconsistent state wrt the presence of scrollbars.
2338
2339         To avoid unnecessary passes, don't remove both scrollbars when only one needs to be
2340         removed. This saves the extra pass needed to add the scrollbar back.
2341
2342         Test: fast/dom/Window/window-resize-update-scrollbars.html
2343
2344         * platform/ScrollView.cpp:
2345         (WebCore::ScrollView::updateScrollbars):
2346
2347 2017-10-31  Wenson Hsieh  <wenson_hsieh@apple.com>
2348
2349         [Attachment Support] Implement WKWebView SPI for inserting attachment elements
2350         https://bugs.webkit.org/show_bug.cgi?id=179013
2351         <rdar://problem/35249668>
2352
2353         Reviewed by Tim Horton.
2354
2355         Adds Editor helper methods to insert an attachment element at the current selection.
2356
2357         Test: WKAttachmentTests.AttachmentElementInsertion
2358
2359         * editing/Editor.cpp:
2360         (WebCore::Editor::insertAttachment):
2361         (WebCore::Editor::insertAttachmentFromFile):
2362         * editing/Editor.h:
2363
2364         Add two new helpers for inserting attachment elements, either from a filename or a data blob. This is a wrapper
2365         around Editor::replaceSelectionWithFragment.
2366
2367         * html/HTMLAttachmentElement.cpp:
2368         (WebCore::HTMLAttachmentElement::HTMLAttachmentElement):
2369         (WebCore::HTMLAttachmentElement::create):
2370         * html/HTMLAttachmentElement.h:
2371
2372         Add a unique identifier string to HTMLAttachmentElement. This unique identifier allows the UI process to
2373         reference and indirectly manipulate attachment elements.
2374
2375 2017-10-31  Alex Christensen  <achristensen@webkit.org>
2376
2377         Fix custom header field setting with reloads and asynchronous navigation action policy decisions
2378         https://bugs.webkit.org/show_bug.cgi?id=179064
2379
2380         Reviewed by Tim Horton.
2381
2382         r223909 had two problems:
2383         1. It called addHTTPHeaderField instead of setHTTPHeaderField, so when a page is reloaded the header field
2384         is added to the resource request to be reloaded, which already had the headers added.
2385         2. It only worked in the synchronous decidePolicyForNavigationAction code path, not for asynchronous completion handlers.
2386
2387         These are both fixed, and both cases are covered with new API tests.
2388
2389         * loader/cache/CachedResourceLoader.cpp:
2390         (WebCore::CachedResourceLoader::requestResource):
2391
2392 2017-10-31  Devin Rousso  <webkit@devinrousso.com>
2393
2394         Web Inspector: make ScriptCallStack::maxCallStackSizeToCapture the default value when capturing backtraces
2395         https://bugs.webkit.org/show_bug.cgi?id=179048
2396
2397         Reviewed by Mark Lam.
2398
2399         No change in functionality.
2400
2401         * bindings/js/JSDOMExceptionHandling.cpp:
2402         (WebCore::reportException):
2403         * dom/RejectedPromiseTracker.cpp:
2404         (WebCore::createScriptCallStackFromReason):
2405         * html/canvas/WebGLRenderingContextBase.cpp:
2406         (WebCore::WebGLRenderingContextBase::compileShader):
2407         (WebCore::WebGLRenderingContextBase::printToConsole):
2408         * inspector/InspectorNetworkAgent.cpp:
2409         (WebCore::InspectorNetworkAgent::buildInitiatorObject):
2410         * inspector/PageDebuggerAgent.cpp:
2411         (WebCore::PageDebuggerAgent::breakpointActionLog):
2412         * inspector/WorkerDebuggerAgent.cpp:
2413         (WebCore::WorkerDebuggerAgent::breakpointActionLog):
2414         * page/DOMWindow.cpp:
2415         (WebCore::DOMWindow::postMessage):
2416
2417 2017-10-31  Michael Catanzaro  <mcatanzaro@igalia.com>
2418
2419         [GTK] Build more files under WebCore as unified sources
2420         https://bugs.webkit.org/show_bug.cgi?id=178968
2421
2422         Reviewed by Keith Miller.
2423
2424         * PlatformGTK.cmake:
2425         * PlatformWPE.cmake:
2426         * SourcesGTK.txt: Added.
2427         * SourcesWPE.txt:
2428
2429 2017-10-30  Ryosuke Niwa  <rniwa@webkit.org>
2430
2431         Assert that no script is executed during LayoutPhase::InRenderTreeLayout
2432         https://bugs.webkit.org/show_bug.cgi?id=179046
2433
2434         Reviewed by Antti Koivisto.
2435
2436         Added NoEventDispatchAssertion to LayoutPhase::InRenderTreeLayout.
2437
2438         * page/LayoutContext.cpp:
2439         (WebCore::LayoutContext::layout):
2440
2441 2017-10-31  Devin Rousso  <webkit@devinrousso.com>
2442
2443         Web Inspector: replace Canvas stack iteration with createScriptCallStack
2444         https://bugs.webkit.org/show_bug.cgi?id=178980
2445
2446         Reviewed by Joseph Pecoraro.
2447
2448         No new tests, updated existing tests.
2449
2450         * inspector/InspectorCanvas.cpp:
2451         (WebCore::InspectorCanvas::buildObjectForCanvas):
2452         (WebCore::InspectorCanvas::buildAction):
2453         (WebCore::iterateCallFrames): Deleted.
2454
2455 2017-10-31  Carlos Garcia Campos  <cgarcia@igalia.com>
2456
2457         [FreeType] Simple and complex paths are not applied consistently
2458         https://bugs.webkit.org/show_bug.cgi?id=177601
2459
2460         Reviewed by Michael Catanzaro.
2461
2462         Due to bug #100050, when rendering text, the complex path is forced in case kerning or shaping is enabled and
2463         only part of the run is going to be rendered. This happens in the GTK+ port when selecting text (except when
2464         selecting the whole run, of course). The text is initially rendered using the simple path as returned by
2465         FontCascade::codePath() and then the selection is rendered using the complex path, overriding what
2466         FontCascade::codePath() returned in that case. This doesn't happen in mac, because the selection is rendered
2467         differently, so FontCascade::drawText always renders the full run (simple path) when selecting text. Selecting
2468         text is the most noticeable inconsistency, but it's not the only one. Similar exceptions are applied when
2469         calculating the text width, or getting the offset of a given position. The rendered text is the simple one, but
2470         the calculations are performed using the complex path, so depending on the kerning and ligatures we might end up
2471         with wrong results. If the text has been rendered using the simple path, the selections and all other
2472         calculations should be performed with the simple path too. This patch moves the condition to force complex text
2473         to FontCascade::codePath(), and only for non Freetype ports. This ensures that all callers to
2474         FontCascade::codePath() will get a consistent result.
2475
2476         * platform/graphics/FontCascade.cpp:
2477         (WebCore::FontCascade::drawText const): Use the mode returned by codePath().
2478         (WebCore::FontCascade::drawEmphasisMarks const): Ditto.
2479         (WebCore::FontCascade::adjustSelectionRectForText const): Use the mode returned by codePath().
2480         (WebCore::FontCascade::offsetForPosition const): Ditto.
2481         (WebCore::FontCascade::codePath const): Force complex text for partial runs for ports not enabling advance text
2482         rendering mode by default.
2483         * platform/graphics/FontCascade.h: Add to and from optional parameters to codePath().
2484
2485 2017-10-30  Chris Dumez  <cdumez@apple.com>
2486
2487         Fire updatefound event after resolving the registration promise
2488         https://bugs.webkit.org/show_bug.cgi?id=178985
2489
2490         Reviewed by Youenn Fablet.
2491
2492         Fake series of events that are supposed to happen after registering a service worker
2493         that notify the page of the service worker's installation and activation.
2494
2495         Also make sure that registration.installing / waiting / active return proper values.
2496         Make sure that serviceWorker.scriptURL returns a proper value.
2497
2498         This unblocks a lot of web-platform-tests since they were blocked shortly after
2499         registration due to missing events or registration.installing being null.
2500
2501         * dom/ScriptExecutionContext.cpp:
2502         (WebCore::ScriptExecutionContext::activeServiceWorker const):
2503         (WebCore::ScriptExecutionContext::setActiveServiceWorker):
2504         * dom/ScriptExecutionContext.h:
2505         * loader/WorkerThreadableLoader.cpp:
2506         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
2507         * loader/cache/CachedResourceLoader.cpp:
2508         (WebCore::CachedResourceLoader::prepareFetch):
2509         * workers/WorkerScriptLoader.cpp:
2510         (WebCore::WorkerScriptLoader::loadSynchronously):
2511         (WebCore::WorkerScriptLoader::loadAsynchronously):
2512         * workers/service/ServiceWorker.cpp:
2513         (WebCore::ServiceWorker::ServiceWorker):
2514         (WebCore::ServiceWorker::setState):
2515         * workers/service/ServiceWorker.h:
2516         * workers/service/ServiceWorkerContainer.cpp:
2517         (WebCore::ServiceWorkerContainer::controller const):
2518         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
2519         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
2520         * workers/service/ServiceWorkerContainer.h:
2521         * workers/service/ServiceWorkerRegistration.cpp:
2522         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
2523         (WebCore::ServiceWorkerRegistration::~ServiceWorkerRegistration):
2524         (WebCore::ServiceWorkerRegistration::installing):
2525         (WebCore::ServiceWorkerRegistration::waiting):
2526         (WebCore::ServiceWorkerRegistration::active):
2527         * workers/service/ServiceWorkerRegistration.h:
2528         * workers/service/ServiceWorkerRegistrationData.cpp:
2529         (WebCore::ServiceWorkerRegistrationData::isolatedCopy const):
2530         * workers/service/ServiceWorkerRegistrationData.h:
2531         (WebCore::ServiceWorkerRegistrationData::encode const):
2532         (WebCore::ServiceWorkerRegistrationData::decode):
2533         * workers/service/server/SWClientConnection.cpp:
2534         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
2535         * workers/service/server/SWServerRegistration.cpp:
2536         (WebCore::SWServerRegistration::scriptContextStarted):
2537         (WebCore::SWServerRegistration::runRegisterJob):
2538         (WebCore::SWServerRegistration::data const):
2539         * workers/service/server/SWServerRegistration.h:
2540
2541 2017-10-30  Fujii Hironori  <Hironori.Fujii@sony.com>
2542
2543         Use LazyNeverDestroyed instead of DEFINE_GLOBAL for XMLNames, HTMLNames, MathMLNames and SVGNames
2544         https://bugs.webkit.org/show_bug.cgi?id=175118
2545
2546         Reviewed by Alex Christensen.
2547
2548         Stop using DEFINE_GLOBAL hack in favor of LazyNeverDestroyed.
2549
2550         No new tests since there should be no behavioral change.
2551
2552         * dom/make_names.pl:
2553         (printConstructors):
2554         (printNamesHeaderFile):
2555         (printNamesCppFile):
2556         (printDefinitions):
2557         * accessibility/AccessibilityRenderObject.cpp:
2558         (WebCore::AccessibilityRenderObject::inheritsPresentationalRole const):
2559         * css/StyleResolver.cpp:
2560         (WebCore::hasEffectiveDisplayNoneForDisplayContents):
2561         * dom/CustomElementReactionQueue.cpp:
2562         (WebCore::CustomElementReactionQueue::observesStyleAttribute const):
2563         * dom/Document.cpp:
2564         (WebCore::Document::validateCustomElementName):
2565         * dom/Element.cpp:
2566         (WebCore::isStyleAttribute):
2567         (WebCore::canAttachAuthorShadowRoot):
2568         * dom/ElementData.cpp:
2569         (WebCore::ElementData::findLanguageAttribute const):
2570         * domjit/JSDocumentDOMJIT.cpp:
2571         (WebCore::compileDocumentBodyAttribute):
2572         * editing/Editor.cpp:
2573         (WebCore::Editor::applyEditingStyleToBodyElement const):
2574         * editing/EditorCommand.cpp:
2575         (WebCore::valueDefaultParagraphSeparator):
2576         * editing/MarkupAccumulator.cpp:
2577         (WebCore::MarkupAccumulator::serializeNodesWithNamespaces):
2578         (WebCore::MarkupAccumulator::appendNamespace):
2579         (WebCore::MarkupAccumulator::elementCannotHaveEndTag):
2580         * editing/ReplaceSelectionCommand.cpp:
2581         (WebCore::isProhibitedParagraphChild):
2582         * html/HTMLBodyElement.cpp:
2583         (WebCore::HTMLBodyElement::createWindowEventHandlerNameMap):
2584         * html/HTMLDocument.cpp:
2585         (WebCore::HTMLDocument::isCaseSensitiveAttribute):
2586         * html/HTMLElement.cpp:
2587         (WebCore::HTMLElement::createEventHandlerNameMap):
2588         * html/parser/HTMLConstructionSite.cpp:
2589         (WebCore::HTMLConstructionSite::findFosterSite):
2590         * html/parser/HTMLElementStack.cpp:
2591         (WebCore::HTMLElementStack::hasTemplateInHTMLScope const):
2592         * html/parser/HTMLPreloadScanner.cpp:
2593         (WebCore::TokenPreloadScanner::updatePredictedBaseURL):
2594         * html/parser/HTMLTreeBuilder.cpp:
2595         (WebCore::HTMLTreeBuilder::processFakePEndTagIfPInButtonScope):
2596         (WebCore::HTMLTreeBuilder::processStartTagForInBody):
2597         (WebCore::HTMLTreeBuilder::processTemplateEndTag):
2598         (WebCore::HTMLTreeBuilder::processEndOfFileForInTemplateContents):
2599         (WebCore::HTMLTreeBuilder::processStartTag):
2600         (WebCore::HTMLTreeBuilder::processBodyEndTagForInBody):
2601         (WebCore::HTMLTreeBuilder::processEndTagForInBody):
2602         (WebCore::HTMLTreeBuilder::processCaptionEndTagForInCaption):
2603         (WebCore::HTMLTreeBuilder::processTableEndTagForInTable):
2604         (WebCore::HTMLTreeBuilder::processEndTag):
2605         (WebCore::HTMLTreeBuilder::insertPhoneNumberLink):
2606         (WebCore::HTMLTreeBuilder::defaultForBeforeHTML):
2607         (WebCore::HTMLTreeBuilder::defaultForBeforeHead):
2608         (WebCore::HTMLTreeBuilder::defaultForInHead):
2609         (WebCore::HTMLTreeBuilder::defaultForInHeadNoscript):
2610         (WebCore::HTMLTreeBuilder::defaultForAfterHead):
2611         * html/parser/TextDocumentParser.cpp:
2612         (WebCore::TextDocumentParser::insertFakePreElement):
2613         * rendering/svg/SVGPathData.cpp:
2614         (WebCore::pathFromGraphicsElement):
2615         * rendering/svg/SVGResources.cpp:
2616         (WebCore::clipperFilterMaskerTags):
2617         (WebCore::markerTags):
2618         (WebCore::fillAndStrokeTags):
2619         (WebCore::chainableResourceTags):
2620         * svg/SVGAnimatedBoolean.h:
2621         * svg/SVGAnimatedEnumeration.h:
2622         * svg/SVGAnimatedInteger.h:
2623         * svg/SVGAnimatedLength.h:
2624         * svg/SVGAnimatedLengthList.h:
2625         * svg/SVGAnimatedNumber.h:
2626         * svg/SVGAnimatedNumberList.h:
2627         * svg/SVGAnimatedPreserveAspectRatio.h:
2628         * svg/SVGAnimatedRect.h:
2629         * svg/SVGAnimatedString.h:
2630         * svg/SVGAnimatedTransformList.h:
2631         * svg/SVGAnimationElement.cpp:
2632         (WebCore::SVGAnimationElement::isSupportedAttribute):
2633         * svg/SVGCursorElement.cpp:
2634         (WebCore::SVGCursorElement::isSupportedAttribute):
2635         * svg/SVGElement.cpp:
2636         (WebCore::createAttributeNameToCSSPropertyIDMap):
2637         (WebCore::SVGElement::childShouldCreateRenderer const):
2638         (WebCore::SVGElement::animatableAttributeForName):
2639         * svg/SVGFilterElement.cpp:
2640         (WebCore::SVGFilterElement::isSupportedAttribute):
2641         * svg/SVGFilterPrimitiveStandardAttributes.cpp:
2642         (WebCore::SVGFilterPrimitiveStandardAttributes::isSupportedAttribute):
2643         * svg/SVGForeignObjectElement.cpp:
2644         (WebCore::SVGForeignObjectElement::isSupportedAttribute):
2645         * svg/SVGGradientElement.cpp:
2646         (WebCore::SVGGradientElement::isSupportedAttribute):
2647         * svg/SVGImageElement.cpp:
2648         (WebCore::SVGImageElement::isSupportedAttribute):
2649         * svg/SVGLineElement.cpp:
2650         (WebCore::SVGLineElement::isSupportedAttribute):
2651         * svg/SVGMarkerElement.cpp:
2652         (WebCore::SVGMarkerElement::isSupportedAttribute):
2653         * svg/SVGMaskElement.cpp:
2654         (WebCore::SVGMaskElement::isSupportedAttribute):
2655         * svg/SVGPathElement.cpp:
2656         (WebCore::SVGPathElement::dPropertyInfo):
2657         (WebCore::SVGPathElement::isSupportedAttribute):
2658         * svg/SVGPatternElement.cpp:
2659         (WebCore::SVGPatternElement::isSupportedAttribute):
2660         * svg/SVGPolyElement.cpp:
2661         (WebCore::SVGPolyElement::pointsPropertyInfo):
2662         * svg/SVGRadialGradientElement.cpp:
2663         (WebCore::SVGRadialGradientElement::isSupportedAttribute):
2664         * svg/SVGTextContentElement.cpp:
2665         (WebCore::SVGTextContentElement::textLengthPropertyInfo):
2666         (WebCore::SVGTextContentElement::isSupportedAttribute):
2667         * svg/SVGTextPathElement.cpp:
2668         (WebCore::SVGTextPathElement::isSupportedAttribute):
2669         * svg/SVGUseElement.cpp:
2670         (WebCore::createAllowedElementSet):
2671         * xml/NativeXPathNSResolver.cpp:
2672         (WebCore::NativeXPathNSResolver::lookupNamespaceURI):
2673         * xml/parser/XMLDocumentParser.cpp:
2674         (WebCore::XMLDocumentParser::parseDocumentFragment):
2675
2676 2017-10-30  Jer Noble  <jer.noble@apple.com>
2677
2678         [WebGL] Optimization to skip painting if texture and source surface hasn't changed isn't working; re-optimize.
2679         https://bugs.webkit.org/show_bug.cgi?id=178953
2680
2681         Reviewed by Dean Jackson.
2682
2683         The "seed" value of the current bound texture never matches the last saved value in
2684         VideoTextureCopierCV::copyImageToPlatformTexture(). The value is modified by the function
2685         itself, so a fresh value needs to be re-queried after the image's surface is attached to the
2686         texture.
2687
2688         Once this fix is in, however, the <canvas> being painted will flash when no new image is
2689         available. This is because the wrong texture target is being restored by the GC3DStateSaver
2690         at the end of copyImageToPlatformTexture(). While we're fixing that, we may as well use the
2691         texture state saved by the GraphicsContext3D itself to restore the correct texture unit,
2692         texture target, and texture.
2693
2694         * platform/graphics/GraphicsContext3D.h:
2695         (WebCore::GraphicsContext3D::activeTextureUnit const):
2696         (WebCore::GraphicsContext3D::currentBoundTexture const):
2697         (WebCore::GraphicsContext3D::currentBoundTarget const):
2698         (WebCore::GraphicsContext3D::GraphicsContext3DState::currentBoundTexture const):
2699         (WebCore::GraphicsContext3D::GraphicsContext3DState::boundTexture const):
2700         (WebCore::GraphicsContext3D::GraphicsContext3DState::currentBoundTarget const):
2701         (WebCore::GraphicsContext3D::GraphicsContext3DState::boundTarget const):
2702         (WebCore::GraphicsContext3D::GraphicsContext3DState::currentBoundTexture): Deleted.
2703         (WebCore::GraphicsContext3D::GraphicsContext3DState::boundTexture): Deleted.
2704         (WebCore::GraphicsContext3D::GraphicsContext3DState::boundTarget): Deleted.
2705         * platform/graphics/cv/VideoTextureCopierCV.cpp:
2706         (WebCore::VideoTextureCopierCV::copyImageToPlatformTexture):
2707         (WebCore::VideoTextureCopierCV::GC3DStateSaver::GC3DStateSaver):
2708         (WebCore::VideoTextureCopierCV::GC3DStateSaver::~GC3DStateSaver):
2709         * platform/graphics/cv/VideoTextureCopierCV.h:
2710         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2711         (WebCore::GraphicsContext3D::prepareTexture):
2712         (WebCore::GraphicsContext3D::activeTexture):
2713         (WebCore::GraphicsContext3D::bindTexture):
2714
2715 2017-10-30  Michael Catanzaro  <mcatanzaro@igalia.com>
2716
2717         WKBundlePageWillSendSubmitEventCallback is called with incorrect frame parameter
2718         https://bugs.webkit.org/show_bug.cgi?id=176719
2719
2720         Reviewed by Chris Dumez.
2721
2722         WKBundlePageWillSendSubmitEventCallback is clearly intended to parallel
2723         WKBundlePageWillSubmitFormCallback, since almost all the parameters are the same. Now, in
2724         WKBundlePageWillSubmitFormCallback, the first WKBundleFrameRef, "frame", is the frame of the
2725         form target, and the second WKBundleFrameRef, sourceFrame, is the frame containing the form.
2726         That's correct. But in WKBundlePageWillSendSubmitEventCallback, both frame and sourceFrame
2727         are always identical. The problem is that the FrameLoaderClient delegate is called on the
2728         wrong FrameLoaderClient. It should be called on the FrameLoaderClient of the target frame,
2729         but HTMLFormElement calls it on the FrameLoaderClient of the source frame instead.
2730
2731         Fix this by factoring the target frame computation out of FormSubmission into some helpers.
2732
2733         * html/HTMLFormElement.cpp:
2734         (WebCore::HTMLFormElement::prepareForSubmission):
2735         (WebCore::HTMLFormElement::effectiveTarget const):
2736         (WebCore::HTMLFormElement::findSubmitButton const):
2737         * html/HTMLFormElement.h:
2738         * loader/FormSubmission.cpp:
2739         (WebCore::FormSubmission::create):
2740
2741 2017-10-30  Alex Christensen  <achristensen@webkit.org>
2742
2743         ASSERTION FAILED: internalValuesConsistent(m_url) in WebCore::URLParser::URLParser
2744         https://bugs.webkit.org/show_bug.cgi?id=178861
2745
2746         Reviewed by Tim Horton.
2747
2748         This is a dark corner of the URL spec that has wildly different behavior in different browsers.
2749         The assertion fired when we have a file URL with a ? or a # after file:// and it was because
2750         m_pathAfterLastSlash was still 0. We definitely shouldn't assert. I'm making us consistent with
2751         other cases where we have nothing there and add an implied missing slash.
2752         
2753         Covered by new API tests.
2754
2755         * platform/URLParser.cpp:
2756         (WebCore::URLParser::parse):
2757
2758 2017-10-27  Megan Gardner  <megan_gardner@apple.com>
2759
2760         Correctly determine affinity when inserting text via Keyboard Suggestions
2761         https://bugs.webkit.org/show_bug.cgi?id=178969
2762
2763         Reviewed by Ryosuke Niwa.
2764
2765         There has been talk about renaming these enums, but in the meantime we should at least have a comment 
2766         clarifying what they actually mean.
2767
2768         No new tests only adding a comment, no tests needed.
2769
2770         * editing/TextAffinity.h:
2771
2772 2017-10-27  Ryosuke Niwa  <rniwa@webkit.org>
2773
2774         Crash in addChildNodesToDeletionQueue
2775         https://bugs.webkit.org/show_bug.cgi?id=178974
2776         <rdar://problem/35234372>
2777
2778         Reviewed by Brent Fulgham.
2779
2780         The bug was caused by HTMLConstructionSite::insertTextNode constructing an ill-formed tree
2781         when fostering parent under a template element by adjusting HTMLConstructionSiteTask's parent
2782         without clearing nextChild. Fixed the crash by simply removing this code since executeTask
2783         already takes care of fostering the parent in static inline insert(HTMLConstructionSiteTask&).
2784
2785         Test: fast/parser/foster-parent-under-template.html
2786
2787         * html/parser/HTMLConstructionSite.cpp:
2788         (WebCore::HTMLConstructionSite::insertTextNode):
2789
2790 2017-10-30  Commit Queue  <commit-queue@webkit.org>
2791
2792         Unreviewed, rolling out r224078.
2793         https://bugs.webkit.org/show_bug.cgi?id=179026
2794
2795         MotionMark regression (Requested by shallawa on #webkit).
2796
2797         Reverted changeset:
2798
2799         "When navigating back to a page, compositing layers may not
2800         use accelerated drawing"
2801         https://bugs.webkit.org/show_bug.cgi?id=178749
2802         https://trac.webkit.org/changeset/224078
2803
2804 2017-10-30  Dean Jackson  <dino@apple.com>
2805
2806         Implement "bitmaprenderer" CanvasRenderingContext
2807         https://bugs.webkit.org/show_bug.cgi?id=178992
2808         <rdar://problem/34147157>
2809
2810         Reviewed by Sam Weinig.
2811
2812         Implement the "bitmaprenderer" context for HTMLCanvasElement.
2813         Use as much of the existing 2d context code as possible, which
2814         means that we are painting the ImageBitmap into the backing
2815         store. This isn't optimal, but it is good enough to get
2816         going while we move buffer ownership from the canvas object
2817         into the rendering contexts.
2818
2819         This patch raised a few issues on the HTML specification:
2820         https://github.com/whatwg/html/issues/3164
2821         https://github.com/whatwg/html/issues/3165
2822         https://github.com/whatwg/html/issues/3166
2823         https://github.com/whatwg/html/issues/3167
2824
2825         Update existing Web Platform Test results.
2826
2827         * html/HTMLCanvasElement.cpp:
2828         (WebCore::HTMLCanvasElement::createContext2d): Drive-by comment fix.
2829         (WebCore::HTMLCanvasElement::createContextWebGL): Ditto.
2830         (WebCore::HTMLCanvasElement::createContextWebGPU): Ditto.
2831         (WebCore::HTMLCanvasElement::createContextBitmapRenderer): We now require
2832         a layer/backing store for a bitmap context.
2833         (WebCore::HTMLCanvasElement::paintsIntoCanvasBuffer const): Add bitmap-renderer
2834         to the type of context that uses the canvas's backing store.
2835         (WebCore::HTMLCanvasElement::createImageBuffer const): Comment fix.
2836         (WebCore::HTMLCanvasElement::setImageBuffer const): Change parameter to a &&.
2837         (WebCore::HTMLCanvasElement::setImageBufferAndMarkDirty): New function to set
2838         the backing store efficiently, as well as make it look like we need to repaint
2839         the entire canvas.
2840         (WebCore::HTMLCanvasElement::drawingContext const): The buffer doesn't actually
2841         need to provide a GraphicsContext if we're a bitmap renderer.
2842         * html/HTMLCanvasElement.h:
2843
2844         * html/ImageBitmap.cpp:
2845         (WebCore::ImageBitmap::transferOwnershipAndClose): New helper to give the ownership
2846         of the ImageBuffer away, and look like close() was called.
2847         * html/ImageBitmap.h:
2848
2849         * html/canvas/ImageBitmapRenderingContext.cpp: Implement the algorithm from the HTML
2850         specification.
2851         (WebCore::ImageBitmapRenderingContext::ImageBitmapRenderingContext):
2852         (WebCore::ImageBitmapRenderingContext::isAccelerated const):
2853         (WebCore::ImageBitmapRenderingContext::setOutputBitmap):
2854         (WebCore::ImageBitmapRenderingContext::transferFromImageBitmap):
2855         * html/canvas/ImageBitmapRenderingContext.h:
2856         * html/canvas/ImageBitmapRenderingContext.idl:
2857
2858 2017-10-30  Simon Fraser  <simon.fraser@apple.com>
2859
2860         tab-size: 0px asserts
2861         https://bugs.webkit.org/show_bug.cgi?id=176198
2862
2863         Reviewed by Antti Koivisto.
2864
2865         Don't claim to support tab-size values with units. We don't, and they would become 0, rather
2866         than fall back to the default as should happen.
2867
2868         Enhanced fast/css/tab-size.html to test.
2869
2870         * css/parser/CSSPropertyParser.cpp:
2871         (WebCore::consumeTabSize):
2872
2873 2017-10-30  Michael Catanzaro  <mcatanzaro@igalia.com>
2874
2875         [WPE] Fix build warnings
2876         https://bugs.webkit.org/show_bug.cgi?id=178899
2877
2878         Reviewed by Carlos Alberto Lopez Perez.
2879
2880         These are actually mostly cross-platform issues.
2881
2882         * html/canvas/WebGL2RenderingContext.cpp:
2883         (WebCore::arrayBufferViewElementSize):
2884         * platform/Cairo.cmake:
2885         * platform/Curl.cmake:
2886         * platform/FreeType.cmake:
2887         * platform/GCrypt.cmake:
2888         * platform/graphics/texmap/TextureMapperShaderProgram.cpp:
2889         (WebCore::TextureMapperShaderProgram::create):
2890         * platform/network/soup/SoupNetworkSession.cpp:
2891         (WebCore::SoupNetworkSession::SoupNetworkSession):
2892
2893 2017-10-30  Michael Catanzaro  <mcatanzaro@igalia.com>
2894
2895         [WPE] Build more files under WebCore as unified sources and get rid of WebCorePlatformWPE build target
2896         https://bugs.webkit.org/show_bug.cgi?id=178964
2897
2898         Reviewed by Carlos Alberto Lopez Perez.
2899
2900         This also gets rid of the WebCorePlatformWPE build target to simplify the build. It links to
2901         all the same libraries as the WebCore target, so it doesn't seem to have any purpose. Bye.
2902
2903         Some CMake files under platform are not unified, either because there is not much to gain
2904         (e.g. ImageDecoders, where everything is in a separate directory), or because it is complex
2905         (e.g. GStreamer, where GObject implementations would be tricky to build unified), and
2906         because we're limited to using only features declared in WebKitFeatures.cmake inside the
2907         unified sources lists, which makes some of the platform files a bit tricky (notably,
2908         anything that needs to go into WebCorePlatformGTK for the GTK port). So it's not perfect.
2909
2910         * PlatformWPE.cmake:
2911         * SourcesWPE.txt: Added.
2912         * crypto/gcrypt/GCryptUtilities.h:
2913         * platform/Cairo.cmake:
2914         * platform/GCrypt.cmake:
2915         * platform/SourcesCairo.txt: Added.
2916         * platform/SourcesGCrypt.txt: Added.
2917         * platform/SourcesGLib.txt: Added.
2918         * platform/SourcesSoup.txt: Added.
2919
2920 2017-10-30  Michael Catanzaro  <mcatanzaro@igalia.com>
2921
2922         Remove more unused ENABLE(GAMEPAD_DEPRECATED) code
2923         https://bugs.webkit.org/show_bug.cgi?id=178364
2924
2925         Reviewed by Carlos Alberto Lopez Perez.
2926
2927         * Modules/gamepad/deprecated/Gamepad.cpp: Removed.
2928         * Modules/gamepad/deprecated/Gamepad.h: Removed.
2929         * Modules/gamepad/deprecated/Gamepad.idl: Removed.
2930         * Modules/gamepad/deprecated/GamepadList.cpp: Removed.
2931         * Modules/gamepad/deprecated/GamepadList.h: Removed.
2932         * Modules/gamepad/deprecated/GamepadList.idl: Removed.
2933         * Modules/gamepad/deprecated/NavigatorGamepad.cpp: Removed.
2934         * Modules/gamepad/deprecated/NavigatorGamepad.h: Removed.
2935         * Modules/gamepad/deprecated/NavigatorGamepad.idl: Removed.
2936
2937 2017-10-30  Daniel Bates  <dabates@apple.com>
2938
2939         Use if conditional function in DerivedSources.make to reduce duplication
2940         https://bugs.webkit.org/show_bug.cgi?id=178989
2941
2942         Reviewed by Darin Adler.
2943
2944         In DerivedSources.make we currently duplicate most of the Makefile recipe for generating HTML/SVG
2945         tags and attributes to support passing the optional command line option --extraDefines when one
2946         or more HTML/SVG compile-time features are enabled. Instead we can make use of a Makefile
2947         conditional function in the recipe itself to avoid code duplication.
2948
2949         * DerivedSources.make:
2950
2951 2017-10-30  Antoine Quint  <graouts@apple.com>
2952
2953         [Web Animations] Expose the playbackRate property on Animation
2954         https://bugs.webkit.org/show_bug.cgi?id=178931
2955
2956         Reviewed by Sam Weinig.
2957
2958         Account for the playback rate when computing and setting an animation's
2959         current time, ensuring that we adjust the start time to preserve the
2960         current time when setting a new playback rate.
2961
2962         Test: http/wpt/wk-web-animations/timing-model/animation-playback-rate.html
2963
2964         * animation/WebAnimation.cpp:
2965         (WebCore::WebAnimation::WebAnimation):
2966         (WebCore::WebAnimation::currentTime const):
2967         (WebCore::WebAnimation::setCurrentTime):
2968         (WebCore::WebAnimation::setPlaybackRate):
2969         * animation/WebAnimation.h:
2970         * animation/WebAnimation.idl:
2971
2972 2017-10-30  Michael Catanzaro  <mcatanzaro@igalia.com>
2973
2974         [WPE][GTK] Expose availability of certain editing commands in WebKitEditorState
2975         https://bugs.webkit.org/show_bug.cgi?id=168219
2976
2977         Reviewed by Ryosuke Niwa.
2978
2979         Make Editor::canUndo and Editor::canRedo const.
2980
2981         Also, remove unused allowsCopy from HitTestResult.
2982
2983         * editing/Editor.cpp:
2984         (WebCore::Editor::canUndo const):
2985         (WebCore::Editor::canRedo const):
2986         (WebCore::Editor::canUndo): Deleted.
2987         (WebCore::Editor::canRedo): Deleted.
2988         * editing/Editor.h:
2989         * rendering/HitTestResult.cpp:
2990         (WebCore::HitTestResult::allowsCopy const): Deleted.
2991         * rendering/HitTestResult.h:
2992         * rendering/SelectionRangeData.cpp:
2993
2994 2017-10-27  Antti Koivisto  <antti@apple.com>
2995
2996         Destroy all unneeded anonymous wrappers in RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers()
2997         https://bugs.webkit.org/show_bug.cgi?id=178933
2998
2999         Reviewed by Zalan Bujtas.
3000
3001         Currently it just cleans up table related wrappers.
3002
3003         * rendering/RenderObject.cpp:
3004         (WebCore::findDestroyRootIncludingAnonymous):
3005
3006         Continuations are left as future work.
3007
3008 2017-10-30  Zalan Bujtas  <zalan@apple.com>
3009
3010         Remove reference to RenderTreeInternalMutationScope
3011         https://bugs.webkit.org/show_bug.cgi?id=178998
3012         <rdar://problem/35246464>
3013
3014         Reviewed by Antti Koivisto.
3015
3016         We don't have such class anymore.
3017
3018         No change in functionality.
3019
3020         * rendering/RenderView.h:
3021
3022 2017-10-30  Zan Dobersek  <zdobersek@igalia.com>
3023
3024         [GCrypt] Add support for P-521 EC curves
3025         https://bugs.webkit.org/show_bug.cgi?id=175199
3026
3027         Reviewed by Jiewen Tan.
3028
3029         Add support for 521-bit elliptic curves in the libgcrypt-based
3030         implementation of WebCrypto API.
3031
3032         In the CryptoAlgorithmECDH implementation, the bit-size of the key is now
3033         rounded up to the next byte boundary and passed to the helper
3034         gcryptDerive() function. There the size in bytes is used to zero-pad the
3035         derived key data. This is done to properly handle derivation results for
3036         the P-521 curves, where the leading zero bit could get clipped, resulting
3037         in a derived key that is only 65 byes in length when it is expected to be
3038         66 bytes. Further cleanups are done in gcryptDerive() to use the mpiData()
3039         function where possible.
3040
3041         In the CryptoAlgorithmECDSA implementation, the bit-size of the key is
3042         again rounded up to the nearest byte boundary before being passed to the
3043         helper gcryptSign() and gcryptVerify() functions. This again properly
3044         enforces the requirement of 66 bytes to handle P-521 elliptic curves.
3045
3046         In the CryptoKeyEC implementation, NamedCurve::P521 cases in helper
3047         functions operating on NamedCurve values are now implemented to return
3048         appropriate values. platformSupportedCurve() now returns true for the
3049         NamedCurve::P521 value. Zero-padding of the private key data is used
3050         wherever it is necessary to avoid clipping any leading zero bit in the
3051         P-521 EC key.
3052
3053         No new tests -- affected tests have their baselines updated.
3054
3055         * crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp:
3056         (WebCore::gcryptDerive):
3057         (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
3058         * crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp:
3059         (WebCore::CryptoAlgorithmECDSA::platformSign):
3060         (WebCore::CryptoAlgorithmECDSA::platformVerify):
3061         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
3062         (WebCore::curveName):
3063         (WebCore::curveIdentifier):
3064         (WebCore::curveSize):
3065         (WebCore::curveUncompressedFieldElementSize):
3066         (WebCore::CryptoKeyEC::platformSupportedCurve):
3067         (WebCore::curveForIdentifier):
3068         (WebCore::CryptoKeyEC::platformImportPkcs8):
3069         (WebCore::CryptoKeyEC::platformAddFieldElements const):
3070         (WebCore::CryptoKeyEC::platformExportPkcs8 const):
3071
3072 2017-10-29  Fujii Hironori  <Hironori.Fujii@sony.com>
3073
3074         Use of uninitialized value $targetIdlFile in hash element at preprocess-idls.pl line 165.
3075         https://bugs.webkit.org/show_bug.cgi?id=177743
3076
3077         Reviewed by Darin Adler.
3078
3079         GamepadWebVR.idl supplements Gamepad.idl. But, Gamepad.idl is not
3080         processed because ENABLE_GAMEPAD is OFF.
3081
3082         No new tests since there should be no behavioral change.
3083
3084         * CMakeLists.txt: Include GamepadWebVR.idl only if ENABLE_GAMEPAD.
3085         * Sources.txt: Ditto.
3086         * bindings/scripts/preprocess-idls.pl: Die if a supplemented IDL file is not found.
3087
3088 2017-10-29  Sam Weinig  <sam@webkit.org>
3089
3090         [Conic Gradients] Add support for parsing conic gradients
3091         https://bugs.webkit.org/show_bug.cgi?id=178987
3092
3093         Reviewed by Dean Jackson.
3094
3095         Adds initial support, disabled by default, for parsing conic gradients as per
3096         CSS 4 Images - https://www.w3.org/TR/css-images-4/#conic-gradients.
3097
3098         Test: fast/gradients/conic-gradient-parsing.html
3099
3100         * css/CSSGradientValue.cpp:
3101         (WebCore::clone):
3102         (WebCore::CSSGradientValue::isCacheable const):
3103         (WebCore::CSSConicGradientValue::customCSSText const):
3104         (WebCore::CSSConicGradientValue::createGradient):
3105         (WebCore::CSSConicGradientValue::equals const):
3106         * css/CSSGradientValue.h:
3107         
3108             Add CSSConicGradientValue as a subclass of CSSGradientValue and implement
3109             customCSSText() and equals(). Stub out createGradient() as painting is not
3110             yet implemented.
3111         
3112         * css/CSSImageGeneratorValue.cpp:
3113         (WebCore::CSSImageGeneratorValue::image):
3114         (WebCore::CSSImageGeneratorValue::isFixedSize const):
3115         (WebCore::CSSImageGeneratorValue::fixedSize):
3116         (WebCore::CSSImageGeneratorValue::isPending const):
3117         (WebCore::CSSImageGeneratorValue::knownToBeOpaque const):
3118         (WebCore::CSSImageGeneratorValue::loadSubimages):
3119         * css/CSSValue.cpp:
3120         (WebCore::CSSValue::equals const):
3121         (WebCore::CSSValue::cssText const):
3122         (WebCore::CSSValue::destroy):
3123         
3124             Dispatch to CSSConicGradientValue as needed.
3125         
3126         * css/CSSValue.h:
3127         (WebCore::CSSValue::isImageGeneratorValue const):
3128         (WebCore::CSSValue::isGradientValue const):
3129         (WebCore::CSSValue::isConicGradientValue const):
3130         
3131             Add conic gradient predicate support and update isImageGeneratorValue and 
3132             isGradientValue to include conic gradient.
3133         
3134         * css/CSSValueKeywords.in:
3135         
3136             Add conic-gradient and repeating-conic-gradient.
3137         
3138         * css/parser/CSSParser.cpp:
3139         (WebCore::CSSParserContext::CSSParserContext):
3140         (WebCore::operator==):
3141         * css/parser/CSSParserMode.h:
3142         (WebCore::CSSParserContextHash::hash):
3143         
3144             Add runtime flags to enable conic gradients.
3145         
3146         * css/parser/CSSPropertyParserHelpers.cpp:
3147         (WebCore::CSSPropertyParserHelpers::consumeAngleOrPercent):
3148         
3149             Helper, similar to consumeLengthOrPercent, for consumeGradientColorStops. 
3150             Corresponds to https://drafts.csswg.org/css-values-4/#typedef-angle-percentage
3151         
3152         (WebCore::CSSPropertyParserHelpers::consumeGradientColorStops):
3153         
3154             Convert to take CSSGradientValue by reference.
3155         
3156         (WebCore::CSSPropertyParserHelpers::consumeAngularGradientColorStops):
3157         
3158             Helper, similar to consumeGradientColorStops, but for angular color stops
3159             used in conic gradients. Corresponds to https://www.w3.org/TR/css-images-4/#typedef-angular-color-stop-list
3160             but does not yet support double position syntax.
3161         
3162         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedRadialGradient):
3163         (WebCore::CSSPropertyParserHelpers::consumeRadialGradient):
3164         (WebCore::CSSPropertyParserHelpers::consumeLinearGradient):
3165         
3166             Pass CSSGradientValue by reference.
3167         
3168         (WebCore::CSSPropertyParserHelpers::consumeConicGradient):
3169         
3170             Parse conic gradient.
3171         
3172         (WebCore::CSSPropertyParserHelpers::consumeGeneratedImage):
3173         
3174             Dispatch to consumeConicGradient for repeating and non-repeating
3175             conic gradients.
3176         
3177         (WebCore::CSSPropertyParserHelpers::isGeneratedImage):
3178         
3179             Put each value on its own line to make it more readable and add CSSValueConicGradient
3180             and CSSValueRepeatingConicGradient.
3181         
3182         * page/Settings.yaml:
3183         
3184             Add a setting to enable conic gradients. Disabled by default.
3185
3186         * features.json:
3187         
3188             Move conic gradients to "In Development".
3189
3190 2017-10-29  Antoine Quint  <graouts@apple.com>
3191
3192         [Web Animations] Expose the currentTime property on Animation
3193         https://bugs.webkit.org/show_bug.cgi?id=178988
3194
3195         Unreviewed.
3196
3197         Style fixes missed in previous patch.
3198
3199         * animation/WebAnimation.cpp:
3200         (WebCore::WebAnimation::setCurrentTime):
3201
3202 2017-10-29  Antoine Quint  <graouts@apple.com>
3203
3204         [Web Animations] Expose the currentTime property on Animation
3205         https://bugs.webkit.org/show_bug.cgi?id=178988
3206
3207         Reviewed by Dean Jackson.
3208
3209         We now expose the currentTime property on Animation objects, our first
3210         step in implementing the Web Animations timing model, specifically section
3211         3.5.4. "The current time of an animation" and section 3.5.5. "Setting the
3212         current time of an animation". Setting the startTime has implications on
3213         currentTime and vice-versa.
3214
3215         Test: webanimations/animation-current-time.html
3216
3217         * animation/WebAnimation.cpp:
3218         (WebCore::WebAnimation::setBindingsStartTime):
3219         (WebCore::WebAnimation::startTime const):
3220         (WebCore::WebAnimation::setStartTime):
3221         (WebCore::WebAnimation::bindingsCurrentTime const):
3222         (WebCore::WebAnimation::setBindingsCurrentTime):
3223         (WebCore::WebAnimation::currentTime const):
3224         (WebCore::WebAnimation::setCurrentTime):
3225         * animation/WebAnimation.h:
3226         * animation/WebAnimation.idl:
3227
3228 2017-10-29  Ryosuke Niwa  <rniwa@webkit.org>
3229
3230         Assert that no script is executed during style recalc
3231         https://bugs.webkit.org/show_bug.cgi?id=178845
3232         <rdar://problem/35106129>
3233
3234         Reviewed by Antti Koivisto.
3235
3236         This patch adds NoEventDispatchAssertion to Document::updateStyle and Document::updateStyleIfNeeded
3237         to make sure we don't start mutating DOM in the middle of a style update.
3238
3239         Added NoEventDispatchAssertion::EventAllowedScope for various places in SVGUseElement to update its
3240         shadow tree since that happens while updating the style.
3241
3242         No new tests since there should be no behavioral change.
3243
3244         * dom/Document.cpp:
3245         (WebCore::Document::resolveStyle): Added NoEventDispatchAssertion while flushing pending stylesheets
3246         and calling FrameView::willRecalcStyle, and while the style tree solver is in works. Also moved in
3247         the code to update the selection and schedule to dispatch a fake mouse event into the same scope.
3248         Also increment m_styleRecalcCount in the same code since post resolution callbacks could run author
3249         scripts which in turn trigger another (recursive) style recalc.
3250         (WebCore::Document::updateStyleIfNeeded): Put everything but the call to resolveStyle in a scope with
3251         NoEventDispatchAssertion.
3252         * dom/Element.cpp:
3253         (WebCore::Element::cloneElementWithChildren): Added NoEventDispatchAssertion::EventAllowedScope to the
3254         newly cloned element for SVG use element's shadow tree.
3255         (WebCore::Element::cloneElementWithoutChildren): Ditto.
3256         * dom/EventDispatcher.cpp:
3257         (WebCore::EventDispatcher::dispatchEvent): Make the assertion more precise to workaround the fact SVG
3258         use elements update its shadow tree in the middle of style updates. Also removed a redundant assertion
3259         since the result of NoEventDispatchAssertion::isEventDispatchAllowedInSubtree cannot chance without
3260         pushing or popoing the stack frame.
3261         * svg/SVGUseElement.cpp:
3262         (WebCore::SVGUseElement::clearShadowTree):
3263         (WebCore::SVGUseElement::updateShadowTree): Added NoEventDispatchAssertion to the user-agent shadow root
3264         of a SVG use element. Since this is a newly created shadow tree which hasn't been exposed to author
3265         scripts, it's safe to mutate them during the style recalc even though it's not the best design.
3266         (WebCore::SVGUseElement::cloneTarget const): Ditto.
3267         (WebCore::SVGUseElement::expandUseElementsInShadowTree const): Ditto.
3268         (WebCore::SVGUseElement::expandSymbolElementsInShadowTree const): Ditto.
3269         (WebCore::SVGUseElement::transferEventListenersToShadowTree const):
3270
3271 2017-10-28  Dean Jackson  <dino@apple.com>
3272
3273         createImageBitmap with HTMLCanvasElement
3274         https://bugs.webkit.org/show_bug.cgi?id=178984
3275         <rdar://problem/35238440>
3276
3277         Reviewed by Sam Weinig.
3278
3279         Implement createImageBitmap(HTMLCanvasElement).
3280
3281         While here, explicitly reject the promises for the
3282         methods we haven't yet implemented. I was hoping this
3283         would avoid a lengthy timeout in one of the imported
3284         WPT tests but, alas, it doesn't. However, it's still
3285         a good idea.
3286
3287         Extend internal WPT proposals to cover canvas creation.
3288
3289         * html/ImageBitmap.cpp:
3290         (WebCore::ImageBitmap::createPromise): Get the image from
3291         the canvas and draw it into a new ImageBitmap buffer.
3292
3293 2017-10-28  Myles C. Maxfield  <mmaxfield@apple.com>
3294
3295         [iOS] Unify Font::platformCharWidthInit() with macOS
3296         https://bugs.webkit.org/show_bug.cgi?id=178951
3297         <rdar://problem/7848198>
3298
3299         Reviewed by Zalan Bujtas.
3300
3301         The only reason these codepaths are different is because historically this codepath
3302         didn't work with GS fonts (which we don't use anymore).
3303
3304         Tests: fast/forms/search-styled.html
3305                fast/forms/text-control-intrinsic-widths.html
3306                fast/forms/textarea-width.html
3307
3308         * platform/graphics/cocoa/FontCocoa.mm:
3309         (WebCore::Font::platformCharWidthInit):
3310
3311 2017-10-28  Chris Dumez  <cdumez@apple.com>
3312
3313         self.ExtendableEvent / Client / Clients / WindowClient do not exist in a Service Worker
3314         https://bugs.webkit.org/show_bug.cgi?id=178976
3315
3316         Reviewed by Sam Weinig.
3317
3318         Test: http/tests/workers/service/ServiceWorkerGlobalScope-properties.html
3319
3320         * workers/service/ExtendableEvent.idl:
3321         * workers/service/FetchEvent.idl:
3322         Drop [Exposed=Worker] as there is already [Exposed=ServiceWorker] and
3323         ServiceWorkerGlobalScope inherits from WorkerGlobalScope. This is redundant
3324         and we would hit assertions and adding the global constructors at runtime
3325         when the feature is enabled, because the property already exists.
3326
3327 2017-10-28  Zalan Bujtas  <zalan@apple.com>
3328
3329         [FrameView::layout cleanup] Move core layout logic to a separate class.
3330         https://bugs.webkit.org/show_bug.cgi?id=178771
3331         <rdar://problem/35166542>
3332
3333         Reviewed by Simon Fraser.
3334
3335         Move layout code out from FrameView to LayoutContext.
3336
3337         LayoutContext holds all the layout related logic (scheduling, needsLayout, handling layout states),
3338         while scrolling, view sizing methods stay in FrameView.
3339         Having a dedicated LayoutContext allows to structure the code better.   
3340
3341         Covered by existing tests.
3342
3343         * Sources.txt:
3344         * WebCore.xcodeproj/project.pbxproj:
3345         * accessibility/AXObjectCache.cpp:
3346         (WebCore::rendererNeedsDeferredUpdate):
3347         * accessibility/AccessibilityObject.cpp:
3348         (WebCore::AccessibilityObject::updateBackingStore):
3349         * accessibility/AccessibilityRenderObject.cpp:
3350         (WebCore::AccessibilityRenderObject::textUnderElement const):
3351         (WebCore::AccessibilityRenderObject::layoutCount const):
3352         * dom/Document.cpp:
3353         (WebCore::Document::setVisualUpdatesAllowed):
3354         (WebCore::Document::resolveStyle):
3355         (WebCore::Document::updateStyleIfNeeded):
3356         (WebCore::Document::updateLayout):
3357         (WebCore::Document::updateLayoutIfDimensionsOutOfDate):
3358         (WebCore::Document::implicitClose):
3359         (WebCore::Document::isLayoutTimerActive):
3360         * dom/Element.cpp:
3361         (WebCore::Element::absoluteEventHandlerBounds):
3362         * editing/FrameSelection.cpp:
3363         (WebCore::FrameSelection::setSelection):
3364         * html/HTMLEmbedElement.cpp:
3365         (WebCore::HTMLEmbedElement::renderWidgetLoadingPlugin const):
3366         * html/HTMLFormControlElement.cpp:
3367         (WebCore::HTMLFormControlElement::didAttachRenderers):
3368         * inspector/InspectorOverlay.cpp:
3369         (WebCore::InspectorOverlay::update):
3370         * loader/FrameLoader.cpp:
3371         (WebCore::FrameLoader::stopForUserCancel):
3372         * page/Frame.cpp:
3373         (WebCore::Frame::setView):
3374         (WebCore::Frame::clearTimers):
3375         (WebCore::Frame::setPageAndTextZoomFactors):
3376         (WebCore::Frame::resumeActiveDOMObjectsAndAnimations):
3377         * page/FrameView.cpp:
3378         (WebCore::FrameView::FrameView):
3379         (WebCore::FrameView::~FrameView):
3380         (WebCore::FrameView::reset):
3381         (WebCore::FrameView::resetScrollbars):
3382         (WebCore::FrameView::didFirstLayout const):
3383         (WebCore::FrameView::willDestroyRenderTree):
3384         (WebCore::FrameView::didDestroyRenderTree):
3385         (WebCore::FrameView::setContentsSize):
3386         (WebCore::FrameView::calculateScrollbarModesForLayout):
3387         (WebCore::FrameView::updateCompositingLayersAfterStyleChange):
3388         (WebCore::FrameView::topContentInsetDidChange):
3389         (WebCore::FrameView::forceLayoutParentViewIfNeeded):
3390         (WebCore::FrameView::adjustScrollbarsForLayout):
3391         (WebCore::FrameView::willDoLayout): This takes care of the view related task right before entering render tree layout.
3392         (WebCore::FrameView::didLayout): post layout tasks.
3393         (WebCore::FrameView::shouldDeferScrollUpdateAfterContentSizeChange):
3394         (WebCore::FrameView::updateLayoutViewport):
3395         (WebCore::FrameView::maintainScrollPositionAtAnchor):
3396         (WebCore::FrameView::updateLayerPositionsAfterScrolling):
3397         (WebCore::FrameView::updateCompositingLayersAfterScrolling):
3398         (WebCore::FrameView::availableContentSizeChanged):
3399         (WebCore::FrameView::updateContentsSize):
3400         (WebCore::FrameView::needsLayout const):
3401         (WebCore::FrameView::setNeedsLayout):
3402         (WebCore::FrameView::scheduleSelectionUpdate):
3403         (WebCore::FrameView::updateEmbeddedObjects):
3404         (WebCore::FrameView::flushAnyPendingPostLayoutTasks):
3405         (WebCore::FrameView::flushPostLayoutTasksQueue):
3406         (WebCore::FrameView::performPostLayoutTasks):
3407         (WebCore::FrameView::sendResizeEventIfNeeded):
3408         (WebCore::FrameView::autoSizeIfEnabled):
3409         (WebCore::FrameView::paintControlTints):
3410         (WebCore::FrameView::paintContents):
3411         (WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive):
3412         (WebCore::FrameView::enableAutoSizeMode):
3413         (WebCore::FrameView::forceLayout):
3414         (WebCore::SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer): Deleted.
3415         (WebCore::SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer): Deleted.
3416         (WebCore::SubtreeLayoutStateMaintainer::shouldDisableLayoutStateForSubtree): Deleted.
3417         (): Deleted.
3418         (WebCore::RenderTreeNeedsLayoutChecker::~RenderTreeNeedsLayoutChecker): Deleted.
3419         (WebCore::applyTextSizingIfNeeded): Deleted.
3420         (WebCore::FrameView::handleLayoutWithFrameFlatteningIfNeeded): Deleted.
3421         (WebCore::FrameView::updateStyleForLayout): Deleted.
3422         (WebCore::FrameView::canPerformLayout const): Deleted.
3423         (WebCore::FrameView::layout): Deleted.
3424         (WebCore::FrameView::runOrSchedulePostLayoutTasks): Deleted.
3425         (WebCore::FrameView::convertSubtreeLayoutToFullLayout): Deleted.
3426         (WebCore::FrameView::layoutTimerFired): Deleted.
3427         (WebCore::FrameView::scheduleRelayout): Deleted.
3428         (WebCore::isObjectAncestorContainerOf): Deleted.
3429         (WebCore::FrameView::scheduleRelayoutOfSubtree): Deleted.
3430         (WebCore::FrameView::layoutPending const): Deleted.
3431         (WebCore::FrameView::unscheduleRelayout): Deleted.
3432         (WebCore::FrameView::startLayoutAtMainFrameViewIfNeeded): Deleted.
3433         * page/FrameView.h:
3434         * page/LayoutContext.cpp: Added.
3435         (WebCore::isObjectAncestorContainerOf):
3436         (WebCore::SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer):
3437         (WebCore::SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer):
3438         (WebCore::SubtreeLayoutStateMaintainer::shouldDisableLayoutStateForSubtree):
3439         (WebCore::RenderTreeNeedsLayoutChecker::~RenderTreeNeedsLayoutChecker):
3440         (WebCore::LayoutScope::LayoutScope):
3441         (WebCore::LayoutScope::~LayoutScope):
3442         (WebCore::LayoutContext::LayoutContext):
3443         (WebCore::LayoutContext::layout):
3444         (WebCore::LayoutContext::runOrScheduleAsynchronousTasks):
3445         (WebCore::LayoutContext::runAsynchronousTasks):
3446         (WebCore::LayoutContext::flushAsynchronousTasks):
3447         (WebCore::LayoutContext::reset):
3448         (WebCore::LayoutContext::needsLayout const):
3449         (WebCore::LayoutContext::setNeedsLayout):
3450         (WebCore::LayoutContext::enableSetNeedsLayout):
3451         (WebCore::LayoutContext::disableSetNeedsLayout):
3452         (WebCore::LayoutContext::scheduleLayout):
3453         (WebCore::LayoutContext::unscheduleLayout):
3454         (WebCore::LayoutContext::scheduleSubtreeLayout):
3455         (WebCore::LayoutContext::layoutTimerFired):
3456         (WebCore::LayoutContext::convertSubtreeLayoutToFullLayout):
3457         (WebCore::LayoutContext::setSubtreeLayoutRoot):
3458         (WebCore::LayoutContext::canPerformLayout const):
3459         (WebCore::LayoutContext::applyTextSizingIfNeeded):
3460         (WebCore::LayoutContext::updateStyleForLayout):
3461         (WebCore::LayoutContext::handleLayoutWithFrameFlatteningIfNeeded):
3462         (WebCore::LayoutContext::startLayoutAtMainFrameViewIfNeeded):
3463         (WebCore::LayoutContext::frame const):
3464         (WebCore::LayoutContext::view const):
3465         (WebCore::LayoutContext::renderView const):
3466         (WebCore::LayoutContext::document const):
3467         * page/LayoutContext.h: Added.
3468         (WebCore::LayoutContext::startDisallowingLayout):
3469         (WebCore::LayoutContext::endDisallowingLayout):
3470         (WebCore::LayoutContext::layoutPhase const):
3471         (WebCore::LayoutContext::isLayoutNested const):
3472         (WebCore::LayoutContext::layoutCount const):
3473         (WebCore::LayoutContext::isLayoutPending const):
3474         (WebCore::LayoutContext::isInLayout const):
3475         (WebCore::LayoutContext::isInRenderTreeLayout const):
3476         (WebCore::LayoutContext::inPaintableState const):
3477         (WebCore::LayoutContext::subtreeLayoutRoot const):
3478         (WebCore::LayoutContext::clearSubtreeLayoutRoot):
3479         (WebCore::LayoutContext::resetFirstLayoutFlag):
3480         (WebCore::LayoutContext::didFirstLayout const):
3481         (WebCore::LayoutContext::setNeedsFullRepaint):
3482         (WebCore::LayoutContext::needsFullRepaint const):
3483         (WebCore::LayoutContext::layoutDisallowed const):
3484         (WebCore::LayoutContext::isLayoutSchedulingEnabled const):
3485         (WebCore::LayoutContext::inAsynchronousTasks const):
3486         * page/Page.cpp:
3487         (WebCore::Page::setPageScaleFactor):
3488         * rendering/RenderBlock.cpp:
3489         (WebCore::RenderBlock::insertPositionedObject):
3490         * rendering/RenderBox.cpp:
3491         (WebCore::RenderBox::imageChanged):
3492         (WebCore::RenderBox::computeLogicalWidthInFragment const):
3493         * rendering/RenderElement.cpp:
3494         (WebCore::RenderElement::clearSubtreeLayoutRootIfNeeded const):
3495         (WebCore::RenderElement::checkForRepaintDuringLayout const):
3496         * rendering/RenderFrameBase.cpp:
3497         (WebCore::RenderFrameBase::performLayoutWithFlattening):
3498         * rendering/RenderLayer.cpp:
3499         (WebCore::RenderLayer::scrollTo):
3500         * rendering/RenderObject.cpp:
3501         (WebCore::scheduleRelayoutForSubtree):
3502         * rendering/RenderTreeAsText.cpp:
3503         (WebCore::write):
3504         * rendering/RenderVideo.cpp:
3505         (WebCore::RenderVideo::updatePlayer):
3506         * rendering/RenderView.h:
3507         * rendering/RenderWidget.cpp:
3508         (WebCore::RenderWidget::updateWidgetPosition):
3509         * svg/graphics/SVGImage.cpp:
3510         (WebCore::SVGImage::draw):
3511         * testing/Internals.cpp:
3512         (WebCore::Internals::layoutCount const):
3513         
3514 2017-10-28  Joseph Pecoraro  <pecoraro@apple.com>
3515
3516         Cleanup PageDebuggable
3517         https://bugs.webkit.org/show_bug.cgi?id=178972
3518
3519         Reviewed by Sam Weinig.
3520
3521         * page/PageDebuggable.cpp:
3522         (WebCore::PageDebuggable::PageDebuggable):
3523         * page/PageDebuggable.h:
3524
3525 2017-10-28  Joseph Pecoraro  <pecoraro@apple.com>
3526
3527         Extract a WorkerDebuggerProxy interface out of WorkerReportingProxy
3528         https://bugs.webkit.org/show_bug.cgi?id=178975
3529
3530         Reviewed by Sam Weinig.
3531
3532         No new tests, just refactoring.
3533
3534         * workers/WorkerDebuggerProxy.h:
3535         * workers/WorkerReportingProxy.h:
3536         * WebCore.xcodeproj/project.pbxproj:
3537         Extract a method from WorkerReportingProxy to WorkerDebuggerProxy and
3538         rename it to be more general.
3539
3540         * inspector/WorkerToPageFrontendChannel.h:
3541         (WebCore::WorkerToPageFrontendChannel::sendMessageToFrontend):
3542         * workers/DedicatedWorkerThread.cpp:
3543         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
3544         * workers/DedicatedWorkerThread.h:
3545         * workers/WorkerMessagingProxy.cpp:
3546         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
3547         (WebCore::WorkerMessagingProxy::postMessageToDebugger):
3548         (WebCore::WorkerMessagingProxy::postMessageToPageInspector): Deleted.
3549         * workers/WorkerMessagingProxy.h:
3550         * workers/WorkerThread.cpp:
3551         (WebCore::WorkerThread::WorkerThread):
3552         * workers/WorkerThread.h:
3553         (WebCore::WorkerThread::workerDebuggerProxy const):
3554         * workers/service/context/ServiceWorkerThread.cpp:
3555         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
3556         * workers/service/context/ServiceWorkerThread.h:
3557         * workers/service/context/ServiceWorkerThreadProxy.cpp:
3558         (WebCore::ServiceWorkerThreadProxy::create):
3559         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
3560         Include a WorkerDebuggerProxy alongside the other proxies.
3561         Use the renamed debugger proxy method.
3562
3563 2017-10-28  Ryosuke Niwa  <rniwa@webkit.org>
3564
3565         Style::Scope::flushPendingUpdate() can replace the entire document in XSLTProcessor::createDocumentFromSource
3566         https://bugs.webkit.org/show_bug.cgi?id=178715
3567         <rdar://problem/35144665>
3568
3569         Reviewed by Brent Fulgham.
3570
3571         Apply XLS tranforms when a 0s timer fires or the document finishes parsing or loading whichever comes first
3572         instead of in the middle of collecting a list of stylesheets.
3573
3574         * dom/Document.cpp:
3575         (WebCore::Document::Document): Initialize the newly added timer.
3576         (WebCore::Document::implicitClose): Apply any pending XSLT before we fire load events since some of the event
3577         handlers may be expecting to see the document after XSLT had been applied.
3578         (WebCore::Document::scheduleToApplyXSLTransforms): Added.
3579         (WebCore::Document::applyPendingXSLTransformsNowIfScheduled): Added.
3580         (WebCore::Document::applyPendingXSLTransformsTimerFired): Added. Moved the logic to apply XSL transforms from
3581         Style::Scope::collectActiveStyleSheets, and merged applyXSLTransform into this function.
3582         (WebCore::Document::applyXSLTransform): Deleted.
3583         (WebCore::Document::finishedParsing): Apply XSLT right before updating the style. This is where used to apply
3584         inline XSLT and it happens much earlier than implicitClose.
3585         (WebCore::Document::suspendScheduledTasks): Suspend the XSLT timer.
3586         (WebCore::Document::resumeScheduledTasks): Reschedule the XSLT timer if m_hasPendingXSLTransforms is set.
3587         * dom/Document.h:
3588         * dom/ProcessingInstruction.cpp:
3589         (WebCore::ProcessingInstruction::checkStyleSheet): Schedule XSLT in the document instead of flushing pending
3590         stylesheets, which would have synchronously applied XSLT. We can't apply XSLT synchronously here because this
3591         function can be called from a non-script-resilient call stack.
3592         (WebCore::ProcessingInstruction::sheetLoaded): Ditto.
3593         * style/StyleScope.cpp:
3594         (WebCore::Style::Scope::collectXSLTransforms): Added.
3595         (WebCore::Style::Scope::collectActiveStyleSheets): Removed the code to apply XSLT. Skip ProcessingInstructions
3596         that applies XSLT. Also use RefPtr<StyleSheet> instead of a raw pointer to store StyleSheet.
3597         * style/StyleScope.h:
3598         * xml/parser/XMLDocumentParserLibxml2.cpp:
3599         (WebCore::XMLDocumentParser::doEnd): Apply any pending XSLTs synchronously here as the comment suggests.
3600
3601 2017-10-27  Devin Rousso  <webkit@devinrousso.com>
3602
3603         Web Inspector: Canvas Tab: no way to see backtrace of where a canvas context was created
3604         https://bugs.webkit.org/show_bug.cgi?id=178799
3605         <rdar://problem/35175805>
3606
3607         Reviewed by Brian Burg.
3608
3609         No new tests, updated existing tests.
3610
3611         * inspector/InspectorCanvas.h:
3612         * inspector/InspectorCanvas.cpp:
3613         (iterateCallFrames):
3614         (WebCore::InspectorCanvas::buildObjectForCanvas):
3615         (WebCore::InspectorCanvas::buildAction):
3616
3617         * inspector/InspectorCanvasAgent.cpp:
3618         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
3619         If the Canvas agent is enabled, generate a backtrace and send it to the frontend with the canvas.
3620         We do not do this for canvases created before the agent is enabled for performance reasons.
3621
3622 2017-10-27  Keith Miller  <keith_miller@apple.com>
3623
3624         Add unified source list files and build scripts to Xcode project navigator
3625         https://bugs.webkit.org/show_bug.cgi?id=178959
3626
3627         Reviewed by Andy Estes.
3628
3629         * WebCore.xcodeproj/project.pbxproj:
3630
3631 2017-10-27  Daniel Bates  <dabates@apple.com>
3632
3633         Only allow non-mixed content protected subresources to ask for credentials
3634         https://bugs.webkit.org/show_bug.cgi?id=178919
3635         <rdar://problem/35015245>
3636
3637         Reviewed by Alex Christensen.
3638
3639         Only allow non-mixed content protected subresources to ask for credentials. It is not meaningful
3640         to allow protected mixed-content subresources to ask for credentials.
3641
3642         Tests: http/tests/security/mixedContent/insecure-image-redirects-to-basic-auth-secure-image.html
3643                http/tests/security/mixedContent/insecure-script-redirects-to-basic-auth-secure-script.html
3644                http/tests/security/mixedContent/insecure-stylesheet-redirects-to-basic-auth-secure-stylesheet.html
3645                http/tests/security/mixedContent/secure-redirect-to-insecure-redirect-to-basic-auth-secure-image.https.html
3646                http/tests/security/mixedContent/secure-redirect-to-secure-redirect-to-basic-auth-insecure-image.https.html
3647                http/tests/security/mixedContent/secure-redirect-to-secure-redirect-to-basic-auth-secure-image.https.html
3648
3649         * loader/ResourceLoader.cpp:
3650         (WebCore::ResourceLoader::ResourceLoader): Initialize m_canAskClientForCredentials based on the
3651         specified resource loader options.
3652         (WebCore::ResourceLoader::init): Update m_canAskClientForCredentials based on the URL of the initial
3653         request.
3654         (WebCore::ResourceLoader::isMixedContent const): Helper function to check if the specified URL
3655         represents a mixed content resource.
3656         (WebCore::ResourceLoader::willSendRequestInternal): If the original request or the redirect request
3657         is mixed content then update state such that we will disallow asking for credentials.
3658         (WebCore::ResourceLoader::isAllowedToAskUserForCredentials const): Modified to use m_canAskClientForCredentials
3659         when determining whether the request is allowed to ask for credentials.
3660         * loader/ResourceLoader.h:
3661
3662 2017-10-27  Chris Dumez  <cdumez@apple.com>
3663
3664         Unskip more Service Workers tests
3665         https://bugs.webkit.org/show_bug.cgi?id=178944
3666
3667         Reviewed by Sam Weinig.
3668
3669         Drop bad assertion that was causing the Service Worker WebProcess to crash and causing
3670         tests to fail as a result.
3671
3672         * workers/service/ServiceWorkerGlobalScope.cpp:
3673         (WebCore::ServiceWorkerGlobalScope::registration):
3674         * workers/service/ServiceWorkerGlobalScope.h:
3675
3676 2017-10-27  Ryan Haddad  <ryanhaddad@apple.com>
3677
3678         Unreviewed, rolling out r224011.
3679
3680         xsl LayoutTests hit an assertion added with this change since
3681         r223999 was rolled out.
3682
3683         Reverted changeset:
3684
3685         "Assert that no script is executed during style recalc"
3686         https://bugs.webkit.org/show_bug.cgi?id=178845
3687         https://trac.webkit.org/changeset/224011
3688
3689 2017-10-27  Antoine Quint  <graouts@apple.com>
3690
3691         [Web Animations] Expose the currentTime property on AnimationTimeline
3692         https://bugs.webkit.org/show_bug.cgi?id=178928
3693
3694         Reviewed by Dean Jackson.
3695
3696         We add the currentTime property on AnimationTimeline and add an internals method
3697         to set it in a test which will allow us to validate the timing model state for
3698         a given time.
3699
3700         Test: webanimations/timeline-current-time.html
3701
3702         * animation/AnimationTimeline.cpp:
3703         (WebCore::AnimationTimeline::bindingsCurrentTime const):
3704         (WebCore::AnimationTimeline::setCurrentTime):
3705         * animation/AnimationTimeline.h:
3706         (WebCore::AnimationTimeline::currentTime const):
3707         * animation/AnimationTimeline.idl:
3708         * testing/Internals.cpp:
3709         (WebCore::Internals::setTimelineCurrentTime):
3710         * testing/Internals.h:
3711         * testing/Internals.idl:
3712
3713 2017-10-27  Antoine Quint  <graouts@apple.com>
3714
3715         [Web Animations] Use Seconds vs. MonotonicTime to represent times
3716         https://bugs.webkit.org/show_bug.cgi?id=178950
3717
3718         Reviewed by Dean Jackson.
3719
3720         Animation start times, all expressed in seconds, in the Web Animations API are relative to the timeline
3721         originTime, itself relative to the page's nagigation time (Performance.navigationTime), so it makes more
3722         sense to use Seconds to represent them as opposed to a MonotonicTime.
3723
3724         * animation/WebAnimation.cpp:
3725         (WebCore::WebAnimation::bindingsStartTime const):
3726         (WebCore::WebAnimation::setBindingsStartTime):
3727         * animation/WebAnimation.h:
3728
3729 2017-10-27  Chris Dumez  <cdumez@apple.com>
3730
3731         DOMWindow::dispatchEvent() does not reset the event's dispatch flag
3732         https://bugs.webkit.org/show_bug.cgi?id=178897
3733
3734         Reviewed by Darin Adler.
3735
3736         Make sure we reset the currentTarget, dispatch flag, phase and propagation flags
3737         after dispatching an event on a Window, as per:
3738         - https://dom.spec.whatwg.org/#concept-event-dispatch
3739
3740         This behavior is consistent with Firefox.
3741
3742         Test: fast/events/window-load-initEvent.html
3743
3744         * page/DOMWindow.cpp:
3745         (WebCore::DOMWindow::dispatchEvent):
3746
3747 2017-10-27  Keith Miller  <keith_miller@apple.com>
3748
3749         Move iOS specific sources to unified sources
3750         https://bugs.webkit.org/show_bug.cgi?id=178915
3751
3752         Rubber-stamped by Tim Horton.
3753
3754         * SourcesCocoa.txt:
3755         * SourcesIOS.txt:
3756         * SourcesMac.txt:
3757         * WebCore.xcodeproj/project.pbxproj:
3758
3759 2017-10-27  Eric Carlson  <eric.carlson@apple.com>
3760
3761         NowPlayingInfo should contain a unique identifier
3762         https://bugs.webkit.org/show_bug.cgi?id=178872
3763         <rdar://problem/34924012>
3764
3765         Unreviewed, build fix.
3766
3767         * platform/audio/ios/MediaSessionManagerIOS.mm:
3768         (WebCore::MediaSessionManageriOS::updateNowPlayingInfo): Call string.impl().hash() instead of
3769         string.existingHash() because the later will assert in a debug build if the hash hasn't
3770         been calculated yet.
3771         * platform/audio/mac/MediaSessionManagerMac.mm:
3772         (WebCore::MediaSessionManagerMac::updateNowPlayingInfo): Ditto.
3773
3774 2017-10-27  Alex Christensen  <achristensen@webkit.org>
3775
3776         Fix accessibility/mac/aria-label-on-label-element.html after r224074
3777         https://bugs.webkit.org/show_bug.cgi?id=178892
3778
3779         * accessibility/AccessibilityNodeObject.cpp:
3780         (WebCore::AccessibilityNodeObject::titleElementText const):
3781         (WebCore::AccessibilityNodeObject::ariaLabeledByText const):
3782         * accessibility/AccessibilityObject.h:
3783         (WebCore::AccessibilityText::AccessibilityText):
3784         Turns out my null checks changed behavior.  This undoes them.
3785
3786 2017-10-27  Ryan Haddad  <ryanhaddad@apple.com>
3787
3788         Unreviewed, rolling out r223999.
3789
3790         Caused xsl LayoutTest flakiness.
3791
3792         Reverted changeset:
3793
3794         "Style::Scope::flushPendingUpdate() can replace the entire
3795         document in XSLTProcessor::createDocumentFromSource"
3796         https://bugs.webkit.org/show_bug.cgi?id=178715
3797         https://trac.webkit.org/changeset/223999
3798
3799 2017-10-27  Chris Dumez  <cdumez@apple.com>
3800
3801         Audit init*Event() method to make sure they reset internal data members
3802         https://bugs.webkit.org/show_bug.cgi?id=178886
3803
3804         Reviewed by Ryosuke Niwa.
3805
3806         Audit init*Event() method to make sure they reset internal data members.
3807
3808         * dom/Event.cpp:
3809         (WebCore::Event::initEvent):
3810         * dom/KeyboardEvent.cpp:
3811         (WebCore::KeyboardEvent::initKeyboardEvent):
3812         * dom/MessageEvent.cpp:
3813         (WebCore::MessageEvent::initMessageEvent):
3814         * dom/MouseEvent.cpp:
3815         (WebCore::MouseEvent::initMouseEvent):
3816         * dom/MouseRelatedEvent.h:
3817         (WebCore::MouseRelatedEvent::setIsSimulated):
3818         * dom/TextEvent.cpp:
3819         (WebCore::TextEvent::initTextEvent):
3820         * dom/WheelEvent.cpp:
3821         (WebCore::WheelEvent::initWheelEvent):
3822
3823 2017-10-27  Chris Dumez  <cdumez@apple.com>
3824
3825         Add initial support for serviceWorkerClient.postMessage()
3826         https://bugs.webkit.org/show_bug.cgi?id=178794
3827
3828         Reviewed by Youenn Fablet.
3829
3830         Add initial support for serviceWorkerClient.postMessage():
3831         - https://w3c.github.io/ServiceWorker/#client-postmessage
3832
3833         It is now possible to do bi-directional communication with a service worker
3834         via postMessage().
3835
3836         No new tests, updated existing test.
3837
3838         * WebCore.xcodeproj/project.pbxproj:
3839         * dom/Document.cpp:
3840         (WebCore::generateDocumentIdentifier):
3841         (WebCore::Document::allDocumentsMap):
3842         (WebCore::Document::allDocuments):
3843         (WebCore::m_identifier):
3844         (WebCore::Document::~Document):
3845         * dom/Document.h:
3846         (WebCore::Document::identifier const):
3847         * dom/ScriptExecutionContext.cpp:
3848         (WebCore::ScriptExecutionContext::serviceWorkerContainer):
3849         * dom/ScriptExecutionContext.h:
3850         * workers/service/ServiceWorker.cpp:
3851         (WebCore::ServiceWorker::postMessage):
3852         * workers/service/ServiceWorkerClient.cpp:
3853         (WebCore::ServiceWorkerClient::ServiceWorkerClient):
3854         (WebCore::ServiceWorkerClient::~ServiceWorkerClient):
3855         (WebCore::ServiceWorkerClient::id const):
3856         (WebCore::ServiceWorkerClient::postMessage):
3857         * workers/service/ServiceWorkerClient.h:
3858         (WebCore::ServiceWorkerClient::create):
3859         * workers/service/ServiceWorkerClient.idl:
3860         * workers/service/ServiceWorkerClientIdentifier.h: Copied from Source/WebCore/workers/service/ServiceWorkerClient.idl.
3861         (WebCore::ServiceWorkerClientIdentifier::toString const):
3862         * workers/service/ServiceWorkerRegistration.cpp:
3863         (WebCore::ServiceWorkerRegistration::unregister):
3864         * workers/service/ServiceWorkerWindowClient.cpp:
3865         (WebCore::ServiceWorkerWindowClient::ServiceWorkerWindowClient):
3866         * workers/service/ServiceWorkerWindowClient.h:
3867         * workers/service/context/SWContextManager.cpp:
3868         (WebCore::SWContextManager::postMessageToServiceWorkerGlobalScope):
3869         * workers/service/context/SWContextManager.h:
3870         * workers/service/context/ServiceWorkerThread.cpp:
3871         (WebCore::ServiceWorkerThread::postMessageToServiceWorkerGlobalScope):
3872         * workers/service/context/ServiceWorkerThread.h:
3873         * workers/service/server/SWClientConnection.cpp:
3874         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
3875         * workers/service/server/SWClientConnection.h:
3876
3877 2017-10-27  Frederic Wang  <fwang@igalia.com>
3878
3879         Use auto for some variables in RenderLayerCompositor/Backing
3880         https://bugs.webkit.org/show_bug.cgi?id=178570
3881
3882         Reviewed by Darin Adler.
3883
3884         No new tests, behavior unchanged.
3885
3886         * rendering/RenderLayerBacking.cpp:
3887         (WebCore::canvasCompositingStrategy):
3888         (WebCore::RenderLayerBacking::RenderLayerBacking):
3889         (WebCore::computePageTiledBackingCoverage):
3890         (WebCore::RenderLayerBacking::layerWillBeDestroyed):
3891         (WebCore::RenderLayerBacking::updateBackdropFiltersGeometry):
3892         (WebCore::layerOrAncestorIsTransformedOrUsingCompositedScrolling):
3893         (WebCore::RenderLayerBacking::updateCompositedBounds):
3894         (WebCore::RenderLayerBacking::updateAfterWidgetResize):
3895         (WebCore::RenderLayerBacking::updateAfterLayout):
3896         (WebCore::RenderLayerBacking::updateConfiguration):
3897         (WebCore::ComputedOffsets::fromAncestorGraphicsLayer):
3898         (WebCore::RenderLayerBacking::updateGeometry):
3899         (WebCore::RenderLayerBacking::updateInternalHierarchy):
3900         (WebCore::RenderLayerBacking::positionOverflowControlsLayers):
3901         (WebCore::RenderLayerBacking::hasUnpositionedOverflowControlsLayers const):
3902         (WebCore::RenderLayerBacking::compositingOpacity const):
3903         (WebCore::isRestartedPlugin):
3904         (WebCore::RenderLayerBacking::isDirectlyCompositedImage const):
3905         (WebCore::RenderLayerBacking::updateImageContents):
3906         (WebCore::RenderLayerBacking::setContentsNeedDisplay):
3907         (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
3908         (WebCore::RenderLayerBacking::getCurrentTransform const):
3909         (WebCore::RenderLayerBacking::logFilledVisibleFreshTile):
3910         (WebCore::RenderLayerBacking::startAnimation):
3911         (WebCore::RenderLayerBacking::compositedBoundsIncludingMargin const):
3912         * rendering/RenderLayerCompositor.cpp:
3913         (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
3914         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayersAfterFlushIncludingSubframes):
3915         (WebCore::updateScrollingLayerWithClient):
3916         (WebCore::RenderLayerCompositor::didFlushChangesForLayer):
3917         (WebCore::RenderLayerCompositor::didPaintBacking):
3918         (WebCore::RenderLayerCompositor::didChangeVisibleRect):
3919         (WebCore::RenderLayerCompositor::enclosingCompositorFlushingLayers const):
3920         (WebCore::RenderLayerCompositor::updateCompositingLayers):
3921         (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers):
3922         (WebCore::RenderLayerCompositor::logLayerInfo):
3923         (WebCore::checkIfDescendantClippingContextNeedsUpdate):
3924         (WebCore::styleChangeRequiresLayerRebuild):
3925         (WebCore::RenderLayerCompositor::canCompositeClipPath):
3926         (WebCore::rendererForCompositingTests):
3927         (WebCore::RenderLayerCompositor::updateBacking):
3928         (WebCore::RenderLayerCompositor::repaintOnCompositingChange):
3929         (WebCore::RenderLayerCompositor::repaintInCompositedAncestor):
3930         (WebCore::RenderLayerCompositor::enclosingNonStackingClippingLayer const):
3931         (WebCore::RenderLayerCompositor::setCompositingParent):
3932         (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
3933         (WebCore::RenderLayerCompositor::hasCoordinatedScrolling const):
3934         (WebCore::RenderLayerCompositor::updateScrollLayerPosition):
3935         (WebCore::RenderLayerCompositor::positionForClipLayer const):
3936         (WebCore::RenderLayerCompositor::frameViewDidLayout):
3937         (WebCore::RenderLayerCompositor::rootFixedBackgroundsChanged):
3938         (WebCore::RenderLayerCompositor::scrollingLayerDidChange):
3939         (WebCore::RenderLayerCompositor::frameContentsCompositor):
3940         (WebCore::RenderLayerCompositor::parentFrameContentLayers):
3941         (WebCore::RenderLayerCompositor::updateLayerTreeGeometry):
3942         (WebCore::RenderLayerCompositor::updateCompositingDescendantGeometry):
3943         (WebCore::RenderLayerCompositor::setIsInWindow):
3944         (WebCore::RenderLayerCompositor::clearBackingForLayerIncludingDescendants):
3945         (WebCore::RenderLayerCompositor::clippedByAncestor const):
3946         (WebCore::RenderLayerCompositor::requiresCompositingForBackfaceVisibility const):
3947         (WebCore::RenderLayerCompositor::requiresCompositingForCanvas const):
3948         (WebCore::RenderLayerCompositor::requiresCompositingForPlugin const):
3949         (WebCore::RenderLayerCompositor::requiresCompositingForAnimation const):
3950         (WebCore::RenderLayerCompositor::requiresCompositingForIndirectReason const):
3951         (WebCore::RenderLayerCompositor::isAsyncScrollableStickyLayer const):
3952         (WebCore::RenderLayerCompositor::isViewportConstrainedFixedOrStickyLayer const):
3953         (WebCore::RenderLayerCompositor::requiresScrollLayer const):
3954         (WebCore::RenderLayerCompositor::supportsFixedRootBackgroundCompositing const):
3955         (WebCore::RenderLayerCompositor::fixedRootBackgroundLayer const):
3956         (WebCore::RenderLayerCompositor::resetTrackedRepaintRects):
3957         (WebCore::RenderLayerCompositor::contentsScaleMultiplierForNewTiles const):
3958         (WebCore::RenderLayerCompositor::documentUsesTiledBacking const):
3959         (WebCore::RenderLayerCompositor::shouldCompositeOverflowControls const):
3960         (WebCore::RenderLayerCompositor::updateLayerForHeader):
3961         (WebCore::RenderLayerCompositor::updateLayerForFooter):
3962         (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
3963         (WebCore::RenderLayerCompositor::ensureRootLayer):
3964         (WebCore::RenderLayerCompositor::destroyRootLayer):
3965         (WebCore::RenderLayerCompositor::attachRootLayer):
3966         (WebCore::RenderLayerCompositor::detachRootLayer):
3967         (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged):
3968         (WebCore::RenderLayerCompositor::notifyIFramesOfCompositingChange):
3969         (WebCore::RenderLayerCompositor::deviceOrPageScaleFactorChanged):
3970         (WebCore::RenderLayerCompositor::computeFixedViewportConstraints const):
3971         (WebCore::RenderLayerCompositor::computeStickyViewportConstraints const):
3972         (WebCore::enclosingScrollingNodeID):
3973         (WebCore::scrollCoordinatedAncestorInParentOfFrame):
3974         (WebCore::RenderLayerCompositor::reattachSubframeScrollLayers):
3975         (WebCore::RenderLayerCompositor::attachScrollingNode):
3976         (WebCore::RenderLayerCompositor::detachScrollCoordinatedLayer):
3977         (WebCore::RenderLayerCompositor::updateScrollCoordinationForThisFrame):
3978         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
3979         (WebCore::RenderLayerCompositor::unregisterAllScrollingLayers):
3980         (WebCore::RenderLayerCompositor::willRemoveScrollingLayerWithBacking):
3981         (WebCore::RenderLayerCompositor::didAddScrollingLayer):
3982         (WebCore::RenderLayerCompositor::updateScrollSnapPropertiesWithFrameView):
3983
3984 2017-10-27  Alicia Boya García  <aboya@igalia.com>
3985
3986         [GStreamer][MSE] Trim space between codecs
3987         https://bugs.webkit.org/show_bug.cgi?id=178160
3988
3989         Reviewed by Xabier Rodriguez-Calvar.
3990
3991         Modify supportsCodecs() to accept a Vector<String> instead of
3992         receiving a string and parsing itself.
3993
3994         This improves passrate for `mediasource-is-type-supported` as it
3995         ensures that whitespace between codecs is now trimmed and codec
3996         strings such as `video/webm;codecs="opus, vp9"` are matched as a valid
3997         type, as required by the spec.
3998
3999         This patch also renames supportCodecs() to supportAllCodecs() and adds