[WebIDL] Update parser and code generators to only access type information through...
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-10-28  Sam Weinig  <sam@webkit.org>
2
3         [WebIDL] Update parser and code generators to only access type information through the type property
4         https://bugs.webkit.org/show_bug.cgi?id=164141
5
6         Reviewed by Anders Carlsson.
7
8         Update IDLParser structs:
9         - domSignature: Rename idlType to type. Specify that type is a domType.
10         - domInterface: Remove name and parent. Specify that type and parentType are a domTypes.
11         - domFunction: Specify that signature is a domSignature.
12         - domAttribute: Remove unused type. Specify that signature is a domSignature.
13         - domIterable: Remove idlKeyType and valueKeyType. Specify that keyType and valueType are a domTypes
14         - domConstant: Specify that type is a domType.
15         - domEnum: Specify that type is a domType.
16         - domDictionary: Remove name and parent. Specify that type and parentType are a domTypes.
17         - Typedef: Rename idlType to type and specify that it is a domType.
18
19         * bindings/scripts/IDLParser.pm:
20         Remove redundant properties and specify type info in structs where possible.
21
22         * bindings/scripts/CodeGenerator.pm:
23         (IsSVGTypeNeedingTearOffForType): Renamed to remove ForType suffix.
24         (IsSVGTypeWithWritablePropertiesNeedingTearOffForType): Renamed to remove ForType suffix.
25         (GetSVGTypeNeedingTearOffForType): Renamed to remove ForType suffix.
26         (GetSVGWrappedTypeNeedingTearOffForType): Renamed to remove ForType suffix.
27
28         Update to always access type information through type accessors. Remove use of removed
29         properties.
30
31         * bindings/scripts/CodeGeneratorJS.pm:
32         (IsNullableType): Deleted.
33         (StripNullable): Deleted.
34         Remove unused functions.
35
36         Update to always access type information through type accessors. Remove use of removed
37         properties.
38
39         * bindings/scripts/generate-bindings.pl:
40         Update to always access type information through type accessors. Remove use of removed
41         properties.
42
43 2016-10-28  Dave Hyatt  <hyatt@apple.com>
44
45         [CSS Parser] Support bopomofo Ruby
46         https://bugs.webkit.org/show_bug.cgi?id=164148
47
48         Reviewed by Simon Fraser.
49
50         * css/parser/CSSParserFastPaths.cpp:
51         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
52
53 2016-10-28  Dave Hyatt  <hyatt@apple.com>
54
55         [CSS Parser] Add support for -webkit-canvas images
56         https://bugs.webkit.org/show_bug.cgi?id=164144
57
58         Reviewed by Simon Fraser.
59
60         * css/CSSValueKeywords.in:
61         * css/parser/CSSParser.cpp:
62         (WebCore::CSSParserContext::CSSParserContext):
63         * css/parser/CSSPropertyParserHelpers.cpp:
64         (WebCore::CSSPropertyParserHelpers::consumeWebkitCanvas):
65         (WebCore::CSSPropertyParserHelpers::consumeGeneratedImage):
66         (WebCore::CSSPropertyParserHelpers::isGeneratedImage):
67
68 2016-10-27  Geoffrey Garen  <ggaren@apple.com>
69
70         One file per class for Executable.h/.cpp
71         https://bugs.webkit.org/show_bug.cgi?id=164099
72
73         Reviewed by Saam Barati.
74
75         * ForwardingHeaders/runtime/Executable.h: Removed.
76         * ForwardingHeaders/runtime/FunctionExecutable.h: Copied from Source/WebCore/ForwardingHeaders/runtime/Executable.h.
77         * bindings/js/JSLazyEventListener.cpp:
78         * bindings/js/JSMainThreadExecStateInstrumentation.h:
79
80 2016-10-28  Dave Hyatt  <hyatt@apple.com>
81
82         [CSS Parser] Clean up gradient parsing
83         https://bugs.webkit.org/show_bug.cgi?id=164139
84
85         Reviewed by Dean Jackson.
86
87         * css/CSSGradientValue.cpp:
88         (WebCore::positionFromValue):
89         (WebCore::CSSGradientValue::computeEndPoint):
90         * css/parser/CSSPropertyParserHelpers.cpp:
91         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradient):
92         (WebCore::CSSPropertyParserHelpers::consumeGradientColorStops):
93         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedRadialGradient):
94         (WebCore::CSSPropertyParserHelpers::consumeRadialGradient):
95         (WebCore::CSSPropertyParserHelpers::consumeLinearGradient):
96
97 2016-10-28  Dean Jackson  <dino@apple.com>
98
99         New CSS Parser should use Colors not RGBA32s
100         https://bugs.webkit.org/show_bug.cgi?id=164124
101         <rdar://problem/29000373>
102
103         Reviewed by Darin Adler.
104
105         The old parser has moved from using RGBA32 values to using
106         Colors directly. This was so we could support ExtendedColors
107         via the new color() syntax.
108
109         Update the new CSS parser to do the same.
110
111         * css/parser/CSSPropertyParserHelpers.cpp:
112         (WebCore::CSSPropertyParserHelpers::parseRGBParameters):
113         (WebCore::CSSPropertyParserHelpers::parseHSLParameters):
114         (WebCore::CSSPropertyParserHelpers::parseHexColor):
115         (WebCore::CSSPropertyParserHelpers::parseColorFunction):
116         (WebCore::CSSPropertyParserHelpers::consumeColor):
117
118 2016-10-28  Dean Jackson  <dino@apple.com>
119
120         Allow new CSS parser to handle insertRule, etc via parseRule
121         https://bugs.webkit.org/show_bug.cgi?id=164122
122         <rdar://problem/29000101>
123
124         Reviewed by Darin Adler.
125
126         Call the new CSS parser from CSSParser::parseRule if enabled. This
127         allows style added via the CSSOM insertRule to go through
128         the parser.
129
130         I tested this across our layout tests that use insertRule. It
131         works fine, but does cause some filter tests to fail. This is
132         because the new parser does not generate WebKitCSSFilterValues,
133         but I think the CSSFunctionValue is good enough. I'll remove
134         WebKitCSSFilterValue separately.
135
136         * css/parser/CSSParser.cpp:
137         (WebCore::CSSParser::parseRule): Call CSSParserImpl::parseRule.
138
139 2016-10-28  Simon Fraser  <simon.fraser@apple.com>
140
141         Wrong blur radius for filter: drop-shadow()
142         https://bugs.webkit.org/show_bug.cgi?id=163667
143
144         Reviewed by Darin Adler.
145         
146         The "stdDev" parameter to <feDropShadow> and <feGaussianBlur> represents the standard
147         deviation (σ) of the Gaussian blur function. CSS filters drop-shadow() and blur() follow
148         this with their radius parameter.
149         
150         However, CSS box-shadow and text-shadow use 2σ to describe the blur radius, since this
151         is conveniently close to the number of pixels the effect of the blur extends out.
152         
153         feDropShadow, which is used by non-accelerated filter: drop-shadow(), was using
154         the wrong blur radius because it passed its stdDev directly to ShadowBlur. ShadowBlur
155         was written for CSS box-shadow, so expected its input "blur radius" to be twice the
156         stdDev.
157         
158         Tests: css3/filters/drop-shadow-blur-radius.html
159                svg/filters/feDropShadow-blur-radius.html
160
161         * platform/graphics/filters/FEDropShadow.cpp:
162         (WebCore::FEDropShadow::platformApplySoftware):
163
164 2016-10-28  Youenn Fablet  <youenn@apple.com>
165
166         Expose RTCPeerConnection unprefixed
167         https://bugs.webkit.org/show_bug.cgi?id=164060
168
169         Reviewed by Darin Adler.
170
171         Covered by rebased and activated tests.
172
173         * Modules/mediastream/RTCPeerConnection.idl:
174
175 2016-10-28  Dave Hyatt  <hyatt@apple.com>
176
177         [CSS Parser] Support the marquee properties
178         https://bugs.webkit.org/show_bug.cgi?id=164132
179
180         Reviewed by Zalan Bujtas.
181
182         * css/parser/CSSParserFastPaths.cpp:
183         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
184         * css/parser/CSSPropertyParser.cpp:
185         (WebCore::consumeWebkitMarqueeIncrement):
186         (WebCore::consumeWebkitMarqueeRepetition):
187         (WebCore::consumeWebkitMarqueeSpeed):
188         (WebCore::CSSPropertyParser::parseSingleValue):
189         (WebCore::CSSPropertyParser::parseShorthand):
190
191 2016-10-28  Dave Hyatt  <hyatt@apple.com>
192
193         [CSS Parser] Miscellaneous bug fixes
194         https://bugs.webkit.org/show_bug.cgi?id=164131
195
196         Reviewed by Zalan Bujtas.
197
198         * css/CSSComputedStyleDeclaration.cpp:
199         (WebCore::ComputedStyleExtractor::propertyValue):
200         * css/CSSPropertyNames.in:
201         The prefix was incorrectly dropped from -webkit-column-progression.
202         Put it back.
203
204         * css/StyleBuilderConverter.h:
205         (WebCore::StyleBuilderConverter::convertPositionComponent):
206         (WebCore::StyleBuilderConverter::convertObjectPosition):
207         Fix object-position parsing so that the position components can
208         be ids.
209
210         * css/StyleBuilderCustom.h:
211         (WebCore::StyleBuilderCustom::applyValueContent):
212         The new parser doesn't make a list for content:none, since none can't be
213         a component of a list anyway. Add code to handle this case in the
214         apply function.
215
216         * css/parser/CSSParser.cpp:
217         (WebCore::isValidKeywordPropertyAndValue):
218         Put the prefix back on -webkit-column-progression.
219
220         * css/parser/CSSParserFastPaths.cpp:
221         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
222         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
223         Same.
224
225         * css/parser/CSSParserImpl.cpp:
226         (WebCore::CSSParserImpl::parsePageSelector):
227         Make sure match type is checked, since our code asserts if it isn't.
228
229         * css/parser/CSSPropertyParser.cpp:
230         (WebCore::validWidthOrHeightKeyword):
231         (WebCore::consumeLineGrid):
232         (WebCore::CSSPropertyParser::parseSingleValue):
233         Add support for the line-grid properties and for -webkit-nbsp-mode.
234
235 2016-10-28  Antti Koivisto  <antti@apple.com>
236
237         Always use iOS preload behavior
238         https://bugs.webkit.org/show_bug.cgi?id=164127
239
240         Reviewed by Andreas Kling.
241
242         On non-iOS platforms we were delaying issuing lower priority preload (images mostly) until document has body.
243         This should be unnecessary as networking layer prioritization should ensure higher priority resources are
244         loaded earlier. Testing on iOS has showed that more aggressive behavior is a win.
245
246         This patch switches to iOS behavior on all platforms (and simplified the logic).
247
248         * html/parser/HTMLResourcePreloader.cpp:
249         (WebCore::HTMLResourcePreloader::preload):
250         * loader/LinkLoader.cpp:
251         (WebCore::LinkLoader::preloadIfNeeded):
252         * loader/cache/CachedResourceLoader.cpp:
253         (WebCore::CachedResourceLoader::performPostLoadActions):
254         (WebCore::CachedResourceLoader::preload):
255         (WebCore::CachedResourceLoader::isPreloaded):
256         (WebCore::CachedResourceLoader::checkForPendingPreloads): Deleted.
257         (WebCore::CachedResourceLoader::requestPreload): Deleted.
258         (WebCore::CachedResourceLoader::clearPendingPreloads): Deleted.
259         * loader/cache/CachedResourceLoader.h:
260
261 2016-10-28  Youenn Fablet  <youenn@apple.com>
262
263         [Fetch] Ensure redirection count is no more than 20 in case of cross origin requests
264         https://bugs.webkit.org/show_bug.cgi?id=164117
265
266         Reviewed by Sam Weinig.
267
268         Tests: imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-cross-origin-worker.html
269                imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-cross-origin.html
270
271         Introducing a ResourceLoaderOptions that defines the maximum redirection count.
272         By default, it is set to 20 as per fetch specification.
273
274         This option is used by SubresourceLoader to cancel load if its redirection count is above that maximum.
275         DocumentThreadableLoader stopping redirections to make preflight if needed, it now uses the maxRedirectCount loader option to ensure
276         that the total number of redirections is 20.
277
278         * loader/DocumentThreadableLoader.cpp:
279         (WebCore::DocumentThreadableLoader::redirectReceived):
280         * loader/ResourceLoaderOptions.h:
281         * loader/SubresourceLoader.cpp:
282         (WebCore::SubresourceLoader::willSendRequestInternal):
283         * loader/SubresourceLoader.h:
284
285 2016-10-28  Fujii Hironori  <Hironori.Fujii@sony.com>
286
287         generate-bindings-all.pl should recompile supplemented IDL if its supplemental IDL are added or removed
288         https://bugs.webkit.org/show_bug.cgi?id=164054
289
290         Reviewed by Michael Catanzaro.
291
292         generate-bindings-all.pl determines which IDL to recompile by
293         comparing timestamps of generated files, source IDL and its
294         dependencies.  But this is not enough. If a new supplemental IDL
295         is added, its supplemented IDL needs to be recompiled even though
296         the timestamp of the supplemental IDL is older than the
297         generated files.
298
299         * bindings/scripts/generate-bindings-all.pl: Read supplemental
300         dependency file both before and after invoking preprocess-idls.pl.
301         Recompile IDL files if its supplemental dependencies are added or
302         removed.
303
304 2016-10-28  Youenn Fablet  <youenn@apple.com>
305
306         PeerMediaDescription does not need to be refcounted
307         https://bugs.webkit.org/show_bug.cgi?id=164059
308
309         Reviewed by Darin Adler.
310
311         No change of behavior.
312
313         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
314         (WebCore::MediaEndpointPeerConnection::createOfferTask):
315         (WebCore::MediaEndpointPeerConnection::createAnswerTask):
316         (WebCore::createSourceMap):
317         (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask):
318         (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask):
319         (WebCore::MediaEndpointPeerConnection::addIceCandidateTask):
320         (WebCore::MediaEndpointPeerConnection::gotIceCandidate):
321         * Modules/mediastream/MediaEndpointPeerConnection.h:
322         * Modules/mediastream/SDPProcessor.cpp:
323         (WebCore::configurationFromJSON):
324         (WebCore::configurationToJSON):
325         (WebCore::SDPProcessor::generateCandidateLine):
326         (WebCore::SDPProcessor::parseCandidateLine):
327         * platform/mediastream/IceCandidate.h:
328         * platform/mediastream/MediaEndpointSessionConfiguration.h:
329         (WebCore::MediaEndpointSessionConfiguration::mediaDescriptions):
330         (WebCore::MediaEndpointSessionConfiguration::addMediaDescription):
331         (WebCore::MediaEndpointSessionConfiguration::clone):
332         * platform/mediastream/PeerMediaDescription.h:
333         (WebCore::PeerMediaDescription::addPayload):
334         (WebCore::PeerMediaDescription::addSsrc):
335         (WebCore::PeerMediaDescription::clearSsrcs):
336         (WebCore::PeerMediaDescription::addIceCandidate):
337         (WebCore::PeerMediaDescription::create): Deleted.
338         (WebCore::PeerMediaDescription::~PeerMediaDescription): Deleted.
339         (WebCore::PeerMediaDescription::type): Deleted.
340         (WebCore::PeerMediaDescription::setType): Deleted.
341         (WebCore::PeerMediaDescription::port): Deleted.
342         (WebCore::PeerMediaDescription::setPort): Deleted.
343         (WebCore::PeerMediaDescription::address): Deleted.
344         (WebCore::PeerMediaDescription::setAddress): Deleted.
345         (WebCore::PeerMediaDescription::mode): Deleted.
346         (WebCore::PeerMediaDescription::setMode): Deleted.
347         (WebCore::PeerMediaDescription::mid): Deleted.
348         (WebCore::PeerMediaDescription::setMid): Deleted.
349         (WebCore::PeerMediaDescription::payloads): Deleted.
350         (WebCore::PeerMediaDescription::setPayloads): Deleted.
351         (WebCore::PeerMediaDescription::rtcpMux): Deleted.
352         (WebCore::PeerMediaDescription::setRtcpMux): Deleted.
353         (WebCore::PeerMediaDescription::rtcpAddress): Deleted.
354         (WebCore::PeerMediaDescription::setRtcpAddress): Deleted.
355         (WebCore::PeerMediaDescription::rtcpPort): Deleted.
356         (WebCore::PeerMediaDescription::setRtcpPort): Deleted.
357         (WebCore::PeerMediaDescription::mediaStreamId): Deleted.
358         (WebCore::PeerMediaDescription::setMediaStreamId): Deleted.
359         (WebCore::PeerMediaDescription::mediaStreamTrackId): Deleted.
360         (WebCore::PeerMediaDescription::setMediaStreamTrackId): Deleted.
361         (WebCore::PeerMediaDescription::dtlsSetup): Deleted.
362         (WebCore::PeerMediaDescription::setDtlsSetup): Deleted.
363         (WebCore::PeerMediaDescription::dtlsFingerprintHashFunction): Deleted.
364         (WebCore::PeerMediaDescription::setDtlsFingerprintHashFunction): Deleted.
365         (WebCore::PeerMediaDescription::dtlsFingerprint): Deleted.
366         (WebCore::PeerMediaDescription::setDtlsFingerprint): Deleted.
367         (WebCore::PeerMediaDescription::cname): Deleted.
368         (WebCore::PeerMediaDescription::setCname): Deleted.
369         (WebCore::PeerMediaDescription::ssrcs): Deleted.
370         (WebCore::PeerMediaDescription::iceUfrag): Deleted.
371         (WebCore::PeerMediaDescription::setIceUfrag): Deleted.
372         (WebCore::PeerMediaDescription::icePassword): Deleted.
373         (WebCore::PeerMediaDescription::setIcePassword): Deleted.
374         (WebCore::PeerMediaDescription::iceCandidates): Deleted.
375         (WebCore::PeerMediaDescription::clone): Deleted.
376         (WebCore::PeerMediaDescription::PeerMediaDescription): Deleted.
377         * platform/mediastream/mac/MediaEndpointMac.cpp:
378         (WebCore::MediaEndpointMac::addRemoteCandidate):
379         (WebCore::MediaEndpointMac::OnIceCandidate):
380         * platform/mediastream/mac/MediaEndpointMac.h:
381         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
382         (WebCore::MediaEndpointOwr::updateSendConfiguration):
383         * platform/mediastream/openwebrtc/MediaEndpointOwr.h:
384         * platform/mock/MockMediaEndpoint.cpp:
385         (WebCore::MockMediaEndpoint::updateConfigurationMids):
386
387 2016-10-28  Antoine Quint  <graouts@apple.com>
388
389         [Modern Media Controls] Media Controller: scrubbing support
390         https://bugs.webkit.org/show_bug.cgi?id=163726
391         <rdar://problem/27989481>
392
393         Reviewed by Dean Jackson.
394
395         We introduce the ScrubberSupport class which brings support for scrubbing the media
396         by interacting with the scrubber in the media controls and correctly reflecting
397         the media's current time as set via the media API.
398
399         Tests: media/modern-media-controls/scrubber-support/scrubber-support-click.html
400                media/modern-media-controls/scrubber-support/scrubber-support-drag.html
401                media/modern-media-controls/scrubber-support/scrubber-support-media-api.html
402
403         * Modules/modern-media-controls/js-files:
404         * Modules/modern-media-controls/media/media-controller.js:
405         (MediaController):
406         * Modules/modern-media-controls/media/scrubbing-support.js: Added.
407         (ScrubbingSupport.prototype.get control):
408         (ScrubbingSupport.prototype.get mediaEvents):
409         (ScrubbingSupport.prototype.controlValueWillStartChanging):
410         (ScrubbingSupport.prototype.controlValueDidChange):
411         (ScrubbingSupport.prototype.controlValueDidStopChanging):
412         (ScrubbingSupport.prototype.syncControl):
413         (ScrubbingSupport):
414         * WebCore.xcodeproj/project.pbxproj:
415
416 2016-10-28  Alex Christensen  <achristensen@webkit.org>
417
418         Fix Windows WebGL build after r208022
419         https://bugs.webkit.org/show_bug.cgi?id=164091
420
421         * platform/graphics/opengl/Extensions3DOpenGLCommon.h:
422         * platform/graphics/opengl/Extensions3DOpenGLES.cpp:
423         (WebCore::Extensions3DOpenGLES::Extensions3DOpenGLES):
424         * platform/graphics/opengl/Extensions3DOpenGLES.h:
425         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
426         (WebCore::GraphicsContext3D::getExtensions):
427
428 2016-10-27  Youenn Fablet  <youenn@apple.com>
429
430         [Fetch API] Fetch ReadableStream should only clone the second branch
431         https://bugs.webkit.org/show_bug.cgi?id=164058
432
433         Reviewed by Darin Adler.
434
435         Covered by rebased tests.
436
437         * Modules/streams/ReadableStreamInternals.js:
438         (readableStreamTeePullFunction):
439
440 2016-10-27  Alex Christensen  <achristensen@webkit.org>
441
442         Update ANGLE
443         https://bugs.webkit.org/show_bug.cgi?id=164101
444
445         Reviewed by Darin Adler.
446
447         ShCheckVariablesWithinPackingLimits has changed signatures from taking a ShVariableInfo* and length
448         to taking a std::vector<sh::ShaderVariable> which requires more information about the shader variables
449         than we kept in GraphicsContext3D::SymbolInfo.  I removed the SymbolInfo class because it was redundant
450         with ANGLE's sh::ShaderVariable and now unused.
451
452         Covered by existing WebGL tests.
453
454         * CMakeLists.txt:
455         * PlatformMac.cmake:
456         * PlatformWin.cmake:
457         * platform/graphics/ANGLEWebKitBridge.cpp:
458         (WebCore::appendSymbol):
459         (WebCore::getStructInfo):
460         (WebCore::getSymbolInfo):
461         (WebCore::ANGLEWebKitBridge::compileShaderSource):
462         * platform/graphics/ANGLEWebKitBridge.h:
463         (WebCore::ANGLEShaderSymbol::isSampler): Deleted.
464         * platform/graphics/GraphicsContext3D.h:
465         (WebCore::GraphicsContext3D::SymbolInfo::SymbolInfo): Deleted.
466         (WebCore::GraphicsContext3D::SymbolInfo::operator==): Deleted.
467         * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
468         (WebCore::Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE):
469         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
470         (WebCore::GraphicsContext3D::checkVaryingsPacking):
471         (WebCore::GraphicsContext3D::precisionsMatch):
472         (WebCore::GraphicsContext3D::mappedSymbolName):
473         (WebCore::GraphicsContext3D::originalSymbolName):
474
475 2016-10-27  Simon Fraser  <simon.fraser@apple.com>
476
477         Remove RenderStyle::isRunningAcceleratedAnimation()
478         https://bugs.webkit.org/show_bug.cgi?id=164109
479
480         Reviewed by David Hyatt.
481
482         RenderStyle::isRunningAcceleratedAnimation() was added in r40876 to handle interrupted
483         accelerated transitions, and to allow RenderLayer::currentTransform() to know when it
484         has to manually get the animated style.
485         
486         The latter can now use isRunningAcceleratedAnimationOnRenderer(), and interrupting
487         accelerated transitions seems to work fine without it, so remove it.
488
489         * page/animation/ImplicitAnimation.cpp:
490         (WebCore::ImplicitAnimation::animate):
491         * page/animation/KeyframeAnimation.cpp:
492         (WebCore::KeyframeAnimation::animate):
493         * rendering/RenderLayer.cpp:
494         (WebCore::RenderLayer::currentTransform):
495         * rendering/style/RenderStyle.h:
496         (WebCore::RenderStyle::isRunningAcceleratedAnimation): Deleted.
497         (WebCore::RenderStyle::setIsRunningAcceleratedAnimation): Deleted.
498         * rendering/style/StyleRareNonInheritedData.cpp:
499         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
500         (WebCore::StyleRareNonInheritedData::operator==):
501         * rendering/style/StyleRareNonInheritedData.h:
502
503 2016-10-27  Myles C. Maxfield  <mmaxfield@apple.com>
504
505         Teach WebGL code about new buffer targets in WebGL2
506         https://bugs.webkit.org/show_bug.cgi?id=163924
507
508         Reviewed by Dean Jackson.
509
510         WebGL 2 adds new buffer targets. Instead of completely reimplementing
511         the functions again for WebGL 2, we can simply check if we are using
512         a new kind of context to conditionally enable support.
513
514         Test: fast/canvas/webgl/webgl2-buffer-targets.html
515
516         * html/canvas/WebGL2RenderingContext.h:
517         * html/canvas/WebGL2RenderingContext.idl:
518         * html/canvas/WebGLBuffer.cpp:
519         (WebCore::WebGLBuffer::associateBufferDataImpl):
520         (WebCore::WebGLBuffer::associateBufferSubDataImpl):
521         (WebCore::WebGLBuffer::setTarget):
522         * html/canvas/WebGLBuffer.h:
523         * html/canvas/WebGLRenderingContextBase.cpp:
524         (WebCore::WebGLRenderingContextBase::bindBuffer):
525         (WebCore::WebGLRenderingContextBase::getBufferParameter):
526         (WebCore::WebGLRenderingContextBase::validateBufferDataParameters):
527         * html/canvas/WebGLRenderingContextBase.h:
528
529 2016-10-27  Dave Hyatt  <hyatt@apple.com>
530
531         [CSS Parser] Enhance grid-auto-flow parsing to allow dense first.
532         https://bugs.webkit.org/show_bug.cgi?id=164110
533
534         Reviewed by Simon Fraser.
535
536         * css/StyleBuilderConverter.h:
537         (WebCore::StyleBuilderConverter::convertGridAutoFlow):
538
539 2016-10-27  Simon Fraser  <simon.fraser@apple.com>
540
541         constify the CSSValue arguments to StyleBuilderConverter functions
542         https://bugs.webkit.org/show_bug.cgi?id=164106
543
544         Reviewed by Zalan Bujtas.
545
546         Make almost all the CSSValue& arguments const (this makes it clear that they
547         are in params, not out params). Only a few that are CSSImageValues are non-const,
548         because they fall into a non-const code path.
549
550         * css/StyleBuilderConverter.h:
551         (WebCore::StyleBuilderConverter::convertLengthOrAuto):
552         (WebCore::StyleBuilderConverter::convertLengthSizing):
553         (WebCore::StyleBuilderConverter::convertLengthMaxSizing):
554         (WebCore::StyleBuilderConverter::convertComputedLength):
555         (WebCore::StyleBuilderConverter::convertLineWidth):
556         (WebCore::StyleBuilderConverter::convertSpacing):
557         (WebCore::StyleBuilderConverter::convertToRadiusLength):
558         (WebCore::StyleBuilderConverter::convertRadius):
559         (WebCore::StyleBuilderConverter::convertObjectPosition):
560         (WebCore::StyleBuilderConverter::convertTextDecoration):
561         (WebCore::StyleBuilderConverter::convertNumber):
562         (WebCore::StyleBuilderConverter::convertNumberOrAuto):
563         (WebCore::StyleBuilderConverter::convertWebkitHyphenateLimitLines):
564         (WebCore::StyleBuilderConverter::convertTransform):
565         (WebCore::StyleBuilderConverter::convertString):
566         (WebCore::StyleBuilderConverter::convertStringOrAuto):
567         (WebCore::StyleBuilderConverter::convertStringOrNone):
568         (WebCore::StyleBuilderConverter::valueToEmphasisPosition):
569         (WebCore::StyleBuilderConverter::convertTextEmphasisPosition):
570         (WebCore::StyleBuilderConverter::convertTextAlign):
571         (WebCore::StyleBuilderConverter::convertClipPath):
572         (WebCore::StyleBuilderConverter::convertResize):
573         (WebCore::StyleBuilderConverter::convertMarqueeRepetition):
574         (WebCore::StyleBuilderConverter::convertMarqueeSpeed):
575         (WebCore::StyleBuilderConverter::convertQuotes):
576         (WebCore::StyleBuilderConverter::convertTextUnderlinePosition):
577         (WebCore::StyleBuilderConverter::convertReflection):
578         (WebCore::StyleBuilderConverter::convertInitialLetter):
579         (WebCore::StyleBuilderConverter::convertTextStrokeWidth):
580         (WebCore::StyleBuilderConverter::convertLineBoxContain):
581         (WebCore::StyleBuilderConverter::convertTextDecorationSkip):
582         (WebCore::StyleBuilderConverter::convertScrollSnapPoints):
583         (WebCore::StyleBuilderConverter::convertSnapCoordinatePair):
584         (WebCore::StyleBuilderConverter::convertScrollSnapCoordinates):
585         (WebCore::StyleBuilderConverter::createGridTrackBreadth):
586         (WebCore::StyleBuilderConverter::createGridTrackSize):
587         (WebCore::StyleBuilderConverter::createGridTrackList):
588         (WebCore::StyleBuilderConverter::createGridPosition):
589         (WebCore::StyleBuilderConverter::convertGridTrackSizeList):
590         (WebCore::StyleBuilderConverter::convertGridTrackSize):
591         (WebCore::StyleBuilderConverter::convertGridPosition):
592         (WebCore::StyleBuilderConverter::convertGridAutoFlow):
593         (WebCore::StyleBuilderConverter::convertWordSpacing):
594         (WebCore::StyleBuilderConverter::convertPerspective):
595         (WebCore::StyleBuilderConverter::convertMarqueeIncrement):
596         (WebCore::StyleBuilderConverter::convertFilterOperations):
597         (WebCore::StyleBuilderConverter::convertFontFeatureSettings):
598         (WebCore::StyleBuilderConverter::convertFontVariationSettings):
599         (WebCore::StyleBuilderConverter::convertTouchCallout):
600         (WebCore::StyleBuilderConverter::convertTapHighlightColor):
601         (WebCore::StyleBuilderConverter::convertOverflowScrolling):
602         (WebCore::StyleBuilderConverter::convertSVGLength):
603         (WebCore::StyleBuilderConverter::convertSVGLengthVector):
604         (WebCore::StyleBuilderConverter::convertStrokeDashArray):
605         (WebCore::StyleBuilderConverter::convertPaintOrder):
606         (WebCore::StyleBuilderConverter::convertOpacity):
607         (WebCore::StyleBuilderConverter::convertSVGURIReference):
608         (WebCore::StyleBuilderConverter::convertSVGColor):
609         (WebCore::StyleBuilderConverter::convertSelfOrDefaultAlignmentData):
610         (WebCore::StyleBuilderConverter::convertContentAlignmentData):
611         (WebCore::StyleBuilderConverter::convertGlyphOrientation):
612         (WebCore::StyleBuilderConverter::convertGlyphOrientationOrAuto):
613         (WebCore::StyleBuilderConverter::convertLineHeight):
614         (WebCore::StyleBuilderConverter::convertFontSynthesis):
615         (WebCore::StyleBuilderConverter::convertPageBreakBetween):
616         (WebCore::StyleBuilderConverter::convertPageBreakInside):
617         (WebCore::StyleBuilderConverter::convertColumnBreakBetween):
618         (WebCore::StyleBuilderConverter::convertColumnBreakInside):
619         (WebCore::StyleBuilderConverter::convertRegionBreakBetween):
620         (WebCore::StyleBuilderConverter::convertRegionBreakInside):
621         (WebCore::StyleBuilderConverter::convertHangingPunctuation):
622
623 2016-10-27  Dave Hyatt  <hyatt@apple.com>
624
625         [CSS Parser] Add support for a reference box to -webkit-clip-path
626         https://bugs.webkit.org/show_bug.cgi?id=164107
627
628         Reviewed by Simon Fraser.
629
630         * css/parser/CSSPropertyParser.cpp:
631         (WebCore::consumeBasicShape):
632         (WebCore::consumeBasicShapeOrBox):
633         (WebCore::consumeWebkitClipPath):
634
635 2016-10-27  Yusuke Suzuki  <utatane.tea@gmail.com>
636
637         [DOM] Add JSEventType
638         https://bugs.webkit.org/show_bug.cgi?id=164096
639
640         Reviewed by Darin Adler.
641
642         Event is inherited by many Event classes. But, Event's accessors and interfaces are
643         frequently called. For example, event.{type, target, srcElement} for accessors. And
644         event.stopPropagation() and event.preventDefault() functions.
645
646         However, since the user-visible event instance is typically the instance of the subclass,
647         jsDynamicCast<JSEvent*>() walks several classes before it succeeds. It is costly.
648
649         In this patch, we add a new WebCore JSType JSEventType for JSEvent and add a new
650         function jsEventCast. That supports a super fast cast operation. And it paves the way
651         for implementing DOM accessors of Event in DOMJIT.
652
653         No behavior change.
654
655         * WebCore.xcodeproj/project.pbxproj:
656         * bindings/js/JSDOMWrapper.h:
657         * bindings/js/JSEventCustom.h: Added.
658         (WebCore::jsEventCast):
659         * bindings/scripts/CodeGeneratorJS.pm:
660         (GetJSTypeForNode):
661         (GenerateHeader):
662         (GetCastingHelperForThisObject):
663         * bindings/scripts/test/JS/JSTestEventConstructor.h:
664         (WebCore::JSTestEventConstructor::createStructure):
665         * dom/Event.idl:
666         * domjit/DOMJITHelpers.h:
667         (WebCore::DOMJIT::branchIfEvent):
668         (WebCore::DOMJIT::branchIfNotEvent):
669
670 2016-10-27  Simon Fraser  <simon.fraser@apple.com>
671
672         Rename StyleRareNonInheritedData::opacity to m_opacity
673         https://bugs.webkit.org/show_bug.cgi?id=164104
674
675         Reviewed by Dave Hyatt.
676
677         Pure rename.
678
679         * rendering/style/RenderStyle.cpp:
680         (WebCore::RenderStyle::changeRequiresLayerRepaint):
681         * rendering/style/RenderStyle.h:
682         (WebCore::RenderStyle::opacity):
683         (WebCore::RenderStyle::setOpacity):
684         * rendering/style/StyleRareNonInheritedData.cpp:
685         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
686         (WebCore::StyleRareNonInheritedData::operator==):
687         * rendering/style/StyleRareNonInheritedData.h:
688         (WebCore::StyleRareNonInheritedData::hasOpacity):
689
690 2016-10-27  Simon Fraser  <simon.fraser@apple.com>
691
692         If an animation's keyframes affect stacking context properties, create stacking context while the animation is running
693         https://bugs.webkit.org/show_bug.cgi?id=164094
694
695         Reviewed by Dean Jackson.
696
697         The CSS animations spec <https://drafts.csswg.org/css-animations-1/> now makes it
698         clear that a keyframe animation animating properties which can affect stacking context
699         should establish stacking context while it's running, or filling-forwards. This is part
700         of the "the user agent must act as if the will-change property...includes all the properties
701         animated by the animation" clause.
702
703         Implement by having CompositeAnimation::animate() track whether running animations should
704         create stacking context, replacing existing code in AnimationController::updateAnimations()
705         which only looked at opacity and transform. Transitions are also checked to see if they need
706         to trigger stacking context.
707
708         This allows for the removal of a 0.9999 hack when blending opacity.
709
710         Tests: animations/stacking-context-fill-forwards.html
711                animations/stacking-context-not-fill-forwards.html
712                animations/stacking-context-unchanged-while-running.html
713
714         * page/animation/AnimationController.cpp:
715         (WebCore::AnimationController::updateAnimations):
716         * page/animation/CSSPropertyAnimation.cpp:
717         * page/animation/CompositeAnimation.cpp:
718         (WebCore::CompositeAnimation::animate):
719         * page/animation/KeyframeAnimation.cpp:
720         (WebCore::KeyframeAnimation::KeyframeAnimation):
721         (WebCore::KeyframeAnimation::computeStackingContextImpact):
722         (WebCore::KeyframeAnimation::animate):
723         * page/animation/KeyframeAnimation.h:
724         * rendering/RenderLayer.cpp:
725         (WebCore::RenderLayer::currentTransform):
726         * rendering/style/WillChangeData.cpp:
727         (WebCore::WillChangeData::propertyCreatesStackingContext):
728         (WebCore::propertyCreatesStackingContext): Deleted.
729         * rendering/style/WillChangeData.h:
730
731 2016-10-27  Sam Weinig  <sam@webkit.org>
732
733         [WebIDL] Move code generators off of domSignature::type and onto domSignature::idlType
734         https://bugs.webkit.org/show_bug.cgi?id=164089
735
736         Reviewed by Alex Christensen.
737
738         Make more IDLParser structures contain domTypes for type descriptions, rather than strings:
739         - domInterface gains type and parentType.
740         - domConstant gains type.
741         - domEnum gains type.
742         - domDictionary gains type and parentType.
743
744         With these structs now containing domTypes, we can update the CodeGenerators to operate on
745         domTypes exclusively, rather than types as strings. This allows us to consistently have access
746         to information such as subtypes and nullability.
747
748         * bindings/scripts/CodeGenerator.pm:
749         Update helpers to operate of domTypes. The one exception is SkipIncludeHeader, which
750         still operates on a type name, since it is called late in code generation on the textual
751         form of type names in the include list. 
752
753         * bindings/scripts/CodeGeneratorJS.pm:
754         Update to use domTypes.
755
756         * bindings/scripts/IDLParser.pm:
757         - Add domType accessors to domInterface, domConstant, domEnum, and domDictionary
758           and populate them.
759         - Remove type accessors from domSignature (domType is accessible from idlType).
760         - Remove special cases for sequence and FrozenArray, now that they are always
761           accessed as domTypes.
762
763         * html/HTMLEmbedElement.idl:
764         * html/HTMLFrameElement.idl:
765         * html/HTMLFrameOwnerElement.cpp:
766         (WebCore::HTMLFrameOwnerElement::getSVGDocument):
767         * html/HTMLFrameOwnerElement.h:
768         * html/HTMLIFrameElement.idl:
769         * html/HTMLObjectElement.idl:
770         Fix interfaces declaring getSVGDocument() to correctly have it return
771         a Document, rather than an SVGDocument, which does exist anymore. To
772         make the bindings happy, also change the signature of HTMLFrameOwnerElement::getSVGDocument
773         to return a Document.
774
775         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
776         * bindings/scripts/test/JS/JSTestInterface.cpp:
777         * bindings/scripts/test/JS/JSTestObj.cpp:
778         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
779         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
780         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
781         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
782         Update test results to remove some redundant headers (Already included JSFoo.h, so no need for Foo.h).
783
784 2016-10-27  Myles C. Maxfield  <mmaxfield@apple.com>
785
786         [macOS] [WebGL2] Temporarily upgrade WebGL 2's internal OpenGL context from version 2.1 to 3.2
787         https://bugs.webkit.org/show_bug.cgi?id=164091
788
789         Reviewed by Dean Jackson.
790
791         In order to test WebGL2 correctly, I had to upgrade the macOS's OpenGL 
792         context to a 3.2-compatible context to make sure the new symbols are
793         accepted. Eventually, this 3.2-compatible context will have to be
794         reverted and replaced with an ANGLE context. The current 3.2-compatible
795         context is just for testing.
796
797         Test: fast/canvas/webgl/webgl2-context-creation.html
798
799         * html/canvas/WebGLBuffer.cpp: Use "nullptr" instead of 0.
800         (WebCore::WebGLBuffer::associateBufferData):
801         * html/canvas/WebGLRenderingContextBase.cpp: Use make_unique() instead
802         of the unique_ptr constructor.
803         (WebCore::WebGLRenderingContextBase::create):
804         * platform/graphics/GraphicsContext3D.h: GraphicsContext should know
805         if it is using a 3.2-compatible context because some parts of 2.1 are
806         removed in these contexts, and replaced with new things which aren't
807         in 2.1.
808         * platform/graphics/mac/GraphicsContext3DMac.mm:
809         (WebCore::setPixelFormat): Use kCGLPFAOpenGLProfile to specify an
810         OpenGL 3.2 context.
811         (WebCore::GraphicsContext3D::GraphicsContext3D): GL_CLAMP is deprecated
812         in OpenGL 3.2. Fortunately, GL_CLAMP_TO_EDGE isn't deprecated and does
813         exactly what we want. In OpenGL3.2, point sprites are always enabled,
814         so there's no need to enable them in those contexts.
815         (WebCore::GraphicsContext3D::isGLES2Compliant):
816         * platform/graphics/opengl/Extensions3DOpenGL.cpp: In OpenGL 3.2,
817         glGetString() no longer accepts GL_EXTENSIONS. Instead, glGetStringi()
818         is used instead. Unfortunately, glGetString() is not available in
819         OpenGL 2.1 contexts, so we need to use one or the other based on the
820         version of the context we're using.
821         (WebCore::Extensions3DOpenGL::Extensions3DOpenGL):
822         (WebCore::Extensions3DOpenGL::getExtensions):
823         * platform/graphics/opengl/Extensions3DOpenGL.h:
824         * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
825         (WebCore::Extensions3DOpenGLCommon::Extensions3DOpenGLCommon):
826         (WebCore::Extensions3DOpenGLCommon::initializeAvailableExtensions):
827         Instead of modifying getExtensions() to use glGetStringi(), it makes
828         better sense to modify this function because getExtensions() returns
829         a string. Building up a string just to split it up again is silly, so
830         modifying this function instead makes more sense.
831         * platform/graphics/opengl/Extensions3DOpenGLCommon.h:
832         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
833         (WebCore::GraphicsContext3D::getIntegerv): GL_MAX_VARYING_FLOATS is
834         removed in OpenGL 3.2 contexts. However, it is replaced by
835         GL_MAX_VARYING_COMPONENTS, though this is deprecated but not removed.
836         In the more recent OpenGL context versions, GL_MAX_VARYING_VECTORS is
837         recommended instead, but that isn't available in OpenGL 3.2.
838         (WebCore::GraphicsContext3D::getExtensions):
839
840 2016-10-27  Megan Gardner  <megan_gardner@apple.com>
841
842         Add support for wide gamut for ShareableBitmap for image popovers
843         https://bugs.webkit.org/show_bug.cgi?id=164001
844
845         Reviewed by Simon Fraser.
846
847         Add a function to return a CGColorSpaceRef for extended sRGB.
848
849         This is currently untestable, so no tests added.
850
851         * platform/graphics/cg/GraphicsContextCG.cpp:
852         (WebCore::extendedSRGBColorSpaceRef):
853
854 2016-10-25  Brent Fulgham  <bfulgham@apple.com>
855
856         [Win][Direct2D] Create a RAII Helper Class for the Render Target
857         https://bugs.webkit.org/show_bug.cgi?id=164005
858
859         Reviewed by Alex Christensen.
860
861         Tested by existing SVG, image, and Canvas layout tests.
862
863         * platform/graphics/GraphicsContext.h:
864         * platform/graphics/win/GradientDirect2D.cpp:
865         (WebCore::Gradient::fill): Use new convenience helper class.
866         * platform/graphics/win/GraphicsContextDirect2D.cpp:
867         (WebCore::GraphicsContext::didBeginDraw):
868         (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
869         (WebCore::GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate): Add an
870         assertion that we are in a valid state when cleaning up the graphics context.
871         (WebCore::GraphicsContextPlatformPrivate::clip): Clipping can only happen in a Draw operation.
872         Open a new BeginDraw if asked to Clip. The Begin must stay active when this method returns,
873         as the Clip layer is only valid during a Draw operation.
874         (WebCore::GraphicsContextPlatformPrivate::beginDraw): Added.
875         (WebCore::GraphicsContextPlatformPrivate::endDraw): Added.
876         (WebCore::GraphicsContext::beginDrawIfNeeded): Added.
877         (WebCore::GraphicsContext::endDraw): Added.
878         (WebCore::GraphicsContext::drawWithoutShadow): Revise to use new RenderTargetHelper class.
879         (WebCore::GraphicsContext::drawWithShadow): Ditto.
880         (WebCore::GraphicsContext::platformFillRoundedRect): Ditto.
881         (WebCore::GraphicsContext::fillRectWithRoundedHole): Ditto.
882         (WebCore::GraphicsContext::setDidBeginDraw): Deleted.
883         * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h:
884         (WebCore::GraphicsContextPlatformPrivate::didBeginDraw): Revise to use count instead of
885         a separate boolean.
886         * platform/graphics/win/ImageBufferDataDirect2D.cpp:
887         (WebCore::ImageBufferData::getData): Revise to use new RenderTargetHelper class.
888         * platform/graphics/win/NativeImageDirect2D.cpp:
889         (WebCore::drawNativeImage): Ditto.
890         * platform/graphics/win/RenderTargetHelper.h: Added.
891         (WebCore::RenderTargetHelper::RenderTargetHelper):
892         (WebCore::RenderTargetHelper::~RenderTargetHelper):
893         (WebCore::RenderTargetHelper::endDraw):
894         * svg/graphics/SVGImage.cpp:
895         (WebCore::SVGImage::nativeImage): Revise to use new RenderTargetHelper class.
896
897 2016-10-27  Wenson Hsieh  <wenson_hsieh@apple.com>
898
899         Support "insertFromDrop" and "deleteByDrag" for the InputEvent spec
900         https://bugs.webkit.org/show_bug.cgi?id=163948
901         <rdar://problem/28921433>
902
903         Reviewed by Darin Adler.
904
905         Implements support for "insertFromDrop" and "deleteByDrag" inputTypes. These are fired when dragging and
906         dropping text in editable areas. To do this, we introduce EditActionInsertFromDrop and EditActionDeleteByDrag
907         (renamed from EditActionDrag, which is no longer necessary after this patch).
908
909         When moving text from an editable element to another, we will use a DeleteSelectionCommand to delete the text
910         from the source element and a ReplaceSelectionCommand to insert the text into the destination element. This
911         means that we currently fire two input events on the source and destination elements (i.e. given by the start
912         and end selections) after both child editing commands of the MoveSelectionCommand have been applied. Instead, we
913         need to fire events in this order:
914
915         1. beforeinput ("deleteByDrag") on the source
916         2. Update DOM
917         3. input ("deleteByDrag") on the source
918
919         4. beforeinput ("insertFromDrop") on the destination
920         5. Update DOM
921         6. input ("insertFromDrop") on the destination
922
923         To accomplish this, we allow an edit command to defer dispatching input events to its child commands via
924         CompositeEditCommand::shouldDispatchInputEvents, which the MoveSelectionCommand overrides. Additionally,
925         when applying the MoveSelectionCommand, we now apply() the child DeleteSelectionCommand and
926         ReplaceSelectionCommand instead of using doApply(). This allows these children to separately dispatch input
927         events, and also handle preventDefault() separately.
928
929         Tests: fast/events/before-input-events-prevent-drag-and-drop.html
930                fast/events/input-events-drag-and-drop.html
931                fast/events/input-events-insert-by-drop.html
932
933         * editing/CompositeEditCommand.cpp:
934         (WebCore::CompositeEditCommand::apply):
935         (WebCore::CompositeEditCommand::composition):
936
937         Searches for the top-level command and returns its composition. Also ASSERTs that the m_command of all child
938         commands along the way is null. In places where we used to ASSERT that command.composition() should be null, we
939         now perform the assertion here instead.
940
941         * editing/CompositeEditCommand.h:
942         (WebCore::CompositeEditCommand::shouldDispatchInputEvents):
943
944         This is true by default, which means that if apply() is called for a composite edit command that does not
945         override this to return false, it will try to dispatch input events. In most cases, the parent command will call
946         on the child command to doApply(), bypassing this check.
947
948         (WebCore::CompositeEditCommand::composition): Deleted.
949         * editing/EditAction.h:
950         * editing/EditCommand.cpp:
951         (WebCore::inputTypeNameForEditingAction):
952         (WebCore::EditCommand::isEditingTextAreaOrTextInput):
953         (WebCore::EditCommand::setStartingSelection):
954         (WebCore::EditCommand::setEndingSelection):
955         (WebCore::EditCommand::setParent):
956         * editing/Editor.cpp:
957         (WebCore::Editor::willApplyEditing):
958         (WebCore::Editor::appliedEditing):
959
960         After applying editing, only adjust the current selection and notify clients of selection change if the applied
961         command was a top-level command; otherwise, these actions should wait until all child commands of the top-level
962         command have been applied. In particular, we should not register the applied command as an undo step.
963
964         * editing/MoveSelectionCommand.cpp:
965         (WebCore::MoveSelectionCommand::doApply):
966         (WebCore::MoveSelectionCommand::editingAction):
967         * editing/MoveSelectionCommand.h:
968         * page/DragController.cpp:
969         (WebCore::DragController::concludeEditDrag):
970
971         For the cases where we're not deleting text from the drag source (i.e. we're just applying a
972         ReplaceSelectionCommand) pass in EditActionInsertFromDrop as the EditAction when creating the command.
973
974 2016-10-27  Per Arne Vollan  <pvollan@apple.com>
975
976         [Win][Direct2D] Implement GraphicsContext::releaseWindowsContext.
977         https://bugs.webkit.org/show_bug.cgi?id=163988
978
979         Reviewed by Brent Fulgham.
980
981         This method is needed to draw native controls.
982
983         * platform/graphics/win/GraphicsContextDirect2D.cpp:
984         (WebCore::GraphicsContext::releaseWindowsContext):
985
986 2016-10-27  Joseph Pecoraro  <pecoraro@apple.com>
987
988         Web Inspector: Worker should recover if Inspector is closed and never sent Worker.initialized command
989         https://bugs.webkit.org/show_bug.cgi?id=164073
990
991         Reviewed by Brian Burg.
992
993         Test: inspector/worker/worker-recover-if-inspector-close.html
994
995         * workers/WorkerInspectorProxy.cpp:
996         (WebCore::WorkerInspectorProxy::disconnectFromWorkerInspectorController):
997         Ensure we stop the debugger only task loop if needed when the last debugger
998         message comes in.
999
1000 2016-10-27  Joseph Pecoraro  <pecoraro@apple.com>
1001
1002         Web Inspector: Include ConsoleAgent in Workers - real console.log support
1003         https://bugs.webkit.org/show_bug.cgi?id=163844
1004         <rdar://problem/28903328>
1005
1006         Reviewed by Brian Burg.
1007
1008         Test: inspector/worker/console-basic.html
1009
1010         This introduces a real ConsoleAgent in the Worker InspectorController.
1011         We no longer need to pass partial ConsoleMessage objects to be logged
1012         through the Page, we can just send the full ConsoleMessages to a
1013         frontend once it connects to the Worker.
1014
1015         In order to guarantee that the Worker InspectorController is properly
1016         all Workers will start paused if there is an Inspector attached to
1017         the Page. The frontend _must_ call the new Worker.initialized method
1018         after sending its setup commands to the Worker. This ensures we get
1019         handle all initialization commands (like Agent.enable(), and
1020         setting state like breakpoints) before any script executes in the
1021         Worker. This mirrors the Inspector.initialized method that does the
1022         same thing for JSContext auto-attach of the Main target.
1023
1024         In the backend, the wait until initialized state is just running
1025         the WorkerThread's RunLoop in a special debugger mode to only process
1026         debugger commands until we are ready. This will effectively be
1027         the same as pausing so it is generalized into WorkerThread.
1028
1029         * CMakeLists.txt:
1030         * WebCore.xcodeproj/project.pbxproj:
1031         * inspector/InspectorAllInOne.cpp:
1032         New files.
1033
1034         * inspector/InspectorWorkerAgent.cpp:
1035         (WebCore::InspectorWorkerAgent::initialized):
1036         (WebCore::InspectorWorkerAgent::shouldWaitForDebuggerOnStart):
1037         * inspector/InspectorWorkerAgent.h:
1038         Add the new initialized method. This just uses the proxy to send
1039         a message to be handled on the Worker Thread and unpause.
1040
1041         * inspector/WorkerConsoleAgent.cpp:
1042         (WebCore::WorkerConsoleAgent::WorkerConsoleAgent):
1043         (WebCore::WorkerConsoleAgent::addInspectedNode):
1044         * inspector/WorkerConsoleAgent.h:
1045         * inspector/WorkerInspectorController.cpp:
1046         (WebCore::WorkerInspectorController::WorkerInspectorController):
1047         Add a ConsoleAgent to WorkerInspectorController.
1048
1049         * workers/WorkerInspectorProxy.h:
1050         * workers/WorkerInspectorProxy.cpp:
1051         (WebCore::WorkerInspectorProxy::workerStartMode):
1052         (WebCore::WorkerInspectorProxy::resumeWorkerIfPaused):
1053         (WebCore::WorkerInspectorProxy::connectToWorkerInspector):
1054         (WebCore::WorkerInspectorProxy::disconnectFromWorkerInspector):
1055         (WebCore::WorkerInspectorProxy::sendMessageToWorkerInspector):
1056         Use the debugger mode when sending messages to the WorkerThread.
1057
1058         * workers/Worker.cpp:
1059         (WebCore::Worker::notifyFinished):
1060         * workers/WorkerMessagingProxy.cpp:
1061         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
1062         (WebCore::WorkerMessagingProxy::postConsoleMessageToWorkerObject): Deleted.
1063         * workers/WorkerMessagingProxy.h:
1064         * workers/WorkerReportingProxy.h:
1065         * workers/WorkerGlobalScope.cpp:
1066         (WebCore::WorkerGlobalScope::addConsoleMessage):
1067         (WebCore::WorkerGlobalScope::addMessage):
1068         * workers/WorkerGlobalScope.h:
1069         * workers/WorkerGlobalScopeProxy.h:
1070         Remove legacy partial console support.
1071
1072         * workers/WorkerRunLoop.h:
1073         * workers/WorkerRunLoop.cpp:
1074         (WebCore::WorkerRunLoop::debuggerMode):
1075         * workers/WorkerThread.h:
1076         * workers/WorkerThread.cpp:
1077         (WebCore::WorkerThread::workerThread):
1078         (WebCore::WorkerThread::startRunningDebuggerTasks):
1079         (WebCore::WorkerThread::stopRunningDebuggerTasks):
1080         General code for spinning the WorkerThread and only processing debugger
1081         (Inspector) commands. Use this when starting the thread to ensure the
1082         frontend initializes the Worker's Agents before any JavaScript executes.
1083
1084         * page/PageConsoleClient.cpp:
1085         * workers/WorkerConsoleClient.cpp:
1086         (WebCore::WorkerConsoleClient::count):
1087         (WebCore::WorkerConsoleClient::time):
1088         (WebCore::WorkerConsoleClient::timeEnd):
1089         * inspector/InspectorConsoleInstrumentation.h: Removed.
1090         * inspector/InspectorInstrumentation.cpp:
1091         (WebCore::InspectorInstrumentation::startConsoleTimingImpl):
1092         (WebCore::InspectorInstrumentation::stopConsoleTimingImpl):
1093         (WebCore::InspectorInstrumentation::shouldWaitForDebuggerOnStartImpl):
1094         * inspector/InspectorInstrumentation.h:
1095         (WebCore::InspectorInstrumentation::shouldWaitForDebuggerOnStart):
1096         (WebCore::InspectorInstrumentation::addMessageToConsole):
1097         (WebCore::InspectorInstrumentation::consoleCount):
1098         (WebCore::InspectorInstrumentation::takeHeapSnapshot):
1099         (WebCore::InspectorInstrumentation::startConsoleTiming):
1100         (WebCore::InspectorInstrumentation::stopConsoleTiming):
1101         (WebCore::InspectorInstrumentation::consoleTimeStamp):
1102         (WebCore::InspectorInstrumentation::startProfiling):
1103         (WebCore::InspectorInstrumentation::stopProfiling):
1104         Implement a few more basic console APIs that required ConsoleAgent.
1105
1106 2016-10-27  Joseph Pecoraro  <pecoraro@apple.com>
1107
1108         Web Inspector: Include RuntimeAgent in Workers - evaluate in Worker context
1109         https://bugs.webkit.org/show_bug.cgi?id=163835
1110         <rdar://problem/28901465>
1111
1112         Reviewed by Brian Burg.
1113
1114         Tests: inspector/unit-tests/target-manager.html
1115                inspector/worker/runtime-basic.html
1116
1117         * CMakeLists.txt:
1118         * WebCore.xcodeproj/project.pbxproj:
1119         * inspector/InspectorAllInOne.cpp:
1120         New file.
1121
1122         * inspector/InspectorWebAgentBase.h:
1123         (WebCore::WorkerAgentContext::WorkerAgentContext):
1124         New agent context creation struct for Workers.
1125
1126         * inspector/WorkerInspectorController.cpp:
1127         (WebCore::WorkerInspectorController::WorkerInspectorController):
1128         Create a RuntimeAgent for Workers.
1129
1130         * inspector/WorkerRuntimeAgent.cpp: Added.
1131         (WebCore::WorkerRuntimeAgent::WorkerRuntimeAgent):
1132         (WebCore::WorkerRuntimeAgent::didCreateFrontendAndBackend):
1133         (WebCore::WorkerRuntimeAgent::willDestroyFrontendAndBackend):
1134         (WebCore::WorkerRuntimeAgent::injectedScriptForEval):
1135         * inspector/WorkerRuntimeAgent.h: Added.
1136         Workers currently only ever have a single execution context.
1137
1138 2016-10-27  Joseph Pecoraro  <pecoraro@apple.com>
1139
1140         Web Inspector: Introduce Page WorkerAgent and Worker InspectorController
1141         https://bugs.webkit.org/show_bug.cgi?id=163817
1142         <rdar://problem/28899063>
1143
1144         Reviewed by Brian Burg.
1145
1146         Test: inspector/worker/worker-create-and-terminate.html
1147
1148         From the perspective of an Inspector frontend, Workers are
1149         like a special JavaScript context, separate from the page, that
1150         may have its own set of Agents. This patch adds the necessary
1151         backend infrastructure to provide WorkerGlobalObject with an
1152         InspectorController and the means to communicate with a frontend
1153         through a Page's WorkerAgent.
1154
1155         Pages now get a WorkerAgent. This informs the frontend about
1156         created and terminated Workers. It also provides a communication
1157         channel to dispatch and return inspector protocol messages to
1158         each of the Workers. The Page side always interacts with the
1159         WorkerInspectorProxy on the main thread. The Page's Worker Agent
1160         can sends and receives messages to WorkerInspectorControllers.
1161
1162         WorkerGlobalScopes now get a WorkerInspectorController which
1163         will eventually contain its own set of agents. There are no
1164         agents yet, but they will be added individually in follow-up
1165         patches. The Worker side always interacts with the
1166         WorkerGlobalScope on the worker thread. WorkerInspectorController
1167         dispatches messages on its agents.
1168
1169         All communication with Worker agents goes through Worker.sendMessageToWorker,
1170         which tunnels the command request to the Worker's InspectorController
1171         and agents. At the protocol level, worker agent command responses and
1172         worker agent events are sent as events through Worker.dispatchMessageFromWorker.
1173         On the frontend, the message dispatcher code will pair up replies with
1174         their commands, and no-reply messages as events, like normal. So calling
1175         worker agent methods in the frontend will be no different from the
1176         existing callback/promise-based ways.
1177
1178         * CMakeLists.txt:
1179         * WebCore.xcodeproj/project.pbxproj:
1180         * inspector/InspectorAllInOne.cpp:
1181         Add new files.
1182
1183         * bindings/js/WorkerScriptController.cpp:
1184         (WebCore::WorkerScriptController::WorkerScriptController):
1185         (WebCore::WorkerScriptController::initScript):
1186         * bindings/js/WorkerScriptController.h:
1187         Some cleanup.
1188
1189         * inspector/InspectorController.cpp:
1190         (WebCore::InspectorController::InspectorController):
1191         * inspector/InspectorController.h:
1192         * inspector/InstrumentingAgents.cpp:
1193         (WebCore::InstrumentingAgents::reset):
1194         * inspector/InstrumentingAgents.h:
1195         (WebCore::InstrumentingAgents::inspectorWorkerAgent):
1196         (WebCore::InstrumentingAgents::setInspectorWorkerAgent):
1197         * inspector/InspectorInstrumentation.cpp:
1198         (WebCore::InspectorInstrumentation::workerStartedImpl):
1199         (WebCore::InspectorInstrumentation::workerTerminatedImpl):
1200         (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope):
1201         * inspector/InspectorInstrumentation.h:
1202         (WebCore::InspectorInstrumentation::workerStarted):
1203         (WebCore::InspectorInstrumentation::workerTerminated):
1204         (WebCore::InspectorInstrumentation::instrumentingAgentsForContext):
1205         Give the Page a WorkerAgent and Instrumentation methods for
1206         Worker creation and termination.
1207
1208         * inspector/InspectorWorkerAgent.h: Added.
1209         * inspector/InspectorWorkerAgent.cpp: Added.
1210         (WebCore::InspectorWorkerAgent::InspectorWorkerAgent):
1211         (WebCore::InspectorWorkerAgent::didCreateFrontendAndBackend):
1212         (WebCore::InspectorWorkerAgent::willDestroyFrontendAndBackend):
1213         (WebCore::InspectorWorkerAgent::enable):
1214         (WebCore::InspectorWorkerAgent::disable):
1215         (WebCore::InspectorWorkerAgent::workerStarted):
1216         (WebCore::InspectorWorkerAgent::workerTerminated):
1217         (WebCore::InspectorWorkerAgent::connectToAllWorkerInspectorProxiesForPage):
1218         (WebCore::InspectorWorkerAgent::disconnectFromAllWorkerInspectorProxies):
1219         (WebCore::InspectorWorkerAgent::connectToWorkerInspectorProxy):
1220         (WebCore::InspectorWorkerAgent::disconnectFromWorkerInspectorProxy):
1221         Handle connecting to Workers. This performs the "connectFrontend"
1222         and "disconnectFrontend" dance with each Worker's InspectorController.
1223         We only connect to workers when the Worker domain is enabled.
1224
1225         (WebCore::InspectorWorkerAgent::sendMessageToWorker):
1226         (WebCore::InspectorWorkerAgent::sendMessageFromWorkerToFrontend):
1227         Proxying messages to individual messages happens through the
1228         WorkerInspectorProxy. That takes care of passing messages
1229         across threads for us.
1230
1231         * workers/WorkerInspectorProxy.cpp: Added.
1232         (WebCore::WorkerInspectorProxy::allWorkerInspectorProxies):
1233         (WebCore::WorkerInspectorProxy::WorkerInspectorProxy):
1234         (WebCore::WorkerInspectorProxy::~WorkerInspectorProxy):
1235         (WebCore::WorkerInspectorProxy::workerStarted):
1236         (WebCore::WorkerInspectorProxy::workerTerminated):
1237         (WebCore::WorkerInspectorProxy::connectToWorkerInspector):
1238         (WebCore::WorkerInspectorProxy::disconnectFromWorkerInspector):
1239         (WebCore::WorkerInspectorProxy::sendMessageToWorkerInspector):
1240         (WebCore::WorkerInspectorProxy::sendMessageFromWorkerToFrontend):
1241         * workers/WorkerInspectorProxy.h: Added.
1242         (WebCore::WorkerInspectorProxy::PageChannel::~PageChannel):
1243         (WebCore::WorkerInspectorProxy::url):
1244         (WebCore::WorkerInspectorProxy::identifier):
1245         (WebCore::WorkerInspectorProxy::scriptExecutionContext):
1246         The WorkerInspectorProxy simplifies the cross thread communication
1247         between the Page Inspector and Worker Inspector. It also provides
1248         a clean interface between the two sides.
1249
1250         * inspector/WorkerToPageFrontendChannel.h: Added.
1251         * inspector/WorkerInspectorController.h: Added.
1252         * inspector/WorkerInspectorController.cpp: Added.
1253         (WebCore::WorkerInspectorController::WorkerInspectorController):
1254         (WebCore::WorkerInspectorController::~WorkerInspectorController):
1255         (WebCore::WorkerInspectorController::workerTerminating):
1256         (WebCore::WorkerInspectorController::connectFrontend):
1257         (WebCore::WorkerInspectorController::disconnectFrontend):
1258         (WebCore::WorkerInspectorController::dispatchMessageFromFrontend):
1259         (WebCore::WorkerInspectorController::functionCallHandler):
1260         (WebCore::WorkerInspectorController::evaluateHandler):
1261         (WebCore::WorkerInspectorController::vm):
1262         A basic InspectorController for a WorkerGlobalScope.
1263         No agents yet, they will come soon.
1264
1265         * inspector/WorkerScriptDebugServer.h:
1266         * inspector/WorkerScriptDebugServer.cpp:
1267         (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer):
1268         (WebCore::WorkerScriptDebugServer::attachDebugger):
1269         (WebCore::WorkerScriptDebugServer::detachDebugger):
1270         (WebCore::WorkerScriptDebugServer::recompileAllJSFunctions):
1271         (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused):
1272         (WebCore::WorkerScriptDebugServer::reportException):
1273         (WebCore::WorkerScriptDebugServer::interruptAndRunTask):
1274         A basic WorkerScriptDebug server for a WorkerGlobalScope.
1275         Not really used until we implement DebuggerAgent, but needed for InspectorEnvironment.
1276
1277         * workers/WorkerGlobalScope.cpp:
1278         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
1279         * workers/WorkerGlobalScope.h:
1280         (WebCore::WorkerGlobalScope::inspectorController):
1281         Give the WorkerGlobalScope an InspectorController.
1282
1283         * workers/WorkerThread.cpp:
1284         (WebCore::WorkerThread::stop):
1285         Ensure the Worker InspectorController is immediately on
1286         the WorkerThread when it is about to be closed.
1287
1288         * workers/WorkerMessagingProxy.cpp:
1289         (WebCore::WorkerMessagingProxy::WorkerMessagingProxy):
1290         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
1291         (WebCore::WorkerMessagingProxy::postMessageToPageInspector):
1292         (WebCore::WorkerMessagingProxy::workerGlobalScopeDestroyedInternal):
1293         (WebCore::WorkerMessagingProxy::terminateWorkerGlobalScope):
1294         * workers/WorkerMessagingProxy.h:
1295         * workers/WorkerReportingProxy.h:
1296         Call into the WorkerInspectorProxy for any inspector related logic,
1297         such as creation, termination, and messages received from the Worker.
1298
1299 2016-10-27  Dave Hyatt  <hyatt@apple.com>
1300
1301         [CSS Parser] Implement CSS variables
1302         https://bugs.webkit.org/show_bug.cgi?id=164075
1303
1304         Reviewed by Dean Jackson.
1305
1306         * CMakeLists.txt:
1307         * WebCore.xcodeproj/project.pbxproj:
1308         Add CSSCustomPropertyValue.cpp to the project.
1309
1310         * css/CSSCustomPropertyValue.cpp: Added.
1311         (WebCore::CSSCustomPropertyValue::checkVariablesForCycles):
1312         (WebCore::CSSCustomPropertyValue::resolveVariableReferences):
1313         * css/CSSCustomPropertyValue.h:
1314         These functions abstract the old and new implementations of CSS
1315         variables so that the callers don't have to worry about it.
1316
1317         * css/CSSValue.cpp:
1318         (WebCore::CSSValue::equals):
1319         Make sure CSSVariableReferenceValue and CSSPendingSubstitutionValue
1320         have equals implemented.
1321
1322         (WebCore::CSSValue::isInvalidCustomPropertyValue): Deleted.
1323         This code was dead and never called.
1324
1325         * css/CSSValue.h:
1326         (WebCore::CSSValue::isCustomPropertyValue):
1327         (WebCore::CSSValue::hasVariableReferences):
1328         Add a helper function for asking if a CSSValue has variable references.
1329         This abstracts the old and new implementations so that callers can
1330         ask if the value has variables without caring which implementation is
1331         being used.
1332
1333         * css/CSSValueList.cpp:
1334         (WebCore::CSSValueList::checkVariablesForCycles):
1335         * css/CSSValueList.h:
1336         In order to abstract the old and new variables implementations, custom
1337         properties now store CSSCustomPropertyValue as their values instead of
1338         raw values. The old implementation needs to be patched to deal with this
1339         wrapper being present now.
1340
1341         * css/CSSVariableData.cpp:
1342         (WebCore::CSSVariableData::checkVariablesForCycles):
1343         (WebCore::CSSVariableData::checkVariablesForCyclesWithRange):
1344         (WebCore::CSSVariableData::resolveVariableFallback):
1345         (WebCore::CSSVariableData::resolveVariableReference):
1346         (WebCore::CSSVariableData::resolveVariableReferences):
1347         (WebCore::CSSVariableData::resolveTokenRange):
1348         * css/CSSVariableData.h:
1349         Implementation of cycle checking and variable resolution. The logic of
1350         this implementation is the same as the old. It walks CSSParserTokens
1351         instead of the old CSSParser structures.
1352
1353         * css/CSSVariableReferenceValue.cpp:
1354         (WebCore::CSSVariableReferenceValue::customCSSText):
1355         Add support for serialization caching, just like the old implementation
1356         had in CSSVariableDependentValue.
1357
1358         (WebCore::CSSVariableReferenceValue::checkVariablesForCycles):
1359         * css/CSSVariableReferenceValue.h:
1360         Add cycle checking and variable resolution helper functions.
1361
1362         * css/CSSVariableValue.cpp:
1363         (WebCore::CSSVariableValue::buildParserValueListSubstitutingVariables):
1364         Patched to account for the change in storage of custom properties to
1365         have custom property value wrappers.
1366
1367         * css/StyleProperties.cpp:
1368         (WebCore::StyleProperties::getPropertyValue):
1369         (WebCore::StyleProperties::borderSpacingValue):
1370         (WebCore::StyleProperties::getLayeredShorthandValue):
1371         (WebCore::StyleProperties::getShorthandValue):
1372         (WebCore::StyleProperties::getCommonValue):
1373         (WebCore::StyleProperties::getPropertyCSSValue):
1374         (WebCore::StyleProperties::asText):
1375         Clean up the resolution of pending substitution values. Instead of hacking
1376         it into every possible StyleShorthandProperty crawling function, obtain
1377         the shorthand for the property up front, access the first longhand, and
1378         if we see a pending substitution value, perform the substitution.
1379
1380         * css/StyleResolver.cpp:
1381         (WebCore::StyleResolver::MatchResult::addMatchedProperties):
1382         (WebCore::StyleResolver::applyProperty):
1383         (WebCore::StyleResolver::resolvedVariableValue):
1384         * css/StyleResolver.h:
1385         Add support for the new implementation in all the same places as the old.
1386
1387         * css/parser/CSSParser.cpp:
1388         (WebCore::CSSParser::parseInlineStyleDeclaration):
1389         (WebCore::CSSParser::parseValueWithVariableReferences):
1390         (WebCore::CSSParser::parseVariableDependentValue): Deleted.
1391         * css/parser/CSSParser.h:
1392         Rename parseVariableDependentValue to parseValueWithVariableReferences,
1393         since it is operating on three distinct value types now. Turn on new
1394         parser support for parseInlineStyleDeclaration.
1395
1396         * css/parser/CSSParserImpl.cpp:
1397         (WebCore::filterProperties):
1398         (WebCore::CSSParserImpl::parseVariableValue): Deleted.
1399         (WebCore::CSSParserImpl::parseCustomPropertySet): Deleted.
1400         * css/parser/CSSParserImpl.h:
1401         Remove parser functions that aren't relevant to our implementation
1402         of CSS variables.
1403
1404         * css/parser/CSSVariableParser.cpp:
1405         (WebCore::classifyVariableRange):
1406         Add support for the CSS4 'revert' keyword to the new variable parser.
1407
1408         * rendering/style/RenderStyle.cpp:
1409         (WebCore::RenderStyle::checkVariablesInCustomProperties):
1410         Modified to store CSSCustomPropertyValues as the values always now and
1411         to use the method abstractions on CSSCustomPropertyValue to resolve
1412         cycles and perform substitutions.
1413
1414         * rendering/style/RenderStyle.h:
1415         (WebCore::RenderStyle::setCustomPropertyValue):
1416         (WebCore::RenderStyle::getCustomPropertyValue):
1417         * rendering/style/StyleCustomPropertyData.h:
1418         (WebCore::StyleCustomPropertyData::operator==):
1419         (WebCore::StyleCustomPropertyData::setCustomPropertyValue):
1420         (WebCore::StyleCustomPropertyData::getCustomPropertyValue):
1421         Tighten up the map to store CSSCustomPropertyValue instead of just
1422         CSSValue.
1423
1424 2016-10-27  Zalan Bujtas  <zalan@apple.com>
1425
1426         RenderMultiColumnFlowThread::processPossibleSpannerDescendant should take RenderObject& instead of RenderObject*
1427         https://bugs.webkit.org/show_bug.cgi?id=164072
1428
1429         Reviewed by Simon Fraser.
1430
1431         No change in functionality.
1432
1433         * rendering/RenderFlowThread.h:
1434         * rendering/RenderMultiColumnFlowThread.cpp:
1435         (WebCore::findSetRendering):
1436         (WebCore::isValidColumnSpanner):
1437         (WebCore::RenderMultiColumnFlowThread::processPossibleSpannerDescendant):
1438         (WebCore::RenderMultiColumnFlowThread::flowThreadDescendantInserted):
1439         (WebCore::RenderMultiColumnFlowThread::findSetRendering): Deleted.
1440         * rendering/RenderMultiColumnFlowThread.h:
1441         * rendering/RenderMultiColumnSet.cpp:
1442         (WebCore::precedesRenderer):
1443         (WebCore::RenderMultiColumnSet::containsRendererInFlowThread):
1444         * rendering/RenderMultiColumnSet.h:
1445         * rendering/RenderMultiColumnSpannerPlaceholder.cpp:
1446         (WebCore::RenderMultiColumnSpannerPlaceholder::createAnonymous):
1447         (WebCore::RenderMultiColumnSpannerPlaceholder::RenderMultiColumnSpannerPlaceholder):
1448         * rendering/RenderMultiColumnSpannerPlaceholder.h:
1449         * rendering/RenderObject.cpp:
1450         (WebCore::RenderObject::insertedIntoTree):
1451
1452 2016-10-27  Brent Fulgham  <bfulgham@apple.com>
1453
1454         Prevent hit tests from being performed on an invalid render tree
1455         https://bugs.webkit.org/show_bug.cgi?id=163877
1456         <rdar://problem/28675761>
1457
1458         Reviewed by Simon Fraser.
1459
1460         Changeset r200971 added code to ensure that layout is up-to-date before hit testing, but did
1461         so only for the main frame. It was still possible to enter cross-frame hit testing with a
1462         subframe needing style recalc. In that situation, the subframe's updateLayout() would get
1463         called, which could trigger a compositing change that marked the parent frame as needing style
1464         recalc. A subsequent layout on the parent frame (for example by hit testing traversing into
1465         a second subframe) could then mutate the parent frame's layer tree while hit testing was
1466         traversing it.
1467         
1468         This patch modifies the hit test logic to ensure that a recursive layout is performed so that
1469         we always perform hit tests on a clean set of frames. It also adds some assertions to warn
1470         us if we encounter this invalid state.
1471
1472         Tested by fast/layers/prevent-hit-test-during-layout.html.
1473
1474         * dom/Document.cpp:
1475         (WebCore::Document::scheduleStyleRecalc): Assert that we are not hit testing
1476         during style recalculation.
1477         * page/EventHandler.cpp:
1478         (WebCore::EventHandler::hitTestResultAtPoint): Ensure that we have a clean render tree
1479         when hit testing.
1480         * page/FrameView.cpp:
1481         (WebCore::FrameView::setNeedsLayout): Assert that we are not in the process of hit testing
1482         when we schedule a layout.
1483         * rendering/RenderView.cpp:
1484         (WebCore::RenderView::hitTest): Mark RenderView as in an active hit test.
1485         * rendering/RenderView.h:
1486
1487 2016-10-27  Zan Dobersek  <zdobersek@igalia.com>
1488
1489         BufferSource should behave as an union
1490         https://bugs.webkit.org/show_bug.cgi?id=164056
1491
1492         Reviewed by Chris Dumez.
1493
1494         WebIDL typedefs BufferSource as (ArrayBufferView or ArrayBuffer).
1495         To follow that definition, IDLBufferSource is now type-aliased
1496         to IDLUnion<IDLInterface<ArrayBufferView>, IDLInterface<ArrayBuffer>>.
1497
1498         Converter<IDLBufferSource> template specialization can now be
1499         removed since the default specialization for IDLUnion will be
1500         used.
1501
1502         C++ implementations still work through a BufferSource object.
1503         That class now has an implicit constructor that consumes the
1504         Variant object. The data() and length() methods on the class
1505         now iterate the variant to find an existing object that can
1506         provide a pointer to the data or the length of it.
1507
1508         * Modules/mediasource/SourceBuffer.cpp:
1509         (WebCore::SourceBuffer::appendBuffer):
1510         * bindings/generic/IDLTypes.h:
1511         * bindings/js/BufferSource.h:
1512         (WebCore::BufferSource::BufferSource):
1513         (WebCore::BufferSource::data):
1514         (WebCore::BufferSource::length):
1515         * bindings/js/JSDOMConvert.h:
1516         (WebCore::Converter<IDLBufferSource>::convert): Deleted.
1517
1518 2016-10-27  Chris Dumez  <cdumez@apple.com>
1519
1520         Merge Element::ShadowRootMode and ShadowRoot::Mode enumerations
1521         https://bugs.webkit.org/show_bug.cgi?id=164063
1522
1523         Reviewed by Sam Weinig.
1524
1525         Merge Element::ShadowRootMode and ShadowRoot::Mode enumerations now
1526         that we support having IDL string enumerations in their own IDL file.
1527
1528         No new tests, no Web-exposed behavior change.
1529
1530         * CMakeLists.txt:
1531         * DerivedSources.cpp:
1532         * DerivedSources.make:
1533         * WebCore.xcodeproj/project.pbxproj:
1534         * css/ElementRuleCollector.cpp:
1535         (WebCore::ElementRuleCollector::collectMatchingRules):
1536         (WebCore::ElementRuleCollector::matchAuthorShadowPseudoElementRules):
1537         (WebCore::ElementRuleCollector::collectMatchingShadowPseudoElementRules):
1538         * css/SelectorChecker.cpp:
1539         (WebCore::SelectorChecker::matchRecursively):
1540         * dom/CustomElementRegistry.cpp:
1541         (WebCore::enqueueUpgradeInShadowIncludingTreeOrder):
1542         * dom/Element.cpp:
1543         (WebCore::Element::bindingsOffsetParent):
1544         (WebCore::Element::addShadowRoot):
1545         (WebCore::Element::attachShadow):
1546         (WebCore::Element::shadowRootForBindings):
1547         (WebCore::Element::userAgentShadowRoot):
1548         (WebCore::Element::ensureUserAgentShadowRoot):
1549         * dom/Element.h:
1550         * dom/Element.idl:
1551         * dom/InlineStyleSheetOwner.cpp:
1552         (WebCore::parserContextForElement):
1553         * dom/Node.cpp:
1554         (WebCore::Node::isUnclosedNode):
1555         (WebCore::Node::assignedSlotForBindings):
1556         (WebCore::Node::isInUserAgentShadowTree):
1557         * dom/ShadowRoot.cpp:
1558         (WebCore::ShadowRoot::ShadowRoot):
1559         * dom/ShadowRoot.h:
1560         * dom/ShadowRoot.idl:
1561         * dom/ShadowRootMode.h: Added.
1562         * dom/ShadowRootMode.idl: Copied from Source/WebCore/dom/ShadowRoot.idl.
1563         * dom/SlotAssignment.cpp:
1564         (WebCore::SlotAssignment::didChangeSlot):
1565         * html/HTMLSummaryElement.cpp:
1566         (WebCore::HTMLSummaryElement::create):
1567         * inspector/InspectorDOMAgent.cpp:
1568         (WebCore::shadowRootType):
1569         * rendering/HitTestResult.cpp:
1570         (WebCore::moveOutOfUserAgentShadowTree):
1571         * rendering/RenderElement.cpp:
1572         (WebCore::RenderElement::selectionPseudoStyle):
1573         * rendering/RenderLayer.cpp:
1574         (WebCore::rendererForScrollbar):
1575         * style/StyleScope.cpp:
1576         (WebCore::Style::Scope::shouldUseSharedUserAgentShadowTreeStyleResolver):
1577         (WebCore::Style::Scope::didChangeStyleSheetEnvironment):
1578         * svg/SVGElement.cpp:
1579         (WebCore::SVGElement::correspondingUseElement):
1580         * testing/Internals.cpp:
1581         (WebCore::Internals::shadowRootType):
1582
1583 2016-10-27  Chris Dumez  <cdumez@apple.com>
1584
1585         Element parameter to CanvasRenderingContext2D.drawFocusIfNeeded() should not be nullable
1586         https://bugs.webkit.org/show_bug.cgi?id=164062
1587
1588         Reviewed by Darin Adler.
1589
1590         Element parameter to CanvasRenderingContext2D.drawFocusIfNeeded() should not be nullable:
1591         - https://html.spec.whatwg.org/#canvasuserinterface
1592
1593         Firefox and Chrome agree with the specification.
1594
1595         Test: fast/canvas/draw-focus-if-needed-null-element.html
1596
1597         * html/canvas/CanvasRenderingContext2D.cpp:
1598         (WebCore::CanvasRenderingContext2D::drawFocusIfNeeded):
1599         (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal):
1600         * html/canvas/CanvasRenderingContext2D.h:
1601         * html/canvas/CanvasRenderingContext2D.idl:
1602
1603 2016-10-27  Yusuke Suzuki  <utatane.tea@gmail.com>
1604
1605         [DOMJIT][CSSJIT] Share code with DOMJIT
1606         https://bugs.webkit.org/show_bug.cgi?id=164006
1607
1608         Reviewed by Mark Lam.
1609
1610         Move CSSJIT's getDocument function to DOMJIT and share it with DOMJIT.
1611         And rename it to "loadDocument", it is closer name to the JSC's convention.
1612
1613         No behavior change.
1614
1615         * cssjit/SelectorCompiler.cpp:
1616         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateSpecialFailureInQuirksModeForActiveAndHoverIfNeeded):
1617         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeValueExactMatching):
1618         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementHasTagName):
1619         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsRoot):
1620         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsScopeRoot):
1621         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsTarget):
1622         (WebCore::SelectorCompiler::getDocument): Deleted.
1623         * domjit/DOMJITHelpers.h:
1624         (WebCore::DOMJIT::loadDocument):
1625         * domjit/JSNodeDOMJIT.cpp:
1626         (WebCore::NodeOwnerDocumentDOMJIT::callDOM):
1627
1628 2016-10-27  Youenn Fablet  <youenn@apple.com>
1629
1630         REGRESSION(r207753-207755): ASSERTION FAILED: m_parsedStyleSheetCache->isInMemoryCache()
1631         https://bugs.webkit.org/show_bug.cgi?id=163905
1632
1633         Reviewed by Antti Koivisto.
1634
1635         Covered by existing tests and http/tests/security/cached-cross-origin-shared-css-stylesheet.html
1636
1637         Small refactoring to do more member fields initialization in StyleSheetContents header.
1638         Refactored StyleSheetContents::m_isInMemoryCache to be a counter instead of a boolean.
1639         This allows StyleSheetContents to be linked to several CachedCSSStyleSheets.
1640
1641         * css/StyleSheetContents.cpp:
1642         (WebCore::StyleSheetContents::StyleSheetContents):
1643         (WebCore::StyleSheetContents::addedToMemoryCache):
1644         (WebCore::StyleSheetContents::removedFromMemoryCache):
1645         * css/StyleSheetContents.h:
1646         * loader/cache/CachedCSSStyleSheet.cpp:
1647         (WebCore::CachedCSSStyleSheet::setBodyDataFrom): Making reuse of saveParsedStyleSheet to handle update of StyleSheetContents cache count.
1648
1649 2016-10-27  Sergio Villar Senin  <svillar@igalia.com>
1650
1651         Unreviewed. Build fix for gcc.
1652
1653         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1654         (WebCore::MediaPlayerPrivateGStreamerMSE::maxTimeSeekable):
1655
1656 2016-10-27  Youenn Fablet  <youenn@apple.com>
1657
1658         MediaPayload does not need to be refcounted
1659         https://bugs.webkit.org/show_bug.cgi?id=164015
1660
1661         Reviewed by Eric Carlson.
1662
1663         No change of behavior.
1664         Making MediaPayload a struct and no-longer ref-counted.
1665         Small performance improvements in MediaEndpointOwr.
1666
1667         * Modules/mediastream/MediaEndpointPeerConnection.h:
1668         * Modules/mediastream/SDPProcessor.cpp:
1669         (WebCore::configurationFromJSON):
1670         (WebCore::configurationToJSON):
1671         * platform/mediastream/MediaEndpoint.h:
1672         * platform/mediastream/MediaPayload.h:
1673         (WebCore::MediaPayload::addParameter):
1674         (WebCore::MediaPayload::create): Deleted.
1675         (WebCore::MediaPayload::~MediaPayload): Deleted.
1676         (WebCore::MediaPayload::type): Deleted.
1677         (WebCore::MediaPayload::setType): Deleted.
1678         (WebCore::MediaPayload::encodingName): Deleted.
1679         (WebCore::MediaPayload::setEncodingName): Deleted.
1680         (WebCore::MediaPayload::clockRate): Deleted.
1681         (WebCore::MediaPayload::setClockRate): Deleted.
1682         (WebCore::MediaPayload::channels): Deleted.
1683         (WebCore::MediaPayload::setChannels): Deleted.
1684         (WebCore::MediaPayload::ccmfir): Deleted.
1685         (WebCore::MediaPayload::setCcmfir): Deleted.
1686         (WebCore::MediaPayload::nackpli): Deleted.
1687         (WebCore::MediaPayload::setNackpli): Deleted.
1688         (WebCore::MediaPayload::nack): Deleted.
1689         (WebCore::MediaPayload::setNack): Deleted.
1690         (WebCore::MediaPayload::parameters): Deleted.
1691         (WebCore::MediaPayload::clone): Deleted.
1692         (WebCore::MediaPayload::MediaPayload): Deleted.
1693         * platform/mediastream/PeerMediaDescription.h:
1694         (WebCore::PeerMediaDescription::payloads):
1695         (WebCore::PeerMediaDescription::addPayload):
1696         (WebCore::PeerMediaDescription::setPayloads):
1697         (WebCore::PeerMediaDescription::clone):
1698         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
1699         (WebCore::MediaEndpointOwr::getDefaultAudioPayloads):
1700         (WebCore::MediaEndpointOwr::getDefaultVideoPayloads):
1701         (WebCore::MediaEndpointOwr::filterPayloads):
1702         * platform/mock/MockMediaEndpoint.cpp:
1703         (WebCore::MockMediaEndpoint::getDefaultAudioPayloads):
1704         (WebCore::MockMediaEndpoint::getDefaultVideoPayloads):
1705         (WebCore::MockMediaEndpoint::filterPayloads):
1706
1707 2016-10-26  Dan Bernstein  <mitz@apple.com>
1708
1709         Improved the last build fix.
1710
1711         Darin pointed out I could have kept the function inline and just removed the WEBCORE_EXPORT.
1712
1713         * Modules/mediastream/UserMediaRequest.cpp:
1714         (WebCore::UserMediaRequest::document): Deleted.
1715         * Modules/mediastream/UserMediaRequest.h:
1716         (WebCore::UserMediaRequest::document):
1717
1718 2016-10-26  Chris Dumez  <cdumez@apple.com>
1719
1720         [Web IDL] Add support for having string enumerations in their own IDL file
1721         https://bugs.webkit.org/show_bug.cgi?id=164025
1722
1723         Reviewed by Darin Adler.
1724
1725         Add support for having string enumerations in their own IDL file to facilitate
1726         sharing them. Use this new support to implement IDBTransactionMode enumeration
1727         for IndexedDB:
1728         - https://www.w3.org/TR/IndexedDB/#idl-def-IDBTransactionMode
1729
1730         No new tests, rebaselined existing tests.
1731
1732         * CMakeLists.txt:
1733         * DerivedSources.cpp:
1734         * DerivedSources.make:
1735         * Modules/indexeddb/IDBDatabase.cpp:
1736         (WebCore::IDBDatabase::transaction):
1737         (WebCore::IDBDatabase::startVersionChangeTransaction):
1738         * Modules/indexeddb/IDBDatabase.h:
1739         * Modules/indexeddb/IDBDatabase.idl:
1740         * Modules/indexeddb/IDBOpenDBRequest.cpp:
1741         (WebCore::IDBOpenDBRequest::onUpgradeNeeded):
1742         * Modules/indexeddb/IDBTransaction.cpp:
1743         (WebCore::IDBTransaction::IDBTransaction):
1744         * Modules/indexeddb/IDBTransaction.h:
1745         (WebCore::IDBTransaction::mode):
1746         (WebCore::IDBTransaction::isVersionChange):
1747         (WebCore::IDBTransaction::isReadOnly):
1748         * Modules/indexeddb/IDBTransaction.idl:
1749         * Modules/indexeddb/IDBTransactionMode.h: Added.
1750         * Modules/indexeddb/IDBTransactionMode.idl: Copied from Source/WebCore/Modules/indexeddb/IDBTransaction.idl.
1751         * Modules/indexeddb/IndexedDB.h:
1752         * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
1753         (WebCore::IDBServer::MemoryBackingStoreTransaction::MemoryBackingStoreTransaction):
1754         (WebCore::IDBServer::MemoryBackingStoreTransaction::objectStoreRenamed):
1755         (WebCore::IDBServer::MemoryBackingStoreTransaction::indexRenamed):
1756         (WebCore::IDBServer::MemoryBackingStoreTransaction::abort):
1757         * Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
1758         (WebCore::IDBServer::MemoryBackingStoreTransaction::isVersionChange):
1759         (WebCore::IDBServer::MemoryBackingStoreTransaction::isWriting):
1760         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
1761         (WebCore::IDBServer::SQLiteIDBBackingStore::beginTransaction):
1762         (WebCore::IDBServer::SQLiteIDBBackingStore::abortTransaction):
1763         (WebCore::IDBServer::SQLiteIDBBackingStore::commitTransaction):
1764         (WebCore::IDBServer::SQLiteIDBBackingStore::createObjectStore):
1765         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteObjectStore):
1766         (WebCore::IDBServer::SQLiteIDBBackingStore::renameObjectStore):
1767         (WebCore::IDBServer::SQLiteIDBBackingStore::clearObjectStore):
1768         (WebCore::IDBServer::SQLiteIDBBackingStore::createIndex):
1769         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteIndex):
1770         (WebCore::IDBServer::SQLiteIDBBackingStore::renameIndex):
1771         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRecord):
1772         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRange):
1773         (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord):
1774         (WebCore::IDBServer::SQLiteIDBBackingStore::generateKeyNumber):
1775         (WebCore::IDBServer::SQLiteIDBBackingStore::revertGeneratedKeyNumber):
1776         (WebCore::IDBServer::SQLiteIDBBackingStore::maybeUpdateKeyGeneratorNumber):
1777         * Modules/indexeddb/server/SQLiteIDBTransaction.cpp:
1778         (WebCore::IDBServer::SQLiteIDBTransaction::begin):
1779         * Modules/indexeddb/server/SQLiteIDBTransaction.h:
1780         (WebCore::IDBServer::SQLiteIDBTransaction::mode):
1781         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1782         (WebCore::IDBServer::UniqueIDBDatabase::enqueueTransaction):
1783         (WebCore::IDBServer::UniqueIDBDatabase::takeNextRunnableTransaction):
1784         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
1785         (WebCore::IDBServer::UniqueIDBDatabaseConnection::establishTransaction):
1786         * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
1787         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::UniqueIDBDatabaseTransaction):
1788         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::originalDatabaseInfo):
1789         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::isVersionChange):
1790         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::isReadOnly):
1791         * Modules/indexeddb/shared/IDBTransactionInfo.cpp:
1792         (WebCore::IDBTransactionInfo::clientTransaction):
1793         (WebCore::IDBTransactionInfo::versionChange):
1794         (WebCore::IDBTransactionInfo::loggingString):
1795         * Modules/indexeddb/shared/IDBTransactionInfo.h:
1796         (WebCore::IDBTransactionInfo::mode):
1797         * WebCore.xcodeproj/project.pbxproj:
1798         * bindings/scripts/CodeGenerator.pm:
1799         (ProcessDocument):
1800         (IsEnumType):
1801         (GetEnumByName):
1802         (IsExternalEnumType):
1803         (ValidEnumValues):
1804         * bindings/scripts/CodeGeneratorJS.pm:
1805         (GenerateEnumeration):
1806         (AddToImplIncludesForIDLType):
1807         (GetEnumerationClassName):
1808         (GenerateEnumerationHeader):
1809         (GenerateEnumerationImplementation):
1810         (GenerateEnumerationImplementationContent):
1811         (GenerateEnumerationsImplementationContent):
1812         (GenerateEnumerationHeaderContent):
1813         (GenerateEnumerationsHeaderContent):
1814         * bindings/scripts/test/JS/JSTestObj.cpp:
1815         (WebCore::jsTestObjPrototypeFunctionMethodWithEnumArgCaller):
1816         (WebCore::jsTestObjPrototypeFunctionMethodWithStandaloneEnumArg):
1817         (WebCore::jsTestObjPrototypeFunctionMethodWithStandaloneEnumArgCaller):
1818         * bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp: Added.
1819         (WebCore::convertEnumerationToJS):
1820         (WebCore::parseEnumeration<TestStandaloneEnumeration>):
1821         (WebCore::convertEnumeration<TestStandaloneEnumeration>):
1822         (WebCore::expectedEnumerationValues<TestStandaloneEnumeration>):
1823         * bindings/scripts/test/JS/JSTestStandaloneEnumeration.h: Added.
1824         * bindings/scripts/test/TestObj.idl:
1825         * bindings/scripts/test/TestStandaloneEnumeration.idl: Copied from Source/WebCore/Modules/indexeddb/IDBTransaction.idl.
1826         * inspector/InspectorIndexedDBAgent.cpp:
1827
1828 2016-10-26  Dan Bernstein  <mitz@apple.com>
1829
1830         Fixed the WebKit2 build.
1831
1832         * Modules/mediastream/UserMediaRequest.cpp:
1833         (WebCore::UserMediaRequest::document): Moved the definition of this function to here from…
1834         * Modules/mediastream/UserMediaRequest.h:
1835         (WebCore::UserMediaRequest::document): …here, so that the WebKit2 build doesn’t encounter an
1836           exported inline function.
1837
1838 2016-10-26  Yusuke Suzuki  <utatane.tea@gmail.com>
1839
1840         [DOMJIT] Implement Node::ownerDocument
1841         https://bugs.webkit.org/show_bug.cgi?id=164004
1842
1843         Reviewed by Darin Adler.
1844
1845         Test: js/dom/domjit-accessor-owner-document.html
1846
1847         Implement Node.ownerDocument DOMJIT accessor.
1848         According to the result of the profiler, jQuery's prop()
1849         function is frequently called in Ember.js SpeedoMeter.
1850         And this function calls jQuery.isXMLDoc(). And this isXMLDoc()
1851         function calls element.ownerDocument accessor. And our WebKit
1852         inspector also uses ownerDocument accessor frequently.
1853
1854         Interesting thing is this ownerDocument functionality is used
1855         in CSSJIT, so CSSJIT has similar helper function to look up the
1856         owner document of the element. As a result, all the necessary
1857         functionality is already implemented, DOMJIT just utilizes it.
1858         For example, Node::treeScopeMemoryOffset() and
1859         TreeScope::documentScopeMemoryOffset() is implemented before this
1860         patch.
1861
1862         In the future, we will convert CSSJIT's Assembler& to CCallHelpers&
1863         and share the code with DOMJIT[1].
1864
1865         [1]: https://bugs.webkit.org/show_bug.cgi?id=164006
1866
1867         * dom/Node.idl:
1868         * domjit/DOMJITAbstractHeapRepository.h:
1869         * domjit/JSNodeDOMJIT.cpp:
1870         (WebCore::NodeOwnerDocumentDOMJIT::checkDOM):
1871         (WebCore::NodeOwnerDocumentDOMJIT::callDOM):
1872
1873 2016-10-26  Chris Dumez  <cdumez@apple.com>
1874
1875         Replace IDBKeyPath with a WTF::Variant
1876         https://bugs.webkit.org/show_bug.cgi?id=163909
1877
1878         Reviewed by Darin Adler.
1879
1880         Replace IDBKeyPath class with the IDBKeyPathVariant type entirely
1881         and rename IDBKeyPathVariant to IDBKeyPath.
1882
1883         Unfortunately, IDBKeyPath still needs some special handling when
1884         returned to the JavaScript because we do not have a toJS() accepting
1885         a WTF::Variant as input yet.
1886
1887         There should be no significant behavior change except that
1888         IDBIndex.keyPath / IDBObjectStore.keyPath now returns an array of
1889         Strings instead of a DOMStringList object when the IDBKeyPath
1890         contains a vector. This is a progression and matches the
1891         specification:
1892         - https://www.w3.org/TR/IndexedDB/#widl-IDBIndex-keyPath
1893         - https://www.w3.org/TR/IndexedDB/#widl-IDBObjectStore-keyPath
1894
1895         No new tests, rebaselined existing tests.
1896
1897         * Modules/indexeddb/IDBCursor.cpp:
1898         (WebCore::IDBCursor::update):
1899         * Modules/indexeddb/IDBDatabase.h:
1900         * Modules/indexeddb/IDBGetResult.cpp:
1901         (WebCore::IDBGetResult::isolatedCopy):
1902         * Modules/indexeddb/IDBKeyPath.cpp:
1903         (WebCore::isIDBKeyPathValid):
1904         (WebCore::IDBKeyPathIsolatedCopy):
1905         * Modules/indexeddb/IDBKeyPath.h:
1906         (WebCore::IDBKeyPathIsolatedCopy):
1907         * Modules/indexeddb/IDBObjectStore.cpp:
1908         (WebCore::IDBObjectStore::keyPath):
1909         (WebCore::IDBObjectStore::putOrAdd):
1910         (WebCore::IDBObjectStore::createIndex):
1911         * Modules/indexeddb/IDBObjectStore.h:
1912         * Modules/indexeddb/server/IDBSerialization.cpp:
1913         (WebCore::serializeIDBKeyPath):
1914         (WebCore::deserializeIDBKeyPath):
1915         * Modules/indexeddb/server/IDBSerialization.h:
1916         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
1917         (WebCore::IDBServer::SQLiteIDBBackingStore::extractExistingDatabaseInfo):
1918         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1919         (WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd):
1920         * Modules/indexeddb/shared/IDBDatabaseInfo.cpp:
1921         (WebCore::IDBDatabaseInfo::createNewObjectStore):
1922         * Modules/indexeddb/shared/IDBDatabaseInfo.h:
1923         * Modules/indexeddb/shared/IDBIndexInfo.cpp:
1924         (WebCore::IDBIndexInfo::IDBIndexInfo):
1925         (WebCore::IDBIndexInfo::isolatedCopy):
1926         * Modules/indexeddb/shared/IDBIndexInfo.h:
1927         * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp:
1928         (WebCore::IDBObjectStoreInfo::IDBObjectStoreInfo):
1929         (WebCore::IDBObjectStoreInfo::createNewIndex):
1930         (WebCore::IDBObjectStoreInfo::isolatedCopy):
1931         * Modules/indexeddb/shared/IDBObjectStoreInfo.h:
1932         (WebCore::IDBObjectStoreInfo::keyPath):
1933         * bindings/js/IDBBindingUtilities.cpp:
1934         (WebCore::injectIDBKeyIntoScriptValue):
1935         (WebCore::maybeCreateIDBKeyFromScriptValueAndKeyPath):
1936         (WebCore::canInjectIDBKeyIntoScriptValue):
1937         (WebCore::createKeyPathArray):
1938         (WebCore::toJS):
1939         * bindings/js/IDBBindingUtilities.h:
1940         * inspector/InspectorIndexedDBAgent.cpp:
1941
1942 2016-10-26  Zalan Bujtas  <zalan@apple.com>
1943
1944         Ignore out-of-flow siblings when searching for a spanner candidate.
1945         https://bugs.webkit.org/show_bug.cgi?id=164042.
1946         <rdar://problem/28758456>
1947
1948         Reviewed by Simon Fraser.
1949
1950         While searching for the spanner candidates in a flow thread, we have to take into account
1951         whether renderers are in- or out-of-flow.
1952         What it means is that while traversing the renderer tree to find the the candidate
1953         renderer (next sibling/ancestor's next child in pre-order traversal), we have to check if the candidate
1954         is in the same layout context too.
1955
1956         Test: fast/multicol/crash-when-spanner-candidate-is-out-of-flow.html
1957
1958         * rendering/RenderMultiColumnFlowThread.cpp:
1959         (WebCore::spannerPlacehoderCandidate):
1960         (WebCore::RenderMultiColumnFlowThread::processPossibleSpannerDescendant):
1961
1962 2016-10-26  Brian Burg  <bburg@apple.com>
1963
1964         Web Inspector: remove unused bool return value from FrontendChannel::sendMessageToFrontend
1965         https://bugs.webkit.org/show_bug.cgi?id=164046
1966
1967         Reviewed by Joseph Pecoraro.
1968
1969         * inspector/InspectorClient.cpp:
1970         (WebCore::InspectorClient::doDispatchMessageOnFrontendPage):
1971         * inspector/InspectorClient.h:
1972         * testing/Internals.cpp:
1973         (WebCore::InspectorStubFrontend::sendMessageToFrontend):
1974
1975 2016-10-26  Chris Dumez  <cdumez@apple.com>
1976
1977         The URLSearchParams constructor should take a union in parameter
1978         https://bugs.webkit.org/show_bug.cgi?id=163906
1979
1980         Reviewed by Darin Adler.
1981
1982         The URLSearchParams constructor should take a union in parameter:
1983         - https://url.spec.whatwg.org/#urlsearchparams
1984
1985         No new tests, no web-exposed behavior change.
1986
1987         * html/URLSearchParams.h:
1988         (WebCore::URLSearchParams::create):
1989         * html/URLSearchParams.idl:
1990
1991 2016-10-26  Sam Weinig  <sam@webkit.org>
1992
1993         [WebIDL] Move more string conversions over to JSDOMConvert
1994         https://bugs.webkit.org/show_bug.cgi?id=164021
1995
1996         Reviewed by Tim Horton.
1997
1998         * bindings/js/JSCSSStyleDeclarationCustom.cpp:
1999         (WebCore::JSCSSStyleDeclaration::putDelegate):
2000         * bindings/js/JSDOMWindowCustom.cpp:
2001         (WebCore::JSDOMWindow::open):
2002         (WebCore::JSDOMWindow::showModalDialog):
2003         (WebCore::handlePostMessage):
2004         * bindings/js/JSHTMLCanvasElementCustom.cpp:
2005         (WebCore::JSHTMLCanvasElement::toDataURL):
2006         * bindings/js/JSHistoryCustom.cpp:
2007         (WebCore::JSHistory::pushState):
2008         (WebCore::JSHistory::replaceState):
2009         Switch to convert functions.
2010
2011         * bindings/js/JSApplePaySessionCustom.cpp:
2012         (WebCore::JSApplePaySession::completeShippingMethodSelection):
2013         (WebCore::JSApplePaySession::completeShippingContactSelection):
2014         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
2015         (WebCore::createAesKeyGenParams):
2016         (WebCore::createRsaKeyGenParams):
2017         * bindings/js/JSDocumentCustom.cpp:
2018         (WebCore::JSDocument::getCSSCanvasContext):
2019         * bindings/js/JSMockContentFilterSettingsCustom.cpp:
2020         (WebCore::JSMockContentFilterSettings::setDecisionPoint):
2021         (WebCore::toDecision):
2022         * bindings/js/JSNodeFilterCustom.cpp:
2023         (WebCore::JSNodeFilter::acceptNode):
2024         * bindings/js/JSDOMBinding.cpp:
2025         (WebCore::toSmallerInt):
2026         (WebCore::toSmallerUInt):
2027         (WebCore::toInt8EnforceRange):
2028         (WebCore::toUInt8EnforceRange):
2029         (WebCore::toInt8Clamp):
2030         (WebCore::toUInt8Clamp):
2031         (WebCore::toInt8):
2032         (WebCore::toUInt8):
2033         (WebCore::toInt16EnforceRange):
2034         (WebCore::toUInt16EnforceRange):
2035         (WebCore::toInt16Clamp):
2036         (WebCore::toUInt16Clamp):
2037         (WebCore::toInt16):
2038         (WebCore::toUInt16):
2039         Use updated IntegerConversionConfiguration naming.
2040
2041         (WebCore::valueToStringTreatingNullAsEmptyString): Deleted.
2042         (WebCore::valueToStringWithUndefinedOrNullCheck): Deleted.
2043         (WebCore::valueToUSVStringTreatingNullAsEmptyString): Deleted.
2044         (WebCore::valueToUSVStringWithUndefinedOrNullCheck): Deleted.
2045         * bindings/js/JSDOMBinding.h:
2046         Remove unused functions.
2047
2048         * bindings/js/JSDOMConvert.h:
2049         (WebCore::convert):
2050         Add StringConversionConfiguration, to match IntegerConversionConfiguration which moved here,
2051         and make them both enum classes. Remove SFINAE based overloading of convert<>, which is not
2052         needed if we get rid of the default parameter, which we can, since the two parameter convert
2053         routes to the right place.
2054
2055         (WebCore::Converter<IDLNullable<T>>::convert):
2056         Add overloads converts that take a Integer/String configuration.
2057
2058         (WebCore::Converter<IDLByte>::convert):
2059         (WebCore::Converter<IDLOctet>::convert):
2060         (WebCore::Converter<IDLShort>::convert):
2061         (WebCore::Converter<IDLUnsignedShort>::convert):
2062         (WebCore::Converter<IDLLong>::convert):
2063         (WebCore::Converter<IDLUnsignedLong>::convert):
2064         (WebCore::Converter<IDLLongLong>::convert):
2065         (WebCore::Converter<IDLUnsignedLongLong>::convert):
2066         Use updated IntegerConversionConfiguration naming.
2067
2068         (WebCore::Converter<IDLDOMString>::convert):
2069         (WebCore::Converter<IDLUSVString>::convert):
2070         Add a configuration parameter, similar to the one used for integers
2071         that changes the behavior of string conversions to return an empty
2072         string for null.
2073
2074         * bindings/js/JSDOMIterator.h:
2075         (WebCore::iteratorCreate):
2076         (WebCore::IteratorTraits>::asJS):
2077         (WebCore::appendForEachArguments):
2078         Simplify a bit by extracting the SFINAE helpers into a EnableIfMap and EnableIfSet.
2079
2080         * bindings/scripts/CodeGeneratorJS.pm:
2081         (GetIntegerConversionConfiguration):
2082         (GetStringConversionConfiguration):
2083         (JSValueToNativeIsHandledByDOMConvert):
2084         (JSValueToNative):
2085         Add support for converting more string types and passing the StringConversionConfiguration.
2086
2087 2016-10-26  Dan Bernstein  <mitz@apple.com>
2088
2089         When pasting web archive, width specifiers in srcset attribute change into density specifiers
2090         https://bugs.webkit.org/show_bug.cgi?id=164027
2091         <rdar://problem/28964948>
2092
2093         Reviewed by Tim Horton.
2094
2095         Updated editing/pasteboard/img-srcset-copy-paste-canonicalization.html.
2096
2097         * html/HTMLImageElement.cpp:
2098         (WebCore::HTMLImageElement::completeURLsInAttributeValue): Use 'w' when writing out a width
2099           specifier.
2100
2101 2016-10-26  Antoine Quint  <graouts@apple.com>
2102
2103         [Modern Media Controls] Media Controller: playback support
2104         https://bugs.webkit.org/show_bug.cgi?id=163678
2105         <rdar://problem/27989479>
2106
2107         Reviewed by Dean Jackson.
2108
2109         We introduce the PlaybackSupport class which brings support for playing and pausing
2110         the media by clicking on the play/pause button in the media controls and correctly
2111         reflecting the media's playback state as the media is played or paused via the media API.
2112
2113         * Modules/modern-media-controls/js-files:
2114         * Modules/modern-media-controls/media/media-controller.js:
2115         (MediaController):
2116         * Modules/modern-media-controls/media/playback-support.js: Copied from Source/WebCore/Modules/modern-media-controls/media/media-controller.js.
2117         (PlaybackSupport.prototype.get control):
2118         (PlaybackSupport.prototype.get mediaEvents):
2119         (PlaybackSupport.prototype.buttonWasClicked):
2120         (PlaybackSupport.prototype.syncControl):
2121         (PlaybackSupport):
2122         * WebCore.xcodeproj/project.pbxproj:
2123
2124 2016-10-26  Chris Dumez  <cdumez@apple.com>
2125
2126         Regression(r203848): 百度糯米 app fails to load content due to a JavaScript error
2127         https://bugs.webkit.org/show_bug.cgi?id=163967
2128         <rdar://problem/28707838>
2129
2130         Reviewed by Ryosuke Niwa.
2131
2132         Add quirk for 百度糯米 app making the 2 last parameters to Event.prototype.initEvent()
2133         optional.
2134
2135         No new tests, change only impacts this specific application.
2136
2137         * bindings/scripts/CodeGeneratorJS.pm:
2138         (GeneratePropertiesHashTable):
2139         * dom/Event.cpp:
2140         (WebCore::Event::initEventForBindings):
2141         * dom/Event.h:
2142         * dom/Event.idl:
2143         * platform/RuntimeApplicationChecks.h:
2144         * platform/RuntimeApplicationChecks.mm:
2145         (WebCore::IOSApplication::isBaiduNuomi):
2146
2147 2016-10-26  Chris Dumez  <cdumez@apple.com>
2148
2149         First parameter to TextTrack.addCue() / removeCue() should not be nullable
2150         https://bugs.webkit.org/show_bug.cgi?id=164020
2151
2152         Reviewed by Eric Carlson.
2153
2154         First parameter to TextTrack.addCue() / removeCue() should not be nullable:
2155         - https://html.spec.whatwg.org/#texttrack
2156
2157         Firefox and Chrome agree with the specification.
2158
2159         Test: media/track/texttrack-addCue-null.html
2160
2161         * html/track/InbandDataTextTrack.cpp:
2162         (WebCore::InbandDataTextTrack::removeDataCue):
2163         (WebCore::InbandDataTextTrack::removeCue):
2164         * html/track/InbandDataTextTrack.h:
2165         * html/track/InbandGenericTextTrack.cpp:
2166         (WebCore::InbandGenericTextTrack::addGenericCue):
2167         (WebCore::InbandGenericTextTrack::removeGenericCue):
2168         (WebCore::InbandGenericTextTrack::removeCue):
2169         * html/track/InbandGenericTextTrack.h:
2170         * html/track/TextTrack.cpp:
2171         (WebCore::TextTrack::addCue):
2172         (WebCore::TextTrack::removeCue):
2173         * html/track/TextTrack.h:
2174         * html/track/TextTrack.idl:
2175
2176 2016-10-26  Antoine Quint  <graouts@apple.com>
2177
2178         [Modern Media Controls] Media Controller: elapsed and remaining time support
2179         https://bugs.webkit.org/show_bug.cgi?id=163679
2180         <rdar://problem/28851675>
2181
2182         Reviewed by Dean Jackson.
2183
2184         We introduce the ElapsedTimeSupport and RemainingTimeSupport classes which bring
2185         support for displaying the elapsed and remaining time in the time control.
2186
2187         Tests: media/modern-media-controls/elapsed-time-support/elapsed-time-support.html
2188                media/modern-media-controls/remaining-time-support/remaining-time-support.html
2189
2190         * Modules/modern-media-controls/js-files:
2191         * Modules/modern-media-controls/media/elapsed-time-support.js: Added.
2192         (ElapsedTimeSupport.prototype.get control):
2193         (ElapsedTimeSupport.prototype.get mediaEvents):
2194         (ElapsedTimeSupport.prototype.syncControl):
2195         (ElapsedTimeSupport):
2196         * Modules/modern-media-controls/media/media-controller.js:
2197         (MediaController):
2198         * Modules/modern-media-controls/media/remaining-time-support.js: Added.
2199         (RemainingTimeSupport.prototype.get control):
2200         (RemainingTimeSupport.prototype.get mediaEvents):
2201         (RemainingTimeSupport.prototype.syncControl):
2202         (RemainingTimeSupport):
2203         * WebCore.xcodeproj/project.pbxproj:
2204
2205 2016-10-26  Dave Hyatt  <hyatt@apple.com>
2206
2207         [CSS Parser] Unify CSSCustomPropertyValue and CSSCustomPropertyDeclaration
2208         https://bugs.webkit.org/show_bug.cgi?id=164019
2209
2210         Reviewed by Zalan Bujtas.
2211
2212         * CMakeLists.txt:
2213         * WebCore.xcodeproj/project.pbxproj:
2214         * css/CSSCustomPropertyDeclaration.cpp: Removed.
2215         * css/CSSCustomPropertyDeclaration.h: Removed.
2216         Get rid of CSSCustomPropertyDeclaration.
2217
2218         * css/CSSCustomPropertyValue.h:
2219         Add new constructors to handle the new variable data format (either a CSSValueId or a
2220         CSSVariableData object that holds parser tokens).
2221
2222         * css/CSSValue.cpp:
2223         (WebCore::CSSValue::cssText):
2224         (WebCore::CSSValue::destroy):
2225         * css/CSSValue.h:
2226         (WebCore::CSSValue::isCustomPropertyDeclaration): Deleted.
2227         Get rid of CSSCustomPropertyDeclaration cases.
2228
2229         * css/CSSVariableData.h:
2230         Switch to CSSCustomPropertyValue.
2231
2232         * css/StyleResolver.cpp:
2233         (WebCore::StyleResolver::applyProperty):
2234         We've renamed the old parser variable data to deprecatedValue to make it clear it's going
2235         to be removed eventually.
2236
2237         * css/parser/CSSParserImpl.cpp:
2238         (WebCore::filterProperties):
2239         (WebCore::CSSParserImpl::consumeVariableValue):
2240         * css/parser/CSSVariableParser.cpp:
2241         (WebCore::CSSVariableParser::parseDeclarationValue):
2242         * css/parser/CSSVariableParser.h:
2243         Switch to CSSCustomPropertyValue.
2244
2245 2016-10-26  Youenn Fablet  <youenn@apple.com>
2246
2247         Enable SDPProcessor for Mac bots
2248         https://bugs.webkit.org/show_bug.cgi?id=163940
2249
2250         Reviewed by Eric Carlson.
2251
2252         Covered by activated tests.
2253
2254         Activating processing of SDPProcessor scripts for Mac bots.
2255         Moving platform/mediastream/openwebrtc/SDPProcessorScriptResource.cpp to platform/mediastream/SDPProcessorScriptResource.cpp.
2256         This file is not tied to openwebrtc and allows retrieving the SDPProcessor script resource file content.
2257
2258         * DerivedSources.make:
2259         * PlatformGTK.cmake:
2260         * WebCore.xcodeproj/project.pbxproj:
2261         * platform/mediastream/SDPProcessorScriptResource.cpp:
2262         (WebCore::SDPProcessorScriptResource::scriptString):
2263         * platform/mediastream/openwebrtc/SDPProcessorScriptResource.cpp: Removed.
2264
2265 2016-10-26  Dave Hyatt  <hyatt@apple.com>
2266
2267         [CSS Parser] Get functional pseudos parsing
2268         https://bugs.webkit.org/show_bug.cgi?id=164018
2269
2270         Reviewed by Zalan Bujtas.
2271
2272         * css/parser/CSSParserValues.cpp:
2273         (WebCore::CSSParserSelector::parsePseudoClassSelectorFromStringView):
2274         Remove the ( check so that we can parse strings that end in (.
2275
2276         * css/parser/CSSSelectorParser.cpp:
2277         (WebCore::CSSSelectorParser::consumePseudo):
2278         Put in a hack that adds a ( to the end of the string so that it will be found in the map.
2279
2280 2016-10-26  Zan Dobersek  <zdobersek@igalia.com>
2281
2282         Unreviewed. Fixing compiler warnings in PlaybackPipeline
2283         that are popping up in GTK+ builds.
2284
2285         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
2286         (WebCore::PlaybackPipeline::addSourceBuffer):
2287         (WebCore::PlaybackPipeline::attachTrack):
2288
2289 2016-10-26  Youenn Fablet  <youennf@gmail.com>
2290
2291         IceCandidate does not need to be refcounted
2292         https://bugs.webkit.org/show_bug.cgi?id=163944
2293
2294         Reviewed by Eric Carlson.
2295
2296         No change of behavior.
2297
2298         Simplifying IceCandidate class into a simple structure, no longer refcounted.
2299         Updated call sites accordingly.
2300         Updated SDP parsing of candidates to return a Variant instead of having both a return and an out parameter.
2301
2302         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2303         (WebCore::MediaEndpointPeerConnection::addIceCandidateTask):
2304         (WebCore::MediaEndpointPeerConnection::gotIceCandidate):
2305         * Modules/mediastream/MediaEndpointPeerConnection.h:
2306         * Modules/mediastream/SDPProcessor.cpp:
2307         (WebCore::createCandidateObject):
2308         (WebCore::createCandidate):
2309         (WebCore::iceCandidateFromJSON):
2310         (WebCore::configurationToJSON):
2311         (WebCore::SDPProcessor::parseCandidateLine):
2312         * Modules/mediastream/SDPProcessor.h:
2313         (WebCore::SDPProcessor::ParsingResult::parsingStatus):
2314         (WebCore::SDPProcessor::ParsingResult::candidate):
2315         * platform/mediastream/IceCandidate.h:
2316         * platform/mediastream/MediaEndpoint.cpp:
2317         * platform/mediastream/MediaEndpoint.h:
2318         * platform/mediastream/PeerMediaDescription.h:
2319         (WebCore::PeerMediaDescription::iceCandidates):
2320         (WebCore::PeerMediaDescription::addIceCandidate):
2321         (WebCore::PeerMediaDescription::clone):
2322         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
2323         (WebCore::MediaEndpointOwr::updateSendConfiguration):
2324         (WebCore::MediaEndpointOwr::addRemoteCandidate):
2325         (WebCore::MediaEndpointOwr::dispatchNewIceCandidate):
2326         (WebCore::MediaEndpointOwr::internalAddRemoteCandidate):
2327         * platform/mediastream/openwebrtc/MediaEndpointOwr.h:
2328         * platform/mock/MockMediaEndpoint.cpp:
2329         (WebCore::MockMediaEndpoint::addRemoteCandidate):
2330         (WebCore::MockMediaEndpoint::dispatchFakeIceCandidates):
2331         * platform/mock/MockMediaEndpoint.h:
2332
2333 2016-10-26  Andreas Kling  <akling@apple.com>
2334
2335         Fix mach port leak in ResourceUsageThread.
2336         <https://webkit.org/b/164012>
2337
2338         Reviewed by Antti Koivisto.
2339
2340         The threads returned by task_threads() need to be deallocated.
2341
2342         * page/cocoa/ResourceUsageThreadCocoa.mm:
2343         (WebCore::cpuUsage):
2344
2345 2016-10-26  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
2346
2347         WebRTC: The RTCTrackEventInit dictionary needs required members
2348         https://bugs.webkit.org/show_bug.cgi?id=158536
2349
2350         Reviewed by Chris Dumez.
2351
2352         Update RTCTrackEvent IDL as per specification.
2353
2354         No additional test required, rebase existing tests.
2355
2356         * Modules/mediastream/RTCTrackEvent.idl:
2357
2358 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
2359
2360         [GStreamer][GTK+][MSE] Unreviewed debug build fix.
2361
2362         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2363         (WebCore::AppendPipeline::resetPipeline):
2364         * platform/graphics/gstreamer/mse/AppendPipeline.h:
2365
2366 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
2367
2368         [cmake][GStreamer][MSE][EME] Build MSE and EME code after refactoring
2369         https://bugs.webkit.org/show_bug.cgi?id=162928
2370
2371         Reviewed by Xabier Rodriguez-Calvar.
2372
2373         Consolidate all the source file tree changes after refactoring.
2374
2375         This patch is co-authored with Philippe Normand <philn@igalia.com> (EME support).
2376
2377         * platform/GStreamer.cmake:
2378
2379 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
2380
2381         [MSE][GStreamer] Enable QUOTA_EXCEEDED_ERR support for GStreamer
2382         https://bugs.webkit.org/show_bug.cgi?id=162922
2383
2384         Reviewed by Xabier Rodriguez-Calvar.
2385
2386         QUOTA_EXCEEDED_ERR should be reported by SourceBuffer when appropriate, at least on the
2387         GStreamer implementation.
2388
2389         * Modules/mediasource/SourceBuffer.cpp:
2390         (WebCore::SourceBuffer::appendBufferInternal):
2391
2392 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
2393
2394         [MSE] Expose additional MediaSource methods to MediaSourcePrivate
2395         https://bugs.webkit.org/show_bug.cgi?id=162920
2396
2397         Reviewed by Xabier Rodriguez-Calvar.
2398
2399         The GStreamer MSE platform implementation needs to report duration changes and trigger
2400         monitorSourceBuffers() calls.
2401
2402         * Modules/mediasource/MediaSource.cpp:
2403         (WebCore::MediaSource::durationChanged):
2404         * Modules/mediasource/MediaSource.h:
2405         * platform/graphics/MediaSourcePrivateClient.h:
2406
2407 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
2408
2409         [GStreamer][EME] ClearKey decryption support
2410         https://bugs.webkit.org/show_bug.cgi?id=162918
2411
2412         Reviewed by Xabier Rodriguez-Calvar.
2413
2414         This patch is authored by Philippe Normand <philn@igalia.com>.
2415
2416         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp: Added.
2417         (webkit_media_clear_key_decrypt_class_init):
2418         (webkit_media_clear_key_decrypt_init):
2419         (webKitMediaClearKeyDecryptorFinalize):
2420         (webKitMediaClearKeyDecryptorRequestDecryptionKey):
2421         (webKitMediaClearKeyDecryptorHandleKeyResponse):
2422         (webKitMediaClearKeyDecryptorSetupCipher):
2423         (webKitMediaClearKeyDecryptorDecrypt):
2424         (webKitMediaClearKeyDecryptorReleaseCipher):
2425         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h: Added.
2426
2427 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
2428
2429         [GStreamer][EME] Base class for decryption support
2430         https://bugs.webkit.org/show_bug.cgi?id=162915
2431
2432         Reviewed by Xabier Rodriguez-Calvar.
2433
2434         Add common encryption base class.
2435
2436         This patch is authored by Philippe Normand <philn@igalia.com>.
2437
2438         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp: Added.
2439         (webkit_media_common_encryption_decrypt_class_init):
2440         (webkit_media_common_encryption_decrypt_init):
2441         (webKitMediaCommonEncryptionDecryptorFinalize):
2442         (webkitMediaCommonEncryptionDecryptTransformCaps):
2443         (webkitMediaCommonEncryptionDecryptTransformInPlace):
2444         (webkitMediaCommonEncryptionDecryptSinkEventHandler):
2445         (webKitMediaCommonEncryptionDecryptorChangeState):
2446         (webKitMediaCommonEncryptionDecryptDefaultSetupCipher):
2447         (webKitMediaCommonEncryptionDecryptDefaultReleaseCipher):
2448         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h: Added.
2449
2450 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
2451
2452         [GStreamer][EME] Utility function to create decryptor
2453         https://bugs.webkit.org/show_bug.cgi?id=162914
2454
2455         Reviewed by Xabier Rodriguez-Calvar.
2456
2457         Add a utility function to find a suitable GStreamer decryptor element.
2458
2459         This patch is authored by Philippe Normand <philn@igalia.com>.
2460
2461         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
2462         (WebCore::createGstDecryptor):
2463         (WebCore::gstRegistryHasElementForMediaType): Deleted.
2464         * platform/graphics/gstreamer/GStreamerUtilities.h:
2465
2466 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
2467
2468         [GStreamer][MSE][EME] Remove MSE code from regular player and add EME support
2469         https://bugs.webkit.org/show_bug.cgi?id=162911
2470
2471         Now that the MSE responsibility has been refactored to the dedicated
2472         MediaPlayerPrivateGStreamerMSE subclass, the regular player no longer needs the MSE code,
2473         just to expose some more methods to the subclass. Float timestamps have been migrated to
2474         double. Also, small changes to accomodate the EME support are needed.
2475
2476         This patch is co-authored with Philippe Normand <philn@igalia.com> (EME support) and
2477         Žan Doberšek <zandobersek@gmail.com> (double timestamps).
2478
2479         Reviewed by Xabier Rodriguez-Calvar.
2480
2481         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2482         (WebCore::busMessageCallback):
2483         (WebCore::MediaPlayerPrivateGStreamer::registerMediaEngine):
2484         (WebCore::initializeGStreamerAndRegisterWebKitElements):
2485         (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
2486         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
2487         (WebCore::MediaPlayerPrivateGStreamer::load):
2488         (WebCore::MediaPlayerPrivateGStreamer::playbackPosition):
2489         (WebCore::MediaPlayerPrivateGStreamer::durationMediaTime):
2490         (WebCore::MediaPlayerPrivateGStreamer::currentMediaTime):
2491         (WebCore::MediaPlayerPrivateGStreamer::seek):
2492         (WebCore::MediaPlayerPrivateGStreamer::doSeek):
2493         (WebCore::MediaPlayerPrivateGStreamer::paused):
2494         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo):
2495         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio):
2496         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfText):
2497         (WebCore::MediaPlayerPrivateGStreamer::buffered):
2498         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
2499         (WebCore::MediaPlayerPrivateGStreamer::processMpegTsSection):
2500         (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired):
2501         (WebCore::MediaPlayerPrivateGStreamer::maxTimeSeekable):
2502         (WebCore::MediaPlayerPrivateGStreamer::maxTimeLoaded):
2503         (WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress):
2504         (WebCore::MediaPlayerPrivateGStreamer::sourceChanged):
2505         (WebCore::MediaPlayerPrivateGStreamer::didEnd):
2506         (WebCore::MediaPlayerPrivateGStreamer::durationChanged):
2507         (WebCore::MediaPlayerPrivateGStreamer::supportsType):
2508         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
2509         (WebCore::MediaPlayerPrivateGStreamer::handleSyncMessage):
2510         (WebCore::MediaPlayerPrivateGStreamer::setAudioStreamProperties): Deleted.
2511         (WebCore::MediaPlayerPrivateGStreamer::commitLoad): Deleted.
2512         (WebCore::MediaPlayerPrivateGStreamer::pause): Deleted.
2513         (WebCore::MediaPlayerPrivateGStreamer::videoChangedCallback): Deleted.
2514         (WebCore::MediaPlayerPrivateGStreamer::videoSinkCapsChangedCallback): Deleted.
2515         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideoCaps): Deleted.
2516         (WebCore::MediaPlayerPrivateGStreamer::setRate): Deleted.
2517         (WebCore::MediaPlayerPrivateGStreamer::processTableOfContentsEntry): Deleted.
2518         (WebCore::MediaPlayerPrivateGStreamer::totalBytes): Deleted.
2519         (WebCore::MediaPlayerPrivateGStreamer::loadNextLocation): Deleted.
2520         (WebCore::MediaPlayerPrivateGStreamer::loadStateChanged): Deleted.
2521         (WebCore::MediaPlayerPrivateGStreamer::timeChanged): Deleted.
2522         (WebCore::mimeTypeSet): Deleted.
2523         (WebCore::MediaPlayerPrivateGStreamer::createAudioSink): Deleted.
2524         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2525         (WebCore::MediaPlayerPrivateGStreamer::configurePlaySink):
2526         (WebCore::MediaPlayerPrivateGStreamer::isMediaSource):
2527         (WebCore::MediaPlayerPrivateGStreamer::createWeakPtr): Deleted.
2528
2529 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
2530
2531         [GStreamer][EME] Add EME support to base private player
2532         https://bugs.webkit.org/show_bug.cgi?id=162908
2533
2534         Reviewed by Xabier Rodriguez-Calvar.
2535
2536         Add encryption key management support.
2537
2538         This patch is authored by Philippe Normand <philn@igalia.com>.
2539
2540         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2541         (WebCore::registerWebKitGStreamerElements):
2542         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
2543         (WebCore::MediaPlayerPrivateGStreamerBase::needKey):
2544         (WebCore::MediaPlayerPrivateGStreamerBase::setCDMSession):
2545         (WebCore::MediaPlayerPrivateGStreamerBase::keyAdded):
2546         (WebCore::MediaPlayerPrivateGStreamerBase::createSession):
2547         (WebCore::MediaPlayerPrivateGStreamerBase::dispatchDecryptionKey):
2548         (WebCore::MediaPlayerPrivateGStreamerBase::supportsKeySystem):
2549         (WebCore::MediaPlayerPrivateGStreamerBase::extendedSupportsType):
2550         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase): Deleted.
2551         (WebCore::MediaPlayerPrivateGStreamerBase::setPipeline): Deleted.
2552         (WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement): Deleted.
2553         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2554         (WebCore::MediaPlayerPrivateGStreamerBase::pipeline):
2555
2556 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
2557
2558         [GStreamer][MSE] WebKitMediaSourceGStreamer refactoring
2559         https://bugs.webkit.org/show_bug.cgi?id=162902
2560
2561         Reviewed by Xabier Rodriguez-Calvar.
2562
2563         Move WebKitMediaSourceGStreamer to the mse directory, split public and private header
2564         sections, manage stream data throttling and seek synchronization, audio/video/text stream
2565         counting, improve GStreamer duration query, stream initialization, remove
2566         MediaSourceClientGStreamer logic (factored out to its own class in another patch) and
2567         interaction with MediaPlayerPrivateGStreamerMSE, PlaybackPipeline and
2568         SourceBufferPrivateGStreamer.
2569
2570         * platform/graphics/gstreamer/WebKitMediaSourceGStreamer.cpp: Removed.
2571         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp: Added.
2572         (disabledAppsrcNeedData):
2573         (disabledAppsrcEnoughData):
2574         (disabledAppsrcSeekData):
2575         (enabledAppsrcEnoughData):
2576         (enabledAppsrcSeekData):
2577         (getStreamByAppsrc):
2578         (webkit_media_src_init):
2579         (webKitMediaSrcFinalize):
2580         (webKitMediaSrcSetProperty):
2581         (webKitMediaSrcGetProperty):
2582         (webKitMediaSrcDoAsyncStart):
2583         (webKitMediaSrcDoAsyncDone):
2584         (webKitMediaSrcChangeState):
2585         (webKitMediaSrcGetSize):
2586         (webKitMediaSrcQueryWithParent):
2587         (webKitMediaSrcUpdatePresentationSize):
2588         (webKitMediaSrcLinkStreamToSrcPad):
2589         (webKitMediaSrcLinkParser):
2590         (webKitMediaSrcFreeStream):
2591         (webKitMediaSrcCheckAllTracksConfigured):
2592         (webKitMediaSrcUriGetType):
2593         (webKitMediaSrcGetProtocols):
2594         (webKitMediaSrcGetUri):
2595         (webKitMediaSrcSetUri):
2596         (webKitMediaSrcUriHandlerInit):
2597         (seekNeedsDataMainThread):
2598         (notifyReadyForMoreSamplesMainThread):
2599         (applicationMessageCallback):
2600         (webKitMediaSrcSetMediaPlayerPrivate):
2601         (webKitMediaSrcSetReadyForSamples):
2602         (webKitMediaSrcPrepareSeek):
2603         (WTF::adoptGRef):
2604         (WTF::refGPtr<WebKitMediaSrc>):
2605         (WTF::derefGPtr<WebKitMediaSrc>):
2606         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.h: Renamed from Source/WebCore/platform/graphics/gstreamer/WebKitMediaSourceGStreamer.h.
2607         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamerPrivate.h: Added.
2608
2609 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
2610
2611         [GStreamer][MSE] Playback pipeline
2612         https://bugs.webkit.org/show_bug.cgi?id=162901
2613
2614         Reviewed by Xabier Rodriguez-Calvar.
2615
2616         Encapsulate the responsibility to interact with the GStreamer playback pipeline and the
2617         different streams managed by the WebKitMediaSrc element into a new PlaybackPipeline class.
2618
2619         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp: Added.
2620         (getStreamByTrackId):
2621         (getStreamBySourceBufferPrivate):
2622         (pushSample):
2623         (WebCore::PlaybackPipeline::create):
2624         (WebCore::PlaybackPipeline::PlaybackPipeline):
2625         (WebCore::PlaybackPipeline::~PlaybackPipeline):
2626         (WebCore::PlaybackPipeline::setWebKitMediaSrc):
2627         (WebCore::PlaybackPipeline::webKitMediaSrc):
2628         (WebCore::PlaybackPipeline::addSourceBuffer):
2629         (WebCore::PlaybackPipeline::removeSourceBuffer):
2630         (WebCore::PlaybackPipeline::attachTrack):
2631         (WebCore::PlaybackPipeline::reattachTrack):
2632         (WebCore::PlaybackPipeline::notifyDurationChanged):
2633         (WebCore::PlaybackPipeline::markEndOfStream):
2634         (WebCore::PlaybackPipeline::flushAndEnqueueNonDisplayingSamples):
2635         (WebCore::PlaybackPipeline::enqueueSample):
2636         (WebCore::PlaybackPipeline::pipeline):
2637         * platform/graphics/gstreamer/mse/PlaybackPipeline.h: Added.
2638
2639 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
2640
2641         [GStreamer][MSE][EME] MSE specialization of Media Player Private for GStreamer
2642         https://bugs.webkit.org/show_bug.cgi?id=162900
2643
2644         Reviewed by Xabier Rodriguez-Calvar.
2645
2646         Refactor MSE-specific logic to its own GStreamer player. This new MSE player coordinates
2647         data appending, media playback and interaction with MediaSource by delegating to
2648         AppendPipeline (one instance per SourceBuffer), PlaybackPipeline and
2649         MediaSourceClientGStreamerMSE/MediaSourcePrivateClient respectively.
2650
2651         This patch is co-authored with Philippe Normand <philn@igalia.com> (EME support).
2652
2653         * platform/graphics/MediaPlayer.cpp:
2654         (WebCore::buildMediaEnginesVector):
2655         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: Added.
2656         (dumpReadyState):
2657         (WebCore::MediaPlayerPrivateGStreamerMSE::registerMediaEngine):
2658         (WebCore::initializeGStreamerAndRegisterWebKitMSEElement):
2659         (WebCore::MediaPlayerPrivateGStreamerMSE::isAvailable):
2660         (WebCore::MediaPlayerPrivateGStreamerMSE::MediaPlayerPrivateGStreamerMSE):
2661         (WebCore::MediaPlayerPrivateGStreamerMSE::~MediaPlayerPrivateGStreamerMSE):
2662         (WebCore::MediaPlayerPrivateGStreamerMSE::load):
2663         (WebCore::MediaPlayerPrivateGStreamerMSE::pause):
2664         (WebCore::MediaPlayerPrivateGStreamerMSE::durationMediaTime):
2665         (WebCore::MediaPlayerPrivateGStreamerMSE::seek):
2666         (WebCore::MediaPlayerPrivateGStreamerMSE::configurePlaySink):
2667         (WebCore::MediaPlayerPrivateGStreamerMSE::changePipelineState):
2668         (WebCore::MediaPlayerPrivateGStreamerMSE::notifySeekNeedsDataForTime):
2669         (WebCore::MediaPlayerPrivateGStreamerMSE::doSeek):
2670         (WebCore::MediaPlayerPrivateGStreamerMSE::maybeFinishSeek):
2671         (WebCore::MediaPlayerPrivateGStreamerMSE::updatePlaybackRate):
2672         (WebCore::MediaPlayerPrivateGStreamerMSE::seeking):
2673         (WebCore::MediaPlayerPrivateGStreamerMSE::setReadyState):
2674         (WebCore::MediaPlayerPrivateGStreamerMSE::waitForSeekCompleted):
2675         (WebCore::MediaPlayerPrivateGStreamerMSE::seekCompleted):
2676         (WebCore::MediaPlayerPrivateGStreamerMSE::setRate):
2677         (WebCore::MediaPlayerPrivateGStreamerMSE::buffered):
2678         (WebCore::MediaPlayerPrivateGStreamerMSE::sourceChanged):
2679         (WebCore::MediaPlayerPrivateGStreamerMSE::updateStates):
2680         (WebCore::MediaPlayerPrivateGStreamerMSE::asyncStateChangeDone):
2681         (WebCore::MediaPlayerPrivateGStreamerMSE::isTimeBuffered):
2682         (WebCore::MediaPlayerPrivateGStreamerMSE::setMediaSourceClient):
2683         (WebCore::MediaPlayerPrivateGStreamerMSE::mediaSourceClient):
2684         (WebCore::MediaPlayerPrivateGStreamerMSE::durationChanged):
2685         (WebCore::mimeTypeCache):
2686         (WebCore::MediaPlayerPrivateGStreamerMSE::getSupportedTypes):
2687         (WebCore::MediaPlayerPrivateGStreamerMSE::trackDetected):
2688         (WebCore::MediaPlayerPrivateGStreamerMSE::supportsType):
2689         (WebCore::MediaPlayerPrivateGStreamerMSE::dispatchDecryptionKey):
2690         (WebCore::MediaPlayerPrivateGStreamerMSE::markEndOfStream):
2691         (WebCore::MediaPlayerPrivateGStreamerMSE::currentMediaTime):
2692         (WebCore::MediaPlayerPrivateGStreamerMSE::maxTimeSeekable):
2693         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h: Added.
2694         (WebCore::MediaPlayerPrivateGStreamerMSE::mediaSourcePrivateClient):
2695
2696 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
2697
2698         [GStreamer][MSE] MediaSourceGStreamer refactoring
2699         https://bugs.webkit.org/show_bug.cgi?id=162899
2700
2701         Reviewed by Žan Doberšek.
2702
2703         Move MediaSourceGStreamer to the mse directory, manage SourceBufferPrivates and delegate WebKitMediaSrc operations to the MSE private player.
2704
2705         * platform/graphics/gstreamer/mse/MediaSourceGStreamer.cpp: Renamed from Source/WebCore/platform/graphics/gstreamer/MediaSourceGStreamer.cpp.
2706         (WebCore::MediaSourceGStreamer::open):
2707         (WebCore::MediaSourceGStreamer::MediaSourceGStreamer):
2708         (WebCore::MediaSourceGStreamer::~MediaSourceGStreamer):
2709         (WebCore::MediaSourceGStreamer::addSourceBuffer):
2710         (WebCore::MediaSourceGStreamer::removeSourceBuffer):
2711         (WebCore::MediaSourceGStreamer::durationChanged):
2712         (WebCore::MediaSourceGStreamer::markEndOfStream):
2713         (WebCore::MediaSourceGStreamer::unmarkEndOfStream):
2714         (WebCore::MediaSourceGStreamer::readyState):
2715         (WebCore::MediaSourceGStreamer::setReadyState):
2716         (WebCore::MediaSourceGStreamer::waitForSeekCompleted):
2717         (WebCore::MediaSourceGStreamer::seekCompleted):
2718         (WebCore::MediaSourceGStreamer::sourceBufferPrivateDidChangeActiveState):
2719         (WebCore::MediaSourceGStreamer::buffered):
2720         * platform/graphics/gstreamer/mse/MediaSourceGStreamer.h: Renamed from Source/WebCore/platform/graphics/gstreamer/MediaSourceGStreamer.h.
2721
2722 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
2723
2724         [GStreamer][MSE] SourceBufferPrivateGStreamer refactoring
2725         https://bugs.webkit.org/show_bug.cgi?id=162898
2726
2727         Reviewed by Xabier Rodriguez-Calvar.
2728
2729         Moved SourceBufferPrivateGStreamer to an mse directory and added unimplemented features (abort, enqueueing and sample flow control).
2730
2731         * platform/graphics/gstreamer/SourceBufferPrivateGStreamer.cpp: Removed.
2732         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp: Added.
2733         (WebCore::SourceBufferPrivateGStreamer::create):
2734         (WebCore::SourceBufferPrivateGStreamer::SourceBufferPrivateGStreamer):
2735         (WebCore::SourceBufferPrivateGStreamer::~SourceBufferPrivateGStreamer):
2736         (WebCore::SourceBufferPrivateGStreamer::setClient):
2737         (WebCore::SourceBufferPrivateGStreamer::append):
2738         (WebCore::SourceBufferPrivateGStreamer::abort):
2739         (WebCore::SourceBufferPrivateGStreamer::resetParserState):
2740         (WebCore::SourceBufferPrivateGStreamer::removedFromMediaSource):
2741         (WebCore::SourceBufferPrivateGStreamer::readyState):
2742         (WebCore::SourceBufferPrivateGStreamer::setReadyState):
2743         (WebCore::SourceBufferPrivateGStreamer::flushAndEnqueueNonDisplayingSamples):
2744         (WebCore::SourceBufferPrivateGStreamer::enqueueSample):
2745         (WebCore::SourceBufferPrivateGStreamer::isReadyForMoreSamples):
2746         (WebCore::SourceBufferPrivateGStreamer::setReadyForMoreSamples):
2747         (WebCore::SourceBufferPrivateGStreamer::notifyReadyForMoreSamples):
2748         (WebCore::SourceBufferPrivateGStreamer::setActive):
2749         (WebCore::SourceBufferPrivateGStreamer::stopAskingForMoreSamples):
2750         (WebCore::SourceBufferPrivateGStreamer::notifyClientWhenReadyForMoreSamples):
2751         (WebCore::SourceBufferPrivateGStreamer::didReceiveInitializationSegment):
2752         (WebCore::SourceBufferPrivateGStreamer::didReceiveSample):
2753         (WebCore::SourceBufferPrivateGStreamer::didReceiveAllPendingSamples):
2754         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h: Renamed from Source/WebCore/platform/graphics/gstreamer/SourceBufferPrivateGStreamer.h.
2755
2756 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
2757
2758         [GStreamer][MSE] MediaSourceClientGStreamerMSE
2759         https://bugs.webkit.org/show_bug.cgi?id=162896
2760
2761         Reviewed by Xabier Rodriguez-Calvar.
2762
2763         This class encapsulates the MediaSource interaction responsibility for the
2764         GStreamer platform.
2765
2766         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp: Added.
2767         (WebCore::MediaSourceClientGStreamerMSE::create):
2768         (WebCore::MediaSourceClientGStreamerMSE::MediaSourceClientGStreamerMSE):
2769         (WebCore::MediaSourceClientGStreamerMSE::~MediaSourceClientGStreamerMSE):
2770         (WebCore::MediaSourceClientGStreamerMSE::addSourceBuffer):
2771         (WebCore::MediaSourceClientGStreamerMSE::duration):
2772         (WebCore::MediaSourceClientGStreamerMSE::durationChanged):
2773         (WebCore::MediaSourceClientGStreamerMSE::abort):
2774         (WebCore::MediaSourceClientGStreamerMSE::append):
2775         (WebCore::MediaSourceClientGStreamerMSE::markEndOfStream):
2776         (WebCore::MediaSourceClientGStreamerMSE::removedFromMediaSource):
2777         (WebCore::MediaSourceClientGStreamerMSE::flushAndEnqueueNonDisplayingSamples):
2778         (WebCore::MediaSourceClientGStreamerMSE::enqueueSample):
2779         (WebCore::MediaSourceClientGStreamerMSE::webKitMediaSrc):
2780         (WebCore::MediaSourceClientGStreamerMSE::clearPlayerPrivate):
2781         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h: Added.
2782
2783 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
2784
2785         [GStreamer] GStreamer Media Sample
2786         https://bugs.webkit.org/show_bug.cgi?id=162894
2787
2788         Reviewed by Xabier Rodriguez-Calvar.
2789
2790         Implement the MediaSample interface for the GStreamer platform.
2791
2792         * platform/graphics/gstreamer/mse/GStreamerMediaSample.cpp: Added.
2793         (WebCore::GStreamerMediaSample::GStreamerMediaSample):
2794         (WebCore::GStreamerMediaSample::create):
2795         (WebCore::GStreamerMediaSample::createFakeSample):
2796         (WebCore::GStreamerMediaSample::applyPtsOffset):
2797         (WebCore::GStreamerMediaSample::offsetTimestampsBy):
2798         (WebCore::GStreamerMediaSample::~GStreamerMediaSample):
2799         * platform/graphics/gstreamer/mse/GStreamerMediaSample.h: Added.
2800         (WebCore::GStreamerMediaSample::presentationTime):
2801         (WebCore::GStreamerMediaSample::decodeTime):
2802         (WebCore::GStreamerMediaSample::duration):
2803         (WebCore::GStreamerMediaSample::trackID):
2804         (WebCore::GStreamerMediaSample::setTrackID):
2805         (WebCore::GStreamerMediaSample::sizeInBytes):
2806         (WebCore::GStreamerMediaSample::sample):
2807         (WebCore::GStreamerMediaSample::presentationSize):
2808         (WebCore::GStreamerMediaSample::setTimestamps):
2809         (WebCore::GStreamerMediaSample::isDivisable):
2810         (WebCore::GStreamerMediaSample::divide):
2811         (WebCore::GStreamerMediaSample::flags):
2812         (WebCore::GStreamerMediaSample::platformSample):
2813         (WebCore::GStreamerMediaSample::dump):
2814
2815 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
2816
2817         [GStreamer] GStreamer Media Description
2818         https://bugs.webkit.org/show_bug.cgi?id=162893
2819
2820         Reviewed by Xabier Rodriguez-Calvar.
2821
2822         Implement the MediaDescription interface for the GStreamer platform.
2823
2824         * platform/graphics/gstreamer/mse/GStreamerMediaDescription.cpp: Added.
2825         (WebCore::GStreamerMediaDescription::codec):
2826         (WebCore::GStreamerMediaDescription::isVideo):
2827         (WebCore::GStreamerMediaDescription::isAudio):
2828         (WebCore::GStreamerMediaDescription::isText):
2829         * platform/graphics/gstreamer/mse/GStreamerMediaDescription.h: Added.
2830         (WebCore::GStreamerMediaDescription::create):
2831         (WebCore::GStreamerMediaDescription::~GStreamerMediaDescription):
2832         (WebCore::GStreamerMediaDescription::GStreamerMediaDescription):
2833
2834 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
2835
2836         [GStreamer][MSE][EME] Append Pipeline
2837         https://bugs.webkit.org/show_bug.cgi?id=162874
2838
2839         Reviewed by Žan Doberšek.
2840
2841         This patch is co-authored with Xabier Rodriguez-Calvar <calvaris@igalia.com> (data starve
2842         and last sample detection, debug features) and Philippe Normand <philn@igalia.com> (EME
2843         support).
2844
2845         * platform/graphics/gstreamer/mse/AppendPipeline.cpp: Added.
2846         (WebCore::dumpAppendState):
2847         (WebCore::appendPipelineElementMessageCallback):
2848         (WebCore::appendPipelineApplicationMessageCallback):
2849         (WebCore::AppendPipeline::AppendPipeline):
2850         (WebCore::AppendPipeline::~AppendPipeline):
2851         (WebCore::AppendPipeline::clearPlayerPrivate):
2852         (WebCore::AppendPipeline::handleElementMessage):
2853         (WebCore::AppendPipeline::handleApplicationMessage):
2854         (WebCore::AppendPipeline::handleAppsrcNeedDataReceived):
2855         (WebCore::AppendPipeline::handleAppsrcAtLeastABufferLeft):
2856         (WebCore::AppendPipeline::id):
2857         (WebCore::AppendPipeline::setAppendState):
2858         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
2859         (WebCore::AppendPipeline::appsinkCapsChanged):
2860         (WebCore::AppendPipeline::checkEndOfAppend):
2861         (WebCore::AppendPipeline::appsinkNewSample):
2862         (WebCore::AppendPipeline::appsinkEOS):
2863         (WebCore::AppendPipeline::didReceiveInitializationSegment):
2864         (WebCore::AppendPipeline::trackId):
2865         (WebCore::AppendPipeline::resetPipeline):
2866         (WebCore::AppendPipeline::setAppsrcDataLeavingProbe):
2867         (WebCore::AppendPipeline::removeAppsrcDataLeavingProbe):
2868         (WebCore::AppendPipeline::abort):
2869         (WebCore::AppendPipeline::pushNewBuffer):
2870         (WebCore::AppendPipeline::reportAppsrcAtLeastABufferLeft):
2871         (WebCore::AppendPipeline::reportAppsrcNeedDataReceived):
2872         (WebCore::AppendPipeline::handleNewAppsinkSample):
2873         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
2874         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink):
2875         (WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread):
2876         (WebCore::appendPipelineAppsinkCapsChanged):
2877         (WebCore::appendPipelineAppsrcDataLeaving):
2878         (WebCore::appendPipelinePadProbeDebugInformation):
2879         (WebCore::appendPipelineAppsrcNeedData):
2880         (WebCore::appendPipelineDemuxerPadAdded):
2881         (WebCore::appendPipelineDemuxerPadRemoved):
2882         (WebCore::appendPipelineAppsinkNewSample):
2883         (WebCore::appendPipelineAppsinkEOS):
2884         * platform/graphics/gstreamer/mse/AppendPipeline.h: Added.
2885         (WebCore::AppendPipeline::appendState):
2886         (WebCore::AppendPipeline::mediaSourceClient):
2887         (WebCore::AppendPipeline::sourceBufferPrivate):
2888         (WebCore::AppendPipeline::bus):
2889         (WebCore::AppendPipeline::pipeline):
2890         (WebCore::AppendPipeline::appsrc):
2891         (WebCore::AppendPipeline::appsink):
2892         (WebCore::AppendPipeline::demuxerSrcPadCaps):
2893         (WebCore::AppendPipeline::appsinkCaps):
2894         (WebCore::AppendPipeline::track):
2895         (WebCore::AppendPipeline::streamType):
2896
2897 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
2898
2899         [GStreamer] Drain query support
2900         https://bugs.webkit.org/show_bug.cgi?id=162872
2901
2902         Reviewed by Žan Doberšek.
2903
2904         Under some circumstances, GStreamer deadlocks completely during MSE seeks on OpenGL ES
2905         systems. This is because the video sink still holds samples. Proper DRAIN support
2906         fixes this issue and is also good for all the platforms, not only OpenGL ES.
2907
2908         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2909         (WebCore::MediaPlayerPrivateGStreamerBase::triggerDrain):
2910         (WebCore::MediaPlayerPrivateGStreamerBase::drainCallback):
2911         (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink):
2912         (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSinkGL): Deleted.
2913         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2914         * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
2915         (VideoRenderRequestScheduler::drain):
2916         (webkitVideoSinkQuery):
2917         (webkitVideoSinkEvent):
2918         (webkit_video_sink_class_init):
2919         (VideoRenderRequestScheduler::stop): Deleted.
2920         (webkitVideoSinkProposeAllocation): Deleted.
2921
2922 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
2923
2924         [GStreamer] Track enhancements for MSE support
2925         https://bugs.webkit.org/show_bug.cgi?id=162869
2926
2927         Reviewed by Xabier Rodriguez-Calvar.
2928
2929         Add 'id' field to Audio/VideoTrackPrivateGStreamer. Make TrackPrivateBaseGStreamer
2930         work anyway in cases where the demuxer isn't contained in a GstPlaybin.
2931
2932         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
2933         (WebCore::AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer):
2934         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
2935         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
2936         (WebCore::TrackPrivateBaseGStreamer::tagsChanged):
2937         (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfActiveChanged):
2938         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
2939         (WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer):
2940         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
2941
2942 2016-10-26  Youenn Fablet  <youenn@apple.com>
2943
2944         Make CachedResourceLoader originsMatch check more efficient
2945         https://bugs.webkit.org/show_bug.cgi?id=163938
2946
2947         Reviewed by Darin Adler.
2948
2949         No change of behavior.
2950
2951         * loader/cache/CachedResourceLoader.cpp:
2952         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest):
2953         (WebCore::originsMatch): Moved to SecurityOrigin.cpp.
2954         * page/SecurityOrigin.cpp:
2955         (WebCore::areOriginsMatching): Helper routine to check whether origins are matching.
2956         (WebCore::originsMatch): Ensuring string comparison provides the same result as this function.
2957         * page/SecurityOrigin.h:
2958         (WebCore::SecurityOrigin::protocol):
2959         (WebCore::SecurityOrigin::host):
2960         (WebCore::SecurityOrigin::domain):
2961
2962 2016-10-25  Yusuke Suzuki  <utatane.tea@gmail.com>
2963
2964         [DOMJIT] Tell IDL result type to DFG to drop type checks in AI
2965         https://bugs.webkit.org/show_bug.cgi?id=163900
2966
2967         Reviewed by Sam Weinig.
2968
2969         Add TestDOMJIT.idl for bindings generation tests.
2970
2971         * bindings/scripts/CodeGeneratorJS.pm:
2972         (GetResultTypeFilter):
2973         (GenerateImplementation):
2974         * bindings/scripts/test/JS/JSTestDOMJIT.cpp: Added.
2975         (WebCore::JSTestDOMJITPrototype::create):
2976         (WebCore::JSTestDOMJITPrototype::createStructure):
2977         (WebCore::JSTestDOMJITPrototype::JSTestDOMJITPrototype):
2978         (WebCore::JSTestDOMJITConstructor::prototypeForStructure):
2979         (WebCore::JSTestDOMJITConstructor::initializeProperties):
2980         (WebCore::JSTestDOMJITPrototype::finishCreation):
2981         (WebCore::JSTestDOMJIT::JSTestDOMJIT):
2982         (WebCore::JSTestDOMJIT::createPrototype):
2983         (WebCore::JSTestDOMJIT::prototype):
2984         (WebCore::BindingCaller<JSTestDOMJIT>::castForAttribute):
2985         (WebCore::jsTestDOMJITAnyAttr):
2986         (WebCore::jsTestDOMJITAnyAttrGetter):
2987         (WebCore::TestDOMJITAnyAttrDOMJIT::TestDOMJITAnyAttrDOMJIT):
2988         (WebCore::domJITGetterSetterForTestDOMJITAnyAttr):
2989         (WebCore::jsTestDOMJITBooleanAttr):
2990         (WebCore::jsTestDOMJITBooleanAttrGetter):
2991         (WebCore::TestDOMJITBooleanAttrDOMJIT::TestDOMJITBooleanAttrDOMJIT):
2992         (WebCore::domJITGetterSetterForTestDOMJITBooleanAttr):
2993         (WebCore::jsTestDOMJITByteAttr):
2994         (WebCore::jsTestDOMJITByteAttrGetter):
2995         (WebCore::TestDOMJITByteAttrDOMJIT::TestDOMJITByteAttrDOMJIT):
2996         (WebCore::domJITGetterSetterForTestDOMJITByteAttr):
2997         (WebCore::jsTestDOMJITOctetAttr):
2998         (WebCore::jsTestDOMJITOctetAttrGetter):
2999         (WebCore::TestDOMJITOctetAttrDOMJIT::TestDOMJITOctetAttrDOMJIT):
3000         (WebCore::domJITGetterSetterForTestDOMJITOctetAttr):
3001         (WebCore::jsTestDOMJITShortAttr):
3002         (WebCore::jsTestDOMJITShortAttrGetter):
3003         (WebCore::TestDOMJITShortAttrDOMJIT::TestDOMJITShortAttrDOMJIT):
3004         (WebCore::domJITGetterSetterForTestDOMJITShortAttr):
3005         (WebCore::jsTestDOMJITUnsignedShortAttr):
3006         (WebCore::jsTestDOMJITUnsignedShortAttrGetter):
3007         (WebCore::TestDOMJITUnsignedShortAttrDOMJIT::TestDOMJITUnsignedShortAttrDOMJIT):
3008         (WebCore::domJITGetterSetterForTestDOMJITUnsignedShortAttr):
3009         (WebCore::jsTestDOMJITLongAttr):
3010         (WebCore::jsTestDOMJITLongAttrGetter):
3011         (WebCore::TestDOMJITLongAttrDOMJIT::TestDOMJITLongAttrDOMJIT):
3012         (WebCore::domJITGetterSetterForTestDOMJITLongAttr):
3013         (WebCore::jsTestDOMJITUnsignedLongAttr):
3014         (WebCore::jsTestDOMJITUnsignedLongAttrGetter):
3015         (WebCore::TestDOMJITUnsignedLongAttrDOMJIT::TestDOMJITUnsignedLongAttrDOMJIT):
3016         (WebCore::domJITGetterSetterForTestDOMJITUnsignedLongAttr):
3017         (WebCore::jsTestDOMJITLongLongAttr):
3018         (WebCore::jsTestDOMJITLongLongAttrGetter):
3019         (WebCore::TestDOMJITLongLongAttrDOMJIT::TestDOMJITLongLongAttrDOMJIT):
3020         (WebCore::domJITGetterSetterForTestDOMJITLongLongAttr):
3021         (WebCore::jsTestDOMJITUnsignedLongLongAttr):
3022         (WebCore::jsTestDOMJITUnsignedLongLongAttrGetter):
3023         (WebCore::TestDOMJITUnsignedLongLongAttrDOMJIT::TestDOMJITUnsignedLongLongAttrDOMJIT):
3024         (WebCore::domJITGetterSetterForTestDOMJITUnsignedLongLongAttr):
3025         (WebCore::jsTestDOMJITFloatAttr):
3026         (WebCore::jsTestDOMJITFloatAttrGetter):
3027         (WebCore::TestDOMJITFloatAttrDOMJIT::TestDOMJITFloatAttrDOMJIT):
3028         (WebCore::domJITGetterSetterForTestDOMJITFloatAttr):
3029         (WebCore::jsTestDOMJITUnrestrictedFloatAttr):
3030         (WebCore::jsTestDOMJITUnrestrictedFloatAttrGetter):
3031         (WebCore::TestDOMJITUnrestrictedFloatAttrDOMJIT::TestDOMJITUnrestrictedFloatAttrDOMJIT):
3032         (WebCore::domJITGetterSetterForTestDOMJITUnrestrictedFloatAttr):
3033         (WebCore::jsTestDOMJITDoubleAttr):
3034         (WebCore::jsTestDOMJITDoubleAttrGetter):
3035         (WebCore::TestDOMJITDoubleAttrDOMJIT::TestDOMJITDoubleAttrDOMJIT):
3036         (WebCore::domJITGetterSetterForTestDOMJITDoubleAttr):
3037         (WebCore::jsTestDOMJITUnrestrictedDoubleAttr):
3038         (WebCore::jsTestDOMJITUnrestrictedDoubleAttrGetter):
3039         (WebCore::TestDOMJITUnrestrictedDoubleAttrDOMJIT::TestDOMJITUnrestrictedDoubleAttrDOMJIT):
3040         (WebCore::domJITGetterSetterForTestDOMJITUnrestrictedDoubleAttr):
3041         (WebCore::jsTestDOMJITDomStringAttr):
3042         (WebCore::jsTestDOMJITDomStringAttrGetter):
3043         (WebCore::TestDOMJITDomStringAttrDOMJIT::TestDOMJITDomStringAttrDOMJIT):
3044         (WebCore::domJITGetterSetterForTestDOMJITDomStringAttr):
3045         (WebCore::jsTestDOMJITByteStringAttr):
3046         (WebCore::jsTestDOMJITByteStringAttrGetter):
3047         (WebCore::TestDOMJITByteStringAttrDOMJIT::TestDOMJITByteStringAttrDOMJIT):
3048         (WebCore::domJITGetterSetterForTestDOMJITByteStringAttr):
3049         (WebCore::jsTestDOMJITUsvStringAttr):
3050         (WebCore::jsTestDOMJITUsvStringAttrGetter):
3051         (WebCore::TestDOMJITUsvStringAttrDOMJIT::TestDOMJITUsvStringAttrDOMJIT):
3052         (WebCore::domJITGetterSetterForTestDOMJITUsvStringAttr):
3053         (WebCore::jsTestDOMJITNodeAttr):
3054         (WebCore::jsTestDOMJITNodeAttrGetter):
3055         (WebCore::TestDOMJITNodeAttrDOMJIT::TestDOMJITNodeAttrDOMJIT):
3056         (WebCore::domJITGetterSetterForTestDOMJITNodeAttr):
3057         (WebCore::jsTestDOMJITBooleanNullableAttr):
3058         (WebCore::jsTestDOMJITBooleanNullableAttrGetter):
3059         (WebCore::TestDOMJITBooleanNullableAttrDOMJIT::TestDOMJITBooleanNullableAttrDOMJIT):
3060         (WebCore::domJITGetterSetterForTestDOMJITBooleanNullableAttr):
3061         (WebCore::jsTestDOMJITByteNullableAttr):
3062         (WebCore::jsTestDOMJITByteNullableAttrGetter):
3063         (WebCore::TestDOMJITByteNullableAttrDOMJIT::TestDOMJITByteNullableAttrDOMJIT):
3064         (WebCore::domJITGetterSetterForTestDOMJITByteNullableAttr):
3065         (WebCore::jsTestDOMJITOctetNullableAttr):
3066         (WebCore::jsTestDOMJITOctetNullableAttrGetter):
3067         (WebCore::TestDOMJITOctetNullableAttrDOMJIT::TestDOMJITOctetNullableAttrDOMJIT):
3068         (WebCore::domJITGetterSetterForTestDOMJITOctetNullableAttr):
3069         (WebCore::jsTestDOMJITShortNullableAttr):
3070         (WebCore::jsTestDOMJITShortNullableAttrGetter):
3071         (WebCore::TestDOMJITShortNullableAttrDOMJIT::TestDOMJITShortNullableAttrDOMJIT):
3072         (WebCore::domJITGetterSetterForTestDOMJITShortNullableAttr):
3073         (WebCore::jsTestDOMJITUnsignedShortNullableAttr):
3074         (WebCore::jsTestDOMJITUnsignedShortNullableAttrGetter):
3075         (WebCore::TestDOMJITUnsignedShortNullableAttrDOMJIT::TestDOMJITUnsignedShortNullableAttrDOMJIT):
3076         (WebCore::domJITGetterSetterForTestDOMJITUnsignedShortNullableAttr):
3077         (WebCore::jsTestDOMJITLongNullableAttr):
3078         (WebCore::jsTestDOMJITLongNullableAttrGetter):
3079         (WebCore::TestDOMJITLongNullableAttrDOMJIT::TestDOMJITLongNullableAttrDOMJIT):
3080         (WebCore::domJITGetterSetterForTestDOMJITLongNullableAttr):
3081         (WebCore::jsTestDOMJITUnsignedLongNullableAttr):
3082         (WebCore::jsTestDOMJITUnsignedLongNullableAttrGetter):
3083         (WebCore::TestDOMJITUnsignedLongNullableAttrDOMJIT::TestDOMJITUnsignedLongNullableAttrDOMJIT):
3084         (WebCore::domJITGetterSetterForTestDOMJITUnsignedLongNullableAttr):
3085         (WebCore::jsTestDOMJITLongLongNullableAttr):
3086         (WebCore::jsTestDOMJITLongLongNullableAttrGetter):
3087         (WebCore::TestDOMJITLongLongNullableAttrDOMJIT::TestDOMJITLongLongNullableAttrDOMJIT):
3088         (WebCore::domJITGetterSetterForTestDOMJITLongLongNullableAttr):
3089         (WebCore::jsTestDOMJITUnsignedLongLongNullableAttr):
3090         (WebCore::jsTestDOMJITUnsignedLongLongNullableAttrGetter):
3091         (WebCore::TestDOMJITUnsignedLongLongNullableAttrDOMJIT::TestDOMJITUnsignedLongLongNullableAttrDOMJIT):
3092         (WebCore::domJITGetterSetterForTestDOMJITUnsignedLongLongNullableAttr):
3093         (WebCore::jsTestDOMJITFloatNullableAttr):
3094         (WebCore::jsTestDOMJITFloatNullableAttrGetter):
3095         (WebCore::TestDOMJITFloatNullableAttrDOMJIT::TestDOMJITFloatNullableAttrDOMJIT):
3096         (WebCore::domJITGetterSetterForTestDOMJITFloatNullableAttr):
3097         (WebCore::jsTestDOMJITUnrestrictedFloatNullableAttr):
3098         (WebCore::jsTestDOMJITUnrestrictedFloatNullableAttrGetter):
3099         (WebCore::TestDOMJITUnrestrictedFloatNullableAttrDOMJIT::TestDOMJITUnrestrictedFloatNullableAttrDOMJIT):
3100         (WebCore::domJITGetterSetterForTestDOMJITUnrestrictedFloatNullableAttr):
3101         (WebCore::jsTestDOMJITDoubleNullableAttr):
3102         (WebCore::jsTestDOMJITDoubleNullableAttrGetter):
3103         (WebCore::TestDOMJITDoubleNullableAttrDOMJIT::TestDOMJITDoubleNullableAttrDOMJIT):
3104         (WebCore::domJITGetterSetterForTestDOMJITDoubleNullableAttr):
3105         (WebCore::jsTestDOMJITUnrestrictedDoubleNullableAttr):
3106         (WebCore::jsTestDOMJITUnrestrictedDoubleNullableAttrGetter):
3107         (WebCore::TestDOMJITUnrestrictedDoubleNullableAttrDOMJIT::TestDOMJITUnrestrictedDoubleNullableAttrDOMJIT):
3108         (WebCore::domJITGetterSetterForTestDOMJITUnrestrictedDoubleNullableAttr):
3109         (WebCore::jsTestDOMJITDomStringNullableAttr):
3110         (WebCore::jsTestDOMJITDomStringNullableAttrGetter):
3111         (WebCore::TestDOMJITDomStringNullableAttrDOMJIT::TestDOMJITDomStringNullableAttrDOMJIT):
3112         (WebCore::domJITGetterSetterForTestDOMJITDomStringNullableAttr):
3113         (WebCore::jsTestDOMJITByteStringNullableAttr):
3114         (WebCore::jsTestDOMJITByteStringNullableAttrGetter):
3115         (WebCore::TestDOMJITByteStringNullableAttrDOMJIT::TestDOMJITByteStringNullableAttrDOMJIT):
3116         (WebCore::domJITGetterSetterForTestDOMJITByteStringNullableAttr):
3117         (WebCore::jsTestDOMJITUsvStringNullableAttr):
3118         (WebCore::jsTestDOMJITUsvStringNullableAttrGetter):
3119         (WebCore::TestDOMJITUsvStringNullableAttrDOMJIT::TestDOMJITUsvStringNullableAttrDOMJIT):
3120         (WebCore::domJITGetterSetterForTestDOMJITUsvStringNullableAttr):
3121         (WebCore::jsTestDOMJITNodeNullableAttr):
3122         (WebCore::jsTestDOMJITNodeNullableAttrGetter):
3123         (WebCore::TestDOMJITNodeNullableAttrDOMJIT::TestDOMJITNodeNullableAttrDOMJIT):
3124         (WebCore::domJITGetterSetterForTestDOMJITNodeNullableAttr):
3125         (WebCore::jsTestDOMJITConstructor):
3126         (WebCore::setJSTestDOMJITConstructor):
3127         (WebCore::JSTestDOMJIT::getConstructor):
3128         (WebCore::JSTestDOMJIT::visitChildren):
3129         * bindings/scripts/test/JS/JSTestDOMJIT.h: Added.
3130         (WebCore::JSTestDOMJIT::create):
3131         (WebCore::JSTestDOMJIT::createStructure):
3132         (WebCore::JSTestDOMJIT::wrapped):
3133         (WebCore::JSTestDOMJIT::finishCreation):
3134         * bindings/scripts/test/TestDOMJIT.idl: Added.
3135
3136 2016-10-25  Brent Fulgham  <bfulgham@apple.com>
3137
3138         [Win] Unreviewed build fix.
3139
3140         * platform/graphics/GraphicsContext.h: Add missing declaration.
3141
3142 2016-10-25  Ryosuke Niwa  <rniwa@webkit.org>
3143
3144         Updating attribute by textContent must create a single mutation record and custom element reaction
3145         https://bugs.webkit.org/show_bug.cgi?id=164003
3146
3147         Reviewed by Chris Dumez.
3148
3149         The bug was caused by setTextContent not invoking setNodeValue for Attr nodes.
3150         Use setNodeValue to match the specification: https://dom.spec.whatwg.org/#dom-node-textcontent
3151
3152         Test: fast/dom/MutationObserver/text-content-on-attr.html
3153
3154         * dom/Node.cpp:
3155         (WebCore::Node::setTextContent):
3156
3157 2016-10-25  Brent Fulgham  <bfulgham@apple.com>
3158
3159         [Win][Direct2D] Use smart pointers for Direct2D Path types
3160         https://bugs.webkit.org/show_bug.cgi?id=163994
3161
3162         Reviewed by Alex Christensen.
3163
3164         Tested by existing path tests.
3165
3166         * platform/graphics/Path.h:
3167         (WebCore::Path::platformPath): Use a COMPtr for m_path.
3168         * platform/graphics/win/GraphicsContextDirect2D.cpp:
3169         (WebCore::GraphicsContext::systemFactory): Present better D2D debug output
3170         when running a debug build.
3171         (WebCore::GraphicsContext::platformInit): Initialize a D2D device from a
3172         native GDI device context.
3173         (WebCore::GraphicsContext::platformStrokeStyle): Added.
3174         (WebCore::GraphicsContext::clipBounds): Simplify clip boundary calculations and
3175         avoid doing math on infinities.
3176         * platform/graphics/win/PathDirect2D.cpp:
3177         (WebCore::scratchRenderTarget): Added.
3178         (WebCore::Path::~Path): Switch to COMPtr implementation.
3179         (WebCore::Path::ensurePlatformPath): Ditto.
3180         (WebCore::Path::appendGeometry): Ditto.
3181         (WebCore::Path::operator=): Ditto.
3182         (WebCore::Path::initializePathState): Ditto.
3183         (WebCore::Path::strokeContains): Provide an implementation.
3184         (WebCore::Path::transform): Ditto.
3185         (WebCore::Path::addEllipse): No need for explicit construction of the
3186         D2D1::Point2F object.
3187         (WebCore::Path::clear): Switch to COMPtr implementation.
3188
3189 2016-10-25  Nan Wang  <n_wang@apple.com>
3190
3191         LayoutTest accessibility/mac/meter-gauge-value-description.html failing
3192         https://bugs.webkit.org/show_bug.cgi?id=163997
3193         <rdar://problem/28948637>
3194
3195         Reviewed by Chris Fleizach.
3196
3197         I hand-edited the Localizable.strings file in a previous patch and my changes
3198         were replaced by running update-webkit-localizable-strings script. Changed the
3199         key to be the same as the value to keep consistency with other entries.
3200
3201         Re-enabled the failing test.
3202
3203         * English.lproj/Localizable.strings:
3204         * platform/LocalizedStrings.cpp:
3205         (WebCore::AXMeterGaugeRegionOptimumText):
3206         (WebCore::AXMeterGaugeRegionSuboptimalText):
3207         (WebCore::AXMeterGaugeRegionLessGoodText):
3208
3209 2016-10-25  Filip Pizlo  <fpizlo@apple.com>
3210
3211         HeapTimer should not hardcode all of its subclasses and USE(CF) shouldn't be a bizarre special case
3212         https://bugs.webkit.org/show_bug.cgi?id=163947
3213
3214         Reviewed by Geoffrey Garen.
3215
3216         No new tests because no new behavior.
3217
3218         * platform/ios/WebSafeGCActivityCallbackIOS.h:
3219         * platform/ios/WebSafeIncrementalSweeperIOS.h:
3220
3221 2016-10-25  Dave Hyatt  <hyatt@apple.com>
3222
3223         [CSS Parser] Improvements to selector parsing
3224         https://bugs.webkit.org/show_bug.cgi?id=163964
3225
3226         Reviewed by Zalan Bujtas.
3227
3228         * css/CSSSelector.cpp:
3229         (WebCore::CSSSelector::setAttribute):
3230         (WebCore::CSSSelector::setNth):
3231         * css/CSSSelector.h:
3232         (WebCore::CSSSelector::setAttributeValueMatchingIsCaseInsensitive):
3233         * css/StyleSheetContents.cpp:
3234         (WebCore::StyleSheetContents::StyleSheetContents):
3235         (WebCore::StyleSheetContents::parserAppendRule):
3236         (WebCore::StyleSheetContents::ruleAt):
3237         (WebCore::StyleSheetContents::ruleCount):
3238         (WebCore::StyleSheetContents::clearRules):
3239         (WebCore::StyleSheetContents::wrapperInsertRule):
3240         (WebCore::StyleSheetContents::wrapperDeleteRule):
3241         * css/StyleSheetContents.h:
3242         * css/parser/CSSParser.cpp:
3243         (WebCore::CSSParserContext::CSSParserContext):
3244         (WebCore::CSSParser::parseSelector):
3245         * css/parser/CSSParserValues.h:
3246         (WebCore::CSSParserSelector::setAttribute):
3247         (WebCore::CSSParserSelector::setArgument):
3248         (WebCore::CSSParserSelector::setNth):
3249         * css/parser/CSSSelectorParser.cpp:
3250         (WebCore::consumeLangArgumentList):
3251         (WebCore::CSSSelectorParser::consumeCompoundSelector):
3252         (WebCore::CSSSelectorParser::consumeAttribute):
3253         (WebCore::isPseudoClassFunction):
3254         (WebCore::isPseudoElementFunction):
3255         (WebCore::CSSSelectorParser::consumePseudo):
3256         (WebCore::CSSSelectorParser::consumeCombinator):
3257
3258 2016-10-25  Beth Dakin  <bdakin@apple.com>
3259
3260         Numbered list should be represented without ‘…’
3261         https://bugs.webkit.org/show_bug.cgi?id=163992
3262         -and corresponding-
3263         rdar://problem/28911337
3264
3265         Reviewed by Darin Adler.
3266
3267         * English.lproj/Localizable.strings:
3268         * platform/LocalizedStrings.cpp:
3269         (WebCore::insertListTypeNumbered):
3270
3271 2016-10-25  Daniel Bates  <dabates@apple.com>
3272
3273         REGRESSION (r178265): XSS Auditor fails to block document.write() of incomplete tag
3274         https://bugs.webkit.org/show_bug.cgi?id=163978
3275         <rdar://problem/25962131>
3276
3277         Reviewed by Darin Adler.
3278
3279         During the tokenization process of an HTML tag the start and end positions of each of its
3280         attributes is tracked so that the XSS Auditor can request a snippet around a suspected
3281         injected attribute. We need to take care to consider document.write() boundaries when
3282         tracking the start and end positions of each HTML tag and attribute so that the XSS Auditor
3283         receives the correct snippet. Following r178265 we no longer consider document.write()
3284         boundaries when tracking the start and end positions of attributes. So, the substring
3285         represented by the start and end positions of an attribute may correspond to some other
3286         attribute in the tag. Therefore the XSS Auditor may fail to block an injection because the
3287         snippet it requested may not be the snippet that it intended to request.
3288
3289         Tests: http/tests/security/xssAuditor/dom-write-location-dom-write-open-img-onerror.html
3290                http/tests/security/xssAuditor/dom-write-location-open-img-onerror.html
3291                http/tests/security/xssAuditor/nested-dom-write-location-open-img-onerror.html
3292
3293         * html/parser/HTMLSourceTracker.cpp:
3294         (WebCore::HTMLSourceTracker::startToken): Set the attribute base offset to be the token
3295         start position.
3296         (WebCore::HTMLSourceTracker::source): Use the specified attribute start position as-is. We no
3297         longer adjust it here because it was adjusted with respect to the attribute base offset, which
3298         takes into account document.write() boundaries.
3299         * html/parser/HTMLToken.h:
3300         (WebCore::HTMLToken::setAttributeBaseOffset): Added.
3301         (WebCore::HTMLToken::beginAttribute): Subtract attribute base offset from the specified offset.
3302         (WebCore::HTMLToken::endAttribute): Ditto.
3303         * html/parser/HTMLTokenizer.h:
3304         (WebCore::HTMLTokenizer::setTokenAttributeBaseOffset): Added.
3305
3306 2016-10-25  Chris Dumez  <cdumez@apple.com>
3307
3308         IDBDatabase.transaction() should take a union in parameter
3309         https://bugs.webkit.org/show_bug.cgi?id=163966
3310
3311         Reviewed by Sam Weinig.
3312
3313         IDBDatabase.transaction() should take a union in parameter:
3314         - https://www.w3.org/TR/IndexedDB/#widl-IDBDatabase-transaction-IDBTransaction-DOMString-sequence-DOMString--storeNames-IDBTransactionMode-mode
3315
3316         No new tests, no expected Web-exposed behavior change.
3317
3318         * Modules/indexeddb/IDBDatabase.cpp:
3319         (WebCore::IDBDatabase::transaction):
3320         * Modules/indexeddb/IDBDatabase.h:
3321         * Modules/indexeddb/IDBDatabase.idl:
3322
3323 2016-10-25  Brady Eidson  <beidson@apple.com>
3324
3325         IndexedDB 2.0: Support IDBObjectStore openKeyCursor.
3326         <rdar://problem/28806930> and https://bugs.webkit.org/show_bug.cgi?id=163954
3327
3328         Reviewed by Andy Estes.
3329
3330         No new tests (Covered by changes to existing tests)
3331
3332         * Modules/indexeddb/IDBCursor.cpp:
3333         (WebCore::IDBCursor::create):
3334         * Modules/indexeddb/IDBCursor.h:
3335
3336         * Modules/indexeddb/IDBObjectStore.cpp:
3337         (WebCore::IDBObjectStore::openCursor):
3338         (WebCore::IDBObjectStore::openKeyCursor):
3339         * Modules/indexeddb/IDBObjectStore.h:
3340         * Modules/indexeddb/IDBObjectStore.idl:
3341
3342         * Modules/indexeddb/IDBTransaction.cpp:
3343         (WebCore::IDBTransaction::requestOpenCursor):
3344
3345         * Modules/indexeddb/server/MemoryObjectStoreCursor.cpp:
3346         (WebCore::IDBServer::MemoryObjectStoreCursor::currentData): Only grab the current value
3347           if the cursor is KeyAndValue.
3348
3349         * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
3350         (WebCore::IDBServer::SQLiteIDBCursor::SQLiteIDBCursor):
3351         (WebCore::IDBServer::SQLiteIDBCursor::internalAdvanceOnce): Only save off the data for an
3352           object store cursor if it's both KeyAndValue.
3353         * Modules/indexeddb/server/SQLiteIDBCursor.h:
3354
3355         * Modules/indexeddb/shared/IDBCursorInfo.cpp:
3356         (WebCore::IDBCursorInfo::objectStoreCursor): Allow for a KeyOnly ObjectStoreCursor.
3357         * Modules/indexeddb/shared/IDBCursorInfo.h:
3358
3359 2016-10-25  Wenson Hsieh  <wenson_hsieh@apple.com>
3360
3361         Support InputEvent.dataTransfer for the InputEvent spec
3362         https://bugs.webkit.org/show_bug.cgi?id=163213
3363         <rdar://problem/28700407>
3364
3365         Reviewed by Ryosuke Niwa.
3366
3367         Adds support for the dataTransfer attribute of InputEvent, which contains both HTML and plain text
3368         representations of inserted content corresponding to input types "insertFromPaste", "insertFromDrop" and
3369         "insertReplacementText". The specification calls for the data transfer's drag data item list to contain this
3370         information via two entries with type strings "text/html" and "text/plain". However, WebKit does not yet support
3371         the DataTransfer.items -- in lieu of this, we will provide this information for now via getData("text/plain")
3372         and getData("text/html"), respectively.
3373
3374         To support this attribute, we need a special type of DataTransfer which is readonly and returns canned data
3375         given a type string. To implement this, we introduce StaticPasteboard, a type of Pasteboard which is initialized
3376         with a map of type string to data. When asked for its data via getData, the StaticPasteboard searches its map
3377         for the requested type and returns the result, if any.
3378
3379         An editing command may now create a new DataTransfer via DataTransfer::createForInputEvent from HTML and
3380         plaintext strings, and then vend this information to its dispatched input events by overriding
3381         CompositeEditCommand::inputEventDataTransfer.
3382
3383         Some further work will be needed to ensure that all information exposed via this DataTransfer does not contain
3384         hidden content. To do this, we should create a new Document, "paste" the contents of our copied HTML string into
3385         it, then simulate selecting the content and generating markup from the selection to create a sanitized
3386         DocumentFragment corresponding to the original copied HTML. This will be addressed in a future patch.
3387
3388         Tests: fast/events/input-events-paste-rich-datatransfer.html
3389                fast/events/input-events-spell-checking-datatransfer.html
3390
3391         * PlatformEfl.cmake:
3392         * PlatformGTK.cmake:
3393         * PlatformWin.cmake:
3394
3395         Add StaticPasteboard.cpp.
3396
3397         * WebCore.xcodeproj/project.pbxproj:
3398         * dom/DataTransfer.cpp:
3399         (WebCore::DataTransfer::DataTransfer):
3400         (WebCore::DataTransfer::createForInputEvent):
3401
3402         Initializes a new DataTransfer for the purposes of input events. This takes a HTML and plain text
3403         representations of the data being inserted and creates a new readonly DataTransfer backed by a StaticPasteboard
3404         that only knows how to map the "text/plain" data type to the given plaintext string and "text/html" to the
3405         given HTML text.
3406
3407         * dom/DataTransfer.h:
3408         * dom/InputEvent.cpp:
3409         (WebCore::InputEvent::create):
3410         (WebCore::InputEvent::InputEvent):
3411         (WebCore::InputEvent::dataTransfer):
3412         * dom/InputEvent.h:
3413         * dom/InputEvent.idl:
3414
3415         Add the InputEvent.dataTransfer attribute.
3416
3417         * dom/Node.cpp:
3418         * editing/CompositeEditCommand.cpp:
3419         (WebCore::CompositeEditCommand::inputEventDataTransfer):
3420
3421         Add a new hook for CompositeEditCommands to vend a DataTransfer for the purposes of input events. By default,
3422         this is null.
3423
3424         * editing/CompositeEditCommand.h:
3425         * editing/Editor.cpp:
3426         (WebCore::dispatchBeforeInputEvent):
3427         (WebCore::dispatchInputEvent):
3428         (WebCore::dispatchBeforeInputEvents):
3429         (WebCore::dispatchInputEvents):
3430         (WebCore::Editor::willApplyEditing):
3431         (WebCore::Editor::appliedEditing):
3432         * editing/ReplaceRangeWithTextCommand.cpp:
3433         (WebCore::ReplaceRangeWithTextCommand::willApplyCommand):
3434         (WebCore::ReplaceRangeWithTextCommand::doApply):
3435         (WebCore::ReplaceRangeWithTextCommand::inputEventDataTransfer):
3436         * editing/ReplaceRangeWithTextCommand.h:
3437         * editing/ReplaceSelectionCommand.cpp:
3438         (WebCore::ReplaceSelectionCommand::willApplyCommand):
3439
3440         Initialize the ReplacementFragment here before applying the command, adjusting the DocumentFragment to be
3441         inserted in the process.
3442
3443         (WebCore::ReplaceSelectionCommand::doApply):
3444         (WebCore::ReplaceSelectionCommand::inputEventDataTransfer):
3445         (WebCore::ReplaceSelectionCommand::ensureReplacementFragment):
3446
3447         Returns the ReplacementFragment used to apply the command, initializing it if necessary and stripping extraneous
3448         nodes off of the document fragment in the process. Since ReplaceSelectionCommand may be used as a top-level
3449         editing command or a child of another CompositeEditCommand such as the ReplaceRangeWithTextCommand, the
3450         ReplacementFragment may be initialized either in willApplyCommand or in doApply.
3451
3452         * editing/ReplaceSelectionCommand.h:
3453         * editing/SpellingCorrectionCommand.cpp:
3454         (WebCore::SpellingCorrectionCommand::willApplyCommand):
3455         (WebCore::SpellingCorrectionCommand::doApply):
3456         (WebCore::SpellingCorrectionCommand::inputEventDataTransfer):
3457         * editing/SpellingCorrectionCommand.h:
3458
3459         Using the replacement text fragment, create and return a DataTransfer for input events.
3460
3461         * platform/Pasteboard.h:
3462         * platform/StaticPasteboard.cpp: Added.
3463         (WebCore::StaticPasteboard::create):
3464         (WebCore::StaticPasteboard::StaticPasteboard):
3465         (WebCore::StaticPasteboard::hasData):
3466         (WebCore::StaticPasteboard::types):
3467         (WebCore::StaticPasteboard::readString):
3468         * platform/StaticPasteboard.h: Copied from Source/WebCore/dom/InputEvent.cpp.
3469         * platform/efl/PasteboardEfl.cpp:
3470         (WebCore::Pasteboard::writeMarkup):
3471         (WebCore::Pasteboard::write):
3472         (WebCore::Pasteboard::read):
3473         * platform/gtk/PasteboardGtk.cpp:
3474         (WebCore::Pasteboard::writeMarkup):
3475         * platform/ios/PasteboardIOS.mm:
3476         (WebCore::Pasteboard::writeMarkup):
3477         * platform/mac/PasteboardMac.mm:
3478         (WebCore::Pasteboard::Pasteboard):
3479         (WebCore::Pasteboard::writeMarkup):
3480         * platform/win/PasteboardWin.cpp:
3481         (WebCore::Pasteboard::write):
3482         (WebCore::Pasteboard::read):
3483
3484         To account for virtual methods on Pasteboard, add implementations for methods that were previously defined but
3485         unimplemented on these platforms.
3486
3487 2016-10-25  Andy Estes  <aestes@apple.com>
3488
3489         Implement rel=noopener
3490         https://bugs.webkit.org/show_bug.cgi?id=155166
3491         <rdar://problem/25193787>
3492
3493         Reviewed by Brent Fulgham.
3494
3495         Added support for rel=noopener to a and area elements.
3496
3497         Tests: fast/dom/Window/a-rel-noopener.html
3498                fast/dom/Window/area-rel-noopener.html
3499
3500         * html/HTMLAnchorElement.cpp:
3501         (WebCore::HTMLAnchorElement::HTMLAnchorElement): Stopped initializing m_linkRelations to 0.
3502         (WebCore::HTMLAnchorElement::parseAttribute): Declared static AtomicStrings for "noreferrer"
3503         and "noopener", and created a SpaceSplitString from the rel attribute value to test for these
3504         two values.
3505         (WebCore::HTMLAnchorElement::hasRel): Updated to use OptionSet::contains().
3506         (WebCore::HTMLAnchorElement::relList): Added a check for "noopener".
3507         (WebCore::HTMLAnchorElement::handleClick): Passed NewFrameOpenerPolicy::Suppress to
3508         FrameLoader::urlSelected() if rel=noopener was specified.
3509         * html/HTMLAnchorElement.h: Changed the Relation enum to an enum class, removed unused enum
3510         values, and changed m_linkRelations from a 30-bit unsigned integer to an OptionSet<Relation>
3511         (HTMLAnchorElement is still 128 bytes on 64-bit).
3512         * loader/FrameLoader.cpp:
3513         (WebCore::FrameLoader::urlSelected): Changed to only compute a NewFrameOpenerPolicy from the
3514         referrer policy if an explicit NewFrameOpenerPolicy isn't specified. Removed the version of
3515         urlSelected() that did not take a downloadAttribute parameter.
3516         * loader/FrameLoader.h: Added an Optional<NewFrameOpenerPolicy> parameter to urlSelected(),
3517         and set a default argument for downloadAttribute instead of having a second version of
3518         urlSelected().
3519
3520 2016-10-25  Eric Carlson  <eric.carlson@apple.com>
3521
3522         [MediaStream] Add "has capture device" bit to media state flags
3523         https://bugs.webkit.org/show_bug.cgi?id=163952
3524
3525         Reviewed by Jer Noble.
3526
3527         No new tests, updated fast/mediastream/MediaStream-page-muted.html, media/muted-video-is-playing-audio.html,
3528         and webaudio/web-audio-is-playing.html.
3529
3530         * Modules/mediastream/MediaStream.cpp:
3531         (WebCore::MediaStream::mediaState): Set HasMediaCaptureDevice, only set HasActiveMediaCaptureDevice when
3532           actually producing data.
3533
3534         * page/MediaProducer.h: Add HasMediaCaptureDevice bit.
3535
3536         * testing/Internals.cpp:
3537         (WebCore::Internals::pageMediaState): Return a string representing MediaStateFlags.
3538         (WebCore::Internals::isPagePlayingAudio): Deleted.
3539         * testing/Internals.h:
3540         * testing/Internals.idl:
3541
3542 2016-10-25  Commit Queue  <commit-queue@webkit.org>
3543
3544         Unreviewed, rolling out r207827 and r207828.
3545         https://bugs.webkit.org/show_bug.cgi?id=163965
3546
3547         Caused LayoutTest webaudio/web-audio-is-playing.html to time
3548         out on macOS. (Requested by ryanhaddad on #webkit).
3549
3550         Reverted changesets:
3551
3552         "[MediaStream] Add "has capture device" bit to media state
3553         flags"
3554         https://bugs.webkit.org/show_bug.cgi?id=163952
3555         http://trac.webkit.org/changeset/207827
3556
3557         "[MediaStream] Add "has capture device" bit to media state
3558         flags"
3559         https://bugs.webkit.org/show_bug.cgi?id=163952
3560         http://trac.webkit.org/changeset/207828
3561
3562 2016-10-25  Antoine Quint  <graouts@apple.com>
3563
3564         [Modern Media Controls] Media Controller: skip back support
3565         https://bugs.webkit.org/show_bug.cgi?id=163725
3566         <rdar://problem/27989480>
3567
3568         Reviewed by Dean Jackson.
3569
3570         We introduce the SkipBackSupport class which brings support for skipping back
3571         30 seconds into the media by clicking on the skip back button in the media controls.
3572
3573         Test: http/tests/media/modern-media-controls/skip-back-support/skip-back-support-button-click.html
3574
3575         * Modules/modern-media-controls/js-files:
3576         * Modules/modern-media-controls/media/media-controller.js:
3577         (MediaController):
3578         * Modules/modern-media-controls/media/skip-back-support.js: Copied from Source/WebCore/Modules/modern-media-controls/media/media-controller.js.
3579         (SkipBackSupport.prototype.get control):
3580         (SkipBackSupport.prototype.buttonWasClicked):
3581         (SkipBackSupport):
3582         * WebCore.xcodeproj/project.pbxproj:
3583
3584 2016-10-25  Commit Queue  <commit-queue@webkit.org>
3585
3586         Unreviewed, rolling out r207578.
3587         https://bugs.webkit.org/show_bug.cgi?id=163962
3588
3589         Broke quip.com so that user can no longer type a space
3590         (Requested by rniwa on #webkit).
3591
3592         Reverted changeset:
3593
3594         "Add a plain space instead of &nbsp; between text nodes"
3595         https://bugs.webkit.org/show_bug.cgi?id=123163
3596         http://trac.webkit.org/changeset/207578
3597
3598 2016-10-25  Chris Dumez  <cdumez@apple.com>
3599
3600         LOG_WITH_STREAM() macro should not have a semi colon at the end
3601         https://bugs.webkit.org/show_bug.cgi?id=163951
3602
3603         Reviewed by Simon Fraser.
3604
3605         * platform/LogMacros.h:
3606
3607 2016-10-25  Chris Dumez  <cdumez@apple.com>
3608
3609         IDBObjectStore.createIndex() should take a union in parameter
3610         https://bugs.webkit.org/show_bug.cgi?id=163935
3611
3612         Reviewed by Darin Adler.
3613
3614         IDBObjectStore.createIndex() should take a union in parameter:
3615         - https://www.w3.org/TR/IndexedDB/#idl-def-IDBObjectStore
3616
3617         No new tests, no expected Web-exposed behavior change.
3618
3619         * Modules/indexeddb/IDBDatabase.cpp:
3620         (WebCore::IDBDatabase::createObjectStore):
3621         * Modules/indexeddb/IDBKeyPath.cpp:
3622         (WebCore::isIDBKeyPathValid):
3623         (WebCore::IDBKeyPath::isValid): Deleted.
3624         * Modules/indexeddb/IDBKeyPath.h:
3625         (WebCore::IDBKeyPath::isNull):
3626         * Modules/indexeddb/IDBObjectStore.cpp:
3627         (WebCore::IDBObjectStore::createIndex):
3628         * Modules/indexeddb/IDBObjectStore.h:
3629         * Modules/indexeddb/IDBObjectStore.idl:
3630
3631 2016-10-24  Sam Weinig  <sam@webkit.org>
3632
3633         [WebIDL] Move more types over to the new JSConverter based toJS functions
3634         https://bugs.webkit.org/show_bug.cgi?id=163920
3635
3636         Reviewed by Darin Adler.
3637
3638         - Adds WebIDL-extension type IDLDate, and use it for Date conversions.
3639         - Move JSDOMIterator over to using IDLType based conversions. Make them more
3640           explicit by adding a traits template argument which describes the iterator.
3641         - Add correct parsing for WebIDL iterable, parsing the parameter types into
3642           domTypes.
3643         - Support non-Optional nullable types via trait-like functions on IDLTypes.
3644
3645
3646         * bindings/generic/IDLTypes.h:
3647         (WebCore::IDLType::isNullValue):
3648         (WebCore::IDLType::extractValueFromNullable):
3649         (WebCore::IDLString::isNullValue):
3650         (WebCore::IDLString::extractValueFromNullable):
3651         (WebCore::IDLInterface::isNullValue):
3652         (WebCore::IDLInterface::extractValueFromNullable):
3653         (WebCore::IDLDate::isNullValue):
3654         (WebCore::IDLDate::extractValueFromNullable):
3655         Add isNullValue and extractValueFromNullable functions to allow non-Optional
3656         based nullable types.
3657         
3658         * Modules/plugins/QuickTimePluginReplacement.mm:
3659         (WebCore::QuickTimePluginReplacement::installReplacement):
3660         * bindings/js/IDBBindingUtilities.cpp:
3661         (WebCore::toJS):
3662         * bindings/js/JSCSSStyleDeclarationCustom.cpp:
3663         (WebCore::stylePropertyGetter):
3664         * bindings/js/JSCustomElementInterface.cpp:
3665         (WebCore::JSCustomElementInterface::invokeAttributeChangedCallback):
3666         Switch to IDLType based toJS.
3667
3668         * bindings/js/JSDOMBinding.cpp:
3669         (WebCore::jsStringOrNull): Deleted.
3670         (WebCore::jsDateOrNull): Deleted.
3671         * bindings/js/JSDOMBinding.h:
3672         (WebCore::jsPair): Deleted.
3673         (WebCore::toJSNullableString): Deleted.
3674         Remove now unusued toJS functions.
3675
3676         * bindings/js/JSDOMConvert.h:
3677         (WebCore::JSConverter<IDLNullable<T>>::convert):
3678         Use new functions to detect and extract nullable values.
3679
3680         (WebCore::Converter<IDLBufferSource>::convert):
3681         Moved to be with the other converters.
3682
3683         (WebCore::Converter<IDLDate>::convert):
3684         (WebCore::JSConverter<IDLDate>::convert):
3685         Added.
3686
3687         * bindings/js/JSDOMIterator.h:
3688         (WebCore::jsPair):
3689         (WebCore::iteratorCreate):
3690         (WebCore::IteratorTraits>::asJS):
3691         (WebCore::appendForEachArguments):
3692         (WebCore::iteratorForEach):
3693         (WebCore::IteratorTraits>::destroy):
3694         (WebCore::IteratorTraits>::next):
3695         (WebCore::IteratorTraits>::finishCreation):
3696         (WebCore::IteratorInspector::decltype): Deleted.
3697         (WebCore::IteratorInspector::test): Deleted.
3698         (WebCore::JSDOMIterator<JSWrapper>::asJS): Deleted.
3699         (WebCore::JSDOMIterator<JSWrapper>::destroy): Deleted.
3700         (WebCore::JSDOMIterator<JSWrapper>::next): Deleted.
3701         (WebCore::JSDOMIteratorPrototype<JSWrapper>::next): Deleted.
3702         (WebCore::JSDOMIteratorPrototype<JSWrapper>::finishCreation): Deleted.
3703         Switch to new Traits based model, and have the generated code pass in 
3704         the type (map or set) and key/value types. With the explicit types known,
3705         we can use the new toJS functions.
3706         
3707         Also, moved the jsPair functions here from JSDOMBinding.h, since this was
3708         the only place it was used.
3709
3710         * bindings/scripts/CodeGeneratorJS.pm:
3711         (GenerateImplementationIterableFunctions):
3712         Add iterator trait definition and update for new parameters to JSDOMIterator
3713         and JSDOMIteratorPrototype.
3714
3715         (GetBaseIDLType):
3716         Add IDLDate, and move IDLBufferSource up to the simple path.
3717
3718         (JSValueToNativeIsHandledByDOMConvert):
3719         Allow Date.
3720
3721         (JSValueToNative):
3722         Remove special case for Date.
3723
3724         (NativeToJSValueIsHandledByDOMConvert):
3725         Allow Date and remove restriction of nullable string-like types.
3726
3727         (NativeToJSValueDOMConvertNeedsState):
3728         Add Date to list of types needing state.
3729
3730         (NativeToJSValue):
3731         Remove special cases for Date and nullable-strings.
3732
3733         * bindings/scripts/IDLParser.pm:
3734         (parseOptionalIterableInterface):
3735         Add correct parsing of iterable.
3736
3737         * bindings/scripts/test/JS/JSTestIterable.cpp:
3738         * bindings/scripts/test/JS/JSTestNode.cpp:
3739         * bindings/scripts/test/JS/JSTestObj.cpp:
3740         Update test results.
3741
3742 2016-10-25  Eric Carlson  <eric.carlson@apple.com>
3743
3744         [MediaStream] Add "has capture device" bit to media state flags
3745         https://bugs.webkit.org/show_bug.cgi?id=163952
3746
3747         Reviewed by Jer Noble.
3748
3749         No new tests, updated fast/mediastream/MediaStream-page-muted.html and media/muted-video-is-playing-audio.html.
3750
3751         * Modules/mediastream/MediaStream.cpp:
3752         (WebCore::MediaStream::mediaState): Set HasMediaCaptureDevice, only set HasActiveMediaCaptureDevice when
3753           actually producing data.
3754
3755         * page/MediaProducer.h: Add HasMediaCaptureDevice bit.
3756
3757         * testing/Internals.cpp:
3758         (WebCore::Internals::pageMediaState): Return a string representing MediaStateFlags.
3759         (WebCore::Internals::isPagePlayingAudio): Deleted.
3760         * testing/Internals.h:
3761         * testing/Internals.idl:
3762
3763 2016-10-25  Brady Eidson  <beidson@apple.com>
3764
3765         IndexedDB 2.0: Support new IDBTransaction interfaces.
3766         <rdar://problem/28806928> and https://bugs.webkit.org/show_bug.cgi?id=163927
3767
3768         Reviewed by Sam Weinig.
3769
3770         Tests: storage/indexeddb/modern/idbtransaction-objectstores-1-private.html
3771                storage/indexeddb/modern/idbtransaction-objectstores-1.html
3772                At least partially passing results on 5 previously failed W3C tests.
3773
3774         The "new IDBTransaction interfaces" really just means adding the property IDBTransaction.objectStoreNames.
3775
3776         * Modules/indexeddb/IDBTransaction.cpp:
3777         (WebCore::IDBTransaction::objectStoreNames):
3778         * Modules/indexeddb/IDBTransaction.h:
3779         * Modules/indexeddb/IDBTransaction.idl:
3780
3781 2016-10-25  Youenn Fablet  <youenn@apple.com>
3782
3783         MediaEndpointConfiguration does not need to be refcounted
3784         https://bugs.webkit.org/show_bug.cgi?id=163888
3785
3786         Reviewed by Eric Carlson.
3787
3788         No change of behavior.
3789
3790         Updating MediaEndpoint to take a MediaEndpointConfiguration&& instead of a RefPtr<MediaEndpointConfiguration>&&.
3791         This allows ensuring that the configuration is not null and removes the need to ref-count it.
3792
3793         Removing ref-counting from MediaEndpointConfiguration and its related IceServer that is now a struct.
3794         Updated MediaEndpointOwr and mock implementations accordingly.
3795
3796         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
3797         (WebCore::MediaEndpointPeerConnection::setConfiguration):
3798         * platform/mediastream/MediaEndpoint.cpp:
3799         * platform/mediastream/MediaEndpoint.h:
3800         * platform/mediastream/MediaEndpointConfiguration.cpp:
3801         (WebCore::MediaEndpointConfiguration::MediaEndpointConfiguration):
3802         * platform/mediastream/MediaEndpointConfiguration.h:
3803         (WebCore::MediaEndpointConfiguration::iceServers):
3804         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
3805         (WebCore::MediaEndpointOwr::setConfiguration):
3806         (WebCore::MediaEndpointOwr::ensureTransportAgentAndTransceivers):
3807         * platform/mediastream/openwebrtc/MediaEndpointOwr.h:
3808         * platform/mock/MockMediaEndpoint.cpp:
3809         * platform/mock/MockMediaEndpoint.h:
3810
3811 2016-10-25  Youenn Fablet  <youenn@apple.com>
3812
3813         CachedResourceLoader should set headers of the HTTP request prior checking for the cache
3814         https://bugs.webkit.org/show_bug.cgi?id=163103
3815
3816         Reviewed by Darin Adler.
3817
3818         No expected change of behavior.
3819
3820         Moved referrer, user-agent, and origin headers setting to CachedResourceRequest/CachedResourceLoader before checking the cache.
3821         This allows simplifying vary header checks and is more inline with the fetch specification.
3822
3823         To compute the referrer value, we need to know whether the request is cross-origin.
3824         A helper function isRequestCrossOrigin is added for that purpose and is also used in CachedResource to set its initial response tainting.
3825
3826         We should disable setting user-agent and origin headers by FrameLoader for subresources since this is now done in CachedResourceLoader.
3827         This could be done as a follow-up patch.
3828
3829         * loader/cache/CachedResource.cpp:
3830         (WebCore::CachedResource::CachedResource):
3831         (WebCore::CachedResource::load):
3832         (WebCore::CachedResource::varyHeaderValuesMatch):
3833         (WebCore::addAdditionalRequestHeadersToRequest): Deleted.
3834         (WebCore::CachedResource::addAdditionalRequestHeaders): Deleted.
3835         * loader/cache/CachedResource.h:
3836         * loader/cache/CachedResourceLoader.cpp:
3837         (WebCore::CachedResourceLoader::updateHTTPRequestHeaders):
3838         (WebCore::CachedResourceLoader::requestResource):
3839         (WebCore::CachedResourceLoader::determineRevalidationPolicy):
3840         * loader/cache/CachedResourceLoader.h:
3841         * loader/cache/CachedResourceRequest.cpp:
3842         (WebCore::CachedResourceRequest::updateForAccessControl):
3843         (WebCore::CachedResourceRequest::updateReferrerOriginAndUserAgentHeaders):
3844         (WebCore::isRequestCrossOrigin):
3845         * loader/cache/CachedResourceRequest.h:
3846         (WebCore::CachedResourceRequest::setOrigin):
3847
3848 2016-10-25  Andreas Kling  <akling@apple.com>
3849
3850         More PassRefPtr purging in WebCore.
3851         <https://webkit.org/b/163895>
3852
3853         Reviewed by Antti Koivisto.
3854
3855         Remove PassRefPtr usage in RenderStyle, RenderTheme and Scrollbar, then fix up all the fallout.
3856
3857         * css/CSSComputedStyleDeclaration.cpp:
3858         (WebCore::contentToCSSValue):
3859         (WebCore::shapePropertyValue):
3860         (WebCore::ComputedStyleExtractor::propertyValue):
3861         * css/StyleBuilderConverter.h:
3862         (WebCore::StyleBuilderConverter::convertQuotes):
3863         * html/HTMLSelectElement.cpp:
3864         (WebCore::HTMLSelectElement::usesMenuList):
3865         (WebCore::HTMLSelectElement::platformHandleKeydownEvent):
3866         (WebCore::HTMLSelectElement::menuListDefaultEventHandler):
3867         * html/InputType.cpp:
3868         (WebCore::InputType::themeSupportsDataListUI):
3869         * html/TextFieldInputType.cpp:
3870         (WebCore::TextFieldInputType::shouldHaveSpinButton):
3871         (WebCore::TextFieldInputType::shouldHaveCapsLockIndicator):
3872         * loader/SubframeLoader.cpp:
3873         (WebCore::SubframeLoader::loadPlugin):
3874         * page/FrameView.cpp:
3875         (WebCore::FrameView::createScrollbar):
3876         * page/FrameView.h:
3877         * page/animation/CSSPropertyAnimation.cpp:
3878         (WebCore::RefCountedPropertyWrapper::RefCountedPropertyWrapper):
3879         (WebCore::PropertyWrapperClipPath::PropertyWrapperClipPath):
3880         (WebCore::PropertyWrapperShape::PropertyWrapperShape):
3881         (WebCore::StyleImagePropertyWrapper::StyleImagePropertyWrapper):
3882         (WebCore::FillLayerRefCountedPropertyWrapper::FillLayerRefCountedPropertyWrapper):
3883         (WebCore::FillLayerStyleImagePropertyWrapper::FillLayerStyleImagePropertyWrapper):
3884         * platform/PopupMenuClient.h:
3885         * platform/ScrollView.cpp:
3886         (WebCore::ScrollView::createScrollbar):
3887         * platform/ScrollView.h:
3888         * platform/Scrollbar.cpp:
3889         (WebCore::Scrollbar::createNativeScrollbar):
3890         * platform/Scrollbar.h:
3891         * rendering/FilterEffectRenderer.cpp:
3892         (WebCore::FilterEffectRenderer::buildReferenceFilter):
3893         * rendering/FilterEffectRenderer.h:
3894         * rendering/RenderLayer.cpp:
3895         (WebCore::RenderLayer::createScrollbar):
3896         (WebCore::RenderLayer::createLocalTransformState):
3897         (WebCore::RenderLayer::hitTestLayerByApplyingTransform):
3898         * rendering/RenderLayer.h:
3899         * rendering/RenderListBox.cpp:
3900         (WebCore::RenderListBox::createScrollbar):
3901         * rendering/RenderListBox.h:
3902         * rendering/RenderMenuList.cpp:
3903         (RenderMenuList::createScrollbar):
3904         * rendering/RenderMenuList.h:
3905         * rendering/RenderScrollbar.cpp:
3906         (WebCore::RenderScrollbar::createCustomScrollbar):
3907         * rendering/RenderScrollbar.h:
3908         * rendering/RenderSearchField.cpp:
3909         (WebCore::RenderSearchField::createScrollbar):
3910         * rendering/RenderSearchField.h:
3911         * rendering/RenderTheme.h:
3912         (WebCore::RenderTheme::defaultTheme):
3913         * rendering/RenderThemeEfl.cpp:
3914         (WebCore::RenderThemeEfl::create):
3915         (WebCore::RenderTheme::themeForPage):
3916         * rendering/RenderThemeEfl.h:
3917         * rendering/RenderThemeGtk.cpp:
3918         (WebCore::RenderTheme::themeForPage):
3919         * rendering/RenderThemeIOS.mm:
3920         (WebCore::RenderTheme::themeForPage):
3921         * rendering/RenderThemeMac.mm:
3922         (WebCore::RenderTheme::themeForPage):
3923         * rendering/RenderThemeWin.cpp:
3924         (WebCore::RenderTheme::themeForPage):
3925         * rendering/RenderWidget.cpp:
3926         (WebCore::RenderWidget::setWidget):
3927         * rendering/RenderWidget.h:
3928         * rendering/style/CursorData.h:
3929         (WebCore::CursorData::CursorData):
3930         (WebCore::CursorData::setImage):
3931         * rendering/style/FillLayer.h:
3932         (WebCore::FillLayer::setImage):
3933         * rendering/style/QuotesData.cpp:
3934         (WebCore::QuotesData::create):
3935         * rendering/style/QuotesData.h:
3936         * rendering/style/RenderStyle.cpp:
3937         (WebCore::RenderStyle::addCursor):
3938         (WebCore::RenderStyle::setCursorList):
3939         (WebCore::RenderStyle::setQuotes):
3940         (WebCore::RenderStyle::setWillChange):
3941         (WebCore::RenderStyle::setContent):
3942         (WebCore::RenderStyle::setListStyleImage):
3943         (WebCore::RenderStyle::setBorderImageSource):
3944         * rendering/style/RenderStyle.h:
3945         (WebCore::RenderStyle::setMaskImage):
3946         (WebCore::RenderStyle::setMaskBoxImageSource):
3947         (WebCore::RenderStyle::setBoxReflect):
3948         (WebCore::RenderStyle::setShapeOutside):
3949         (WebCore::RenderStyle::setClipPath):
3950         * rendering/style/StyleCachedImage.cpp:
3951         (WebCore::StyleCachedImage::cssValue):
3952         * rendering/style/StyleCachedImage.h:
3953         * rendering/style/StyleGeneratedImage.cpp:
3954         (WebCore::StyleGeneratedImage::cssValue):
3955         * rendering/style/StyleGeneratedImage.h:
3956         * rendering/style/StyleImage.h:
3957         * rendering/style/StyleMultiColData.h:
3958         * rendering/style/StyleRareInheritedData.h:
3959
3960 2016-10-24  Ryosuke Niwa  <rniwa@webkit.org>
3961
3962         Custom elements reactions should have a queue per element
3963         https://bugs.webkit.org/show_bug.cgi?id=163878
3964
3965         Reviewed by Antti Koivisto.
3966
3967         This patch splits the custom elements reaction queue into per element to match the latest HTML specifications:
3968         https://html.spec.whatwg.org/multipage/scripting.html#custom-element-reaction-queue
3969         and introduces the backup element queue:
3970         https://html.spec.whatwg.org/multipage/scripting.html#backup-element-queue
3971
3972         In terms of code changes, CustomElementReactionStack now holds onto ElementQueue, an ordered list of elements,
3973         and make each ElementRareData keep its own CustomElementReactionQueue. CustomElementReactionQueue is created
3974         for each custom element when it is synchronously constructed or enqueued to upgrade.
3975
3976         Because each reaction queue is now specific to each element, CustomElementReactionQueue instead of
3977         CustomElementReactionQueueItem stores JSCustomElementInterface.
3978
3979         The backup element queue is created as a singleton returned by CustomElementReactionStack's backupElementQueue,
3980         and ensureBackupQueue() schedules a new mirotask to process the backup queue when the