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