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