Support updating a service worker registration's updateViaCache flag
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-12-15  Chris Dumez  <cdumez@apple.com>
2
3         Support updating a service worker registration's updateViaCache flag
4         https://bugs.webkit.org/show_bug.cgi?id=180888
5
6         Reviewed by Brady Eidson.
7
8         Support updating a service worker registration's updateViaCache flag to match other browsers:
9         - https://github.com/w3c/ServiceWorker/issues/1189
10
11         No new tests, rebaselined existing test.
12
13         * workers/service/SWClientConnection.cpp:
14         (WebCore::SWClientConnection::setRegistrationUpdateViaCache):
15         * workers/service/SWClientConnection.h:
16         * workers/service/ServiceWorkerRegistration.cpp:
17         (WebCore::ServiceWorkerRegistration::setUpdateViaCache):
18         * workers/service/ServiceWorkerRegistration.h:
19         * workers/service/server/SWServer.h:
20         * workers/service/server/SWServerJobQueue.cpp:
21         (WebCore::SWServerJobQueue::runRegisterJob):
22         * workers/service/server/SWServerRegistration.cpp:
23         (WebCore::SWServerRegistration::setUpdateViaCache):
24         * workers/service/server/SWServerRegistration.h:
25
26 2017-12-15  Ryan Haddad  <ryanhaddad@apple.com>
27
28         Unreviewed, rolling out r225941.
29
30         This change introduced LayoutTest crashes and assertion
31         failures.
32
33         Reverted changeset:
34
35         "Web Inspector: replace HTMLCanvasElement with
36         CanvasRenderingContext for instrumentation logic"
37         https://bugs.webkit.org/show_bug.cgi?id=180770
38         https://trac.webkit.org/changeset/225941
39
40 2017-12-15  Ryosuke Niwa  <rniwa@webkit.org>
41
42         Add a release assert that Timer::m_wasDeleted is false in setNextFireTime
43         https://bugs.webkit.org/show_bug.cgi?id=180860
44         <rdar://problem/36066500>
45
46         Reviewed by David Kilzer.
47
48         Turn an exist debug-only assertion into a release assertion to help diagnose a crash
49         which appears to be caused by a freed timer getting scheduled back into the timer heap.
50
51         * platform/Timer.cpp:
52         (WebCore::TimerBase::~TimerBase):
53         (WebCore::TimerBase::setNextFireTime):
54         * platform/Timer.h:
55
56 2017-12-15  Simon Fraser  <simon.fraser@apple.com>
57
58         Elements animated on-screen are missing sometimes
59         https://bugs.webkit.org/show_bug.cgi?id=180773
60         rdar://problem/34923438
61
62         Reviewed by Zalan Bujtas.
63         
64         After r225310 it was still possible for elements to be missing backing store when brought
65         on-screen via an animation. This occurred if a child element was outside the bounds of the
66         element being animated.
67
68         Fix by making sure that GraphicsLayer's "animatedExtent" took composited child layers into account.
69
70         As for r225310, no test because this is timing sensitive and hard to reliably make a test for.
71
72         * rendering/RenderLayer.cpp:
73         (WebCore::RenderLayer::calculateClipRects const):
74         * rendering/RenderLayer.h:
75         * rendering/RenderLayerBacking.cpp:
76         (WebCore::RenderLayerBacking::updateGeometry):
77
78 2017-12-15  Chris Dumez  <cdumez@apple.com>
79
80         imported/w3c/web-platform-tests/service-workers/service-worker/update.https.html is sometimes crashing in Debug builds
81         https://bugs.webkit.org/show_bug.cgi?id=180867
82
83         Reviewed by Brady Eidson.
84
85         Fix assertion to make sure the worker is terminating if it is already in m_runningOrTerminatingWorkers.
86
87         * workers/service/server/SWServer.cpp:
88         (WebCore::SWServer::runServiceWorker):
89
90 2017-12-15  Chris Dumez  <cdumez@apple.com>
91
92         Service Worker Registration promise is sometimes not rejected when the script load fails
93         https://bugs.webkit.org/show_bug.cgi?id=180849
94
95         Reviewed by Brady Eidson.
96
97         Service Worker Registration promise is sometimes not rejected when the script load fails.
98         This was caused by the ServiceWorkerJob sometimes passing a null ResourceError to the
99         StorageProcess, even though the load failed.
100
101         No new tests, rebaselined exisiting tests.
102
103         * workers/WorkerScriptLoader.cpp:
104         (WebCore::WorkerScriptLoader::notifyError):
105         * workers/service/ServiceWorkerJob.cpp:
106         (WebCore::ServiceWorkerJob::notifyFinished):
107
108 2017-12-15  Youenn Fablet  <youenn@apple.com>
109
110         WebRTC Stats should not be console logged from a background thread
111         https://bugs.webkit.org/show_bug.cgi?id=180845
112
113         Reviewed by Eric Carlson.
114
115         Ensuring console log are done in the main thread.
116
117         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
118         (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered):
119
120 2017-12-15  Antti Koivisto  <antti@apple.com>
121
122         Introduce RenderTreeBuilder
123         https://bugs.webkit.org/show_bug.cgi?id=180817
124
125         Reviewed by Zalan Bujtas.
126
127         RenderTreeBuilder is responsible of building the render tree, including construction of various anonymous
128         renderers. Renderer subtype specific render tree construction code will eventually move there.
129
130         This patch adds RenderTreeBuilder class and passes it as a parameter for all addChild implementations.
131         Future patches can then mechanically move the building code from renderers to RenderTreeBuilder.
132
133         It also moves one addChild implementation (RenderRuby::addChild -> RenderTreeBuilder::rubyRunInsertChild)
134         to RenderTreeBuilder as a test.
135
136         * WebCore.xcodeproj/project.pbxproj:
137         * rendering/RenderBlock.cpp:
138         (WebCore::RenderBlock::addChildToContinuation):
139         (WebCore::RenderBlock::addChild):
140         (WebCore::RenderBlock::addChildIgnoringContinuation):
141         * rendering/RenderBlock.h:
142         * rendering/RenderBlockFlow.cpp:
143         (WebCore::RenderBlockFlow::addChild):
144         * rendering/RenderBlockFlow.h:
145         * rendering/RenderBoxModelObject.cpp:
146         (WebCore::RenderBoxModelObject::moveChildTo):
147         * rendering/RenderButton.cpp:
148         (WebCore::RenderButton::addChild):
149         (WebCore::RenderButton::setText):
150         * rendering/RenderButton.h:
151         * rendering/RenderElement.cpp:
152         (WebCore::RenderElement::addChild):
153         * rendering/RenderElement.h:
154         (WebCore::RenderElement::addChildIgnoringContinuation):
155         * rendering/RenderFullScreen.cpp:
156         (WebCore::RenderFullScreen::wrapNewRenderer):
157         (WebCore::RenderFullScreen::wrapExistingRenderer):
158         (WebCore::RenderFullScreen::unwrapRenderer):
159         (WebCore::RenderFullScreen::createPlaceholder):
160         * rendering/RenderGrid.cpp:
161         (WebCore::RenderGrid::addChild):
162         * rendering/RenderGrid.h:
163         * rendering/RenderInline.cpp:
164         (WebCore::RenderInline::addChild):
165         (WebCore::RenderInline::addChildIgnoringContinuation):
166         (WebCore::RenderInline::splitInlines):
167         (WebCore::RenderInline::splitFlow):
168         (WebCore::RenderInline::addChildToContinuation):
169         (WebCore::RenderInline::childBecameNonInline):
170         * rendering/RenderInline.h:
171         * rendering/RenderMenuList.cpp:
172         (WebCore::RenderMenuList::createInnerBlock):
173         (RenderMenuList::addChild):
174         (RenderMenuList::setText):
175         * rendering/RenderMenuList.h:
176         * rendering/RenderMultiColumnFlow.cpp:
177         (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant):
178         * rendering/RenderQuote.cpp:
179         (WebCore::RenderQuote::updateTextRenderer):
180         (WebCore::RenderQuote::updateRenderer):
181         * rendering/RenderQuote.h:
182         * rendering/RenderRuby.cpp:
183         (WebCore::RenderRubyAsInline::addChild):
184         (WebCore::RenderRubyAsBlock::addChild):
185         * rendering/RenderRuby.h:
186         * rendering/RenderRubyBase.h:
187         * rendering/RenderRubyRun.cpp:
188         (WebCore::RenderRubyRun::rubyBaseSafe):
189         (WebCore::RenderRubyRun::addChild): Deleted.
190         * rendering/RenderRubyRun.h:
191         * rendering/RenderTable.cpp:
192         (WebCore::RenderTable::addChild):
193         * rendering/RenderTable.h:
194         * rendering/RenderTableRow.cpp:
195         (WebCore::RenderTableRow::addChild):
196         * rendering/RenderTableRow.h:
197         * rendering/RenderTableSection.cpp:
198         (WebCore::RenderTableSection::addChild):
199         * rendering/RenderTableSection.h:
200         * rendering/RenderTreeBuilder.cpp: Added.
201         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
202         (WebCore::RenderTreeBuilder::~RenderTreeBuilder):
203         (WebCore::RenderTreeBuilder::insertChild):
204         (WebCore::RenderTreeBuilder::rubyRunInsertChild):
205         * rendering/RenderTreeBuilder.h: Added.
206         (WebCore::RenderTreeBuilder::current):
207         * rendering/TextAutoSizing.cpp:
208         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
209         * rendering/mathml/RenderMathMLFenced.cpp:
210         (WebCore::RenderMathMLFenced::updateFromElement):
211         (WebCore::RenderMathMLFenced::makeFences):
212         (WebCore::RenderMathMLFenced::addChild):
213         * rendering/mathml/RenderMathMLFenced.h:
214         * rendering/svg/RenderSVGContainer.cpp:
215         (WebCore::RenderSVGContainer::addChild):
216         * rendering/svg/RenderSVGContainer.h:
217         * rendering/svg/RenderSVGInline.cpp:
218         (WebCore::RenderSVGInline::addChild):
219         * rendering/svg/RenderSVGInline.h:
220         * rendering/svg/RenderSVGRoot.cpp:
221         (WebCore::RenderSVGRoot::addChild):
222         * rendering/svg/RenderSVGRoot.h:
223         * rendering/svg/RenderSVGText.cpp:
224         (WebCore::RenderSVGText::addChild):
225         * rendering/svg/RenderSVGText.h:
226         * style/RenderTreePosition.cpp:
227         (WebCore::RenderTreePosition::insert): Deleted.
228         * style/RenderTreePosition.h:
229         (WebCore::RenderTreePosition::RenderTreePosition):
230         (WebCore::RenderTreePosition::nextSibling const):
231         (WebCore::RenderTreePosition::canInsert const): Deleted.
232         * style/RenderTreeUpdater.cpp:
233         (WebCore::RenderTreeUpdater::updateAfterDescendants):
234         (WebCore::RenderTreeUpdater::createRenderer):
235         (WebCore::RenderTreeUpdater::createTextRenderer):
236         (WebCore::RenderTreeUpdater::updateTextRenderer):
237         (WebCore::createTextRenderer): Deleted.
238         * style/RenderTreeUpdater.h:
239         * style/RenderTreeUpdaterFirstLetter.cpp:
240         (WebCore::updateFirstLetterStyle):
241         (WebCore::createFirstLetterRenderer):
242         * style/RenderTreeUpdaterGeneratedContent.cpp:
243         (WebCore::RenderTreeUpdater::GeneratedContent::updateQuotesUpTo):
244         (WebCore::createContentRenderers):
245         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
246         * style/RenderTreeUpdaterListItem.cpp:
247         (WebCore::RenderTreeUpdater::ListItem::updateMarker):
248         * style/RenderTreeUpdaterListItem.h:
249         * style/RenderTreeUpdaterMultiColumn.cpp:
250         (WebCore::RenderTreeUpdater::MultiColumn::createFragmentedFlow):
251         (WebCore::RenderTreeUpdater::MultiColumn::destroyFragmentedFlow):
252
253 2017-12-14  Youenn Fablet  <youenn@apple.com>
254
255         Implement <iframe allow="camera; microphone">
256         https://bugs.webkit.org/show_bug.cgi?id=167430
257
258         Reviewed by Eric Carlson.
259
260         Tests: imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-default-feature-policy.https.sub.html
261
262         Adding allow attribute to HTMLIFrameElement as per https://wicg.github.io/feature-policy/#iframe-allow-attribute.
263         Cross-origin iframes will get access to camera/microphone based on this attribute value.
264         Same-origin iframes do not need any attribute.
265         In case getUserMedia requests both camera and microphone, and allow attribute is only one of these,
266         getUserMedia access is denied. This goes against the tests but is not very clear from the specification.
267
268         * Modules/mediastream/UserMediaRequest.cpp:
269         (WebCore::isSecure):
270         (WebCore::isAllowedToUse):
271         (WebCore::canCallGetUserMedia):
272         (WebCore::UserMediaRequest::start):
273         * html/HTMLAttributeNames.in:
274         * html/HTMLIFrameElement.cpp:
275         (WebCore::HTMLIFrameElement::parseAttribute):
276         * html/HTMLIFrameElement.h:
277         * html/HTMLIFrameElement.idl:
278
279 2017-12-14  Zalan Bujtas  <zalan@apple.com>
280
281         Inconsistent section grid could lead to CrashOnOverflow
282         https://bugs.webkit.org/show_bug.cgi?id=180850
283         <rdar://problem/34064811>
284
285         Reviewed by Simon Fraser.
286
287         Each RenderTableSection maintains a grid of rows and columns. The number of columns in this grid equals the
288         maximum number of columns in the entire table (taking spans and multiple sections into account).
289         Since the maximum number of columns might change while re-computing the sections, we need to
290         adjust them accordingly at the end (otherwise it could lead to inconsistent grids where rows have different number of columns).
291
292         Test: fast/table/table-row-oveflow-crash.html
293
294         * rendering/RenderTable.cpp:
295         (WebCore::RenderTable::recalcSections const):
296         * rendering/RenderTableSection.cpp:
297         (WebCore::RenderTableSection::removeRedundantColumns):
298         * rendering/RenderTableSection.h:
299
300 2017-12-14  David Kilzer  <ddkilzer@apple.com>
301
302         Enable -Wstrict-prototypes for WebKit
303         <https://webkit.org/b/180757>
304         <rdar://problem/36024132>
305
306         Rubber-stamped by Joseph Pecoraro.
307
308         * Configurations/Base.xcconfig:
309         (CLANG_WARN_STRICT_PROTOTYPES): Add. Set to YES.
310
311 2017-12-14  Youenn Fablet  <youenn@apple.com>
312
313         srflx and relay ICE candidates lack raddr (rel-addr) and rport (rel-port) attributes if getUserMedia access has not been granted
314         https://bugs.webkit.org/show_bug.cgi?id=180842
315
316         Reviewed by Jon Lee.
317
318         Manually tested since there is no way to gather reflexive or stun candidates in WebKit CI.
319
320         * Modules/mediastream/PeerConnectionBackend.cpp:
321         (WebCore::filterICECandidate):
322
323 2017-12-14  Commit Queue  <commit-queue@webkit.org>
324
325         Unreviewed, rolling out r225878.
326         https://bugs.webkit.org/show_bug.cgi?id=180855
327
328         Introduced a crash in HTMLPictureElement. We're taking a
329         different approach for webkit.org/b/180769 (Requested by rniwa
330         on #webkit).
331
332         Reverted changeset:
333
334         "Crash inside ImageLoader::updateFromElement()"
335         https://bugs.webkit.org/show_bug.cgi?id=180769
336         https://trac.webkit.org/changeset/225878
337
338 2017-12-14  Ryan Haddad  <ryanhaddad@apple.com>
339
340         Unreviewed, rolling out r225931.
341
342         Breaks internal builds.
343
344         Reverted changeset:
345
346         "Fix Mac CMake build"
347         https://bugs.webkit.org/show_bug.cgi?id=180835
348         https://trac.webkit.org/changeset/225931
349
350 2017-12-14  Simon Fraser  <simon.fraser@apple.com>
351
352         Another Windows build fix.
353
354         * platform/graphics/cg/GraphicsContextCG.cpp:
355         (WebCore::extendedSRGBColorSpaceRef):
356
357 2017-12-14  Simon Fraser  <simon.fraser@apple.com>
358
359         Fix Windows build after r225915.
360
361         Windows doens't have dispatch_once with blocks. Switch to use lambda functions instead.
362
363         * platform/graphics/cg/GraphicsContextCG.cpp:
364         (WebCore::sRGBColorSpaceRef):
365         (WebCore::linearRGBColorSpaceRef):
366         (WebCore::extendedSRGBColorSpaceRef):
367         (WebCore::displayP3ColorSpaceRef):
368
369 2017-12-14  Devin Rousso  <webkit@devinrousso.com>
370
371         Web Inspector: replace HTMLCanvasElement with CanvasRenderingContext for instrumentation logic
372         https://bugs.webkit.org/show_bug.cgi?id=180770
373
374         Reviewed by Joseph Pecoraro.
375
376         No change in functionality.
377
378         * html/canvas/CanvasRenderingContext.h:
379         * html/canvas/CanvasRenderingContext.cpp:
380         (WebCore::CanvasRenderingContext::~CanvasRenderingContext):
381         Instead of waiting on the HTMLCanvasElement to destruct to call willDestroyCanvasRenderingContext
382         we can call out in the destructor and know that the CanvasRenderingContext will be destroyed
383         immediately thereafter.
384
385         * html/canvas/CanvasRenderingContext2D.h:
386         * html/canvas/CanvasRenderingContext2D.cpp:
387         (WebCore::CanvasRenderingContext2D::create):
388         * html/canvas/ImageBitmapRenderingContext.h:
389         * html/canvas/ImageBitmapRenderingContext.cpp:
390         (WebCore::ImageBitmapRenderingContext::create):
391         * html/canvas/WebGL2RenderingContext.h:
392         * html/canvas/WebGL2RenderingContext.cpp:
393         (WebCore::WebGL2RenderingContext::create):
394         * html/canvas/WebGLRenderingContext.h:
395         * html/canvas/WebGLRenderingContext.cpp:
396         (WebCore::WebGLRenderingContext::create):
397         * html/canvas/WebGLRenderingContextBase.cpp:
398         (WebCore::WebGLRenderingContextBase::create):
399         * html/canvas/WebGPURenderingContext.cpp:
400         (WebCore::WebGPURenderingContext::create):
401         * html/HTMLCanvasElement.cpp:
402         (WebCore::HTMLCanvasElement::createContext2d):
403         (WebCore::HTMLCanvasElement::createContextWebGL):
404         (WebCore::HTMLCanvasElement::createContextWebGPU):
405         (WebCore::HTMLCanvasElement::createContextBitmapRenderer):
406         (WebCore::HTMLCanvasElement::paint):
407         (WebCore::HTMLCanvasElement::setImageBuffer const):
408         Instead of adding didCreateCanvasRenderingContext calls at the construction sites of each
409         context, we can make the constructors private and force the usage of static `create` functions.
410         This way, we have access to the fully constructed object and have a guaranteed path for creation.
411
412         * inspector/InspectorCanvas.h:
413         * inspector/InspectorCanvas.cpp:
414         (WebCore::InspectorCanvas::create):
415         (WebCore::InspectorCanvas::InspectorCanvas):
416         (WebCore::InspectorCanvas::canvasElement):
417         (WebCore::InspectorCanvas::resetRecordingData):
418         (WebCore::InspectorCanvas::recordAction):
419         (WebCore::InspectorCanvas::buildObjectForCanvas):
420         (WebCore::InspectorCanvas::getCanvasContentAsDataURL):
421         (WebCore::InspectorCanvas::buildInitialState):
422         
423         * inspector/InspectorShaderProgram.h:
424         * inspector/InspectorShaderProgram.cpp:
425         (WebCore::InspectorShaderProgram::context const):
426
427         * inspector/agents/InspectorCanvasAgent.h:
428         * inspector/agents/InspectorCanvasAgent.cpp:
429         (WebCore::InspectorCanvasAgent::InspectorCanvasAgent):
430         (WebCore::InspectorCanvasAgent::enable):
431         (WebCore::InspectorCanvasAgent::disable):
432         (WebCore::InspectorCanvasAgent::requestNode):
433         (WebCore::InspectorCanvasAgent::requestContent):
434         (WebCore::InspectorCanvasAgent::requestCSSCanvasClientNodes):
435         (WebCore::contextAsScriptValue):
436         (WebCore::InspectorCanvasAgent::resolveCanvasContext):
437         (WebCore::InspectorCanvasAgent::startRecording):
438         (WebCore::InspectorCanvasAgent::stopRecording):
439         (WebCore::InspectorCanvasAgent::updateShader):
440         (WebCore::InspectorCanvasAgent::frameNavigated):
441         (WebCore::InspectorCanvasAgent::didChangeCSSCanvasClientNodes):
442         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
443         (WebCore::InspectorCanvasAgent::willDestroyCanvasRenderingContext):
444         (WebCore::InspectorCanvasAgent::didChangeCanvasMemory):
445         (WebCore::InspectorCanvasAgent::recordCanvasAction):
446         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
447         (WebCore::InspectorCanvasAgent::consoleStartRecordingCanvas):
448         (WebCore::InspectorCanvasAgent::didEnableExtension):
449         (WebCore::InspectorCanvasAgent::didCreateProgram):
450         (WebCore::InspectorCanvasAgent::canvasDestroyedTimerFired):
451         (WebCore::InspectorCanvasAgent::canvasRecordingTimerFired):
452         (WebCore::InspectorCanvasAgent::clearCanvasData):
453         (WebCore::InspectorCanvasAgent::unbindCanvas):
454         (WebCore::InspectorCanvasAgent::findInspectorCanvas):
455         (WebCore::InspectorCanvasAgent::unbindProgram):
456         (WebCore::InspectorCanvasAgent::didCreateCSSCanvas): Deleted.
457         (WebCore::InspectorCanvasAgent::canvasDestroyed): Deleted.
458
459         * inspector/InspectorInstrumentation.h:
460         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext):
461         (WebCore::InspectorInstrumentation::willDestroyCanvasRenderingContext):
462         (WebCore::InspectorInstrumentation::didChangeCanvasMemory):
463         (WebCore::InspectorInstrumentation::recordCanvasAction):
464         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrame):
465         (WebCore::InspectorInstrumentation::didEnableExtension):
466         (WebCore::InspectorInstrumentation::didCreateProgram):
467         (WebCore::InspectorInstrumentation::willDeleteProgram):
468         (WebCore::InspectorInstrumentation::isShaderProgramDisabled):
469         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvas):
470         (WebCore::InspectorInstrumentation::didCreateCSSCanvas): Deleted.
471         * inspector/InspectorInstrumentation.cpp:
472         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvasImpl):
473         (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodesImpl):
474         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContextImpl):
475         (WebCore::InspectorInstrumentation::willDestroyCanvasRenderingContextImpl):
476         (WebCore::InspectorInstrumentation::didChangeCanvasMemoryImpl):
477         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrameImpl):
478         (WebCore::InspectorInstrumentation::didEnableExtensionImpl):
479         (WebCore::InspectorInstrumentation::didCreateProgramImpl):
480         (WebCore::InspectorInstrumentation::didCreateCSSCanvasImpl): Deleted.
481
482         * page/PageConsoleClient.cpp:
483         (WebCore::PageConsoleClient::record):
484         (WebCore::PageConsoleClient::recordEnd):
485
486         * dom/Document.h:
487         * dom/Document.cpp:
488         (WebCore::Document::getCSSCanvasElement):
489         (WebCore::Document::nameForCSSCanvasElement const):
490         We have no reason to save the CSS canvas name for each InspectorCanvas object, so instead we
491         can just query for the name based on the CanvasRenderingContext's HTMLCanvasElement (assuming
492         it is not an OffscreenCanvas) when we need it.
493
494 2017-12-14  Chris Dumez  <cdumez@apple.com>
495
496         self.importScripts() should obey updateViaCache inside service workers
497         https://bugs.webkit.org/show_bug.cgi?id=180826
498
499         Reviewed by Youenn Fablet.
500
501         self.importScripts() should obey updateViaCache inside service workers, as per:
502         - https://html.spec.whatwg.org/multipage/workers.html#dom-workerglobalscope-importscripts
503
504         Tests: http/tests/workers/service/registration-updateViaCache-all-importScripts.html
505                http/tests/workers/service/registration-updateViaCache-imports-importScripts.html
506                http/tests/workers/service/registration-updateViaCache-none-importScripts.html
507
508         * workers/WorkerGlobalScope.cpp:
509         (WebCore::WorkerGlobalScope::importScripts):
510         * workers/WorkerScriptLoader.cpp:
511         (WebCore::WorkerScriptLoader::loadSynchronously):
512         * workers/WorkerScriptLoader.h:
513         * workers/service/SWClientConnection.cpp:
514         (WebCore::SWClientConnection::setRegistrationLastUpdateTime):
515         * workers/service/SWClientConnection.h:
516         * workers/service/ServiceWorkerRegistration.cpp:
517         (WebCore::ServiceWorkerRegistration::lastUpdateTime const):
518         (WebCore::ServiceWorkerRegistration::setLastUpdateTime):
519         * workers/service/ServiceWorkerRegistration.h:
520         * workers/service/server/SWServer.h:
521         * workers/service/server/SWServerRegistration.cpp:
522         (WebCore::SWServerRegistration::setLastUpdateTime):
523         * workers/service/server/SWServerRegistration.h:
524
525 2017-12-14  Yusuke Suzuki  <utatane.tea@gmail.com>
526
527         Drop Thread::tryCreate
528         https://bugs.webkit.org/show_bug.cgi?id=180808
529
530         Reviewed by Darin Adler.
531
532         This change reveals that nobody cares the WorkerThread::start's failure.
533         We should use `Thread::create` to ensure thread is actually starting.
534
535         * workers/WorkerThread.cpp:
536         (WebCore::WorkerThread::start):
537         * workers/WorkerThread.h:
538
539 2017-12-14  Alicia Boya García  <aboya@igalia.com>
540
541         [MSE] Add isValid() check before using trackBuffer.lastEnqueuedPresentationTime
542         https://bugs.webkit.org/show_bug.cgi?id=180258
543
544         Reviewed by Jer Noble.
545
546         * Modules/mediasource/SourceBuffer.cpp:
547         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
548
549 2017-12-14  John Wilander  <wilander@apple.com>
550
551         Storage Access API: Implement frame-specific access in the document.cookie layer
552         https://bugs.webkit.org/show_bug.cgi?id=180682
553         <rdar://problem/35982257>
554
555         Reviewed by Alex Christensen.
556
557         No new tests. Changed expected result from existing test.
558
559         CookiesStrategy::cookiesForDOM(), CookiesStrategy::setCookiesFromDOM(),
560         CookiesStrategy::cookieRequestHeaderFieldValue(), and
561         CookiesStrategy::getRawCookies() now take optional parameters for
562         frameID and pageID to allow frame-specific scoping of cookies.
563
564         This change makes the return values of FrameLoaderClient::frameID()
565         and FrameLoaderClient::pageID() std::optional<uint64_t> so that
566         WebCore can call those getters and get the right return values in
567         WebKit and std:nullopt in WebKitLegacy.
568
569         * dom/Document.cpp:
570         (WebCore::Document::requestStorageAccess):
571         * loader/CookieJar.cpp:
572         (WebCore::cookies):
573         (WebCore::setCookies):
574         (WebCore::cookieRequestHeaderFieldValue):
575         (WebCore::getRawCookies):
576         * loader/EmptyFrameLoaderClient.h:
577         * loader/FrameLoaderClient.h:
578         * platform/CookiesStrategy.h:
579         * platform/network/CacheValidation.cpp:
580         (WebCore::headerValueForVary):
581         * platform/network/PlatformCookieJar.h:
582         * platform/network/cf/CookieJarCFNet.cpp:
583         (WebCore::setCookiesFromDOM):
584         (WebCore::cookiesForDOM):
585         (WebCore::cookieRequestHeaderFieldValue):
586         (WebCore::getRawCookies):
587         * platform/network/curl/CookieJarCurl.cpp:
588         (WebCore::CookieJarCurlFileSystem::setCookiesFromDOM):
589         (WebCore::CookieJarCurlFileSystem::cookiesForDOM):
590         (WebCore::CookieJarCurlFileSystem::cookieRequestHeaderFieldValue):
591         (WebCore::CookieJarCurlFileSystem::getRawCookies):
592         (WebCore::cookiesForDOM):
593         (WebCore::setCookiesFromDOM):
594         (WebCore::cookieRequestHeaderFieldValue):
595         (WebCore::getRawCookies):
596         * platform/network/curl/CookieJarCurl.h:
597         * platform/network/mac/CookieJarMac.mm:
598         (WebCore::cookiesInPartitionForURL):
599         (WebCore::cookiesForURL):
600         (WebCore::cookiesForSession):
601         (WebCore::cookiesForDOM):
602         (WebCore::cookieRequestHeaderFieldValue):
603         (WebCore::setCookiesFromDOM):
604         (WebCore::getRawCookies):
605         * platform/network/soup/CookieJarSoup.cpp:
606         (WebCore::setCookiesFromDOM):
607         (WebCore::cookiesForDOM):
608         (WebCore::cookieRequestHeaderFieldValue):
609         (WebCore::getRawCookies):
610
611 2017-12-14  Alex Christensen  <achristensen@webkit.org>
612
613         Fix Mac CMake build
614         https://bugs.webkit.org/show_bug.cgi?id=180835
615
616         Reviewed by Andy Estes.
617
618         * PlatformMac.cmake:
619         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
620
621 2017-12-14  Antoine Quint  <graouts@apple.com>
622
623         [Web Animations] Use is<> when possible
624         https://bugs.webkit.org/show_bug.cgi?id=180832
625
626         Reviewed by Dean Jackson.
627
628         Adopt is<> when possible.
629
630         * animation/WebAnimation.cpp:
631         (WebCore::WebAnimation::setEffect):
632         (WebCore::WebAnimation::setTimeline):
633         (WebCore::WebAnimation::startOrStopAccelerated):
634
635 2017-12-14  Antoine Quint  <graouts@apple.com>
636
637         [Web Animations] Bring timeline and currentTime setters closer to compliance
638         https://bugs.webkit.org/show_bug.cgi?id=180834
639
640         Reviewed by Dean Jackson.
641
642         Now that we've added support for the concept of a hold time, pending tasks
643         and updating the finished state, adopt those in places we had already implemented
644         but weren't fully compliant.
645
646         Web Platform Tests cover these behaviors, but we're currently failing those tests
647         due to lacking an implementation for Element.animate().
648
649         * animation/WebAnimation.cpp:
650         (WebCore::WebAnimation::setTimeline): Add some spec comments to clarify the code behavior
651         and implement step 4 of the "setting the timeline" procedure where we reset the hold time
652         to an unresolved value if the start time is resolved, as well as step 5 where we update the
653         finished state. Finally, we also ensure we update the pending tasks as the ready state is
654         dependent on a timeline being set.
655         (WebCore::WebAnimation::bindingsStartTime const): Invert the way we test for an unresolved
656         value to match prior review comments by Dean Jackson.
657         (WebCore::WebAnimation::setBindingsStartTime): Use a boolean check rather than checking
658         equality with std::nullopt.
659         (WebCore::WebAnimation::setBindingsCurrentTime): Do not raise an exception when setting
660         an unresolved time.
661
662 2017-12-14  Antoine Quint  <graouts@apple.com>
663
664         [Web Animations] Implement the cancel() method on Animation
665         https://bugs.webkit.org/show_bug.cgi?id=180830
666         <rdar://problem/36055816>
667
668         Reviewed by Dean Jackson.
669
670         We implement the cancel() method on the Animation interface with full spec text defining
671         the normative behavior of those methods and code matching those steps. Implementing the
672         cancel() method required implementing the notion of "resetting pending tasks",
673         which the Web Animations spec defines as well.
674
675         * animation/WebAnimation.cpp:
676         (WebCore::WebAnimation::setEffect):
677         (WebCore::WebAnimation::cancel):
678         (WebCore::WebAnimation::resetPendingTasks):
679         * animation/WebAnimation.h:
680         * animation/WebAnimation.idl:
681
682 2017-12-14  Jer Noble  <jer.noble@apple.com>
683
684         "Click to exit fullscreen" text not legible on High Sierra
685         https://bugs.webkit.org/show_bug.cgi?id=180825
686         <rdar://problem/32839983>
687
688         Reviewed by Eric Carlson.
689
690         Explicitly set the NSVisualAffectView's .appearance property.
691
692         * platform/mac/WebCoreFullScreenPlaceholderView.mm:
693         (-[WebCoreFullScreenPlaceholderView initWithFrame:]):
694
695 2017-12-14  Antoine Quint  <graouts@apple.com>
696
697         [Web Animations] Implement the finish() method on Animation
698         https://bugs.webkit.org/show_bug.cgi?id=180822
699         <rdar://problem/36053282>
700
701         Reviewed by Dean Jackson.
702
703         We implement the finish() method on the Animation interface with full spec text defining
704         the normative behavior of those methods and code matching those steps. Implementing the
705         finish() method required implementing the notion of "silently setting the current time",
706         which the Web Animations spec defines as well.
707
708         * animation/WebAnimation.cpp:
709         (WebCore::WebAnimation::silentlySetCurrentTime):
710         (WebCore::WebAnimation::setCurrentTime):
711         (WebCore::WebAnimation::finish):
712         * animation/WebAnimation.h:
713         * animation/WebAnimation.idl:
714
715 2017-12-14  Chris Dumez  <cdumez@apple.com>
716
717         Service worker script fetching currently always uses the network cache
718         https://bugs.webkit.org/show_bug.cgi?id=180816
719
720         Reviewed by Alex Christensen.
721
722         Service worker script fetching currently always uses the network cache. This is incorrect as per:
723         - https://w3c.github.io/ServiceWorker/#update-algorithm (step 7.2)
724
725         Tests: http/tests/workers/service/registration-updateViaCache-all.html
726                http/tests/workers/service/registration-updateViaCache-none.html
727
728         * workers/Worker.cpp:
729         (WebCore::Worker::create):
730         * workers/WorkerScriptLoader.cpp:
731         (WebCore::WorkerScriptLoader::loadAsynchronously):
732         * workers/WorkerScriptLoader.h:
733         * workers/service/SWClientConnection.cpp:
734         (WebCore::SWClientConnection::startScriptFetchForServer):
735         * workers/service/SWClientConnection.h:
736         * workers/service/ServiceWorkerContainer.cpp:
737         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
738         * workers/service/ServiceWorkerContainer.h:
739         * workers/service/ServiceWorkerJob.cpp:
740         (WebCore::ServiceWorkerJob::startScriptFetch):
741         (WebCore::ServiceWorkerJob::fetchScriptWithContext):
742         * workers/service/ServiceWorkerJob.h:
743         * workers/service/ServiceWorkerJobClient.h:
744         * workers/service/server/SWServer.cpp:
745         (WebCore::SWServer::startScriptFetch):
746         * workers/service/server/SWServer.h:
747         * workers/service/server/SWServerJobQueue.cpp:
748         (WebCore::SWServerJobQueue::runUpdateJob):
749         * workers/service/server/SWServerRegistration.h:
750         (WebCore::SWServerRegistration::lastUpdateTime const):
751
752 2017-12-14  Simon Fraser  <simon.fraser@apple.com>
753
754         Remove ColorSpaceDeviceRGB and most users of the obsolete deviceRGB colorspace
755         https://bugs.webkit.org/show_bug.cgi?id=180689
756
757         Reviewed by Darin Adler.
758         
759         Address issues noted by Darin in r225797:
760         
761         Existing and new code mistakenly allocated colorspaces on every call, because
762         they didn't initialize the static variable on the first call. Avoid this mistake
763         by using dispatch_once() in these functions.
764
765         Fix a case where the extendedSRGBColorSpaceRef() fallback was returning deviceRGB
766         instead of sRGB.
767
768         * platform/graphics/cg/GraphicsContextCG.cpp:
769         (WebCore::sRGBColorSpaceRef):
770         (WebCore::linearRGBColorSpaceRef):
771         (WebCore::extendedSRGBColorSpaceRef):
772         (WebCore::displayP3ColorSpaceRef):
773         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
774         (WebCore::linearRGBColorSpaceRef):
775
776 2017-12-13  Keith Miller  <keith_miller@apple.com>
777
778         JSObjects should have a mask for loading indexed properties
779         https://bugs.webkit.org/show_bug.cgi?id=180768
780
781         Reviewed by Mark Lam.
782
783         * bindings/js/JSDOMConvertSequences.h:
784         (WebCore::Detail::NumericSequenceConverter::convertArray):
785         (WebCore::Detail::SequenceConverter::convertArray):
786
787 2017-12-13  Antoine Quint  <graouts@apple.com>
788
789         [Web Animations] Implement the play() and pause() methods on Animation
790         https://bugs.webkit.org/show_bug.cgi?id=178932
791         <rdar://problem/35271069>
792
793         Reviewed by Eric Carlson.
794
795         We implement the play() and pause() methods of the Animation interface with full spec text defining
796         the normative behavior of those methods and code matching those steps. Playing and pausing animations
797         incur running a play or pause task when conditions are met, specifically here when the timeline is ready.
798         So we add the notion of pending tasks and provide a proper implementation of pending() which we had
799         introduced in an earlier patch with a constant false return value.
800
801         Note that the play() method exposes an auto-rewinding flag which we always set to true, but other specs,
802         namely CSS Animations, do not require the rewinding behavior, so we expose it for future use.
803
804         * animation/WebAnimation.cpp:
805         (WebCore::WebAnimation::play):
806         (WebCore::WebAnimation::setTimeToRunPendingPlayTask):
807         (WebCore::WebAnimation::runPendingPlayTask):
808         (WebCore::WebAnimation::pause):
809         (WebCore::WebAnimation::setTimeToRunPendingPauseTask):
810         (WebCore::WebAnimation::runPendingPauseTask):
811         (WebCore::WebAnimation::updatePendingTasks):
812         * animation/WebAnimation.h:
813         * animation/WebAnimation.idl:
814
815 2017-12-14  Frederic Wang  <fwang@igalia.com>
816
817         Make GraphicsLayer::dumpProperties dump m_offsetFromRenderer
818         https://bugs.webkit.org/show_bug.cgi?id=180473
819
820         Reviewed by Antonio Gomes.
821
822         No new tests, this is just a new debug info.
823
824         * platform/graphics/GraphicsLayer.cpp:
825         (WebCore::GraphicsLayer::dumpProperties const): Dump the offset from renderer if nonzero.
826
827 2017-12-12  Yusuke Suzuki  <utatane.tea@gmail.com>
828
829         REGRESSION(r225769): Build errors with constexpr std::tie on older gcc
830         https://bugs.webkit.org/show_bug.cgi?id=180692
831
832         Reviewed by Carlos Garcia Campos.
833
834         * platform/graphics/FontSelectionAlgorithm.h:
835         (WebCore::FontSelectionRange::operator== const):
836         (WebCore::FontSelectionRequest::tied const):
837         (WebCore::FontSelectionCapabilities::tied const):
838         (WebCore::FontSelectionSpecifiedCapabilities:: const):
839
840 2017-12-13  Daniel Bates  <dabates@apple.com>
841
842         Fix the Windows build after <https://trac.webkit.org/changeset/225879>
843         (https://bugs.webkit.org/show_bug.cgi?id=180651)
844
845         * html/TextFieldInputType.cpp:
846         (WebCore::autoFillButtonTypeToAccessibilityLabel):
847         (WebCore::autoFillButtonTypeToAutoFillButtonText):
848         (WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName):
849
850 2017-12-13  Devin Rousso  <webkit@devinrousso.com>
851
852         Web Inspector: add instrumentation for ImageBitmapRenderingContext
853         https://bugs.webkit.org/show_bug.cgi?id=180736
854
855         Reviewed by Joseph Pecoraro.
856
857         Tests: inspector/canvas/create-context-bitmaprenderer.html
858                inspector/canvas/requestContent-bitmaprenderer.html
859                inspector/canvas/resolveCanvasContext-bitmaprenderer.html
860
861         * CMakeLists.txt:
862         * Sources.txt:
863         * WebCore.xcodeproj/project.pbxproj:
864
865         * html/HTMLCanvasElement.cpp:
866         (WebCore::HTMLCanvasElement::getContext):
867         (WebCore::HTMLCanvasElement::createContextBitmapRenderer):
868         Support passing an optional settings dictionary when creating an ImageBitmapRenderingContext.
869
870         * inspector/agents/InspectorCanvasAgent.cpp:
871         (WebCore::InspectorCanvasAgent::requestContent):
872         (WebCore::contextAsScriptValue):
873
874         * bindings/js/CallTracerTypes.h:
875
876         * inspector/InspectorCanvas.h:
877         * inspector/InspectorCanvas.cpp:
878         (WebCore::InspectorCanvas::buildObjectForCanvas):
879         (WebCore::InspectorCanvas::indexForData):
880         (WebCore::InspectorCanvas::buildAction):
881         (WebCore::InspectorCanvas::buildArrayForImageBitmap): Deleted.
882
883 2017-12-13  Daniel Bates  <dabates@apple.com>
884
885         Add more auto fill button types
886         https://bugs.webkit.org/show_bug.cgi?id=180651
887         <rdar://problem/35891125>
888         And
889         <rdar://problem/35977943>
890
891         Reviewed by Brent Fulgham.
892
893         Tests: fast/forms/auto-fill-button/input-autofilled-disabled-strong-password-auto-fill-button.html
894                fast/forms/auto-fill-button/input-autofilled-readonly-strong-password-auto-fill-button.html
895                fast/forms/auto-fill-button/input-disabled-strong-password-and-strong-confirmation-password-auto-fill-buttons.html
896                fast/forms/auto-fill-button/input-readonly-strong-password-and-strong-confirmation-password-auto-fill-buttons.html
897                fast/forms/auto-fill-button/input-strong-confirmation-password-auto-fill-button.html
898                fast/forms/auto-fill-button/input-strong-password-auto-fill-button.html
899
900         * English.lproj/Localizable.strings:
901         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
902         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): Add strings for new auto fill button types.
903
904         * css/CSSSelector.cpp:
905         (WebCore::CSSSelector::selectorText const):
906         * css/CSSSelector.h:
907         * css/SelectorChecker.cpp:
908         (WebCore::SelectorChecker::checkOne const):
909         * css/SelectorCheckerTestFunctions.h:
910         (WebCore::isAutofilledStrongPassword):
911         * css/SelectorPseudoClassAndCompatibilityElementMap.in:
912         * css/html.css:
913         (input::-webkit-strong-password-auto-fill-button):
914         (input:-webkit-autofill-strong-password):
915         (input:-webkit-autofill, input:-webkit-autofill-strong-password):
916         (input:-webkit-autofill): Deleted.
917         * cssjit/SelectorCompiler.cpp:
918         (WebCore::SelectorCompiler::addPseudoClassType):
919         Add new CSS pseudo class and CSS styles.
920
921         * html/HTMLInputElement.cpp:
922         (WebCore::HTMLInputElement::reset): Hide the auto fill button when the form is reset. This is also called
923         whenever we suspend the page to put it into the page cache.
924         (WebCore::HTMLInputElement::setShowAutoFillButton): Modified to update the editability of the inner text element
925         and invalidate styles for the subtree as the editability may have changed depending on the auto fill button type.
926
927         (WebCore::autoFillStrongPasswordMaskImage):
928         (WebCore::HTMLInputElement::createInnerTextStyle):
929         (WebCore::HTMLInputElement::createInnerTextStyle const): Deleted.
930         Adjust the look of the inner text field. This function is not const because we may need to resolve style to
931         generate a mask image.
932
933         * html/HTMLInputElement.h:
934         (WebCore::HTMLInputElement::autoFillButtonType const): Fix style nit; use a C++ style cast while I am in
935         this area.
936         (WebCore::HTMLInputElement::hasAutoFillStrongPasswordButton const): Added.
937
938         * html/HTMLTextAreaElement.cpp:
939         (WebCore::HTMLTextAreaElement::createInnerTextStyle):
940         (WebCore::HTMLTextAreaElement::createInnerTextStyle const): Deleted.
941         Made this non-const because HTMLInputElement::createInnerTextStyle() needs to be non-const. See above.
942
943         * html/HTMLTextAreaElement.h:
944         * html/HTMLTextFormControlElement.cpp:
945         (WebCore::HTMLTextFormControlElement::isInnerTextElementEditable const):
946         (WebCore::HTMLTextFormControlElement::updateInnerTextElementEditability):
947         Extract out the query to determine if the inner text element is editable into a virtual function isInnerTextElementEditable()
948         and have updateInnerTextElementEditability() make use of it. By default a field is considered editable if it is not disabled
949         or read-only. We override updateInnerTextElementEditability() in HTMLInputElement to also consider the auto fill button type.
950
951         * html/HTMLTextFormControlElement.h:
952         * html/TextFieldInputType.cpp:
953         (WebCore::autoFillButtonTypeToAccessibilityLabel):
954         (WebCore::autoFillButtonTypeToAutoFillButtonText):
955         (WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName):
956         (WebCore::isAutoFillButtonTypeChanged):
957         (WebCore::TextFieldInputType::createAutoFillButton):
958         (WebCore::TextFieldInputType::updateAutoFillButton):
959         Support having text for the auto fill button.
960
961         * platform/LocalizedStrings.cpp:
962         (WebCore::AXAutoFillStrongPasswordLabel):
963         (WebCore::AXAutoFillStrongConfirmationPasswordLabel):
964         (WebCore::autoFillStrongPasswordLabel):
965         * platform/LocalizedStrings.h:
966         Add localized strings.
967
968         * rendering/RenderTextControlSingleLine.h: Disallow scrolling depending on the auto fill button type.
969
970         * testing/Internals.cpp:
971         (WebCore::toAutoFillButtonType):
972         * testing/Internals.h:
973         * testing/Internals.idl:
974         Add support for testing.
975
976 2017-12-13  Ryosuke Niwa  <rniwa@webkit.org>
977
978         Crash inside ImageLoader::updateFromElement()
979         https://bugs.webkit.org/show_bug.cgi?id=180769
980         <rdar://problem/35278782>
981
982         Reviewed by Antti Koivisto.
983
984         Fixed the crash by moving all call sites of ImageLoader::updateFromElement() to be post insertion callbacks
985         where it's safe to execute arbitrary scripts.
986
987         No new test since existing tests cover this with a newly added release assert in ImageLoader.
988
989         * html/HTMLImageElement.cpp:
990         (WebCore::HTMLImageElement::insertedIntoAncestor):
991         (WebCore::HTMLImageElement::didFinishInsertingNode): Extracted from insertedIntoAncestor to call
992         selectImageSource or updateFromElement.
993         * html/HTMLImageElement.h: Made many member functions final.
994         * html/HTMLInputElement.cpp:
995         (WebCore::HTMLInputElement::didAttachRenderers): Delay the call to ImageLoader::updateFromElement() in
996         ImageInputType using a post style resolution callback.
997         * html/HTMLMetaElement.h:
998         * html/HTMLPictureElement.cpp:
999         (WebCore::HTMLPictureElement::sourcesChanged): Store the list of child image elements into a vector before
1000         calling selectImageSource since each call may execute arbitrary scripts.
1001         * html/HTMLSourceElement.cpp:
1002         (WebCore::HTMLSourceElement::insertedIntoAncestor): Delay the call to ImageLoader::updateFromElement()
1003         using a post style resolution callback.
1004         (WebCore::HTMLSourceElement::didFinishInsertingNode): Extracted from insertedIntoAncestor.
1005         * html/HTMLSourceElement.h:
1006         * html/HTMLVideoElement.cpp:
1007         (WebCore::HTMLVideoElement::didAttachRenderers):
1008         (WebCore::HTMLVideoElement::updateAfterStyleResolution): Extracted from didAttachRenderers.
1009         * html/HTMLVideoElement.h:
1010         * html/ImageInputType.cpp:
1011         (WebCore::ImageInputType::needsPostStyleResolutionCallback): Added. Returns true so that HTMLInputElement's
1012         didAttachRenderers would register a post style resolution callback.
1013         (WebCore::ImageInputType::updateAfterStyleResolution): Extracted from attach.
1014         (WebCore::ImageInputType::attach): Deleted.
1015         * html/ImageInputType.h:
1016         * html/InputType.cpp:
1017         (WebCore::InputType::needsPostStyleResolutionCallback): Added. All but ImageInputType returns false.
1018         (WebCore::InputType::updateAfterStyleResolution): Added.
1019         (WebCore::InputType::attach): Deleted.
1020         * html/InputType.h:
1021         * loader/ImageLoader.cpp:
1022         (WebCore::ImageLoader::updateFromElement): Added a release assertion. There is no direct security implication
1023         so there is no need to use RELEASE_ASSERT_WITH_SECURITY_IMPLICATION here.
1024         * svg/SVGImageElement.cpp:
1025         (WebCore::SVGImageElement::insertedIntoAncestor):
1026         (WebCore::SVGImageElement::didFinishInsertingNode):
1027         * svg/SVGImageElement.h:
1028
1029 2017-12-13  Zalan Bujtas  <zalan@apple.com>
1030
1031         RenderImage can be destroyed even before setting the style on it.
1032         https://bugs.webkit.org/show_bug.cgi?id=180767
1033         <rdar://problem/33965995>
1034
1035         Reviewed by Simon Fraser.
1036
1037         In certain cases, when the newly constructed renderer can't be inserted into the tree (parent can only have specific type of children etc),
1038         RenderTreeUpdater destroys it right away. While destroying a RenderImage, the associated image resource assumes
1039         that the image renderer has been initialized through RenderElement::initializeStyle(). This is an incorrect
1040         assumption.
1041         This patch also makes RenderImageResource's m_renderer a weak pointer.
1042            
1043         Test: fast/images/crash-when-image-renderer-is-destroyed-before-calling-initializeStyle.html
1044
1045         * rendering/RenderImageResource.cpp:
1046         (WebCore::RenderImageResource::initialize):
1047         (WebCore::RenderImageResource::setCachedImage):
1048         (WebCore::RenderImageResource::resetAnimation):
1049         (WebCore::RenderImageResource::image const):
1050         (WebCore::RenderImageResource::setContainerContext):
1051         (WebCore::RenderImageResource::imageSize const):
1052         * rendering/RenderImageResource.h:
1053         (WebCore::RenderImageResource::renderer const):
1054         * rendering/RenderImageResourceStyleImage.cpp:
1055         (WebCore::RenderImageResourceStyleImage::shutdown):
1056
1057 2017-12-13  Ryosuke Niwa  <rniwa@webkit.org>
1058
1059         Update the SVG use element's shadow trees explicitly before the style recall
1060         https://bugs.webkit.org/show_bug.cgi?id=180729
1061         <rdar://problem/36009806>
1062
1063         Reviewed by Antti Koivisto.
1064
1065         Update the SVG use element's shadow trees before start resolving styles. Document now has a hash set of all
1066         connected SVG use elements with invalidated shadow trees. SVGUseElement adds itself to this set when its
1067         shadow tree gets invalidated, or it gets newly connected to a document with the invalidated shadow tree.
1068         SVGUseElement removes itself from this set when it updates its shadow tree or it gets disconnected from
1069         a document with the invalidated shadow tree.
1070
1071         No new tests. Covered by existing tests.
1072
1073         * dom/Document.cpp:
1074         (WebCore::Document::~Document): Assert that m_svgUseElements has been cleared.
1075         (WebCore::Document::resolveStyle): Update the shadow trees of SVG use elements with invalidated shadow trees.
1076         (WebCore::Document::addSVGUseElement): Added.
1077         (WebCore::Document::removeSVGUseElement): Added.
1078         * dom/Document.h:
1079         (WebCore::Document::svgUseElements const): Added.
1080         * dom/Element.cpp:
1081         (WebCore::Element::cloneElementWithChildren): Removed EventAllowedScope since the SVG use element's shadow
1082         tree is no longer updated when there is a NoEventDispatchAssertion in the stack.
1083         (WebCore::Element::cloneElementWithoutChildren): Ditto.
1084         * style/StyleTreeResolver.cpp:
1085         (WebCore::Style::TreeResolver::resolveComposedTree): No longer drops the assertion now that SVG use element's
1086         shadow tree is updated before calling this function.
1087         * svg/SVGUseElement.cpp:
1088         (WebCore::SVGUseElement::insertedIntoAncestor): Add the element to the document's hash set if this use element's
1089         shadow tree needs to be updated (m_shadowTreeNeedsUpdate is set), and it got newly connected.
1090         (WebCore::SVGUseElement::removedFromAncestor): Ditto for removal. We have to check m_shadowTreeNeedsUpdate before
1091         calling SVGGraphicsElement::removedFromAncestor or updateExternalDocument since either function can invoke
1092         m_shadowTreeNeedsUpdate to true.
1093         (WebCore::SVGUseElement::willRecalcStyle): Deleted. We no longer call updateShadowTree during style recalc.
1094         (WebCore::SVGUseElement::updateShadowTree): Remove this element from the document's hah set. We can't clear all
1095         the entries in the map at once in Document::resolveStyle because updating the shadow trees of a SVG use element
1096         can result in a sync IPC in ImageLoader::updateFromElement, which end up executing arbitrary author scripts.
1097         (WebCore::SVGUseElement::cloneTarget const): Removed EventAllowedScope since the SVG use element's shadow tree
1098         is no longer updated when there is a NoEventDispatchAssertion in the stack.
1099         (WebCore::SVGUseElement::expandUseElementsInShadowTree const): Ditto.
1100         (WebCore::SVGUseElement::expandSymbolElementsInShadowTree const): Ditto.
1101         (WebCore::SVGUseElement::invalidateShadowTree): Add the element to the document's hash set if it's connected.
1102         * svg/SVGUseElement.h:
1103
1104 2017-12-13  Per Arne Vollan  <pvollan@apple.com>
1105
1106         REGRESSION(225597): Can't select a text box or web view on a page when VO is on.
1107         https://bugs.webkit.org/show_bug.cgi?id=180756
1108         <rdar://problem/35996158>
1109
1110         Reviewed by Brent Fulgham.
1111
1112         No new tests.
1113
1114         * platform/mac/EventLoopMac.mm:
1115         (WebCore::EventLoop::cycle):
1116
1117 2017-12-13  Antoine Quint  <graouts@apple.com>
1118
1119         [Web Animations] Implement the "updating the finished state" procedure
1120         https://bugs.webkit.org/show_bug.cgi?id=180743
1121         <rdar://problem/36017232>
1122
1123         Reviewed by Simon Fraser.
1124
1125         The Web Animations spec defines a procedure for "updating the finished state", which should run as the timeline time
1126         changes and is responsible for ultimately triggering finish events and fulfil the "finished" promise. The procedure
1127         allows for two flags to control its behavior: didSeek and synchronouslyNotify. When synchronouslyNotify is true, the
1128         "finish notification steps" procedure is ran right away, otherwise it's queued as a microtask.
1129
1130         In this patch we introduce the notion of "hold time", which is the time held while an animation is paused. It will be
1131         set by the pause() and play() method in future patches.
1132
1133         * animation/DocumentTimeline.cpp:
1134         (WebCore::DocumentTimeline::updateAnimations): Update the finished state as the timeline time changes with both flags
1135         set to false.
1136         * animation/WebAnimation.cpp:
1137         (WebCore::WebAnimation::currentTime const): Add a private currentTime(bool) variant which allows for the hold time to
1138         be ignored in case updateFinishedState() was called with the didSeek flag set to false.
1139         (WebCore::WebAnimation::updateFinishedState): Implement the procedure as specified with all spec-mandated steps inline.
1140         (WebCore::WebAnimation::scheduleMicrotaskIfNeeded): Schedule a microtask to complete the "finish notification steps"
1141         if we haven't scheduled a microtask before.
1142         (WebCore::WebAnimation::performMicrotask): Perform the microtask if the "finish notification steps" procedure hasn't
1143         been canceled after it was originally scheduled, as tracked by the m_finishNotificationStepsMicrotaskPending flag, since
1144         microtasks are not presently cancelable.
1145         (WebCore::WebAnimation::finishNotificationSteps): Implement the procedure as specified with all spec-mandated steps inline,
1146         dispatching a "finish" events and fulfilling the "finished" promise.
1147         * animation/WebAnimation.h:
1148         * animation/WebAnimation.idl:
1149         * dom/EventNames.h:
1150
1151 2017-12-13  Simon Fraser  <simon.fraser@apple.com>
1152
1153         Fix crash under Document::visualUpdatesSuppressionTimerFired()
1154         https://bugs.webkit.org/show_bug.cgi?id=180758
1155         Document::visualUpdatesSuppressionTimerFired
1156
1157         Reviewed by Zalan Bujtas.
1158
1159         Speculative fix for crash under visualUpdatesSuppressionTimerFired() where view()
1160         can be null. Add null checks for the view() in all code called from this function.
1161
1162         * dom/Document.cpp:
1163         (WebCore::Document::setVisualUpdatesAllowed):
1164         (WebCore::Document::visualUpdatesSuppressionTimerFired):
1165
1166 2017-12-13  Zalan Bujtas  <zalan@apple.com>
1167
1168         ASSERT(LayoutDisallowedScope::isLayoutAllowed()) whenever hitting Enter in Web Inspector console
1169         https://bugs.webkit.org/show_bug.cgi?id=180690
1170
1171         Reviewed by Simon Fraser.
1172
1173         Defer text replacement notification until after layout is done to avoid unexpected forced layouts.
1174
1175         Covered by existing tests.
1176
1177         * accessibility/AXObjectCache.cpp:
1178         (WebCore::AXObjectCache::disableAccessibility):
1179         (WebCore::AXObjectCache::remove):
1180         (WebCore::filterMapForRemoval):
1181         (WebCore::filterListForRemoval):
1182         (WebCore::AXObjectCache::prepareForDocumentDestruction):
1183         (WebCore::AXObjectCache::performDeferredCacheUpdate):
1184         (WebCore::AXObjectCache::deferTextReplacementNotificationForTextControl):
1185         (WebCore::filterForRemoval): Deleted.
1186         * accessibility/AXObjectCache.h: Need to use the base (Element) class since
1187         we can't call is<HTMLTextFormControlElement> in Node d'tor.
1188         (WebCore::AXObjectCache::deferTextReplacementNotificationForTextControl):
1189         * html/HTMLTextFormControlElement.cpp:
1190         (WebCore::HTMLTextFormControlElement::setInnerTextValue):
1191
1192 2017-12-13  Ryan Haddad  <ryanhaddad@apple.com>
1193
1194         Unreviewed, rolling out r225836.
1195
1196         Broke the Windows build.
1197
1198         Reverted changeset:
1199
1200         "Unify some WebGL sources"
1201         https://bugs.webkit.org/show_bug.cgi?id=180726
1202         https://trac.webkit.org/changeset/225836
1203
1204 2017-12-13  Andy Estes  <aestes@apple.com>
1205
1206         [Payment Request] Remove ApplePayPaymentMethodUpdateEvent and use PaymentDetailsModifiers instead
1207         https://bugs.webkit.org/show_bug.cgi?id=180737
1208         <rdar://problem/36013152>
1209
1210         Reviewed by Brady Eidson.
1211
1212         Instead of firing a non-standard "applepaypaymentmethodupdate" event when the payment method
1213         changes, use the PaymentDetailsModifier mechanism to allow the merchant to specify override
1214         totals and additional display items per payment method type.
1215
1216         Test: http/tests/ssl/applepay/ApplePayPaymentDetailsModifier.https.html
1217
1218         * DerivedSources.make:
1219         * Modules/applepay/ApplePayLineItem.idl:
1220         * Modules/applepay/ApplePayPaymentMethod.h:
1221         * Modules/applepay/ApplePayPaymentMethod.idl:
1222         * Modules/applepay/ApplePayPaymentMethodType.h: Added.
1223         * Modules/applepay/ApplePayPaymentMethodType.idl: Added.
1224         * Modules/applepay/cocoa/PaymentMethodCocoa.mm:
1225         * Modules/applepay/paymentrequest/ApplePayModifier.h: Added.
1226         * Modules/applepay/paymentrequest/ApplePayModifier.idl: Added.
1227         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
1228         (WebCore::ApplePayPaymentHandler::show):
1229         (WebCore::ApplePayPaymentHandler::computeTotalAndLineItems):
1230         (WebCore::ApplePayPaymentHandler::detailsUpdated):
1231         (WebCore::ApplePayPaymentHandler::shippingAddressUpdated):
1232         (WebCore::ApplePayPaymentHandler::shippingOptionUpdated):
1233         (WebCore::ApplePayPaymentHandler::paymentMethodUpdated):
1234         (WebCore::ApplePayPaymentHandler::didSelectPaymentMethod):
1235         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
1236         * Modules/applepay/paymentrequest/ApplePayPaymentMethodUpdateEvent.cpp: Removed.
1237         * Modules/applepay/paymentrequest/ApplePayPaymentMethodUpdateEvent.h: Removed.
1238         * Modules/paymentrequest/PaymentRequest.h:
1239         * Modules/paymentrequest/PaymentRequest.idl:
1240         * WebCore.xcodeproj/project.pbxproj:
1241         * dom/EventNames.h:
1242         * dom/EventNames.in:
1243         * testing/MockPaymentCoordinator.cpp:
1244         (WebCore::convert):
1245         (WebCore::MockPaymentCoordinator::updateTotalAndLineItems):
1246         (WebCore::MockPaymentCoordinator::completeShippingMethodSelection):
1247         (WebCore::MockPaymentCoordinator::completeShippingContactSelection):
1248         (WebCore::MockPaymentCoordinator::completePaymentMethodSelection):
1249         * testing/MockPaymentCoordinator.h:
1250         * testing/MockPaymentCoordinator.idl:
1251
1252 2017-12-12  Zalan Bujtas  <zalan@apple.com>
1253
1254         is<HTMLTextFormControlElement> reports the input type.
1255         https://bugs.webkit.org/show_bug.cgi?id=180721
1256         <rdar://problem/36005123>
1257
1258         Reviewed by Ryosuke Niwa.
1259
1260         This patch ensures that is<HTMLTextFormControlElement> consistently returns true even
1261         when the input type changes from text to non-text (checkbox etc).
1262
1263         * accessibility/AccessibilityObject.cpp:
1264         (WebCore::AccessibilityObject::selectText):
1265         * dom/Element.h:
1266         (WebCore::Element::isTextFormControlElement const):
1267         (WebCore::Element::isTextField const):
1268         (WebCore::Element::isTextFormControl const): Deleted.
1269         * editing/Editor.cpp:
1270         (WebCore::Editor::selectionForCommand):
1271         (WebCore::Editor::setBaseWritingDirection):
1272         (WebCore::findFirstMarkable):
1273         * editing/FrameSelection.cpp:
1274         (WebCore::FrameSelection::selectAll):
1275         * html/FormController.cpp:
1276         (WebCore::FormController::formElementsCharacterCount const):
1277         * html/HTMLElement.cpp:
1278         (WebCore::HTMLElement::directionality const):
1279         * html/HTMLInputElement.h:
1280         * html/HTMLTextAreaElement.h:
1281         * html/HTMLTextFormControlElement.cpp:
1282         (WebCore::HTMLTextFormControlElement::didEditInnerTextValue):
1283         (WebCore::HTMLTextFormControlElement::selectedText const):
1284         (WebCore::HTMLTextFormControlElement::setSelectionRange):
1285         (WebCore::HTMLTextFormControlElement::selectionStart const):
1286         (WebCore::HTMLTextFormControlElement::computeSelectionStart const):
1287         (WebCore::HTMLTextFormControlElement::selectionEnd const):
1288         (WebCore::HTMLTextFormControlElement::computeSelectionEnd const):
1289         (WebCore::HTMLTextFormControlElement::selectionDirection const):
1290         (WebCore::HTMLTextFormControlElement::computeSelectionDirection const):
1291         (WebCore::HTMLTextFormControlElement::selection const):
1292         (WebCore::HTMLTextFormControlElement::selectionChanged):
1293         (WebCore::HTMLTextFormControlElement::lastChangeWasUserEdit const):
1294         (WebCore::HTMLTextFormControlElement::setInnerTextValue):
1295         (WebCore::HTMLTextFormControlElement::valueWithHardLineBreaks const):
1296         (WebCore::enclosingTextFormControl):
1297         * html/HTMLTextFormControlElement.h:
1298         (isType):
1299         * rendering/HitTestResult.cpp:
1300         (WebCore::HitTestResult::isOverTextInsideFormControlElement const):
1301
1302 2017-12-12  Dean Jackson  <dino@apple.com>
1303
1304         Unify some WebGL sources
1305         https://bugs.webkit.org/show_bug.cgi?id=180726
1306
1307         Rubber-stamped by Keith, weeks ago.
1308
1309         * Sources.txt:
1310         * WebCore.xcodeproj/project.pbxproj:
1311         * html/canvas/WebGLRenderingContextBase.cpp:
1312
1313 2017-12-12  Michael Catanzaro  <mcatanzaro@igalia.com>
1314
1315         Unreviewed, fix !ENABLE(MEDIA_STREAM) build after r225822
1316         https://bugs.webkit.org/show_bug.cgi?id=180666
1317         <rdar://problem/36008948>
1318
1319         * html/HTMLMediaElement.cpp:
1320
1321 2017-12-12  Alex Christensen  <achristensen@webkit.org>
1322
1323         Fix possible out-of-bounds read in protocolIsInHTTPFamily
1324         https://bugs.webkit.org/show_bug.cgi?id=180688
1325
1326         Reviewed by Daniel Bates.
1327
1328         It wouldn't read very far out of bounds, and it would just change a bool return value,
1329         but it's still out of bounds.  Covered by an API test that ASAN wouldn't like.
1330
1331         * platform/URL.cpp:
1332         (WebCore::protocolIsInHTTPFamily):
1333         Check bounds before reading a string.
1334
1335 2017-12-12  Youenn Fablet  <youenn@apple.com>
1336
1337         getUserMedia is resolving before the document knows it is capturing
1338         https://bugs.webkit.org/show_bug.cgi?id=180699
1339
1340         Reviewed by Eric Carlson.
1341
1342         Covered by updated test.
1343
1344         Ensure the document state is capturing when getUserMedia promise is resolved by doing the following:
1345         - Promise is resolved when MediaStream is producing data.
1346         - MediaStream asks Document to update its state when MediaStream state is updated.
1347
1348         Introduce PendingActivationMediaStream for waiting for the MediaStream to produce data.
1349
1350         * Modules/mediastream/MediaStream.cpp:
1351         (WebCore::MediaStream::statusDidChange):
1352         * Modules/mediastream/UserMediaRequest.cpp:
1353         (WebCore::UserMediaRequest::allow):
1354         (WebCore::UserMediaRequest::contextDestroyed):
1355         (WebCore::UserMediaRequest::PendingActivationMediaStream::PendingActivationMediaStream):
1356         (WebCore::UserMediaRequest::PendingActivationMediaStream::~PendingActivationMediaStream):
1357         (WebCore::UserMediaRequest::PendingActivationMediaStream::characteristicsChanged):
1358         (WebCore::UserMediaRequest::mediaStreamIsReady):
1359         * Modules/mediastream/UserMediaRequest.h:
1360         (WebCore::UserMediaRequest::PendingActivationMediaStream::create):
1361         * platform/mediastream/RealtimeMediaSourceCenter.h:
1362         * WebCore/WebCore.xcodeproj/project.pbxproj:
1363
1364 2017-12-12  John Wilander  <wilander@apple.com>
1365
1366         Storage Access API: Implement frame-specific access in the network storage session layer
1367         https://bugs.webkit.org/show_bug.cgi?id=180679
1368         <rdar://problem/35982116>
1369
1370         Reviewed by Alex Christensen.
1371
1372         Tests: http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-and-try-access-from-right-frame.html
1373                http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-but-try-access-from-wrong-frame.html
1374
1375         This changes adds frameID and pageID to what is communicated for
1376         storage access and also stored in the network process' table of
1377         partitioning exceptions.
1378
1379         * dom/Document.cpp:
1380         (WebCore::Document::hasStorageAccess):
1381             Now makes use of the new m_hasFrameSpecificStorageAccess to check
1382             if access has already been granted to this document's domain and
1383             frame.
1384         (WebCore::Document::requestStorageAccess):
1385             Now submits frameID and pageID in the request call and sets
1386             m_hasFrameSpecificStorageAccess upon granted access callback.
1387         * dom/Document.h:
1388         * page/ChromeClient.h:
1389         * platform/network/NetworkStorageSession.h:
1390         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1391         (WebCore::NetworkStorageSession::cookieStoragePartition const):
1392         (WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies):
1393         (WebCore::NetworkStorageSession::isStorageAccessGranted const):
1394         (WebCore::NetworkStorageSession::setStorageAccessGranted):
1395             Now makes use of frameID and pageID for partitioning exceptions.
1396         * platform/network/mac/CookieJarMac.mm:
1397         (WebCore::cookiesInPartitionForURL):
1398         (WebCore::setCookiesFromDOM):
1399             Submits std::nullopt for frameID and pageID.
1400             Follow-up work tracked in https://bugs.webkit.org/show_bug.cgi?id=180682. 
1401         * platform/network/mac/ResourceHandleMac.mm:
1402         (WebCore::ResourceHandle::applySniffingPoliciesAndStoragePartitionIfNeeded):
1403             Submits std::nullopt for frameID and pageID.
1404             Follow-up work tracked in https://bugs.webkit.org/show_bug.cgi?id=180682. 
1405
1406 2017-12-12  Youenn Fablet  <youenn@apple.com>
1407
1408         Playing webrtc video tracks should prevent from display to got to sleep
1409         https://bugs.webkit.org/show_bug.cgi?id=180666
1410
1411         Reviewed by Darin Adler.
1412
1413         Done through manual testing by checking screen assertions taken on webrtc sites.
1414
1415         * html/HTMLMediaElement.cpp:
1416         (WebCore::HTMLMediaElement::shouldDisableSleep const):
1417
1418 2017-12-12  Dean Jackson  <dino@apple.com>
1419
1420         Add CanvasRenderingContext2DBase class and OffscreenCanvasRenderingContext2D
1421         https://bugs.webkit.org/show_bug.cgi?id=180718
1422         <rdar://problem/36004015>
1423
1424         Reviewed by Sam Weinig.
1425
1426         Add an OffscreenCanvasRenderingContext2D class, and in the process create a shared
1427         base class for it and CanvasRenderingContext2D, called CanvasRenderingContext2DBase.
1428         The base class has nearly all the functionality, with the exception of the text
1429         and focus rendering APIs, which are only exposed on CanvasRenderingContext2D.
1430
1431         At the moment CanvasRenderingContext2DBase's implementation still expects the attached
1432         canvas to be an HTMLCanvasElement, but that's ok since you can't yet create an
1433         OffscreenCanvasRenderingContext2D. A subsequent patch will do the right thing.
1434
1435         No change in functionality at the moment, so covered by the existing tests.
1436
1437         * DerivedSources.make: Add the new IDL file.
1438
1439         * Sources.txt: Add all the new files to compile.
1440         * WebCore.xcodeproj/project.pbxproj:
1441
1442         * bindings/js/JSCanvasRenderingContext2DCustom.cpp: Removed some unnecessary headers, and
1443         added JSC:: where appropriate.
1444         (WebCore::JSCanvasRenderingContext2DOwner::isReachableFromOpaqueRoots):
1445         (WebCore::JSCanvasRenderingContext2D::visitAdditionalChildren):
1446
1447         * bindings/js/JSOffscreenCanvasRenderingContext2DCustom.cpp: Copied from Source/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp.
1448         (WebCore::root): New root function that just returns the address of the OffscreenCanvas.
1449         (WebCore::JSOffscreenCanvasRenderingContext2DOwner::isReachableFromOpaqueRoots):
1450         (WebCore::JSOffscreenCanvasRenderingContext2D::visitAdditionalChildren):
1451
1452         * bindings/js/JSWorkerNavigatorCustom.cpp: Add JSC:: to fix a compilation error.
1453         (WebCore::JSWorkerNavigator::visitAdditionalChildren):
1454
1455         * bindings/js/WebCoreBuiltinNames.h: New IDL types.
1456
1457         * html/OffscreenCanvas.idl: Explicitly generates an IsReachable.
1458
1459         * html/canvas/CanvasRenderingContext.h:
1460         (WebCore::CanvasRenderingContext::isOffscreen2d const): Helper for is<> trait.
1461
1462         * html/canvas/CanvasRenderingContext2D.cpp: Nearly everything has been moved to the Base class.
1463         * html/canvas/CanvasRenderingContext2D.h:
1464         * html/canvas/CanvasRenderingContext2DBase.cpp: Copied from Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp.
1465         * html/canvas/CanvasRenderingContext2DBase.h: Copied from Source/WebCore/html/canvas/CanvasRenderingContext2D.h.
1466
1467         * html/canvas/OffscreenCanvasRenderingContext2D.cpp: Added. Basic implementation that
1468         just uses the Base class.
1469         (WebCore::OffscreenCanvasRenderingContext2D::OffscreenCanvasRenderingContext2D):
1470         * html/canvas/OffscreenCanvasRenderingContext2D.h: Added.
1471         * html/canvas/OffscreenCanvasRenderingContext2D.idl: Added.
1472
1473 2017-12-12  Jer Noble  <jer.noble@apple.com>
1474
1475         [EME] Support FPS-over-HLS in the Modern EME API
1476         https://bugs.webkit.org/show_bug.cgi?id=180707
1477
1478         Reviewed by Eric Carlson.
1479
1480         Add support for the "skd" initDataType, where the initData is the URI provided in the 
1481         EXT-X-KEY tag in a HLS manifest:
1482
1483         * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
1484         (WebCore::CDMPrivateFairPlayStreaming::sinfName):
1485         (WebCore::CDMPrivateFairPlayStreaming::skdName):
1486         (WebCore::extractSinfData):
1487         (WebCore::CDMPrivateFairPlayStreaming::sanitizeSkd):
1488         (WebCore::CDMPrivateFairPlayStreaming::extractKeyIDsSkd):
1489         (WebCore::validInitDataTypes):
1490         (WebCore::CDMFactory::platformRegisterFactories):
1491         (WebCore::CDMPrivateFairPlayStreaming::supportsInitDataType const):
1492         (WebCore::CDMPrivateFairPlayStreaming::supportsConfiguration const):
1493         (WebCore::CDMPrivateFairPlayStreaming::supportsInitData const):
1494         (WebCore::sinfName): Deleted.
1495
1496         Add support for creating a AVContentKeyRequest from a skd key URI rather than from
1497         initialization data, and for extracting keyIDs from the AVContentKeyRequest identifier.
1498
1499         * platform/graphics/avfoundation/CDMFairPlayStreaming.h:
1500         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
1501         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
1502         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::keyIDs):
1503         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::requestLicense):
1504         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense):
1505         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest):
1506
1507         Add support for AVContentKeySession to MediaPlayerPrivateAVFoundationObjC, and for emitting
1508         initializationData messages when encountering a loading request for a "skd" URI.
1509
1510         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
1511         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1512         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
1513         (WebCore::MediaPlayerPrivateAVFoundationObjC::cdmInstanceAttached):
1514         (WebCore::MediaPlayerPrivateAVFoundationObjC::cdmInstanceDetached):
1515         (WebCore::MediaPlayerPrivateAVFoundationObjC::attemptToDecryptWithInstance):
1516
1517 2017-12-12  Antoine Quint  <graouts@apple.com>
1518
1519         [Web Animations] Expose promises on Animation interface
1520         https://bugs.webkit.org/show_bug.cgi?id=180710
1521         <rdar://problem/36000604>
1522
1523         Reviewed by Dean Jackson.
1524
1525         Expose the "ready" and "finished" promises on Animation. A future patch will fulfil or reject them.
1526
1527         * animation/WebAnimation.cpp:
1528         (WebCore::WebAnimation::WebAnimation):
1529         (WebCore::WebAnimation::readyPromiseResolve):
1530         (WebCore::WebAnimation::finishedPromiseResolve):
1531         * animation/WebAnimation.h:
1532         * animation/WebAnimation.idl:
1533
1534 2017-12-12  Youenn Fablet  <youenn@apple.com>
1535
1536         Fetch Event header filtering should apply in CORS mode only
1537         https://bugs.webkit.org/show_bug.cgi?id=180708
1538
1539         Reviewed by Alex Christensen.
1540
1541         Covered by no-longer failing test.
1542
1543         * workers/service/context/ServiceWorkerFetch.cpp: cleaning headers only in case of CORS mode.
1544
1545 2017-12-12  Myles C. Maxfield  <mmaxfield@apple.com>
1546
1547         REGRESSION (Safari 11): custom <font-face> tag crashes a page
1548         https://bugs.webkit.org/show_bug.cgi?id=177848
1549
1550         Reviewed by Darin Adler.
1551
1552         We currently use the CSS property parsers to parse SVG's <font-face> element attributes. Instead,
1553         we should be using the CSS descriptor parsers to parse these attributes. However, this is a
1554         fairly involved task, so until I can finish that, this patch fixes the crash. The crash is simple;
1555         the descriptors shouldn't accept the universal keywords ("initial", "inherit", etc.) and our
1556         font-face machinery assumes this. So the fix is just detect these keywords and explicitly disallow
1557         them.
1558
1559         Test: svg/text/font-style-keyword.html
1560
1561         * svg/SVGFontFaceElement.cpp:
1562         (WebCore::SVGFontFaceElement::parseAttribute):
1563
1564 2017-12-12  Antoine Quint  <graouts@apple.com>
1565
1566         [Web Animations] Implement the playState property on Animation
1567         https://bugs.webkit.org/show_bug.cgi?id=180711
1568         <rdar://problem/36000982>
1569
1570         Reviewed by Dean Jackson.
1571
1572         Expose the playState and pending properties. The playState property has a complete implementation but
1573         has some test failures due to Animation lacking correct behavior while running animations which will
1574         be fixed in a followup patch. The pending property is a placeholder until we implement pending play
1575         and pause tasks in followup patches.
1576
1577         * animation/WebAnimation.cpp:
1578         (WebCore::WebAnimation::playState const):
1579         (WebCore::WebAnimation::effectEndTime const):
1580         * animation/WebAnimation.h:
1581         * animation/WebAnimation.idl:
1582
1583 2017-12-12  Javier Fernandez  <jfernandez@igalia.com>
1584
1585         [css-grid] Implement alignment for absolute positioned grid items
1586         https://bugs.webkit.org/show_bug.cgi?id=180632
1587
1588         Reviewed by Manuel Rego Casasnovas.
1589
1590         We are changing how we compute the grid area's size of positioned
1591         items, trying to make the logic as independent as possible of the
1592         grid container's direction.
1593
1594         The new way of placing absolute positioned elements in their grid area
1595         is based on the previously computed area's size. This provide a
1596         mechanism to place an item in its area respecting the offsets derived
1597         from the Content Alignment CSS properties and, which is more important,
1598         ignoring the grid container's direction.
1599
1600         Additionally, we use the already implemented alignment logic that's
1601         used for regular grid items. This patch provides almost full alignment
1602         capabilities for positioned objects, with the exception of 'stretch'.
1603
1604         It's worth mentioning that some of the test cases using vertical-rl
1605         writing mode will fail because of the bug 180633.
1606
1607         Updated web-platform-tests results of the test cases that pass now.
1608
1609         * rendering/GridLayoutFunctions.cpp:
1610        (WebCore::GridLayoutFunctions::hasOverrideContainingBlockContentSizeForChild):
1611         (WebCore::GridLayoutFunctions::overrideContainingBlockContentSizeForChild):
1612         * rendering/GridLayoutFunctions.h:
1613         * rendering/GridTrackSizingAlgorithm.cpp:
1614         (WebCore::GridTrackSizingAlgorithmStrategy::updateOverrideContainingBlockContentSizeForChild const):
1615         * rendering/RenderGrid.cpp:
1616         (WebCore::RenderGrid::layoutBlock):
1617         (WebCore::RenderGrid::gridItemOffset const):
1618         (WebCore::RenderGrid::hasStaticPositionForChild const):
1619         (WebCore::RenderGrid::layoutPositionedObject):
1620         (WebCore::RenderGrid::applyStretchAlignmentToChildIfNeeded):
1621         (WebCore::RenderGrid::columnAxisPositionForChild const):
1622         (WebCore::RenderGrid::rowAxisPositionForChild const):
1623         (WebCore::RenderGrid::columnAxisOffsetForChild const):
1624         (WebCore::RenderGrid::rowAxisOffsetForChild const):
1625         (WebCore::RenderGrid::gridPositionIsAutoForOutOfFlow const):
1626         (WebCore::RenderGrid::resolveAutoStartGridPosition const):
1627         (WebCore::RenderGrid::resolveAutoEndGridPosition const):
1628         (WebCore::RenderGrid::gridAreaBreadthForOutOfFlowChild):
1629         (WebCore::RenderGrid::logicalOffsetForChild const):
1630         (WebCore::RenderGrid::gridAreaPositionForOutOfFlowChild const):
1631         (WebCore::RenderGrid::gridAreaPositionForInFlowChild const):
1632         (WebCore::RenderGrid::gridAreaPositionForChild const):
1633         (WebCore::RenderGrid::translateOutOfFlowRTLCoordinate const):
1634         (WebCore::RenderGrid::findChildLogicalPosition const):
1635         * rendering/RenderGrid.h:
1636         * rendering/style/GridPositionsResolver.cpp:
1637         (WebCore::adjustGridPositionsFromStyle):
1638         (WebCore::GridPositionsResolver::initialPositionSide):
1639         (WebCore::GridPositionsResolver::finalPositionSide):
1640         * rendering/style/GridPositionsResolver.h:
1641
1642 2017-12-12  Jer Noble  <jer.noble@apple.com>
1643
1644         [EME] Support reporting and restoring persistent usage data.
1645         https://bugs.webkit.org/show_bug.cgi?id=180684
1646
1647         Reviewed by Eric Carlson.
1648
1649         Add support for reading and acknowledging persistent usage data from the MediaKeys storage
1650         directory.
1651
1652         Add a mechanism for passing the storage location down to CDMPrivate and CDMInstance objects
1653         inside of the CDM class itself:
1654
1655         * Modules/encryptedmedia/CDM.cpp:
1656         (WebCore::CDM::createInstance):
1657         (WebCore::CDM::storageDirectory const):
1658         * Modules/encryptedmedia/CDM.h:
1659
1660         Support loading expired session data, acknowledging expired session data, closing sessions
1661         and removing usable key data.
1662
1663         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
1664         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
1665         (WebCore::isEqual):
1666         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense):
1667         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::loadSession):
1668         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::closeSession):
1669         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::removeSessionData):
1670
1671 2017-12-12  Christopher Reid  <chris.reid@sony.com>
1672
1673         WebGL TextureMapperShaderProgram shaders don't compile in MSVC
1674         https://bugs.webkit.org/show_bug.cgi?id=180709
1675
1676         Reviewed by Myles C. Maxfield.
1677
1678         No new tests, no change in behavior.
1679
1680         Vertex and Fragment shaders were not compiling because TextureMapperShaderProgram.cpp was
1681         stringifying "#if USE(OPENGL_ES_2) ... #endif" into the shaders rather than evaluating these
1682         preprocessor directives before the STRINGIFY expansion.
1683
1684         Moved these #if conditions outside of STRINGIFY to remove compiler ambiguity.
1685
1686         * platform/graphics/texmap/TextureMapperShaderProgram.cpp:
1687
1688 2017-12-12  Zach Li  <zachli@apple.com>
1689         [WK2] Expose image via WKBundleHitTestResult API.
1690         https://bugs.webkit.org/show_bug.cgi?id=180552.
1691         rdar://problem/23951521
1692
1693         Reviewed by Simon Fraser.
1694
1695         * platform/graphics/ImageSource.h:
1696         This method will be used by clients outside WebCore, so
1697         add WEBCORE_EXPORT.
1698
1699 2017-12-12  Simon Fraser  <simon.fraser@apple.com>
1700
1701         Remove ColorSpaceDeviceRGB and most users of the obsolete deviceRGB colorspace
1702         https://bugs.webkit.org/show_bug.cgi?id=180689
1703
1704         Reviewed by Tim Horton.
1705
1706         Remove the ColorSpaceDeviceRGB enum and users.
1707
1708         ImageBuffer now uses sRGB instead of deviceRGB in the few cases that used the latter.
1709
1710         Switch Windows CG code to use sRGBColorSpaceRef() instead of deviceRGBColorSpaceRef().
1711
1712         Have linearRGBColorSpaceRef() use kCGColorSpaceLinearSRGB, which is present in iOS 9 and 10.11 and later.
1713
1714         * page/win/FrameCGWin.cpp:
1715         (WebCore::imageFromRect):
1716         * platform/graphics/Color.cpp:
1717         (WebCore::operator<<):
1718         * platform/graphics/ColorSpace.h:
1719         * platform/graphics/ImageBuffer.cpp:
1720         (WebCore::ImageBuffer::transformColorSpace):
1721         * platform/graphics/cg/ColorCG.cpp:
1722         (WebCore::Color::Color):
1723         (WebCore::leakCGColor):
1724         (WebCore::createCGColorWithDeviceRGBA): Deleted.
1725         * platform/graphics/cg/GraphicsContextCG.cpp:
1726         (WebCore::sRGBColorSpaceRef):
1727         (WebCore::linearRGBColorSpaceRef):
1728         (WebCore::extendedSRGBColorSpaceRef):
1729         (WebCore::displayP3ColorSpaceRef):
1730         (WebCore::deviceRGBColorSpaceRef): Deleted.
1731         * platform/graphics/cg/GraphicsContextCG.h:
1732         (WebCore::cachedCGColorSpace):
1733         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
1734         * platform/graphics/win/GraphicsContextCGWin.cpp:
1735         (WebCore::CGContextWithHDC):
1736         (WebCore::GraphicsContext::releaseWindowsContext):
1737         (WebCore::GraphicsContext::drawWindowsBitmap):
1738         * platform/graphics/win/ImageCGWin.cpp:
1739         (WebCore::BitmapImage::create):
1740         (WebCore::BitmapImage::getHBITMAPOfSize):
1741         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
1742         (WebCore::MockRealtimeVideoSourceMac::pixelBufferFromCGImage const):
1743         * platform/win/DragImageCGWin.cpp:
1744         (WebCore::allocImage):
1745         (WebCore::createCgContextFromBitmap):
1746         * rendering/svg/RenderSVGResourceFilter.cpp:
1747         (WebCore::RenderSVGResourceFilter::postApplyResource):
1748         * rendering/svg/RenderSVGResourceMasker.cpp:
1749         (WebCore::RenderSVGResourceMasker::drawContentIntoMaskImage):
1750
1751 2017-12-12  Youenn Fablet  <youenn@apple.com>
1752
1753         Navigation requests should use navigate fetch mode
1754         https://bugs.webkit.org/show_bug.cgi?id=179808
1755
1756         Reviewed by Chris Dumez.
1757
1758         Covered by existing tests.
1759
1760         * Modules/fetch/FetchRequest.cpp:
1761         (WebCore::buildOptions): Update to throw only if init.mode is Navigate.
1762         * Modules/fetch/FetchRequestInit.h:
1763         (WebCore::FetchRequestInit::hasMembers const): If init is present, set default values as per spec.
1764         * loader/DocumentLoader.cpp:
1765         (WebCore::DocumentLoader::loadMainResource): Set fetch mode to navigate.
1766         * loader/DocumentThreadableLoader.cpp:
1767         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Bypass preflight in case fetch mode is navigate.
1768
1769 2017-12-12  Simon Fraser  <simon.fraser@apple.com>
1770
1771         HTML-page with <object type="image/svg+xml" data="foo.svg"> often is blank
1772         https://bugs.webkit.org/show_bug.cgi?id=180524
1773         <rdar://problem/35920554>
1774
1775         Reviewed by Antti Koivisto.
1776
1777         The test case has script that conditionalizes behavior on whether window.innerWidth/Height
1778         are zero during the load event. We didn't force layout in innerWidth/Height, so whether
1779         they would zero depended on whether the parent frame had laid out, which was timing-sensitive.
1780
1781         Fix by triggering enough layout in the parent document so that the FrameView is resized before
1782         fetching its dimensions in innerWidth/Height. This causes our behavior to match Chrome and Firefox.
1783
1784         Test: fast/dom/iframe-innerWidth.html
1785
1786         * dom/EventDispatcher.cpp:
1787         (WebCore::EventDispatcher::dispatchEvent): Add some logging that helped me diagnose this.
1788         * page/DOMWindow.cpp:
1789         (WebCore::DOMWindow::innerHeight const):
1790         (WebCore::DOMWindow::innerWidth const):
1791
1792 2017-12-11  Antoine Quint  <graouts@apple.com>
1793
1794         [Web Animations] Enqueue and dispatch animation events
1795         https://bugs.webkit.org/show_bug.cgi?id=180657
1796         <rdar://problem/35970103>
1797
1798         Reviewed by Chris Dumez.
1799
1800         Now that we have support for the AnimationPlaybackEvent interface, we need a way to enqueue
1801         such events for dispatch at the opportune time. The Web Animations spec defines two ways
1802         to queue and dispatch events.
1803
1804         If the animation has a "document for timing", it should enqueue events on this document.
1805         In our implementation, if the animation timeline is set to a DocumentTimeline, that means
1806         it has a document for timing, and we let the DocumentTimeline enqueue those events, which
1807         will be dispatched through a dedicated GenericTaskQueue<Timer>. These events will be sorted
1808         by their respective timeline time before being dispatched.
1809
1810         If there is no document for timing, events should be dispatched as a standalone task.
1811
1812         * animation/DocumentTimeline.cpp:
1813         (WebCore::DocumentTimeline::~DocumentTimeline): Close the event dispatch task queue when the
1814         document timeline is torn down.
1815         (WebCore::DocumentTimeline::enqueueAnimationPlaybackEvent): Add the provided event to the
1816         pending animation events queue and, if one hasn't been registered yet, enqueue a task to
1817         dispatch events using a GenericTaskQueue<Timer>.
1818         (WebCore::compareAnimationPlaybackEvents): Comparator used to sort events in performEventDispatchTask()
1819         where events are sorted such that unresolved timeline times come first, and then from the
1820         earlier resolved timeline times to the later resolved timeline times. Events with unresolved
1821         timeline times and equal resolved timeline times are sorted in the order they were enqueued.
1822         (WebCore::DocumentTimeline::performEventDispatchTask): Run a stable sort on a copy of the pending list
1823         of events to dispatch and dispatch the events individually on their respective animations.
1824         * animation/DocumentTimeline.h:
1825         * animation/WebAnimation.cpp:
1826         (WebCore::WebAnimation::create): Pass in the document to the constructor.
1827         (WebCore::WebAnimation::WebAnimation): Use the provided document to initialize ActiveDOMObject.
1828         (WebCore::WebAnimation::enqueueAnimationPlaybackEvent): Create an AnimationPlaybackEvent with
1829         the provided type, timeline time and animation time and enqueue it on the document timeline,
1830         if one is available, or dispatch on this animation as a standalone task.
1831         (WebCore::WebAnimation::acceleratedRunningStateDidChange):
1832         (WebCore::WebAnimation::activeDOMObjectName const):
1833         (WebCore::WebAnimation::canSuspendForDocumentSuspension const):
1834         (WebCore::WebAnimation::stop):
1835         * animation/WebAnimation.h: Define WebAnimation to be an EventTarget and an ActiveDOMObject.
1836         * animation/WebAnimation.idl: Define WebAnimation to be an EventTarget and an ActiveDOMObject.
1837         * dom/EventTargetFactory.in:
1838
1839 2017-12-12  Chris Dumez  <cdumez@apple.com>
1840
1841         Simplify IPC code between WebProcess and StorageProcess for serviceWorker.postMessage()
1842         https://bugs.webkit.org/show_bug.cgi?id=180683
1843
1844         Reviewed by Brady Eidson.
1845
1846         Merge the 2 code paths from calling postMessage() from a ServiceWorkerClient and from
1847         a ServiceWorker. Also, postMessage() now only IPCs an identifier from the WebContent
1848         process to the StorageProcess. The ServiceWorkerClientData is looked up on Storage
1849         process side from the identifier before being sent to the context process.
1850
1851         * workers/service/SWClientConnection.h:
1852         * workers/service/ServiceWorker.cpp:
1853         (WebCore::ServiceWorker::postMessage):
1854         * workers/service/ServiceWorkerTypes.h:
1855         * workers/service/server/SWServer.cpp:
1856         (WebCore::SWServer::clientByID const):
1857         (WebCore::SWServer::matchAll):
1858         (WebCore::SWServer::forEachClientForOrigin):
1859         (WebCore::SWServer::claim):
1860         (WebCore::SWServer::registerServiceWorkerClient):
1861         (WebCore::SWServer::unregisterServiceWorkerClient):
1862         * workers/service/server/SWServer.h:
1863         * workers/service/server/SWServerWorker.cpp:
1864         (WebCore::SWServerWorker::findClientByIdentifier):
1865         * workers/service/server/SWServerWorker.h:
1866
1867 2017-12-12  Youenn Fablet  <youenn@apple.com>
1868
1869         Allow AudioContext to start when getUserMedia is on
1870         https://bugs.webkit.org/show_bug.cgi?id=180680
1871
1872         Reviewed by Eric Carlson.
1873
1874         Test: webrtc/getUserMedia-webaudio-autoplay.html
1875
1876         * Modules/webaudio/AudioContext.cpp:
1877         (WebCore::AudioContext::willBeginPlayback):
1878
1879 2017-12-12  Romain Bellessort  <romain.bellessort@crf.canon.fr>
1880
1881         [Readable Streams API] Throw RangeError if a size is provided when creating a readable byte stream
1882         https://bugs.webkit.org/show_bug.cgi?id=180470
1883
1884         Reviewed by Youenn Fablet.
1885
1886         Throw a RangeError if a ReadableStream is created with type 'bytes' and with a
1887         non-undefined strategy size, as per latest spec:
1888         - https://github.com/whatwg/streams/pull/856
1889         - https://streams.spec.whatwg.org/#rs-constructor (step 4.c)
1890
1891         One new test imported from WPT to check that RangeError is thrown.
1892
1893         * Modules/streams/ReadableStream.js:
1894         (initializeReadableStream): Check strategy size and throw RangeError if needed.
1895
1896 2017-12-12  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1897
1898         [GTK][WebRTC] Stop warning with so much verbosity about not implemented RealtimeMediaSourceCenter
1899         https://bugs.webkit.org/show_bug.cgi?id=180694
1900
1901         Reviewed by Youenn Fablet.
1902
1903         No new tests -- no change in functionality.
1904
1905         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1906         (WebCore::RealtimeMediaSourceCenter::singleton):
1907
1908 2017-12-12  Ms2ger  <Ms2ger@igalia.com>
1909
1910         Implement {DOMMimeTypeArray, DOMPluginArray}::supportedPropertyNames().
1911         https://bugs.webkit.org/show_bug.cgi?id=180471
1912
1913         Reviewed by Darin Adler.
1914
1915         Test: imported/w3c/web-platform-tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator-pluginarray.html
1916
1917         * plugins/DOMMimeTypeArray.cpp:
1918         (WebCore::DOMMimeTypeArray::supportedPropertyNames):
1919         * plugins/DOMPluginArray.cpp:
1920         (WebCore::DOMPluginArray::supportedPropertyNames):
1921
1922 2017-12-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1923
1924         [WTF] Thread::create should have Thread::tryCreate
1925         https://bugs.webkit.org/show_bug.cgi?id=180333
1926
1927         Reviewed by Darin Adler.
1928
1929         No behavior change.
1930
1931         * bindings/js/GCController.cpp:
1932         (WebCore::GCController::garbageCollectOnAlternateThreadForDebugging):
1933         * platform/audio/ReverbConvolver.cpp:
1934         (WebCore::ReverbConvolver::ReverbConvolver):
1935         * platform/audio/ReverbConvolver.h:
1936         * workers/WorkerThread.cpp:
1937         (WebCore::WorkerThread::start):
1938
1939 2017-12-11  Manuel Rego Casasnovas  <rego@igalia.com>
1940
1941         [css-grid] Automatic minimum size is not clamped if min track sizing function is auto
1942         https://bugs.webkit.org/show_bug.cgi?id=180283
1943
1944         Reviewed by Darin Adler.
1945
1946         We were not clamping the automatic minimum size when
1947         the min track sizing function was intrinsic (e.g. minmax(auto, 0px)).
1948         However the spec (https://drafts.csswg.org/css-grid/#min-size-auto)
1949         is very clear regarding that.
1950
1951         This patch modifies
1952         GridTrackSizingAlgorithm::sizeTrackToFitNonSpanningItem(),
1953         so in the case of a fixed max track sizing function it clamps
1954         the automatic minimum size of the item to the stretch fit
1955         of the grid area's size.
1956         It needs to take into account if the item has fixed size, margin, border
1957         and/or padding as those cannot be clamped.
1958
1959         Using WPT tests to verify this behavior,
1960         and corrected a bunch of other tests that were wrong.
1961
1962         Test: imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-minimum-size-grid-items-017.html
1963               imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-minimum-size-grid-items-022.html
1964               imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-minimum-size-grid-items-023.html
1965
1966         * rendering/GridTrackSizingAlgorithm.cpp:
1967         (WebCore::GridTrackSizingAlgorithm::sizeTrackToFitNonSpanningItem):
1968         * rendering/GridTrackSizingAlgorithm.h:
1969         (WebCore::GridTrack::growthLimitIsInfinite const):
1970         * rendering/style/GridTrackSize.h:
1971         (WebCore::GridTrackSize::cacheMinMaxTrackBreadthTypes):
1972         (WebCore::GridTrackSize::hasFixedMaxTrackBreadth const):
1973
1974 2017-12-11  Zan Dobersek  <zdobersek@igalia.com>
1975
1976         [Cairo] Cairo::clipToImageBuffer() should operate on a cairo_surface_t
1977         https://bugs.webkit.org/show_bug.cgi?id=180665
1978
1979         Reviewed by Michael Catanzaro.
1980
1981         Have the Cairo::clipToImageBuffer() function in the CairoUtilities code
1982         operate on a cairo_surface_t object, instead of an Image object.
1983
1984         Call site in GraphicsContext::clipToImageBuffer() is adjusted to first
1985         ensure a non-null Image object, and then retrieve a cairo_surface_t
1986         object from that, passing it on to Cairo::clipToImageBuffer().
1987
1988         No new tests -- no change in functionality.
1989
1990         * platform/graphics/cairo/CairoOperations.cpp:
1991         (WebCore::Cairo::clipToImageBuffer):
1992         * platform/graphics/cairo/CairoOperations.h:
1993         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1994         (WebCore::GraphicsContext::clipToImageBuffer):
1995
1996 2017-12-11  Zan Dobersek  <zdobersek@igalia.com>
1997
1998         [Cairo] Don't use a static cairo_surface_t object for CairoPath contexts
1999         https://bugs.webkit.org/show_bug.cgi?id=180663
2000
2001         Reviewed by Michael Catanzaro.
2002
2003         Instead of using a single cairo_surface_t object and sharing it between
2004         different cairo_t objects handled by CairoPath, create a new mock 1x1px
2005         alpha-only surface for each cairo_t object that's allocated in the
2006         CairoPath constructor.
2007
2008         This avoids potential issues in how Cairo's state handling internally
2009         uses these surfaces, which is completely opaque to us and out of our
2010         control. This also avoids crashes when using this one cairo_surface_t
2011         object through different CairoPath objects across different threads.
2012
2013         No new tests -- no change in behavior.
2014
2015         * platform/graphics/cairo/PlatformPathCairo.cpp:
2016         (WebCore::CairoPath::CairoPath):
2017         (WebCore::pathSurface): Deleted.
2018         * platform/graphics/cairo/PlatformPathCairo.h:
2019         (WebCore::CairoPath::context):
2020
2021 2017-12-11  Zan Dobersek  <zdobersek@igalia.com>
2022
2023         [CoordGraphics] Move UpdateAtlas, AreaAllocator into the platform layer
2024         https://bugs.webkit.org/show_bug.cgi?id=180641
2025
2026         Reviewed by Michael Catanzaro.
2027
2028         Move the UpdateAtlas and AreaAllocator classes and their source files
2029         into the platform layer. This still means using the WebCore namespace,
2030         but apart from that these two classes have no dependency on anything in
2031         the WebKit layer, so they can be moved from there.
2032
2033         No new tests -- no change in functionality.
2034
2035         * platform/TextureMapper.cmake:
2036         * platform/graphics/texmap/coordinated/AreaAllocator.cpp: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.cpp.
2037         (WebCore::AreaAllocator::AreaAllocator):
2038         (WebCore::AreaAllocator::~AreaAllocator):
2039         (WebCore::AreaAllocator::expand):
2040         (WebCore::AreaAllocator::expandBy):
2041         (WebCore::AreaAllocator::release):
2042         (WebCore::AreaAllocator::overhead const):
2043         (WebCore::AreaAllocator::roundAllocation const):
2044         (WebCore::GeneralAreaAllocator::GeneralAreaAllocator):
2045         (WebCore::GeneralAreaAllocator::~GeneralAreaAllocator):
2046         (WebCore::GeneralAreaAllocator::freeNode):
2047         (WebCore::GeneralAreaAllocator::expand):
2048         (WebCore::fitsWithin):
2049         (WebCore::GeneralAreaAllocator::allocate):
2050         (WebCore::GeneralAreaAllocator::allocateFromNode):
2051         (WebCore::GeneralAreaAllocator::splitNode):
2052         (WebCore::GeneralAreaAllocator::updateLargestFree):
2053         (WebCore::GeneralAreaAllocator::release):
2054         (WebCore::GeneralAreaAllocator::overhead const):
2055         * platform/graphics/texmap/coordinated/AreaAllocator.h: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.h.
2056         (WebCore::nextPowerOfTwo):
2057         (WebCore::AreaAllocator::size const):
2058         (WebCore::AreaAllocator::minimumAllocation const):
2059         (WebCore::AreaAllocator::setMinimumAllocation):
2060         (WebCore::AreaAllocator::margin const):
2061         (WebCore::AreaAllocator::setMargin):
2062         * platform/graphics/texmap/coordinated/UpdateAtlas.cpp: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp.
2063         (WebCore::UpdateAtlas::UpdateAtlas):
2064         (WebCore::UpdateAtlas::~UpdateAtlas):
2065         (WebCore::UpdateAtlas::buildLayoutIfNeeded):
2066         (WebCore::UpdateAtlas::didSwapBuffers):
2067         (WebCore::UpdateAtlas::getCoordinatedBuffer):
2068         * platform/graphics/texmap/coordinated/UpdateAtlas.h: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h.
2069         (WebCore::UpdateAtlas::size const):
2070         (WebCore::UpdateAtlas::supportsAlpha const):
2071         (WebCore::UpdateAtlas::addTimeInactive):
2072         (WebCore::UpdateAtlas::isInactive const):
2073         (WebCore::UpdateAtlas::isInUse const):
2074
2075 2017-12-11  Ryosuke Niwa  <rniwa@webkit.org>
2076
2077         Disable NoEventDispatchAssertion release assertion in WebKit1
2078         https://bugs.webkit.org/show_bug.cgi?id=180616
2079
2080         Reviewed by Zalan Bujtas.
2081
2082         Disabled the release assertion for NoEventDispatchAssertion in WebKit1 since there are many
2083         delegate callbacks that happen at unsafe timing, and we don't have any hope of fixing them
2084         in short term.
2085
2086         * bindings/js/ScriptController.cpp:
2087         (WebCore::ScriptController::canExecuteScripts):
2088         * dom/Document.cpp:
2089         (WebCore::isSafeToUpdateStyleOrLayout):
2090         * dom/ScriptElement.cpp:
2091         (WebCore::ScriptElement::executeClassicScript):
2092         * platform/RuntimeApplicationChecks.h:
2093         (WebCore::isInWebProcess):
2094         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
2095         (WebCore::isInWebProcess): Extracted from IOSApplication::isWebProcess.
2096         (WebCore::IOSApplication::isWebProcess):
2097
2098 2017-12-11  Darin Adler  <darin@apple.com>
2099
2100         Improve FontSelectionAlgorithm, including moving from IntegerHasher to Hasher
2101         https://bugs.webkit.org/show_bug.cgi?id=180340
2102
2103         Reviewed by Dan Bates.
2104
2105         * css/CSSFontFaceSet.h: Moved FontSelectionRequestKey and FontSelectionRequestKeyHash
2106         here to be private members, and used a std::optional instead of a class for this.
2107         Also use the new Hasher to compute the hash. Also added FontSelectionRequestKeyHashTraits.
2108
2109         * platform/graphics/FontDescription.cpp:
2110         (WebCore::FontDescription::FontDescription): Updated since FontSelectionRequest
2111         does not always have a constructor any more.
2112
2113         * platform/graphics/FontSelectionAlgorithm.h: Tweaked comments. Used "using" instead
2114         of typedef. Formatted some trivial functions as single lines. Stopped using
2115         NeverDestroyed for simple classes like FontSelectionValue; it's not needed unless
2116         there is a destructor. Got rid of some incorrect use of const. Replaced some member
2117         functions with non-member functions. Moved some function bodies out of class definitions.
2118         Used a lot of constexpr functions.
2119         (WebCore::FontSelectionRequest::tied const): Added so we can easily write both == and the
2120         hash function without listing the data members.
2121         (WebCore::add): Added an overload so we can hash things that include FontSelectionRequest.
2122         (WebCore::FontSelectionRequestKey::FontSelectionRequestKey): Changed this class to
2123         use std::optional instead of a separate boolean for deleted values.
2124         (WebCore::FontSelectionRequestKey::isHashTableDeletedValue const): Ditto.
2125         (WebCore::FontSelectionRequestKey::operator== const): Ditto.
2126         (WebCore::FontSelectionRequestKeyHash::hash): Ditto.
2127         (WebCore::FontSelectionRequestKeyHash::equal): Ditto.
2128         (WebCore::FontSelectionCapabilities::tied const): Added so we can easily write both ==
2129         and the hash function without listing the data members.
2130         (WebCore::FontSelectionSpecifiedCapabilities::tied const): Ditto.
2131         (WebCore::FontSelectionAlgorithm::FontSelectionAlgorithm): Use make_unique instead of new.
2132
2133         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2134         (WebCore::findClosestFont): Move in the vector instead of copying it when creating a
2135         FontSelectionAlgorithm object.
2136
2137 2017-12-11  Jer Noble  <jer.noble@apple.com>
2138
2139         [EME] support update() for FairPlayStreaming in Modern EME API
2140         https://bugs.webkit.org/show_bug.cgi?id=180542
2141
2142         Reviewed by Eric Carlson.
2143
2144         Support the updateLicense() method in CDMInstanceFairPlayStreaming. Also, support adding a
2145         AVStreamDataParser to the AVContentKeySession.
2146
2147         Drive-by fixes:
2148
2149         - Sometimes, AVFoundation will give us a base64 encoded string with spaces url-disallowed
2150         characters, so use base64Decode() rather than base64URLDecode().
2151
2152         * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
2153         (WebCore::validFairPlayStreamingSchemes):
2154         (WebCore::extractSinfData):
2155         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
2156         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
2157         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense):
2158         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest):
2159         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didFailToProvideRequest):
2160         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2161         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstance const):
2162         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2163         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceAttached):
2164         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceDetached):
2165         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::attemptToDecryptWithInstance):
2166         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
2167         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2168         (WebCore::SourceBufferPrivateAVFObjC::destroyParser):
2169         (WebCore::SourceBufferPrivateAVFObjC::setCDMInstance):
2170
2171 2017-12-11  Eric Carlson  <eric.carlson@apple.com>
2172
2173         Web Inspector: Optionally log WebKit log parameters as JSON
2174         https://bugs.webkit.org/show_bug.cgi?id=180529
2175         <rdar://problem/35909462>
2176
2177         Reviewed by Joseph Pecoraro.
2178
2179         * dom/Document.cpp:
2180         (WebCore::Document::didLogMessage):Update for API change. Don't check for main thread, that
2181         is already done in addConsoleMessage.
2182         * dom/Document.h:
2183
2184         * html/HTMLMediaElement.cpp:
2185         (WebCore::HTMLMediaElement::updatePlayState): Cleanup logging.
2186
2187         * html/track/DataCue.cpp:
2188         (WebCore::DataCue::toJSONString const): Serialize to JSON string.
2189         (WebCore::DataCue::toString const): Deleted.
2190         * html/track/DataCue.h:
2191         (WTF::LogArgument<WebCore::DataCue>::toString):
2192
2193         * html/track/TextTrackCue.cpp:
2194         (WebCore::TextTrackCue::toJSON const): Ditto.
2195         (WebCore::TextTrackCue::toJSONString const):
2196         (WebCore::TextTrackCue::toString const): Deleted.
2197         * html/track/TextTrackCue.h:
2198         (WTF::LogArgument<WebCore::TextTrackCue>::toString):
2199
2200         * html/track/TextTrackCueGeneric.cpp:
2201         (WebCore::TextTrackCueGeneric::toJSONString const): Ditto.
2202         (WebCore::TextTrackCueGeneric::toString const): Deleted.
2203         * html/track/TextTrackCueGeneric.h:
2204         (WTF::LogArgument<WebCore::TextTrackCueGeneric>::toString):
2205
2206         * html/track/VTTCue.cpp:
2207         (WebCore::VTTCue::toJSONString const): Ditto.
2208         (WebCore::VTTCue::toString const): Deleted.
2209         * html/track/VTTCue.h:
2210         (WTF::LogArgument<WebCore::VTTCue>::toString):
2211
2212         * platform/graphics/InbandTextTrackPrivateClient.h:
2213         (WebCore::GenericCueData::toJSONString const): Ditto.
2214         (WTF::LogArgument<WebCore::GenericCueData>::toString):
2215         (WebCore::GenericCueData::toString const): Deleted.
2216
2217         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
2218         (WebCore::InbandTextTrackPrivateAVF::processAttributedStrings): Cleanup logging.
2219         (WebCore::InbandTextTrackPrivateAVF::removeCompletedCues): Ditto.
2220         (WebCore::InbandTextTrackPrivateAVF::processNativeSamples): Log the entire cue.
2221         (WebCore::InbandTextTrackPrivateAVF::readNativeSampleBuffer): Cleanup logging.
2222
2223         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
2224         (WebCore::MediaPlayerPrivateAVFoundation::maxMediaTimeSeekable const): Don't log, it isn't
2225         interesting and happens frequently.
2226         (WebCore::MediaPlayerPrivateAVFoundation::minMediaTimeSeekable const): Ditto.
2227
2228         * platform/graphics/iso/ISOVTTCue.cpp:
2229         (WebCore::ISOWebVTTCue::toJSONString const): Serialize to JSON string.
2230
2231         * platform/graphics/iso/ISOVTTCue.h:
2232         (WTF::LogArgument<WebCore::ISOWebVTTCue>::toString): Ditto.
2233
2234 2017-12-11  Youenn Fablet  <youenn@apple.com>
2235
2236         Use VCP H264 encoder for platforms supporting it
2237         https://bugs.webkit.org/show_bug.cgi?id=179076
2238         rdar://problem/35180773
2239
2240         Reviewed by Eric Carlson.
2241
2242         Covered by existing test coverage.
2243
2244         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.cpp:
2245         (WebCore::VideoToolboxVideoEncoderFactory::setActive):
2246         (WebCore::VideoToolboxVideoEncoderFactory::CreateSupportedVideoEncoder):
2247         (WebCore::VideoToolboxVideoEncoderFactory::DestroyVideoEncoder):
2248         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.h:
2249
2250 2017-12-11  Chris Dumez  <cdumez@apple.com>
2251
2252         Merge ServiceWorkerClientIdentifier into ServiceWorkerClientData
2253         https://bugs.webkit.org/show_bug.cgi?id=180669
2254
2255         Reviewed by Youenn Fablet.
2256
2257         Merge ServiceWorkerClientIdentifier into ServiceWorkerClientData, for consistency with
2258         ServiceWorkerIdentifier / ServiceWorkerData, and start simplifying the postMessage() code.
2259
2260         * WebCore.xcodeproj/project.pbxproj:
2261         * dom/Document.cpp:
2262         (WebCore::Document::setServiceWorkerConnection):
2263         * workers/service/SWClientConnection.h:
2264         * workers/service/ServiceWorker.cpp:
2265         (WebCore::ServiceWorker::postMessage):
2266         * workers/service/ServiceWorkerClient.cpp:
2267         (WebCore::ServiceWorkerClient::getOrCreate):
2268         (WebCore::ServiceWorkerClient::ServiceWorkerClient):
2269         * workers/service/ServiceWorkerClient.h:
2270         (WebCore::ServiceWorkerClient::identifier const):
2271         * workers/service/ServiceWorkerClientData.cpp:
2272         (WebCore::ServiceWorkerClientData::isolatedCopy const):
2273         (WebCore::ServiceWorkerClientData::from):
2274         * workers/service/ServiceWorkerClientData.h:
2275         (WebCore::ServiceWorkerClientData::encode const):
2276         (WebCore::ServiceWorkerClientData::decode):
2277         * workers/service/ServiceWorkerClientInformation.h: Removed.
2278         * workers/service/ServiceWorkerClients.cpp:
2279         (WebCore::didFinishGetRequest):
2280         (WebCore::ServiceWorkerClients::get):
2281         (WebCore::matchAllCompleted):
2282         * workers/service/ServiceWorkerTypes.h:
2283         * workers/service/ServiceWorkerWindowClient.cpp:
2284         (WebCore::ServiceWorkerWindowClient::ServiceWorkerWindowClient):
2285         * workers/service/ServiceWorkerWindowClient.h:
2286         * workers/service/context/SWContextManager.cpp:
2287         (WebCore::SWContextManager::postMessageToServiceWorker):
2288         * workers/service/context/SWContextManager.h:
2289         * workers/service/context/ServiceWorkerThread.cpp:
2290         (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
2291         * workers/service/context/ServiceWorkerThread.h:
2292         * workers/service/server/SWServer.cpp:
2293         (WebCore::SWServer::findClientByIdentifier):
2294         (WebCore::SWServer::matchAll):
2295         (WebCore::SWServer::claim):
2296         (WebCore::SWServer::registerServiceWorkerClient):
2297         * workers/service/server/SWServer.h:
2298         * workers/service/server/SWServerToContextConnection.h:
2299         * workers/service/server/SWServerWorker.h:
2300
2301 2017-12-11  Daniel Bates  <dabates@apple.com>
2302
2303         Fix the macOS Sierra build following r225179
2304         (https://bugs.webkit.org/show_bug.cgi?id=180011)
2305
2306         Substitute TARGET_MAC_OS_X_VERSION_LESS_THAN_101300 for TARGET_MAC_OS_X_VERSION_LESS_THAN_1013000.
2307
2308         * Configurations/WebCore.xcconfig:
2309
2310 2017-12-11  Zalan Bujtas  <zalan@apple.com>
2311
2312         Make FrameView objects IsoHeap allocated
2313         https://bugs.webkit.org/show_bug.cgi?id=180668
2314         <rdar://problem/35976738>
2315
2316         Reviewed by Simon Fraser.
2317
2318         Related to <https://trac.webkit.org/changeset/225719/webkit>
2319
2320         * page/FrameView.cpp:
2321         * page/FrameView.h:
2322
2323 2017-12-11  Antoine Quint  <graouts@apple.com>
2324
2325         [Web Animations] Implement AnimationPlaybackEvent and AnimationPlaybackEventInit
2326         https://bugs.webkit.org/show_bug.cgi?id=180647
2327
2328         Reviewed by Dean Jackson.
2329
2330         Actually fix Windows build this time.
2331
2332         * animation/AnimationPlaybackEventInit.h:
2333
2334 2017-12-11  Antoine Quint  <graouts@apple.com>
2335
2336         [Web Animations] Implement AnimationPlaybackEvent and AnimationPlaybackEventInit
2337         https://bugs.webkit.org/show_bug.cgi?id=180647
2338         <rdar://problem/35966325>
2339
2340         Reviewed by Dean Jackson.
2341
2342         Unreviewed, fix Windows build.
2343
2344         * animation/AnimationPlaybackEventInit.h:
2345
2346 2017-12-11  Zalan Bujtas  <zalan@apple.com>
2347
2348         FloatingObjects/FloatingObject classes should hold weak references to renderers
2349         https://bugs.webkit.org/show_bug.cgi?id=180627
2350         <rdar://problem/35954069>
2351
2352         Reviewed by Antti Koivisto.
2353
2354         * rendering/FloatingObjects.cpp:
2355         (WebCore::FloatingObject::FloatingObject):
2356         (WebCore::ComputeFloatOffsetAdapter::ComputeFloatOffsetAdapter):
2357         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter::ComputeFloatOffsetForFloatLayoutAdapter):
2358         (WebCore::ComputeFloatOffsetForLineLayoutAdapter::ComputeFloatOffsetForLineLayoutAdapter):
2359         (WebCore::FindNextFloatLogicalBottomAdapter::FindNextFloatLogicalBottomAdapter):
2360         (WebCore::FindNextFloatLogicalBottomAdapter::collectIfNeeded):
2361         (WebCore::FloatingObjects::findNextFloatLogicalBottomBelow):
2362         (WebCore::FloatingObjects::findNextFloatLogicalBottomBelowForBlock):
2363         (WebCore::FloatingObjects::FloatingObjects):
2364         (WebCore::FloatingObjects::clearLineBoxTreePointers):
2365         (WebCore::FloatingObjects::logicalLeftOffsetForPositioningFloat):
2366         (WebCore::FloatingObjects::logicalRightOffsetForPositioningFloat):
2367         (WebCore::FloatingObjects::logicalLeftOffset):
2368         (WebCore::FloatingObjects::logicalRightOffset):
2369         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded):
2370         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded):
2371         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter<FloatTypeValue>::heightRemaining const):
2372         (WebCore::ComputeFloatOffsetAdapter<FloatTypeValue>::collectIfNeeded):
2373         (WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded):
2374         (WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded):
2375         * rendering/FloatingObjects.h:
2376         (WebCore::FloatingObject::renderer const):
2377         (WebCore::FloatingObjects::renderer const):
2378
2379 2017-12-11  David Quesada  <david_quesada@apple.com>
2380
2381         Turn on ENABLE_APPLICATION_MANIFEST
2382         https://bugs.webkit.org/show_bug.cgi?id=180562
2383         rdar://problem/35924737
2384
2385         Reviewed by Geoffrey Garen.
2386
2387         * Configurations/FeatureDefines.xcconfig:
2388         * loader/LinkLoader.cpp:
2389         (WebCore::createLinkPreloadResourceClient):
2390         * loader/cached/CachedResourceRequest.cpp:
2391             Add a missing #include that was implicitly added in the unified source when
2392             the feature is disabled.
2393
2394 2017-12-11  Dean Jackson  <dino@apple.com>
2395
2396         Add a runtime feature flag for ImageBitmap and OffscreenCanvas
2397         https://bugs.webkit.org/show_bug.cgi?id=180652
2398         <rdar://problem/35969611>
2399
2400         Reviewed by Antoine Quint.
2401
2402         Add a RuntimeEnabledFeature for these interfaces, and link the bindings
2403         to the feature.
2404
2405         Test: fast/canvas/offscreen-enabled.html
2406
2407         * bindings/js/WebCoreBuiltinNames.h:
2408         * html/ImageBitmap.idl:
2409         * html/OffscreenCanvas.idl:
2410         * page/RuntimeEnabledFeatures.h:
2411         (WebCore::RuntimeEnabledFeatures::setImageBitmapOffscreenCanvasEnabled):
2412         (WebCore::RuntimeEnabledFeatures::imageBitmapOffscreenCanvasEnabled const):
2413         * page/WindowOrWorkerGlobalScope.idl:
2414
2415 2017-12-11  Antoine Quint  <graouts@apple.com>
2416
2417         [Web Animations] Implement AnimationPlaybackEvent and AnimationPlaybackEventInit
2418         https://bugs.webkit.org/show_bug.cgi?id=180647
2419         <rdar://problem/35966325>
2420
2421         Reviewed by Dean Jackson.
2422
2423         We implement the AnimationPlaybackEvent interface and AnimationPlaybackEventInit dictionary
2424         as the first step towards dispatching animation "finish" and "cancel" events.
2425
2426         Animation playback events will be dispatched on Animation objects and expose the timeline time
2427         and animation current time at the time they were constructed. Dispatch itself, which will be
2428         the focus of the next patch, is not synchronous, so it's important to track those values
2429         at creation time.
2430
2431         No new tests yet, followup patches will enable event dispatch and existing Web Platform Tests
2432         will show progressions.
2433
2434         * CMakeLists.txt:
2435         * DerivedSources.make:
2436         * Sources.txt:
2437         * WebCore.xcodeproj/project.pbxproj:
2438         * animation/AnimationPlaybackEvent.cpp: Added.
2439         (WebCore::AnimationPlaybackEvent::AnimationPlaybackEvent):
2440         (WebCore::AnimationPlaybackEvent::bindingsCurrentTime const):
2441         (WebCore::AnimationPlaybackEvent::bindingsTimelineTime const):
2442         * animation/AnimationPlaybackEvent.h: Added.
2443         * animation/AnimationPlaybackEvent.idl: Added.
2444         * animation/AnimationPlaybackEventInit.h: Added.
2445         * animation/AnimationPlaybackEventInit.idl: Added.
2446         * bindings/js/WebCoreBuiltinNames.h:
2447         * dom/EventNames.in:
2448
2449 2017-12-11  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2450
2451         [WinCairo] DumpRenderTree times out for all non-http tests
2452         https://bugs.webkit.org/show_bug.cgi?id=180571
2453
2454         Reviewed by Alex Christensen.
2455
2456         Bug fix on processing the curl event for file protocol.
2457
2458         No new tests. This fix is to run existing tests.
2459
2460         * platform/network/curl/CurlRequest.cpp:
2461         (WebCore::CurlRequest::completeDidReceiveResponse):
2462         * platform/network/curl/CurlRequest.h:
2463         (WebCore::CurlRequest::isCompleted const):
2464         (WebCore::CurlRequest::isCancelled const):
2465         (WebCore::CurlRequest::isCompletedOrCancelled const):
2466
2467 2017-12-11  Manuel Rego Casasnovas  <rego@igalia.com>
2468
2469         REGRESSION(r221931): Row stretch doesn't work for grid container with min-height
2470         https://bugs.webkit.org/show_bug.cgi?id=180287
2471
2472         Reviewed by Darin Adler.
2473
2474         In r221931 we moved the stretch phase as the last step of
2475         the track sizing algorithm.
2476         However this introduced a regression as we were no longer
2477         taking into account the grid container min-width|height constraints
2478         during this step.
2479
2480         The CSS WG modified the spec so it now defines what to do
2481         in these situations (https://drafts.csswg.org/css-grid/#algo-stretch):
2482           "If the free space is indefinite, but the grid container
2483            has a definite min-width/height, use that size to calculate
2484            the free space for this step instead."
2485
2486         This patch adds a new method
2487         GridTrackSizingAlgorithmStrategy::freeSpaceForStretchAutoTracksStep().
2488         When we're in the DefiniteSizeStrategy it just returns the current
2489         free space.
2490         For the IndefiniteSizeStrategy in the columns case we don't need
2491         any special computation (the same that happens in
2492         recomputeUsedFlexFractionIfNeeded()); for rows it uses the min size
2493         of the grid container (respecting min-width|height properties)
2494         to calculate the free space.
2495
2496         Test: imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-stretch-respects-min-size-001.html
2497
2498         * rendering/GridTrackSizingAlgorithm.cpp:
2499         (WebCore::IndefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep const):
2500         (WebCore::DefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep const):
2501         (WebCore::GridTrackSizingAlgorithm::stretchAutoTracks):
2502         * rendering/GridTrackSizingAlgorithm.h:
2503
2504 2017-12-10  Minsheng Liu  <lambda@liu.ms>
2505
2506         Incorrect bounds inside <mover>/<munder> when a stretchy operator is present
2507         https://bugs.webkit.org/show_bug.cgi?id=179682
2508
2509         Reviewed by Frédéric Wang.
2510
2511         Currently a stretchy operator inside <mover>/<munder>/<munderover> is stretched
2512         during paint() rather than layout(), which leads to both end user confusion
2513         and many unexpected behaviors. This patch rewrites
2514         RenderMathMLUnderOver::stretchHorizontalOperatorsAndLayoutChildren()
2515         to both eliminate the issue and make operator stretching more standard
2516         conforming.
2517
2518         A test is added to check the stretch width of stretchy operators in various
2519         scenarios:
2520         mathml/opentype/munderover-stretch-width.html
2521
2522         A previous test is updated:
2523         mathml/opentype/opentype-stretchy-horizontal.html
2524
2525         * rendering/mathml/RenderMathMLOperator.cpp:
2526         (WebCore::RenderMathMLOperator::stretchTo):
2527         (WebCore::RenderMathMLOperator::resetStretchSize):
2528         (WebCore::RenderMathMLOperator::paint):
2529         * rendering/mathml/RenderMathMLOperator.h:
2530         (WebCore::RenderMathMLOperator::setStretchWidthLocked):
2531         (WebCore::RenderMathMLOperator::isStretchWidthLocked const):
2532         * rendering/mathml/RenderMathMLUnderOver.cpp:
2533         (WebCore::toHorizontalStretchyOperator):
2534         (WebCore::fixLayoutAfterStretch):
2535         (WebCore::RenderMathMLUnderOver::stretchHorizontalOperatorsAndLayoutChildren):
2536
2537 2017-12-10  Yusuke Suzuki  <utatane.tea@gmail.com>
2538
2539         Unreviewed, follow-up patch after r225470
2540         https://bugs.webkit.org/show_bug.cgi?id=180308
2541
2542         * Modules/webdatabase/SQLTransaction.cpp:
2543         (WebCore::SQLTransaction::checkAndHandleClosedDatabase):
2544         Use consistent operands.
2545
2546         * bindings/js/JSCallbackData.h:
2547         (WebCore::JSCallbackData::JSCallbackData):
2548         Use class field initializer.
2549
2550         * xml/parser/XMLDocumentParserLibxml2.cpp:
2551         (WebCore::openFunc):
2552         Use consistent operands.
2553
2554 2017-12-09  Ryosuke Niwa  <rniwa@webkit.org>
2555
2556         iOS: Crash in Document::updateLayout() via Document::processViewport
2557         https://bugs.webkit.org/show_bug.cgi?id=180619
2558         <rdar://problem/35717575>
2559
2560         Reviewed by Zalan Bujtas.
2561
2562         The crash is caused by modern media controls updating the layout in the middle of insertedIntoAncestor
2563         via HTMLMediaElement::setControllerJSProperty inside Document::pageScaleFactorChangedAndStable.
2564
2565         Fixed the crash by delaying the work to update the viewport configuration until didFinishInsertingNode
2566         since updating the viewport configuration results in a lot of related code running in response,
2567         and making sure all that code never tries to execute an author script is not attainable in the short term,
2568         and a maintenance nightmare in the long term.
2569
2570         Test: media/ios/viewport-change-with-video.html
2571
2572         * html/HTMLMetaElement.cpp:
2573         (WebCore::HTMLMetaElement::insertedIntoAncestor):
2574         (WebCore::HTMLMetaElement::didFinishInsertingNode): Added.
2575         * html/HTMLMetaElement.h:
2576
2577 2017-12-08  Zalan Bujtas  <zalan@apple.com>
2578
2579         Document::updateLayout() could destroy current frame.
2580         https://bugs.webkit.org/show_bug.cgi?id=180525
2581         <rdar://problem/35906836>
2582
2583         Reviewed by Simon Fraser.
2584
2585         Early return when Document::updateLayout() triggers Frame destruction.
2586
2587         Test: fast/frames/crash-when-iframe-is-remove-in-eventhandler.html
2588
2589         * dom/TreeScope.cpp:
2590         (WebCore::absolutePointIfNotClipped):
2591
2592 2017-12-08  Chris Dumez  <cdumez@apple.com>
2593
2594         ServiceWorkerGlobalScope is a global object and should be marked as [ImplicitThis] in the IDL
2595         https://bugs.webkit.org/show_bug.cgi?id=180615
2596
2597         Reviewed by Brady Eidson.
2598
2599         ServiceWorkerGlobalScope is a global object and should be marked as [ImplicitThis] in the IDL, similarly to what we do for Window.
2600         This allows a getter to be fallback to the global object as ThisValue when the cast of the ThisValue to the expected type fails.
2601
2602         No new tests, rebaselined existing test.
2603
2604         * workers/DedicatedWorkerGlobalScope.idl:
2605         * workers/WorkerGlobalScope.idl:
2606         * workers/service/ServiceWorkerGlobalScope.idl:
2607
2608 2017-12-08  Brady Eidson  <beidson@apple.com>
2609
2610         Delay some service worker operations until after the database import completes.
2611         https://bugs.webkit.org/show_bug.cgi?id=180573
2612
2613         Reviewed by Chris Dumez.
2614
2615         No new tests (Not testable yet).
2616
2617         Right after the storage process launches it starts importing registration records.
2618         During this time, a lot of the decisions we make regarding registrations, fetch, etc.
2619         are invalid, as they rely on those in-memory records being in place.
2620         
2621         This patch delays certain things until after the initial origin table import is complete.
2622         
2623         * workers/service/server/RegistrationStore.cpp:
2624         (WebCore::RegistrationStore::databaseOpenedAndRecordsImported):
2625
2626         * workers/service/server/SWOriginStore.h:
2627
2628         * workers/service/server/SWServer.cpp:
2629         (WebCore::SWServer::registrationStoreImportComplete): Tell the origin store the initial
2630           import was completed.
2631         (WebCore::SWServer::addRegistrationFromStore):
2632         * workers/service/server/SWServer.h:
2633
2634 2017-12-08  Youenn Fablet  <youenn@apple.com>
2635
2636         Service Worker should use a correct user agent
2637         https://bugs.webkit.org/show_bug.cgi?id=180566
2638         <rdar://problem/35926295>
2639
2640         Reviewed by Chris Dumez.
2641
2642         Test: http/wpt/service-workers/useragent.https.html
2643
2644         Make ServiceWorkerFrameLoaderClient return a valid UserAgent.
2645         Pass user agent to ServiceWorkerThread so that navigation.userAgent is correctly initialized.
2646         Allow ServiceWorkerFrameLoaderClient to clean itself when no longer needed.
2647
2648         * loader/EmptyFrameLoaderClient.h:
2649         * workers/service/context/ServiceWorkerThread.cpp:
2650         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
2651         * workers/service/context/ServiceWorkerThread.h:
2652         * workers/service/context/ServiceWorkerThreadProxy.cpp:
2653         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
2654         (WebCore::ServiceWorkerThreadProxy::frameLoaderClient):
2655         * workers/service/context/ServiceWorkerThreadProxy.h:
2656
2657 2017-12-07  Simon Fraser  <simon.fraser@apple.com>
2658
2659         Wrong caret position for input field inside a fixed position parent on iOS 11
2660         https://bugs.webkit.org/show_bug.cgi?id=176896
2661         rdar://problem/33726145
2662
2663         Reviewed by Tim Horton.
2664
2665         In r219668 I added code to compute a layout viewport rect in the web process, so that
2666         after programmatic scrolling, getBoundingClientRect() would return the correct values.
2667         However, that computation sometimes used a different visual viewport than the UI process,
2668         resulting in a different layout viewport being set. This would happen when the keyboard
2669         was visible, and the combination of this and zooming when focusing an input would result
2670         in a state where the scrolling tree contained notes computed with the bad layout viewport.
2671         This could cause apparently offset fixed elements, and bad caret positioning if those fixed
2672         elements contained the focused input.
2673
2674         Fix by passing to the web process the same visual viewport rect that the UI process is using,
2675         namely "unobscuredContentRectRespectingInputViewBounds". This was already being set in
2676         VisibleContentRectUpdateInfo but wasn't encoded/decoded, so fix that. Set it as an optional<>
2677         on FrameView when different from the normal visual viewport, and return it from
2678         visualViewportRect().
2679
2680         Some other minor logging changes.
2681
2682         Test: fast/visual-viewport/ios/caret-after-focus-in-fixed.html
2683
2684         * page/FrameView.cpp:
2685         (WebCore::FrameView::setVisualViewportOverrideRect):
2686         (WebCore::FrameView::updateLayoutViewport):
2687         (WebCore::FrameView::visualViewportRect const):
2688         * page/FrameView.h:
2689         * page/scrolling/mac/ScrollingTreeFixedNode.mm:
2690         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange):
2691
2692 2017-12-08  Zalan Bujtas  <zalan@apple.com>
2693
2694         Make inline box objects IsoHeap allocated.
2695         https://bugs.webkit.org/show_bug.cgi?id=180556
2696         <rdar://problem/35923629>
2697
2698         Reviewed by Filip Pizlo.
2699
2700         * rendering/EllipsisBox.cpp:
2701         * rendering/EllipsisBox.h:
2702         * rendering/InlineBox.cpp:
2703         * rendering/InlineBox.h:
2704         * rendering/InlineElementBox.cpp:
2705         * rendering/InlineElementBox.h:
2706         * rendering/InlineFlowBox.cpp:
2707         * rendering/InlineFlowBox.h:
2708         * rendering/InlineTextBox.cpp:
2709         * rendering/InlineTextBox.h:
2710         * rendering/RootInlineBox.cpp:
2711         * rendering/RootInlineBox.h:
2712         * rendering/TrailingFloatsRootInlineBox.h:
2713         * rendering/svg/SVGInlineFlowBox.cpp:
2714         * rendering/svg/SVGInlineFlowBox.h:
2715         * rendering/svg/SVGInlineTextBox.cpp:
2716         * rendering/svg/SVGInlineTextBox.h:
2717         * rendering/svg/SVGRootInlineBox.cpp:
2718         * rendering/svg/SVGRootInlineBox.h:
2719
2720 2017-12-08  Chris Dumez  <cdumez@apple.com>
2721
2722         Clearing all Website Data should remove service worker registrations on disk
2723         https://bugs.webkit.org/show_bug.cgi?id=180558
2724
2725         Reviewed by Youenn Fablet.
2726
2727         Clear service worker registrations on disk in addition to the ones in memory.
2728
2729         * workers/service/server/RegistrationDatabase.cpp:
2730         (WebCore::v1RecordsTableSchema):
2731         (WebCore::v1RecordsTableSchemaAlternate):
2732         (WebCore::databaseFilename):
2733         Make sure these always get called from the background thread since they use
2734         a static string.
2735
2736         (WebCore::RegistrationDatabase::RegistrationDatabase):
2737         Call importRecordsIfNecessary() instead of openSQLiteDatabase(). importRecordsIfNecessary()
2738         only calls openSQLiteDatabase() if the database file exists, to avoid creating a database
2739         file unnecessarily.
2740
2741         (WebCore::RegistrationDatabase::databasePath const):
2742         New method which returns the database file path.
2743
2744         (WebCore::RegistrationDatabase::openSQLiteDatabase):
2745
2746         (WebCore::RegistrationDatabase::importRecordsIfNecessary):
2747         New methods which imports records if the database file exist. It the database file does
2748         not exist, it does not create it.
2749
2750         (WebCore::RegistrationDatabase::pushChanges):
2751         Call completion handler when changes are pushed.
2752
2753         (WebCore::RegistrationDatabase::clearAll):
2754         Close the database if it is open, then remove the database files.
2755
2756         (WebCore::RegistrationDatabase::doPushChanges):
2757         If the database is not already open, we now open it when trying to write changes for
2758         the first time.
2759
2760         * workers/service/server/RegistrationDatabase.h:
2761         * workers/service/server/RegistrationStore.cpp:
2762         (WebCore::RegistrationStore::clearAll):
2763         (WebCore::RegistrationStore::flushChanges):
2764         * workers/service/server/RegistrationStore.h:
2765
2766         * workers/service/server/SWServer.cpp:
2767         (WebCore::SWServer::clearAll):
2768         (WebCore::SWServer::clear):
2769         Also clear the database.
2770
2771         * workers/service/server/SWServer.h:
2772
2773         * workers/service/server/SWServerWorker.cpp:
2774         (WebCore::SWServerWorker::terminate):
2775         Only call SWServer::terminateWorker() if the worker is running. Otherwise, we hit
2776         an assertion when clearing a registration would worker was already terminated.
2777
2778 2017-12-08  Joseph Pecoraro  <pecoraro@apple.com>
2779
2780         ServiceWorker Inspector: Various issues inspecting service worker on mobile.twitter.com
2781         https://bugs.webkit.org/show_bug.cgi?id=180520
2782         <rdar://problem/35900764>
2783
2784         Reviewed by Brian Burg.
2785
2786         * inspector/agents/worker/ServiceWorkerAgent.cpp:
2787         (WebCore::ServiceWorkerAgent::getInitializationInfo):
2788         * inspector/agents/worker/ServiceWorkerAgent.h:
2789         Add initial script content to initialization so we always at least have main resource content.
2790
2791 2017-12-08  Joseph Pecoraro  <pecoraro@apple.com>
2792
2793         ServiceWorker Inspector: Should be able to see image content from CacheStorage.add(url) network request
2794         https://bugs.webkit.org/show_bug.cgi?id=180506
2795
2796         Reviewed by Brian Burg.
2797
2798         No test as this only happens inside a ServiceWorker inspector which
2799         we don't yet have a way to test. In a Page Inspector, the
2800         CacheStorage.add network request already behaves as expected.
2801
2802         * inspector/NetworkResourcesData.cpp:
2803         (WebCore::NetworkResourcesData::responseReceived):
2804         (WebCore::shouldBufferResourceData):
2805         * inspector/NetworkResourcesData.h:
2806         (WebCore::NetworkResourcesData::ResourceData::forceBufferData const):
2807         (WebCore::NetworkResourcesData::ResourceData::setForceBufferData):
2808         Provide a way to force buffering in NetworkResourceData.
2809
2810         * inspector/agents/InspectorNetworkAgent.cpp:
2811         (WebCore::InspectorNetworkAgent::didReceiveResponse):
2812         * inspector/agents/InspectorNetworkAgent.h:
2813         * inspector/agents/page/PageNetworkAgent.h:
2814         * inspector/agents/worker/WorkerNetworkAgent.h:
2815         Enable force buffering in a Worker Network Agent.
2816
2817 2017-12-08  Daniel Bates  <dabates@apple.com>
2818
2819         Remove unnecessary prefix from AutoFillButtonType enumerators
2820         https://bugs.webkit.org/show_bug.cgi?id=180512
2821
2822         Reviewed by Tim Horton.
2823
2824         * testing/Internals.cpp:
2825         (WebCore::toAutoFillButtonType):
2826         * testing/Internals.h:
2827         * testing/Internals.idl:
2828
2829 2017-12-08  Dean Jackson  <dino@apple.com>
2830
2831         Implement transferToImageBitmap for WebGL offscreen canvas objects
2832         https://bugs.webkit.org/show_bug.cgi?id=180603
2833         <rdar://problem/34147143>
2834
2835         Reviewed by Sam Weinig.
2836
2837         Implement the basic version of creating an ImageBitmap from an
2838         OffscreenCanvas that is using a WebGL context.
2839
2840         Tests: http/wpt/offscreen-canvas/transferToImageBitmap-empty.html
2841                http/wpt/offscreen-canvas/transferToImageBitmap-webgl.html
2842
2843         * html/ImageBitmap.cpp:
2844         (WebCore::ImageBitmap::create): Add a new constructor to be used by OffscreenCanvas.
2845         Creates a blank ImageBitmap.
2846         * html/ImageBitmap.h:
2847
2848         * html/OffscreenCanvas.cpp:
2849         (WebCore::OffscreenCanvas::transferToImageBitmap): Create a new ImageBitmap
2850         and paint the current canvas into it.
2851
2852 2017-12-08  Youenn Fablet  <youenn@apple.com>
2853
2854         WebServiceWorkerProvider should use Cancellation error to notify DTL that it cannot handle a fetch
2855         https://bugs.webkit.org/show_bug.cgi?id=180584
2856
2857         Reviewed by Alex Christensen.
2858
2859         Previously, for each cross origin fetch that is going through a service worker and service worker is not handling the fetch,
2860         we return an AccessControl error so that DocumentThreadableLoader will do preflight and regular load through the network.
2861         This error is wrongly logged in the Inspector.
2862         Change error type to Cancellation so that the Inspector does not log it.
2863
2864         * loader/DocumentThreadableLoader.cpp:
2865         (WebCore::DocumentThreadableLoader::didFail):
2866
2867 2017-12-08  Youenn Fablet  <youenn@apple.com>
2868
2869         Service Worker should use a correct SessionID
2870         https://bugs.webkit.org/show_bug.cgi?id=180585
2871
2872         Reviewed by Alex Christensen.
2873
2874         Test: http/tests/workers/service/serviceworker-private-browsing.https.html
2875
2876         Store SessionID in SWServer and send it as part of service worker instantiation.
2877
2878         * workers/service/server/SWServer.cpp:
2879         (WebCore::SWServer::SWServer):
2880         (WebCore::SWServer::installContextData):
2881         (WebCore::SWServer::runServiceWorker):
2882         * workers/service/server/SWServer.h:
2883         * workers/service/server/SWServerToContextConnection.h:
2884
2885 2017-12-08  Youenn Fablet  <youenn@apple.com>
2886
2887         FetchResponse should keep unfiltered ResourceResponse so that it can be used in Service Worker
2888         https://bugs.webkit.org/show_bug.cgi?id=179641
2889         <rdar://problem/35923570>
2890
2891         Reviewed by Alex Christensen.
2892
2893         Covered by existing rebased tests.
2894
2895         FetchResponse will now store an unfiltered response.
2896         If it needs to expose it to JavaScript, it will create a filtered response lazily.
2897         This allows service worker to send back to web pages, opaque responses containing every information.
2898
2899         Updating Document::initSecurityContext so that any document loaded with a response whose tainting is Opaque gets a unique origin.
2900         This ensures cross-origin checks to work if service worker returns such a response on a same origin URL.
2901
2902         Updated SubresourceLoader to check cross origin service worker responses based on their tainting.
2903
2904         * Modules/fetch/FetchResponse.cpp:
2905         (WebCore::FetchResponse::create):
2906         (WebCore::FetchResponse::error):
2907         (WebCore::FetchResponse::redirect):
2908         (WebCore::FetchResponse::FetchResponse):
2909         (WebCore::FetchResponse::clone):
2910         (WebCore::FetchResponse::url const):
2911         (WebCore::FetchResponse::filteredResponse const):
2912         (WebCore::FetchResponse::BodyLoader::didReceiveResponse):
2913         (WebCore::FetchResponse::resourceResponse const):
2914         * Modules/fetch/FetchResponse.h:
2915         (WebCore::FetchResponse::create): Deleted.
2916         * dom/Document.cpp:
2917         (WebCore::Document::initSecurityContext):
2918         * loader/SubresourceLoader.cpp:
2919         (WebCore::SubresourceLoader::willSendRequestInternal):
2920         (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl):
2921
2922 2017-12-08  David Quesada  <david_quesada@apple.com>
2923
2924         ApplicationManifestParser should strip whitespace from the raw input
2925         https://bugs.webkit.org/show_bug.cgi?id=180539
2926         rdar://problem/35915075
2927
2928         Reviewed by Joseph Pecoraro.
2929
2930         * Modules/applicationmanifest/ApplicationManifestParser.cpp:
2931         (WebCore::ApplicationManifestParser::parseManifest):
2932
2933 2017-12-08  Eric Carlson  <eric.carlson@apple.com>
2934
2935         Move Logger from PAL to WTF so it can be used outside of WebCore
2936         https://bugs.webkit.org/show_bug.cgi?id=180561
2937
2938         Reviewed by Alex Christensen.
2939
2940         No new tests, existing API test updated.
2941
2942         * Modules/mediastream/PeerConnectionBackend.h:
2943         * Modules/mediastream/RTCPeerConnection.h:
2944         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
2945         (PAL::LogArgument<webrtc::RTCStats>::toString): Deleted.
2946         * dom/Document.cpp:
2947         * dom/Document.h:
2948         * html/HTMLMediaElement.cpp:
2949         (PAL::LogArgument<WebCore::URL>::toString): Deleted.
2950         * html/HTMLMediaElement.h:
2951         * html/HTMLMediaElementEnums.h:
2952         (PAL::LogArgument<WebCore::HTMLMediaElementEnums::ReadyState>::toString): Deleted.
2953         (PAL::LogArgument<WebCore::HTMLMediaElementEnums::NetworkState>::toString): Deleted.
2954         * html/MediaElementSession.cpp:
2955         (WebCore::MediaElementSession::logger const):
2956         * html/MediaElementSession.h:
2957         * html/track/DataCue.h:
2958         (PAL::LogArgument<WebCore::DataCue>::toString): Deleted.
2959         * html/track/TextTrackCue.h:
2960         (PAL::LogArgument<WebCore::TextTrackCue>::toString): Deleted.
2961         * html/track/TextTrackCueGeneric.h:
2962         (PAL::LogArgument<WebCore::TextTrackCueGeneric>::toString): Deleted.
2963         * html/track/TrackBase.cpp:
2964         (WebCore::nullLogger):
2965         (WebCore::TrackBase::TrackBase):
2966         * html/track/TrackBase.h:
2967         * html/track/VTTCue.h:
2968         (PAL::LogArgument<WebCore::VTTCue>::toString): Deleted.
2969         * platform/graphics/InbandTextTrackPrivate.h:
2970         * platform/graphics/InbandTextTrackPrivateClient.h:
2971         (PAL::LogArgument<WebCore::GenericCueData>::toString): Deleted.
2972         * platform/graphics/MediaPlayer.cpp:
2973         (WebCore::nullLogger):
2974         (WebCore::MediaPlayer::mediaPlayerLogger):
2975         * platform/graphics/MediaPlayer.h:
2976         (WTF::LogArgument<MediaTime>::toString):
2977         (PAL::LogArgument<WTF::MediaTime>::toString): Deleted.
2978         * platform/graphics/MediaPlayerEnums.h:
2979         (PAL::LogArgument<WebCore::MediaPlayerEnums::ReadyState>::toString): Deleted.
2980         (PAL::LogArgument<WebCore::MediaPlayerEnums::NetworkState>::toString): Deleted.
2981         * platform/graphics/TrackPrivateBase.cpp:
2982         (WebCore::TrackPrivateBase::setLogger):
2983         * platform/graphics/TrackPrivateBase.h:
2984         * platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm:
2985         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
2986         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
2987         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2988         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
2989         * platform/mediastream/RTCIceConnectionState.h:
2990         (PAL::LogArgument<WebCore::RTCIceConnectionState>::toString): Deleted.
2991         * platform/mediastream/RTCIceGatheringState.h:
2992         (PAL::LogArgument<WebCore::RTCIceGatheringState>::toString): Deleted.
2993         * platform/mediastream/RTCPeerConnectionState.h:
2994         (PAL::LogArgument<WebCore::RTCPeerConnectionState>::toString): Deleted.
2995         * platform/mediastream/RTCSignalingState.h:
2996         (PAL::LogArgument<WebCore::RTCSignalingState>::toString): Deleted.
2997         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
2998
2999 2017-12-08  Yusuke Suzuki  <utatane.tea@gmail.com>
3000
3001         Remove pthread_once in favor of dispatch_once
3002         https://bugs.webkit.org/show_bug.cgi?id=180591
3003
3004         Reviewed by Saam Barati.
3005
3006         No behavior change.
3007
3008         * platform/mac/WebCoreNSURLExtras.mm:
3009         (WebCore::allCharactersInIDNScriptWhiteList):
3010         (WebCore::readIDNScriptWhiteList): Deleted.
3011
3012 2017-12-08  Chris Dumez  <cdumez@apple.com>
3013
3014         Improve error handling in RegistrationDatabase
3015         https://bugs.webkit.org/show_bug.cgi?id=180587
3016
3017         Reviewed by Brady Eidson.
3018
3019         * workers/service/server/RegistrationDatabase.cpp:
3020         (WebCore::RegistrationDatabase::openSQLiteDatabase):
3021         (WebCore::RegistrationDatabase::doPushChanges):
3022
3023 2017-12-07  Darin Adler  <darin@apple.com>
3024
3025         Simplify and streamline some Color-related code to prepare for some Color/ExtendedColor work
3026         https://bugs.webkit.org/show_bug.cgi?id=180569
3027
3028         Reviewed by Sam Weinig.
3029
3030         * accessibility/AccessibilityNodeObject.cpp:
3031         (WebCore::AccessibilityNodeObject::colorValue const): Use valueAsColor instead of
3032         having custom code here to parse the color string.
3033
3034         * css/CSSGradientValue.cpp:
3035         (WebCore::interpolate): Deleted.
3036         (WebCore::CSSGradientValue::computeStops): Call blend instead of interpolate. The only
3037         difference is that the interpolate function truncated when converting from floating point
3038         to integer, and the blend function rounds instead.
3039
3040         * css/StyleResolver.cpp:
3041         (WebCore::StyleResolver::colorFromPrimitiveValue const): Removed unneeded special case
3042         for identifier of 0, since StyleColor::colorFromKeyword already handles that correctly.
3043         Also got rid of unneded local variable "state".
3044
3045         * html/ColorInputType.cpp:
3046         (WebCore::isValidSimpleColor): Rewrote to take a StringView instead of a String and
3047         to stay with a single loop since this does not need the extra efficiency of a separate
3048         8-bit and 16-bit character version. Renamed to more closely match what the specification
3049         calls this algorithm.
3050         (WebCore::parseSimpleColorValue): Added. To be used instead of relying on the behavior of
3051         the Color constructor that takes a String, so we can remove that later.
3052         (WebCore::ColorInputType::sanitizeValue const): Updated for name change.
3053         (WebCore::ColorInputType::valueAsColor const): Use parseSimpleColorValue instead of the
3054         Color constructor that takes a string.
3055         (WebCore::ColorInputType::typeMismatchFor const): Updated for name change.
3056         (WebCore::ColorInputType::selectColor): Updated to take a StringView instead of a Color.
3057         Note that this function is used for testing only.
3058
3059         * html/ColorInputType.h: Marked everything final instead of override. Updated the
3060         selectColor function to take a StringView instead of a Color.
3061
3062         * html/HTMLInputElement.cpp:
3063         (WebCore::HTMLInputElement::selectColor): Take a StringView instead of a Color.
3064         * html/HTMLInputElement.h: Ditto.
3065
3066         * html/InputType.cpp:
3067         (WebCore::InputType::selectColor): Take a StringView instead of a Color.
3068         * html/InputType.h: Ditto.
3069
3070         * testing/Internals.cpp:
3071         (WebCore::Internals::selectColorInColorChooser): Pass the string directly instead of
3072         constructing a Color with it.
3073         (WebCore::Internals::setViewBaseBackgroundColor): Instead of pasring the passed in string
3074         with the Color constructor, implemented the two names that are actually used with this
3075         function in tests: "transparent" and "white".
3076
3077 2017-12-08  Konstantin Tokarev  <annulen@yandex.ru>
3078
3079         Unreviewed, fix wrong letter case in #import HTMLIframeElement.h
3080
3081         * editing/cocoa/WebContentReaderCocoa.mm:
3082
3083 2017-12-07  Yusuke Suzuki  <utatane.tea@gmail.com>
3084
3085         Use WTF::RecursiveLockAdapter instead of using pthread_mutex_t with recursive lock option
3086         https://bugs.webkit.org/show_bug.cgi?id=180449
3087
3088         Reviewed by Mark Lam.
3089
3090         Use WTF::RecursiveLockAdapter<StaticLock> instead. We can remove pthread_mutex_xxx,
3091         pthread_once and FontLocker wrapper.
3092
3093         * platform/graphics/FontCache.cpp:
3094         (WebCore::FontCache::getCachedFontPlatformData):
3095         (WebCore::FontCache::fontForPlatformData):
3096         (WebCore::FontCache::purgeInactiveFontData):
3097         (WebCore::FontCache::inactiveFontCount):
3098         (initFontCacheLockOnce): Deleted.
3099         (FontLocker::FontLocker): Deleted.
3100         (FontLocker::~FontLocker): Deleted.
3101
3102 2017-12-07  Eric Carlson  <eric.carlson@apple.com>
3103
3104         Simplify log channel configuration UI
3105         https://bugs.webkit.org/show_bug.cgi?id=180527
3106         <rdar://problem/35908382>
3107
3108         Reviewed by Joseph Pecoraro.
3109
3110         No new tests, updated existing test.
3111
3112         * inspector/agents/WebConsoleAgent.cpp:
3113         (WebCore::WebConsoleAgent::getLoggingChannels):
3114         (WebCore::channelConfigurationForString):
3115
3116 2017-12-07  Yusuke Suzuki  <utatane.tea@gmail.com>
3117
3118         Use StaticLock instead of NeverDestroyed<Lock>
3119         https://bugs.webkit.org/show_bug.cgi?id=180507
3120
3121         Reviewed by Saam Barati.
3122
3123         StaticLock can be used instead of using NeverDestroyed<Lock>.
3124
3125         No behavior change.
3126
3127         * Modules/webdatabase/Database.cpp:
3128         (WebCore::Database::performOpenAndVerify):
3129         * Modules/webdatabase/DatabaseTracker.cpp:
3130         (WebCore::DatabaseTracker::openDatabaseMutex):
3131         (WebCore::DatabaseTracker::emptyDatabaseFilesRemovalTaskWillBeScheduled):
3132         (WebCore::DatabaseTracker::emptyDatabaseFilesRemovalTaskDidFinish):
3133         (WebCore::DatabaseTracker::scheduleNotifyDatabaseChanged):
3134         (WebCore::DatabaseTracker::scheduleForNotification):
3135         (WebCore::DatabaseTracker::notifyDatabasesChanged):
3136         (WebCore::notificationMutex): Deleted.
3137         * Modules/webdatabase/DatabaseTracker.h:
3138         * platform/URL.cpp:
3139         (WebCore::registerDefaultPortForProtocolForTesting):
3140         (WebCore::clearDefaultPortForProtocolMapForTesting):
3141         (WebCore::defaultPortForProtocol):
3142         (WebCore::defaultPortForProtocolMapForTestingLock): Deleted.
3143         * platform/graphics/MediaPlayer.cpp:
3144         (WebCore::buildMediaEnginesVector):
3145         (WebCore::installedMediaEngines):
3146         (WebCore::MediaPlayer::resetMediaEngines):
3147         (WebCore::mediaEngineVectorLock): Deleted.
3148         * platform/ios/QuickLook.mm:
3149         (WebCore::removeQLPreviewConverterForURL):
3150         (WebCore::addQLPreviewConverterWithFileForURL):
3151         (WebCore::qlPreviewConverterDictionaryMutex): Deleted.
3152         * platform/ios/WebSQLiteDatabaseTrackerClient.mm:
3153         (+[WebDatabaseTransactionBackgroundTaskController startBackgroundTask]):
3154         (+[WebDatabaseTransactionBackgroundTaskController endBackgroundTask]):
3155         (transactionBackgroundTaskIdentifierLock): Deleted.
3156         * platform/network/curl/CurlContext.cpp:
3157         (WebCore::CurlShareHandle::lockCallback):
3158         (WebCore::CurlShareHandle::unlockCallback):
3159         (WebCore::CurlShareHandle::mutexFor):
3160         * platform/network/curl/CurlContext.h:
3161
3162 2017-12-07  Brady Eidson  <beidson@apple.com>
3163
3164         Read registrations in from disk.
3165         https://bugs.webkit.org/show_bug.cgi?id=180543
3166
3167         Reviewed by Andy Estes.
3168
3169         No new tests (Not testable quite yet)
3170
3171         On launch, read through the database.
3172
3173         Set up enough objects in the SWServer necessary to cause fetches and postMessages to
3174         go to a worker that has never run before.
3175
3176         * workers/service/ServiceWorkerContextData.cpp:
3177         (WebCore::ServiceWorkerContextData::isolatedCopy const):
3178         * workers/service/ServiceWorkerContextData.h:
3179         (WebCore::ServiceWorkerContextData::encode const):
3180         (WebCore::ServiceWorkerContextData::decode):
3181
3182         * workers/service/ServiceWorkerRegistrationKey.cpp:
3183         (WebCore::ServiceWorkerRegistrationKey::toDatabaseKey const):
3184         (WebCore::ServiceWorkerRegistrationKey::fromDatabaseKey):
3185         * workers/service/ServiceWorkerRegistrationKey.h:
3186
3187         * workers/service/server/RegistrationDatabase.cpp:
3188         (WebCore::stringToUpdateViaCache):
3189         (WebCore::stringToWorkerType):
3190         (WebCore::RegistrationDatabase::doPushChanges):
3191         (WebCore::RegistrationDatabase::importRecords):
3192         (WebCore::RegistrationDatabase::addRegistrationToStore):
3193         * workers/service/server/RegistrationDatabase.h:
3194
3195         * workers/service/server/RegistrationStore.cpp:
3196         (WebCore::RegistrationStore::RegistrationStore):
3197         (WebCore::RegistrationStore::addRegistrationFromDatabase):
3198         * workers/service/server/RegistrationStore.h:
3199
3200         * workers/service/server/SWServer.cpp:
3201         (WebCore::SWServer::addRegistrationFromStore):
3202         (WebCore::SWServer::SWServer):
3203         (WebCore::SWServer::updateWorker):
3204         (WebCore::SWServer::tryInstallContextData):
3205         (WebCore::SWServer::installContextData):
3206         (WebCore::generateServiceWorkerIdentifier): Deleted.
3207         * workers/service/server/SWServer.h:
3208
3209         * workers/service/server/SWServerRegistration.h:
3210
3211         * workers/service/server/SWServerWorker.cpp:
3212         (WebCore::SWServerWorker::contextData const):
3213
3214 2017-12-07  Yusuke Suzuki  <utatane.tea@gmail.com>
3215
3216         Use WTF Locking primitives in WebThread and drop pthread_xxx use
3217         https://bugs.webkit.org/show_bug.cgi?id=180445
3218
3219         Reviewed by Saam Barati.
3220
3221         We remove use of pthread locking primitives from WebThread implementation,
3222         and use WTF Lock and Condition instead.
3223
3224         No behavior change.
3225
3226         * platform/ios/wak/WebCoreThread.mm:
3227         (HandleDelegateSource):
3228         (SendDelegateMessage):
3229         (WebThreadRunOnMainThread):
3230         (WebThreadAdoptAndRelease):
3231         (WebCoreObjCDeallocOnWebThreadImpl):
3232         (WebCoreObjCDeallocWithWebThreadLockImpl):
3233         (HandleWebThreadReleaseSource):
3234         (_WebThreadAutoLock):
3235         (WebRunLoopLockInternal):
3236         (CurrentThreadContext):
3237         Use WTF::ThreadSpecific.
3238
3239         (StartWebThread):
3240         (_WebThreadLock):
3241         Remove `shouldTry` parameter since it is always `false`. We clean up code based on `shouldTry = false`,
3242         and rename it from _WebTryThreadLock to _WebThreadLock since it does not try now.
3243
3244         (_WebThreadLockFromAnyThread):
3245         (WebThreadUnlockFromAnyThread):
3246         (_WebThreadUnlock):
3247         (lockWebCoreReleaseLock): Deleted.
3248         (unlockWebCoreReleaseLock): Deleted.
3249         (WebTimedConditionLock): Deleted.
3250         (_WebTryThreadLock): Deleted.
3251
3252 2017-12-07  Alex Christensen  <achristensen@webkit.org>
3253
3254         Fix API test after r225645.
3255         https://bugs.webkit.org/show_bug.cgi?id=180544
3256
3257         * loader/FrameLoader.cpp:
3258         (WebCore::FrameLoader::loadURL):
3259         (WebCore::FrameLoader::loadWithDocumentLoader):
3260         The API test WebKitLegacy.FragmentNavigation started failing after r225645.
3261         It does call the completion handler with ignore to cancel fragment navigation.
3262         To make this work and increase compatibility, only synchronously continue with
3263         fragment navigations if we haven't received a synchronous answer to the
3264         decidePolicyForNavigationAction callback.
3265
3266 2017-12-07  Oleksandr Skachkov  <gskachkov@gmail.com>
3267
3268         WebAssembly: sending module to iframe fails
3269         https://bugs.webkit.org/show_bug.cgi?id=179263
3270
3271         Reviewed by JF Bastien.
3272
3273         Allow use WebAssembly.Module as input parameters for postMessage 
3274         in window and iframe object.
3275
3276         Tests: wasm/iframe-postmessage.html
3277                wasm/window-postmessage.html
3278
3279         * bindings/js/SerializedScriptValue.cpp:
3280         (WebCore::CloneSerializer::dumpIfTerminal):
3281         * bindings/js/SerializedScriptValue.h:
3282         * page/DOMWindow.cpp:
3283         (WebCore::DOMWindow::postMessage):
3284
3285 2017-12-07  Joseph Pecoraro  <pecoraro@apple.com>
3286
3287         Web Inspector: Fix style in remote inspector classes
3288         https://bugs.webkit.org/show_bug.cgi?id=180545
3289
3290         Reviewed by Youenn Fablet.
3291
3292         * page/PageDebuggable.h:
3293         * workers/service/context/ServiceWorkerDebuggable.h:
3294
3295 2017-12-07  Antti Koivisto  <antti@apple.com>
3296
3297         Move security origin filtering for getMatchedCSSRules out of StyleResolver
3298         https://bugs.webkit.org/show_bug.cgi?id=180468
3299
3300         Reviewed by Zalan Bujtas.
3301
3302         The non-standard getMatchedCSSRules API should not return rules from stylesheets in different security origins.
3303         To implement this we currently have lots of invasive code in StyleResolver, RuleSets and ElementRuleCollector
3304         basically passing around a bit. This also makes RuleSets document specific blocking optimizations.
3305
3306         This patches replaces the mechanism with a bit in StyleRule which is much simpler.
3307
3308         * css/DocumentRuleSets.cpp:
3309         (WebCore::makeRuleSet):
3310         * css/ElementRuleCollector.cpp:
3311         (WebCore::ElementRuleCollector::collectMatchingRulesForList):
3312         * css/ElementRuleCollector.h:
3313         (WebCore::ElementRuleCollector::setPseudoStyleRequest):
3314         (WebCore::ElementRuleCollector::setSameOriginOnly): Deleted.
3315         * css/RuleFeature.cpp:
3316         (WebCore::RuleFeatureSet::collectFeatures):
3317         * css/RuleFeature.h:
3318         (WebCore::RuleFeature::RuleFeature):
3319         * css/RuleSet.cpp:
3320         (WebCore::RuleData::RuleData):
3321         (WebCore::RuleSet::addRule):
3322         (WebCore::RuleSet::addChildRules):
3323         (WebCore::RuleSet::addRulesFromSheet):
3324         (WebCore::RuleSet::addStyleRule):
3325         * css/RuleSet.h:
3326         (WebCore::RuleData::linkMatchType const):
3327         (WebCore::RuleData::hasDocumentSecurityOrigin const): Deleted.
3328         * css/StyleResolver.cpp:
3329         (WebCore::StyleResolver::pseudoStyleRulesForElement):
3330         * css/StyleResolver.h:
3331         * css/StyleRule.cpp:
3332         (WebCore::StyleRule::StyleRule):
3333         (WebCore::StyleRule::createForSplitting):
3334         (WebCore::StyleRule::splitIntoMultipleRulesWithMaximumSelectorComponentCount const):
3335         (WebCore::StyleRule::create): Deleted.
3336         * css/StyleRule.h:
3337         (WebCore::StyleRuleBase::StyleRuleBase):
3338         (WebCore::StyleRuleBase::hasDocumentSecurityOrigin const):
3339
3340             Add a bit.
3341
3342         * css/parser/CSSParser.cpp:
3343         (WebCore::CSSParserContext::CSSParserContext):
3344
3345             Include hasDocumentSecurityOrigin bit to parser context. This means that a stylesheet data structures
3346             can't be shared between a contexts where this differs. This likely very rare in practice.
3347
3348         (WebCore::operator==):
3349         * css/parser/CSSParserImpl.cpp:
3350         (WebCore::CSSParserImpl::consumeStyleRule):
3351         * css/parser/CSSParserMode.h:
3352         (WebCore::CSSParserContextHash::hash):
3353         * editing/EditingStyle.cpp:
3354         (WebCore::EditingStyle::mergeStyleFromRules):
3355         * page/DOMWindow.cpp:
3356         (WebCore::DOMWindow::getMatchedCSSRules const):
3357
3358             Filter out rules from different security origin after getting them from style resolver.
3359
3360 2017-12-07  Zalan Bujtas  <zalan@apple.com>
3361
3362         AX: Document::existingAXObjectCache() should always return the existing AXObjectCache.
3363         https://bugs.webkit.org/show_bug.cgi?id=180548
3364         <rdar://problem/35917755>
3365
3366         Reviewed by Chris Fleizach.
3367
3368         Currently the AX cache becomes unreachable through Document::existingAXObjectCache soon after the render tree is destroyed.
3369         From this point, the Node objects can't deregister themselves from the AX cache anymore. In some cases, it's
3370         redundant/not advised to notify the cache about certain changes when the document is being destroyed, but the
3371         callsites should make that decision.
3372
3373         Covered by existing tests.
3374
3375         * dom/Document.cpp:
3376         (WebCore::Document::existingAXObjectCacheSlow const):
3377         * rendering/RenderElement.cpp:
3378         (WebCore::RenderElement::takeChildInternal):
3379
3380 2017-12-07  Youenn Fablet  <youenn@apple.com>
3381
3382         Fix erroneous ASSERT in DocumentThreadableLoader::didFail
3383         https://bugs.webkit.org/show_bug.cgi?id=180549
3384
3385         Reviewed by Alex Christensen.
3386
3387         * loader/DocumentThreadableLoader.cpp:
3388         (WebCore::DocumentThreadableLoader::didFail): ASSERT was checking whether the optional was null.
3389         This could never be the case since we move the value of the optional, not the optional itself.
3390         Ensure that the optional value is null so that we are sure request is being loaded and make the optional null just after that.
3391
3392 2017-12-07  Ryosuke Niwa  <rniwa@webkit.org>
3393
3394         iOS: Many AMP pages crash inside Document::updateStyleIfNeeded
3395         https://bugs.webkit.org/show_bug.cgi?id=180550
3396         <rdar://problem/35410390>
3397
3398         Reviewed by Zalan Bujtas.
3399
3400         The crash was caused when updatign the layout of an non-flattened frame inside a flattened frame.
3401         In those cases, isInChildFrameWithFrameFlattening is false on the inner frame.
3402
3403         No new tests for now.
3404
3405         * dom/NoEventDispatchAssertion.h:
3406         * rendering/RenderFrameBase.cpp:
3407         (WebCore::RenderFrameBase::performLayoutWithFlattening): Disable the assertion temporarily here.
3408         In theory, we should be able to remove the check for isInChildFrameWithFrameFlattening but we err
3409         on the safer side for now.
3410
3411 2017-12-07  Alex Christensen  <achristensen@webkit.org>
3412
3413         Always synchronously continue with fragment navigations
3414         https://bugs.webkit.org/show_bug.cgi?id=180544
3415         <rdar://problem/34815986> and <rdar://problem/35126690>
3416
3417         Reviewed by Geoffrey Garen.
3418
3419         Test: http/tests/dom/document-fragment.html
3420
3421         When a decidePolicyForNavigationAction completionHandler is called asynchronously,
3422         the document's URL has not changed yet when JavaScript execution continues.  This causes
3423         significant web incompatibility because all browsers change the document's URL immediately
3424         during fragment navigations.  In order to make WebKit applications more web compatible,
3425         we now immediately continue to have the state consistent.  To keep compatibility with any
3426         WebView, UIWebView, or WKWebView applications that use these delegate callbacks to update
3427         state, we still call decidePolicyForNavigationAction.  This would break a theoretical app
3428         that would cancel fragment navigations, but it fixes apps that continue fragment navigations
3429         asynchronously.
3430
3431         * loader/FrameLoader.cpp:
3432         (WebCore::FrameLoader::loadURL):
3433         (WebCore::FrameLoader::loadWithDocumentLoader):
3434
3435 2017-12-07  Youenn Fablet  <youenn@apple.com>
3436