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