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