REGRESSION(r215686): O(n^2) algorithm in CachedRawResource::addDataBuffer
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-05-20  Alex Christensen  <achristensen@webkit.org>
2
3         REGRESSION(r215686): O(n^2) algorithm in CachedRawResource::addDataBuffer
4         https://bugs.webkit.org/show_bug.cgi?id=172406
5         <rdar://32109532>
6
7         Reviewed by Brady Eidson.
8
9         CachedRawResource::calculateIncrementalDataChunk was calling SharedBuffer::data each time the data
10         was appended to the SharedBuffer. This causes the data to be copied from two segments to one segment,
11         which causes the O(n^2) behavior I was worried about in r215686. These append/data/append/data calls
12         used to cause O(1) copies per byte which was amortized because of the exponential growth of the buffer.
13         After this change, there should be 0 copies per byte here, and instead a O(log(n)) binary search in the
14         call to std::upper_bound to find the next segment of data with a given starting location in the SharedBuffer.
15         We need to store the additional information of the offsets of the beginnings of the segments in a
16         SharedBuffer. This doesn't asymptotically increase our memory usage, but it does allow us to asymptotically
17         decrease the amount of time it takes to find data at a given offset in a SharedBuffer from O(n) to O(log(n)).
18
19         This allows us to complete http://speedtest.xfinity.com and new functionality in SharedBuffer is covered by API tests.
20
21         * loader/TextTrackLoader.cpp:
22         (WebCore::TextTrackLoader::processNewCueData):
23         * loader/cache/CachedRawResource.cpp:
24         (WebCore::CachedRawResource::calculateIncrementalDataChunk):
25         (WebCore::CachedRawResource::addDataBuffer):
26         (WebCore::CachedRawResource::finishLoading):
27         * loader/cache/CachedRawResource.h:
28         * platform/SharedBuffer.cpp:
29         (WebCore::SharedBuffer::SharedBuffer):
30         (WebCore::SharedBuffer::combineIntoOneSegment):
31         (WebCore::SharedBuffer::data):
32         (WebCore::SharedBuffer::getSomeData):
33         (WebCore::SharedBuffer::tryCreateArrayBuffer):
34         (WebCore::SharedBuffer::append):
35         (WebCore::SharedBuffer::clear):
36         (WebCore::SharedBuffer::copy):
37         (WebCore::SharedBuffer::internallyConsistent):
38         (WebCore::SharedBuffer::hintMemoryNotNeededSoon):
39         (WebCore::SharedBufferDataView::SharedBufferDataView):
40         (WebCore::SharedBufferDataView::size):
41         (WebCore::SharedBufferDataView::data):
42         * platform/SharedBuffer.h:
43         * platform/cf/SharedBufferCF.cpp:
44         (WebCore::SharedBuffer::createCFData):
45         (WebCore::SharedBuffer::hintMemoryNotNeededSoon):
46         (WebCore::SharedBuffer::append):
47         * platform/cocoa/SharedBufferCocoa.mm:
48         (WebCore::SharedBuffer::createNSData):
49         (WebCore::SharedBuffer::createCFData):
50         (WebCore::SharedBuffer::createNSDataArray):
51
52 2017-05-22  Chris Dumez  <cdumez@apple.com>
53
54         Resources in cached parsed stylesheets may bypass content blockers
55         https://bugs.webkit.org/show_bug.cgi?id=172468
56         <rdar://problem/31972693>
57
58         Reviewed by Geoffrey Garen.
59
60         Resources in cached parsed stylesheets could bypass content blockers when they were in the memory cache and
61         they did not need revalidation.
62
63         To address the issue, I made StyleSheetContents::subresourcesAllowReuse() to check content blockers.
64         If a subresource in the cached stylesheet is blocked, then we return false in subresourcesAllowReuse() and
65         the cached parsed stylesheet will not be used.
66
67         No new tests, not currently testable.
68
69         * css/StyleSheetContents.cpp:
70         (WebCore::StyleSheetContents::subresourcesAllowReuse):
71         * css/StyleSheetContents.h:
72         * html/HTMLLinkElement.cpp:
73         (WebCore::HTMLLinkElement::setCSSStyleSheet):
74         * loader/cache/CachedCSSStyleSheet.cpp:
75         (WebCore::CachedCSSStyleSheet::restoreParsedStyleSheet):
76         * loader/cache/CachedCSSStyleSheet.h:
77
78 2017-05-22  Chris Dumez  <cdumez@apple.com>
79
80         ASSERTION FAILED: tokens.find(item) == notFound in WebCore::DOMTokenList::replace
81         https://bugs.webkit.org/show_bug.cgi?id=172473
82
83         Reviewed by Ryosuke Niwa.
84
85         Fix bad assertion in DOMTokenList::replace(). If item == replacement, then the
86         assertion was wrong.
87
88         No new tests, unskipped existing test.
89
90         * html/DOMTokenList.cpp:
91         (WebCore::DOMTokenList::replace):
92
93 2017-05-22  Youenn Fablet  <youenn@apple.com>
94
95         Remove AVAudioCaptureSource
96         https://bugs.webkit.org/show_bug.cgi?id=172360
97
98         Reviewed by Sam Weinig.
99
100         No change of behavior, this class is no longer used by default as it does not support echo cancellation.
101
102         * WebCore.xcodeproj/project.pbxproj:
103         * page/Settings.cpp:
104         (WebCore::Settings::setMediaCaptureRequiresSecureConnection):
105         (WebCore::Settings::useAVFoundationAudioCapture): Deleted.
106         (WebCore::Settings::setUseAVFoundationAudioCapture): Deleted.
107         * page/Settings.h:
108         * platform/mediastream/mac/AVAudioCaptureSource.h: Removed.
109         * platform/mediastream/mac/AVAudioCaptureSource.mm: Removed.
110         * platform/mediastream/mac/AVCaptureDeviceManager.h:
111         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
112         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
113         (WebCore::RealtimeMediaSourceCenterMac::defaultAudioFactory):
114         (WebCore::RealtimeMediaSourceCenterMac::defaultAudioCaptureDeviceManager):
115         (WebCore::RealtimeMediaSourceCenterMac::setUseAVFoundationAudioCapture): Deleted.
116         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
117
118 2017-05-22  Brian Burg  <bburg@apple.com>
119
120         Web Inspector: webkit reload policy should match default behavior
121         https://bugs.webkit.org/show_bug.cgi?id=171385
122         <rdar://problem/31871515>
123
124         Reviewed by Joseph Pecoraro.
125
126         Add an option to PageAgent.reload that tells the backend to use the old
127         behavior that revalidates unexpired cached subresources. This used by tests.
128
129         Covered by existing network/memory/disk cache tests.
130
131         * inspector/InspectorPageAgent.h:
132         * inspector/InspectorPageAgent.cpp:
133         (WebCore::InspectorPageAgent::reload):
134
135 2017-05-22  Yoav Weiss  <yoav@yoav.ws>
136
137         [preload] Add media and type attribute support.
138         https://bugs.webkit.org/show_bug.cgi?id=171720
139
140         Reviewed by Youenn Fablet.
141
142         Tests: http/wpt/preload/media-attribute.html
143                http/wpt/preload/type-attribute.html
144                http/tests/preload/viewport/meta-viewport-link-headers.php
145
146         * css/MediaQueryEvaluator.cpp: Move the mediaAttributeMatches code from HTMLResourcePreloader to a central location.
147         (WebCore::MediaQueryEvaluator::mediaAttributeMatches):
148         * css/MediaQueryEvaluator.h:
149         * html/HTMLImageElement.cpp:
150         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement): Use isSupportedImageOrSVGMIMEType() instead of checking SVG MIME type specifically.
151         * html/HTMLLinkElement.cpp:
152         (WebCore::HTMLLinkElement::process): Call loadLink() with the media and type attributes.
153         * html/parser/HTMLDocumentParser.cpp:
154         (WebCore::HTMLDocumentParser::pumpTokenizer): Trigger Link header based preload for links that have the media attribute.
155         * html/parser/HTMLPreloadScanner.cpp:
156         (WebCore::TokenPreloadScanner::StartTagScanner::createPreloadRequest): Avoid preloading link resources with non-matching type.
157         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): Collect the type attribute for link resources.
158         * html/parser/HTMLResourcePreloader.cpp:
159         (WebCore::HTMLResourcePreloader::preload): Use MediaQueryEvaluator::mediaAttributeMatches instead of the local one.
160         (WebCore::mediaAttributeMatches): Deleted.
161         * loader/FrameLoader.cpp:
162         (WebCore::FrameLoader::receivedFirstData): Indicate that only link preloads with no media attribute should be loaded here.
163         * loader/LinkLoader.cpp:
164         (WebCore::LinkLoader::loadLinksFromHeader): Load only links with or without media attributes, according to mode. Also send media and
165         type attributes to preloadIfNeeded().
166         (WebCore::LinkLoader::isSupportedType): Check if the MIME type is supported for the CachedResource::Type.
167         (WebCore::LinkLoader::preloadIfNeeded): Get the media and type attributes and only trigger a preload if media matches and type is supported.
168         (WebCore::LinkLoader::loadLink): Pass along the media and type attributes.
169         * loader/LinkLoader.h:
170         * platform/MIMETypeRegistry.cpp:
171         (WebCore::MIMETypeRegistry::isSupportedImageOrSVGMIMEType): Check if MIME type is supported for an image, or is an SVG mime type.
172         (WebCore::MIMETypeRegistry::isSupportedStyleSheetMIMEType): Check if MIME type is supported for a stylesheet.
173         (WebCore::MIMETypeRegistry::isSupportedFontMIMEType): Check if MIME type is supported for a font.
174         (WebCore::MIMETypeRegistry::isSupportedTextTrackMIMEType): Check if MIME type is supported for a text track.
175         * platform/MIMETypeRegistry.h:
176
177 2017-05-22  Said Abou-Hallawa  <sabouhallawa@apple.com>
178
179         [CG] Use the SPI CGImageSourceGetTypeWithData() to get the typeIdentifierHint of an image
180         https://bugs.webkit.org/show_bug.cgi?id=172405
181
182         Reviewed by Simon Fraser.
183
184         Use CGImageSourceGetTypeWithData() to get the typeIdentifierHint which will
185         be passed to CGImageSourceCreateIncremental(). If data is insufficient to
186         guess typeIdentifierHint, that means the image size is still not available.
187         In this case, CachedImage::addIncrementalDataBuffer() will call error()
188         which will call clear() which will call Image::destroyDecodedData()
189         which will delete the current ImageDecoder and creates a new one. So we
190         don't need to check the return value insufficientData.
191
192         * platform/graphics/DecodingOptions.h: Fix the header file dependencies.
193         * platform/graphics/ImageSource.cpp:
194         (WebCore::ImageSource::ensureDecoderAvailable): No need for the URL parameter.
195         * platform/graphics/ImageTypes.h: Move a typedef from ImageDecoderCG.h to ImageTypes.h.
196         * platform/graphics/cg/ImageDecoderCG.cpp:
197         (WebCore::ImageDecoder::ImageDecoder): Pass the SharedBuffer data to the constructor.
198         * platform/graphics/cg/ImageDecoderCG.h:
199         (WebCore::ImageDecoder::create): No need for the URL argument.
200         * platform/graphics/win/ImageDecoderDirect2D.h:
201         (WebCore::ImageDecoder::create): Remove the URL argument from the function signature.
202         * platform/image-decoders/ImageDecoder.cpp:
203         (WebCore::ImageDecoder::create): Remove the URL argument from the function signature.
204         * platform/image-decoders/ImageDecoder.h:
205         * platform/spi/cg/ImageIOSPI.h: Add the prototype of CGImageSourceGetTypeWithData().
206
207 2017-05-22  Zalan Bujtas  <zalan@apple.com>
208
209         SameSizeAsInlineBox mismatch on ARMV7.
210         https://bugs.webkit.org/show_bug.cgi?id=172459
211
212         Reviewed by Simon Fraser.
213
214         Due to the ARMV7/i386 padding behaviour mismatch, forcing m_bitfields to be 32bits does not always
215         produce the desired padding.
216         Move the bool to the end of the member list and let m_deletionSentinel (4bytes) force
217         padding.
218
219         * rendering/InlineBox.cpp:
220         * rendering/InlineBox.h:
221
222 2017-05-22  Myles C. Maxfield  <mmaxfield@apple.com>
223
224         Enable the woff2-variations @font-face format identifier
225         https://bugs.webkit.org/show_bug.cgi?id=172425
226
227         Reviewed by Andreas Kling.
228
229         We support woff2, and woff-variations, but not woff2-variations.
230         https://github.com/w3c/csswg-drafts/commit/5c914a8a0382734bd420090a89bc19b32e6c302d
231
232         Test: fast/text/variations/font-face-format-woff2.html
233
234         * platform/graphics/mac/FontCustomPlatformData.cpp:
235         (WebCore::FontCustomPlatformData::supportsFormat):
236
237 2017-05-22  Antoine Quint  <graouts@apple.com>
238
239         [mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
240         https://bugs.webkit.org/show_bug.cgi?id=168409
241
242         Reviewed by Simon Fraser.
243
244         Remove all the custom logging code we wrote to diagnose why this specific test failed and instead
245         log the backtrace when the ScriptedAnimationController gets suspended, which should allow us to
246         identify which test actually leads to suspension and affects this particular test.
247
248         * Modules/modern-media-controls/controls/scheduler.js:
249         (const.scheduler.new.prototype.scheduleLayout):
250         (const.scheduler.new.prototype.unscheduleLayout):
251         (const.scheduler.new.prototype._requestFrameIfNeeded):
252         (const.scheduler.new.prototype._frameDidFire):
253         (const.scheduler.new.prototype._layout):
254         * dom/Document.cpp:
255         (WebCore::Document::requestAnimationFrame):
256         * dom/ScriptedAnimationController.cpp:
257         (WebCore::ScriptedAnimationController::suspend):
258         (WebCore::ScriptedAnimationController::resume):
259         (WebCore::ScriptedAnimationController::addThrottlingReason):
260         (WebCore::ScriptedAnimationController::removeThrottlingReason):
261         (WebCore::ScriptedAnimationController::registerCallback):
262         (WebCore::ScriptedAnimationController::cancelCallback):
263         (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
264         (WebCore::ScriptedAnimationController::scheduleAnimation):
265         (WebCore::ScriptedAnimationController::dispatchLoggingEventIfRequired): Deleted.
266         * dom/ScriptedAnimationController.h:
267         * page/Page.cpp:
268         (WebCore::Page::suspendScriptedAnimations):
269         * page/Settings.in:
270         * testing/InternalSettings.cpp:
271         (WebCore::InternalSettings::resetToConsistentState):
272         (WebCore::InternalSettings::shouldDispatchRequestAnimationFrameEvents): Deleted.
273         (WebCore::InternalSettings::setShouldDispatchRequestAnimationFrameEvents): Deleted.
274         * testing/InternalSettings.h:
275         * testing/InternalSettings.idl:
276
277 2017-05-22  Emilio Cobos Álvarez  <ecobos@igalia.com>
278
279         Don't unconditionally reset TextIterator::m_handledChildren for display: contents nodes.
280         https://bugs.webkit.org/show_bug.cgi?id=172443
281
282         This avoids an infinite hang when enabling display: contents in bug 171984.
283
284         Reviewed by Antti Koivisto.
285
286         No new tests. Relanding bug 171984 will add test coverage for this.
287
288         * editing/TextIterator.cpp:
289         (WebCore::hasDisplayContents):
290         (WebCore::fullyClipsContents):
291         (WebCore::TextIterator::advance):
292
293 2017-05-22  Sam Weinig  <sam@webkit.org>
294
295         [WebIDL] Support callbacks with arbitrary return types
296         https://bugs.webkit.org/show_bug.cgi?id=172407
297
298         Reviewed by Chris Dumez.
299
300         - Adds and adopts CallbackResult<> template class that encapsulates a return value
301           and status from a javascript callback.
302         - Updates NodeIterator/TreeWalker to explicitly propagate exceptions thrown from
303           a JSNodeFilter, rather than relying on the JSNodeFilter to catch them (seemingly
304           accidentally).
305
306         * CMakeLists.txt:
307         * WebCore.xcodeproj/project.pbxproj:
308         * bindings/js/JSBindingsAllInOne.cpp:
309         Update file lists.
310
311         * Modules/geolocation/PositionCallback.h:
312         * Modules/geolocation/PositionErrorCallback.h:
313         * Modules/notifications/NotificationPermissionCallback.h:
314         * Modules/webaudio/AudioBufferCallback.h:
315         * Modules/webdatabase/DatabaseCallback.h:
316         * dom/RequestAnimationFrameCallback.h:
317         * dom/StringCallback.h:
318         * dom/Traversal.cpp:
319         * fileapi/BlobCallback.h:
320         * html/VoidCallback.h:
321         * page/IntersectionObserverCallback.h:
322         * page/PerformanceObserverCallback.h:
323         * css/MediaQueryListListener.h:
324         * Modules/webdatabase/SQLStatement.h:
325         * Modules/webdatabase/SQLStatementCallback.h:
326         * Modules/webdatabase/SQLStatementErrorCallback.h:
327         * Modules/webdatabase/SQLTransaction.cpp:
328         * Modules/webdatabase/SQLTransactionCallback.h:
329         * Modules/webdatabase/SQLTransactionErrorCallback.h:
330         * inspector/InspectorDatabaseAgent.cpp:
331         Adopt CallbackResult.
332
333         * Modules/webdatabase/SQLStatementErrorCallback.idl:
334         Remove Custom extended attribute annotation.
335
336         * Modules/webdatabase/SQLStatement.cpp:
337         (WebCore::SQLStatement::performCallback):
338         Adopt CallbackResult, migrating logic from JSSQLStatementErrorCallbackCustom
339         into the implementation, by way of the status enum.
340
341         * bindings/IDLTypes.h:
342         Add IDLVoid type.
343
344         * bindings/js/JSNodeFilterCustom.cpp: Removed.
345         * bindings/js/JSSQLStatementErrorCallbackCustom.cpp: Removed.
346         Remove now unneeded custom bindings.
347
348         * bindings/scripts/CodeGeneratorJS.pm:
349         (GenerateIndexedGetter):
350         (GenerateNamedGetter):
351         (GenerateImplementation):
352         (GenerateImplementationFunctionCall):
353         Update for new NativeToJSValue arguments.
354
355         (GenerateCallbackHeaderContent):
356         (GenerateCallbackImplementationContent):
357         Remove requirement of only void return types and update return type to use CallbackFunction.
358         Also adds necessary conversion of return value.
359
360         (GetBaseIDLType):
361         Add void IDL type mapping.
362
363         (IsValidContextForJSValueToNative):
364         Add operation as valid context, as that is what the callback return type's context is.
365
366         (NativeToJSValueUsingReferences):
367         (NativeToJSValueUsingPointers):
368         (NativeToJSValue):
369         Rework NativeToJSValueUsingReferences/NativeToJSValueUsingPointers to take a global object reference
370         accessor rather than a thisObject accessor, as a thisObject is not always available, and what the function
371         actually wants is the global object.
372
373         * bindings/scripts/IDLAttributes.json:
374         Add new RethrowException attribute to instruct the callback function to re-throw, rather than
375         just report, exceptions thrown in the callback and SkipCallbackInvokeCheck which instructs the
376         callback function to not check canInvokeCallback() before calling. These will both be needed to retain
377         the behavior of NodeFilter, and should be investigated further.
378
379         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
380         * bindings/scripts/test/JS/JSTestCallbackFunction.h:
381         * bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.cpp: Added.
382         * bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.h: Added.
383         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
384         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h:
385         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
386         * bindings/scripts/test/JS/JSTestCallbackInterface.h:
387         * bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp: Added.
388         * bindings/scripts/test/JS/JSTestVoidCallbackFunction.h: Added.
389         * bindings/scripts/test/TestCallbackFunction.idl:
390         * bindings/scripts/test/TestCallbackInterface.idl:
391         * bindings/scripts/test/TestVoidCallbackFunction.idl: Copied from Source/WebCore/bindings/scripts/test/TestCallbackFunction.idl.
392         Update test results and add some additional test cases for callback functions and callback interface functions that return
393         non-void and use the RethrowExceptions.
394
395         * dom/CallbackResult.h: Added.
396         (WebCore::CallbackResult<ReturnType>::CallbackResult):
397         (WebCore::CallbackResult<ReturnType>::type):
398         (WebCore::CallbackResult<void>::CallbackResult):
399         (WebCore::CallbackResult<void>::type):
400         New class to encapsulate the return value and status of a callback function. Modeled loosely on
401         ExceptionOr, but is simpler since it does not need to handle complex exception objects.
402
403         * dom/NativeNodeFilter.cpp:
404         * dom/NativeNodeFilter.h:
405         Adopt CallbackResult, matching other NodeFiltering code by using
406         unsigned short rather than short, remove unused functions, and convert 
407         condition member to a Ref, allowing us to get rid of the branch acceptNode.
408
409         * dom/NodeFilter.h:
410         Adopt CallbackResult.
411
412         * dom/NodeFilter.idl:
413         Replace Custom extended attribute with SkipCallbackInvokeCheck and RethrowException.
414
415         * dom/NodeFilterCondition.cpp:
416         * dom/NodeFilterCondition.h:
417         Modernize to take a Node reference and match other filtering code
418         by returning an unsigned short.
419
420         * dom/Traversal.cpp:
421         * dom/Traversal.h:
422         Adopt CallbackResult and match other node filtering code by using unsigned short 
423         rather than short.
424
425         * dom/NodeIterator.cpp:
426         * dom/NodeIterator.h:
427         * dom/NodeIterator.idl:
428         * dom/TreeWalker.cpp:
429         * dom/TreeWalker.h:
430         * dom/TreeWalker.idl:
431         Change functions that callout to javascript via the NodeFilter to 
432         return ExceptionOr<Node>. Check the result of CallbackResult for a
433         thrown exception, and bail, returning Exception { ExistingExceptionError }
434         which acts as an indicator to the bindings that an exception was thrown.
435         (In actuality, the specific exception code does not matter. All that matters
436         is that an ExceptionOr<> is returned, which triggers, via overload, a path
437         in toJS() that calls propagateException(), which in turn, checks to see if
438         an exception is on the stack. But, having an explicit code here helps debugging).
439
440 2017-05-22  Simon Fraser  <simon.fraser@apple.com>
441
442         Support transform-box to switch sizing box in SVG
443         https://bugs.webkit.org/show_bug.cgi?id=145783
444
445         Reviewed by Dean Jackson.
446
447         Add support for the CSS "transform-box" property, as described at
448         <https://drafts.csswg.org/css-transforms/#transform-box>.
449         
450         This changes the behavior of percentage values in transform-origin in SVG.
451         When these were added in r110532, percentage values in transform-origin were made
452         relative to the bounding box, but absolute values relative to the view box.
453         <https://github.com/w3c/csswg-drafts/issues/895> has concluded that this behavior
454         is confusing. The new behavior is that, for SVG elements, both absolute and
455         percentage values are relative to the reference box, which is specified by the
456         new transform-box property.
457
458         The initial value for transform-box is border-box, with the svg.css UA stylesheet
459         supplying a default of view-box for the relevant SVG elements per
460         <https://www.w3.org/TR/SVG2/styling.html#UAStyleSheet>.
461
462         For non-SVG elements, the used value is always border-box, so there is no change
463         in behavior.
464
465         Tests: fast/css/transform-box-parsing.html
466                svg/transforms/svg-transform-box.html
467
468         * css/CSSComputedStyleDeclaration.cpp:
469         (WebCore::ComputedStyleExtractor::propertyValue):
470         * css/CSSPrimitiveValueMappings.h:
471         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
472         (WebCore::CSSPrimitiveValue::operator TransformBox):
473         * css/CSSProperties.json:
474         * css/CSSValueKeywords.in:
475         * css/parser/CSSPropertyParser.cpp:
476         (WebCore::CSSPropertyParser::parseSingleValue):
477         * css/svg.css:
478         (*:not(svg),):
479         (*): Deleted.
480         (html|* > svg): Deleted.
481         * page/animation/AnimationBase.cpp:
482         (WebCore::AnimationBase::computeTransformedExtentViaTransformList):
483         * rendering/style/RenderStyle.cpp:
484         (WebCore::RenderStyle::applyTransform): The transformOriginX().isPercent() tests
485         were added to support the weird "% values are relative to bounding box" in SVG. Now
486         it's up to the caller to pass a non-zero origin when that matters, and
487         SVGGraphicsElement::animatedLocalTransform() is the only caller that does so.
488         * rendering/style/RenderStyle.h:
489         (WebCore::RenderStyle::hasTransform):
490         (WebCore::RenderStyle::transformBox):
491         (WebCore::RenderStyle::setTransformBox):
492         (WebCore::RenderStyle::initialTransformBox):
493         * rendering/style/RenderStyleConstants.h:
494         * rendering/style/StyleTransformData.cpp:
495         (WebCore::StyleTransformData::StyleTransformData):
496         (WebCore::StyleTransformData::operator==):
497         * rendering/style/StyleTransformData.h:
498         * svg/SVGGraphicsElement.cpp:
499         (WebCore::SVGGraphicsElement::animatedLocalTransform): Consult the transform-box
500         style to compute the reference box as the bounding box, or the view box.
501
502 2017-05-22  Chris Dumez  <cdumez@apple.com>
503
504         Add support for [LegacyWindowAlias] IDL extended attribute
505         https://bugs.webkit.org/show_bug.cgi?id=172451
506
507         Reviewed by Sam Weinig.
508
509         Add support for [LegacyWindowAlias] IDL extended attribute as per:
510         - https://heycam.github.io/webidl/#LegacyWindowAlias
511
512         Use it for our legacy window aliases, such as webKitURL.
513
514         No new tests, there should be no Web-exposed behavior change.
515
516         * bindings/scripts/IDLAttributes.json:
517         * bindings/scripts/preprocess-idls.pl:
518         (GenerateConstructorAttributes):
519         * css/DOMMatrix.idl:
520         * dom/MutationObserver.idl:
521         * dom/XMLDocument.idl:
522         * html/DOMURL.idl:
523         * page/DOMWindow.idl:
524
525 2017-05-22  Jer Noble  <jer.noble@apple.com>
526
527         ASSERTION FAILED: m_boundThread == currentThread() in WTF::WeakReference<WebCore::WebCoreDecompressionSession>::clear()
528         https://bugs.webkit.org/show_bug.cgi?id=172457
529         <rdar://problem/32329436>
530
531         Reviewed by Eric Carlson.
532
533         Remove vestigal WeakPtrFactory that was entirely unused.
534
535         * platform/graphics/cocoa/WebCoreDecompressionSession.h:
536         (WebCore::WebCoreDecompressionSession::createWeakPtr): Deleted.
537         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
538         (WebCore::WebCoreDecompressionSession::WebCoreDecompressionSession):
539
540 2017-05-22  Antti Koivisto  <antti@apple.com>
541
542         Crash in WebCore::StyleRuleKeyframes::findKeyframeIndex
543         https://bugs.webkit.org/show_bug.cgi?id=170756
544         <rdar://problem/31573157>
545
546         Reviewed by Andreas Kling.
547
548         Using a malformed key with CSSKeyframesRule.findRule crashes because
549         CSSParser::parseKeyframeKeyList returns null which is then dereferenced.
550
551         * css/CSSKeyframesRule.cpp:
552         (WebCore::StyleRuleKeyframes::findKeyframeIndex): Null test.
553
554 2017-05-22  Wenson Hsieh  <wenson_hsieh@apple.com>
555
556         Remove unused documentIsHandlingNonDefaultDrag plumbing for WebKit2
557         https://bugs.webkit.org/show_bug.cgi?id=172453
558
559         Reviewed by Tim Horton.
560
561         Removes unused plumbing that was originally added to support file uploads. No new tests, since there is no
562         change in behavior.
563
564         * page/DragController.h:
565         (WebCore::DragController::documentIsHandlingNonDefaultDrag): Deleted.
566
567 2017-05-22  Jer Noble  <jer.noble@apple.com>
568
569         Media element thinks its hidden when in PiP mode and tab is backgrounded.
570         https://bugs.webkit.org/show_bug.cgi?id=172221
571
572         Reviewed by Eric Carlson.
573
574         The element should not be considered hidden when in legacy fullscreen mode or PiP mode.
575
576         * html/HTMLMediaElement.cpp:
577         (WebCore::HTMLMediaElement::visibilityStateChanged):
578         (WebCore::HTMLMediaElement::fullscreenModeChanged):
579
580 2017-05-22  Zan Dobersek  <zdobersek@igalia.com>
581
582         NavigatorEME: null RefPtr<> dereference due to different calling conventions
583         https://bugs.webkit.org/show_bug.cgi?id=172352
584
585         Reviewed by Carlos Garcia Campos.
586
587         * Modules/encryptedmedia/NavigatorEME.cpp:
588         (WebCore::tryNextSupportedConfiguration): Avoid crashes when constructing
589         the MediaKeySystemAccess::create() arguments that can occur for targets with
590         calling conventions that might release the implementation RefPtr<> before it's
591         dereferenced to retrieve the key system string. Simply acquire the reference
592         to the key system String object before the MediaKeySystem::create() call
593         expression that releases the problematic RefPtr<>.
594
595 2017-05-22  Gwang Yoon Hwang  <yoon@igalia.com>
596
597         [CoordinatedGraphics] Clear UpdateAtlases for each tests
598         https://bugs.webkit.org/show_bug.cgi?id=172119
599
600         Reviewed by Carlos Garcia Campos.
601
602         * loader/EmptyClients.h:
603         * page/ChromeClient.h:
604         * testing/Internals.cpp:
605         (WebCore::Internals::resetToConsistentState): Clears update atlases
606         while resetting states of the test runner.
607
608 2017-05-22  Gwang Yoon Hwang  <yoon@igalia.com>
609
610         [CoordinatedGraphics] BitmapTexturePool does not release textures properly
611         https://bugs.webkit.org/show_bug.cgi?id=172428
612
613         Reviewed by Žan Doberšek.
614
615         No new tests because no behavior change.
616
617         * platform/graphics/texmap/BitmapTexturePool.cpp:
618         (WebCore::BitmapTexturePool::BitmapTexturePool):
619         Use the RunLoopTimer instead of Timer, because BitmapTexturePool would
620         run on the compositing thread in Coordinated Graphics case.
621         (WebCore::BitmapTexturePool::releaseUnusedTexturesTimerFired):
622         We should check not only the last used time but also the refcounts of the
623         texture when selecting textures to remove.
624         * platform/graphics/texmap/BitmapTexturePool.h:
625         (WebCore::BitmapTexturePool::Entry::canBeReleased): Added.
626
627 2017-05-21  Carlos Garcia Campos  <cgarcia@igalia.com>
628
629         [WPE] Use surfaceless context for sharing and offscreen context if available
630         https://bugs.webkit.org/show_bug.cgi?id=172268
631
632         Reviewed by Žan Doberšek.
633
634         Like GTK+ port does, WPE should use surfaceless contexts when possible, and only create a native offscreen
635         context as a fallback. We don't need to do anything special in WPE port, just to make it consistent with the
636         Wayland and X11 implementations. We should also avoid including EGL.h in headers, we added
637         GLContextEGLWayland.cpp and GLContextEGLX11.cpp to avoid that. PlatformDisplayWPE::EGLOffscreenTarget is quite
638         simple and only used by GLContextEGLWPE, so we could move it there like we do for Wayland and X11.
639
640         * platform/graphics/GLContext.h: Remove EGL header includes.
641         * platform/graphics/egl/GLContextEGL.cpp:
642         (WebCore::GLContextEGL::createWindowContext): Use createWindowSurfaceWPE() in WPE.
643         (WebCore::GLContextEGL::createContext): Use createWPEContext in WPE.
644         (WebCore::GLContextEGL::createSharingContext): Move the WPE code below to ensure we try
645         createSurfacelessContext() first.
646         * platform/graphics/egl/GLContextEGL.h:
647         * platform/graphics/egl/GLContextEGLWPE.cpp:
648         (WebCore::GLContextEGL::GLContextEGL): Add constructor for WPE that receives a struct wpe_renderer_backend_egl_offscreen_target*
649         (WebCore::GLContextEGL::createWindowSurfaceWPE): Added implementation here because eglCreateWindowSurface needs
650         the platform specific EGL includes and definitions.
651         (WebCore::GLContextEGL::createWPEContext): Create a GLContext using WPE backend API directly here.
652         (WebCore::GLContextEGL::destroyWPETarget): Add null check.
653         * platform/graphics/wpe/PlatformDisplayWPE.cpp: Remove EGLOffscreenTarget.
654         * platform/graphics/wpe/PlatformDisplayWPE.h:
655
656 2017-05-21  Michael Catanzaro  <mcatanzaro@igalia.com>
657
658         [GTK] Remove Firefox user agent quirk for Google domains
659         https://bugs.webkit.org/show_bug.cgi?id=171941
660
661         Reviewed by Carlos Garcia Campos.
662
663         * platform/UserAgentQuirks.cpp:
664         (WebCore::UserAgentQuirks::quirksForURL):
665         (WebCore::UserAgentQuirks::stringForQuirk):
666         (WebCore::urlRequiresFirefoxBrowser): Deleted.
667         (WebCore::UserAgentQuirks::firefoxRevisionString): Deleted.
668         * platform/UserAgentQuirks.h:
669         * platform/gtk/UserAgentGtk.cpp:
670         (WebCore::buildUserAgentString):
671
672 2017-05-21  Antti Koivisto  <antti@apple.com>
673
674         matchMedia('print').addListener() fires in WK1 but never in WK2 when printing (breaks printing Google maps, QuickLooks)
675         https://bugs.webkit.org/show_bug.cgi?id=172361
676         <rdar://problem/28777408>
677
678         Reviewed by Sam Weinig.
679
680         Test: fast/media/matchMedia-print.html
681
682         * page/FrameView.cpp:
683         (WebCore::FrameView::layout):
684
685             Evaluate matchMedia queries unconditionally. No idea why it wasn't like that.
686
687         * testing/Internals.cpp:
688         (WebCore::Internals::setPrinting):
689
690             Add testing support. The existing ways to do printing testing were unable to hit this bug as
691             they had too much additional gunk.
692
693         * testing/Internals.h:
694         * testing/Internals.idl:
695
696 2017-05-21  Zalan Bujtas  <zalan@apple.com>
697
698         Remove redundant FrameView ref in FrameView::performPostLayoutTasks
699         https://bugs.webkit.org/show_bug.cgi?id=172422
700
701         Reviewed by Antti Koivisto.
702
703         This was added to protect FrameView from getting destroyed in updateEmbeddedObjects(), but r169475 changed
704         the embedded object update to be asynchronous.  
705
706         * page/FrameView.cpp:
707         (WebCore::FrameView::performPostLayoutTasks):
708
709 2017-05-20  Chris Dumez  <cdumez@apple.com>
710
711         Drop [NoInterfaceObject] from RTCDTMFSender and RTCStatsReport
712         https://bugs.webkit.org/show_bug.cgi?id=172418
713
714         Reviewed by Youenn Fablet.
715
716         Drop [NoInterfaceObject] from RTCDTMFSender and RTCStatsReport to match the specification:
717         - https://www.w3.org/TR/webrtc/#rtcdtmfsender
718         - https://www.w3.org/TR/webrtc/#rtcstatsreport-object
719
720         Firefox exposes both RTCDTMFSender and RTCStatsReport. Chrome exposes RTCStatsReport only.
721         RTCDTMFSender seems to be currently disabled at build time currently so the change to
722         its interface does not currently impact Web-exposed behavior, only the change to the
723         RTCStatsReport interface currently does.
724
725         No new tests, rebaselined existing test.
726
727         * Modules/mediastream/RTCDTMFSender.idl:
728         * Modules/mediastream/RTCStatsReport.idl:
729         Drop [NoInterfaceObject].
730
731         * Modules/mediastream/RTCIceCandidateEvent.cpp: Removed.
732         * Modules/mediastream/RTCIceCandidateEvent.h: Removed.
733         * Modules/mediastream/RTCIceCandidateEvent.idl: Removed.
734         Drop class and IDL that are no longer used. They were not even part of any project files.
735         RTCIceCandidateEvent has been renamed to RTCPeerConnectionIceEvent, which we support.
736
737 2017-05-20  Chris Dumez  <cdumez@apple.com>
738
739         Value for iterator property is wrong for maplike interfaces
740         https://bugs.webkit.org/show_bug.cgi?id=172410
741
742         Reviewed by Sam Weinig.
743
744         Value for iterator property was wrong for maplike interfaces. The iterator property is
745         supposed to have the same value as the 'entries' property but we were using the value
746         of the 'values' property.
747
748         Specification:
749         - https://heycam.github.io/webidl/#es-map-entries
750         - https://heycam.github.io/webidl/#es-iterator
751
752         This impacts the iterator of the RTCStatsReport interface.
753
754         No new tests, updated existing test.
755
756         * bindings/scripts/CodeGeneratorJS.pm:
757         (GenerateImplementation):
758         * bindings/scripts/test/JS/JSMapLike.cpp:
759         (WebCore::JSMapLikePrototype::finishCreation):
760         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
761         (WebCore::JSReadOnlyMapLikePrototype::finishCreation):
762
763 2017-05-20  Chris Dumez  <cdumez@apple.com>
764
765         Drop superfluous iterator property setting in addValueIterableMethods()
766         https://bugs.webkit.org/show_bug.cgi?id=172409
767
768         Reviewed by Youenn Fablet.
769
770         Drop superfluous iterator setting in addValueIterableMethods(). The bindings already take care of
771         adding the iterator property before calling addValueIterableMethods().
772
773         No new tests, no Web-facing behavior change.
774
775         * bindings/js/JSDOMIterator.cpp:
776         (WebCore::addValueIterableMethods):
777
778 2017-05-20  Jer Noble  <jer.noble@apple.com>
779
780         [MSE][Mac] Support painting MSE video-element to canvas
781         https://bugs.webkit.org/show_bug.cgi?id=125157
782         <rdar://problem/23062016>
783
784         Reviewed by Eric Carlson.
785
786         Test: media/media-source/media-source-paint-to-canvas.html
787
788         In order to have access to decoded video data for painting, decode the encoded samples manually
789         instead of adding them to the AVSampleBufferDisplayLayer. To facilitate doing so, add a new
790         utility class WebCoreDecompressionSession, which can decode samples and store them.
791
792         For the purposes of this patch, to avoid double-decoding of video data and to avoid severe complication
793         of our sample delivery pipeline, we will only support painting of decoded video samples when the video is
794         not displayed in the DOM.
795
796         * Modules/mediasource/MediaSource.cpp:
797         (WebCore::MediaSource::seekToTime): Always send waitForSeekCompleted() to give private a chance to delay seek completion.
798         * Modules/mediasource/SourceBuffer.cpp:
799         (WebCore::SourceBuffer::sourceBufferPrivateReenqueSamples): Added.
800         * Modules/mediasource/SourceBuffer.h:
801         * WebCore.xcodeproj/project.pbxproj:
802         * platform/cf/CoreMediaSoftLink.cpp: Added new soft link macros.
803         * platform/cf/CoreMediaSoftLink.h: Ditto.
804         * platform/cocoa/CoreVideoSoftLink.cpp: Ditto.
805         * platform/cocoa/CoreVideoSoftLink.h: Ditto.
806         * platform/graphics/SourceBufferPrivateClient.h:
807         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
808         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sampleBufferDisplayLayer): Simple accessor.
809         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::decompressionSession): Ditto.
810         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
811         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
812         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::load): Update whether we should be displaying in a layer or decompression session..
813         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVisible): Ditto.
814         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitForSeekCompleted): m_seeking is now an enum.
815         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seeking): Ditto.
816         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekCompleted): Ditto. If waiting for a video frame, delay completing seek.
817         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::nativeImageForCurrentTime): Call updateLastImage() and return result.
818         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateLastImage): Fetch the image for the current time.
819         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::paint): Pass to paintCurrentFrameInCanvas.
820         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::paintCurrentFrameInContext): Get a native image, and render it.
821         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::acceleratedRenderingStateChanged): Create or destroy a layer or decompression session as appropriate.
822         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer): Creates a layer.
823         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyLayer): Destroys a layer.
824         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureDecompressionSession): Creates a decompression session.
825         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyDecompressionSession): Destroys a decompression session.
826         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableVideoFrame): If seek completion delayed, complete now. Ditto for ready state change.
827         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setReadyState): If waiting for a video frame, delay ready state change.
828         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addDisplayLayer): Deleted.
829         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::removeDisplayLayer): Deleted.
830         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
831         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
832         (WebCore::MediaSourcePrivateAVFObjC::hasVideo): Promote to a class function.
833         (WebCore::MediaSourcePrivateAVFObjC::hasSelectedVideo): Return whether any of the active source buffers have video and are selected.
834         (WebCore::MediaSourcePrivateAVFObjC::hasSelectedVideoChanged): Call setSourceBufferWithSelectedVideo().
835         (WebCore::MediaSourcePrivateAVFObjC::setVideoLayer): Set (or clear) the layer on the selected buffer.
836         (WebCore::MediaSourcePrivateAVFObjC::setDecompressionSession): Ditto for decompression session.
837         (WebCore::MediaSourcePrivateAVFObjC::setSourceBufferWithSelectedVideo): Remove the layer and decompression session from the unselected
838
839                 buffer and add the decompression session or layer to the newly selected buffer.
840         (WebCore::MediaSourcePrivateAVFObjCHasVideo): Deleted.
841         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
842         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
843         (WebCore::SourceBufferPrivateAVFObjC::destroyRenderers): Clear the videoLayer and decompressionSession.
844         (WebCore::SourceBufferPrivateAVFObjC::hasSelectedVideo): Return whether the buffer has a selected video track.
845         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled): The media player now manages the video layer and decompression session lifetimes.
846         (WebCore::SourceBufferPrivateAVFObjC::flush): Flush the decompression session, if it exists.
847         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Enqueue to the decompression session, if it exists.
848         (WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples): As the decompression session, if it exists.
849         (WebCore::SourceBufferPrivateAVFObjC::didBecomeReadyForMoreSamples): Tell the decompression session to stop requesting data, if it exists.
850         (WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples): Request media data from the decompression session, if it exists.
851         (WebCore::SourceBufferPrivateAVFObjC::setVideoLayer): Added.
852         (WebCore::SourceBufferPrivateAVFObjC::setDecompressionSession): Added.
853         * platform/graphics/cocoa/WebCoreDecompressionSession.h: Added.
854         (WebCore::WebCoreDecompressionSession::create):
855         (WebCore::WebCoreDecompressionSession::isInvalidated):
856         (WebCore::WebCoreDecompressionSession::createWeakPtr):
857         * platform/graphics/cocoa/WebCoreDecompressionSession.mm: Added.
858         (WebCore::WebCoreDecompressionSession::WebCoreDecompressionSession): Register for media data requests.
859         (WebCore::WebCoreDecompressionSession::invalidate):  Unregister for same.
860         (WebCore::WebCoreDecompressionSession::maybeBecomeReadyForMoreMediaDataCallback): Pass to maybeBecomeReadyForMoreMediaData.
861         (WebCore::WebCoreDecompressionSession::maybeBecomeReadyForMoreMediaData): Check in-flight decodes, and decoded frame counts.
862         (WebCore::WebCoreDecompressionSession::enqueueSample): Pass the sample to be decoded on a background queue.
863         (WebCore::WebCoreDecompressionSession::decodeSample): Decode the sample.
864         (WebCore::WebCoreDecompressionSession::decompressionOutputCallback): Call handleDecompressionOutput.
865         (WebCore::WebCoreDecompressionSession::handleDecompressionOutput): Pass decoded sample to be enqueued on the main thread.
866         (WebCore::WebCoreDecompressionSession::getFirstVideoFrame):
867         (WebCore::WebCoreDecompressionSession::enqueueDecodedSample): Enqueue the frame (if it's a displayed frame).
868         (WebCore::WebCoreDecompressionSession::isReadyForMoreMediaData): Return whether we've hit our high water sample count.
869         (WebCore::WebCoreDecompressionSession::requestMediaDataWhenReady):
870         (WebCore::WebCoreDecompressionSession::stopRequestingMediaData): Unset the same.
871         (WebCore::WebCoreDecompressionSession::notifyWhenHasAvailableVideoFrame): Set a callback to notify when a decoded frame has been enqueued.
872         (WebCore::WebCoreDecompressionSession::imageForTime): Successively dequeue images until reaching one at or beyond the requested time.
873         (WebCore::WebCoreDecompressionSession::flush): Synchronously empty the producer and consumer queues.
874         (WebCore::WebCoreDecompressionSession::getDecodeTime): Utility method.
875         (WebCore::WebCoreDecompressionSession::getPresentationTime): Ditto.
876         (WebCore::WebCoreDecompressionSession::getDuration): Ditto.
877         (WebCore::WebCoreDecompressionSession::compareBuffers): Ditto.
878         * platform/cocoa/VideoToolboxSoftLink.cpp: Added.
879         * platform/cocoa/VideoToolboxSoftLink.h: Added.
880
881 2017-05-19  Joseph Pecoraro  <pecoraro@apple.com>
882
883         WebAVStreamDataParserListener String leak
884         https://bugs.webkit.org/show_bug.cgi?id=172395
885
886         Reviewed by Chris Dumez.
887
888         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
889         (-[WebAVStreamDataParserListener streamDataParser:didProvideMediaData:forTrackID:mediaType:flags:]):
890         (-[WebAVStreamDataParserListener streamDataParser:didReachEndOfTrackWithTrackID:mediaType:]):
891         Use an isolated String in a lambda used across threads.
892
893 2017-05-19  Chris Dumez  <cdumez@apple.com>
894
895         Consider not exposing webkitURL in workers
896         https://bugs.webkit.org/show_bug.cgi?id=172166
897
898         Reviewed by Geoffrey Garen.
899
900         Drop webkitURL alias for URL in workers, to match other browsers. The risk should
901         be low given that this only impacts workers, we expose URL to workers and Blink
902         does not have this alias. We still support the webkitURL alias for URL on Window.
903
904         No new tests, rebaselined existing test.
905
906         * workers/WorkerGlobalScope.idl:
907
908 2017-05-19  Youenn Fablet  <youenn@apple.com>
909
910         Add RTCPeerConnection connection state change logging
911         https://bugs.webkit.org/show_bug.cgi?id=172314
912
913         Reviewed by Eric Carlson.
914
915         No change of behavior.
916         Adding some release logging of connection state changes.
917
918         * Modules/mediastream/RTCPeerConnection.cpp:
919         (WebCore::rtcIceGatheringStateToString):
920         (WebCore::RTCPeerConnection::updateIceGatheringState):
921         (WebCore::rtcIceConnectionStateToString):
922         (WebCore::RTCPeerConnection::updateIceConnectionState):
923
924 2017-05-19  Jeremy Jones  <jeremyj@apple.com>
925
926         webkitSupportsFullscreen and webkitSupportsPresentationMode('fullscreen') disagree.
927         https://bugs.webkit.org/show_bug.cgi?id=172329
928         rdar://problem/32260891
929
930         Reviewed by Darin Adler.
931
932         Updated tests:
933         * media/media-fullscreen-inline-expected.txt:
934         * media/media-fullscreen-not-in-document-expected.txt:
935         * media/media-fullscreen.js:
936
937         webkitSupportsPresentationMode('fullscreen') should delegate to webkitSupportsFullscreen.
938         The additional mediaSession().fullscreenPermitted() check causes it to return false when
939         not handling a user gesture, which isn't helpful to deciding to show a button in controls
940         or not.
941
942         * html/HTMLVideoElement.cpp:
943         (WebCore::HTMLVideoElement::webkitSupportsPresentationMode):
944
945 2017-05-19  Jeremy Jones  <jeremyj@apple.com>
946
947         Prevent javascript interface from activating picture-in-picture for video elements that are showing capture camera on ios.
948         https://bugs.webkit.org/show_bug.cgi?id=172328
949
950         Reviewed by Eric Carlson.
951
952         This change allows MediaPlayers to decide if they support pictureInPicture.
953         And check this from supportsFullscreen().
954
955         In MediaPlayerPrivateMediaStreamAVFObjC disable pip if there is a capture video track.
956         Elsewhere, leave it enabled.
957
958         * html/HTMLVideoElement.cpp:
959         (WebCore::HTMLVideoElement::supportsFullscreen): Added Check.
960         * platform/graphics/MediaPlayer.cpp:
961         (WebCore::MediaPlayer::supportsPictureInPicture): Added.
962         * platform/graphics/MediaPlayer.h:
963         * platform/graphics/MediaPlayerPrivate.h:
964         (WebCore::MediaPlayerPrivateInterface::supportsPictureInPicture): Added.
965         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
966         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
967         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
968         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
969         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::supportsPictureInPicture): Added
970         * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
971         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
972         (WebCore::MediaPlayerPrivateQTKit::supportsFullscreen): Deleted. Moved inline.
973
974 2017-05-19  Chris Dumez  <cdumez@apple.com>
975
976         Do not fire load event for SVGElements that are detached or in frameless documents
977         https://bugs.webkit.org/show_bug.cgi?id=172289
978         <rdar://problem/32275689>
979
980         Reviewed by Ryosuke Niwa.
981
982         We should not fire load event for SVGElements that are detached or in frameless
983         documents.
984
985         Test: svg/load-event-detached.html
986
987         * svg/SVGElement.cpp:
988         (WebCore::SVGElement::sendSVGLoadEventIfPossible):
989
990 2017-05-19  Chris Dumez  <cdumez@apple.com>
991
992         Option() named constructor is not per spec
993         https://bugs.webkit.org/show_bug.cgi?id=172185
994
995         Reviewed by Sam Weinig.
996
997         Align the behavior of the Option() named constructor with the HTML specification:
998         - https://html.spec.whatwg.org/#dom-option
999
1000         In particular, we no longer create an empty Text child node if the input text is the empty string.
1001         This also aligns our behavior with Firefox.
1002
1003         Test: imported/w3c/web-platform-tests/html/semantics/forms/the-option-element/option-element-constructor.html
1004
1005         * html/HTMLOptionElement.cpp:
1006         (WebCore::HTMLOptionElement::createForJSConstructor):
1007         * html/HTMLOptionElement.h:
1008         * html/HTMLOptionElement.idl:
1009
1010 2017-05-19  Chris Dumez  <cdumez@apple.com>
1011
1012         URLSearchParams / Headers objects @@iterator is not as per Web IDL spec
1013         https://bugs.webkit.org/show_bug.cgi?id=172218
1014
1015         Reviewed by Youenn Fablet.
1016
1017         Both URLSearchParams and Headers interfaces are iterable as per their
1018         respective specification, and they both have a pair iterator:
1019         - https://url.spec.whatwg.org/#interface-urlsearchparams
1020         - https://fetch.spec.whatwg.org/#headers-class
1021
1022         As per the WebIDL specification for 'entries'[1], "If the interface has a pair
1023         iterator, then the Function object is the value of the @@iterator property",
1024         the value of @@iterator being defined at [2]. In WebKit, we were using
1025         different values/functions for 'entries' and @@iterator, although those
1026         functions were doing the same thing (and the right thing).
1027
1028         Also, as per [2], the name of the @@iterator function should be "entries",
1029         which I also implemented in this patch. Previously, we were using
1030         "[Symbol.Iterator]" as function name.
1031
1032         [1] https://heycam.github.io/webidl/#es-iterable-entries
1033         [2] https://heycam.github.io/webidl/#es-iterator
1034
1035         No new tests, rebaselined existing tests.
1036
1037         * bindings/scripts/CodeGeneratorJS.pm:
1038         (GenerateImplementation):
1039         (GenerateImplementationIterableFunctions):
1040         * bindings/scripts/test/JS/JSMapLike.cpp:
1041         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
1042         * bindings/scripts/test/JS/JSTestIterable.cpp:
1043         (WebCore::JSTestIterablePrototype::finishCreation):
1044         (WebCore::jsTestIterablePrototypeFunctionEntriesCaller):
1045         * bindings/scripts/test/JS/JSTestNode.cpp:
1046         (WebCore::JSTestNodePrototype::finishCreation):
1047         (WebCore::jsTestNodePrototypeFunctionEntriesCaller):
1048
1049 2017-05-19  Zalan Bujtas  <zalan@apple.com>
1050
1051         Redundant ellipsis box triggers ASSERT_WITH_SECURITY_IMPLICATION in InlineBox::parent().
1052         https://bugs.webkit.org/show_bug.cgi?id=172309
1053         <rdar://problem/32262357>
1054
1055         Reviewed by Simon Fraser.
1056
1057         This patch stops the redundant ellipsis box trigger ASSERT_WITH_SECURITY_IMPLICATION.
1058
1059         In RootInlineBox::placeEllipsis we construct an ellipsis box and append it to a static HashMap which
1060         keeps track of the ellipsis boxes on each line. However when the line already has an ellipsis, we
1061         re-use the existing one and this newly constructed (but redundant) box gets destroyed as we return from this function.
1062         In InlineBox's d'tor, we let the parent know that now it has a dangling child and we assert on it
1063         later, while accessing the children list. However this redundant ellipsis box was never added to the line,
1064         so the assertion hits incorrectly.
1065
1066         Test: fast/inline/redundant-ellipsis-triggers-assert-incorrectly.html
1067
1068         * rendering/EllipsisBox.cpp:
1069         (WebCore::EllipsisBox::EllipsisBox):
1070         * rendering/InlineBox.cpp: This needs 32bits padding.
1071         (WebCore::InlineBox::invalidateParentChildList):
1072         * rendering/InlineBox.h:
1073         * rendering/RootInlineBox.cpp:
1074         (WebCore::RootInlineBox::placeEllipsis):
1075
1076 2017-05-19  Matt Rajca  <mrajca@apple.com>
1077
1078         Inherit media user gestures from the top document when autoplay quirks are allowed.
1079         https://bugs.webkit.org/show_bug.cgi?id=172375
1080
1081         Reviewed by Eric Carlson.
1082
1083         Added API test.
1084
1085         * dom/Document.cpp:
1086         (WebCore::Document::processingUserGestureForMedia):
1087
1088 2017-05-19  Youenn Fablet  <youenn@apple.com>
1089
1090         Align MockRealtimeMediaSourceCenter with RealtimeMediaSourceCenter
1091         https://bugs.webkit.org/show_bug.cgi?id=172324
1092
1093         Reviewed by Eric Carlson.
1094
1095         No change of behavior.
1096         Remove most of MockRealtimeMediaSourceCenter implementation.
1097         Next step should be to remove it entirely and use the factory setters instead.
1098
1099         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1100         (WebCore::RealtimeMediaSourceCenter::RealtimeMediaSourceCenter):
1101         (WebCore::RealtimeMediaSourceCenter::createMediaStream):
1102         (WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices):
1103         (WebCore::RealtimeMediaSourceCenter::setDeviceEnabled):
1104         * platform/mediastream/RealtimeMediaSourceCenter.h:
1105         (WebCore::RealtimeMediaSourceCenter::supportedConstraints):
1106         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1107         (WebCore::RealtimeMediaSourceCenterMac::RealtimeMediaSourceCenterMac):
1108         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
1109         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
1110         (WebCore::MockRealtimeMediaSourceCenter::MockCaptureDeviceManager::captureDevices):
1111         * platform/mock/MockRealtimeMediaSourceCenter.h:
1112
1113 2017-05-19  Zalan Bujtas  <zalan@apple.com>
1114
1115         Update SameSizeAsInlineBox with the correct InlineBoxBitfields bits.
1116         https://bugs.webkit.org/show_bug.cgi?id=172377
1117
1118         Reviewed by Tim Horton.
1119
1120         * rendering/InlineBox.cpp:
1121
1122 2017-05-19  Daniel Bates  <dabates@apple.com>
1123
1124         Bindings: Support runtime-enabled features in specific worlds
1125         https://bugs.webkit.org/show_bug.cgi?id=172235
1126
1127         Reviewed by Chris Dumez.
1128
1129         Currently a function, attribute, or interface can be annotated with either EnabledAtRuntime
1130         or EnabledForWorld (not both) to expose/conceal it depending on the state of a runtime
1131         feature flag or the DOM world associated with the running JavaScript code, respectively.
1132         Even though we do not have any functions, attributes, or interfaces that are annotated
1133         with both EnabledAtRuntime and EnabledForWorld at the time of writing, it seems reasonable
1134         to support such a combination of annotations. This also has the benefit of making it
1135         straightforward to support the extended attribute SecureContext by generalizing the logic
1136         that generates the code to expose/conceal a function, attribute, or interface.
1137
1138         * bindings/scripts/CodeGeneratorJS.pm:
1139         (GenerateRuntimeEnableConditionalString): Use an array to build up all the conjuncts in
1140         the conditional expression.
1141         (GenerateImplementation): Substitute GenerateRuntimeEnableConditionalString() and $runtimeEnableConditionalString
1142         for GetRuntimeEnableFunctionName() and $enable_function_result, respectively.
1143         (GetRuntimeEnableFunctionName): Deleted.
1144
1145         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1146          (WebCore::JSTestGlobalObject::finishCreation):
1147          (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabled):
1148          (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabledCaller):
1149          (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeaturesEnabled):
1150          (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeaturesEnabledCaller):
1151          Update expected results.
1152
1153          * bindings/scripts/test/JS/JSTestObj.cpp:
1154          (WebCore::JSTestObjPrototype::finishCreation):
1155          (WebCore::jsTestObjPrototypeFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabled):
1156          (WebCore::jsTestObjPrototypeFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabledCaller):
1157          Ditto.
1158
1159          * bindings/scripts/test/TestGlobalObject.idl: Added test cases.
1160          * bindings/scripts/test/TestObj.idl: Added test case.
1161
1162 2017-05-19  Jeremy Jones  <jeremyj@apple.com>
1163
1164         Fix macos build after r217143
1165         https://bugs.webkit.org/show_bug.cgi?id=172380
1166
1167         unreviewed.
1168
1169         Remove reference to WebVideoFullscreenInterface for mac build.
1170
1171         * html/HTMLMediaElement.cpp:
1172         * platform/mac/WebVideoFullscreenInterfaceMac.h:
1173
1174 2017-05-19  Jeremy Jones  <jeremyj@apple.com>
1175
1176         Remove defunct WebVideoFullscreenInterface
1177         https://bugs.webkit.org/show_bug.cgi?id=172254
1178
1179         Reviewed by Jon Lee.
1180
1181         No new tests because no behavior change.
1182
1183         WebVideoFullscreenInterface has long since been replaced by WebVideoFullscreenModelClient.
1184
1185         * WebCore.xcodeproj/project.pbxproj:
1186         * html/HTMLMediaElement.cpp:
1187         * html/HTMLVideoElement.cpp:
1188         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
1189         * platform/cocoa/WebVideoFullscreenInterface.h: Removed.
1190         * platform/cocoa/WebVideoFullscreenModel.h:
1191         * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
1192         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
1193         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
1194         * platform/mac/WebVideoFullscreenInterfaceMac.h:
1195
1196 2017-05-19  Jeremy Jones  <jeremyj@apple.com>
1197
1198         HTMLVideoElement::webkitSupportsPresentationMode allowsPictureInPicture() check is redundant.
1199         https://bugs.webkit.org/show_bug.cgi?id=172330
1200         rdar://problem/32285443
1201
1202         Reviewed by Eric Carlson.
1203
1204         No new tests because no behavior change.
1205
1206         This removes a redundant call to allowsPictureInPicture() to make it
1207         more clear that webkitSupportsPresentationMode gives the same result as 
1208         webkitSupportsFullscreen(pipMode)
1209
1210         * html/HTMLVideoElement.cpp:
1211         (WebCore::HTMLVideoElement::webkitSupportsPresentationMode):
1212
1213 2017-05-19  Jeremy Jones  <jeremyj@apple.com>
1214
1215         [WebRTC] Remove PiP support for video elements that are showing camera capture
1216         https://bugs.webkit.org/show_bug.cgi?id=172336
1217
1218         Reviewed by Eric Carlson.
1219
1220         No new tests because no effect on the DOM. This just changes a value sent to the platform interface layer.
1221
1222         Ask video element if it supports picture-in-picture instead of asking the mediaSession directly.
1223         This allows the video element to give a more robust answer.
1224
1225         * html/HTMLVideoElement.h:
1226         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
1227         (WebVideoFullscreenControllerContext::setUpFullscreen):
1228
1229 2017-05-18  Sam Weinig  <sam@webkit.org>
1230
1231         [WebIDL] Remove the need for the generator to know about native type mapping
1232         https://bugs.webkit.org/show_bug.cgi?id=172310
1233
1234         Reviewed by Darin Adler.
1235
1236         Replace the use of explicit typename to native type mappings in CodeGeneratorJS.pm
1237         with use of IDLTypes and Converter, which already need the mapping. This allows us
1238         to have the information in only one spot.
1239
1240         Also, callback generation to account for nullability and update the IDLs to correctly
1241         annotate only the types that need to be nullable. 
1242
1243         * Modules/geolocation/GeoNotifier.cpp:
1244         * Modules/geolocation/GeoNotifier.h:
1245         * Modules/geolocation/Geolocation.cpp:
1246         * Modules/geolocation/Geolocation.h:
1247         * Modules/geolocation/PositionCallback.idl:
1248         * Modules/geolocation/PositionErrorCallback.h:
1249         Use references where possible in the Geolocation code. It was almost possible
1250         to make PositionCallback take a non-nullable position, but some odd logic in
1251         Geolocation::makeCachedPositionCallbacks() implies that there is a path where
1252         passing null is possible, though it would assert. Added FIXME's to return to
1253         this in a follow up.
1254
1255         * Modules/webaudio/AudioBufferCallback.idl:
1256         Add nullable annotation and FIXME explaining that the latest spec splits the callback
1257         into two separate ones.
1258
1259         * Modules/webdatabase/Database.cpp:
1260         (WebCore::Database::runTransaction):
1261         * Modules/webdatabase/DatabaseCallback.h:
1262         * Modules/webdatabase/DatabaseManager.cpp:
1263         (WebCore::DatabaseManager::openDatabase):
1264         * Modules/webdatabase/SQLStatement.cpp:
1265         (WebCore::SQLStatement::performCallback):
1266         * Modules/webdatabase/SQLStatementCallback.h:
1267         * Modules/webdatabase/SQLStatementErrorCallback.h:
1268         * Modules/webdatabase/SQLTransaction.cpp:
1269         (WebCore::SQLTransaction::deliverTransactionCallback):
1270         (WebCore::SQLTransaction::deliverTransactionErrorCallback):
1271         * Modules/webdatabase/SQLTransactionCallback.h:
1272         * Modules/webdatabase/SQLTransactionErrorCallback.h:
1273         * inspector/InspectorDatabaseAgent.cpp:
1274         * bindings/js/JSSQLStatementErrorCallbackCustom.cpp:
1275         (WebCore::JSSQLStatementErrorCallback::handleEvent):
1276         Update to pass callback parameters as references, since they are never null.
1277
1278         * bindings/IDLTypes.h:
1279         Add NullableParameterType to allow customization of nullable parameters (in much
1280         the same way we allow customization of the nullable implementation type).
1281
1282         * bindings/scripts/CodeGeneratorJS.pm:
1283         (GenerateDefaultValue):
1284         Use Converter<>::ReturnType{ } for default values rather than ${GetNativeType..}().
1285
1286         (GenerateHeader):
1287         Remove use of GetNativeType for toWrapped by using the impl type, since this will never
1288         be a complex type.
1289
1290         (GenerateImplementation):
1291         Simplify DOMJIT UnsafeToNative by merging two identical paths and using auto.
1292
1293         (GenerateParametersCheck):
1294         Rework parameter checks to use more specific variable names, make branches more clear,
1295         and use Converter<>::ReturnType rather than GetNativeType.
1296
1297         (GenerateCallbackHeaderContent):
1298         (GenerateCallbackImplementationContent):
1299         Switch to using typename ${IDLType}::ParameterType as the parameters for callback functions. Also
1300         add final and override to make sure the generated function matches the user provided base class.
1301         (GetNativeType): Deleted.
1302         (GetNativeInnerType): Deleted.
1303         (GetNativeTypeForCallbacks): Deleted.
1304         Remove native type mappings.
1305
1306         * css/MediaQueryListListener.h:
1307         * css/MediaQueryListListener.idl:
1308         * css/MediaQueryMatcher.cpp:
1309         Update MediaQueryListListener to take a non-nullable MediaQueryList.
1310         
1311         * dom/NativeNodeFilter.cpp:
1312         * dom/NativeNodeFilter.h:
1313         * dom/NodeFilter.h:
1314         * dom/NodeFilter.idl:
1315         * dom/NodeIterator.cpp:
1316         * dom/Traversal.cpp:
1317         * dom/Traversal.h:
1318         * dom/TreeWalker.cpp:
1319         * bindings/js/JSNodeFilterCustom.cpp:
1320         Update acceptNode to be non-nullable and pass the Node by reference.
1321
1322         * dom/StringCallback.cpp:
1323         * dom/StringCallback.h:
1324         Pass the ScriptExecutionContext by reference.
1325
1326         * page/IntersectionObserverCallback.h:
1327         Update to match new parameter types and pass IntersectionObserver by reference.
1328
1329         * page/PerformanceObserver.cpp:
1330         * page/PerformanceObserverCallback.h:
1331         Update to pass PerformanceObserverEntryList and PerformanceObserver by reference.
1332
1333         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
1334         * bindings/scripts/test/JS/JSTestCallbackFunction.h:
1335         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
1336         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h:
1337         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
1338         * bindings/scripts/test/JS/JSTestCallbackInterface.h:
1339         * bindings/scripts/test/JS/JSTestObj.cpp:
1340         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1341         Update test results.
1342
1343         * bindings/scripts/test/TestCallbackInterface.idl:
1344         Update test to refer to actual interfaces as we now do lookup on these parameter 
1345         types rather than blindly assuming they are interfaces.
1346
1347 2017-05-19  Commit Queue  <commit-queue@webkit.org>
1348
1349         Unreviewed, rolling out r217098, r217111, r217113, and
1350         r217114.
1351         https://bugs.webkit.org/show_bug.cgi?id=172367
1352
1353         These changes broke the Windows build and introduced
1354         LayoutTest failures (Requested by ryanhaddad on #webkit).
1355
1356         Reverted changesets:
1357
1358         "[MSE][Mac] Support painting MSE video-element to canvas"
1359         https://bugs.webkit.org/show_bug.cgi?id=125157
1360         http://trac.webkit.org/changeset/217098
1361
1362         "[MSE][Mac] Support painting MSE video-element to canvas"
1363         https://bugs.webkit.org/show_bug.cgi?id=125157
1364         http://trac.webkit.org/changeset/217111
1365
1366         "Unreviewed build fix; add undefined functions and constants
1367         to the CoreMediaSoftLink.h, and use the"
1368         http://trac.webkit.org/changeset/217113
1369
1370         "[MSE][Mac] Support painting MSE video-element to canvas"
1371         https://bugs.webkit.org/show_bug.cgi?id=125157
1372         http://trac.webkit.org/changeset/217114
1373
1374 2017-05-19  Andy Estes  <aestes@apple.com>
1375
1376         REGRESSION (r217078): window.ApplePaySession is undefined on macOS Sierra
1377         https://bugs.webkit.org/show_bug.cgi?id=172344
1378
1379         Reviewed by Tim Horton.
1380
1381         r213673 mistakenly changed the ApplePaySession interface from being conditional on
1382         APPLE_PAY to being conditional on APPLE_PAY_DELEGATE, so when r217078 disabled
1383         APPLE_PAY_DELEGATE on Sierra and earlier it disabled ApplePaySession.
1384
1385         Fix this by reverting ApplePaySession to being conditional on APPLE_PAY.
1386
1387         Fixes http/tests/ssl/applepay/ApplePaySession.html
1388
1389         * Modules/applepay/ApplePaySession.idl:
1390
1391 2017-05-19  Chris Dumez  <cdumez@apple.com>
1392
1393         CSSOM insertRule() index argument is optional with default 0
1394         https://bugs.webkit.org/show_bug.cgi?id=172219
1395
1396         Reviewed by Sam Weinig.
1397
1398         Index parameter to CSSSupportsRule.insertRule() and CSSStyleSheet.insertRule() should
1399         be optional with a default value of 0, as per the latest specification:
1400         - https://github.com/w3c/csswg-drafts/commit/7949d41a2d86107f8ad4624c055b4b0c9c28ad0d
1401         - https://www.w3.org/Bugs/Public/show_bug.cgi?id=27384
1402
1403         Tests: imported/w3c/web-platform-tests/cssom/insertRule-charset-no-index.html
1404                imported/w3c/web-platform-tests/cssom/insertRule-import-no-index.html
1405                imported/w3c/web-platform-tests/cssom/insertRule-namespace-no-index.html
1406                imported/w3c/web-platform-tests/cssom/insertRule-no-index.html
1407
1408         * css/CSSStyleSheet.cpp:
1409         * css/CSSStyleSheet.h:
1410         * css/CSSStyleSheet.idl:
1411         * css/CSSSupportsRule.idl:
1412
1413 2017-05-19  Carlos Garcia Campos  <cgarcia@igalia.com>
1414
1415         [Threaded Compositor] Remove platform ifdefs from threaded compositor implementation
1416         https://bugs.webkit.org/show_bug.cgi?id=172265
1417
1418         Reviewed by Žan Doberšek.
1419
1420         Remove PlatformDisplayWPE::EGLTarget.
1421
1422         * platform/graphics/wpe/PlatformDisplayWPE.cpp:
1423         * platform/graphics/wpe/PlatformDisplayWPE.h:
1424
1425 2017-05-19  Jer Noble  <jer.noble@apple.com>
1426
1427         Unreviewed build fix; add undefined functions and constants to the CoreMediaSoftLink.h, and use the
1428         correct (and previously soft-linked) method in WebCoreDecompressionSession.
1429
1430         * platform/cf/CoreMediaSoftLink.cpp:
1431         * platform/cf/CoreMediaSoftLink.h:
1432         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
1433         (WebCore::WebCoreDecompressionSession::imageForTime):
1434
1435 2017-05-19  Yusuke Suzuki  <utatane.tea@gmail.com>
1436
1437         [JSC][DFG][DOMJIT] Extend CheckDOM to CheckSubClass
1438         https://bugs.webkit.org/show_bug.cgi?id=172098
1439
1440         Reviewed by Saam Barati.
1441
1442         Add DOMJIT interface IDL attribute. Which allows us to define checkSubClassPatchpointFor${className}
1443         function for that ClassInfo. And we move CheckSubClass patchpoint implementation to ClassInfo's member
1444
1445         * CMakeLists.txt:
1446         * WebCore.xcodeproj/project.pbxproj:
1447         * bindings/js/JSDOMGlobalObject.cpp:
1448         * bindings/js/JSDOMWindowBase.cpp:
1449         * bindings/js/JSDOMWindowProperties.cpp:
1450         * bindings/js/JSDOMWindowShell.cpp:
1451         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
1452         * bindings/js/JSWorkerGlobalScopeBase.cpp:
1453         * bindings/scripts/CodeGeneratorJS.pm:
1454         (GenerateHeader):
1455         (GenerateImplementation):
1456         (GenerateImplementationIterableFunctions):
1457         (GenerateConstructorHelperMethods):
1458         * bindings/scripts/IDLAttributes.json:
1459         * bindings/scripts/test/JS/JSInterfaceName.cpp:
1460         * bindings/scripts/test/JS/JSMapLike.cpp:
1461         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
1462         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
1463         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
1464         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
1465         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
1466         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
1467         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
1468         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
1469         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
1470         * bindings/scripts/test/JS/JSTestDOMJIT.h:
1471         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
1472         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1473         * bindings/scripts/test/JS/JSTestException.cpp:
1474         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
1475         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1476         * bindings/scripts/test/JS/JSTestInterface.cpp:
1477         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
1478         * bindings/scripts/test/JS/JSTestIterable.cpp:
1479         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
1480         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
1481         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
1482         * bindings/scripts/test/JS/JSTestNode.cpp:
1483         * bindings/scripts/test/JS/JSTestObj.cpp:
1484         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1485         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
1486         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
1487         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
1488         * bindings/scripts/test/JS/JSTestSerialization.cpp:
1489         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
1490         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
1491         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
1492         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1493         * bridge/c/CRuntimeObject.cpp:
1494         * bridge/c/c_instance.cpp:
1495         * bridge/objc/ObjCRuntimeObject.mm:
1496         * bridge/objc/objc_instance.mm:
1497         * bridge/objc/objc_runtime.mm:
1498         * bridge/runtime_array.cpp:
1499         * bridge/runtime_method.cpp:
1500         * bridge/runtime_object.cpp:
1501         * dom/Document.idl:
1502         * dom/DocumentFragment.idl:
1503         * dom/Element.idl:
1504         * dom/Event.idl:
1505         * dom/Node.idl:
1506         * domjit/JSDocumentDOMJIT.cpp:
1507         (WebCore::checkSubClassPatchpointForJSDocument):
1508         (WebCore::DocumentDocumentElementDOMJIT::checkDOM): Deleted.
1509         (WebCore::DocumentBodyDOMJIT::checkDOM): Deleted.
1510         * domjit/JSDocumentFragmentDOMJIT.cpp: Copied from Source/JavaScriptCore/runtime/JSMap.cpp.
1511         (WebCore::checkSubClassPatchpointForJSDocumentFragment):
1512         * domjit/JSElementDOMJIT.cpp: Copied from Source/JavaScriptCore/tools/JSDollarVM.cpp.
1513         (WebCore::checkSubClassPatchpointForJSElement):
1514         * domjit/JSEventDOMJIT.cpp: Copied from Source/JavaScriptCore/tools/JSDollarVM.cpp.
1515         (WebCore::checkSubClassPatchpointForJSEvent):
1516         * domjit/JSNodeDOMJIT.cpp:
1517         (WebCore::checkSubClassPatchpointForJSNode):
1518         (WebCore::NodeFirstChildDOMJIT::checkDOM): Deleted.
1519         (WebCore::NodeLastChildDOMJIT::checkDOM): Deleted.
1520         (WebCore::NodeNextSiblingDOMJIT::checkDOM): Deleted.
1521         (WebCore::NodePreviousSiblingDOMJIT::checkDOM): Deleted.
1522         (WebCore::NodeParentNodeDOMJIT::checkDOM): Deleted.
1523         (WebCore::NodeNodeTypeDOMJIT::checkDOM): Deleted.
1524         (WebCore::NodeOwnerDocumentDOMJIT::checkDOM): Deleted.
1525
1526 2017-05-18  Jer Noble  <jer.noble@apple.com>
1527
1528         [MSE][Mac] Support painting MSE video-element to canvas
1529         https://bugs.webkit.org/show_bug.cgi?id=125157
1530         <rdar://problem/23062016>
1531
1532         Reviewed by Eric Carlson.
1533
1534         Test: media/media-source/media-source-paint-to-canvas.html
1535
1536         In order to have access to decoded video data for painting, decode the encoded samples manually
1537         instead of adding them to the AVSampleBufferDisplayLayer. To facilitate doing so, add a new
1538         utility class WebCoreDecompressionSession, which can decode samples and store them.
1539
1540         For the purposes of this patch, to avoid double-decoding of video data and to avoid severe complication
1541         of our sample delivery pipeline, we will only support painting of decoded video samples when the video is
1542         not displayed in the DOM.
1543
1544         * Modules/mediasource/MediaSource.cpp:
1545         (WebCore::MediaSource::seekToTime): Always send waitForSeekCompleted() to give private a chance to delay seek completion.
1546         * Modules/mediasource/SourceBuffer.cpp:
1547         (WebCore::SourceBuffer::sourceBufferPrivateReenqueSamples): Added.
1548         * Modules/mediasource/SourceBuffer.h:
1549         * WebCore.xcodeproj/project.pbxproj:
1550         * platform/cf/CoreMediaSoftLink.cpp: Added new soft link macros.
1551         * platform/cf/CoreMediaSoftLink.h: Ditto.
1552         * platform/cocoa/CoreVideoSoftLink.cpp: Ditto.
1553         * platform/cocoa/CoreVideoSoftLink.h: Ditto.
1554         * platform/graphics/SourceBufferPrivateClient.h:
1555         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
1556         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sampleBufferDisplayLayer): Simple accessor.
1557         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::decompressionSession): Ditto.
1558         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1559         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
1560         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::load): Update whether we should be displaying in a layer or decompression session..
1561         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVisible): Ditto.
1562         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitForSeekCompleted): m_seeking is now an enum.
1563         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seeking): Ditto.
1564         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekCompleted): Ditto. If waiting for a video frame, delay completing seek.
1565         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::nativeImageForCurrentTime): Call updateLastImage() and return result.
1566         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateLastImage): Fetch the image for the current time.
1567         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::paint): Pass to paintCurrentFrameInCanvas.
1568         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::paintCurrentFrameInContext): Get a native image, and render it.
1569         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::acceleratedRenderingStateChanged): Create or destroy a layer or decompression session as appropriate.
1570         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer): Creates a layer.
1571         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyLayer): Destroys a layer.
1572         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureDecompressionSession): Creates a decompression session.
1573         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyDecompressionSession): Destroys a decompression session.
1574         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableVideoFrame): If seek completion delayed, complete now. Ditto for ready state change.
1575         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setReadyState): If waiting for a video frame, delay ready state change.
1576         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addDisplayLayer): Deleted.
1577         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::removeDisplayLayer): Deleted.
1578         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
1579         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
1580         (WebCore::MediaSourcePrivateAVFObjC::hasVideo): Promote to a class function.
1581         (WebCore::MediaSourcePrivateAVFObjC::hasSelectedVideo): Return whether any of the active source buffers have video and are selected.
1582         (WebCore::MediaSourcePrivateAVFObjC::hasSelectedVideoChanged): Call setSourceBufferWithSelectedVideo().
1583         (WebCore::MediaSourcePrivateAVFObjC::setVideoLayer): Set (or clear) the layer on the selected buffer.
1584         (WebCore::MediaSourcePrivateAVFObjC::setDecompressionSession): Ditto for decompression session.
1585         (WebCore::MediaSourcePrivateAVFObjC::setSourceBufferWithSelectedVideo): Remove the layer and decompression session from the unselected
1586
1587                 buffer and add the decompression session or layer to the newly selected buffer.
1588         (WebCore::MediaSourcePrivateAVFObjCHasVideo): Deleted.
1589         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
1590         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1591         (WebCore::SourceBufferPrivateAVFObjC::destroyRenderers): Clear the videoLayer and decompressionSession.
1592         (WebCore::SourceBufferPrivateAVFObjC::hasSelectedVideo): Return whether the buffer has a selected video track.
1593         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled): The media player now manages the video layer and decompression session lifetimes.
1594         (WebCore::SourceBufferPrivateAVFObjC::flush): Flush the decompression session, if it exists.
1595         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Enqueue to the decompression session, if it exists.
1596         (WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples): As the decompression session, if it exists.
1597         (WebCore::SourceBufferPrivateAVFObjC::didBecomeReadyForMoreSamples): Tell the decompression session to stop requesting data, if it exists.
1598         (WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples): Request media data from the decompression session, if it exists.
1599         (WebCore::SourceBufferPrivateAVFObjC::setVideoLayer): Added.
1600         (WebCore::SourceBufferPrivateAVFObjC::setDecompressionSession): Added.
1601         * platform/graphics/cocoa/WebCoreDecompressionSession.h: Added.
1602         (WebCore::WebCoreDecompressionSession::create):
1603         (WebCore::WebCoreDecompressionSession::isInvalidated):
1604         (WebCore::WebCoreDecompressionSession::createWeakPtr):
1605         * platform/graphics/cocoa/WebCoreDecompressionSession.mm: Added.
1606         (WebCore::WebCoreDecompressionSession::WebCoreDecompressionSession): Register for media data requests.
1607         (WebCore::WebCoreDecompressionSession::invalidate):  Unregister for same.
1608         (WebCore::WebCoreDecompressionSession::maybeBecomeReadyForMoreMediaDataCallback): Pass to maybeBecomeReadyForMoreMediaData.
1609         (WebCore::WebCoreDecompressionSession::maybeBecomeReadyForMoreMediaData): Check in-flight decodes, and decoded frame counts.
1610         (WebCore::WebCoreDecompressionSession::enqueueSample): Pass the sample to be decoded on a background queue.
1611         (WebCore::WebCoreDecompressionSession::decodeSample): Decode the sample.
1612         (WebCore::WebCoreDecompressionSession::decompressionOutputCallback): Call handleDecompressionOutput.
1613         (WebCore::WebCoreDecompressionSession::handleDecompressionOutput): Pass decoded sample to be enqueued on the main thread.
1614         (WebCore::WebCoreDecompressionSession::getFirstVideoFrame):
1615         (WebCore::WebCoreDecompressionSession::enqueueDecodedSample): Enqueue the frame (if it's a displayed frame).
1616         (WebCore::WebCoreDecompressionSession::isReadyForMoreMediaData): Return whether we've hit our high water sample count.
1617         (WebCore::WebCoreDecompressionSession::requestMediaDataWhenReady):
1618         (WebCore::WebCoreDecompressionSession::stopRequestingMediaData): Unset the same.
1619         (WebCore::WebCoreDecompressionSession::notifyWhenHasAvailableVideoFrame): Set a callback to notify when a decoded frame has been enqueued.
1620         (WebCore::WebCoreDecompressionSession::imageForTime): Successively dequeue images until reaching one at or beyond the requested time.
1621         (WebCore::WebCoreDecompressionSession::flush): Synchronously empty the producer and consumer queues.
1622         (WebCore::WebCoreDecompressionSession::getDecodeTime): Utility method.
1623         (WebCore::WebCoreDecompressionSession::getPresentationTime): Ditto.
1624         (WebCore::WebCoreDecompressionSession::getDuration): Ditto.
1625         (WebCore::WebCoreDecompressionSession::compareBuffers): Ditto.
1626         * platform/cocoa/VideoToolboxSoftLink.cpp: Added.
1627         * platform/cocoa/VideoToolboxSoftLink.h: Added.
1628
1629 2017-05-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
1630
1631         [REGRESSION](r216901): Delete ImageDecoder if BitmapImage::destroyDecodedData() was called to destroy all the decoded frames
1632         https://bugs.webkit.org/show_bug.cgi?id=172325
1633
1634         Reviewed by Simon Fraser.
1635
1636         When calling BitmapImage::destroyDecodedData() with destroyAll = true, the
1637         current ImageDecoder has to be deleted regardless the current frame needs
1638         to be cached or not. This is true except when the image is animating.
1639         Creating a new ImageDecoder for the animated image will lead to decoding
1640         all the frames from frame-zero till the current frame.
1641
1642         Deleting the current ImageDecoder has the benefit of releasing its raster
1643         data. We also must delete the current ImageDecoder when the CachedImage
1644         switched its data SharedBuffer.
1645
1646         The fix is return the condition in BitmapImage::destroyDecodedData() to 
1647         be as it was before r216901.
1648
1649         * platform/graphics/BitmapImage.cpp:
1650         (WebCore::BitmapImage::destroyDecodedData):
1651
1652 2017-05-18  Ryan Haddad  <ryanhaddad@apple.com>
1653
1654         Unreviewed, rolling out r217079.
1655
1656         This change broke internal builds.
1657
1658         Reverted changeset:
1659
1660         "Redundant ellipsis box triggers
1661         ASSERT_WITH_SECURITY_IMPLICATION in InlineBox::parent()."
1662         https://bugs.webkit.org/show_bug.cgi?id=172309
1663         http://trac.webkit.org/changeset/217079
1664
1665 2017-05-18  Joseph Pecoraro  <pecoraro@apple.com>
1666
1667         Web Inspector: Release InjectedScripts when frontends close
1668         https://bugs.webkit.org/show_bug.cgi?id=172313
1669
1670         Reviewed by Andreas Kling.
1671
1672         * inspector/InspectorController.cpp:
1673         (WebCore::InspectorController::disconnectFrontend):
1674         Release inspector resources together, including discarding injected
1675         scripts so that they may be collected.
1676
1677         (WebCore::InspectorController::inspectedPageDestroyed):
1678         (WebCore::InspectorController::disconnectAllFrontends):
1679         Move the disconnect call inside of disconnectAllFrontends to establish
1680         a pattern of releasing web inspector resources together.
1681
1682 2017-05-18  Simon Fraser  <simon.fraser@apple.com>
1683
1684         Add a newline after the URL in showLayerTree output.
1685
1686         Reviewed by Zalan Bujtas.
1687
1688         * rendering/RenderLayer.cpp:
1689         (WebCore::showLayerTree):
1690
1691 2017-05-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1692
1693         Attachment drag preview should not have the attachment outline
1694         https://bugs.webkit.org/show_bug.cgi?id=172327
1695         <rdar://problem/32282831>
1696
1697         Reviewed by Tim Horton.
1698
1699         When creating a drag image for an attachment element, don't include borders around the attachment.
1700
1701         * page/DragController.cpp:
1702         (WebCore::DragController::startDrag):
1703         * rendering/RenderAttachment.h:
1704         * rendering/RenderThemeIOS.mm:
1705         (WebCore::RenderThemeIOS::paintAttachment):
1706
1707 2017-05-18  Youenn Fablet  <youenn@apple.com>
1708
1709         Make WebRTC logging happen in Release
1710         https://bugs.webkit.org/show_bug.cgi?id=172307
1711
1712         Reviewed by Eric Carlson.
1713
1714         No change of behavior.
1715         Move from LOG(WebRTC...) to RELEASE_LOG(WebRTC...).
1716
1717         * Modules/mediastream/PeerConnectionBackend.cpp:
1718         (WebCore::PeerConnectionBackend::createOfferSucceeded):
1719         (WebCore::PeerConnectionBackend::createOfferFailed):
1720         (WebCore::PeerConnectionBackend::createAnswerSucceeded):
1721         (WebCore::PeerConnectionBackend::createAnswerFailed):
1722         (WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded):
1723         (WebCore::PeerConnectionBackend::setLocalDescriptionFailed):
1724         (WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
1725         (WebCore::PeerConnectionBackend::setRemoteDescriptionFailed):
1726         (WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
1727         (WebCore::PeerConnectionBackend::addIceCandidateFailed):
1728         (WebCore::PeerConnectionBackend::newICECandidate):
1729         (WebCore::PeerConnectionBackend::doneGatheringCandidates):
1730         * Modules/mediastream/RTCPeerConnection.cpp:
1731         (WebCore::RTCPeerConnection::queuedCreateOffer):
1732         (WebCore::RTCPeerConnection::queuedCreateAnswer):
1733         (WebCore::RTCPeerConnection::queuedSetLocalDescription):
1734         (WebCore::RTCPeerConnection::queuedSetRemoteDescription):
1735         (WebCore::RTCPeerConnection::queuedAddIceCandidate):
1736
1737 2017-05-18  Eric Carlson  <eric.carlson@apple.com>
1738
1739         [MediaStream] do not cache gUM permissions
1740         https://bugs.webkit.org/show_bug.cgi?id=172245
1741
1742         Reviewed by Youenn Fablet.
1743
1744         No new tests, updated fast/mediastream/MediaDevices-getUserMedia.html.
1745
1746         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1747         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints): Add salt parameter.
1748         * platform/mediastream/RealtimeMediaSourceCenter.h:
1749
1750 2017-05-18  Zalan Bujtas  <zalan@apple.com>
1751
1752         Redundant ellipsis box triggers ASSERT_WITH_SECURITY_IMPLICATION in InlineBox::parent().
1753         https://bugs.webkit.org/show_bug.cgi?id=172309
1754         <rdar://problem/32262357>
1755
1756         Reviewed by Simon Fraser.
1757
1758         This patch stops the redundant ellipsis box trigger ASSERT_WITH_SECURITY_IMPLICATION.
1759
1760         In RootInlineBox::placeEllipsis we construct an ellipsis box and append it to a static HashMap which
1761         keeps track of the ellipsis boxes on each line. However when the line already has an ellipsis, we
1762         re-use the existing one and this newly constructed (but redundant) box gets destroyed as we return from this function.
1763         In InlineBox's d'tor, we let the parent know that now it has a dangling child and we assert on it
1764         later, while accessing the children list. However this redundant ellipsis box was never added to the line,
1765         so the assertion hits incorrectly.
1766
1767         Test: fast/inline/redundant-ellipsis-triggers-assert-incorrectly.html
1768
1769         * rendering/EllipsisBox.cpp:
1770         (WebCore::EllipsisBox::EllipsisBox):
1771         * rendering/InlineBox.cpp:
1772         (WebCore::InlineBox::invalidateParentChildList):
1773         * rendering/InlineBox.h:
1774         * rendering/RootInlineBox.cpp:
1775         (WebCore::RootInlineBox::placeEllipsis): Use the newly created ellipsis box instead.
1776
1777 2017-05-18  Andy Estes  <aestes@apple.com>
1778
1779         ENABLE(APPLE_PAY_DELEGATE) should be NO on macOS Sierra and earlier
1780         https://bugs.webkit.org/show_bug.cgi?id=172305
1781
1782         Reviewed by Anders Carlsson.
1783
1784         * Configurations/FeatureDefines.xcconfig:
1785
1786 2017-05-18  Dean Jackson  <dino@apple.com>
1787
1788         Transform misplaces element 50% of the time
1789         https://bugs.webkit.org/show_bug.cgi?id=172300
1790
1791         Reviewed by Simon Fraser.
1792
1793         A hardware-accelerated animation of the transform property
1794         requires layout to happen if it contains a translate operation
1795         using percentages, otherwise it may create an incorrect
1796         animation. The "50% of the time" comes in to play because
1797         the layout timer may sometimes fire before the animation
1798         timer. The test case contains a example that is much more
1799         likely to fail without this fix.
1800
1801         Test: animations/needs-layout.html
1802
1803         * page/animation/CSSAnimationController.cpp:
1804         (WebCore::CSSAnimationControllerPrivate::animationTimerFired): If
1805         we've been told that we need a layout, and we have one pending, then
1806         force it before doing the rest of the animation logic.
1807         (WebCore::CSSAnimationController::updateAnimations): Check if the
1808         CompositeAnimation depends on layout, and tell the private controller
1809         that it should check for the necessity of a layout as the animation
1810         timer fires.
1811
1812         * page/animation/CompositeAnimation.cpp:
1813         (WebCore::CompositeAnimation::animate): Ask the keyframes if this
1814         animation depends on layout.
1815
1816         * page/animation/CompositeAnimation.h:
1817         (WebCore::CompositeAnimation::hasAnimationThatDependsOnLayout):
1818         * page/animation/KeyframeAnimation.cpp:
1819         (WebCore::KeyframeAnimation::KeyframeAnimation):
1820         (WebCore::KeyframeAnimation::computeLayoutDependency): Look at all
1821         the keyframe properties for something that is a translation using
1822         percentages.
1823
1824         * page/animation/KeyframeAnimation.h:
1825
1826 2017-05-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1827
1828         Selection around attachment elements should not persist when beginning a drag
1829         https://bugs.webkit.org/show_bug.cgi?id=172319
1830         <rdar://problem/32283008>
1831
1832         Reviewed by Tim Horton.
1833
1834         When beginning to drag an attachment element, save and restore the visible selection when calling out to the
1835         injected bundle for additional data, and when creating the drag image.
1836
1837         Augmented an existing API test: DataInteractionTests.AttachmentElementItemProviders.
1838
1839         * page/DragController.cpp:
1840         (WebCore::DragController::startDrag):
1841
1842 2017-05-18  Daniel Bates  <dabates@apple.com>
1843
1844         Cleanup: Remove unused functions from RuntimeEnabledFeatures
1845         https://bugs.webkit.org/show_bug.cgi?id=172315
1846
1847         Reviewed by Jer Noble.
1848
1849         * page/RuntimeEnabledFeatures.cpp:
1850         (WebCore::RuntimeEnabledFeatures::htmlMediaElementEnabled): Deleted.
1851         (WebCore::RuntimeEnabledFeatures::htmlVideoElementEnabled): Deleted.
1852         (WebCore::RuntimeEnabledFeatures::htmlSourceElementEnabled): Deleted.
1853         (WebCore::RuntimeEnabledFeatures::mediaControllerEnabled): Deleted.
1854         (WebCore::RuntimeEnabledFeatures::mediaErrorEnabled): Deleted.
1855         (WebCore::RuntimeEnabledFeatures::timeRangesEnabled): Deleted.
1856         * page/RuntimeEnabledFeatures.h:
1857         (WebCore::RuntimeEnabledFeatures::setDOMIteratorEnabled): Deleted.
1858         (WebCore::RuntimeEnabledFeatures::domIteratorEnabled): Deleted.
1859         (WebCore::RuntimeEnabledFeatures::setGeolocationEnabled): Deleted.
1860         (WebCore::RuntimeEnabledFeatures::geolocationEnabled): Deleted.
1861
1862 2017-05-18  Daniel Bates  <dabates@apple.com>
1863
1864         Improve error message for Access-Control-Allow-Origin violation due to misconfigured server
1865         https://bugs.webkit.org/show_bug.cgi?id=162819
1866         <rdar://problem/28575938>
1867
1868         Reviewed by Joseph Pecoraro.
1869
1870         Inspired by Blink change:
1871         <https://src.chromium.org/viewvc/blink?view=revision&revision=163406>
1872
1873         At most one Access-Control-Allow-Origin header may be in an HTTP response. Improve the
1874         error message emitted on a CORS failure when Access-Control-Allow-Origin contains more
1875         than one origin, indicated by the presence of a ',', as a way to help web developers/server
1876         administrators differentiate between a misconfigured Access-Control-Allow-Origin header
1877         and a misconfigured server.
1878
1879         * loader/CrossOriginAccessControl.cpp:
1880         (WebCore::passesAccessControlCheck): Defined a local variable to hold the value of securityOrigin.toString()
1881         and referenced this variable throughout the code to avoid computing the stringified security
1882         origin more than once. Switched to using makeString() to concatenate error message when the
1883         origin of the page does not match the value of the Access-Control-Allow-Origin header.
1884
1885 2017-05-18  John Wilander  <wilander@apple.com>
1886
1887         Resource Load Statistics: Grandfather domains for existing data records
1888         https://bugs.webkit.org/show_bug.cgi?id=172155
1889         <rdar://problem/24913532>
1890
1891         Reviewed by Alex Christensen.
1892
1893         Test: http/tests/loading/resourceLoadStatistics/grandfathering.html
1894
1895         * loader/ResourceLoadObserver.cpp:
1896         (WebCore::ResourceLoadObserver::setGrandfathered):
1897         (WebCore::ResourceLoadObserver::isGrandfathered):
1898         (WebCore::ResourceLoadObserver::setMinimumTimeBetweeenDataRecordsRemoval):
1899         (WebCore::ResourceLoadObserver::setGrandfatheringTime):
1900             Functions for testing and configuration.
1901             ResourceLoadObserver::setMinimumTimeBetweeenDataRecordsRemoval() changed as a result of moving
1902             WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweeenDataRecordsRemoval() here.
1903         * loader/ResourceLoadObserver.h:
1904         * loader/ResourceLoadStatisticsStore.cpp:
1905         (WebCore::ResourceLoadStatisticsStore::createEncoderFromData):
1906         (WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
1907             Now contains endOfGrandfatheringTimestamp.
1908         (WebCore::ResourceLoadStatisticsStore::clearInMemoryAndPersistent):
1909             Now makes a call to m_grandfatherExistingWebsiteDataHandler().
1910         (WebCore::ResourceLoadStatisticsStore::setGrandfatherExistingWebsiteDataCallback):
1911         (WebCore::ResourceLoadStatisticsStore::setMinimumTimeBetweeenDataRecordsRemoval):
1912             Changed as a result of moving
1913             WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweeenDataRecordsRemoval() here.
1914         (WebCore::ResourceLoadStatisticsStore::setGrandfatheringTime):
1915         (WebCore::ResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
1916             Renamed since it now also takes grandfathering into account.
1917         (WebCore::ResourceLoadStatisticsStore::updateStatisticsForRemovedDataRecords):
1918             Fixed typo in local variable name.
1919         (WebCore::ResourceLoadStatisticsStore::handleFreshStartWithEmptyOrNoStore):
1920         (WebCore::ResourceLoadStatisticsStore::shouldRemoveDataRecords):
1921             Convenience function added.
1922         (WebCore::ResourceLoadStatisticsStore::dataRecordsBeingRemoved):
1923             Convenience function added.
1924         (WebCore::ResourceLoadStatisticsStore::dataRecordsWereRemoved):
1925             Convenience function added.
1926         (WebCore::ResourceLoadStatisticsStore::prevalentResourceDomainsWithoutUserInteraction): Deleted.
1927             Replaced by ResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor().
1928         * loader/ResourceLoadStatisticsStore.h:
1929
1930 2017-05-18  Daniel Bates  <dabates@apple.com>
1931
1932         Bindings: Require value for extended attributes EnabledAtRuntime and EnabledForWorld
1933         https://bugs.webkit.org/show_bug.cgi?id=172252
1934
1935         Reviewed by Sam Weinig.
1936
1937         According to Sam Weinig it is an anti-feature that EnabledAtRuntime can be specified
1938         without a value. We should make it require a value for the name of the RuntimeEnabledFeatures
1939         function to use in the generated code. For similar reasons we should also require
1940         a value for the extended attribute EnabledForWorld.
1941
1942         * Modules/websockets/WebSocket.idl: Substitute EnabledAtRuntime=WebSocket for EnabledAtRuntime.
1943         * bindings/scripts/CodeGeneratorJS.pm:
1944         (GetRuntimeEnableFunctionName):
1945         * html/HTMLAudioElement.idl: Substitute EnabledAtRuntime=Audio for EnabledAtRuntime.
1946         * page/RuntimeEnabledFeatures.cpp:
1947         (WebCore::RuntimeEnabledFeatures::audioEnabled):
1948         (WebCore::RuntimeEnabledFeatures::htmlAudioElementEnabled): Deleted. This function duplicated
1949         the functionality of RuntimeEnabledFeatures::audioEnabled(). Instead we explicitly
1950         write EnabledAtRuntime=Audio in HTMLAudioElement.idl to use RuntimeEnabledFeatures::audioEnabled()
1951         to determine whether to expose/conceal the HTMLAudioElement global constructor at runtime.
1952         * page/RuntimeEnabledFeatures.h:
1953
1954 2017-05-18  Jer Noble  <jer.noble@apple.com>
1955
1956         Allow nested timers to propagate user gestures so long as the total nested interval is less than 1s.
1957         https://bugs.webkit.org/show_bug.cgi?id=172173
1958
1959         Reviewed by Andy Estes.
1960
1961         Test: media/restricted-audio-playback-with-multiple-settimeouts.html
1962
1963         Store the current nested timer interval in DOMTimerFireState, and use that value to propagate the
1964         nested interval through multiple invocations of setTimeout().
1965
1966         Drive-by fix: instead of manually resetting the nesting level in DOMTimer::fired(), add the
1967         nesting level to the DOMTimerFireState, and reset the nesting level on the state's destruction.
1968         This fixes one place in DOMTimer::fire() where an early return lead to the timer's nesting level
1969         not being reset.
1970
1971         * page/DOMTimer.cpp:
1972         (WebCore::DOMTimerFireState::DOMTimerFireState):
1973         (WebCore::DOMTimerFireState::~DOMTimerFireState):
1974         (WebCore::DOMTimerFireState::nestedTimerInterval):
1975         (WebCore::shouldForwardUserGesture):
1976         (WebCore::userGestureTokenToForward):
1977         (WebCore::currentNestedTimerInterval):
1978         (WebCore::DOMTimer::DOMTimer):
1979         (WebCore::DOMTimer::fired):
1980         * page/DOMTimer.h:
1981
1982 2017-05-18  Youenn Fablet  <youenn@apple.com>
1983
1984         RealtimeOutgoingAudioSource should use the source sample rate
1985         https://bugs.webkit.org/show_bug.cgi?id=172297
1986
1987         Reviewed by Eric Carlson.
1988
1989         Covered by manual tests.
1990
1991         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
1992         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable): Using the audio source sample rate so that the converter does the right conversion.
1993
1994 2017-05-18  Andy Estes  <aestes@apple.com>
1995
1996         Add "countryCode" to ApplePayErrorContactField
1997         https://bugs.webkit.org/show_bug.cgi?id=172264
1998         <rdar://problem/32004909>
1999
2000         Reviewed by Anders Carlsson.
2001
2002         Added ApplePayError tests to http/tests/ssl/applepay/ApplePaySession.html
2003
2004         * Modules/applepay/ApplePayError.idl:
2005         * Modules/applepay/PaymentRequest.h:
2006
2007 2017-05-18  Daniel Bates  <dabates@apple.com>
2008
2009         Cleanup: Remove unnecessary call to AddToImplIncludes("RuntimeEnabledFeatures.h") in GenerateImplementation()
2010         https://bugs.webkit.org/show_bug.cgi?id=172236
2011
2012         Reviewed by Chris Dumez.
2013
2014         It is unnecessary for GenerateImplementation() to explicitly call AddToImplIncludes("RuntimeEnabledFeatures.h")
2015         to add the header RuntimeEnabledFeatures.h to the list of headers in the generated implementation
2016         as this header is added when GetRuntimeEnableFunctionName() is called. And GenerateImplementation()
2017         calls GetRuntimeEnableFunctionName().
2018
2019         No functionality changed. So, no new tests.
2020
2021         * bindings/scripts/CodeGeneratorJS.pm:
2022         (GenerateImplementation):
2023
2024 2017-05-18  Daniel Bates  <dabates@apple.com>
2025
2026         REGRESSION (r209608): Cross-origin plugin document opened in child window blocked by parent
2027         window CSP when object-src 'none' is set
2028         https://bugs.webkit.org/show_bug.cgi?id=172038
2029         <rdar://problem/32258262>
2030
2031         Reviewed by Andy Estes.
2032
2033         Fixes an issue where a cross-origin plugin document opened in a child window would inherit
2034         the Content Security Policy (CSP) of its opener. In particular, a cross-origin plugin
2035         document opened in a child window would be blocked when the CSP of its opener disallows
2036         plugins (e.g. object-source 'none').
2037
2038         Prior to r209608 a document opened in a child window never inherited the CSP from its opener
2039         and a plugin document loaded in a subframe would unconditionally inherit the CSP from its
2040         parent frame. So, a plugin document opened in a child window would be allowed to load
2041         regardless of whether its opener had a CSP that prevented plugins. Following r209608 a
2042         document opened in a child window would inherit its CSP from its opener if and only if it
2043         would inherit the security origin from its opener (e.g. about:blank) or was a plugin
2044         document. The latter condition makes plugin documents opened in a child window unconditionally
2045         inherit the CSP from their opener and is the cause of this bug. It seems reasonable to exempt
2046         cross-origin plugin documents opened in a child window from the CSP inheritance rule because
2047         such documents cannot compromise the origin of their opener. Same-origin plugin documents
2048         opened in a child window will continue to inherit the CSP from their opener because such
2049         documents can compromise the origin of their opener.
2050
2051         Tests: http/tests/security/contentSecurityPolicy/cross-origin-plugin-document-allowed-in-child-window.html
2052                http/tests/security/contentSecurityPolicy/plugin-blocked-in-about-blank-window.html
2053                http/tests/security/contentSecurityPolicy/same-origin-plugin-document-blocked-in-child-window.html
2054
2055         * dom/Document.cpp:
2056         (WebCore::Document::shouldInheritContentSecurityPolicyFromOwner): Added.
2057         (WebCore::Document::initContentSecurityPolicy):
2058         * dom/Document.h:
2059
2060 2017-05-18  Keith Miller  <keith_miller@apple.com>
2061
2062         WebAssembly API: test with neutered inputs
2063         https://bugs.webkit.org/show_bug.cgi?id=163899
2064
2065         Reviewed by JF Bastien.
2066
2067         Make it not possible to transfer an ArrayBuffer that is backed by a
2068         wasm memory.
2069
2070         Test: workers/wasm-mem-post-message.html
2071
2072         * bindings/js/SerializedScriptValue.cpp:
2073         (WebCore::SerializedScriptValue::create):
2074
2075 2017-05-18  Commit Queue  <commit-queue@webkit.org>
2076
2077         Unreviewed, rolling out r217031, r217032, and r217037.
2078         https://bugs.webkit.org/show_bug.cgi?id=172293
2079
2080         cause linking errors in Windows (Requested by yusukesuzuki on
2081         #webkit).
2082
2083         Reverted changesets:
2084
2085         "[JSC][DFG][DOMJIT] Extend CheckDOM to CheckSubClass"
2086         https://bugs.webkit.org/show_bug.cgi?id=172098
2087         http://trac.webkit.org/changeset/217031
2088
2089         "Unreviewed, rebaseline for newly added ClassInfo"
2090         https://bugs.webkit.org/show_bug.cgi?id=172098
2091         http://trac.webkit.org/changeset/217032
2092
2093         "Unreviewed, fix debug and non-JIT build"
2094         https://bugs.webkit.org/show_bug.cgi?id=172098
2095         http://trac.webkit.org/changeset/217037
2096
2097 2017-05-18  Per Arne Vollan  <pvollan@apple.com>
2098
2099         Protect MediaDeviceRequest instance during context destruction.
2100         https://bugs.webkit.org/show_bug.cgi?id=172285
2101         <rdar://problem/30369017>
2102
2103         Reviewed by Brent Fulgham.
2104
2105         In MediaDevicesRequest::contextDestroyed(), the call to m_enumerationRequest->cancel() might
2106         end up deleting itself (MediaDevicesRequest). The std::function member m_completionHandler
2107         in MediaDevicesEnumerationRequest contains a captured variable of type
2108         RefPtr<MediaDevicesRequest>. When m_completionHandler is set to null in the cancel() method,
2109         the MediaDevicesRequest object will be deleted if the m_completionHandler member is holding
2110         the last reference.
2111
2112         No new tests, since I am unable to reproduce.
2113
2114         * Modules/mediastream/MediaDevicesRequest.cpp:
2115         (WebCore::MediaDevicesRequest::contextDestroyed):
2116
2117 2017-05-18  Antti Koivisto  <antti@apple.com>
2118
2119         Design mode should not affect UA shadow trees
2120         https://bugs.webkit.org/show_bug.cgi?id=171854
2121         <rdar://problem/32071037>
2122
2123         Reviewed by Zalan Bujtas.
2124
2125         Test: editing/deleting/search-shadow-tree-delete.html
2126
2127         * html/HTMLElement.cpp:
2128         (WebCore::HTMLElement::editabilityFromContentEditableAttr):
2129
2130             Ignore design mode for UA shadow trees.
2131
2132         * html/SearchInputType.cpp:
2133         (WebCore::SearchInputType::~SearchInputType):
2134         (WebCore::SearchInputType::createShadowSubtree):
2135         (WebCore::SearchInputType::resultsButtonElement):
2136         (WebCore::SearchInputType::cancelButtonElement):
2137         * html/SearchInputType.h:
2138
2139             Use RefPtr.
2140
2141 2017-05-18  Vanessa Chipirrás Navalón  <vchipirras@igalia.com>
2142
2143         [GTK][GStreamer][MSE] Crash on youtube when MSE is enabled but gstreamer cant find the decoder element.
2144         https://bugs.webkit.org/show_bug.cgi?id=167120
2145
2146         Reviewed by Žan Doberšek.
2147
2148         This is because supportCodecs() doesn't check in runtime which plugins the player has.
2149         So, a static function which returns a map with the plugins has been created. That map is later
2150         used in the supportsCodecs() method to check if the requested codec matches any of the map.
2151
2152         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2153         (WebCore::MediaPlayerPrivateGStreamerBase::initializeGStreamerAndRegisterWebKitElements):
2154         The declaration is moved into this class.
2155         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2156         (WebCore::MediaPlayerPrivateGStreamer::isAvailable): This function calls the implementation of
2157         initializeGstreamerAndRegisterWebKitElements function.
2158         (WebCore::MediaPlayerPrivateGStreamer::load): Ditto
2159         (WebCore::mimeTypeSet): Ditto
2160         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: It is static type to expose
2161         initializeGStreamerAndRegisterWebKitElements() function to be called from internal function
2162         "which runs before MediaPlayerPrivateGStreamerBase initialization but needs to have GStreamer initialized".
2163         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
2164         (WebCore::codecSet): It returns a map with the plugins has been created.
2165         (WebCore::MediaPlayerPrivateGStreamerMSE::supportsCodecs): To check if the requested codec
2166         matches any of the map from codecSet().
2167
2168 2017-05-18  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2169
2170         [Readable Streams API] Align getDesiredSize with spec
2171         https://bugs.webkit.org/show_bug.cgi?id=172220
2172
2173         Reviewed by Chris Dumez.
2174
2175         Aligned implementation of getDesiredSize operation for both controllers:
2176         - https://streams.spec.whatwg.org/#readable-stream-default-controller-get-desired-size
2177         - https://streams.spec.whatwg.org/#readable-byte-stream-controller-get-desired-size
2178
2179         Implementation slightly differs from spec as queueTotalSize refactoring is not
2180         yet implemented, but behavior is now similar.
2181
2182         No new tests (already covered by WPT tests, corresponding expectations have been updated).
2183
2184         * Modules/streams/ReadableByteStreamInternals.js:
2185         (readableByteStreamControllerGetDesiredSize): Updated.
2186         * Modules/streams/ReadableStreamInternals.js:
2187         (readableStreamDefaultControllerGetDesiredSize): Updated.
2188
2189 2017-05-18  Tim Horton  <timothy_horton@apple.com>
2190
2191         More WebKit2 header cleanup
2192         https://bugs.webkit.org/show_bug.cgi?id=172214
2193
2194         Reviewed by Simon Fraser.
2195
2196         * Modules/mediastream/UserMediaController.cpp:
2197         * Modules/mediastream/UserMediaController.h:
2198
2199 2017-05-16  Yusuke Suzuki  <utatane.tea@gmail.com>
2200
2201         [JSC][DFG][DOMJIT] Extend CheckDOM to CheckSubClass
2202         https://bugs.webkit.org/show_bug.cgi?id=172098
2203
2204         Reviewed by Saam Barati.
2205
2206         Add DOMJIT interface IDL attribute. Which allows us to define checkSubClassPatchpoint function
2207         for that ClassInfo. And we move CheckSubClass patchpoint implementation to ClassInfo's member.
2208
2209         * CMakeLists.txt:
2210         * WebCore.xcodeproj/project.pbxproj:
2211         * bindings/js/JSDOMGlobalObject.cpp:
2212         * bindings/js/JSDOMWindowBase.cpp:
2213         * bindings/js/JSDOMWindowProperties.cpp:
2214         * bindings/js/JSDOMWindowShell.cpp:
2215         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
2216         * bindings/js/JSWorkerGlobalScopeBase.cpp:
2217         * bindings/scripts/CodeGeneratorJS.pm:
2218         (GenerateHeader):
2219         (GenerateImplementation):
2220         (GenerateImplementationIterableFunctions):
2221         (GenerateConstructorHelperMethods):
2222         * bindings/scripts/IDLAttributes.json:
2223         * bindings/scripts/test/JS/JSInterfaceName.cpp:
2224         * bindings/scripts/test/JS/JSMapLike.cpp:
2225         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
2226         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
2227         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
2228         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
2229         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
2230         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
2231         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
2232         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
2233         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
2234         * bindings/scripts/test/JS/JSTestDOMJIT.h:
2235         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
2236         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
2237         * bindings/scripts/test/JS/JSTestException.cpp:
2238         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
2239         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2240         * bindings/scripts/test/JS/JSTestInterface.cpp:
2241         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
2242         * bindings/scripts/test/JS/JSTestIterable.cpp:
2243         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
2244         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
2245         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
2246         * bindings/scripts/test/JS/JSTestNode.cpp:
2247         * bindings/scripts/test/JS/JSTestObj.cpp:
2248         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
2249         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
2250         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
2251         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
2252         * bindings/scripts/test/JS/JSTestSerialization.cpp:
2253         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
2254         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
2255         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
2256         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2257         * bridge/c/CRuntimeObject.cpp:
2258         * bridge/c/c_instance.cpp:
2259         * bridge/objc/ObjCRuntimeObject.mm:
2260         * bridge/objc/objc_instance.mm:
2261         * bridge/objc/objc_runtime.mm:
2262         * bridge/runtime_array.cpp:
2263         * bridge/runtime_method.cpp:
2264         * bridge/runtime_object.cpp:
2265         * dom/Document.idl:
2266         * dom/DocumentFragment.idl:
2267         * dom/Element.idl:
2268         * dom/Event.idl:
2269         * dom/Node.idl:
2270         * domjit/JSDocumentDOMJIT.cpp:
2271         (WebCore::JSDocument::checkSubClassPatchpoint):
2272         (WebCore::DocumentDocumentElementDOMJIT::checkDOM): Deleted.
2273         (WebCore::DocumentBodyDOMJIT::checkDOM): Deleted.
2274         * domjit/JSDocumentFragmentDOMJIT.cpp: Copied from Source/JavaScriptCore/runtime/JSMap.cpp.
2275         (WebCore::JSDocumentFragment::checkSubClassPatchpoint):
2276         * domjit/JSElementDOMJIT.cpp: Copied from Source/JavaScriptCore/tools/JSDollarVM.cpp.
2277         (WebCore::JSElement::checkSubClassPatchpoint):
2278         * domjit/JSEventDOMJIT.cpp: Copied from Source/JavaScriptCore/tools/JSDollarVM.cpp.
2279         (WebCore::JSEvent::checkSubClassPatchpoint):
2280         * domjit/JSNodeDOMJIT.cpp:
2281         (WebCore::JSNode::checkSubClassPatchpoint):
2282         (WebCore::NodeFirstChildDOMJIT::checkDOM): Deleted.
2283         (WebCore::NodeLastChildDOMJIT::checkDOM): Deleted.
2284         (WebCore::NodeNextSiblingDOMJIT::checkDOM): Deleted.
2285         (WebCore::NodePreviousSiblingDOMJIT::checkDOM): Deleted.
2286         (WebCore::NodeParentNodeDOMJIT::checkDOM): Deleted.
2287         (WebCore::NodeNodeTypeDOMJIT::checkDOM): Deleted.
2288         (WebCore::NodeOwnerDocumentDOMJIT::checkDOM): Deleted.
2289
2290 2017-05-17  Youenn Fablet  <youenn@apple.com>
2291
2292         r216999 broke win build
2293         https://bugs.webkit.org/show_bug.cgi?id=172257
2294
2295         Unreviewed.
2296
2297         * testing/Internals.cpp:
2298         (WebCore::Internals::setPageVisibility): Moving setPageVisibility out of MEDIA_STREAM compilation flag.
2299
2300 2017-05-17  Andy Estes  <aestes@apple.com>
2301
2302         [Cocoa] errors are not propagated to PassKit when calling ApplePaySession.completePayment()
2303         https://bugs.webkit.org/show_bug.cgi?id=172253
2304         <rdar://problem/32258020>
2305
2306         Reviewed by Dan Bernstein.
2307
2308         In ApplePaySession::completePayment(), releaseReturnValue() was being called twice on the
2309         same convertedResult. Since the first call moved the errors vector out of convertedResult,
2310         the vector is empty in the second call. It's the second call that sends the result to the
2311         UI process, so we end up with an empty arary when we call PassKit's delegate completion
2312         handler.
2313
2314         * Modules/applepay/ApplePaySession.cpp:
2315         (WebCore::ApplePaySession::completePayment):
2316
2317 2017-05-17  Ryan Haddad  <ryanhaddad@apple.com>
2318
2319         Unreviewed, rolling out r217014.
2320
2321         This change caused mac-wk2 LayoutTests to exit early due to
2322         crashes.
2323
2324         Reverted changeset:
2325
2326         "Resource Load Statistics: Grandfather domains for existing
2327         data records"
2328         https://bugs.webkit.org/show_bug.cgi?id=172155
2329         http://trac.webkit.org/changeset/217014
2330
2331 2017-05-17  Zalan Bujtas  <zalan@apple.com>
2332
2333         Tighten TextIterator::handleTextNode run-renderer mapping logic.
2334         https://bugs.webkit.org/show_bug.cgi?id=172174
2335
2336         Reviewed by Antti Koivisto.
2337
2338         This patch ensure that when runs and renderers are getting out of sync
2339         we don't run into problems like webkit.org/b/172113 (where we end up
2340         using incorrect content start/end positions).
2341
2342         * editing/TextIterator.cpp:
2343         (WebCore::TextIterator::handleTextNode):
2344
2345 2017-05-17  John Wilander  <wilander@apple.com>
2346
2347         Resource Load Statistics: Grandfather domains for existing data records
2348         https://bugs.webkit.org/show_bug.cgi?id=172155
2349         <rdar://problem/24913532>
2350
2351         Reviewed by Alex Christensen.
2352
2353         Test: http/tests/loading/resourceLoadStatistics/grandfathering.html
2354
2355         * loader/ResourceLoadObserver.cpp:
2356         (WebCore::ResourceLoadObserver::setGrandfathered):
2357         (WebCore::ResourceLoadObserver::isGrandfathered):
2358         (WebCore::ResourceLoadObserver::setMinimumTimeBetweeenDataRecordsRemoval):
2359         (WebCore::ResourceLoadObserver::setGrandfatheringTime):
2360             Functions for testing and configuration.
2361             ResourceLoadObserver::setMinimumTimeBetweeenDataRecordsRemoval() changed as a result of moving
2362             WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweeenDataRecordsRemoval() here.
2363         * loader/ResourceLoadObserver.h:
2364         * loader/ResourceLoadStatisticsStore.cpp:
2365         (WebCore::ResourceLoadStatisticsStore::createEncoderFromData):
2366         (WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
2367             Now contains endOfGrandfatheringTimestamp.
2368         (WebCore::ResourceLoadStatisticsStore::clearInMemoryAndPersistent):
2369             Now makes a call to m_grandfatherExistingWebsiteDataHandler().
2370         (WebCore::ResourceLoadStatisticsStore::setGrandfatherExistingWebsiteDataCallback):
2371         (WebCore::ResourceLoadStatisticsStore::setMinimumTimeBetweeenDataRecordsRemoval):
2372             Changed as a result of moving
2373             WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweeenDataRecordsRemoval() here.
2374         (WebCore::ResourceLoadStatisticsStore::setGrandfatheringTime):
2375         (WebCore::ResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
2376             Renamed since it now also takes grandfathering into account.
2377         (WebCore::ResourceLoadStatisticsStore::updateStatisticsForRemovedDataRecords):
2378             Fixed typo in local variable name.
2379         (WebCore::ResourceLoadStatisticsStore::handleFreshStartWithEmptyOrNoStore):
2380         (WebCore::ResourceLoadStatisticsStore::shouldRemoveDataRecords):
2381             Convenience function added.
2382         (WebCore::ResourceLoadStatisticsStore::dataRecordsBeingRemoved):
2383             Convenience function added.
2384         (WebCore::ResourceLoadStatisticsStore::dataRecordsWereRemoved):
2385             Convenience function added.
2386         (WebCore::ResourceLoadStatisticsStore::prevalentResourceDomainsWithoutUserInteraction): Deleted.
2387             Replaced by ResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor().
2388         * loader/ResourceLoadStatisticsStore.h:
2389
2390 2017-05-17  Zalan Bujtas  <zalan@apple.com>
2391
2392         Debug ASSERT: WebCore::RenderImageResource::shutdown
2393         https://bugs.webkit.org/show_bug.cgi?id=172238
2394         <rdar://problem/30064601>
2395
2396         Reviewed by Simon Fraser.
2397
2398         While constructing new renderers, as part of the render tree update, we check if the insertion point is valid for them. 
2399         When this newly constructed child renderer can't be injected to a specific place, we destroy it right away.
2400         This assert was added with the assumption that the image resource object gets initialized
2401         (through RenderObject::initializeStyle) even when the renderer turns out to be invalid.
2402
2403         Test: fast/images/assert-when-insertion-point-is-incorrect.html
2404
2405         * rendering/RenderImageResource.cpp:
2406         (WebCore::RenderImageResource::RenderImageResource):
2407         (WebCore::RenderImageResource::shutdown):
2408         * rendering/RenderImageResource.h:
2409
2410 2017-05-17  Per Arne Vollan  <pvollan@apple.com>
2411
2412         Crash under WebCore::AudioSourceProviderAVFObjC::process().
2413         https://bugs.webkit.org/show_bug.cgi?id=172101
2414         rdar://problem/27446589
2415
2416         Reviewed by Jer Noble.
2417
2418         Calling the function MTAudioProcessingTapGetSourceAudio when the value of the
2419         MTAudioProcessingTapRef parameter is null, will lead to a null dereference.
2420         This can for example happen if MediaPlayerPrivateAVFoundationObjC::cancelLoad()
2421         is called on the main thread while MediaToolbox is calling the
2422         WebCore::AudioSourceProviderAVFObjC::processCallback function on a secondary
2423         thread. MediaPlayerPrivateAVFoundationObjC::cancelLoad() will then call
2424         AudioSourceProviderAVFObjC::setPlayerItem(nullptr), which will call
2425         AudioSourceProviderAVFObjC::destroyMix(), which will set m_tap to null. When
2426         AudioSourceProviderAVFObjC::process is called on the secondary thread, using
2427         the m_tap member in the call to MTAudioProcessingTapGetSourceAudio, the process
2428         will crash.
2429
2430         No new tests since I am not able to reproduce.
2431
2432         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
2433         (WebCore::AudioSourceProviderAVFObjC::initCallback):
2434         (WebCore::AudioSourceProviderAVFObjC::process):
2435
2436 2017-05-17  Chris Dumez  <cdumez@apple.com>
2437
2438         Setting URL.search to '' results in a stringified URL ending in '?'
2439         https://bugs.webkit.org/show_bug.cgi?id=162345
2440         <rdar://problem/31800441>
2441
2442         Reviewed by Alex Christensen.
2443
2444         As per the specification for the URL.search setter [1], if the given value is
2445         the empty string, then we should set the URL's query to null. We would
2446         previously set the URL's query to the empty string in this case. This aligns
2447         our behavior with Firefox and Chrome.
2448
2449         [1] https://url.spec.whatwg.org/#dom-url-search
2450
2451         No new tests, updated existing tests.
2452
2453         * html/URLUtils.h:
2454         (WebCore::URLUtils<T>::setSearch):
2455
2456 2017-05-17  Eric Carlson  <eric.carlson@apple.com>
2457
2458         [MediaStream] videoWidth and videoHeight should be set when 'loadedmetadata' event fires
2459         https://bugs.webkit.org/show_bug.cgi?id=172223
2460         <rdar://problem/31899755>
2461
2462         Reviewed by Jer Noble.
2463
2464         Test: fast/mediastream/get-user-media-on-loadedmetadata.html
2465
2466         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2467         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentReadyState): If a stream has
2468         a video track, return HaveNothing until we have a sample.
2469        
2470         * platform/mediastream/RealtimeMediaSource.h:
2471         * platform/mock/MockRealtimeAudioSource.cpp:
2472         (WebCore::MockRealtimeAudioSource::tick): Optionally delay the next sample.
2473         (WebCore::MockRealtimeAudioSource::delaySamples):
2474         * platform/mock/MockRealtimeAudioSource.h:
2475
2476         * platform/mock/MockRealtimeVideoSource.cpp:
2477         (WebCore::MockRealtimeVideoSource::delaySamples):
2478         (WebCore::MockRealtimeVideoSource::generateFrame): Optionally delay the next sample.
2479         * platform/mock/MockRealtimeVideoSource.h:
2480
2481         * testing/Internals.cpp:
2482         (WebCore::Internals::delayMediaStreamTrackSamples):
2483         * testing/Internals.h:
2484         * testing/Internals.idl:
2485
2486 2017-05-17  Youenn Fablet  <youenn@apple.com>
2487
2488         iOS WebRTC Media Capture should not allow camera capture from background tab
2489         https://bugs.webkit.org/show_bug.cgi?id=172200
2490
2491         Reviewed by Eric Carlson.
2492
2493         Test: platform/ios/mediastream/getUserMedia-disabled-in-background-tabs.html and manual tests.
2494
2495         Making Video Capture Factory aware of Document visibility changes.
2496         On iOS, muting/unmuting the current video source according Document visibility.
2497         Not using Document visibility change observer as factories are platform and cannot implement
2498         the visibility observer interface without moving the visibility observer interface.
2499
2500         Introducing internals API to switch on/off the page visibility.
2501
2502         * dom/Document.cpp:
2503         (WebCore::Document::visibilityStateChanged):
2504         (WebCore::Document::notifyVisibilityChangedToMediaCapture):
2505         * dom/Document.h:
2506         * platform/mediastream/RealtimeMediaSource.h:
2507         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2508         (WebCore::RealtimeMediaSourceCenter::setVisibility):
2509         * platform/mediastream/RealtimeMediaSourceCenter.h:
2510         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2511         (WebCore::AVVideoCaptureSourceFactory::setVisibility):
2512         * testing/Internals.cpp:
2513         (WebCore::Internals::setPageVisibility):
2514         * testing/Internals.h:
2515         * testing/Internals.idl:
2516
2517 2017-05-17  Said Abou-Hallawa  <sabouhallawa@apple.com>
2518
2519         When the image decoding thread makes a callOnMainThread(), ensure all the objects it needs are protected
2520         https://bugs.webkit.org/show_bug.cgi?id=171614
2521
2522         Reviewed by David Kilzer.
2523
2524         The asynchronous image decoding was designed to not block the main thread if
2525         the image is deleted. To achieve that we allow decoding the current frame
2526         even if it is not going to be used after closing the decoding queue. We 
2527         protect all the objects which the decoding thread uses. But when a frame
2528         finishes decoding the native image frame is cached on the main thread. Not
2529         all of the objects are protected when the callOnMainThread() is dispatched.
2530         The ImageFrameCache and the ImageDecoder objects are not protected.
2531
2532         This might lead to two kinds of crashes:
2533         1. A segfault inside the ImageDecoder trying to access one of its member
2534         2. A segfault inside the ImageFrameCache trying to access one of its frames
2535
2536         The fix is to protect the ImageFrameCache and the ImageDecoder when the
2537         decoding thread makes a callOnMainThread(). Also switch all the pointers
2538         the decoding threads protect to be ThreadSafeRefCounted.
2539
2540         * platform/graphics/ImageFrameCache.cpp:
2541         (WebCore::ImageFrameCache::startAsyncDecodingQueue):
2542         * platform/graphics/ImageFrameCache.h:
2543         * platform/graphics/cg/ImageDecoderCG.h:
2544         * platform/graphics/win/ImageDecoderDirect2D.h:
2545         * platform/image-decoders/ImageDecoder.h:
2546
2547 2017-05-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2548
2549         A URL type is vended for a non-URL plain text string when starting data interaction
2550         https://bugs.webkit.org/show_bug.cgi?id=172228
2551         <rdar://problem/32166729>
2552
2553         Reviewed by Andy Estes.
2554
2555         Previously, when writing a plain text string to WebItemProviderPasteboard, we would write an NSString directly
2556         to the item provider by using built-in functionality in NSString+UIItemProvider. However, this causes plain
2557         strings such as "apple" to be considered URLs, since -[NSURL URLWithString:] creates a non-null NSURL. To fix
2558         this, we instead write the string as UTF8 data, for the UTI kUTTypeUTF8PlainText, if the plain text is not a
2559         URL. If the plain text is clearly a URL (determined by constructing a new WebCore URL with no base URL and the
2560         plaintext string as the absolute URL) then we additionally write an NSURL to the pasteboard.
2561
2562         2 new API tests:
2563         DataInteractionTests.SinglePlainTextWordTypeIdentifiers
2564         DataInteractionTests.SinglePlainTextURLTypeIdentifiers
2565
2566         * platform/ios/PlatformPasteboardIOS.mm:
2567         (WebCore::addRepresentationsForPlainText):
2568         (WebCore::PlatformPasteboard::writeObjectRepresentations):
2569
2570 2017-05-15  Jiewen Tan  <jiewen_tan@apple.com>
2571
2572         Replace CryptoOperationData with BufferSource for WebKitSubtleCrypto
2573         https://bugs.webkit.org/show_bug.cgi?id=172146
2574         <rdar://problem/32122256>
2575
2576         Reviewed by Brent Fulgham.
2577
2578         In this patch, we replaces CryptoOperationData with BufferSource for WebKitSubtleCrypto in
2579         the custom binding codes.
2580
2581         Test: crypto/webkitSubtle/import-export-raw-key-leak.html
2582
2583         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
2584         (WebCore::JSWebKitSubtleCrypto::encrypt):
2585         (WebCore::JSWebKitSubtleCrypto::decrypt):
2586         (WebCore::JSWebKitSubtleCrypto::sign):
2587         (WebCore::JSWebKitSubtleCrypto::verify):
2588         (WebCore::JSWebKitSubtleCrypto::digest):
2589         (WebCore::JSWebKitSubtleCrypto::importKey):
2590         (WebCore::JSWebKitSubtleCrypto::unwrapKey):
2591         * crypto/WebKitSubtleCrypto.idl:
2592
2593 2017-05-17  Youenn Fablet  <youenn@apple.com>
2594
2595         Move-related refactoring on UserMediaPermissionRequestProxy
2596         https://bugs.webkit.org/show_bug.cgi?id=172195
2597
2598         Reviewed by Alex Christensen.
2599
2600         No behavioral change.
2601
2602         * platform/mediastream/RealtimeMediaSourceCenter.h: Cleaning the function definition.
2603
2604 2017-05-17  David Kilzer  <ddkilzer@apple.com>
2605
2606         BlobDataFileReference::generateReplacementFile() should use mkstemp()
2607         <https://webkit.org/b/172192>
2608
2609         Reviewed by Brent Fulgham.
2610
2611         * platform/network/mac/BlobDataFileReferenceMac.mm:
2612         (WebCore::BlobDataFileReference::generateReplacementFile): Use
2613         mkstemp().
2614
2615 2017-05-17  Matt Lewis  <jlewis3@apple.com>
2616
2617         Unreviewed, rolling out r216974.
2618
2619         Revision caused consistent timeouts on all platforms.
2620
2621         Reverted changeset:
2622
2623         "Add a RuntimeEnabledFeature for display: contents, defaulted
2624         to false."
2625         https://bugs.webkit.org/show_bug.cgi?id=171984
2626         http://trac.webkit.org/changeset/216974
2627
2628 2017-05-17  Nan Wang  <n_wang@apple.com>
2629
2630         ASSERTION FAILED in WebCore::AccessibilityNodeObject::insertChild()
2631         https://bugs.webkit.org/show_bug.cgi?id=171927
2632         <rdar://problem/32109781>
2633
2634         Reviewed by Chris Fleizach.
2635
2636         The nextSibling() logic might include the continuation sibling that's not
2637         the child of the current renderer. Make sure we only insert the valid child.
2638
2639         Test: accessibility/insert-children-assert.html
2640
2641         * accessibility/AccessibilityObject.cpp:
2642         (WebCore::AccessibilityObject::setIsIgnoredFromParentDataForChild):
2643         * accessibility/AccessibilityRenderObject.cpp:
2644         (WebCore::AccessibilityRenderObject::nextSibling):
2645
2646 2017-05-17  Ryosuke Niwa  <rniwa@webkit.org>
2647
2648         getElementById can return a wrong elemnt when a matching element is removed during beforeload event
2649         https://bugs.webkit.org/show_bug.cgi?id=171374
2650
2651         Reviewed by Brent Fulgham.
2652
2653         The bug was caused by HTMLLinkElement firing beforeload event inside insertedInto before the tree state is updated.
2654         Delay the event dispatch to the post insertion callback.
2655
2656         Test: fast/html/link-element-removal-during-beforeload.html
2657
2658         * html/HTMLLinkElement.cpp:
2659         (WebCore::HTMLLinkElement::insertedInto):
2660         (WebCore::HTMLLinkElement::finishedInsertingSubtree):
2661         * html/HTMLLinkElement.h:
2662
2663 2017-05-17  Alex Christensen  <achristensen@webkit.org>
2664
2665         Interacting with WKHTTPCookieStores before creating WKWebViews and WKProcessPools should affect cookies used
2666         https://bugs.webkit.org/show_bug.cgi?id=171987
2667
2668         Reviewed by Brady Eidson.
2669
2670         Covered by new API tests.
2671
2672         * CMakeLists.txt:
2673         * platform/Cookie.h:
2674         (WebCore::Cookie::Cookie):
2675         (WebCore::Cookie::isNull):
2676         (WebCore::CookieHash::hash):
2677         (WebCore::CookieHash::equal):
2678         (WTF::HashTraits<WebCore::Cookie>::emptyValue):
2679         (WTF::HashTraits<WebCore::Cookie>::constructDeletedValue):
2680         (WTF::HashTraits<WebCore::Cookie>::isDeletedValue):
2681         * platform/network/Cookie.cpp: Added.
2682         (WebCore::Cookie::operator==):
2683         (WebCore::Cookie::hash):
2684         * platform/network/cocoa/CookieCocoa.mm:
2685         (WebCore::Cookie::operator NSHTTPCookie *):
2686         (WebCore::Cookie::operator==):
2687         (WebCore::Cookie::hash):
2688         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
2689         (WebCore::NetworkStorageSession::setCookies):
2690         Use NSHTTPCookie's hash and equality comparison to more closely match the NSHTTPCookie behavior.
2691
2692 2017-05-17  Emilio Cobos Álvarez  <ecobos@igalia.com>
2693
2694         Add a RuntimeEnabledFeature for display: contents, defaulted to false.
2695         https://bugs.webkit.org/show_bug.cgi?id=171984
2696
2697         Reviewed by Antti Koivisto.
2698
2699         The "defaulted to false" is not only because there are spec issues,
2700         but because I ran the WPT suite, and there was a fair amount of
2701         crashes and messed render trees.
2702
2703         * css/StyleResolver.cpp:
2704         (WebCore::StyleResolver::adjustRenderStyle):
2705         * page/RuntimeEnabledFeatures.h:
2706         (WebCore::RuntimeEnabledFeatures::setDisplayContentsEnabled):
2707         (WebCore::RuntimeEnabledFeatures::displayContentsEnabled):
2708
2709 2017-05-17  Antti Koivisto  <antti@apple.com>
2710
2711         Regression (198943): <marquee> shouldn't wrap text
2712         https://bugs.webkit.org/show_bug.cgi?id=172217
2713
2714         Reviewed by Andreas Kling.
2715
2716         RenderMarquee::updateMarqueeStyle mutated the style and then expected it to inherit to children.
2717         This doesn't work anymore because render tree construction is now separated from style resolution
2718         where inheritance happens.
2719
2720         Test: fast/html/marquee-child-wrap.html
2721
2722         * css/StyleResolver.cpp:
2723         (WebCore::StyleResolver::adjustRenderStyle):
2724
2725             Implement marquee hacks in adjustRenderStyle instead. This can't do the childrenInline check
2726             the previous code had but it wasn't working anyway (there are no children when updateMarqueeStyle
2727             gets called).
2728
2729         * rendering/RenderMarquee.cpp:
2730         (WebCore::RenderMarquee::updateMarqueeStyle):
2731
2732             This no longer needs mutable style.
2733
2734 2017-05-16  David Kilzer  <ddkilzer@apple.com>
2735
2736         Remove C-style casts by using xmlDocPtr instead of void*
2737         <https://webkit.org/b/172189>
2738
2739         Reviewed by Alex Christensen.
2740
2741         * dom/TransformSource.h: Fix whitespace indentation.
2742         (typedef PlatformTransformSource): Use xmlDocPtr not void*.
2743         * dom/TransformSourceLibxslt.cpp:
2744         (WebCore::TransformSource::~TransformSource): Remove cast.
2745         * xml/XSLStyleSheetLibxslt.cpp:
2746         (WebCore::XSLStyleSheet::document): Remove cast.
2747         * xml/XSLTProcessorLibxslt.cpp:
2748         (WebCore::xmlDocPtrFromNode): Remove casts.
2749         * xml/parser/XMLDocumentParser.h:
2750         (WebCore::xmlDocPtrForString): Update declaration to return
2751         xmlDocPtr not void*.
2752         * xml/parser/XMLDocumentParserLibxml2.cpp:
2753         (WebCore::XMLDocumentParser::doEnd): Change type of local
2754         variable from void* to xmlDocPtr.
2755         (WebCore::xmlDocPtrForString): Update to return xmlDocPtr
2756         not void*.
2757
2758 2017-05-16  Sam Weinig  <sam@webkit.org>
2759
2760         Bring Notification.idl up to spec
2761         https://bugs.webkit.org/show_bug.cgi?id=172156
2762
2763         Reviewed by Chris Dumez.
2764
2765         Test: http/tests/notifications/notification.html
2766
2767         * CMakeLists.txt:
2768         * DerivedSources.make:
2769         * WebCore.xcodeproj/project.pbxproj:
2770         Add new files.
2771
2772         * Modules/notifications/Notification.cpp:
2773         (WebCore::Notification::create):
2774         (WebCore::Notification::Notification):
2775         (WebCore::Notification::show):
2776         (WebCore::directionString): Deleted.
2777         (WebCore::Notification::permission): Deleted.
2778         (WebCore::Notification::permissionString): Deleted.
2779         * Modules/notifications/Notification.h:
2780         * Modules/notifications/Notification.idl:
2781         * Modules/notifications/NotificationClient.h:
2782         * Modules/notifications/NotificationDirection.h: Added.
2783         * Modules/notifications/NotificationPermission.h: Added.
2784         * Modules/notifications/NotificationPermission.idl: Added.
2785         * Modules/notifications/NotificationPermissionCallback.h:
2786         * Modules/notifications/NotificationPermissionCallback.idl:
2787         Bring up to spec, replacing DOMStrings with enums where appropriate and adding
2788         additional readonly properties to Notification to mirror options provided
2789         in construction.
2790
2791 2017-05-16  Zalan Bujtas  <zalan@apple.com>
2792
2793         Do not skip <slot> children when collecting content for innerText.
2794         https://bugs.webkit.org/show_bug.cgi?id=172113
2795         <rdar://problem/30362324>
2796
2797         Reviewed by Ryosuke Niwa and Brent Fulgham.
2798
2799         "display: contents" elements do not generate renderers but their children might.
2800         This patch ensure that we don't skip them while collecting text content.  
2801
2802         Test: fast/text/inner-text-should-include-slot-subtree.html
2803
2804         * editing/TextIterator.cpp:
2805         (WebCore::TextIterator::advance):
2806
2807 2017-05-16  Filip Pizlo  <fpizlo@apple.com>
2808
2809         GCController::garbageCollectNowIfNotDoneRecently should request Async Full GCs
2810         https://bugs.webkit.org/show_bug.cgi?id=172204
2811
2812         Reviewed by Saam Barati.
2813
2814         No new tests because existing tests will tell us if there is a problem.
2815         
2816         The goal of this change is to reduce the likelihood that we block for a GC. We want it to be
2817         benchmark-neutral.
2818         
2819         It's a 0.14% speed-up on JetStream with 24% probability.
2820         
2821         It's a 0.12% slow-down on PLT3 with 43% probability.
2822         
2823         So it's neutral on my machine.
2824
2825         * bindings/js/GCController.cpp:
2826         (WebCore::GCController::garbageCollectNowIfNotDoneRecently):
2827
2828 2017-05-16  Tim Horton  <timothy_horton@apple.com>
2829
2830         [macOS] REGRESSION: Drag images for links with right-to-left titles are incorrect (172006)
2831         https://bugs.webkit.org/show_bug.cgi?id=172006
2832         <rdar://problem/32165137>
2833
2834         Reviewed by Dean Jackson.
2835
2836         * platform/mac/DragImageMac.mm:
2837         (WebCore::LinkImageLayout::LinkImageLayout):
2838         (WebCore::createDragImageForLink):
2839         (WebCore::LinkImageLayout::addLine): Deleted.
2840         * platform/spi/cocoa/CoreTextSPI.h:
2841         Set and paint the entire frame as a single unit, making use of the
2842         CTFrameMaximumNumberOfLines attribute to limit the number of lines.
2843         This gives CoreText power over text alignment and makes RTL text lay
2844         out correctly.
2845
2846 2017-05-16  Chris Dumez  <cdumez@apple.com>
2847
2848         Implement DOMMatrix / DOMMatrixReadOnly
2849         https://bugs.webkit.org/show_bug.cgi?id=110001
2850
2851         Reviewed by Sam Weinig and Simon Fraser.
2852
2853         Implement DOMMatrix / DOMMatrixReadOnly as per:
2854         - https://drafts.fxtf.org/geometry/#DOMMatrix
2855
2856         For now, these new types co-exist with WebKitCSSMatrix / SVGMatrix. However, in the future,
2857         WebKitCSSMatrix / SVGMatrix are supposed to become aliases to DOMMatrix.
2858
2859         Most of it has been implemented. What remaining to be implemented is:
2860         - Make WebKitCSSMatrix / SVGMatrix aliases to DOMMatrix
2861         - DOMMatrix.fromFloat32Array() / fromFloat64Array()
2862         - DOMMatrixReadOnly.fromFloat32Array() / fromFloat64Array() / toFloat32Array() / toFloat64Array()
2863         - DOMMatrixReadOnly.transformPoint().
2864
2865         Tests: imported/w3c/web-platform-tests/css/geometry-1/*
2866
2867         * CMakeLists.txt:
2868         * DerivedSources.make:
2869         * WebCore.xcodeproj/project.pbxproj:
2870
2871         * bindings/scripts/CodeGeneratorJS.pm:
2872         * bindings/scripts/test/JS/JSTestObj.cpp:
2873         Fix a bug in the bindings generator causing the generator code for
2874         "Constructor(optional (DOMString or sequence<unrestricted double>) init)" to be wrong
2875         and not build.
2876
2877         * css/DOMMatrix.cpp: Added.
2878         (WebCore::DOMMatrix::DOMMatrix):
2879         (WebCore::DOMMatrix::fromMatrix):
2880         (WebCore::DOMMatrix::multiplySelf):
2881         (WebCore::DOMMatrix::preMultiplySelf):
2882         (WebCore::DOMMatrix::translateSelf):
2883         (WebCore::DOMMatrix::scaleSelf):
2884         (WebCore::DOMMatrix::scale3dSelf):
2885         (WebCore::DOMMatrix::rotateSelf):
2886         (WebCore::DOMMatrix::rotateFromVectorSelf):
2887         (WebCore::DOMMatrix::rotateAxisAngleSelf):
2888         (WebCore::DOMMatrix::skewXSelf):
2889         (WebCore::DOMMatrix::skewYSelf):
2890         (WebCore::DOMMatrix::invertSelf):
2891         (WebCore::DOMMatrix::setMatrixValueForBindings):
2892         * css/DOMMatrix.h: Added.
2893         (WebCore::DOMMatrix::create):
2894         (WebCore::DOMMatrix::setA):
2895         (WebCore::DOMMatrix::setB):
2896         (WebCore::DOMMatrix::setC):
2897         (WebCore::DOMMatrix::setD):
2898         (WebCore::DOMMatrix::setE):
2899         (WebCore::DOMMatrix::setF):
2900         (WebCore::DOMMatrix::setM11):
2901         (WebCore::DOMMatrix::setM12):
2902         (WebCore::DOMMatrix::setM13):
2903         (WebCore::DOMMatrix::setM14):
2904         (WebCore::DOMMatrix::setM21):
2905         (WebCore::DOMMatrix::setM22):
2906         (WebCore::DOMMatrix::setM23):
2907         (WebCore::DOMMatrix::setM24):
2908         (WebCore::DOMMatrix::setM31):
2909         (WebCore::DOMMatrix::setM32):
2910         (WebCore::DOMMatrix::setM33):
2911         (WebCore::DOMMatrix::setM34):
2912         (WebCore::DOMMatrix::setM41):
2913         (WebCore::DOMMatrix::setM42):
2914         (WebCore::DOMMatrix::setM43):
2915         (WebCore::DOMMatrix::setM44):
2916         * css/DOMMatrix.idl: Added.
2917         * css/DOMMatrixInit.h: Added.
2918         * css/DOMMatrixInit.idl: Added.
2919         * css/DOMMatrixReadOnly.cpp: Added.
2920         (WebCore::DOMMatrixReadOnly::DOMMatrixReadOnly):
2921         (WebCore::DOMMatrixReadOnly::validateAndFixup):
2922         (WebCore::DOMMatrixReadOnly::fromMatrix):
2923         (WebCore::DOMMatrixReadOnly::isIdentity):
2924         (WebCore::DOMMatrixReadOnly::setMatrixValue):
2925         (WebCore::DOMMatrixReadOnly::translate):
2926         (WebCore::DOMMatrixReadOnly::flipX):
2927         (WebCore::DOMMatrixReadOnly::flipY):
2928         (WebCore::DOMMatrixReadOnly::multiply):
2929         (WebCore::DOMMatrixReadOnly::scale):
2930         (WebCore::DOMMatrixReadOnly::scale3d):
2931         (WebCore::DOMMatrixReadOnly::rotate):
2932         (WebCore::DOMMatrixReadOnly::rotateFromVector):
2933         (WebCore::DOMMatrixReadOnly::rotateAxisAngle):
2934         (WebCore::DOMMatrixReadOnly::skewX):
2935         (WebCore::DOMMatrixReadOnly::skewY):
2936         (WebCore::DOMMatrixReadOnly::inverse):
2937         (WebCore::DOMMatrixReadOnly::toString):
2938         * css/DOMMatrixReadOnly.h: Added.
2939         (WebCore::DOMMatrixReadOnly::create):
2940         (WebCore::DOMMatrixReadOnly::a):
2941         (WebCore::DOMMatrixReadOnly::b):
2942         (WebCore::DOMMatrixReadOnly::c):
2943         (WebCore::DOMMatrixReadOnly::d):
2944         (WebCore::DOMMatrixReadOnly::e):
2945         (WebCore::DOMMatrixReadOnly::f):
2946         (WebCore::DOMMatrixReadOnly::m11):
2947         (WebCore::DOMMatrixReadOnly::m12):
2948         (WebCore::DOMMatrixReadOnly::m13):
2949         (WebCore::DOMMatrixReadOnly::m14):
2950         (WebCore::DOMMatrixReadOnly::m21):
2951         (WebCore::DOMMatrixReadOnly::m22):
2952         (WebCore::DOMMatrixReadOnly::m23):
2953         (WebCore::DOMMatrixReadOnly::m24):
2954         (WebCore::DOMMatrixReadOnly::m31):
2955         (WebCore::DOMMatrixReadOnly::m32):
2956         (WebCore::DOMMatrixReadOnly::m33):
2957         (WebCore::DOMMatrixReadOnly::m34):
2958         (WebCore::DOMMatrixReadOnly::m41):
2959         (WebCore::DOMMatrixReadOnly::m42):
2960         (WebCore::DOMMatrixReadOnly::m43):
2961         (WebCore::DOMMatrixReadOnly::m44):
2962         (WebCore::DOMMatrixReadOnly::is2D):
2963         (WebCore::DOMMatrixReadOnly::fromMatrixHelper):
2964         * css/DOMMatrixReadOnly.idl: Added.
2965         * css/WebKitCSSMatrix.h:
2966         * css/WebKitCSSMatrix.idl:
2967         * svg/SVGMatrix.h:
2968         * svg/SVGMatrix.idl:
2969
2970 2017-05-16  Eric Carlson  <eric.carlson@apple.com>
2971
2972         [MediaStream] AudioSampleBufferList::zeroABL takes byte count, not sample count
2973         https://bugs.webkit.org/show_bug.cgi?id=172194
2974         <rdar://problem/32233799>
2975
2976         Reviewed by Jer Noble.
2977
2978         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
2979         (WebCore::AudioTrackPrivateMediaStreamCocoa::render): Pass number of bytes to zero,
2980         not number of samples.
2981
2982 2017-05-16  Mark Lam  <mark.lam@apple.com>
2983
2984         WorkerRunLoop::Task::performTask() needs to null check context->script() before use.
2985         https://bugs.webkit.org/show_bug.cgi?id=172193
2986         <rdar://problem/32225346>
2987
2988         Reviewed by Filip Pizlo.
2989
2990         According to https://build-safari.apple.com/results/Trunk%20Fuji%20GuardMalloc%20Production%20WK2%20Tests/r216929_459760e0918316187c8e52c6585a3a9ba9181204%20(12066)/results.html,
2991         we see a crash with this crash trace:
2992
2993         Thread 13 Crashed:: WebCore: Worker
2994         0 com.apple.WebCore        0x00000001099607b2 WebCore::WorkerScriptController::isTerminatingExecution() const + 18
2995         1 com.apple.WebCore        0x000000010995ebbf WebCore::WorkerRunLoop::runCleanupTasks(WebCore::WorkerGlobalScope*) + 143
2996         2 com.apple.WebCore        0x000000010995e80f WebCore::WorkerRunLoop::run(WebCore::WorkerGlobalScope*) + 111
2997         3 com.apple.WebCore        0x00000001099621b6 WebCore::WorkerThread::workerThread() + 742
2998         4 com.apple.JavaScriptCore 0x000000010a964b92 WTF::threadEntryPoint(void*) + 178
2999         5 com.apple.JavaScriptCore 0x000000010a964a69 WTF::wtfThreadEntryPoint(void*) + 121
3000         6 libsystem_pthread.dylib  0x00007fffbdb5caab _pthread_body + 180
3001         7 libsystem_pthread.dylib  0x00007fffbdb5c9f7 _pthread_start + 286
3002         8 libsystem_pthread.dylib  0x00007fffbdb5c1fd thread_start + 13
3003
3004         ... and the crashing address is:
3005
3006         Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000022
3007
3008         0x0000000000000022 is the offset of m_scheduledTerminationMutex in the
3009         WorkerScriptController.  This means that WorkerScriptController::isTerminatingExecution()
3010         is passed a NULL this pointer.  This means that it's possible to have a race
3011         where a WorkerRunLoop::Task gets enqueued beyond the Cleanup task that deletes the
3012         context->script().  As a result, WorkerRunLoop::Task::performTask() (called by
3013         runCleanupTasks()) may see a null context->script().
3014
3015         Hence, WorkerRunLoop::Task::performTask() should null check context->script()
3016         before invoking the isTerminatingExecution() query on it.
3017
3018         No new tests because this is already covered by existing tests.
3019
3020         * workers/WorkerRunLoop.cpp:
3021         (WebCore::WorkerRunLoop::Task::performTask):
3022
3023 2017-05-16  Youenn Fablet  <youenn@apple.com>
3024
3025         Modernize WebKit2 getUserMedia passing of parameters
3026         https://bugs.webkit.org/show_bug.cgi?id=172161
3027
3028         Reviewed by Eric Carlson.
3029
3030         No change of behavior.
3031
3032         * platform/mediastream/RealtimeMediaSourceCenter.h: Using WTF::Function to enable capture Ref<>.
3033
3034 2017-05-16  Jeremy Jones  <jeremyj@apple.com>
3035
3036         Captions and subtitles not showing up in picture-in-picture for MSE content.
3037         https://bugs.webkit.org/show_bug.cgi?id=172145
3038
3039         Reviewed by Eric Carlson.
3040
3041         No new tests as this has no affect on the DOM.
3042
3043         Add TextTrackRepresentation code from MediaPlayerPrivateAVFoundationObj to MediaPlayerPrivateMediaSourceAVFObjc.
3044         This moves the TextTrackRepresentation platfrom layer into the fullscreen container layer when going into
3045         pip for fullscreen, allowing the captions to be visible.
3046
3047         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
3048         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3049         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer):
3050         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer):
3051         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenFrame):
3052         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::requiresTextTrackRepresentation):
3053         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::syncTextTrackBounds):
3054         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setTextTrackRepresentation):
3055
3056 2017-05-16  David Kilzer  <ddkilzer@apple.com>
3057
3058         WebCore::leakCGColor() needs CF_RETURNS_RETAINED annotation
3059         <https://webkit.org/b/172190>
3060
3061         Reviewed by Simon Fraser.
3062
3063         * platform/graphics/cg/ColorCG.cpp:
3064         (WebCore::leakCGColor): Annotate with CF_RETURNS_RETAINED since
3065         it does not follow the CF naming convention, which means the
3066         expected behavior can't be inferred by the clang static
3067         analyzer.
3068
3069 2017-05-16  Youenn Fablet  <youenn@apple.com>
3070
3071         RealtimeOutgoingVideoSource should support sinkWants for rotation
3072         https://bugs.webkit.org/show_bug.cgi?id=172123
3073         <rdar://problem/32200017>
3074
3075         Reviewed by Eric Carlson.
3076
3077         Covered by manual testing.
3078
3079         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
3080         (WebCore::RealtimeOutgoingVideoSource::AddOrUpdateSink): Triggering pixel rotation based on sink.
3081         (WebCore::RealtimeOutgoingVideoSource::sendFrame): Doing the rotation using libwebrtc API.
3082         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
3083
3084 2017-05-16  Myles C. Maxfield  <mmaxfield@apple.com>
3085
3086         REGRESSION(r212513): LastResort is platform-dependent, so its semantics should not be required to perform font loading correctly.
3087         https://bugs.webkit.org/show_bug.cgi?id=168487
3088
3089         Reviewed by Antti Koivisto.
3090
3091         There are three ways a Web author can chain multiple font files together:
3092         1. Multiple entries in the "src" descriptor in an @font-face rule
3093         2. Multiple @font-face rules with the same "font-family" descriptor
3094         3. Multiple entries in the "font-family" property on an element
3095
3096         Before r212513, the code which iterated across #2 and #3 above could have
3097         triggered each item in the chain to download. r212513 tried to solve this
3098         by using LastResort as the interstitial font used during downloads, because
3099         LastResort supports every character and therefore solves #3 above. However,
3100         this change had a few problems:
3101
3102         1. Previously, our code would try to avoid using the interstitial font for
3103         layout or rendering whenever possible (because one of the chains above may
3104         have named a local font which would be better to use). In order to use the
3105         benefits of LastResort, I had to remove this avoidance logic and make
3106         WebKit try to use the interstitial font as often as possible. However, due
3107         to the large metrics of LastResort, this means that offsetWidth queries
3108         during font loading would be wildly inaccurate, causing Google Docs to break.
3109         2. It also means that canvas drawing during font loading would actually draw
3110         LastResort, causing Bing maps to break.
3111         3. LastResort is platform-specific, so only platforms which have it would
3112         actually be able to load fonts correctly.
3113
3114         Instead, we should keep the older logic about avoiding using the
3115         interstitial font so that loading has a better experience for the user.
3116         We solve the unnecessary download problem by giving our loading code a
3117         downloading policy enum, which has two values: allow downloads or forbid
3118         downloads. Whenever our loading code returns the interstitial font, we
3119         continue our search, but we change the policy to forbid downloads.
3120
3121         There is one piece of subtlety, though: It is more common for web authors
3122         to put good fallbacks in the "font-family" property than in the "src"
3123         descriptor inside @font-face. This means that we shouldn't exhaustively
3124         search through the @font-face src list first. Instead, we should look
3125         through the src list until we hit a non-local font, and then immediately
3126         start looking through the other other chains.
3127
3128         Tests: fast/text/font-download-font-face-src-list.html
3129                fast/text/font-download-font-family-property.html
3130                fast/text/font-download-remote-fallback-all.html
3131                fast/text/font-interstitial-invisible-width-while-loading.html
3132                fast/text/font-weight-download-3.html
3133                fast/text/web-font-load-fallback-during-loading-2.html
3134                fast/text/web-font-load-invisible-during-loading.html
3135
3136         * css/CSSFontFace.cpp:
3137         (WebCore::CSSFontFace::fontLoadEventOccurred): Implement support for
3138         the font download policy.
3139         (WebCore::CSSFontFace::setStatus): After 3 seconds of loading, we
3140         will start drawing the fallback font. However, for testing, we have an
3141         internal setting to make this switch happen immediately. This patch now
3142         requires that this internal switch happen synchronously.
3143         (WebCore::CSSFontFace::pump): Implement support for the font download
3144         policy.
3145         (WebCore::CSSFontFace::load): Ditto.
3146         (WebCore::CSSFontFace::font): Ditto.
3147         * css/CSSFontFace.h: Ditto.
3148         * css/CSSFontSelector.cpp:
3149         (WebCore::CSSFontSelector::beginLoadingFontSoon): Implement support for
3150         synchronous font download timeouts.
3151         * css/CSSSegmentedFontFace.cpp:
3152         (WebCore::CSSSegmentedFontFace::fontRanges): Implement support for the
3153         font download policy.
3154         * platform/graphics/Font.cpp: Add new flag which represents if the
3155         interstitial font was created after the 3 second timeout or before.
3156         Previously, we would distinguish between these two cases by knowing
3157         that one font was LastResort and the other font was a fallback. Now that
3158         we're using fallback fonts on both sides of the 3 second timeout, we
3159         now no longer know which one should be invisible. This new enum solves
3160         this problem.
3161         (WebCore::Font::Font):
3162         (WebCore::Font::verticalRightOrientationFont):
3163         (WebCore::Font::uprightOrientationFont):
3164         * platform/graphics/Font.h: Ditto.
3165         (WebCore::Font::create):
3166         (WebCore::Font::origin):
3167         (WebCore::Font::visibility):
3168         * platform/graphics/FontCache.h:
3169         * platform/graphics/FontCascade.cpp: We try to fall back to a local() font
3170         during downloads, but there might not be one that we can use. Therefore, we
3171         can't use the presence of the interstitial font to detect if we should paint
3172         invisibly. Instead, we can move this logic into the font-specific part of
3173         painting, and consult with the specific font to know if it was created from
3174         a timed-out @font-face rule or not.
3175         (WebCore::FontCascade::drawText):
3176         (WebCore::shouldDrawIfLoading):
3177         (WebCore::FontCascade::drawGlyphBuffer):
3178         (WebCore::FontCascade::drawEmphasisMarks):
3179         * platform/graphics/FontCascade.h:
3180         * platform/graphics/FontCascadeFonts.cpp:
3181         (WebCore::FontCascadeFonts::glyphDataForVariant): Implement the logic
3182         described above where we switch the policy if we encounter the intestitial
3183         font.
3184         (WebCore::FontCascadeFonts::glyphDataForNormalVariant): Ditto.
3185         (WebCore::glyphPageFromFontRanges): Ditto.
3186         * platform/graphics/FontRanges.cpp: Implement support for the font download
3187         policy.
3188         (WebCore::FontRanges::Range::font):
3189         (WebCore::FontRanges::glyphDataForCharacter):
3190         (WebCore::FontRanges::fontForCharacter):
3191         (WebCore::FontRanges::fontForFirstRange):
3192         * platform/graphics/FontRanges.h:
3193         * platform/graphics/FontSelector.h:
3194         * platform/graphics/freetype/FontCacheFreeType.cpp:
3195         (WebCore::FontCache::lastResortFallbackFontForEveryCharacter): Deleted.
3196         * platform/graphics/mac/FontCacheMac.mm:
3197         (WebCore::FontCache::lastResortFallbackFontForEveryCharacter): Deleted.
3198         * platform/graphics/win/FontCacheWin.cpp:
3199         (WebCore::FontCache::lastResortFallbackFontForEveryCharacter): Deleted.
3200
3201 2017-05-16  Zalan Bujtas  <zalan@apple.com>
3202
3203         Simple line layout: Move setCollapedWhitespaceWidth call to updateLineConstrains.
3204         https://bugs.webkit.org/show_bug.cgi?id=172178
3205
3206         Reviewed by Antti Koivisto.
3207
3208         No change in functionality.
3209
3210         * rendering/SimpleLineLayout.cpp:
3211         (WebCore::SimpleLineLayout::updateLineConstrains):
3212         (WebCore::SimpleLineLayout::createLineRuns):
3213
3214 2017-05-16  Eric Carlson  <eric.carlson@apple.com>
3215
3216         [MediaStream] Return default device list until user gives permission to capture
3217         https://bugs.webkit.org/show_bug.cgi?id=172168
3218         <rdar://problem/31816884>
3219
3220         Reviewed by Youenn Fablet.
3221
3222         Test: fast/mediastream/media-devices-enumerate-devices.html
3223
3224         * Modules/mediastream/MediaDevicesRequest.cpp:
3225         (WebCore::MediaDevicesRequest::filterDeviceList): Remove all but the "default" number of
3226         devices of each type.
3227         (WebCore::MediaDevicesRequest::start): Call filterDeviceList.
3228         * Modules/mediastream/MediaDevicesRequest.h:
3229
3230 2017-05-16  Claudio Saavedra  <csaavedra@igalia.com>
3231
3232         Silent a few warnings about unused parameters
3233         https://bugs.webkit.org/show_bug.cgi?id=172169
3234
3235         Reviewed by Sam Weinig.
3236
3237         * page/Page.cpp:
3238         (WebCore::Page::mainFrameLoadStarted):
3239         * platform/graphics/cairo/ImageBufferCairo.cpp:
3240         (WebCore::ImageBuffer::toData):
3241         * platform/network/ResourceRequestBase.cpp:
3242         (WebCore::ResourceRequestBase::partitionName):
3243
3244 2017-05-16  Wenson Hsieh  <wenson_hsieh@apple.com>
3245
3246         WebItemProviderPasteboard should be robust when temporary files are missing path extensions
3247         https://bugs.webkit.org/show_bug.cgi?id=172170
3248
3249         Reviewed by Tim Horton.
3250
3251         Makes a slight adjustment to the temporary file URLs are handled when using WebItemProviderPasteboard to load
3252         data off of item providers. Previously, we would bail early and not load any data if the temporary URL is
3253         missing an extension. Since the switch to NSItemProviders from UIItemProviders, some types of temporary files
3254         generated by item providers are missing extensions, so this extra check is meaningless.
3255
3256         Covered by existing data interaction unit tests.
3257
3258         * platform/ios/WebItemProviderPasteboard.mm:
3259         (temporaryFileURLForDataInteractionContent):
3260         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout:]):
3261
3262 2017-05-16  Zan Dobersek  <zdobersek@igalia.com>
3263
3264         [WPE] GLContextEGL::createWPEContext() should fall back to pbuffer-based contexts when offscreen target provides no native window
3265         https://bugs.webkit.org/show_bug.cgi?id=172162
3266
3267         Reviewed by Carlos Garcia Campos.
3268
3269         When creating an offscreen GLContext, the underlying implementation might
3270         provide a mock native window that's to be used as the window target upon
3271         which a window-based GLContext should be created. But we should also support
3272         falling back to pbuffer-based GLContexts when the underlying implementation
3273         can't provide such mock targets.
3274
3275         * platform/graphics/egl/GLContextEGLWPE.cpp:
3276         (WebCore::GLContextEGL::createWPEContext):
3277
3278 2017-05-16  Zan Dobersek  <zdobersek@igalia.com>
3279
3280         [GLib] Name more GSource-based RunLoop::Timers
3281         https://bugs.webkit.org/show_bug.cgi?id=172158
3282
3283         Reviewed by Carlos Garcia Campos.
3284
3285         * platform/glib/MainThreadSharedTimerGLib.cpp:
3286         (WebCore::MainThreadSharedTimer::MainThreadSharedTimer):
3287         Specify 'MainThreadSharedTimer' as the name of this GSource-based RunLoop::Timer.
3288
3289 2017-05-16  Romain Bellessort  <romain.bellessort@crf.canon.fr>
3290
3291         [Readable Streams API] Implement ReadableStreamBYOBReader releaseLock()
3292         https://bugs.webkit.org/show_bug.cgi?id=172111
3293
3294         Reviewed by Chris Dumez.
3295
3296         Implemented ReadableStreamBYOBReader releaseLock():
3297         - https://streams.spec.whatwg.org/#byob-reader-release-lock;
3298         - https://streams.spec.whatwg.org/#readable-stream-reader-generic-release.
3299
3300         Added tests to check releaseLock behavior.
3301
3302         * Modules/streams/ReadableStreamBYOBReader.js:
3303         (releaseLock): Implemented.
3304         * Modules/streams/ReadableStreamInternals.js:
3305         (readableStreamReaderGenericRelease): Aligned with spec.
3306
3307 2017-05-16  Carlos Garcia Campos  <cgarcia@igalia.com>
3308
3309         Unreviewed. Try to fix GTK+ build with MEDIA_STREAM enabled after r216918.
3310
3311         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
3312         (WebCore::RealtimeMediaSourceCenterOwr::validateRequestConstraints):
3313
3314 2017-05-16  Youenn Fablet  <youenn@apple.com>
3315
3316         Remove MediaConstraintsData and MediaConstraintsImpl
3317         https://bugs.webkit.org/show_bug.cgi?id=172132
3318
3319         Reviewed by Eric Carlson.
3320
3321         No observable change of behavior.
3322
3323         Removing MediaConstraintsData and MediaConstraintsImpl allows simplifying the code.
3324         Further simplified the code by making MediaConstraints no longer ref counted and now a struct.
3325         Simplified some RealtimeMediaSource subclasses by removing unused MediaConstraints class members.
3326
3327         * CMakeLists.txt: Removing MediaConstraintsImpl.cpp.
3328         * Modules/mediastream/MediaConstraintsImpl.cpp: Removed.
3329         * Modules/mediastream/MediaConstraintsImpl.h: Removed.
3330         * Modules/mediastream/MediaDevices.cpp:
3331         (WebCore::createMediaConstraints):
3332         (WebCore::MediaDevices::getUserMedia):
3333         (WebCore::createMediaConstraintsImpl): Deleted.
3334         * Modules/mediastream/MediaStreamTrack.cpp:
3335         (WebCore::createMediaConstraints):
3336         (WebCore::MediaStreamTrack::applyConstraints):
3337         (WebCore::createMediaConstraintsImpl): Deleted.
3338         * Modules/mediastream/MediaTrackConstraints.cpp:
3339         (WebCore::createMediaConstraints):
3340         (WebCore::createMediaConstraintsImpl): Deleted.
3341         * Modules/mediastream/MediaTrackConstraints.h:
3342         * Modules/mediastream/UserMediaRequest.cpp:
3343         (WebCore::UserMediaRequest::start):
3344         (WebCore::UserMediaRequest::UserMediaRequest):
3345         (WebCore::UserMediaRequest::allow):
3346         * Modules/mediastream/UserMediaRequest.h:
3347         (WebCore::UserMediaRequest::audioConstraints):
3348         (WebCore::UserMediaRequest::videoConstraints):
3349         * WebCore.xcodeproj/project.pbxproj:
3350         * platform/mediastream/MediaConstraints.cpp:
3351         (WebCore::addDefaultVideoConstraints):
3352         (WebCore::MediaConstraints::isConstraintSet):
3353         (WebCore::MediaConstraints::setDefaultVideoConstraints):
3354         * platform/mediastream/MediaConstraints.h:
3355         (WebCore::MediaConstraints::~MediaConstraints): Deleted.
3356         (WebCore::MediaConstraints::MediaConstraints): Deleted.
3357         * platform/mediastream/MediaStreamConstraintsValidationClient.h:
3358         * platform/mediastream/RealtimeMediaSource.cpp:
3359         (WebCore::RealtimeMediaSource::selectSettings):
3360         (WebCore::RealtimeMediaSource::supportsConstraints):
3361         (WebCore::RealtimeMediaSource::applyConstraints):
3362         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
3363         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):
3364         * platform/mediastream/RealtimeMediaSourceCenter.h:
3365         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
3366         (WebCore::RealtimeIncomingAudioSource::supportedConstraints): Deleted.
3367         * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
3368         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
3369         (WebCore::RealtimeIncomingVideoSource::supportedConstraints): Deleted.
3370         * platform/mediastream/mac/RealtimeIncomingVideoSource.h:
3371         * platform/mock/MockRealtimeMediaSource.h:
3372         (WebCore::MockRealtimeMediaSource::constraints): Deleted.
3373
3374 2017-05-16  Andy Estes  <aestes@apple.com>
3375
3376         [Cocoa] Tell NEFilterSource about the presenting app's PID
3377         https://bugs.webkit.org/show_bug.cgi?id=172152
3378         <rdar://problem/32197740>
3379
3380         Reviewed by Dan Bernstein.
3381
3382         * platform/cocoa/NetworkExtensionContentFilter.mm:
3383         (WebCore::NetworkExtensionContentFilter::initialize):
3384         * platform/spi/cocoa/NEFilterSourceSPI.h:
3385