Ensure that style is updated when the effective appearance changes
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-03-16  Megan Gardner  <megan_gardner@apple.com>
2
3         Ensure that style is updated when the effective appearance changes
4         https://bugs.webkit.org/show_bug.cgi?id=183690
5         <rdar://problem/38385900>
6
7         Reviewed by Tim Horton and Wenson Hsieh.
8
9         Only exposing a function to outside WebCore, no tests needed.
10
11         * page/Page.h:
12
13 2018-03-16  Chris Dumez  <cdumez@apple.com>
14
15         WebKit.RestoreSessionStateContainingScrollRestorationDefault API test is failing with async policy delegates
16         https://bugs.webkit.org/show_bug.cgi?id=183679
17
18         Reviewed by Alex Christensen.
19
20         Update CachedRawResource::didAddClient() to not send data until we've received
21         the policy decision for the response.
22
23         No new tests, covered by new API test.
24
25         * loader/DocumentLoader.cpp:
26         (WebCore::DocumentLoader::handleSubstituteDataLoadNow):
27         (WebCore::DocumentLoader::responseReceived):
28         * loader/DocumentLoader.h:
29         * loader/DocumentThreadableLoader.cpp:
30         (WebCore::DocumentThreadableLoader::responseReceived):
31         * loader/DocumentThreadableLoader.h:
32         * loader/MediaResourceLoader.cpp:
33         (WebCore::MediaResource::responseReceived):
34         * loader/MediaResourceLoader.h:
35         * loader/appcache/ApplicationCacheResourceLoader.cpp:
36         (WebCore::ApplicationCacheResourceLoader::responseReceived):
37         * loader/appcache/ApplicationCacheResourceLoader.h:
38         * loader/cache/CachedRawResource.cpp:
39         (WebCore::CachedRawResource::didAddClient):
40         (WebCore::CachedRawResource::responseReceived):
41         * loader/cache/CachedRawResourceClient.h:
42         (WebCore::CachedRawResourceClient::responseReceived):
43         * loader/cache/KeepaliveRequestTracker.cpp:
44         (WebCore::KeepaliveRequestTracker::responseReceived):
45         * loader/cache/KeepaliveRequestTracker.h:
46         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h:
47         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
48         (WebCore::WebCoreAVFResourceLoader::responseReceived):
49
50 2018-03-16  Youenn Fablet  <youenn@apple.com>
51
52         Name Service Worker threads differently from regular Worker threads
53         https://bugs.webkit.org/show_bug.cgi?id=183698
54
55         Reviewed by Chris Dumez.
56
57         No observable change of behavior.
58         For debugging purposes, knowing that a thread is a service worker thread might help give context.
59         It might also identify on a crash log whether the process is a service worker process or a regular web process.
60
61         * workers/WorkerThread.cpp:
62         (WebCore::WorkerThread::start):
63         * workers/WorkerThread.h:
64         (WebCore::WorkerThread::isServiceWorkerThread const):
65         * workers/service/context/ServiceWorkerThread.h:
66
67 2018-03-16  Youenn Fablet  <youenn@apple.com>
68
69         IceCandidates leak on webrtc/datachannel/basic.html and other tests
70         https://bugs.webkit.org/show_bug.cgi?id=183676
71         <rdar://problem/36116228>
72
73         Reviewed by Eric Carlson.
74
75         Covered by manual testing using --leaks option on WK1.
76         WebKit should not release the candidates since libwebrtc is not taking ownership.
77
78         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
79         (WebCore::LibWebRTCPeerConnectionBackend::doSetLocalDescription):
80         (WebCore::LibWebRTCPeerConnectionBackend::doSetRemoteDescription):
81
82 2018-03-16  Zan Dobersek  <zdobersek@igalia.com>
83
84         [Nicosia] Add Cairo-specific GraphicsContext operation recorder
85         https://bugs.webkit.org/show_bug.cgi?id=183593
86
87         Reviewed by Carlos Garcia Campos.
88
89         Add Nicosia::CairoOperationRecorder, GraphicsContextImpl implementation
90         that records all GraphicsContext operations for deferred replay on a
91         different thread. Recording here mostly consists of storing all the
92         Cairo resources in a thread-safe manner, which is eased by the atomic
93         reference counting used in Cairo.
94
95         Nicosia::PaintingOperation derivatives are used for operations or state
96         updates that require recording. Instances of these classes are appended
97         to a Vector<> object that is then pushed into a thread pool in
98         Nicosia::PaintingEngineThreaded , replaying all the operations against
99         the Cairo context established from an associated target Nicosia::Buffer.
100
101         This GraphicsContextImpl implementation is now used in the
102         PaintingContextCairo::ForRecording constructor to construct the
103         GraphicsContext implementation that will be used for recording.
104
105         * platform/TextureMapper.cmake:
106         * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp: Added.
107         (Nicosia::getContext):
108         (Nicosia::OperationData::arg const const):
109         (Nicosia::createCommand):
110         (Nicosia::CairoOperationRecorder::CairoOperationRecorder):
111         (Nicosia::m_commandList):
112         (Nicosia::CairoOperationRecorder::updateState):
113         (Nicosia::CairoOperationRecorder::clearShadow):
114         (Nicosia::CairoOperationRecorder::setLineCap):
115         (Nicosia::CairoOperationRecorder::setLineDash):
116         (Nicosia::CairoOperationRecorder::setLineJoin):
117         (Nicosia::CairoOperationRecorder::setMiterLimit):
118         (Nicosia::CairoOperationRecorder::fillRect):
119         (Nicosia::CairoOperationRecorder::fillRoundedRect):
120         (Nicosia::CairoOperationRecorder::fillRectWithRoundedHole):
121         (Nicosia::CairoOperationRecorder::fillPath):
122         (Nicosia::CairoOperationRecorder::fillEllipse):
123         (Nicosia::CairoOperationRecorder::strokeRect):
124         (Nicosia::CairoOperationRecorder::strokePath):
125         (Nicosia::CairoOperationRecorder::strokeEllipse):
126         (Nicosia::CairoOperationRecorder::clearRect):
127         (Nicosia::CairoOperationRecorder::drawGlyphs):
128         (Nicosia::CairoOperationRecorder::drawImage):
129         (Nicosia::CairoOperationRecorder::drawTiledImage):
130         (Nicosia::CairoOperationRecorder::drawNativeImage):
131         (Nicosia::CairoOperationRecorder::drawPattern):
132         (Nicosia::CairoOperationRecorder::drawRect):
133         (Nicosia::CairoOperationRecorder::drawLine):
134         (Nicosia::CairoOperationRecorder::drawLinesForText):
135         (Nicosia::CairoOperationRecorder::drawLineForDocumentMarker):
136         (Nicosia::CairoOperationRecorder::drawEllipse):
137         (Nicosia::CairoOperationRecorder::drawPath):
138         (Nicosia::CairoOperationRecorder::drawFocusRing):
139         (Nicosia::CairoOperationRecorder::save):
140         (Nicosia::CairoOperationRecorder::restore):
141         (Nicosia::CairoOperationRecorder::translate):
142         (Nicosia::CairoOperationRecorder::rotate):
143         (Nicosia::CairoOperationRecorder::scale):
144         (Nicosia::CairoOperationRecorder::concatCTM):
145         (Nicosia::CairoOperationRecorder::setCTM):
146         (Nicosia::CairoOperationRecorder::getCTM):
147         (Nicosia::CairoOperationRecorder::beginTransparencyLayer):
148         (Nicosia::CairoOperationRecorder::endTransparencyLayer):
149         (Nicosia::CairoOperationRecorder::clip):
150         (Nicosia::CairoOperationRecorder::clipOut):
151         (Nicosia::CairoOperationRecorder::clipPath):
152         (Nicosia::CairoOperationRecorder::clipBounds):
153         (Nicosia::CairoOperationRecorder::applyDeviceScaleFactor):
154         (Nicosia::CairoOperationRecorder::roundToDevicePixels):
155         (Nicosia::CairoOperationRecorder::append):
156         * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h: Added.
157         * platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp:
158         (Nicosia::PaintingContextCairo::ForRecording::ForRecording):
159
160 2018-03-16  Zan Dobersek  <zdobersek@igalia.com>
161
162         [TexMap] Clean up TextureMapperLayer constructor
163         https://bugs.webkit.org/show_bug.cgi?id=183634
164
165         Reviewed by Michael Catanzaro.
166
167         In the TextureMapperLayer header, only declare the constructor, and move
168         all the previous member initialization to the point of declaration of
169         these member variables.
170
171         In the TextureMapperLayer implementation file, the constructor and
172         destructor are moved into proper order at the top of the file. The
173         former is defaulted, and the latter remains unchanged.
174
175         No change in behavior.
176
177         * platform/graphics/texmap/TextureMapperLayer.cpp:
178         (WebCore::TextureMapperLayer::~TextureMapperLayer):
179         * platform/graphics/texmap/TextureMapperLayer.h:
180
181 2018-03-16  Miguel Gomez  <magomez@igalia.com>
182
183         [GTK] When using EGL, request an OpenGL core profile when possible
184         https://bugs.webkit.org/show_bug.cgi?id=178719
185
186         Reviewed by Carlos Garcia Campos.
187
188         When using EGL and OpenGL, try to request a context with version >= 3.2 with a core profile
189         whenever possible. In order to to this, we require EGL version 1.5 or version 1.4 with the
190         extension EGL_KHR_create_context. If EGL requirements are not met, or we cannot get a
191         context with version >= 3.2 then use whatever EGL gives us.
192
193         Covered by existent tests.
194
195         * platform/graphics/egl/GLContextEGL.cpp:
196         (WebCore::GLContextEGL::createWindowContext):
197         (WebCore::GLContextEGL::createPbufferContext):
198         (WebCore::GLContextEGL::createSurfacelessContext):
199         (WebCore::GLContextEGL::createContextForEGLVersion):
200         * platform/graphics/egl/GLContextEGL.h:
201         * platform/graphics/egl/GLContextEGLWPE.cpp:
202         (WebCore::GLContextEGL::createWPEContext):
203         * platform/graphics/egl/GLContextEGLWayland.cpp:
204         (WebCore::GLContextEGL::createWaylandContext):
205         * platform/graphics/egl/GLContextEGLX11.cpp:
206         (WebCore::GLContextEGL::createPixmapContext):
207
208 2018-03-16  Zan Dobersek  <zdobersek@igalia.com>
209
210         [TexMap] Don't use the TextureMapperAnimation::Client interface to apply animation
211         https://bugs.webkit.org/show_bug.cgi?id=183656
212
213         Reviewed by Carlos Garcia Campos.
214
215         Don't have the TextureMapperLayer class inherit from the
216         TextureMapperAnimation::Client interface just for the purposes of
217         synchronization of animation-affected attributes in syncAnimations().
218         For that purpose it's enough to provide a struct that is passed to that
219         method, and with the TextureMapperAnimation class filling out any of the
220         animated attributes that need to be updated.
221
222         TextureMapperAnimation::ApplicationResult struct is introducted for that
223         purpose. std::optional<> members in it are assigned values during the
224         application process, if an appropriate animation affects them. The
225         relevant member values in TextureMapperLayer are then updated, or value
226         from the default state is used.
227
228         TextureMapperAnimation::Client is removed.
229
230         No new tests -- no change in behavior.
231
232         * platform/graphics/texmap/TextureMapperAnimation.cpp:
233         (WebCore::TextureMapperAnimation::apply):
234         (WebCore::TextureMapperAnimation::applyInternal):
235         (WebCore::TextureMapperAnimations::apply):
236         * platform/graphics/texmap/TextureMapperAnimation.h:
237         * platform/graphics/texmap/TextureMapperLayer.cpp:
238         (WebCore::TextureMapperLayer::syncAnimations):
239         (WebCore::TextureMapperLayer::setAnimatedTransform): Deleted.
240         (WebCore::TextureMapperLayer::setAnimatedOpacity): Deleted.
241         (WebCore::TextureMapperLayer::setAnimatedFilters): Deleted.
242         * platform/graphics/texmap/TextureMapperLayer.h:
243
244 2018-03-16  Devin Rousso  <webkit@devinrousso.com>
245
246         Web Inspector: Canvas Tab: main WebGL canvas on acko.net has no reported size
247         https://bugs.webkit.org/show_bug.cgi?id=178798
248         <rdar://problem/35175740>
249
250         Reviewed by Brian Burg.
251
252         When the main frame navigates, the DOMAgent would recieve two InspectorInstrumentation calls,
253         one when the frame begins its navigation and the other when the document for that frame has
254         loaded. Both of these would discard the DOMAgent's bindings, which included the map of
255         `nodeId`s. This was an issue for canvases, as the frontend would be notified whenever any
256         canvas is created, which would usually occur before the `DOMContentLoaded` event is fired.
257         As a result, the canvases would attempt to retrieve their associated node, only to have the
258         DOMAgent discard those bindings quickly thereafter.
259
260         This patch removes DOMAgent's and DOMDebuggerAgent's (parity) instrumentation hooks for the
261         latter event, ensuring that the bindings are only discarded once.
262
263         * inspector/agents/InspectorDOMAgent.h:
264         * inspector/agents/InspectorDOMAgent.cpp:
265         (WebCore::InspectorDOMAgent::mainFrameDOMContentLoaded): Deleted.
266
267         * inspector/agents/InspectorDOMDebuggerAgent.h:
268         * inspector/agents/InspectorDOMDebuggerAgent.cpp:
269         (WebCore::InspectorDOMDebuggerAgent::frameDocumentUpdated): Added.
270         (WebCore::InspectorDOMDebuggerAgent::mainFrameDOMContentLoaded): Deleted.
271
272         * inspector/InspectorInstrumentation.cpp:
273         (WebCore::InspectorInstrumentation::domContentLoadedEventFiredImpl):
274         (WebCore::InspectorInstrumentation::frameDocumentUpdatedImpl):
275
276 2018-03-15  Tim Horton  <timothy_horton@apple.com>
277
278         Include CADisplayLink explicitly where needed, instead of all of CA
279         https://bugs.webkit.org/show_bug.cgi?id=183689
280         <rdar://problem/38528719>
281
282         Reviewed by Wenson Hsieh.
283
284         * platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
285
286 2018-03-15  Tim Horton  <timothy_horton@apple.com>
287
288         Include MobileCoreServices in the WebCore prefix header
289         https://bugs.webkit.org/show_bug.cgi?id=183688
290         <rdar://problem/38527621>
291
292         Reviewed by Dan Bernstein.
293
294         * WebCorePrefix.h:
295
296 2018-03-15  Megan Gardner  <megan_gardner@apple.com>
297
298         Create MediaQueryParserContext to provide additional context for the evaluation of media queries
299         https://bugs.webkit.org/show_bug.cgi?id=183677
300
301         Reviewed by Tim Horton.
302
303         We need additional context for parsing media queries to make sure they are parsed correctly and valid.
304
305         Not currently testable, will add tests in a later patch.
306
307         * WebCore.xcodeproj/project.pbxproj:
308         * css/MediaList.cpp:
309         (WebCore::MediaQuerySet::create):
310         (WebCore::MediaQuerySet::set):
311         (WebCore::MediaQuerySet::add):
312         (WebCore::MediaQuerySet::remove):
313         * css/MediaList.h:
314         * css/MediaQueryEvaluator.cpp:
315         (WebCore::MediaQueryEvaluator::mediaAttributeMatches):
316         * css/MediaQueryExpression.cpp:
317         (WebCore::featureWithValidIdent):
318         (WebCore::featureWithValidDensity):
319         (WebCore::featureWithValidPositiveLength):
320         (WebCore::featureWithPositiveInteger):
321         (WebCore::featureWithPositiveNumber):
322         (WebCore::featureWithZeroOrOne):
323         (WebCore::isFeatureValidWithoutValue):
324         (WebCore::MediaQueryExpression::MediaQueryExpression):
325         * css/MediaQueryExpression.h:
326         * css/MediaQueryMatcher.cpp:
327         (WebCore::MediaQueryMatcher::matchMedia):
328         * css/MediaQueryParserContext.cpp: Added.
329         (WebCore::MediaQueryParserContext::MediaQueryParserContext):
330         * css/MediaQueryParserContext.h: Added.
331         (WebCore::MediaQueryParserContext::MediaQueryParserContext):
332         * css/StyleMedia.cpp:
333         (WebCore::StyleMedia::matchMedium const):
334         * css/StyleRuleImport.cpp:
335         (WebCore::StyleRuleImport::StyleRuleImport):
336         (WebCore::StyleRuleImport::setCSSStyleSheet):
337         * css/parser/CSSParser.cpp:
338         (WebCore::CSSParserContext::CSSParserContext):
339         (WebCore::operator==):
340         * css/parser/CSSParserImpl.cpp:
341         (WebCore::CSSParserImpl::consumeImportRule):
342         (WebCore::CSSParserImpl::consumeMediaRule):
343         * css/parser/MediaQueryParser.cpp:
344         (WebCore::MediaQueryParser::parseMediaQuerySet):
345         (WebCore::MediaQueryParser::parseMediaCondition):
346         (WebCore::MediaQueryParser::MediaQueryParser):
347         (WebCore::MediaQueryData::addExpression):
348         * css/parser/MediaQueryParser.h:
349         (WebCore::MediaQueryData::setMediaQueryParserContext):
350         * css/parser/SizesAttributeParser.cpp:
351         (WebCore::SizesAttributeParser::parse):
352         * dom/DOMImplementation.cpp:
353         (WebCore::DOMImplementation::createCSSStyleSheet):
354         * dom/InlineStyleSheetOwner.cpp:
355         (WebCore::InlineStyleSheetOwner::createSheet):
356         * dom/ProcessingInstruction.cpp:
357         (WebCore::ProcessingInstruction::setCSSStyleSheet):
358         * html/HTMLImageElement.cpp:
359         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
360         * html/HTMLLinkElement.cpp:
361         (WebCore::HTMLLinkElement::process):
362         (WebCore::HTMLLinkElement::initializeStyleSheet):
363         (WebCore::HTMLLinkElement::setCSSStyleSheet):
364         * html/HTMLLinkElement.h:
365         * html/HTMLMediaElement.cpp:
366         (WebCore::HTMLMediaElement::selectNextSourceChild):
367         * html/HTMLSourceElement.cpp:
368         (WebCore::HTMLSourceElement::parsedMediaAttribute const):
369         * html/HTMLSourceElement.h:
370         * html/HTMLStyleElement.cpp:
371         (WebCore::HTMLStyleElement::parseAttribute):
372         * html/parser/HTMLPreloadScanner.cpp:
373         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
374
375 2018-03-15  Commit Queue  <commit-queue@webkit.org>
376
377         Unreviewed, rolling out r229639.
378         https://bugs.webkit.org/show_bug.cgi?id=183683
379
380         it is causing a crash in API tests (Requested by youenn on
381         #webkit).
382
383         Reverted changeset:
384
385         "ActiveDOMObject should assert that they are destroyed in the
386         thread they are created"
387         https://bugs.webkit.org/show_bug.cgi?id=183671
388         https://trac.webkit.org/changeset/229639
389
390 2018-03-15  Youenn Fablet  <youenn@apple.com>
391
392         Bad configuration parameters should make RTCPeerConnection constructor throw
393         https://bugs.webkit.org/show_bug.cgi?id=183615
394
395         Reviewed by Eric Carlson.
396
397         Implement more of https://w3c.github.io/webrtc-pc/#set-pc-configuration.
398         Throw an error whenever underlying libwebrtc set configuration fails.
399
400         Covered by rebased test.
401
402         * Modules/mediastream/PeerConnectionBackend.h:
403         * Modules/mediastream/RTCPeerConnection.cpp:
404         (WebCore::iceServersFromConfiguration):
405         (WebCore::RTCPeerConnection::initializeConfiguration):
406         (WebCore::RTCPeerConnection::setConfiguration):
407         * Modules/mediastream/RTCPeerConnection.js:
408         (initializeRTCPeerConnection):
409         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
410
411 2018-03-15  Youenn Fablet  <youenn@apple.com>
412
413         replaceTrack triggers negotiationneeded
414         https://bugs.webkit.org/show_bug.cgi?id=180342
415         <rdar://problem/35822426>
416
417         Reviewed by Eric Carlson.
418
419         Covered by updated test.
420         Fix the case of replacing a track for which data is already flowing.
421         We should probably do the same for null tracks when fully implementing transceivers.
422
423         * Modules/mediastream/RTCPeerConnection.cpp:
424         (WebCore::RTCPeerConnection::enqueueReplaceTrackTask):
425
426 2018-03-15  Keith Rollin  <krollin@apple.com>
427
428         Telemetry for stalled webpage loads
429         https://bugs.webkit.org/show_bug.cgi?id=183221
430         <rdar://problem/36549013>
431
432         Reviewed by Chris Dumez.
433
434         Add telemetry for page loads, tracking the pages that succeed, fail,
435         or are canceled. This information will be used to track the overall
436         health of our page loading as time goes on.
437
438         No new tests -- no new/changed user-level functionality.
439
440         * page/DiagnosticLoggingKeys.cpp:
441         (WebCore::DiagnosticLoggingKeys::telemetryPageLoadKey):
442         (WebCore::DiagnosticLoggingKeys::timedOutKey):
443         (WebCore::DiagnosticLoggingKeys::canceledLessThan2SecondsKey):
444         (WebCore::DiagnosticLoggingKeys::canceledLessThan5SecondsKey):
445         (WebCore::DiagnosticLoggingKeys::canceledLessThan20SecondsKey):
446         (WebCore::DiagnosticLoggingKeys::canceledMoreThan20SecondsKey):
447         (WebCore::DiagnosticLoggingKeys::failedLessThan2SecondsKey):
448         (WebCore::DiagnosticLoggingKeys::failedLessThan5SecondsKey):
449         (WebCore::DiagnosticLoggingKeys::failedLessThan20SecondsKey):
450         (WebCore::DiagnosticLoggingKeys::failedMoreThan20SecondsKey):
451         (WebCore::DiagnosticLoggingKeys::occurredKey):
452         (WebCore::DiagnosticLoggingKeys::succeededLessThan2SecondsKey):
453         (WebCore::DiagnosticLoggingKeys::succeededLessThan5SecondsKey):
454         (WebCore::DiagnosticLoggingKeys::succeededLessThan20SecondsKey):
455         (WebCore::DiagnosticLoggingKeys::succeededMoreThan20SecondsKey):
456         * page/DiagnosticLoggingKeys.h:
457         * platform/network/cf/ResourceError.h:
458         (WebCore::ResourceError::ResourceError):
459         * platform/network/mac/ResourceErrorMac.mm:
460         (WebCore::ResourceError::ResourceError):
461         (WebCore::ResourceError::getNSURLErrorDomain const):
462         (WebCore::ResourceError::getCFErrorDomainCFNetwork const):
463         (WebCore::ResourceError::mapPlatformError):
464
465 2018-03-15  Youenn Fablet  <youenn@apple.com>
466
467         ActiveDOMObject should assert that they are destroyed in the thread they are created
468         https://bugs.webkit.org/show_bug.cgi?id=183671
469
470         Reviewed by Chris Dumez.
471
472         No change of behavior.
473         Moved MessagePort assertion to ActiveDOMObject.
474
475         * dom/ActiveDOMObject.cpp:
476         (WebCore::ActiveDOMObject::~ActiveDOMObject):
477         * dom/ActiveDOMObject.h:
478         * dom/MessagePort.cpp:
479         (WebCore::MessagePort::~MessagePort):
480         * dom/MessagePort.h:
481
482 2018-03-15  Youenn Fablet  <youenn@apple.com>
483
484         MessagePort is not always destroyed on the right thread
485         https://bugs.webkit.org/show_bug.cgi?id=183619
486         <rdar://problem/38204711>
487
488         Reviewed by Chris Dumez.
489
490         Add assertion to ensure MessagePort is destroyed in the right thread.
491         Modify methods taking a ref in a lambda to rely on weak pointers and refing the WorkerThread if in a worker context.
492         It is safe to ref the WorkerThread since it is thread safe ref counted and we are passing the ref to the main thread
493         where the WorkerThread is expected to be destroyed.
494
495         Test: http/tests/workers/worker-messageport-2.html
496
497         * dom/MessagePort.cpp:
498         (WebCore::MessagePort::~MessagePort):
499         (WebCore::MessagePort::dispatchMessages):
500         (WebCore::MessagePort::updateActivity):
501         (WebCore::MessagePort::hasPendingActivity const):
502         * dom/MessagePort.h:
503
504 2018-03-15  Jer Noble  <jer.noble@apple.com>
505
506         Adopt new AVURLAssetUseClientURLLoadingExclusively AVURLAsset creation option.
507         https://bugs.webkit.org/show_bug.cgi?id=183660
508
509         Reviewed by Jon Lee.
510
511         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
512         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
513
514 2018-03-15  Chris Dumez  <cdumez@apple.com>
515
516         Unreviewed, fix tiny mistake in r229615 that caused API tests failures.
517
518         * workers/service/server/SWServer.cpp:
519         (WebCore::SWServer::addRegistrationFromStore):
520
521 2018-03-15  Zan Dobersek  <zdobersek@igalia.com>
522
523         [TexMap] Remove TextureMapperLayer::texture()
524         https://bugs.webkit.org/show_bug.cgi?id=183635
525
526         Reviewed by Michael Catanzaro.
527
528         Remove the unused TextureMapperLayer::texture() method. This enables
529         removing the virtual TextureMapperBackingStore::texture() method, as
530         well as the implementations of it in TextureMapperTiledBackingStore and
531         CoordinatedBackingStore classes.
532
533         No change in behavior.
534
535         * platform/graphics/texmap/TextureMapperBackingStore.h:
536         * platform/graphics/texmap/TextureMapperLayer.h:
537         * platform/graphics/texmap/TextureMapperTiledBackingStore.cpp:
538         (WebCore::TextureMapperTiledBackingStore::texture const): Deleted.
539         * platform/graphics/texmap/TextureMapperTiledBackingStore.h:
540
541 2018-03-15  Zan Dobersek  <zdobersek@igalia.com>
542
543         [TexMap] Don't bother caching pattern transform matrix
544         https://bugs.webkit.org/show_bug.cgi?id=183633
545
546         Reviewed by Michael Catanzaro.
547
548         Remove the m_patternTransform and m_patternTransformDirty member
549         variables from the TextureMapperLayer class. These unnecessarily
550         complicate the state update methods that need to compare the given
551         attribute against the current state, and only update it if it has
552         changed.
553
554         Instead, compute the pattern TransformationMatrix value on-the-fly in
555         the paintSelf() method, if at all necessary.
556
557         No change in functionality.
558
559         * platform/graphics/texmap/TextureMapperLayer.cpp:
560         (WebCore::TextureMapperLayer::paintSelf):
561         (WebCore::TextureMapperLayer::setContentsRect):
562         (WebCore::TextureMapperLayer::setContentsTileSize):
563         (WebCore::TextureMapperLayer::setContentsTilePhase):
564         (WebCore::TextureMapperLayer::computePatternTransformIfNeeded): Deleted.
565         * platform/graphics/texmap/TextureMapperLayer.h:
566
567 2018-03-14  John Wilander  <wilander@apple.com>
568
569         Resource Load Statistics: Add clearing of storage access to WebResourceLoadStatisticsStore::clearInMemory()
570         https://bugs.webkit.org/show_bug.cgi?id=183641
571         <rdar://problem/38469497>
572
573         Reviewed by Brent Fulgham and Chris Dumez.
574
575         No new tests. This change is to stabilize existing layout tests.
576         See Ryan Haddad's comment in https://bugs.webkit.org/show_bug.cgi?id=183620.
577
578         * platform/network/NetworkStorageSession.h:
579         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
580         (WebCore::NetworkStorageSession::removeAllStorageAccess):
581             New function to clear out all storage access entries.
582
583 2018-03-14  Youenn Fablet  <youenn@apple.com>
584
585         imported/w3c/web-platform-tests/WebCryptoAPI/wrapKey_unwrapKey/wrapKey_unwrapKey.worker.html is crashing
586         https://bugs.webkit.org/show_bug.cgi?id=183602
587
588         Reviewed by Chris Dumez.
589
590         Introduce a map of ScriptExecutionContext that is read/write protected using a Lock.
591         This allows introducing postTaskTo taking a ScriptExecutionContext identifier and callable from any thread.
592         Use that method in Crypto instead of refing/unrefing  the context.
593         Lock only happens if context does some postTask activity. This is governed by calling or not the new contextIdentifier() getter.
594
595         Covered by crypto tests no longer failing m_workerGlobalScope->hasOneRef() assertion.
596
597         * crypto/CryptoAlgorithm.cpp:
598         (WebCore::dispatchAlgorithmOperation):
599         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
600         (WebCore::CryptoAlgorithmECDH::deriveBits):
601         * crypto/algorithms/CryptoAlgorithmSHA1.cpp:
602         (WebCore::CryptoAlgorithmSHA1::digest):
603         * crypto/algorithms/CryptoAlgorithmSHA224.cpp:
604         (WebCore::CryptoAlgorithmSHA224::digest):
605         * crypto/algorithms/CryptoAlgorithmSHA256.cpp:
606         (WebCore::CryptoAlgorithmSHA256::digest):
607         * crypto/algorithms/CryptoAlgorithmSHA384.cpp:
608         (WebCore::CryptoAlgorithmSHA384::digest):
609         * crypto/algorithms/CryptoAlgorithmSHA512.cpp:
610         (WebCore::CryptoAlgorithmSHA512::digest):
611         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
612         (WebCore::CryptoKeyRSA::generatePair):
613         * crypto/mac/CryptoKeyRSAMac.cpp:
614         (WebCore::CryptoKeyRSA::generatePair):
615         * dom/Document.cpp:
616         (WebCore::Document::~Document):
617         * dom/ScriptExecutionContext.cpp:
618         (WebCore::allScriptExecutionContextsMapLock):
619         (WebCore::ScriptExecutionContext::ScriptExecutionContext):
620         (WebCore::ScriptExecutionContext::removeFromContextsMap):
621         (WebCore::ScriptExecutionContext::checkConsistency const):
622         (WebCore::ScriptExecutionContext::postTaskTo):
623         * dom/ScriptExecutionContext.h:
624         (WebCore::ScriptExecutionContext::contextIdentifier const):
625         * workers/WorkerGlobalScope.cpp:
626         (WebCore::WorkerGlobalScope::~WorkerGlobalScope):
627
628 2018-03-14  Chris Dumez  <cdumez@apple.com>
629
630         Reduce use of SWServerToContextConnection::globalServerToContextConnection()
631         https://bugs.webkit.org/show_bug.cgi?id=183626
632
633         Reviewed by Youenn Fablet.
634
635         Reduce use of SWServerToContextConnection::globalServerToContextConnection() as we are moving towards
636         having multiple context connections.
637
638         No new tests, no expected behavior change.
639
640         * workers/service/server/SWServer.cpp:
641         (WebCore::SWServer::matchAll):
642         (WebCore::SWServer::serverToContextConnectionCreated):
643         (WebCore::SWServer::runServiceWorkerIfNecessary):
644         (WebCore::SWServer::runServiceWorker):
645         (WebCore::SWServer::terminateWorkerInternal):
646         (WebCore::SWServer::markAllWorkersAsTerminated):
647         (WebCore::SWServer::workerContextTerminated):
648         (WebCore::SWServer::fireInstallEvent):
649         (WebCore::SWServer::fireActivateEvent):
650         * workers/service/server/SWServer.h:
651         * workers/service/server/SWServerToContextConnection.cpp:
652         (WebCore::SWServerToContextConnection::findClientByIdentifier):
653         (WebCore::SWServerToContextConnection::matchAll):
654         (WebCore::SWServerToContextConnection::claim):
655         * workers/service/server/SWServerWorker.cpp:
656         (WebCore::SWServerWorker::contextConnection):
657         (WebCore::SWServerWorker::matchAll):
658         * workers/service/server/SWServerWorker.h:
659
660 2018-03-14  Youenn Fablet  <youenn@apple.com>
661
662         MessagePort should remove its listeners when being closed
663         https://bugs.webkit.org/show_bug.cgi?id=183644
664
665         Reviewed by Chris Dumez.
666
667         Test: http/tests/workers/worker-messageport.html
668
669         * dom/MessagePort.cpp:
670         (WebCore::MessagePort::close):
671         (WebCore::MessagePort::contextDestroyed):
672
673 2018-03-14  Chris Dumez  <cdumez@apple.com>
674
675         Drop unnecessary StorageToWebProcessConnection::workerContextProcessConnectionCreated()
676         https://bugs.webkit.org/show_bug.cgi?id=183624
677
678         Reviewed by Youenn Fablet.
679
680         Pass in context connection to SWServer::serverToContextConnectionCreated() to avoid
681         relying on the deprecated globalServerToContextConnection().
682
683         No new tests, no expected behavior change.
684
685         * workers/service/server/SWServer.cpp:
686         (WebCore::SWServer::serverToContextConnectionCreated):
687         * workers/service/server/SWServer.h:
688
689 2018-03-14  Mark Lam  <mark.lam@apple.com>
690
691         Enhance the MacroAssembler and LinkBuffer to support pointer profiling.
692         https://bugs.webkit.org/show_bug.cgi?id=183623
693         <rdar://problem/38443314>
694
695         Reviewed by Michael Saboff.
696
697         No new tests.  Just adding PtrTags required by new MacroAssembler API.
698
699         * cssjit/FunctionCall.h:
700         (WebCore::FunctionCall::prepareAndCall):
701         * cssjit/SelectorCompiler.cpp:
702         (WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
703
704 2018-03-14  Chris Fleizach  <cfleizach@apple.com>
705
706         AX: Implement accessible dismiss action on iOS
707         https://bugs.webkit.org/show_bug.cgi?id=183352
708         <rdar://problem/38161500>
709
710         Reviewed by Zalan Bujtas.
711
712         Test: accessibility/ios-simulator/AOM-dismiss-event.html
713
714         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
715         (-[WebAccessibilityObjectWrapper accessibilityPerformEscape]):
716
717 2018-03-14  Youenn Fablet  <youenn@apple.com>
718
719         Update libwebrtc up to 36af4e9614f707f733eb2340fae66d6325aaac5b
720         https://bugs.webkit.org/show_bug.cgi?id=183481
721
722         Reviewed by Eric Carlson.
723
724         Covered by existing tests.
725         Updated libwebrtc binding code.
726
727         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
728         (WebCore::fillEncodingParameters):
729         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h:
730
731 2018-03-14  Tim Horton  <timothy_horton@apple.com>
732
733         Fix the build after r229567
734
735         * Configurations/FeatureDefines.xcconfig:
736
737 2018-03-13  John Wilander  <wilander@apple.com>
738
739         Resource Load Statistics: Immediately forward cookie access for domains with previous user interaction when there's an opener document
740         https://bugs.webkit.org/show_bug.cgi?id=183620
741         <rdar://problem/38431469>
742
743         Reviewed by Brent Fulgham.
744
745         Tests: http/tests/storageAccess/deny-storage-access-under-opener.html
746                http/tests/storageAccess/grant-storage-access-under-opener.html
747
748         It turns out the fix in https://bugs.webkit.org/show_bug.cgi?id=183577
749         wasn't enough to address the compatibility issues with popups. Some of
750         them just detect their unpartitioned cookies, auto-dismiss themselves,
751         and expect their unpartitioned cookies to be available under the opener
752         afterwards. We should grant them access if the popup's domain has had
753         user interaction _previously_.
754
755         Note that we still need https://bugs.webkit.org/show_bug.cgi?id=183577
756         because if the popup's domain has not received user interaction
757         previously, we will not grant it storage access on just the window open.
758
759         * dom/Document.cpp:
760         (WebCore::Document::hasRequestedPageSpecificStorageAccessWithUserInteraction):
761         (WebCore::Document::setHasRequestedPageSpecificStorageAccessWithUserInteraction):
762         (WebCore::Document::hasGrantedPageSpecificStorageAccess): Deleted.
763         (WebCore::Document::setHasGrantedPageSpecificStorageAccess): Deleted.
764             Renamed from *Granted* to *Requested* since there is now a case
765             where access will not be granted, i.e. when the popup domain has
766             not had user interaction previously.
767         * dom/Document.h:
768         * loader/ResourceLoadObserver.cpp:
769         (WebCore::ResourceLoadObserver::setRequestStorageAccessUnderOpenerCallback):
770             Renamed *Grant* to *Request*.
771         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
772         (WebCore::ResourceLoadObserver::logWindowCreation):
773             New function called from DOMWindow::createWindow().
774         (WebCore::ResourceLoadObserver::requestStorageAccessUnderOpener):
775             New convenience function.
776         (WebCore::ResourceLoadObserver::setGrantStorageAccessUnderOpenerCallback): Deleted.
777             Renamed *Grant* to *Request*.
778         * loader/ResourceLoadObserver.h:
779         * page/DOMWindow.cpp:
780         (WebCore::DOMWindow::createWindow):
781             Now calls ResourceLoadObserver::logWindowCreation() if a window
782             was created and the opener has a document and a page ID.
783
784 2018-03-13  Chris Dumez  <cdumez@apple.com>
785
786         fast/loader/javascript-url-iframe-remove-on-navigate.html is a flaky crash on iOS with async delegates
787         https://bugs.webkit.org/show_bug.cgi?id=183610
788
789         Reviewed by Youenn Fablet.
790
791         The issue was that in DocumentLoader::loadMainResource(), the call to requestMainResource() which
792         return null due to the load getting cancelled synchronously. If this load is the parent frame's last
793         pending load, then the 'load' event gets fired in the parent frame. In the test, the parent frame's
794         load event handler does a document.write() call which blows away the iframe. As a result, when
795         we return from the requestMainResource(), m_frame is null and we crash later on dereferencing it.
796
797         No new tests, covered by fast/loader/javascript-url-iframe-remove-on-navigate-async-delegate.html
798         which was crashing flakily.
799
800         * loader/DocumentLoader.cpp:
801         (WebCore::DocumentLoader::loadMainResource):
802
803 2018-03-13  Jer Noble  <jer.noble@apple.com>
804
805         [iOS] Muted media playback can interrupt out-of-process audio
806         https://bugs.webkit.org/show_bug.cgi?id=183606
807         <rdar://problem/37466253>
808
809         Reviewed by Eric Carlson.
810
811         Test: Updated TestWebKitAPI test to verify the correct AVAudioSession category is set.
812
813         A non-playing, non-muted media element will cause the AVAudioSession category to be set to
814         "playing" when a muted media element begins playback. Ignore these non-playing elements for
815         the purposes of determining the AVAudioSession category.
816
817         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
818         (PlatformMediaSessionManager::updateSessionState):
819
820 2018-03-13  Youenn Fablet  <youenn@apple.com>
821
822         Calling removeTrack with RTCRtpSender does not set SenderTrack to null
823         https://bugs.webkit.org/show_bug.cgi?id=183308
824
825         Reviewed by Eric Carlson.
826
827         Covered by updated test.
828
829         * Modules/mediastream/RTCRtpSender.cpp:
830         (WebCore::RTCRtpSender::stop): Set track to null when being stopped i.e. removed.
831         * Modules/mediastream/RTCRtpSender.h:
832
833 2018-03-13  Youenn Fablet  <youenn@apple.com>
834
835         Changing link element rel attribute from preload to stylesheet should succeed loading the stylesheet
836         https://bugs.webkit.org/show_bug.cgi?id=183601
837         <rdar://problem/38309441>
838
839         Reviewed by Antti Koivisto.
840
841         Test: http/wpt/preload/change-link-rel-attribute.html
842
843         * loader/LinkPreloadResourceClients.h:
844         (WebCore::LinkPreloadResourceClient::clearResource): Remove the call to CachedResource::cancelLoad.
845         This call is expected to be called by ResourceLoader when cancelling the load from below CachedResource.
846         * loader/cache/CachedResource.cpp:
847         (WebCore::CachedResource::allClientsRemoved): In case of preload,
848         cancel the load if not finished when there is no more client attached to it.
849         * loader/cache/CachedResource.h:
850
851 2018-03-12  John Wilander  <wilander@apple.com>
852
853         Resource Load Statistics: Immediately forward cookie access at user interaction when there's an opener document
854         https://bugs.webkit.org/show_bug.cgi?id=183577
855         <rdar://problem/38266987>
856
857         Reviewed by Brent Fulgham.
858
859         Tested manually on live websites.
860         No new automated tests because of a bug in WebKitTestRunner:
861         https://bugs.webkit.org/show_bug.cgi?id=183578
862         The event sender triggers gestures in the opener rather than
863         in the popup.
864
865         * dom/Document.cpp:
866         (WebCore::Document::removedLastRef):
867             Clears the new m_primaryDomainsGrantedPageSpecificStorageAccess.
868         (WebCore::Document::hasGrantedPageSpecificStorageAccess):
869         (WebCore::Document::setHasGrantedPageSpecificStorageAccess):
870         * dom/Document.h:
871             Added member m_primaryDomainsGrantedPageSpecificStorageAccess
872             where we store domains that have been granted access.
873         * loader/ResourceLoadObserver.cpp:
874         (WebCore::ResourceLoadObserver::setGrantStorageAccessUnderOpenerCallback):
875         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
876             Now checks if there is a cross-origin opener and if so, immediately
877             grants cookie access to the popup's domain if it is partitioned or
878             blocked. 
879         * loader/ResourceLoadObserver.h:
880         * platform/network/NetworkStorageSession.h:
881             Added member m_pagesGrantedStorageAccess.
882         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
883         (WebCore::NetworkStorageSession::cookieStoragePartition const):
884         (WebCore::NetworkStorageSession::hasStorageAccess const):
885             Renamed from hasStorageAccessForFrame since the frameID now is optional.
886         (WebCore::NetworkStorageSession::grantStorageAccess):
887             Renamed from grantStorageAccessForFrame since the frameID now is optional.
888         (WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage):
889             Now removes the pageID entry in m_pagesGrantedStorageAccess.
890         (WebCore::NetworkStorageSession::hasStorageAccessForFrame const): Deleted.
891             Renamed since the frameID now is optional.
892         (WebCore::NetworkStorageSession::grantStorageAccessForFrame): Deleted.
893             Renamed since the frameID now is optional.
894
895 2018-03-12  Tim Horton  <timothy_horton@apple.com>
896
897         Stop using SDK conditionals to control feature definitions
898         https://bugs.webkit.org/show_bug.cgi?id=183430
899         <rdar://problem/38251619>
900
901         Reviewed by Dan Bernstein.
902
903         * Configurations/FeatureDefines.xcconfig:
904         * Configurations/WebKitTargetConditionals.xcconfig: Renamed.
905
906 2018-03-12  Chris Dumez  <cdumez@apple.com>
907
908         Return boolean from DOMTokenList's replace() method
909         https://bugs.webkit.org/show_bug.cgi?id=183567
910
911         Reviewed by Youenn Fablet.
912
913         Have DOMTokenList's replace() method return a boolean indicating if the
914         token was replaced, as per:
915         - https://dom.spec.whatwg.org/#dom-domtokenlist-replace
916
917         This is a recent addition to the DOM specification:
918         - https://github.com/whatwg/dom/pull/582
919
920         No new tests, rebaselined existing test.
921
922         * html/DOMTokenList.cpp:
923         (WebCore::replaceInOrderedSet):
924         (WebCore::DOMTokenList::replace):
925         * html/DOMTokenList.h:
926         * html/DOMTokenList.idl:
927
928 2018-03-12  Brian Burg  <bburg@apple.com>
929
930         Ignore some deprecation warnings encountered when compiling with newer versions of ICU
931         https://bugs.webkit.org/show_bug.cgi?id=183584
932         <rdar://problem/38395317>
933
934         Reviewed by Daniel Bates.
935
936         Ignore new deprecation warnings. Where a function has more than one
937         deprecation warning, mark out the entire function so it remains readable.
938
939         * editing/TextIterator.cpp:
940         * platform/graphics/SurrogatePairAwareTextIterator.cpp:
941         (WebCore::SurrogatePairAwareTextIterator::normalizeVoicingMarks):
942         * platform/text/TextEncoding.cpp:
943
944 2018-03-12  Yoav Weiss  <yoav@yoav.ws>
945
946         Runtime flag for link prefetch and remove link subresource.
947         https://bugs.webkit.org/show_bug.cgi?id=183540
948
949         Reviewed by Chris Dumez.
950
951         This patch removes the LINK_PREFETCH build time flag, removes
952         link subresource, adds an off-by-default runtime flag for link
953         prefetch and makes sure link prefetch only works when this flag is on.
954
955         Subresource is removed as it's not a part of any spec, nor supported by any
956         other browser. It was replaced by link preload.
957
958         No new tests as this is not adding any new functionality.
959
960         * Configurations/FeatureDefines.xcconfig: Remove the LINK_PREFETCH flag.
961         * html/LinkRelAttribute.cpp:
962         (WebCore::LinkRelAttribute::LinkRelAttribute): Put prefetch support behind the runtime flag.
963         (WebCore::LinkRelAttribute::isSupported): Add prefetch.
964         * html/LinkRelAttribute.h: Remove the LINK_PREFETCH flag.
965         * loader/LinkLoader.cpp:
966         (WebCore::createLinkPreloadResourceClient): Remove the LINK_PREFETCH flag.
967         (WebCore::LinkLoader::prefetchIfNeeded): Move the prefetch code to `prefetchIfNeeded()`. Remove subresource bits.
968         (WebCore::LinkLoader::loadLink): Call `prefetchIfNeeded()`.
969         * loader/LinkLoader.h:
970         * loader/ResourceLoadInfo.cpp:
971         (WebCore::toResourceType): Remove the LINK_PREFETCH flag as well as subresource.
972         * loader/SubresourceLoader.cpp:
973         (WebCore::logResourceLoaded): Remove the LINK_PREFETCH flag as well as subresource.
974         * loader/cache/CachedResource.cpp:
975         (WebCore::CachedResource::defaultPriorityForResourceType): Remove the LINK_PREFETCH flag as well as subresource.
976         (WebCore::CachedResource::load): Remove the LINK_PREFETCH flag.
977         * loader/cache/CachedResource.h:
978         (WebCore::CachedResource::ignoreForRequestCount const): Remove the LINK_PREFETCH flag as well as subresource.
979         * loader/cache/CachedResourceLoader.cpp:
980         (WebCore::createResource): Remove the LINK_PREFETCH flag as well as subresource.
981         (WebCore::CachedResourceLoader::requestLinkResource): Remove subresource.
982         (WebCore::contentTypeFromResourceType): Remove the LINK_PREFETCH flag as well as subresource.
983         (WebCore::CachedResourceLoader::checkInsecureContent const): Remove the LINK_PREFETCH flag as well as subresource.
984         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest): Remove the LINK_PREFETCH flag as well as subresource.
985         * loader/cache/CachedResourceLoader.h:
986         * page/RuntimeEnabledFeatures.h:
987         (WebCore::RuntimeEnabledFeatures::setLinkPrefetchEnabled): Set the prefetch flag.
988         (WebCore::RuntimeEnabledFeatures::linkPrefetchEnabled const): Get the prefetch flag.
989
990 2018-03-12  Youenn Fablet  <youenn@apple.com>
991
992         RTCPeerConnection's close method should update signalingState
993         https://bugs.webkit.org/show_bug.cgi?id=174314
994         <rdar://problem/33267977>
995
996         Reviewed by Eric Carlson.
997
998         Covered by rebased test.
999         Add closed as signalingState enum value.
1000         Set peer connection signaling state to closed once close is called.
1001
1002         * Modules/mediastream/RTCPeerConnection.cpp:
1003         (WebCore::RTCPeerConnection::doClose):
1004         * Modules/mediastream/RTCSignalingState.idl:
1005         * platform/mediastream/RTCSignalingState.h:
1006
1007 2018-03-12  Mark Lam  <mark.lam@apple.com>
1008
1009         Make a NativeFunction into a class to support pointer profiling.
1010         https://bugs.webkit.org/show_bug.cgi?id=183573
1011         <rdar://problem/38384697>
1012
1013         Reviewed by Filip Pizlo.
1014
1015         No new tests because there's no new behavior.  Only updating bindings.
1016
1017         * bindings/scripts/CodeGeneratorJS.pm:
1018         (GenerateHashTableValueArray):
1019         * bindings/scripts/test/JS/JSMapLike.cpp:
1020         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
1021         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
1022         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
1023         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
1024         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
1025         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
1026         * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
1027         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1028         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1029         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
1030         * bindings/scripts/test/JS/JSTestInterface.cpp:
1031         * bindings/scripts/test/JS/JSTestIterable.cpp:
1032         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
1033         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
1034         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
1035         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
1036         * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
1037         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
1038         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
1039         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
1040         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
1041         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
1042         * bindings/scripts/test/JS/JSTestNode.cpp:
1043         * bindings/scripts/test/JS/JSTestObj.cpp:
1044         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
1045         * bindings/scripts/test/JS/JSTestSerialization.cpp:
1046         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
1047         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
1048         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
1049         * bindings/scripts/test/JS/JSTestStringifier.cpp:
1050         * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
1051         * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
1052         * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
1053         * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
1054         * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
1055         * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
1056         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1057
1058 2018-03-12  Tim Horton  <timothy_horton@apple.com>
1059
1060         Use a different SPI header for some AudioToolbox enums
1061         https://bugs.webkit.org/show_bug.cgi?id=183574
1062         <rdar://problem/38385889>
1063
1064         Reviewed by Anders Carlsson.
1065
1066         * platform/audio/ios/AudioDestinationIOS.cpp:
1067         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
1068         Adjust SPI imports.
1069
1070 2018-03-12  Danyao Wang  <danyao@chromium.org>
1071
1072         Add a query and fragment exception to history API's unique origin restriction.
1073         https://bugs.webkit.org/show_bug.cgi?id=183028
1074
1075         Reviewed by Brent Fulgham.
1076
1077         Tests: http/tests/navigation/pushstate-at-unique-origin-denied.php
1078                Tools/TestWebKitAPI/Tests/WebCore/URL.cpp
1079
1080         * page/History.cpp:
1081         (WebCore::History::stateObjectAdded):
1082
1083 2018-03-12  Antti Koivisto  <antti@apple.com>
1084
1085         Don't invalidate descendants for nth pseudo classes unless needed
1086         https://bugs.webkit.org/show_bug.cgi?id=183566
1087
1088         Reviewed by Zalan Bujtas.
1089
1090         We currently invalidate the whole subtrees that may match :nth-child and similar. In many common
1091         cases we know that only the direct siblings may be affected.
1092
1093         * css/SelectorChecker.cpp:
1094         (WebCore::localContextForParent):
1095         (WebCore::SelectorChecker::matchRecursively const):
1096
1097             Track if the context matches the subject element if the selector or its siblings only.
1098
1099         (WebCore::SelectorChecker::checkOne const):
1100
1101             Use different bits of descendant and child invalidation cases.
1102
1103         * cssjit/SelectorCompiler.cpp:
1104         (WebCore::SelectorCompiler::fragmentMatchesRightmostOrAdjacentElement):
1105         (WebCore::SelectorCompiler::constructFragmentsInternal):
1106
1107             Track if the context matches the subject element if the selector or its siblings only.
1108
1109         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChild):
1110         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChildOf):
1111         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthLastChild):
1112
1113             Use different bits of descendant and child invalidation cases.
1114
1115         * dom/Element.cpp:
1116         (WebCore::invalidateForForwardPositionalRules):
1117         (WebCore::invalidateForBackwardPositionalRules):
1118
1119             Invalidate more precisely based on the new bits.
1120
1121         (WebCore::checkForSiblingStyleChanges):
1122         (WebCore::Element::setDescendantsAffectedByForwardPositionalRules):
1123         (WebCore::Element::setDescendantsAffectedByBackwardPositionalRules):
1124         (WebCore::Element::hasFlagsSetDuringStylingOfChildren const):
1125         (WebCore::Element::rareDataDescendantsAffectedByForwardPositionalRules const):
1126         (WebCore::Element::rareDataDescendantsAffectedByBackwardPositionalRules const):
1127
1128             New bits.
1129
1130         * dom/Element.h:
1131         (WebCore::Element::descendantsAffectedByForwardPositionalRules const):
1132         (WebCore::Element::descendantsAffectedByBackwardPositionalRules const):
1133         * dom/ElementRareData.h:
1134         (WebCore::ElementRareData::descendantsAffectedByForwardPositionalRules const):
1135         (WebCore::ElementRareData::setDescendantsAffectedByForwardPositionalRules):
1136         (WebCore::ElementRareData::descendantsAffectedByBackwardPositionalRules const):
1137         (WebCore::ElementRareData::setDescendantsAffectedByBackwardPositionalRules):
1138         (WebCore::ElementRareData::ElementRareData):
1139         (WebCore::ElementRareData::resetStyleRelations):
1140         * style/StyleRelations.cpp:
1141         (WebCore::Style::commitRelationsToRenderStyle):
1142         (WebCore::Style::commitRelations):
1143         * style/StyleRelations.h:
1144
1145 2018-03-12  Javier Fernandez  <jfernandez@igalia.com>
1146
1147         Remove GridLayout runtime flag
1148         https://bugs.webkit.org/show_bug.cgi?id=183484
1149
1150         Reviewed by Myles C. Maxfield.
1151
1152         The Grid Layout feature has been enabled by default for almost a
1153         year, so I think it's time to remove the runtime flag and the
1154         codepath run when the feature is disabled.
1155
1156         No new tests, because there are no changes in functionality.
1157
1158         * css/CSSComputedStyleDeclaration.cpp:
1159         (WebCore::valueForContentPositionAndDistributionWithOverflowAlignment):
1160         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
1161         * css/StyleBuilderConverter.h:
1162         (WebCore::StyleBuilderConverter::convertContentAlignmentData):
1163         * css/parser/CSSParser.cpp:
1164         (WebCore::CSSParserContext::CSSParserContext):
1165         (WebCore::operator==):
1166         * css/parser/CSSParserFastPaths.cpp:
1167         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
1168         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
1169         * css/parser/CSSParserMode.h:
1170         (WebCore::CSSParserContextHash::hash):
1171         * css/parser/CSSPropertyParser.cpp:
1172         (WebCore::CSSPropertyParser::parseSingleValue):
1173         * dom/Document.cpp:
1174         * dom/Document.h:
1175         * page/RuntimeEnabledFeatures.h:
1176         * rendering/RenderFlexibleBox.cpp:
1177         (WebCore::alignmentOffset):
1178         * rendering/style/RenderStyle.cpp:
1179         * rendering/style/RenderStyle.h:
1180         (WebCore::RenderStyle::initialDefaultAlignment):
1181         * testing/InternalSettings.cpp:
1182         (WebCore::InternalSettings::Backup::Backup):
1183         (WebCore::InternalSettings::Backup::restoreTo):
1184         * testing/InternalSettings.h:
1185         * testing/InternalSettings.idl:
1186
1187 2018-03-12  Antoine Quint  <graouts@apple.com>
1188
1189         [Web Animations] Implement CSS Animations and CSS Transitions as Web Animations
1190         https://bugs.webkit.org/show_bug.cgi?id=183504
1191         <rdar://problem/38372965>
1192
1193         Reviewed by Dean Jackson and Jon Lee.
1194
1195         Tests: webanimations/css-animations.html
1196                webanimations/css-transitions.html
1197
1198         This patch implements CSS Animations and CSS Transitions as Web Animations. The main changes are:
1199
1200         * StyleTreeResolver: StyleTreeResolver now has a code path to add CSSAnimation and CSSTransition objects onto the DocumentTimeline
1201         to be picked up by the Web Animations engine. The previous CSSAnimationController code path is preserved if the runtime flag is disabled.
1202
1203         * AnimationTimeline: we add two new methods, updateCSSAnimationsForElement() and updateCSSTransitionsForElement() which are called from
1204         TreeResolver::createAnimatedElementUpdate(). These look at the AnimationList for the old and new RenderStyle objects and create, update
1205         and remove matching CSSAnimation and CSSTransition instances.
1206
1207         * DeclarativeAnimation: a new superclass to both CSSAnimation and CSSTransition which introduces the concept of a backingAnimation(),
1208         which is an Animation held by the RenderStyle objects, and two virtual methods with base implementations, initialize() which is called
1209         upon creating by create() methods in subclasses, and syncPropertiesWithBackingAnimation() which ensures that properties on the
1210         DeclarativeAnimation objects (Web Animations side) match the backing animation (CSS side).
1211
1212         * KeyframeEffectReadOnly: two new important methods to create blending keyframes (KeyframeList) based on backing Animation objects,
1213         computeCSSAnimationBlendingKeyframes() and computeCSSTransitionBlendingKeyframes().
1214
1215         * Sources.txt:
1216         * WebCore.xcodeproj/project.pbxproj:
1217         * animation/AnimationEffectReadOnly.h:
1218         (WebCore::AnimationEffectReadOnly::isKeyframeEffectReadOnly const): We fix this method such that calling it on a KeyframeEffect, which
1219         is a subclass of KeyframeEffectReadOnly, returns true.
1220         * animation/AnimationEffectTimingReadOnly.cpp: In order for DeclarativeAnimation::syncPropertiesWithBackingAnimation() to set the timing
1221         function for a declarative animation's effect, we need a public method to set an effect's timing function outside of just the "easing"
1222         property setter exposed via the JS API. So we introduce a setTimingFunction() method and call it from setEasing().
1223         (WebCore::AnimationEffectTimingReadOnly::setEasing):
1224         (WebCore::AnimationEffectTimingReadOnly::setTimingFunction):
1225         * animation/AnimationEffectTimingReadOnly.h:
1226         * animation/AnimationTimeline.cpp:
1227         (WebCore::AnimationTimeline::~AnimationTimeline): Clear all maps and sets containing WebAnimation references to ensure these get destructed
1228         when the AnimationTimeline is being destructed and should no longer hold a reference to them.
1229         (WebCore::AnimationTimeline::relevantMapForAnimation): We store various subclasses of WebAnimation in dedicated maps so we can composite
1230         animations in the correct order when animating. This function returns the correct map for a given animation such that animationWasAddedToElement()
1231         and animationWasRemovedFromElement() mutate the right map.
1232         (WebCore::AnimationTimeline::animationWasAddedToElement):
1233         (WebCore::AnimationTimeline::animationWasRemovedFromElement):
1234         (WebCore::AnimationTimeline::animationsForElement): Make sure to look for animations in the lists of CSS Animations and CSS Transitions as well
1235         as Web Animations.
1236         (WebCore::AnimationTimeline::updateCSSAnimationsForElement): This method is called by TreeResolver::createAnimatedElementUpdate() during style
1237         resolution. It compares the AnimationList of the previous style and the new style for a given element, checks that animations with a given name
1238         that were not present in the old AnimationList have a new matching CSSAnimation object for them added to the AnimationTimeline, that animations
1239         with a given name that are no longer present in the new AnimationList have their matching CSSAnimation object removed from the AnimationTimeline,
1240         and that animations with a given name that are present in both the old and new AnimationList have their matching CSSAnimation updated to match
1241         the current state of the animation in the AnimationList.
1242         (WebCore::AnimationTimeline::updateCSSTransitionsForElement): Similarly to updateCSSAnimationsForElement(), this method is called during style
1243         resolution by TreeResolver::createAnimatedElementUpdate(). Its role is to create or remove CSSTransition objects based on the AnimationList found
1244         in the old and new styles for a given element. It follows a slightly different logic than updateCSSAnimationsForElement() since for CSS Transitions,
1245         there is no need to update CSSTransition objects for a CSS property existing in both the old and new AnimationList, since when a CSS transitions
1246         property is changed, a whole new transition is initiated. However, it's important to check that different Animation objects and styles would actually
1247         result in different timing properties and blending keyframes, so check for this as well before creating new CSSTransition objects.
1248         * animation/AnimationTimeline.h:
1249         (WebCore::AnimationTimeline::animations const): Change the m_animations type from HashSet to ListHashSet to guarantee we preserve the insertion order which is
1250         required by getAnimations().
1251         (WebCore::AnimationTimeline::hasElementAnimations const): Indicates to DocumentTimeline::updateAnimations() that there are animations targeting the provided element.
1252         (WebCore::AnimationTimeline::elementToAnimationsMap):
1253         (WebCore::AnimationTimeline::elementToCSSAnimationsMap):
1254         (WebCore::AnimationTimeline::elementToCSSTransitionsMap):
1255         * animation/CSSAnimation.cpp: CSSAnimation is now a subclass of DeclarativeAnimation and subclasses initialize() and syncPropertiesWithBackingAnimation()
1256         to perform work specific to CSS Animations.
1257         (WebCore::CSSAnimation::create): Set the animationName property based on the provided backing animation.
1258         (WebCore::CSSAnimation::CSSAnimation):
1259         (WebCore::CSSAnimation::initialize): Create the blending keyframes for this CSSAnimation.
1260         (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): Reflect the animation-fill-mode, animation-direction, animation-iteration-count and
1261         animation-play-state CSS properties on the AnimationEffectTimingReadOnly object associated with this CSSAnimation.
1262         * animation/CSSAnimation.h:
1263         * animation/CSSTransition.cpp: CSSTransition is now a subclass of DeclarativeAnimation.
1264         (WebCore::CSSTransition::create): Set the transitionProperty property based on the provided backing animation.
1265         (WebCore::CSSTransition::CSSTransition):
1266         (WebCore::CSSTransition::matchesBackingAnimationAndStyles const):
1267         (WebCore::CSSTransition::canBeListed const): Subclass this method such that we also check that we have blending keyframes for a CSSTransition to be
1268         listed by calls to getAnimations().
1269         * animation/CSSTransition.h:
1270         * animation/DeclarativeAnimation.cpp: Added. This new WebAnimation subclass now is the common base class for both CSSAnimation and CSSTransition.
1271         It establishes a relationship with a "backing animation", which is an Animation obtained from a style's AnimationList while resolving styles.
1272         These backing animations contain all of the parsed CSS styles related to CSS Animations and CSS Transitions and we use those to set matching properties
1273         of the Web Animations timing model in the new syncPropertiesWithBackingAnimation() virtual method, which subclasses can override to perform further
1274         work that is specific to a given declarative animation type. The initialize() method is called during create() methods to perform common animation
1275         setup work. Note that while both initialize() and syncPropertiesWithBackingAnimation() are called, we suspend invalidation to that animation's effect
1276         since these methods are meant to be called during style invalidation and we would hit an assertion if we followed the usual route of calling
1277         updateStyleIfNeeded() on the target's document during invalidation.
1278         (WebCore::DeclarativeAnimation::DeclarativeAnimation):
1279         (WebCore::DeclarativeAnimation::setBackingAnimation):
1280         (WebCore::DeclarativeAnimation::initialize): Create a KeyframeEffectReadOnly for this animation and set the provided element as its target, set that
1281         element's document's timeline and play the animation if the backing animation's play state is playing.
1282         (WebCore::DeclarativeAnimation::syncPropertiesWithBackingAnimation): Reflect the {animation|transition}-delay, {animation|transition}-duration and
1283         {animation|transition}-timing-function properties as set on the backing animation.
1284         * animation/DeclarativeAnimation.h: Added.
1285         (WebCore::DeclarativeAnimation::backingAnimation const):
1286         * animation/DocumentTimeline.cpp:
1287         (WebCore::DocumentTimeline::updateAnimations): Trigger style invalidation for elements targeted not just by WebAnimation instances, but also by any
1288         of the DeclarativeAnimation subclasses. We also remove the call to updateFinishedState() which should have been removed when we implemented correct
1289         support for asynchronous WebAnimation operations.
1290         (WebCore::DocumentTimeline::animatedStyleForRenderer): Declarative animations are backed by KeyframeEffectReadOnly effects, so make sure we check
1291         for KeyframeEffectReadOnly or one of its subclasses and not just KeyframeEffect since there now are animation types that use the ReadOnly variant.
1292         (WebCore::DocumentTimeline::runningAnimationsForElementAreAllAccelerated): Same as for animatedStyleForRenderer, check for KeyframeEffectReadOnly
1293         and not simply KeyframeEffect.
1294         * animation/KeyframeEffectReadOnly.cpp:
1295         (WebCore::invalidateElement): Stop forcing a style resolution as we invalidate element, marking them as dirty is sufficient. Calls to getAnimations()
1296         already force a style resolution as needed.
1297         (WebCore::KeyframeEffectReadOnly::create): Add a new create() method that only provides a target and which is used by DeclarativeAnimation::initialize().
1298         (WebCore::KeyframeEffectReadOnly::getKeyframes): The previous implementation of getKeyframes() used the ParsedKeyframe list held as m_parsedKeyframes
1299         to compute keyframes. In the case of declarative animations, there are no ParsedKeyframe since the JS API was not involved, so we use the blending keyframes
1300         to look for keyframe data.
1301         (WebCore::KeyframeEffectReadOnly::computeCSSAnimationBlendingKeyframes): Called by CSSAnimation::initialize(), this function creates blending keyframes by
1302         looking up the keyframes date obtained from the @keyframes rule with this backing animation's name.
1303         (WebCore::KeyframeEffectReadOnly::computeCSSTransitionBlendingKeyframes): Called by CSSTransition::create(), this function creates blending keyframes by
1304         creating a 0-offset keyframe with the old style and a 1-offset keyframe with the new style as provided during TreeResolver::createAnimatedElementUpdate().
1305         (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): Called by AnimationTimeline::updateCSSTransitionsForElement()
1306         to check that a provided backing Animation and a pair of old and new RenderStyles that may be different objects actually would yield different timing
1307         properties and keyframe CSS values for a given CSS transition to avoid the deletion and creation of CSSTransition objects.
1308         (WebCore::KeyframeEffectReadOnly::shouldRunAccelerated): We mistakenly assumed we always had blending keyframes, which is not always the case with a
1309         CSSTransition where the transition style itself might be set first, but the target value after. So we should only run accelerated provided there are blending
1310         keyframes at least, the function already returning false if it finds a blending keyframe animating a non-accelerated CSS property.
1311         (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle): Check that there actually is a matching ParsedKeyframe to read the timing function from.
1312         * animation/KeyframeEffectReadOnly.h:
1313         (WebCore::KeyframeEffectReadOnly::hasBlendingKeyframes const):
1314         * animation/WebAnimation.cpp:
1315         (WebCore::WebAnimation::~WebAnimation): We used to do something very wrong when a WebAnimation was destroyed which uncovered crashes when dealing with
1316         declarative animations. In AnimationTimeline's updateCSSAnimationsForElement() and updateCSSTransitionsForElement(), when we identify that a DeclarativeAnimation
1317         no longer matches an Animation from the current style's AnimationList, we set that DeclarativeAnimation's effect to null and call removeAnimation() on
1318         the timeline. This removes all references from AnimationTimeline to this DeclarativeAnimation and leads to ~WebAnimation being called. Calling removeAnimation()
1319         again in the destructor means that we'd hit ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun) in ref(). It was also meaningless to perform this work in
1320         the WebAnimation destructor since an animation could never be destroyed if it were still registered on a timeline.
1321         (WebCore::WebAnimation::suspendEffectInvalidation): DeclarativeAnimation instances have their timing model properties set during style invalidation, so we need
1322         a mechanism to allow the usual effect invalidation to be suspended in this case. We now maintain a simple m_suspendCount count that increases and decreases with
1323         calls to this method and unsuspendEffectInvalidation() and a isEffectInvalidationSuspended() method returning true whenever that count is positive.
1324         (WebCore::WebAnimation::unsuspendEffectInvalidation):
1325         (WebCore::WebAnimation::timingModelDidChange): Check that effect invalidation is not suspended before proceeding with invalidating the effect.
1326         (WebCore::WebAnimation::setEffect): Check for KeyframeEffectReadOnly and not just KeyframeEffect since declarative animations have ReadOnly effects.
1327         (WebCore::WebAnimation::setTimeline): Check for KeyframeEffectReadOnly and not just KeyframeEffect since declarative animations have ReadOnly effects.
1328         (WebCore::WebAnimation::scheduleMicrotaskIfNeeded): Ensure that the WebAnimation's lifecycle is extended at least to the completion of the scheduled microtask.
1329         This would otherwise cause crashes after declarative animations were destroyed when they were no longer applied.
1330         (WebCore::WebAnimation::runPendingPlayTask): Only fulfill the "ready" promise if it hasn't already been, which might have been the case if multiple calls to play()
1331         are made as a result of updating the animation play state in CSSAnimation::syncPropertiesWithBackingAnimation().
1332         (WebCore::WebAnimation::runPendingPauseTask): Same as above but with multiple pause() calls.
1333         (WebCore::WebAnimation::startOrStopAccelerated): Check for KeyframeEffectReadOnly and not just KeyframeEffect since declarative animations have ReadOnly effects.
1334         (WebCore::WebAnimation::canBeListed const): This new method is called by {Document|Element}::getAnimations() to check that an animation is in the correct state to
1335         be listed. The Web Animations spec explains that only animations "that have an associated target effect which is current or in effect" can be listed. We implement
1336         this behavior as specified.
1337         * animation/WebAnimation.h:
1338         (WebCore::WebAnimation::isDeclarativeAnimation const):
1339         (WebCore::WebAnimation::isEffectInvalidationSuspended):
1340         * dom/Document.cpp:
1341         (WebCore::Document::getAnimations): Ensure that the document's pending styles are resolved before returning animations to ensure that any pending declarative
1342         animations are created. Additionally, we ensure that we only list qualifying animations that have effects targeting elements that are children of thi document.
1343         * dom/Element.cpp:
1344         (WebCore::Element::getAnimations): Same as Document::getAnimations().
1345         * style/StyleTreeResolver.cpp:
1346         (WebCore::Style::TreeResolver::createAnimatedElementUpdate): When resolving styles, call into the AnimationTimeline if the runtime flag to enable CSS Animations and
1347         CSS Transitions as Web Animations is on. Otherwise, use CSSAnimationController.
1348
1349 2018-03-12  Michael Catanzaro  <mcatanzaro@igalia.com>
1350
1351         [GTK] Crash in WebCore::PlatformDisplayWayland::~PlatformDisplayWayland
1352         https://bugs.webkit.org/show_bug.cgi?id=176490
1353
1354         Reviewed by Žan Doberšek.
1355
1356         Destroy the wl_display with wl_display_disconnect() (client process API), not
1357         wl_display_destroy() (server process API). It has to be destroyed last, so explicitly
1358         destroy the wl_registry and wl_compositor first.
1359
1360         * platform/graphics/wayland/PlatformDisplayWayland.cpp:
1361         (WebCore::PlatformDisplayWayland::~PlatformDisplayWayland):
1362
1363 2018-03-10  Megan Gardner  <megan_gardner@apple.com>
1364
1365         Media query for default appearance
1366         https://bugs.webkit.org/show_bug.cgi?id=183539
1367         <rdar://problem/38326388>
1368
1369         Reviewed by Tim Horton.
1370
1371         Not currently testable, will add tests in a later patch.
1372
1373         Write a media query to evaluate appearance.
1374
1375         * css/CSSValueKeywords.in:
1376         * css/MediaFeatureNames.h:
1377         * css/MediaQueryEvaluator.cpp:
1378         (WebCore::defaultAppearanceEvaluate):
1379         * css/MediaQueryExpression.cpp:
1380         (WebCore::featureWithValidIdent):
1381         (WebCore::isFeatureValidWithoutValue):
1382         * page/Page.h:
1383         (WebCore::Page::defaultAppearance const):
1384         (WebCore::Page::setDefaultAppearance):
1385
1386 2018-03-10  Daniel Bates  <dabates@apple.com>
1387
1388         InlineTextBox should own shadow data
1389         https://bugs.webkit.org/show_bug.cgi?id=183359
1390         <rdar://problem/38171343>
1391
1392         Reviewed by Darin Adler.
1393
1394         Following r229147 we recompute the selection style, including any shadow data, whenever we
1395         paint the inline text box. Therefore, InlineTextBox needs to take ownership of the shadow
1396         data or it may be deallocated before it can be used.
1397
1398         Covered by existing tests.
1399
1400         * rendering/InlineTextBox.cpp: Changed data type of InlineTextBox::MarkedTextStyle::textShadow
1401         from const ShadowData* to std::optional<ShadowData>. Also removed explicitly deleted equality
1402         and inequality operators as they are unnecessary. Layout tests should catch if these are ever
1403         implemented and used when painting because the painted results will be wrong.
1404         (WebCore::InlineTextBox::computeStyleForUnmarkedMarkedText const): Clone ShadowData.
1405         (WebCore::InlineTextBox::resolveStyleForMarkedText): Simplified logic.
1406         (WebCore::InlineTextBox::paintMarkedTextForeground): Modified code now that MarkedTextStyle
1407         holds a std::optional<ShadowData>.
1408         (WebCore::InlineTextBox::paintMarkedTextDecoration): Ditto.
1409         * rendering/TextPaintStyle.cpp:
1410         (WebCore::computeTextSelectionPaintStyle): Changed the out parameter type from const ShadowData*
1411         to std::optional<ShadowData>& and modified code as needed.
1412         * rendering/TextPaintStyle.h:
1413         * rendering/style/ShadowData.cpp: Removed unncessary #include of header LayoutRect.h.
1414         This header will be included via ShadowData.h.
1415         (WebCore::ShadowData::clone): Convenience method that returns an std::optional to a
1416         cloned ShadowData object.
1417         * rendering/style/ShadowData.h:
1418
1419 2018-03-09  Zalan Bujtas  <zalan@apple.com>
1420
1421         Turn off offset*/scroll* optimization for input elements with shadow content
1422         https://bugs.webkit.org/show_bug.cgi?id=182383
1423         <rdar://problem/37114190>
1424
1425         Reviewed by Antti Koivisto.
1426
1427         We normally ensure clean tree before calling offsetHeight/Width, scrollHeight/Width.
1428         In certain cases (see updateLayoutIfDimensionsOutOfDate() for details), it's okay to return
1429         the previously computed values even when some part of the tree is dirty.
1430         In case of shadow content, updateLayoutIfDimensionsOutOfDate() might return false (no need to layout)
1431         for the root, while true (needs layout) for the shadow content.
1432         This could confuse the caller (Element::scrollWidth/Height etc) and lead to incorrect result.
1433
1434         Test: fast/forms/scrollheight-with-mutation-crash.html
1435
1436         * dom/Document.cpp:
1437         (WebCore::Document::updateLayoutIfDimensionsOutOfDate):
1438
1439 2018-03-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1440
1441         [macOS] Copying a table from the Numbers app and pasting into iCloud Numbers fails
1442         https://bugs.webkit.org/show_bug.cgi?id=183485
1443         <rdar://problem/38041984>
1444
1445         Reviewed by Ryosuke Niwa.
1446
1447         After r222656, WebKit now treats raw image data on the pasteboard as files for the purposes of computing
1448         DataTransfer.files and DataTransfer.types. However, this is combined with existing policies that suppress
1449         DataTransfer.getData and DataTransfer.setData when the pasteboard contains files (generalized to copy/paste in
1450         r222688). This means we now don't allow web pages to access "text/plain" in the case where the user copies part
1451         of a table from the native Numbers app since Numbers additionally writes a snapshot of the table to the platform
1452         pasteboard.
1453
1454         This restriction on getData/setData was intended to prevent web pages from extracting users' file paths when
1455         pasting or dropping, so it doesn't make sense to enforce this restriction even when there is only in-memory
1456         image data on the pasteboard. To fix this bug, we make Pasteboard::fileContentState() differentiate between
1457         cases where there are (real) files on the pasteboard, and cases where we've fallen back to treating image data
1458         as files.
1459
1460         Rebaselined existing LayoutTests to match new behavior.
1461         Also covered by 4 new API tests:
1462             - PasteMixedContent.ImageDataAndPlainText
1463             - PasteMixedContent.ImageDataAndPlainTextAndURL
1464             - PasteMixedContent.ImageDataAndPlainTextAndURLAndHTML
1465             - UIPasteboardTests.DataTransferGetDataWhenPastingImageAndText
1466
1467         * dom/DataTransfer.cpp:
1468         (WebCore::DataTransfer::shouldSuppressGetAndSetDataToAvoidExposingFilePaths const):
1469
1470         If custom pasteboard data is enabled, suppress getData and setData if and only if we might actually expose file
1471         paths (see Pasteboard::fileContentState).
1472
1473         (WebCore::DataTransfer::types const):
1474
1475         Only allow "text/html" or "text/uri-list" in the case where there are actual files in the pasteboard. If there's
1476         only image data, add all of the DOM-safe types back into the list of types.
1477
1478         * platform/Pasteboard.h:
1479         * platform/StaticPasteboard.h:
1480
1481         Add an enum type to represent the result of Pasteboard::fileContentState.
1482         -   NoFileOrImageData indicates that there was nothing on the pasteboard that could be considered a file
1483             from the point of view of the page.
1484         -   InMemoryImage indicates that there are no files on the pasteboard, but there is image data that we consider
1485             to be files, exposed via DataTransfer API.
1486         -   MayContainFilePaths indicates that there might be file paths on the pasteboard. This means that the source
1487             has either written file paths to the pasteboard (for example, through NSFilenamesPboardType) or the source
1488             has written image data along with a URL type of some sort that does not match one of the allowed URL schemes
1489             that are safe to expose (currently, these are http-family, data, or blob).
1490
1491         * platform/cocoa/PasteboardCocoa.mm:
1492         (WebCore::Pasteboard::fileContentState):
1493
1494         Refactor to return one of the three enum types described above.
1495
1496         (WebCore::Pasteboard::containsFiles): Deleted.
1497         * platform/gtk/PasteboardGtk.cpp:
1498         (WebCore::Pasteboard::fileContentState):
1499         (WebCore::Pasteboard::containsFiles): Deleted.
1500         * platform/win/PasteboardWin.cpp:
1501         (WebCore::Pasteboard::fileContentState):
1502         (WebCore::Pasteboard::containsFiles): Deleted.
1503         * platform/wpe/PasteboardWPE.cpp:
1504         (WebCore::Pasteboard::fileContentState):
1505         (WebCore::Pasteboard::containsFiles): Deleted.
1506
1507         Adjust for Pasteboard::fileContentState() tweaks.
1508
1509 2018-03-09  Chris Fleizach  <cfleizach@apple.com>
1510
1511         AX: WebKit seems to be running spell checker even on non-editable content text
1512         https://bugs.webkit.org/show_bug.cgi?id=183456
1513         <rdar://problem/38076042>
1514
1515         Reviewed by Joanmarie Diggs.
1516
1517         Test: accessibility/mac/attributed-string/attributed-string-does-not-includes-misspelled-for-non-editable.html
1518
1519         Only apply misspelled attributes if it's for editable text. It's not useful or performant to do this for static text.
1520
1521         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1522         (AXAttributeStringSetSpelling):
1523
1524 2018-03-09  Nan Wang  <n_wang@apple.com>
1525
1526         AX: AOM: More accessibility events support
1527         https://bugs.webkit.org/show_bug.cgi?id=183023
1528         <rdar://problem/37764380>
1529
1530         Reviewed by Chris Fleizach.
1531
1532         The test is crashing when we call updateBackingStore when 
1533         the AXObjectCache object is gone. Added a check to fix that.
1534
1535         Modified the test by using the right format of setTimeout and extended the delay.
1536
1537         * accessibility/AccessibilityObject.cpp:
1538         (WebCore::AccessibilityObject::updateBackingStore):
1539
1540 2018-03-09  Ross Kirsling  <ross.kirsling@sony.com>
1541
1542         Unreviewed. Fix WinCairo build after r229497.
1543
1544         * platform/MIMETypeRegistry.cpp:
1545         (WebCore::MIMETypeRegistry::getNormalizedMIMEType):
1546
1547 2018-03-09  Ross Kirsling  <ross.kirsling@sony.com>
1548
1549         Clean up MIMETypeRegistry::mimeTypeAssociationMap for Curl
1550         https://bugs.webkit.org/show_bug.cgi?id=170529
1551
1552         Reviewed by Alex Christensen.
1553
1554         * platform/MIMETypeRegistry.cpp:
1555         (WebCore::MIMETypeRegistry::getNormalizedMIMEType):
1556         (WebCore::mimeTypeAssociationMap): Deleted.
1557         Create map with makeNeverDestroyed and a loop instead.
1558
1559 2018-03-09  Brian Burg  <bburg@apple.com>
1560
1561         Web Inspector: there should only be one way for async backend commands to send failure
1562         https://bugs.webkit.org/show_bug.cgi?id=183524
1563
1564         Reviewed by Timothy Hatcher.
1565
1566         Remove some useless ErrorString arguments. Fix some bugs where we
1567         may never call the callback in an early exit situation.
1568
1569         Covered by existing Inspector and protocol generator tests.
1570
1571         * inspector/agents/InspectorDatabaseAgent.cpp:
1572         (WebCore::InspectorDatabaseAgent::executeSQL):
1573         * inspector/agents/InspectorDatabaseAgent.h:
1574         * inspector/agents/InspectorIndexedDBAgent.h:
1575         * inspector/agents/InspectorIndexedDBAgent.cpp:
1576         (WebCore::getDocumentAndIDBFactoryFromFrameOrSendFailure):
1577         (WebCore::InspectorIndexedDBAgent::requestDatabaseNames):
1578         (WebCore::InspectorIndexedDBAgent::requestDatabase):
1579         (WebCore::InspectorIndexedDBAgent::requestData):
1580         (WebCore::InspectorIndexedDBAgent::clearObjectStore):
1581         (WebCore::assertDocument): Deleted.
1582         (WebCore::assertIDBFactory): Deleted.
1583         Modernize this code a little bit to share the document/idbFactory extraction code.
1584
1585         * inspector/agents/InspectorNetworkAgent.cpp:
1586         (WebCore::InspectorNetworkAgent::loadResource):
1587         * inspector/agents/InspectorNetworkAgent.h:
1588
1589 2018-03-09  Youenn Fablet  <youenn@apple.com>
1590
1591         Crash in ServiceWorkerContainer::ready
1592         https://bugs.webkit.org/show_bug.cgi?id=183380
1593
1594         Reviewed by Chris Dumez.
1595
1596         Not using 'this' through lambdas.
1597         Instead rely on the last lambda that is passed a ScriptExecutionContext& to get back 'this' which is a ServiceWorkerContainer.
1598
1599         Should be covered by imported/w3c/web-platform-tests/service-workers/service-worker/register-default-scope.https.html no longer crashing.
1600         Although it should probably be LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ready.https.html that should crash
1601         since this is the main test using ready.
1602
1603         * workers/service/ServiceWorkerContainer.cpp:
1604         (WebCore::ServiceWorkerContainer::ready):
1605
1606 2018-03-09  Youenn Fablet  <youenn@apple.com>
1607
1608         RealtimeOutgoingAudioSource and RealtimeOutgoingVideoSource should be destroyed on the main thread
1609         https://bugs.webkit.org/show_bug.cgi?id=183483
1610         <rdar://problem/38214152>
1611
1612         Reviewed by Eric Carlson.
1613
1614         When dereferencing from libwebrtc code path, schedule a call to deref on main thread.
1615         WebCore dereferencing is happening in the main thread so this guarantees destruction on the main thread.
1616
1617         Covered by updated mock libwebrtc peer connection backend.
1618         We make mock senders to keep a reference to their source which are RealtimeOutgoingXXSource.
1619         We then make mock peer connection backend to free the mock senders in a background thread.
1620
1621         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1622         (WebCore::LibWebRTCPeerConnectionBackend::doStop):
1623         * platform/mediastream/RealtimeOutgoingAudioSource.cpp:
1624         (WebCore::RealtimeOutgoingAudioSource::stop):
1625         * platform/mediastream/RealtimeOutgoingAudioSource.h:
1626         * platform/mediastream/RealtimeOutgoingVideoSource.cpp:
1627         (WebCore::RealtimeOutgoingVideoSource::stop):
1628         * platform/mediastream/RealtimeOutgoingVideoSource.h:
1629         * testing/MockLibWebRTCPeerConnection.cpp:
1630         (WebCore::ThreadKeeper::create):
1631         (WebCore::ThreadKeeper::setThread):
1632         (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection):
1633         * testing/MockLibWebRTCPeerConnection.h:
1634
1635 2018-03-09  Jer Noble  <jer.noble@apple.com>
1636
1637         Unconditionalize more methods in VideoFullscreenInterface (and related classes)
1638         https://bugs.webkit.org/show_bug.cgi?id=183501
1639
1640         Reviewed by Eric Carlson.
1641
1642         No need for these methods to be PLATFORM(MAC) only.
1643
1644         * platform/cocoa/PlaybackSessionModel.h:
1645         (WebCore::PlaybackSessionModelClient::ensureControlsManager):
1646         * platform/ios/VideoFullscreenInterfaceAVKit.h:
1647         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
1648         (VideoFullscreenInterfaceAVKit::isPlayingVideoInEnhancedFullscreen const):
1649         * platform/mac/VideoFullscreenInterfaceMac.h:
1650
1651 2018-03-09  Youenn Fablet  <youenn@apple.com>
1652
1653         ServiceWorker should respect IDB and DOMCache partitioning
1654         https://bugs.webkit.org/show_bug.cgi?id=183496
1655
1656         Reviewed by Brady Eidson.
1657
1658         Test: http/wpt/service-workers/third-party-registration.html
1659
1660         Set the correct top origin of service worker ScriptExecutionContext.
1661
1662         * workers/service/context/ServiceWorkerThread.cpp:
1663         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
1664
1665 2018-03-09  Youenn Fablet  <youenn@apple.com>
1666
1667         Cannot change audio input source device
1668         https://bugs.webkit.org/show_bug.cgi?id=175975
1669         <rdar://problem/34073589>
1670
1671         Reviewed by Eric Carlson.
1672
1673         Covered by manually testing https://webrtc.github.io/samples/src/content/devices/input-output/ with a USB web cam.
1674
1675         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1676         (WebCore::CoreAudioSharedUnit::setCaptureDeviceID):
1677         (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
1678
1679 2018-03-09  Jer Noble  <jer.noble@apple.com>
1680
1681         Add new CSS env constants for use with fullscreen
1682         https://bugs.webkit.org/show_bug.cgi?id=183498
1683
1684         Reviewed by Dean Jackson.
1685
1686         Tests: fullscreen/fullscreen-auto-hide-delay.html
1687                fullscreen/fullscreen-inset-top.html
1688
1689         * dom/ConstantPropertyMap.cpp:
1690         (WebCore::ConstantPropertyMap::nameForProperty const):
1691         (WebCore::variableDataForPositiveDuration):
1692         (WebCore::ConstantPropertyMap::setFullscreenInsetTop):
1693         (WebCore::ConstantPropertyMap::setFullscreenAutoHideDelay):
1694         * dom/ConstantPropertyMap.h:
1695         * page/Page.cpp:
1696         (WebCore::Page::setFullscreenInsetTop):
1697         (WebCore::Page::setFullscreenAutoHideDelay):
1698         * page/Page.h:
1699         * testing/Internals.cpp:
1700         (WebCore::Internals::resetToConsistentState):
1701         (WebCore::Internals::setFullscreenInsetTop):
1702         (WebCore::Internals::setFullscreenAutoHideDelay):
1703         * testing/Internals.h:
1704         * testing/Internals.idl:
1705
1706 2018-03-09  Zalan Bujtas  <zalan@apple.com>
1707
1708         RenderTreeBuilder::splitAnonymousBoxesAroundChild should take multicolumn spanners into account.
1709         https://bugs.webkit.org/show_bug.cgi?id=183493
1710         <rdar://problem/38030461>
1711
1712         Reviewed by Antti Koivisto.
1713
1714         Multicolumn spanners are taken out of their original position and placed next
1715         to a RenderMultiColumnSet. splitAnonymousBoxesAroundChild needs to know the original parent (in the render tree context).
1716
1717         Test: fast/multicol/adjust-beforeChild-for-spanner-crash.html
1718
1719         * rendering/updating/RenderTreeBuilder.cpp:
1720         (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild):
1721         * rendering/updating/RenderTreeBuilder.h:
1722         * rendering/updating/RenderTreeBuilderBlock.cpp:
1723         (WebCore::RenderTreeBuilder::Block::attachIgnoringContinuation):
1724         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
1725         (WebCore::RenderTreeBuilder::MultiColumn::adjustBeforeChildForMultiColumnSpannerIfNeeded):
1726         * rendering/updating/RenderTreeBuilderMultiColumn.h:
1727         * rendering/updating/RenderTreeBuilderRuby.cpp:
1728         (WebCore::RenderTreeBuilder::Ruby::moveChildrenInternal):
1729         * rendering/updating/RenderTreeBuilderTable.cpp:
1730         (WebCore::RenderTreeBuilder::Table::attach):
1731
1732 2018-03-09  Jer Noble  <jer.noble@apple.com>
1733
1734         Add isPictureInPictureActive messaging across WebKit process boundary
1735         https://bugs.webkit.org/show_bug.cgi?id=183499
1736
1737         Reviewed by Eric Carlson.
1738
1739         * platform/cocoa/PlaybackSessionModel.h:
1740         (WebCore::PlaybackSessionModelClient::pictureInPictureActiveChanged):
1741         * platform/cocoa/PlaybackSessionModelMediaElement.h:
1742         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
1743         (WebCore::PlaybackSessionModelMediaElement::updateForEventName):
1744         (WebCore::PlaybackSessionModelMediaElement::isPictureInPictureActive const):
1745         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
1746         (VideoFullscreenControllerContext::isPictureInPictureActive const):
1747
1748 2018-03-09  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1749
1750         [Curl] Implement connection limit.
1751         https://bugs.webkit.org/show_bug.cgi?id=183016
1752
1753         Implement both connection limit per host and total
1754         connection limit on curl network layer.
1755
1756         Reviewed by Youenn Fablet.
1757
1758         No new tests because there's no behavior change.
1759
1760         * platform/network/curl/CurlContext.cpp:
1761         (WebCore::EnvironmentVariableReader::sscanTemplate<signed>):
1762         (WebCore::CurlContext::CurlContext):
1763         (WebCore::CurlMultiHandle::setMaxConnects):
1764         (WebCore::CurlMultiHandle::setMaxTotalConnections):
1765         (WebCore::CurlMultiHandle::setMaxHostConnections):
1766         * platform/network/curl/CurlContext.h:
1767         (WebCore::CurlContext::scheduler):
1768         * platform/network/curl/CurlRequest.cpp:
1769         (WebCore::CurlRequest::startWithJobManager):
1770         (WebCore::CurlRequest::cancel):
1771         (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
1772         (WebCore::CurlRequest::completeDidReceiveResponse):
1773         (WebCore::CurlRequest::pausedStatusChanged):
1774         * platform/network/curl/CurlRequestScheduler.cpp:
1775         (WebCore::CurlRequestScheduler::CurlRequestScheduler):
1776         (WebCore::CurlRequestScheduler::workerThread):
1777         (WebCore::CurlRequestScheduler::singleton): Deleted.
1778         * platform/network/curl/CurlRequestScheduler.h:
1779
1780 2018-03-09  Jer Noble  <jer.noble@apple.com>
1781
1782         webkitfullscreenchange event not fired at the same time as :-webkit-full-screen pseudo selector changes; causes glitchiness
1783         https://bugs.webkit.org/show_bug.cgi?id=183383
1784
1785         Reviewed by Eric Carlson.
1786
1787         Fire the webkitfullscreenchange event at the same time as the pseudo class selector changes, during the handling
1788         of webkitDidEnterFullScreenForElement. For WebKit2 clients, this is guaranteed to be asynchronous, since the
1789         calling method originates in the UIProcess. For WebKit1 clients (and WKTR and DRT), there's the possibility that
1790         webkitWillEnterFullScreenForElement will be called synchronously from within
1791         Document::requestFullScreenForElement(), so break that synchronousness by starting the
1792         ChromeClient::enterFullScreenForElement(...) process in a async task.
1793
1794         Previously, the firing of the fullscreenchange event was done through a zero-length timer. Use a
1795         GenericTaskQueue instead.
1796
1797         A number of layout tests depend on the behavior that the element will be in fullscreen when the 'playing' event
1798         fires. This was true for DRT (but not WKTR), since its fullscreen implementations were deliberately synchronous, but
1799         won't necessarily be true for all ports. Fix this in a subsequent patch.
1800
1801         * dom/Document.cpp:
1802         (WebCore::Document::requestFullScreenForElement):
1803         (WebCore::Document::webkitExitFullscreen):
1804         (WebCore::Document::webkitWillEnterFullScreenForElement):
1805         (WebCore::Document::webkitDidEnterFullScreenForElement):
1806         (WebCore::Document::webkitDidExitFullScreenForElement):
1807         (WebCore::Document::dispatchFullScreenChangeEvents):
1808         * dom/Document.h:
1809         * html/HTMLMediaElement.cpp:
1810         (WebCore::HTMLMediaElement::setReadyState):
1811         (WebCore::HTMLMediaElement::playInternal):
1812         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
1813         (WebCore::HTMLMediaElement::updatePlayState):
1814         (WebCore::HTMLMediaElement::setPlaying):
1815
1816 2018-03-09  Zan Dobersek  <zdobersek@igalia.com>
1817
1818         [Nicosia] Add threaded PaintingEngine implementation
1819         https://bugs.webkit.org/show_bug.cgi?id=183511
1820
1821         Reviewed by Carlos Garcia Campos.
1822
1823         Add Nicosia::PaintingEngineThreaded, class that internally uses a thread
1824         pool in which painting tasks are executed.
1825
1826         Implementation for now defaults to using GLib's GThreadPool, defaulting
1827         to 4 threads that are exclusive to this pool. These parameters should be
1828         fine-tuned in the future, or even made configurable, but are a solid
1829         basis for testing.
1830
1831         In PaintingEngineThreaded::paint(), PaintingContext implementation is
1832         used to record all the operations, and the gathered Vector is combined
1833         with the Buffer object and dispatched into the thread pool. In the
1834         thread function, the provided buffer and painting operations are run
1835         through the PaintingContext implementation, replaying all the operations
1836         on a painting context that draws into the given buffer.
1837
1838         The recorded operation objects implement the PaintingOperation interface
1839         contain all the data necessary to replay a given operation. They can be
1840         executed against a PaintingOperationReplay object, as is the case during
1841         PaintingContext::replay(), or they can be dumped into a TextStream
1842         object for debugging purposes.
1843
1844         PaintingContext now also provides the record() and replay() static
1845         functions. PaintingContext objects now differ per purpose, which can be
1846         either for painting or for recording. paint() and replay() use a
1847         for-painting PaintingContext, and record() uses a for-recording one.
1848         The for-painting PaintingContext receives a Buffer object, i.e. a memory
1849         area on which it can draw, while the for-recording PaintingContext uses
1850         the passed-in PaintingOperations Vector that should store all the
1851         recorded operations.
1852
1853         The current Cairo implementation of PaintingContext is moved into
1854         PaintingContextCairo::ForPainting. PaintingContextCairo::ForRecording is
1855         added but is currently no-op until a Cairo-specific GraphicsContextImpl
1856         with recording capabilities is added, allowing any call on the
1857         GraphicsContext object used in PaintingContext::record() to be recorded
1858         for later replay. PaintingOperationReplayCairo, inheriting from
1859         PaintingOperationReplay, will be used for replay purposes, providing
1860         only reference to the PlatformContextCairo object that is constructed in
1861         PaintingContextCairo::ForPainting.
1862
1863         The Cairo-specific GraphicsContextImpl implementation will be added in
1864         a separate patch. After that, PaintingEngine::create() will be modified
1865         so that the Nicosia::PaintingEngineThreaded implementation can be used
1866         for testing purposes, probably by setting an environment variable.
1867
1868         * platform/TextureMapper.cmake:
1869         * platform/graphics/nicosia/NicosiaPaintingContext.cpp:
1870         (Nicosia::PaintingContext::createForPainting):
1871         (Nicosia::PaintingContext::createForRecording):
1872         (Nicosia::PaintingContext::create): Deleted.
1873         * platform/graphics/nicosia/NicosiaPaintingContext.h:
1874         (Nicosia::PaintingContext::paint):
1875         (Nicosia::PaintingContext::record):
1876         (Nicosia::PaintingContext::replay):
1877         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp: Added.
1878         (Nicosia::s_threadFunc):
1879         (Nicosia::paintLayer):
1880         (Nicosia::PaintingEngineThreaded::PaintingEngineThreaded):
1881         (Nicosia::PaintingEngineThreaded::~PaintingEngineThreaded):
1882         (Nicosia::PaintingEngineThreaded::paint):
1883         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.h: Copied from Source/WebCore/platform/graphics/nicosia/NicosiaPaintingContext.cpp.
1884         * platform/graphics/nicosia/NicosiaPaintingOperation.h: Copied from Source/WebCore/platform/graphics/nicosia/NicosiaPaintingContext.cpp.
1885         * platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp:
1886         (Nicosia::PaintingContextCairo::ForPainting::ForPainting):
1887         (Nicosia::PaintingContextCairo::ForPainting::~ForPainting):
1888         (Nicosia::PaintingContextCairo::ForPainting::graphicsContext):
1889         (Nicosia::PaintingContextCairo::ForPainting::replay):
1890         (Nicosia::PaintingContextCairo::ForRecording::ForRecording):
1891         (Nicosia::PaintingContextCairo::ForRecording::graphicsContext):
1892         (Nicosia::PaintingContextCairo::ForRecording::replay):
1893         (Nicosia::PaintingContextCairo::PaintingContextCairo): Deleted.
1894         (Nicosia::PaintingContextCairo::~PaintingContextCairo): Deleted.
1895         (Nicosia::PaintingContextCairo::graphicsContext): Deleted.
1896         * platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.h:
1897         * platform/graphics/nicosia/cairo/NicosiaPaintingOperationReplayCairo.h: Copied from Source/WebCore/platform/graphics/nicosia/NicosiaPaintingContext.cpp.
1898         (Nicosia::PaintingOperationReplayCairo::PaintingOperationReplayCairo):
1899
1900 2018-03-09  Zan Dobersek  <zdobersek@igalia.com>
1901
1902         Remove some unused cruft in TextureMapperLayer.
1903
1904         The ScrollingClient class is not used anymore since r229318.
1905         findScrollableContentsLayerAt() is similarly unused, but also lacking
1906         an actual definition. ContentsLayerCount enum can also be purged.
1907
1908         Rubber-stamped by Carlos Garcia Campos.
1909
1910         * platform/graphics/texmap/TextureMapperLayer.h:
1911
1912 2018-03-08  Zan Dobersek  <zdobersek@igalia.com>
1913
1914         Add basic synchronization capability to Nicosia::Buffer
1915         https://bugs.webkit.org/show_bug.cgi?id=183500
1916
1917         Reviewed by Carlos Garcia Campos.
1918
1919         Have Nicosia::Buffer track a painting state, and allow that state to be
1920         modified and accessed from different threads. The PaintingState enum
1921         value is protected by a Lock object, and can be modified via the
1922         beginPainting() and completePainting() methods. Additionally, the
1923         waitUntilPaintingComplete() method allows the caller to wait until the
1924         painting is complete for the given Nicosia::Buffer object.
1925
1926         This added state doesn't affect a Nicosia::Buffer object internally, and
1927         doesn't have any effect on  existing usages of Nicosia::Buffer (which
1928         are not multi-threaded).
1929
1930         * platform/graphics/nicosia/NicosiaBuffer.cpp:
1931         (Nicosia::Buffer::beginPainting):
1932         (Nicosia::Buffer::completePainting):
1933         (Nicosia::Buffer::waitUntilPaintingComplete):
1934         * platform/graphics/nicosia/NicosiaBuffer.h:
1935
1936 2018-03-08  Zan Dobersek  <zdobersek@igalia.com>
1937
1938         Move NicosiaPaintingContextCairo files under Cairo-specific directory
1939         https://bugs.webkit.org/show_bug.cgi?id=183497
1940
1941         Reviewed by Carlos Garcia Campos.
1942
1943         Pack Cairo-specific files in the Nicosia subsystem under cairo/.
1944
1945         * platform/TextureMapper.cmake:
1946         * platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp: Renamed from Source/WebCore/platform/graphics/nicosia/NicosiaPaintingContextCairo.cpp.
1947         * platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.h: Renamed from Source/WebCore/platform/graphics/nicosia/NicosiaPaintingContextCairo.h.
1948
1949 2018-03-08  Nan Wang  <n_wang@apple.com>
1950
1951         AX: AOM: More accessibility events support
1952         https://bugs.webkit.org/show_bug.cgi?id=183023
1953         <rdar://problem/37764380>
1954
1955         Reviewed by Chris Fleizach.
1956
1957         Fixed the crash that we shouldn't dispatch the accessibility events if the
1958         event path is empty.
1959
1960         Also added a check to not dispatch events if the runtime flag is not enabled.
1961
1962         Test: accessibility/mac/AOM-events-webarea-crash.html
1963
1964         * accessibility/AccessibilityObject.cpp:
1965         (WebCore::AccessibilityObject::shouldDispatchAccessibilityEvent const):
1966         (WebCore::AccessibilityObject::dispatchAccessibilityEvent const):
1967         * accessibility/AccessibilityObject.h:
1968
1969 2018-03-08  Megan Gardner  <megan_gardner@apple.com>
1970
1971         Allow WebViews to disable system appearance
1972         https://bugs.webkit.org/show_bug.cgi?id=183418
1973         <rdar://problem/36975642>
1974
1975         Reviewed by Tim Horton.
1976
1977         Not currently testable, tests will be added in a later patch.
1978
1979         Allow webviews to choose whether or not to follow the default system appearance.
1980
1981         * css/StyleColor.cpp:
1982         (WebCore::StyleColor::colorFromKeyword):
1983         * css/StyleColor.h:
1984         * css/StyleResolver.cpp:
1985         (WebCore::StyleResolver::colorFromPrimitiveValue const):
1986         * css/parser/CSSParser.cpp:
1987         (WebCore::CSSParser::parseSystemColor):
1988         * css/parser/CSSParser.h:
1989         * css/parser/CSSParserMode.h:
1990         * html/canvas/CanvasRenderingContext2D.cpp:
1991         (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal):
1992         * html/canvas/CanvasRenderingContext2DBase.cpp:
1993         (WebCore::CanvasRenderingContext2DBase::setStrokeColor):
1994         (WebCore::CanvasRenderingContext2DBase::setFillColor):
1995         * html/canvas/CanvasStyle.cpp:
1996         (WebCore::parseColor):
1997         (WebCore::parseColorOrCurrentColor):
1998         (WebCore::CanvasStyle::createFromString):
1999         (WebCore::CanvasStyle::createFromStringWithOverrideAlpha):
2000         * html/canvas/CanvasStyle.h:
2001         * page/Page.h:
2002         (WebCore::Page::useSystemAppearance const):
2003         (WebCore::Page::setUseSystemAppearance):
2004         * platform/Theme.cpp:
2005         (WebCore::Theme::paint):
2006         * platform/Theme.h:
2007         * platform/mac/LocalDefaultSystemAppearance.h:
2008         * platform/mac/LocalDefaultSystemAppearance.mm:
2009         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
2010         (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance):
2011         * platform/mac/ThemeMac.h:
2012         * platform/mac/ThemeMac.mm:
2013         (-[WebCoreThemeView initWithUseSystemAppearance:]):
2014         (WebCore::paintToggleButton):
2015         (WebCore::paintButton):
2016         (WebCore::ThemeMac::ensuredView):
2017         (WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext):
2018         (WebCore::ThemeMac::paint):
2019         (-[WebCoreThemeView init]): Deleted.
2020         * rendering/RenderTheme.cpp:
2021         (WebCore::RenderTheme::paint):
2022         (WebCore::RenderTheme::systemColor const):
2023         (WebCore::RenderTheme::focusRingColor):
2024         * rendering/RenderTheme.h:
2025         (WebCore::RenderTheme::platformFocusRingColor const):
2026         * rendering/RenderThemeIOS.mm:
2027         (WebCore::RenderThemeIOS::systemColor const):
2028         * rendering/RenderThemeMac.h:
2029         * rendering/RenderThemeMac.mm:
2030         (WebCore::RenderThemeMac::documentViewFor const):
2031         (WebCore::RenderThemeMac::platformFocusRingColor const):
2032         (WebCore::RenderThemeMac::systemColor const):
2033         (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary):
2034         (WebCore::RenderThemeMac::paintSliderThumb):
2035         * rendering/TextPaintStyle.cpp:
2036         (WebCore::computeTextPaintStyle):
2037
2038 2018-03-08  Megan Gardner  <megan_gardner@apple.com>
2039
2040         Ensure default appearance for selection form control
2041         https://bugs.webkit.org/show_bug.cgi?id=183482
2042         <rdar://problem/38274894>
2043
2044         Reviewed by Tim Horton.
2045   
2046         The appearance for selection form controls was not set to default.
2047
2048         Not currently testable, will add tests in a later patch.
2049
2050         * rendering/RenderThemeMac.mm:
2051         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const):
2052
2053 2018-03-08  Per Arne Vollan  <pvollan@apple.com>
2054
2055         [Win] Compile error: pal/ExportMacros.h not found.
2056         https://bugs.webkit.org/show_bug.cgi?id=183467
2057
2058         Reviewed by Brent Fulgham.
2059
2060         PAL header files are no longer located under the WebCore folder in forwarding headers. An additional
2061         build step is required to copy the PAL header files to the internal include folder.
2062
2063         No new tests, no change in functionality. 
2064
2065         * PlatformWin.cmake:
2066         * WebCore.vcxproj/WebCore.proj:
2067
2068 2018-03-08  Megan Gardner  <megan_gardner@apple.com>
2069
2070         Ensure system appearance is default for legacy webkit
2071         https://bugs.webkit.org/show_bug.cgi?id=183473
2072         <rdar://problem/38210306>
2073
2074         Reviewed by Tim Horton.
2075
2076         Need to set the appearance on the window for legacy webkit due to differences in drawing.
2077
2078         Not currently testable, will add tests in a later patch.
2079
2080         * platform/mac/ThemeMac.mm:
2081         (WebCore::paintButton):
2082
2083 2018-03-08  Youenn Fablet  <youenn@apple.com>
2084
2085         libwebrtc update broke internal builds
2086         https://bugs.webkit.org/show_bug.cgi?id=183454
2087
2088         Reviewed by Eric Carlson.
2089
2090         No change of behavior.
2091         Fixed header search paths.
2092         Removed deleted file from XCode project as an additional clean-up.
2093
2094         * Configurations/WebCore.xcconfig:
2095         * WebCore.xcodeproj/project.pbxproj:
2096
2097 2018-03-08  Per Arne Vollan  <pvollan@apple.com>
2098
2099         NSAnimation is not working in the WebContent process when WindowServer access is blocked.
2100         https://bugs.webkit.org/show_bug.cgi?id=183291
2101
2102         Reviewed by Dean Jackson.
2103
2104         The animation can be implemented by using an NSTimer instead. Use the existing Bezier timing
2105         function to create a smooth animation.
2106
2107         No new tests. This code is used to fade scrollbars in and out by animating the alpha value.
2108         This scrollbar setting is not the default in macOS, which makes it non trivial to create
2109         layout tests for this.
2110
2111         * platform/mac/ScrollAnimatorMac.mm:
2112         (-[WebScrollbarPartAnimation initWithScrollbar:featureToAnimate:animateFrom:animateTo:duration:]):
2113         (-[WebScrollbarPartAnimation startAnimation]):
2114         (-[WebScrollbarPartAnimation setCurrentProgress:setCurrentProgress:]):
2115         (-[WebScrollbarPartAnimation invalidate]):
2116         (-[WebScrollbarPartAnimation setDuration:]):
2117         (-[WebScrollbarPartAnimation stopAnimation]):
2118         (-[WebScrollbarPartAnimation setCurrentProgress:]): Deleted.
2119
2120 2018-03-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
2121
2122         Templatize SVGAnimatedType
2123         https://bugs.webkit.org/show_bug.cgi?id=183017
2124
2125         Reviewed by Dean Jackson.
2126
2127         This is a work toward https://bugs.webkit.org/show_bug.cgi?id=168586. The
2128         goal to have SVGAnimatedType be type independent. The appropriate method
2129         of this template will be implicitly instantiated based to the type of the
2130         animated attribute(s).
2131
2132         * Sources.txt: Delete SVGAnimatedType.cpp since its function became template
2133         functions or short enough to be inline functions.
2134         * WebCore.xcodeproj/project.pbxproj:
2135         * svg/SVGAnimatedAngle.cpp:
2136         (WebCore::SVGAnimatedAngleAnimator::constructFromString):
2137         (WebCore::SVGAnimatedAngleAnimator::startAnimValAnimation):
2138         (WebCore::SVGAnimatedAngleAnimator::resetAnimValToBaseVal):
2139         (WebCore::SVGAnimatedAngleAnimator::addAnimatedTypes):
2140         (WebCore::SVGAnimatedAngleAnimator::calculateAnimatedValue):
2141         Use the template functions SVGAnimatedType::create<>() and SVGAnimatedType::as<>().
2142
2143         * svg/SVGAnimatedBoolean.cpp:
2144         (WebCore::SVGAnimatedBooleanAnimator::constructFromString):
2145         (WebCore::SVGAnimatedBooleanAnimator::startAnimValAnimation):
2146         (WebCore::SVGAnimatedBooleanAnimator::resetAnimValToBaseVal):
2147         (WebCore::SVGAnimatedBooleanAnimator::calculateAnimatedValue):
2148         Ditto.
2149
2150         * svg/SVGAnimatedColor.cpp:
2151         (WebCore::SVGAnimatedColorAnimator::constructFromString):
2152         (WebCore::SVGAnimatedColorAnimator::addAnimatedTypes):
2153         (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue):
2154         Ditto.
2155
2156         * svg/SVGAnimatedEnumeration.cpp:
2157         (WebCore::SVGAnimatedEnumerationAnimator::constructFromString):
2158         (WebCore::SVGAnimatedEnumerationAnimator::startAnimValAnimation):
2159         (WebCore::SVGAnimatedEnumerationAnimator::resetAnimValToBaseVal):
2160         (WebCore::SVGAnimatedEnumerationAnimator::calculateAnimatedValue):
2161         Ditto.
2162
2163         * svg/SVGAnimatedInteger.cpp:
2164         (WebCore::SVGAnimatedIntegerAnimator::constructFromString):
2165         (WebCore::SVGAnimatedIntegerAnimator::startAnimValAnimation):
2166         (WebCore::SVGAnimatedIntegerAnimator::resetAnimValToBaseVal):
2167         (WebCore::SVGAnimatedIntegerAnimator::addAnimatedTypes):
2168         (WebCore::SVGAnimatedIntegerAnimator::calculateAnimatedValue):
2169         Ditto.
2170
2171         * svg/SVGAnimatedIntegerOptionalInteger.cpp:
2172         (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString):
2173         (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::startAnimValAnimation):
2174         (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::resetAnimValToBaseVal):
2175         (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::addAnimatedTypes):
2176         (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::calculateAnimatedValue):
2177         Ditto.
2178
2179         * svg/SVGAnimatedLength.cpp:
2180         (WebCore::SVGAnimatedLengthAnimator::constructFromString):
2181         (WebCore::SVGAnimatedLengthAnimator::startAnimValAnimation):
2182         (WebCore::SVGAnimatedLengthAnimator::resetAnimValToBaseVal):
2183         (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes):
2184         (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue):
2185         Ditto.
2186
2187         * svg/SVGAnimatedLengthList.cpp:
2188         (WebCore::SVGAnimatedLengthListAnimator::constructFromString):
2189         (WebCore::SVGAnimatedLengthListAnimator::startAnimValAnimation):
2190         (WebCore::SVGAnimatedLengthListAnimator::resetAnimValToBaseVal):
2191         (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes):
2192         (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue):
2193         Ditto.
2194
2195         * svg/SVGAnimatedNumber.cpp:
2196         (WebCore::SVGAnimatedNumberAnimator::constructFromString):
2197         (WebCore::SVGAnimatedNumberAnimator::startAnimValAnimation):
2198         (WebCore::SVGAnimatedNumberAnimator::resetAnimValToBaseVal):
2199         (WebCore::SVGAnimatedNumberAnimator::addAnimatedTypes):
2200         (WebCore::SVGAnimatedNumberAnimator::calculateAnimatedValue):
2201         Ditto.
2202
2203         * svg/SVGAnimatedNumberList.cpp:
2204         (WebCore::SVGAnimatedNumberListAnimator::constructFromString):
2205         (WebCore::SVGAnimatedNumberListAnimator::startAnimValAnimation):
2206         (WebCore::SVGAnimatedNumberListAnimator::resetAnimValToBaseVal):
2207         (WebCore::SVGAnimatedNumberListAnimator::addAnimatedTypes):
2208         (WebCore::SVGAnimatedNumberListAnimator::calculateAnimatedValue):
2209         Ditto.
2210
2211         * svg/SVGAnimatedNumberOptionalNumber.cpp:
2212         (WebCore::SVGAnimatedNumberOptionalNumberAnimator::constructFromString):
2213         (WebCore::SVGAnimatedNumberOptionalNumberAnimator::startAnimValAnimation):
2214         (WebCore::SVGAnimatedNumberOptionalNumberAnimator::resetAnimValToBaseVal):
2215         (WebCore::SVGAnimatedNumberOptionalNumberAnimator::addAnimatedTypes):
2216         (WebCore::SVGAnimatedNumberOptionalNumberAnimator::calculateAnimatedValue):
2217         Ditto.
2218
2219         * svg/SVGAnimatedPath.cpp:
2220         (WebCore::SVGAnimatedPathAnimator::constructFromString):
2221         (WebCore::SVGAnimatedPathAnimator::startAnimValAnimation):
2222         (WebCore::SVGAnimatedPathAnimator::resetAnimValToBaseVal):
2223         (WebCore::SVGAnimatedPathAnimator::addAnimatedTypes):
2224         (WebCore::SVGAnimatedPathAnimator::calculateAnimatedValue):
2225         Ditto.
2226
2227         * svg/SVGAnimatedPointList.cpp:
2228         (WebCore::SVGAnimatedPointListAnimator::constructFromString):
2229         (WebCore::SVGAnimatedPointListAnimator::startAnimValAnimation):
2230         (WebCore::SVGAnimatedPointListAnimator::resetAnimValToBaseVal):
2231         (WebCore::SVGAnimatedPointListAnimator::addAnimatedTypes):
2232         (WebCore::SVGAnimatedPointListAnimator::calculateAnimatedValue):
2233         Ditto.
2234
2235         * svg/SVGAnimatedPreserveAspectRatio.cpp:
2236         (WebCore::SVGAnimatedPreserveAspectRatioAnimator::constructFromString):
2237         (WebCore::SVGAnimatedPreserveAspectRatioAnimator::startAnimValAnimation):
2238         (WebCore::SVGAnimatedPreserveAspectRatioAnimator::resetAnimValToBaseVal):
2239         (WebCore::SVGAnimatedPreserveAspectRatioAnimator::calculateAnimatedValue):
2240         Ditto.
2241
2242         * svg/SVGAnimatedRect.cpp:
2243         (WebCore::SVGAnimatedRectAnimator::constructFromString):
2244         (WebCore::SVGAnimatedRectAnimator::startAnimValAnimation):
2245         (WebCore::SVGAnimatedRectAnimator::resetAnimValToBaseVal):
2246         (WebCore::SVGAnimatedRectAnimator::addAnimatedTypes):
2247         (WebCore::SVGAnimatedRectAnimator::calculateAnimatedValue):
2248         Ditto.
2249
2250         * svg/SVGAnimatedString.cpp:
2251         (WebCore::SVGAnimatedStringAnimator::constructFromString):
2252         (WebCore::SVGAnimatedStringAnimator::startAnimValAnimation):
2253         (WebCore::SVGAnimatedStringAnimator::resetAnimValToBaseVal):
2254         (WebCore::SVGAnimatedStringAnimator::calculateAnimatedValue):
2255         Ditto.
2256
2257         * svg/SVGAnimatedTransformList.cpp:
2258         (WebCore::SVGAnimatedTransformListAnimator::constructFromString):
2259         (WebCore::SVGAnimatedTransformListAnimator::startAnimValAnimation):
2260         (WebCore::SVGAnimatedTransformListAnimator::resetAnimValToBaseVal):
2261         (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes):
2262         (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue):
2263         (WebCore::SVGAnimatedTransformListAnimator::calculateDistance):
2264         Ditto.
2265
2266         * svg/SVGAnimatedType.cpp: Removed.
2267         * svg/SVGAnimatedType.h:
2268         (WebCore::SVGAnimatedType::create):
2269         (WebCore::SVGAnimatedType::SVGAnimatedType):
2270         (WebCore::SVGAnimatedType::~SVGAnimatedType):
2271         (WebCore::SVGAnimatedType::as const):
2272         (WebCore::SVGAnimatedType::as):
2273         (WebCore::SVGAnimatedType::type const):
2274         (WebCore::SVGAnimatedType::valueAsString const):
2275         (WebCore::SVGAnimatedType::setValueAsString):
2276         (WebCore::SVGAnimatedType::supportsAnimVal):
2277         (WebCore::SVGAnimatedType::angleAndEnumeration const): Deleted.
2278         (WebCore::SVGAnimatedType::boolean const): Deleted.
2279         (WebCore::SVGAnimatedType::color const): Deleted.
2280         (WebCore::SVGAnimatedType::enumeration const): Deleted.
2281         (WebCore::SVGAnimatedType::integer const): Deleted.
2282         (WebCore::SVGAnimatedType::integerOptionalInteger const): Deleted.
2283         (WebCore::SVGAnimatedType::length const): Deleted.
2284         (WebCore::SVGAnimatedType::lengthList const): Deleted.
2285         (WebCore::SVGAnimatedType::number const): Deleted.
2286         (WebCore::SVGAnimatedType::numberList const): Deleted.
2287         (WebCore::SVGAnimatedType::numberOptionalNumber const): Deleted.
2288         (WebCore::SVGAnimatedType::path const): Deleted.
2289         (WebCore::SVGAnimatedType::pointList const): Deleted.
2290         (WebCore::SVGAnimatedType::preserveAspectRatio const): Deleted.
2291         (WebCore::SVGAnimatedType::rect const): Deleted.
2292         (WebCore::SVGAnimatedType::string const): Deleted.
2293         (WebCore::SVGAnimatedType::transformList const): Deleted.
2294         (WebCore::SVGAnimatedType::angleAndEnumeration): Deleted.
2295         (WebCore::SVGAnimatedType::boolean): Deleted.
2296         (WebCore::SVGAnimatedType::color): Deleted.
2297         (WebCore::SVGAnimatedType::enumeration): Deleted.
2298         (WebCore::SVGAnimatedType::integer): Deleted.
2299         (WebCore::SVGAnimatedType::integerOptionalInteger): Deleted.
2300         (WebCore::SVGAnimatedType::length): Deleted.
2301         (WebCore::SVGAnimatedType::lengthList): Deleted.
2302         (WebCore::SVGAnimatedType::number): Deleted.
2303         (WebCore::SVGAnimatedType::numberList): Deleted.
2304         (WebCore::SVGAnimatedType::numberOptionalNumber): Deleted.
2305         (WebCore::SVGAnimatedType::path): Deleted.
2306         (WebCore::SVGAnimatedType::pointList): Deleted.
2307         (WebCore::SVGAnimatedType::preserveAspectRatio): Deleted.
2308         (WebCore::SVGAnimatedType::rect): Deleted.
2309         (WebCore::SVGAnimatedType::string): Deleted.
2310         (WebCore::SVGAnimatedType::transformList): Deleted.
2311         Replace the union by a Variant. Replace all the type specific functions
2312         by the template functions create() and as(). Use WTF::visit to get the
2313         value stored in the variant. Use the SVGPropertyTraits to perform the
2314         required operation.
2315
2316         * svg/SVGAnimatedTypeAnimator.h:
2317         (WebCore::SVGAnimatedTypeAnimator::constructFromBaseValue):
2318         (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValue):
2319         (WebCore::SVGAnimatedTypeAnimator::stopAnimValAnimationForType):
2320         (WebCore::SVGAnimatedTypeAnimator::animValDidChangeForType):
2321         (WebCore::SVGAnimatedTypeAnimator::animValWillChangeForType):
2322         (WebCore::SVGAnimatedTypeAnimator::constructFromBaseValues):
2323         (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValues):
2324         (WebCore::SVGAnimatedTypeAnimator::stopAnimValAnimationForTypes):
2325         (WebCore::SVGAnimatedTypeAnimator::animValDidChangeForTypes):
2326         (WebCore::SVGAnimatedTypeAnimator::animValWillChangeForTypes):
2327         (WebCore::SVGAnimatedTypeAnimator::executeAction):
2328         Rename the parameters and the local variables to match their types. Use
2329         the SVGAnimatedType template functions create() and as().
2330
2331         * svg/SVGLengthValue.h:
2332         (WebCore::SVGPropertyTraits<SVGLengthValue>::parse): This was moved from
2333         SVGAnimatedType::setValueAsString()
2334         (WebCore::SVGPropertyTraits<SVGLengthValue>::toString): This was moved from
2335         SVGAnimatedType::valueAsString().
2336
2337         * svg/SVGMarkerTypes.h: Add placeholders for parse() and toString() so
2338         SVGAnimatedType::valueAsString() and setValueAsString() can compile for 
2339         all types.
2340
2341         * svg/SVGNumberListValues.h:
2342         (WebCore::SVGPropertyTraits<SVGNumberListValues>::parse):
2343         * svg/SVGPathByteStream.h:
2344         (WebCore::SVGPropertyTraits<SVGPathByteStream>::parse):
2345         (WebCore::SVGPropertyTraits<SVGPathByteStream>::toString):
2346         * svg/SVGPointListValues.h:
2347         (WebCore::SVGPropertyTraits<SVGPointListValues>::parse):
2348         (WebCore::SVGPropertyTraits<SVGPointListValues>::toString):
2349         * svg/SVGPreserveAspectRatioValue.h:
2350         (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::fromString):
2351         (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::parse):
2352         (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::toString):
2353         Ditto.
2354
2355         * svg/SVGTransformListValues.h:
2356         (WebCore::SVGPropertyTraits<SVGTransformListValues>::parse):
2357         Ditto.
2358
2359         * svg/SVGValue.h: Added. SVGValueVariant is the replacement of the union
2360         SVGAnimatedType::DataUnion.
2361
2362         * svg/properties/SVGPropertyInfo.h:
2363         Add a minimum and maximum AnimatedPropertyType so, SVGAnimatedType::type()
2364         can assert that the index of the variant is in the range of this enum.
2365
2366         * svg/properties/SVGPropertyTraits.h:
2367         (WebCore::SVGPropertyTraits<bool>::parse):
2368         (WebCore::SVGPropertyTraits<unsigned>::parse):
2369         (WebCore::SVGPropertyTraits<int>::parse):
2370         Ditto.
2371
2372 2018-03-08  Yusuke Suzuki  <utatane.tea@gmail.com>
2373
2374         [JSC][WebCore] Extend jsDynamicCast for WebCore types in WebCore and remove jsDynamicDowncast
2375         https://bugs.webkit.org/show_bug.cgi?id=183449
2376
2377         Reviewed by Mark Lam.
2378
2379         This patch removes jsDynamicDowncast. Our JSC::jsDynamicCast can have a way to inject a fast
2380         path that is similar to jsDynamicDowncast. WebCore can leverage this functionality to add
2381         a fast path for WebCore's extended JS object types (JSEvent, JSElement, JSNode, and JSDocument).
2382
2383         No behavior change.
2384
2385         * WebCore.xcodeproj/project.pbxproj:
2386         * bindings/js/CommonVM.cpp:
2387         (WebCore::lexicalFrameFromCommonVM):
2388         * bindings/js/JSDOMConvertBufferSource.h:
2389         (WebCore::toPossiblySharedArrayBufferView):
2390         * bindings/js/JSDOMConvertPromise.h:
2391         (WebCore::Converter<IDLPromise<T>>::convert):
2392         * bindings/js/JSDOMExceptionHandling.cpp:
2393         (WebCore::reportException):
2394         (WebCore::retrieveErrorMessage):
2395         * bindings/js/JSDOMIterator.h:
2396         (WebCore::IteratorTraits>::next):
2397         * bindings/js/JSDOMWindowProxy.cpp:
2398         (WebCore::JSDOMWindowProxy::toWrapped):
2399         * bindings/js/JSDOMWrapperCache.h:
2400         * bindings/js/JSDocumentCustom.h:
2401         (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSDocument>::inherits):
2402         (WebCore::jsDocumentCast): Deleted.
2403         * bindings/js/JSDynamicDowncast.h: Removed.
2404         * bindings/js/JSElementCustom.h:
2405         (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSElement>::inherits):
2406         (WebCore::jsElementCast): Deleted.
2407         * bindings/js/JSEventCustom.h:
2408         (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSEvent>::inherits):
2409         (WebCore::jsEventCast): Deleted.
2410         * bindings/js/JSEventTargetCustom.cpp:
2411         (WebCore::jsEventTargetCast):
2412         * bindings/js/JSNodeCustom.h:
2413         (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSNode>::inherits):
2414         (WebCore::jsNodeCast): Deleted.
2415         * bindings/js/JSPluginElementFunctions.cpp:
2416         (WebCore::pluginElementPropertyGetter):
2417         * bindings/js/JSReadableStreamSourceCustom.cpp:
2418         (WebCore::JSReadableStreamSource::start):
2419         * bindings/js/JSWorkerGlobalScopeBase.cpp:
2420         (WebCore::toJSDedicatedWorkerGlobalScope):
2421         (WebCore::toJSWorkerGlobalScope):
2422         (WebCore::toJSServiceWorkerGlobalScope):
2423         * bindings/js/ReadableStream.cpp:
2424         (WebCore::ReadableStream::create):
2425         (WebCore::ReadableStream::isDisturbed):
2426         * bindings/js/ReadableStream.h:
2427         (WebCore::JSReadableStreamWrapperConverter::toWrapped):
2428         * bindings/js/ScriptModuleLoader.cpp:
2429         (WebCore::ScriptModuleLoader::evaluate):
2430         * bindings/js/SerializedScriptValue.cpp:
2431         (WebCore::CloneSerializer::dumpIfTerminal):
2432         (WebCore::CloneSerializer::serialize):
2433         * bindings/js/StructuredClone.cpp:
2434         (WebCore::structuredCloneArrayBufferView):
2435         * bindings/scripts/CodeGeneratorJS.pm:
2436         (GetCastingHelperForThisObject):
2437         (GenerateImplementation):
2438         * bindings/scripts/test/JS/JSInterfaceName.cpp:
2439         (WebCore::jsInterfaceNameConstructor):
2440         (WebCore::setJSInterfaceNameConstructor):
2441         (WebCore::JSInterfaceName::toWrapped):
2442         * bindings/scripts/test/JS/JSMapLike.cpp:
2443         (WebCore::IDLAttribute<JSMapLike>::cast):
2444         (WebCore::IDLOperation<JSMapLike>::cast):
2445         (WebCore::jsMapLikeConstructor):
2446         (WebCore::setJSMapLikeConstructor):
2447         (WebCore::JSMapLike::toWrapped):
2448         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
2449         (WebCore::IDLAttribute<JSReadOnlyMapLike>::cast):
2450         (WebCore::IDLOperation<JSReadOnlyMapLike>::cast):
2451         (WebCore::jsReadOnlyMapLikeConstructor):
2452         (WebCore::setJSReadOnlyMapLikeConstructor):
2453         (WebCore::JSReadOnlyMapLike::toWrapped):
2454         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
2455         (WebCore::IDLAttribute<JSTestActiveDOMObject>::cast):
2456         (WebCore::IDLOperation<JSTestActiveDOMObject>::cast):
2457         (WebCore::jsTestActiveDOMObjectConstructor):
2458         (WebCore::setJSTestActiveDOMObjectConstructor):
2459         (WebCore::JSTestActiveDOMObject::toWrapped):
2460         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
2461         (WebCore::IDLAttribute<JSTestCEReactions>::cast):
2462         (WebCore::IDLOperation<JSTestCEReactions>::cast):
2463         (WebCore::jsTestCEReactionsConstructor):
2464         (WebCore::setJSTestCEReactionsConstructor):
2465         (WebCore::JSTestCEReactions::toWrapped):
2466         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
2467         (WebCore::IDLAttribute<JSTestCEReactionsStringifier>::cast):
2468         (WebCore::IDLOperation<JSTestCEReactionsStringifier>::cast):
2469         (WebCore::jsTestCEReactionsStringifierConstructor):
2470         (WebCore::setJSTestCEReactionsStringifierConstructor):
2471         (WebCore::JSTestCEReactionsStringifier::toWrapped):
2472         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
2473         (WebCore::IDLAttribute<JSTestCallTracer>::cast):
2474         (WebCore::IDLOperation<JSTestCallTracer>::cast):
2475         (WebCore::jsTestCallTracerConstructor):
2476         (WebCore::setJSTestCallTracerConstructor):
2477         (WebCore::JSTestCallTracer::toWrapped):
2478         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
2479         (WebCore::jsTestClassWithJSBuiltinConstructorConstructor):
2480         (WebCore::setJSTestClassWithJSBuiltinConstructorConstructor):
2481         (WebCore::JSTestClassWithJSBuiltinConstructor::toWrapped):
2482         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
2483         (WebCore::jsTestCustomConstructorWithNoInterfaceObjectConstructor):
2484         (WebCore::setJSTestCustomConstructorWithNoInterfaceObjectConstructor):
2485         (WebCore::JSTestCustomConstructorWithNoInterfaceObject::toWrapped):
2486         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
2487         (WebCore::IDLAttribute<JSTestDOMJIT>::cast):
2488         (WebCore::IDLOperation<JSTestDOMJIT>::cast):
2489         (WebCore::jsTestDOMJITConstructor):
2490         (WebCore::setJSTestDOMJITConstructor):
2491         * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
2492         (WebCore::IDLAttribute<JSTestEnabledBySetting>::cast):
2493         (WebCore::IDLOperation<JSTestEnabledBySetting>::cast):
2494         (WebCore::jsTestEnabledBySettingConstructor):
2495         (WebCore::setJSTestEnabledBySettingConstructor):
2496         (WebCore::JSTestEnabledBySetting::toWrapped):
2497         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
2498         (WebCore::IDLAttribute<JSTestEventConstructor>::cast):
2499         (WebCore::jsTestEventConstructorConstructor):
2500         (WebCore::setJSTestEventConstructorConstructor):
2501         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
2502         (WebCore::IDLOperation<JSTestEventTarget>::cast):
2503         (WebCore::jsTestEventTargetConstructor):
2504         (WebCore::setJSTestEventTargetConstructor):
2505         (WebCore::JSTestEventTarget::toWrapped):
2506         * bindings/scripts/test/JS/JSTestException.cpp:
2507         (WebCore::IDLAttribute<JSTestException>::cast):
2508         (WebCore::jsTestExceptionConstructor):
2509         (WebCore::setJSTestExceptionConstructor):
2510         (WebCore::JSTestException::toWrapped):
2511         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
2512         (WebCore::IDLAttribute<JSTestGenerateIsReachable>::cast):
2513         (WebCore::jsTestGenerateIsReachableConstructor):
2514         (WebCore::setJSTestGenerateIsReachableConstructor):
2515         (WebCore::JSTestGenerateIsReachable::toWrapped):
2516         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2517         (WebCore::IDLAttribute<JSTestGlobalObject>::cast):
2518         (WebCore::IDLOperation<JSTestGlobalObject>::cast):
2519         (WebCore::jsTestGlobalObjectConstructor):
2520         (WebCore::setJSTestGlobalObjectConstructor):
2521         (WebCore::JSTestGlobalObject::toWrapped):
2522         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
2523         (WebCore::jsTestIndexedSetterNoIdentifierConstructor):
2524         (WebCore::setJSTestIndexedSetterNoIdentifierConstructor):
2525         (WebCore::JSTestIndexedSetterNoIdentifier::toWrapped):
2526         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
2527         (WebCore::jsTestIndexedSetterThrowingExceptionConstructor):
2528         (WebCore::setJSTestIndexedSetterThrowingExceptionConstructor):
2529         (WebCore::JSTestIndexedSetterThrowingException::toWrapped):
2530         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
2531         (WebCore::IDLOperation<JSTestIndexedSetterWithIdentifier>::cast):
2532         (WebCore::jsTestIndexedSetterWithIdentifierConstructor):
2533         (WebCore::setJSTestIndexedSetterWithIdentifierConstructor):
2534         (WebCore::JSTestIndexedSetterWithIdentifier::toWrapped):
2535         * bindings/scripts/test/JS/JSTestInterface.cpp:
2536         (WebCore::IDLAttribute<JSTestInterface>::cast):
2537         (WebCore::IDLOperation<JSTestInterface>::cast):
2538         (WebCore::jsTestInterfaceConstructor):
2539         (WebCore::setJSTestInterfaceConstructor):
2540         (WebCore::JSTestInterface::toWrapped):
2541         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
2542         (WebCore::IDLAttribute<JSTestInterfaceLeadingUnderscore>::cast):
2543         (WebCore::jsTestInterfaceLeadingUnderscoreConstructor):
2544         (WebCore::setJSTestInterfaceLeadingUnderscoreConstructor):
2545         (WebCore::JSTestInterfaceLeadingUnderscore::toWrapped):
2546         * bindings/scripts/test/JS/JSTestIterable.cpp:
2547         (WebCore::IDLOperation<JSTestIterable>::cast):
2548         (WebCore::jsTestIterableConstructor):
2549         (WebCore::setJSTestIterableConstructor):
2550         (WebCore::JSTestIterable::toWrapped):
2551         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
2552         (WebCore::IDLAttribute<JSTestJSBuiltinConstructor>::cast):
2553         (WebCore::IDLOperation<JSTestJSBuiltinConstructor>::cast):
2554         (WebCore::jsTestJSBuiltinConstructorConstructor):
2555         (WebCore::setJSTestJSBuiltinConstructorConstructor):
2556         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
2557         (WebCore::IDLOperation<JSTestMediaQueryListListener>::cast):
2558         (WebCore::jsTestMediaQueryListListenerConstructor):
2559         (WebCore::setJSTestMediaQueryListListenerConstructor):
2560         (WebCore::JSTestMediaQueryListListener::toWrapped):
2561         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
2562         (WebCore::jsTestNamedAndIndexedSetterNoIdentifierConstructor):
2563         (WebCore::setJSTestNamedAndIndexedSetterNoIdentifierConstructor):
2564         (WebCore::JSTestNamedAndIndexedSetterNoIdentifier::toWrapped):
2565         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
2566         (WebCore::jsTestNamedAndIndexedSetterThrowingExceptionConstructor):
2567         (WebCore::setJSTestNamedAndIndexedSetterThrowingExceptionConstructor):
2568         (WebCore::JSTestNamedAndIndexedSetterThrowingException::toWrapped):
2569         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
2570         (WebCore::IDLOperation<JSTestNamedAndIndexedSetterWithIdentifier>::cast):
2571         (WebCore::jsTestNamedAndIndexedSetterWithIdentifierConstructor):
2572         (WebCore::setJSTestNamedAndIndexedSetterWithIdentifierConstructor):
2573         (WebCore::JSTestNamedAndIndexedSetterWithIdentifier::toWrapped):
2574         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
2575         (WebCore::jsTestNamedConstructorConstructor):
2576         (WebCore::setJSTestNamedConstructorConstructor):
2577         (WebCore::JSTestNamedConstructor::toWrapped):
2578         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
2579         (WebCore::jsTestNamedDeleterNoIdentifierConstructor):
2580         (WebCore::setJSTestNamedDeleterNoIdentifierConstructor):
2581         (WebCore::JSTestNamedDeleterNoIdentifier::toWrapped):
2582         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
2583         (WebCore::jsTestNamedDeleterThrowingExceptionConstructor):
2584         (WebCore::setJSTestNamedDeleterThrowingExceptionConstructor):
2585         (WebCore::JSTestNamedDeleterThrowingException::toWrapped):
2586         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
2587         (WebCore::IDLOperation<JSTestNamedDeleterWithIdentifier>::cast):
2588         (WebCore::jsTestNamedDeleterWithIdentifierConstructor):
2589         (WebCore::setJSTestNamedDeleterWithIdentifierConstructor):
2590         (WebCore::JSTestNamedDeleterWithIdentifier::toWrapped):
2591         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
2592         (WebCore::jsTestNamedDeleterWithIndexedGetterConstructor):
2593         (WebCore::setJSTestNamedDeleterWithIndexedGetterConstructor):
2594         (WebCore::JSTestNamedDeleterWithIndexedGetter::toWrapped):
2595         * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp:
2596         (WebCore::jsTestNamedGetterCallWithConstructor):
2597         (WebCore::setJSTestNamedGetterCallWithConstructor):
2598         (WebCore::JSTestNamedGetterCallWith::toWrapped):
2599         * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp:
2600         (WebCore::jsTestNamedGetterNoIdentifierConstructor):
2601         (WebCore::setJSTestNamedGetterNoIdentifierConstructor):
2602         (WebCore::JSTestNamedGetterNoIdentifier::toWrapped):
2603         * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
2604         (WebCore::IDLOperation<JSTestNamedGetterWithIdentifier>::cast):
2605         (WebCore::jsTestNamedGetterWithIdentifierConstructor):
2606         (WebCore::setJSTestNamedGetterWithIdentifierConstructor):
2607         (WebCore::JSTestNamedGetterWithIdentifier::toWrapped):
2608         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
2609         (WebCore::jsTestNamedSetterNoIdentifierConstructor):
2610         (WebCore::setJSTestNamedSetterNoIdentifierConstructor):
2611         (WebCore::JSTestNamedSetterNoIdentifier::toWrapped):
2612         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
2613         (WebCore::jsTestNamedSetterThrowingExceptionConstructor):
2614         (WebCore::setJSTestNamedSetterThrowingExceptionConstructor):
2615         (WebCore::JSTestNamedSetterThrowingException::toWrapped):
2616         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
2617         (WebCore::IDLOperation<JSTestNamedSetterWithIdentifier>::cast):
2618         (WebCore::jsTestNamedSetterWithIdentifierConstructor):
2619         (WebCore::setJSTestNamedSetterWithIdentifierConstructor):
2620         (WebCore::JSTestNamedSetterWithIdentifier::toWrapped):
2621         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
2622         (WebCore::IDLOperation<JSTestNamedSetterWithIndexedGetter>::cast):
2623         (WebCore::jsTestNamedSetterWithIndexedGetterConstructor):
2624         (WebCore::setJSTestNamedSetterWithIndexedGetterConstructor):
2625         (WebCore::JSTestNamedSetterWithIndexedGetter::toWrapped):
2626         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
2627         (WebCore::IDLOperation<JSTestNamedSetterWithIndexedGetterAndSetter>::cast):
2628         (WebCore::jsTestNamedSetterWithIndexedGetterAndSetterConstructor):
2629         (WebCore::setJSTestNamedSetterWithIndexedGetterAndSetterConstructor):
2630         (WebCore::JSTestNamedSetterWithIndexedGetterAndSetter::toWrapped):
2631         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
2632         (WebCore::jsTestNamedSetterWithOverrideBuiltinsConstructor):
2633         (WebCore::setJSTestNamedSetterWithOverrideBuiltinsConstructor):
2634         (WebCore::JSTestNamedSetterWithOverrideBuiltins::toWrapped):
2635         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
2636         (WebCore::IDLAttribute<JSTestNamedSetterWithUnforgableProperties>::cast):
2637         (WebCore::IDLOperation<JSTestNamedSetterWithUnforgableProperties>::cast):
2638         (WebCore::jsTestNamedSetterWithUnforgablePropertiesConstructor):
2639         (WebCore::setJSTestNamedSetterWithUnforgablePropertiesConstructor):
2640         (WebCore::JSTestNamedSetterWithUnforgableProperties::toWrapped):
2641         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
2642         (WebCore::IDLAttribute<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins>::cast):
2643         (WebCore::IDLOperation<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins>::cast):
2644         (WebCore::jsTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsConstructor):
2645         (WebCore::setJSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsConstructor):
2646         (WebCore::JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins::toWrapped):
2647         * bindings/scripts/test/JS/JSTestNode.cpp:
2648         (WebCore::IDLAttribute<JSTestNode>::cast):
2649         (WebCore::IDLOperation<JSTestNode>::cast):
2650         (WebCore::jsTestNodeConstructor):
2651         (WebCore::setJSTestNodeConstructor):
2652         * bindings/scripts/test/JS/JSTestObj.cpp:
2653         (WebCore::IDLAttribute<JSTestObj>::cast):
2654         (WebCore::IDLOperation<JSTestObj>::cast):
2655         (WebCore::jsTestObjConstructor):
2656         (WebCore::setJSTestObjConstructor):
2657         (WebCore::JSTestObj::toWrapped):
2658         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
2659         (WebCore::jsTestOverloadedConstructorsConstructor):
2660         (WebCore::setJSTestOverloadedConstructorsConstructor):
2661         (WebCore::JSTestOverloadedConstructors::toWrapped):
2662         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
2663         (WebCore::jsTestOverloadedConstructorsWithSequenceConstructor):
2664         (WebCore::setJSTestOverloadedConstructorsWithSequenceConstructor):
2665         (WebCore::JSTestOverloadedConstructorsWithSequence::toWrapped):
2666         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
2667         (WebCore::IDLOperation<JSTestOverrideBuiltins>::cast):
2668         (WebCore::jsTestOverrideBuiltinsConstructor):
2669         (WebCore::setJSTestOverrideBuiltinsConstructor):
2670         (WebCore::JSTestOverrideBuiltins::toWrapped):
2671         * bindings/scripts/test/JS/JSTestPluginInterface.cpp:
2672         (WebCore::jsTestPluginInterfaceConstructor):
2673         (WebCore::setJSTestPluginInterfaceConstructor):
2674         (WebCore::JSTestPluginInterface::toWrapped):
2675         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
2676         (WebCore::IDLAttribute<JSTestPromiseRejectionEvent>::cast):
2677         (WebCore::jsTestPromiseRejectionEventConstructor):
2678         (WebCore::setJSTestPromiseRejectionEventConstructor):
2679         * bindings/scripts/test/JS/JSTestSerialization.cpp:
2680         (WebCore::IDLAttribute<JSTestSerialization>::cast):
2681         (WebCore::IDLOperation<JSTestSerialization>::cast):
2682         (WebCore::jsTestSerializationConstructor):
2683         (WebCore::setJSTestSerializationConstructor):
2684         (WebCore::JSTestSerialization::toWrapped):
2685         * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp:
2686         (WebCore::jsTestSerializationIndirectInheritanceConstructor):
2687         (WebCore::setJSTestSerializationIndirectInheritanceConstructor):
2688         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
2689         (WebCore::IDLAttribute<JSTestSerializationInherit>::cast):
2690         (WebCore::IDLOperation<JSTestSerializationInherit>::cast):
2691         (WebCore::jsTestSerializationInheritConstructor):
2692         (WebCore::setJSTestSerializationInheritConstructor):
2693         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
2694         (WebCore::IDLAttribute<JSTestSerializationInheritFinal>::cast):
2695         (WebCore::IDLOperation<JSTestSerializationInheritFinal>::cast):
2696         (WebCore::jsTestSerializationInheritFinalConstructor):
2697         (WebCore::setJSTestSerializationInheritFinalConstructor):
2698         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
2699         (WebCore::IDLAttribute<JSTestSerializedScriptValueInterface>::cast):
2700         (WebCore::IDLOperation<JSTestSerializedScriptValueInterface>::cast):
2701         (WebCore::jsTestSerializedScriptValueInterfaceConstructor):
2702         (WebCore::setJSTestSerializedScriptValueInterfaceConstructor):
2703         (WebCore::JSTestSerializedScriptValueInterface::toWrapped):
2704         * bindings/scripts/test/JS/JSTestStringifier.cpp:
2705         (WebCore::IDLOperation<JSTestStringifier>::cast):
2706         (WebCore::jsTestStringifierConstructor):
2707         (WebCore::setJSTestStringifierConstructor):
2708         (WebCore::JSTestStringifier::toWrapped):
2709         * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
2710         (WebCore::IDLOperation<JSTestStringifierAnonymousOperation>::cast):
2711         (WebCore::jsTestStringifierAnonymousOperationConstructor):
2712         (WebCore::setJSTestStringifierAnonymousOperationConstructor):
2713         (WebCore::JSTestStringifierAnonymousOperation::toWrapped):
2714         * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
2715         (WebCore::IDLOperation<JSTestStringifierNamedOperation>::cast):
2716         (WebCore::jsTestStringifierNamedOperationConstructor):
2717         (WebCore::setJSTestStringifierNamedOperationConstructor):
2718         (WebCore::JSTestStringifierNamedOperation::toWrapped):
2719         * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
2720         (WebCore::IDLOperation<JSTestStringifierOperationImplementedAs>::cast):
2721         (WebCore::jsTestStringifierOperationImplementedAsConstructor):
2722         (WebCore::setJSTestStringifierOperationImplementedAsConstructor):
2723         (WebCore::JSTestStringifierOperationImplementedAs::toWrapped):
2724         * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
2725         (WebCore::IDLOperation<JSTestStringifierOperationNamedToString>::cast):
2726         (WebCore::jsTestStringifierOperationNamedToStringConstructor):
2727         (WebCore::setJSTestStringifierOperationNamedToStringConstructor):
2728         (WebCore::JSTestStringifierOperationNamedToString::toWrapped):
2729         * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
2730         (WebCore::IDLAttribute<JSTestStringifierReadOnlyAttribute>::cast):
2731         (WebCore::IDLOperation<JSTestStringifierReadOnlyAttribute>::cast):
2732         (WebCore::jsTestStringifierReadOnlyAttributeConstructor):
2733         (WebCore::setJSTestStringifierReadOnlyAttributeConstructor):
2734         (WebCore::JSTestStringifierReadOnlyAttribute::toWrapped):
2735         * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
2736         (WebCore::IDLAttribute<JSTestStringifierReadWriteAttribute>::cast):
2737         (WebCore::IDLOperation<JSTestStringifierReadWriteAttribute>::cast):
2738         (WebCore::jsTestStringifierReadWriteAttributeConstructor):
2739         (WebCore::setJSTestStringifierReadWriteAttributeConstructor):
2740         (WebCore::JSTestStringifierReadWriteAttribute::toWrapped):
2741         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2742         (WebCore::IDLAttribute<JSTestTypedefs>::cast):
2743         (WebCore::IDLOperation<JSTestTypedefs>::cast):
2744         (WebCore::jsTestTypedefsConstructor):
2745         (WebCore::setJSTestTypedefsConstructor):
2746         (WebCore::JSTestTypedefs::toWrapped):
2747         * bridge/objc/WebScriptObject.mm:
2748         (-[WebScriptObject setValue:forKey:]):
2749         * bridge/runtime_array.cpp:
2750         (JSC::RuntimeArray::lengthGetter):
2751         * bridge/runtime_method.cpp:
2752         (JSC::RuntimeMethod::lengthGetter):
2753         * html/HTMLMediaElement.cpp:
2754         (WebCore::controllerJSValue):
2755         (WebCore::HTMLMediaElement::updateCaptionContainer):
2756         (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
2757         * inspector/agents/InspectorDOMAgent.cpp:
2758         (WebCore::InspectorDOMAgent::buildObjectForEventListener):
2759
2760 2018-03-08  Yusuke Suzuki  <utatane.tea@gmail.com>
2761
2762         [JSC] Add inherits<T>(VM&) leveraging JSCast fast path
2763         https://bugs.webkit.org/show_bug.cgi?id=183429
2764
2765         Reviewed by Mark Lam.
2766
2767         * bindings/js/IDBBindingUtilities.cpp:
2768         (WebCore::createIDBKeyFromValue):
2769         * bindings/js/JSDOMConvertDate.cpp:
2770         (WebCore::valueToDate):
2771         * bindings/js/JSDOMGlobalObject.cpp:
2772         (WebCore::JSDOMGlobalObject::scriptExecutionContext const):
2773         * bindings/js/JSDOMWindowCustom.cpp:
2774         (WebCore::JSDOMWindow::toWrapped):
2775         * bindings/js/JSEventTargetCustom.cpp:
2776         * bindings/js/JSNodeCustom.cpp:
2777         (WebCore::JSNode::pushEventHandlerScope const):
2778         * bindings/js/JSXPathNSResolverCustom.cpp:
2779         (WebCore::JSXPathNSResolver::toWrapped):
2780         * bindings/js/ScriptState.cpp:
2781         (WebCore::domWindowFromExecState):
2782         (WebCore::scriptExecutionContextFromExecState):
2783         * bindings/js/SerializedScriptValue.cpp:
2784         (WebCore::CloneSerializer::isArray):
2785         (WebCore::CloneSerializer::isMap):
2786         (WebCore::CloneSerializer::isSet):
2787         (WebCore::CloneSerializer::dumpArrayBufferView):
2788         (WebCore::CloneSerializer::dumpDOMPoint):
2789         (WebCore::CloneSerializer::dumpDOMRect):
2790         (WebCore::CloneSerializer::dumpDOMMatrix):
2791         (WebCore::CloneSerializer::dumpIfTerminal):
2792         (WebCore::CloneDeserializer::CloneDeserializer):
2793         (WebCore::CloneDeserializer::readArrayBufferView):
2794         * bindings/scripts/CodeGeneratorJS.pm:
2795         (GenerateOverloadDispatcher):
2796         * bindings/scripts/test/JS/JSTestObj.cpp:
2797         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodOverloadDispatcher):
2798         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameterOverloadDispatcher):
2799         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithDistinguishingUnionOverloadDispatcher):
2800         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWith2DistinguishingUnionsOverloadDispatcher):
2801         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithNonDistinguishingUnionOverloadDispatcher):
2802         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnionOverloadDispatcher):
2803         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameterOverloadDispatcher):
2804         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunctionOverloadDispatcher):
2805         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
2806         (WebCore::JSTestOverloadedConstructorsConstructor::construct):
2807         * bridge/c/c_instance.cpp:
2808         (JSC::Bindings::CInstance::invokeMethod):
2809         * bridge/objc/WebScriptObject.mm:
2810         (+[WebScriptObject _convertValueToObjcValue:originRootObject:rootObject:]):
2811         * bridge/objc/objc_instance.mm:
2812         (ObjcInstance::invokeMethod):
2813         * bridge/objc/objc_runtime.mm:
2814         (JSC::Bindings::callObjCFallbackObject):
2815         * bridge/runtime_method.cpp:
2816         (JSC::callRuntimeMethod):
2817         * bridge/runtime_object.cpp:
2818         (JSC::Bindings::callRuntimeObject):
2819         (JSC::Bindings::callRuntimeConstructor):
2820         * inspector/WebInjectedScriptHost.cpp:
2821         (WebCore::WebInjectedScriptHost::subtype):
2822         (WebCore::WebInjectedScriptHost::isHTMLAllCollection):
2823
2824 2018-03-08  Tim Horton  <timothy_horton@apple.com>
2825
2826         Stop linking ApplicationServices directly
2827         https://bugs.webkit.org/show_bug.cgi?id=182867
2828         <rdar://problem/38252142>
2829
2830         Reviewed by Alex Christensen.
2831
2832         The frameworks that we use that live inside ApplicationServices
2833         have mostly moved out, so import them directly.
2834
2835         * Configurations/WebCore.xcconfig:
2836         * html/canvas/CanvasRenderingContext2D.cpp:
2837         * html/canvas/CanvasRenderingContext2DBase.cpp:
2838         * platform/MIMETypeRegistry.cpp:
2839         * platform/graphics/ComplexTextController.cpp:
2840         * platform/graphics/cg/ColorCG.cpp:
2841         * platform/graphics/cg/ImageDecoderCG.cpp:
2842         * platform/graphics/cg/UTIRegistry.cpp:
2843         * platform/graphics/cocoa/FontCocoa.mm:
2844         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
2845         * platform/graphics/mac/GlyphPageMac.cpp:
2846         * platform/graphics/mac/PDFDocumentImageMac.mm:
2847         * platform/graphics/mac/SimpleFontDataCoreText.cpp:
2848         * platform/graphics/win/FontCGWin.cpp:
2849         * platform/graphics/win/FontCacheWin.cpp:
2850         * platform/graphics/win/FontCustomPlatformData.cpp:
2851         * platform/graphics/win/FontPlatformDataCGWin.cpp:
2852         * platform/graphics/win/ImageCGWin.cpp:
2853         * platform/graphics/win/SimpleFontDataCGWin.cpp:
2854
2855 2018-03-07  Tim Horton  <timothy_horton@apple.com>
2856
2857         Sort and separate FeatureDefines.xcconfig
2858         https://bugs.webkit.org/show_bug.cgi?id=183427
2859
2860         Reviewed by Dan Bernstein.
2861
2862         * Configurations/FeatureDefines.xcconfig:
2863         Sort and split FeatureDefines into paragraphs
2864         (to make it easier to sort later).
2865
2866 2018-03-07  Zalan Bujtas  <zalan@apple.com>
2867
2868         Invalid innerTextRenderer in RenderTextControlSingleLine::styleDidChange()
2869         https://bugs.webkit.org/show_bug.cgi?id=183385
2870         <rdar://problem/38085397>
2871
2872         Reviewed by Antti Koivisto.
2873
2874         When HTMLInputElement::updateType() is called with a dirty value, we eagerly change the m_inputType first
2875         and then we take care of the dirty value by calling setAttributeWithoutSynchronization().
2876         With a DOMSubtreeModified event listener attached, setAttributeWithoutSynchronization() can end up running some
2877         layout code (offsetHeight) with a renderer - m_inputType mismatch.
2878
2879         This patch ensures that we don't change the m_inputType until after we finished setting the new value.
2880
2881         Test: fast/DOM/HTMLInputElement/input-value-and-type-change-crash.html
2882
2883         * html/HTMLInputElement.cpp:
2884         (WebCore::HTMLInputElement::updateType):
2885
2886 2018-03-07  Chris Dumez  <cdumez@apple.com>
2887
2888         Get rid of custom bindings for History's replaceState() / pushState()
2889         https://bugs.webkit.org/show_bug.cgi?id=183372
2890
2891         Reviewed by Youenn Fablet.
2892
2893         Get rid of custom bindings for History's replaceState() / pushState() by
2894         moving the cached state from the wrapper to the History implementation
2895         object.
2896
2897         No new tests, no web-facing behavior change.
2898
2899         * bindings/js/JSHistoryCustom.cpp:
2900         (WebCore::JSHistory::state const):
2901         (WebCore::JSHistory::visitAdditionalChildren):
2902         * page/History.cpp:
2903         (WebCore::History::cachedState):
2904         (WebCore::History::stateObjectAdded):
2905         * page/History.h:
2906         (WebCore::History::pushState):
2907         (WebCore::History::replaceState):
2908         * page/History.idl:
2909
2910 2018-03-07  Youenn Fablet  <youenn@apple.com>
2911
2912         Match unsupported plugins based on domains and not origin
2913         https://bugs.webkit.org/show_bug.cgi?id=183384
2914
2915         Reviewed by Chris Dumez.
2916
2917         Move from an origin-keyed map to a vector of plugins.
2918         We iterate through the vector and a match happens if the page host name ends with the provided matching domain.
2919         This allows supporting rules for *.mydomain.com by passing 'mydomain.com'.
2920         Covered by existing tests.
2921         We are not testing subdomains like www.localhost since there is no support in our CI but this is tested through Unit tests.
2922
2923         * loader/EmptyClients.cpp:
2924         * platform/URL.cpp:
2925         (WebCore::URL::isMatchingDomain const):
2926         * platform/URL.h:
2927         * plugins/PluginData.h:
2928         (WebCore::isSupportedPlugin):
2929         (WebCore::SupportedPluginName::decode):
2930         (WebCore::SupportedPluginName::encode const):
2931         * plugins/PluginInfoProvider.h:
2932
2933 2017-12-18  Youenn Fablet  <youenn@apple.com>
2934
2935         Update to libwebrtc revision 4e70a72571dd26b85c2385e9c618e343428df5d3
2936         https://bugs.webkit.org/show_bug.cgi?id=180843
2937
2938         Reviewed by Eric Carlson.
2939
2940         Covered by existing tests.
2941
2942         Moving H264 codecs and factories to libwebrtc.
2943         Updating LibWebRTCProvider according new libwebrtc API.
2944         Updating ref counting according new libwebrtc API.
2945
2946         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2947         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
2948         (WebCore::LibWebRTCMediaEndpoint::AddRef const):
2949         (WebCore::LibWebRTCMediaEndpoint::Release const):
2950         (WTF::LogArgument<webrtc::RTCStats>::toString):
2951         * WebCore.xcodeproj/project.pbxproj:
2952         * platform/mediastream/RealtimeOutgoingAudioSource.h:
2953         * platform/mediastream/RealtimeOutgoingVideoSource.h:
2954         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h:
2955         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
2956         (WebCore::LibWebRTCProvider::createPeerConnectionFactory):
2957         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
2958         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
2959         (WebCore::LibWebRTCProviderCocoa::~LibWebRTCProviderCocoa):
2960         (WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
2961         (WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
2962         (WebCore::LibWebRTCProviderCocoa::setActive):
2963         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h:
2964         * platform/mediastream/libwebrtc/VideoToolBoxDecoderFactory.cpp: Removed.
2965         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.cpp: Removed.
2966         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
2967         (WebCore::ConvertToI420):
2968         (WebCore::RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated):
2969         * testing/Internals.cpp:
2970         (WebCore::Internals::setH264HardwareEncoderAllowed):
2971         * testing/MockLibWebRTCPeerConnection.h:
2972
2973 2018-03-07  Sihui Liu  <sihui_liu@apple.com>
2974
2975         replaceState cause back/forward malfunction on html page with <base href="/"> tag
2976         https://bugs.webkit.org/show_bug.cgi?id=182678
2977         <rdar://problem/37517821>
2978
2979         Reviewed by Chris Dumez.
2980
2981         replaceState should not change URL when the URL argument is NULL, but should change URL when the URL argument is an empty string.
2982
2983         Test: http/tests/history/replacestate-no-url.html
2984
2985         * page/History.cpp:
2986         (WebCore::History::urlForState):
2987
2988 2018-03-07  Antti Koivisto  <antti@apple.com>
2989
2990         Don't invalidate descendants for sibling combinators unless needed
2991         https://bugs.webkit.org/show_bug.cgi?id=183410
2992         <rdar://problem/38227297>
2993
2994         Reviewed by Zalan Bujtas.
2995
2996         If we know the matched sibling combinator doesn't affect descendants we shouldn't invalidate them.
2997
2998         * css/SelectorChecker.cpp:
2999         (WebCore::SelectorChecker::matchRecursively const):
3000
3001             Use different bit for the descendant case.
3002
3003         * cssjit/SelectorCompiler.cpp:
3004         (WebCore::SelectorCompiler::fragmentMatchesTheRightmostElement):
3005
3006             Remove unneeded context assert.
3007
3008         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateSelectorChecker):
3009
3010             Use different bit for the descendant case.
3011
3012         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateSelectorCheckerExcludingPseudoElements):
3013         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementHasPseudoElement):
3014         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateRequestedPseudoElementEqualsToSelectorPseudoElement):
3015         * dom/Element.cpp:
3016         (WebCore::invalidateForSiblingCombinators):
3017
3018             Invalidate the target sibling or all descendants based on the bits.
3019
3020         * dom/Element.h:
3021         (WebCore::Element::descendantsAffectedByPreviousSibling const):
3022         (WebCore::Element::setDescendantsAffectedByPreviousSibling const):
3023         * dom/Node.h:
3024         * style/StyleRelations.cpp:
3025         (WebCore::Style::commitRelationsToRenderStyle):
3026         (WebCore::Style::commitRelations):
3027         * style/StyleRelations.h:
3028
3029             Add DescendantsAffectedByPreviousSibling bit. AffectedByPreviousSibling is now just about the target element.
3030
3031 2018-03-07  Antti Koivisto  <antti@apple.com>
3032
3033         checkForSiblingStyleChanges should use internal versions of the invalidation functions
3034         https://bugs.webkit.org/show_bug.cgi?id=183405
3035         <rdar://problem/38218310>
3036
3037         Reviewed by Zalan Bujtas.
3038
3039         Non-internal invalidateStyleForElement/Subtree() implement sibling combinator invalidation. Checking this
3040         is only needed if the element in question changed somehow. In checkForSiblingStyleChanges we know that
3041         another element changed and we really just want to invalidate.
3042
3043         * css/SelectorChecker.cpp:
3044         (WebCore::isFirstOfType):
3045         (WebCore::SelectorChecker::checkOne const):
3046
3047         Also make :first-of-type use ChildrenAffectedByForwardPositionalRules for invalidation similar to :last-of-type
3048         for more correct invalidation.
3049
3050         * dom/Element.cpp:
3051         (WebCore::checkForSiblingStyleChanges):
3052
3053 2018-03-07  Yusuke Suzuki  <utatane.tea@gmail.com>
3054
3055         HTML `pattern` attribute should set `u` flag for regular expressions
3056         https://bugs.webkit.org/show_bug.cgi?id=151598
3057
3058         Reviewed by Chris Dumez.
3059
3060         This patch attaches "u" flag to the RegExp compiled for HTML "pattern" attribute[1].
3061
3062         [1]: https://html.spec.whatwg.org/multipage/forms.html#the-pattern-attribute
3063
3064         * html/BaseTextInputType.cpp:
3065         (WebCore::BaseTextInputType::patternMismatch const):
3066
3067 2018-03-07  Frederic Wang  <fwang@igalia.com>
3068
3069         Relayout frames after AsyncFrameScrolling or FrameFlattening option is changed
3070         https://bugs.webkit.org/show_bug.cgi?id=183081
3071
3072         Reviewed by Antonio Gomes.
3073
3074         The frames may be resized when the FrameFlattening option is modified and hence this patch
3075         forces a relayout. It also does that when AsyncFrameScrolling is modified too, since that
3076         may imply changes in frame flattening after bug 173704. Forcing a relayout will also be
3077         enough to trigger other updates for async frame scrolling in the future (see bug 149264 and
3078         bug 171667).
3079
3080         Test: platform/ios/fast/frames/flattening/iframe-flattening-async-frame-scrolling-dynamic.html
3081
3082         * page/Settings.yaml: Call setNeedsRelayoutAllFrames when one of the AsyncFrameScrolling or
3083         FrameFlattening options is changed.
3084         * page/SettingsBase.cpp: Include RenderWidget to make call on frame->ownerRenderer().
3085         (WebCore::SettingsBase::setNeedsRelayoutAllFrames):  Make layout and preferred widths dirty
3086         on all frames in the page and schedule a relayout.
3087         * page/SettingsBase.h: Declare setNeedsRelayoutAllFrames().
3088
3089 2018-03-07  Alejandro G. Castro  <alex@igalia.com>
3090
3091         Make NetworkRTCResolver port agnostic
3092         https://bugs.webkit.org/show_bug.cgi?id=178855
3093
3094         Reviewed by Youenn Fablet.
3095
3096         Add new API in the DNSResolveQueue allowing to revolve hostnames and get the result. Add platform
3097         specific code for soup platform and refactor the other platforms. Added new API to the DNS API header
3098         and move the general code to the DNS.cpp file, that way we can reuse that code in all the platforms
3099         and leave the ResolveQueue class of the platforms in a file.
3100
3101         No new tests because this is a refactor.
3102
3103         * PlatformAppleWin.cmake: Move the DNSCFNet class to DNSResolveQueueCFNet.
3104         * PlatformMac.cmake: Ditto.
3105         * Sources.txt: Add the DNS.cpp for compilation.
3106         * SourcesCocoa.txt: Move the DNSCFNet class to DNSResolveQueueCFNet.
3107         * WebCore.xcodeproj/project.pbxproj: Move the DNSCFNet class to DNSResolveQueueCFNet, add the DNS.cpp
3108         for compilation. Add the new DNSResolveQueueCFNet class.
3109         * platform/Curl.cmake: Move the DNSCFNet class to DNSResolveQueueCurl.
3110         * platform/network/DNS.cpp: Add this file with the default implementation of the DNS functions for
3111         all the platforms.
3112         (WebCore::prefetchDNS): Copied from every platform implementation.
3113         (WebCore::resolveDNS): Add the function, resolves a hostname, receives the identifier of the operation
3114         and the completion handler.
3115         (WebCore::stopResolveDNS): Add the function, stops a resolution operation, receives the identifier
3116         of the operation.
3117         * platform/network/DNS.h: Add the new APIs resolveDNS and stopResolveDNS with the classes used for the
3118         implementation.
3119         (WebCore::IPAddress::IPAddress): Add this class used to send the resolved address information, it does
3120         not depend on libwebrtc rtc classes.
3121         (WebCore::IPAddress::get): Get a reference to the struct sockaddr_in in the IPAddress class.
3122         (WebCore::DNSCompletionHandler): Add this CompletionHandler type to be used when resolving the DNS
3123         address.
3124         * platform/network/DNSResolveQueue.cpp: Add the DNSResolveQueue platform instantiation in the singleton.
3125         (WebCore::DNSResolveQueue::singleton): Use DNSResolveQueue platform classes when creating the singleton..
3126         (WebCore::DNSResolveQueue::resolve): Add this method to get the address of a hostname, it sends the
3127         identifier and the completion handler to use when returning the result.
3128         (WebCore::DNSResolveQueue::stopResolve): Add this method to stop the resolve operation when required.
3129         * platform/network/DNSResolveQueue.h: Add the new methods and make the class abstract, so that every
3130         platform can implement the functions.
3131         * platform/network/cf/DNSResolveQueueCFNet.cpp: Renamed from Source/WebCore/platform/network/cf/DNSCFNet.cpp.
3132         Add the methods to the new class DNSResolveQueueCFNet, move the prefetchDNS to the DNS.cpp general
3133         implementation.
3134         * platform/network/cf/DNSResolveQueueCFNet.h: Add the new class inheriting from the DNSResolveQueue. Add the
3135         new methods, we have to implement these methods and move the NetworkRTCResolver for COCOA code here.
3136         (WebCore::DNSResolveQueueCF::resolve): Dummy method, not implemented.
3137         (WebCore::DNSResolveQueueCF::stopResolve): Ditto.
3138         * platform/network/curl/DNSResolveQueueCurl.cpp: Renamed from Source/WebCore/platform/network/curl/DNSCurl.cpp.
3139         * platform/network/curl/DNSResolveQueueCurl.h: Add the new class inheriting from the DNSResolveQueue.
3140         (WebCore::DNSResolveQueueCurl::resolve): Ditto.
3141         (WebCore::DNSResolveQueueCurl::stopResolve): Ditto.
3142         * platform/network/soup/DNSResolveQueueSoup.h: New class inheriting from the DNSResolveQueue class, adding
3143         a HasMap with the active operations, it allows stopping them.
3144         * platform/network/soup/DNSResolveQueueSoup.cpp: Renamed from Source/WebCore/platform/network/curl/DNSSoup.cpp.
3145         (WebCore::resolvedWithObserverCallback): Called when the result address from the soup platform is ready,
3146         sends the address to the completion handler.
3147         (WebCore::DNSResolveQueueSoup::resolve): Launch the resolve operation with the soup library.
3148         (WebCore::DNSResolveQueueSoup::stopResolve): Stop the resolve operation on process with a GCancellable.
3149
3150 2018-03-06  Brian Burg  <bburg@apple.com>
3151
3152         [Cocoa] Stop copying ForwardingHeaders directory that no longer exists
3153         https://bugs.webkit.org/show_bug.cgi?id=183396
3154
3155         Reviewed by Dan Bernstein.
3156
3157         * WebCore.xcodeproj/project.pbxproj:
3158         Rename the phase to "Copy ICU Headers". ForwardingHeaders are no longer a thing.
3159
3160 2018-03-06  Youenn Fablet  <youenn@apple.com>
3161
3162         didReceiveServerRedirectForProvisionalNavigation is not called in case of document redirection with service worker registration change
3163         https://bugs.webkit.org/show_bug.cgi?id=183299
3164         <rdar://problem/37547029>
3165
3166         Reviewed by Alex Christensen.
3167
3168         In case of redirection with service worker registration change, we cancel the load and create a new one.
3169         This prevent ResourceLoader::willSendRequestInternal to call the didReceiveServerRedirectForProvisionalNavigation
3170         callback. We thus explictly call this callback after restarting the load with the new service worker step.
3171         We only call this callback if the main resource is there as we do not want to call it if it was blocked by content extension.
3172
3173         Test: http/wpt/service-workers/navigation-redirect-main-frame.https.html
3174
3175         * loader/DocumentLoader.cpp:
3176         (WebCore::DocumentLoader::restartLoadingDueToServiceWorkerRegistrationChange):
3177
3178 2018-03-06  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3179
3180         [Curl] Remove unnecessary copied ResourceRequest member variable.
3181         https://bugs.webkit.org/show_bug.cgi?id=183010
3182
3183         Reviewed by Youenn Fablet.
3184
3185         * platform/network/ResourceHandle.h:
3186         * platform/network/ResourceHandleInternal.h:
3187         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
3188         * platform/network/curl/CurlRequest.h:
3189         (WebCore::CurlRequest::resourceRequest const):
3190         * platform/network/curl/ResourceHandleCurl.cpp:
3191         (WebCore::ResourceHandle::start):
3192         (WebCore::ResourceHandle::addCacheValidationHeaders):
3193         (WebCore::ResourceHandle::createCurlRequest):
3194         (WebCore::ResourceHandle::restartRequestWithCredential):
3195         (WebCore::ResourceHandle::continueAfterWillSendRequest):
3196
3197 2018-03-06  Nan Wang  <n_wang@apple.com>
3198
3199         AX: Flaky test after r229310
3200         https://bugs.webkit.org/show_bug.cgi?id=183376
3201         <rdar://problem/38188685>
3202
3203         Reviewed by Chris Fleizach.
3204
3205         The test that forces the context menu to show sometimes locks up 
3206         the test runner. Also, we missed a case where calling AXShowMenu
3207         action on a combobox is not dispatching the accessibility event.
3208
3209         Using the combobox example to test the event dispatching in order to
3210         avoid the test hang.
3211
3212         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3213         (-[WebAccessibilityObjectWrapper accessibilityPerformShowMenuAction]):
3214         (-[WebAccessibilityObjectWrapper accessibilityShowContextMenu]):
3215
3216 2018-03-06  Chris Dumez  <cdumez@apple.com>
3217
3218         fast/loader/redirect-to-invalid-url-using-meta-refresh-disallowed.html fails with async policy delegates
3219         https://bugs.webkit.org/show_bug.cgi?id=183345
3220
3221         Reviewed by Alex Christensen.
3222
3223         FrameLoader::loadURL() was calling loadWithNavigationAction() and then resetting the
3224         m_quickRedirectComing flag right after. This works if the navigation policy decision
3225         triggered by loadWithNavigationAction() is made synchronously. However, when it is
3226         made asynchronously, the flag gets reset too early, before the policy decision
3227         handler has been called. This is an issue because the policy decision handler
3228         relies on the m_quickRedirectComing flag.
3229
3230         Similarly, FrameLoader::loadFrameRequest() was calling loadPostRequest() / loadURL()
3231         and then focusing a frame right after. This does not work as intended when the navigation
3232         policy decision is made asynchronously.
3233
3234         To address the issue, we now pass a completion handler that gets called when the operation
3235         has actually completion, after the policy decision has been made. This maintains the
3236         behavior in place with synchronous policy delegates.
3237
3238         Test: fast/loader/redirect-to-invalid-url-using-meta-refresh-disallowed-async-delegates.html
3239
3240         * loader/FrameLoader.cpp:
3241         (WebCore::FrameLoader::loadURLIntoChildFrame):
3242         (WebCore::FrameLoader::loadFrameRequest):
3243         (WebCore::FrameLoader::loadURL):
3244         (WebCore::FrameLoader::loadWithNavigationAction):
3245         (WebCore::FrameLoader::load):
3246         (WebCore::FrameLoader::loadWithDocumentLoader):
3247         (WebCore::FrameLoader::reloadWithOverrideEncoding):
3248         (WebCore::FrameLoader::reload):
3249         (WebCore::FrameLoader::loadPostRequest):
3250         (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
3251         (WebCore::FrameLoader::loadDifferentDocumentItem):
3252         * loader/FrameLoader.h:
3253
3254 2018-03-06  Antoine Quint  <graouts@apple.com>
3255
3256         [Web Animations] Add a new CSSTransition subclass of WebAnimation
3257         https://bugs.webkit.org/show_bug.cgi?id=183373
3258         <rdar://problem/38181985>
3259
3260         Reviewed by Dean Jackson.
3261
3262         Adding a new CSSAnimation subclass which we will create in a later patch while resolving styles
3263         upon identifying that a new CSS Animation has been added to an element.
3264
3265         * CMakeLists.txt:
3266         * DerivedSources.make:
3267         * Sources.txt:
3268         * WebCore.xcodeproj/project.pbxproj:
3269         * animation/CSSTransition.cpp: Added.
3270         (WebCore::CSSTransition::create):
3271         (WebCore::CSSTransition::CSSTransition):
3272         * animation/CSSTransition.h: Added.
3273         * animation/CSSTransition.idl: Added.
3274         * animation/KeyframeEffect.cpp:
3275         * animation/WebAnimation.h:
3276         (WebCore::WebAnimation::isCSSTransition const):
3277         * bindings/js/JSWebAnimationCustom.cpp:
3278         (WebCore::toJSNewlyCreated):
3279         * bindings/js/WebCoreBuiltinNames.h:
3280
3281 2018-03-06  Megan Gardner  <megan_gardner@apple.com>
3282
3283         Ensure system appearance is default for web content
3284         https://bugs.webkit.org/show_bug.cgi?id=183354
3285         <rdar://problem/36975571>
3286         <rdar://problem/38162381>
3287
3288         Make sure the the system appearance for web content is default, and
3289         consolidate that code to a single class.
3290
3291         Reviewed by Tim Horton.
3292
3293         Not currently testable, will add tests in a future patch.
3294
3295         * WebCore.xcodeproj/project.pbxproj:
3296         * platform/mac/LocalDefaultSystemAppearance.h: Added.
3297         * platform/mac/LocalDefaultSystemAppearance.mm: Added.
3298         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
3299         (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance):
3300         * platform/mac/ThemeMac.mm:
3301         (-[WebCoreThemeView init]):
3302         (WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext):
3303         * rendering/RenderThemeMac.mm:
3304         (WebCore::RenderThemeMac::systemColor const):
3305
3306 2018-03-06  Antoine Quint  <graouts@apple.com>
3307
3308         [Web Animations] Add a new runtime flag to control whether CSS Animations and CSS Transitions should run using the Web Animations timeline
3309         https://bugs.webkit.org/show_bug.cgi?id=183370
3310         <rdar://problem/38180729>
3311
3312         Reviewed by Dean Jackson.
3313
3314         Before we start creating WebAnimation objects to perform CSS Animations and CSS Transitions, which will replace the existing codepath
3315         involving CSSAnimationController and CompositeAnimation, we need a runtime flag that will allow all the new code to be turned off by
3316         default while we bring this feature up.
3317
3318         * page/RuntimeEnabledFeatures.h:
3319         (WebCore::RuntimeEnabledFeatures::setCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled):
3320         (WebCore::RuntimeEnabledFeatures::cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled const):
3321
3322 2018-03-06  Daniel Bates  <dabates@apple.com>
3323
3324         Make more use of USE(OPENGL_ES) and replace typedefs with C++11 using statements
3325         in TextureCacheCV.h
3326
3327         Rubber-stamped by Tim Horton.
3328
3329         * platform/graphics/cv/TextureCacheCV.h:
3330
3331 2018-03-06  Antti Koivisto  <antti@apple.com>
3332
3333         Cache hasComplexSelectorsForStyleAttribute bit
3334         https://bugs.webkit.org/show_bug.cgi?id=183363
3335
3336         Reviewed by Andreas Kling.
3337
3338         * css/DocumentRuleSets.cpp:
3339         (WebCore::DocumentRuleSets::collectFeatures const):
3340         (WebCore::DocumentRuleSets::hasComplexSelectorsForStyleAttribute const):
3341
3342         Cache the bit to avoid hash lookups.
3343
3344         * css/DocumentRuleSets.h:
3345         * dom/StyledElement.cpp:
3346         (WebCore::StyledElement::invalidateStyleAttribute):
3347         (WebCore::shouldSynchronizeStyleAttributeImmediatelyForInvalidation): Deleted.
3348
3349         Move code to DocumentRuleSets.
3350
3351 2018-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
3352
3353         Change the type of SVGToOTFFontConverter::m_weight to be not a char
3354         https://bugs.webkit.org/show_bug.cgi?id=183339
3355
3356         Reviewed by Alex Christensen.