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