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