[CSS Parser] Eliminate in-place lowercasing in the parser.
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-12-04  Dave Hyatt  <hyatt@apple.com>
2
3         [CSS Parser] Eliminate in-place lowercasing in the parser.
4         https://bugs.webkit.org/show_bug.cgi?id=165368
5
6         Reviewed by Darin Adler.
7
8         Replace the in-place lowercasing that the parser does with new
9         mechanisms. In-place lowercasing ruins serialization and doesn't
10         work on CSS parsed from static strings. It also has the side effect
11         of mutating strings passed in from JavaScript like for querySelectorAll.
12
13         For class/id selectors, we now check if the string is lowercase or not.
14         If it contains uppercase ASCII characters, then we allocate the RareData
15         for the selector. RareData now has two fields instead of one for the value,
16         a matching value (all lowercase in quirks mode), and a serializing value (the
17         original string). Because this is done at the CSSSelector level, the old
18         parser has been patched as well for these cases.
19
20         In addition, in-place lowercasing was done for pseudo-elements, for
21         media query features, and for attr(). In all of these cases we do
22         lowercase converting by first checking if it's needed. Serialization will
23         not retain the original string in these cases, so we may want to revisit
24         these cases in the future and apply a solution similar to what we did for
25         selectors.
26
27         * css/CSSGrammar.y.in:
28         * css/CSSSelector.cpp:
29         (WebCore::CSSSelector::createRareData):
30         (WebCore::CSSSelector::selectorText):
31         (WebCore::CSSSelector::RareData::RareData):
32         (WebCore::CSSSelector::RareData::~RareData):
33         * css/CSSSelector.h:
34         (WebCore::CSSSelector::RareData::create):
35         (WebCore::CSSSelector::setValue):
36         (WebCore::CSSSelector::value):
37         (WebCore::CSSSelector::serializingValue):
38         * css/MediaQueryExp.cpp:
39         (WebCore::MediaQueryExpression::MediaQueryExpression):
40         * css/parser/CSSParserToken.cpp:
41         (WebCore::convertToASCIILowercaseInPlace): Deleted.
42         (WebCore::CSSParserToken::convertToASCIILowercaseInPlace): Deleted.
43         * css/parser/CSSParserToken.h:
44         * css/parser/CSSParserValues.h:
45         (WebCore::CSSParserSelector::setValue):
46         * css/parser/CSSPropertyParser.cpp:
47         (WebCore::consumeAttr):
48         * css/parser/CSSSelectorParser.cpp:
49         (WebCore::CSSSelectorParser::consumeId):
50         (WebCore::CSSSelectorParser::consumeClass):
51         (WebCore::CSSSelectorParser::consumePseudo):
52         * css/parser/MediaQueryParser.cpp:
53         (WebCore::MediaQueryParser::readFeature):
54
55 2016-12-04  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
56
57         Fix a build break on EFL since r209303.
58
59         Unreviewed build fix.
60
61         * bindings/js/SerializedScriptValue.cpp:
62         (WebCore::exceptionForSerializationFailure): Add a return in the end of function.
63
64 2016-12-03  Dan Bernstein  <mitz@apple.com>
65
66         [Cocoa] Expose InjectedBundlePageEditorClient via the Objective-C bundle SPI
67         https://bugs.webkit.org/show_bug.cgi?id=165276
68         <rdar://problem/29467040>
69
70         Reviewed by Darin Adler.
71
72         * platform/ios/PlatformPasteboardIOS.mm:
73         (WebCore::PlatformPasteboard::write): Make sure to put the client data on the pasteboard,
74           like we do on macOS.
75
76 2016-12-03  Dave Hyatt  <hyatt@apple.com>
77
78         [CSS Parser] Remove line numbers from StyleRule.
79         https://bugs.webkit.org/show_bug.cgi?id=165361
80
81         Reviewed by Simon Fraser.
82
83         StyleRules have a concept of a source line that is eventually passed
84         to the inspector. This was only ever used by normal rules, i.e., ones with
85         selectors, and set to 0 for all other rules. This line was set to the line number
86         at which the end of the selector text occurred.
87
88         Because Inspector already computes the start and end range for the selector
89         text, storing a source line on StyleRule ends up being redundant. This patch
90         gets rid of the source line and uses the end line of the selector text
91         instead.
92
93         * css/CSSGrammar.y.in:
94         Remove the code that updates the last seen selector line.
95
96         * css/CSSKeyframeRule.cpp:
97         (WebCore::StyleKeyframe::StyleKeyframe):
98         * css/CSSKeyframesRule.cpp:
99         (WebCore::StyleRuleKeyframes::StyleRuleKeyframes):
100         No longer need to pass in a 0 line number.
101
102         * css/StyleRule.cpp:
103         (WebCore::StyleRule::StyleRule):
104         (WebCore::StyleRule::create):
105         (WebCore::StyleRule::splitIntoMultipleRulesWithMaximumSelectorComponentCount):
106         (WebCore::StyleRuleFontFace::StyleRuleFontFace):
107         (WebCore::StyleRuleGroup::StyleRuleGroup):
108         (WebCore::StyleRuleCharset::StyleRuleCharset):
109         (WebCore::StyleRuleNamespace::StyleRuleNamespace):
110         * css/StyleRule.h:
111         (WebCore::StyleRuleBase::StyleRuleBase):
112         (WebCore::StyleRuleBase::sourceLine): Deleted.
113         * css/StyleRuleImport.cpp:
114         (WebCore::StyleRuleImport::StyleRuleImport):
115         Remove m_sourceLine and change the create methods and constructors to not
116         require a line number.
117
118         * css/parser/CSSParser.cpp:
119         (WebCore::CSSParser::createStyleRule):
120         Line number no longer needed.
121
122         (WebCore::CSSParser::updateLastSelectorLineAndPosition): Deleted.
123         * css/parser/CSSParser.h:
124         Got rid of the function that tracks and updates the last seen selector line.
125
126         * css/parser/CSSParserImpl.cpp:
127         (WebCore::CSSParserImpl::consumeStyleRule):
128         Fix the rule creation in the new parser to not pass in a 0 line number.
129
130         * inspector/InspectorStyleSheet.cpp:
131         (WebCore::buildSourceRangeObject):
132         (WebCore::InspectorStyleSheet::buildObjectForSelectorList):
133         (WebCore::InspectorStyleSheet::buildObjectForRule):
134         * inspector/InspectorStyleSheet.h:
135         Patch the methods that build up the selector range to return the end line
136         information for selector text so that it can be set as the source line
137         for the rule (thus eliminating the need to store the line number on the style
138         rule itself).
139
140 2016-12-02  Sam Weinig  <sam@webkit.org>
141
142         optional sequence values not handled correctly by binding generator
143         https://bugs.webkit.org/show_bug.cgi?id=142562
144
145         Also fixes:
146             Remove non-standard postMessage overload
147             https://bugs.webkit.org/show_bug.cgi?id=161911
148         and
149             Wrong argument order in window.postMessage
150             https://bugs.webkit.org/show_bug.cgi?id=63141
151
152         Reviewed by Darin Adler.
153
154         * WebCore.xcodeproj/project.pbxproj:
155         Remove no longer needed files.
156
157         * bindings/generic/IDLTypes.h:
158         * bindings/js/JSDOMConvert.h:
159         (WebCore::Converter<IDLObject>::convert):
160         Add support for the WebIDL object type.
161
162         * bindings/js/JSDOMBinding.cpp:
163         (WebCore::createDOMException):
164         Add support for throwing stack overflow errors.
165
166         * bindings/js/JSDOMWindowCustom.cpp:
167         (WebCore::handlePostMessage): Deleted.
168         (WebCore::JSDOMWindow::postMessage): Deleted.
169         * bindings/js/JSDedicatedWorkerGlobalScopeCustom.cpp: Removed.
170         * bindings/js/JSMessagePortCustom.cpp:
171         (WebCore::JSMessagePort::postMessage): Deleted.
172         (WebCore::extractTransferables): Deleted.
173         * bindings/js/JSMessagePortCustom.h: Removed.
174         * bindings/js/JSWorkerCustom.cpp:
175         (WebCore::JSWorker::postMessage): Deleted.
176         Remove custom bindings for postMessage.
177
178         * bindings/js/SerializedScriptValue.h:
179         Switch to using enum class.
180
181         * bindings/js/SerializedScriptValue.cpp:
182         (WebCore::SerializedScriptValue::transferArrayBuffers):
183         (WebCore::SerializedScriptValue::create):
184         Add new create function that takes the transfer list, processes it, and returns
185         MessagePorts and SerializedScriptValue / exception.
186
187         (WebCore::CloneBase::throwStackOverflow): Deleted.
188         (WebCore::CloneDeserializer::throwValidationError): Deleted.
189         Remove uncalled functions.
190
191         * bindings/scripts/CodeGenerator.pm:
192         (IsRefPtrType):
193         (IsBuiltinType):
194         * bindings/scripts/CodeGeneratorJS.pm:
195         (AddToIncludesForIDLType):
196         (GetBaseIDLType):
197         Add support for the WebIDL 'object' type.
198
199         * bindings/scripts/test/JS/JSTestObj.cpp:
200         * bindings/scripts/test/TestObj.idl:
201         Add tests for 'object'.
202
203         * dom/ExceptionCode.h:
204         Add two new ExceptionCodes:
205           - ExistingExceptionError, to indicate that implementation code threw a JS exception.
206           - StackOverflowError, to indicate that a stack overflow exception should be thrown.
207
208         * dom/MessagePort.cpp:
209         (WebCore::MessagePort::postMessage):
210         * dom/MessagePort.h:
211         * dom/MessagePort.idl:
212         * page/DOMWindow.cpp:
213         (WebCore::DOMWindow::postMessage):
214         * page/DOMWindow.h:
215         * page/DOMWindow.idl:
216         * workers/DedicatedWorkerGlobalScope.cpp:
217         (WebCore::DedicatedWorkerGlobalScope::postMessage):
218         * workers/DedicatedWorkerGlobalScope.h:
219         * workers/DedicatedWorkerGlobalScope.idl:
220         * workers/Worker.cpp:
221         (WebCore::Worker::postMessage):
222         * workers/Worker.h:
223         * workers/Worker.idl:
224         Update to call new SerializedScriptValue create function.
225
226 2016-12-03  Dave Hyatt  <hyatt@apple.com>
227
228         [CSS Parser] Support Dashboard Regions
229         https://bugs.webkit.org/show_bug.cgi?id=165357
230
231         Reviewed by Daniel Bates.
232
233         * css/CSSValueKeywords.in:
234         * css/parser/CSSPropertyParser.cpp:
235         (WebCore::consumeWebkitDashboardRegion):
236         (WebCore::CSSPropertyParser::parseSingleValue):
237
238 2016-12-02  Simon Fraser  <simon.fraser@apple.com>
239
240         Improve the behavior of scroll-into-view when the target is inside position:fixed
241         https://bugs.webkit.org/show_bug.cgi?id=165354
242
243         Reviewed by Zalan Bujtas.
244         
245         The existing RenderLayer::scrollRectToVisible() code paid no heed to whether the 
246         target was inside position:fixed, resulting in unwanted scrolls.
247         
248         Fix this by plumbing through from the call sites a "insideFixed" flag which we get
249         when we call localToAbsolute(), and use this flag to avoid scrolling at all if
250         unzoomed.
251         
252         If zoomed and we're focussing something inside position:fixed, and if visual viewports
253         are enabled, we can compute the visual viewport required to reveal the target rect,
254         which gives us the ideal scroll position.
255         
256         Fix a bug on non-iOS platforms when zoomed, which is to scale the viewRect since
257         frameView.visibleContentRect() gives an unscaled rect on those platforms.
258         
259         Not all callers of scrollRectToVisible() are fixed, but those that are not will get
260         the current behavior.
261
262         Tests: fast/overflow/scroll-anchor-in-position-fixed.html
263                fast/visual-viewport/zoomed-scroll-into-view-fixed.html
264                fast/visual-viewport/zoomed-scroll-to-anchor-in-position-fixed.html
265
266         * dom/Element.cpp:
267         (WebCore::Element::scrollIntoView):
268         (WebCore::Element::scrollIntoViewIfNeeded):
269         (WebCore::Element::scrollIntoViewIfNotVisible):
270         (WebCore::Element::updateFocusAppearance):
271         * editing/FrameSelection.cpp:
272         (WebCore::FrameSelection::FrameSelection):
273         (WebCore::FrameSelection::absoluteCaretBounds):
274         (WebCore::FrameSelection::recomputeCaretRect):
275         (WebCore::FrameSelection::revealSelection):
276         * editing/FrameSelection.h:
277         * editing/VisiblePosition.cpp:
278         (WebCore::VisiblePosition::absoluteCaretBounds):
279         * editing/VisiblePosition.h:
280         * editing/htmlediting.cpp:
281         (WebCore::absoluteBoundsForLocalCaretRect):
282         * editing/htmlediting.h:
283         * page/FrameView.cpp:
284         (WebCore::FrameView::scrollElementToRect):
285         (WebCore::FrameView::scrollToAnchor):
286         * page/PrintContext.cpp:
287         (WebCore::PrintContext::outputLinkedDestinations):
288         * rendering/RenderElement.cpp:
289         (WebCore::RenderElement::getLeadingCorner):
290         (WebCore::RenderElement::getTrailingCorner):
291         (WebCore::RenderElement::absoluteAnchorRect):
292         (WebCore::RenderElement::anchorRect): Renamed to absoluteAnchorRect().
293         * rendering/RenderElement.h:
294         * rendering/RenderLayer.cpp:
295         (WebCore::RenderLayer::scrollRectToVisible):
296         (WebCore::RenderLayer::getRectToExpose):
297         (WebCore::RenderLayer::autoscroll):
298         * rendering/RenderLayer.h:
299         * rendering/RenderObject.cpp:
300         (WebCore::RenderObject::scrollRectToVisible):
301         * rendering/RenderObject.h:
302
303 2016-11-30  Simon Fraser  <simon.fraser@apple.com>
304
305         localToAbsolute() does incorrect conversion for elements inside position:fixed with zooming
306         https://bugs.webkit.org/show_bug.cgi?id=165244
307
308         Reviewed by Zalan Bujtas.
309         
310         RenderView::mapLocalToContainer() and RenderView::mapAbsoluteToLocalPoint() handle the coordinate
311         mapping through the RenderView's transform (when zoomed), and apply the scroll offset for position:fixed
312         elements.
313         
314         They did this in the wrong order; "local to absolute" applied the zoom scale, and then adjusted for the scroll position,
315         and "absolute to local" applied the scroll position and then the transform.
316         
317         However that scroll position adjustment should be in unzoomed coordinates, since it's accounting for the
318         layout adjustment that position:fixed receives (which actually occurs via the localToAbsolute() call
319         in RenderLayer's accumulateOffsetTowardsAncestor()). "local to absolute" should therefore apply the scroll
320         adjustment first before the transform, and "absolute to local" the reverse.
321         
322         In both visual viewport mode, and legacy drifty fixed mode FrameView::scrollPositionForFixedPosition()
323         returns a scroll offset that is unaffected by zoom, which is correct and confirms this change.
324         
325         [Confusingly, ScrollView scroll positions _are_ affected by zoom, as the entire document gets bigger.]
326         
327         RenderGeometryMap::mapToContainer(), which is an optimization on top of RenderView::mapLocalToContainer(),
328         gets a similar fix.
329         
330         Test: fast/zooming/client-rect-in-fixed-zoomed.html
331
332         * rendering/RenderGeometryMap.cpp:
333         (WebCore::RenderGeometryMap::mapToContainer):
334         * rendering/RenderView.cpp:
335         (WebCore::RenderView::mapLocalToContainer):
336         (WebCore::RenderView::mapAbsoluteToLocalPoint):
337
338 2016-12-02  Simon Fraser  <simon.fraser@apple.com>
339
340         Put names on layers in release builds
341         https://bugs.webkit.org/show_bug.cgi?id=165347
342
343         Reviewed by Tim Horton.
344
345         Put names on GraphicsLayers (and therefore CALayers) in release builds. Release names
346         are a simpler, truncated version of debug names, with <tagname> id class names.
347
348         Non-primary layer names converted to lowercase and "layer" removed.
349
350         Fix comments that refer to gdb.
351
352         Use ENABLE(TREE_DEBUGGING) in more places.
353
354         * dom/Node.h:
355         * dom/Position.h:
356         * dom/Range.h:
357         * editing/FrameSelection.h:
358         * editing/VisiblePosition.h:
359         * editing/VisibleSelection.h:
360         * history/HistoryItem.h:
361         * page/FrameTree.h:
362         * platform/graphics/GraphicsLayer.h:
363         * platform/graphics/ca/GraphicsLayerCA.cpp:
364         (WebCore::GraphicsLayerCA::setName):
365         (WebCore::GraphicsLayerCA::setContentsToSolidColor):
366         (WebCore::GraphicsLayerCA::updateNames):
367         (WebCore::GraphicsLayerCA::updateBackdropFilters):
368         (WebCore::GraphicsLayerCA::updateContentsImage):
369         (WebCore::GraphicsLayerCA::updateClippingStrategy):
370         (WebCore::GraphicsLayerCA::updateContentsRects):
371         (WebCore::GraphicsLayerCA::changeLayerTypeTo):
372         * platform/graphics/ca/TileController.cpp:
373         (WebCore::TileController::tileGridContainerLayerName):
374         (WebCore::TileController::zoomedOutTileGridContainerLayerName):
375         (WebCore::TileController::createTileLayer):
376         * rendering/CounterNode.h:
377         * rendering/InlineBox.h:
378         * rendering/InlineFlowBox.h:
379         * rendering/RenderCounter.h:
380         * rendering/RenderLayer.cpp:
381         (WebCore::RenderLayer::name):
382         * rendering/RenderLayer.h:
383         * rendering/RenderLayerBacking.cpp:
384         (WebCore::RenderLayerBacking::createGraphicsLayer):
385         (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer):
386         (WebCore::RenderLayerBacking::updateAncestorClippingLayer):
387         (WebCore::RenderLayerBacking::updateDescendantClippingLayer):
388         (WebCore::RenderLayerBacking::updateForegroundLayer):
389         (WebCore::RenderLayerBacking::updateBackgroundLayer):
390         (WebCore::RenderLayerBacking::updateMaskingLayer):
391         (WebCore::RenderLayerBacking::updateChildClippingStrategy):
392         (WebCore::RenderLayerBacking::updateScrollingLayers):
393         * rendering/RenderLayerCompositor.cpp:
394         (WebCore::RenderLayerCompositor::updateLayerForTopOverhangArea):
395         (WebCore::RenderLayerCompositor::updateLayerForBottomOverhangArea):
396         (WebCore::RenderLayerCompositor::updateLayerForHeader):
397         (WebCore::RenderLayerCompositor::updateLayerForFooter):
398         (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
399         (WebCore::RenderLayerCompositor::ensureRootLayer):
400         * rendering/RenderObject.h:
401
402 2016-12-02  Antoine Quint  <graouts@apple.com>
403
404         [Modern Media Controls] Update the media controls size as the media element is resized
405         https://bugs.webkit.org/show_bug.cgi?id=165346
406
407         Reviewed by Dean Jackson.
408
409         The "resize" event dispatched by HTMLMediaElement indicates a change in the media's
410         intrinsic size, while the "resize" event dispatched by the HTMLMediaElement's ShadowRoot
411         indicates that the layout size of the media element has changed. We now use the latter.
412
413         * Modules/modern-media-controls/media/media-controller.js:
414         (MediaController):
415         (MediaController.prototype.handleEvent):
416
417 2016-12-02  Andy Estes  <aestes@apple.com>
418
419         [Cocoa] Adopt the PRODUCT_BUNDLE_IDENTIFIER build setting
420         https://bugs.webkit.org/show_bug.cgi?id=164492
421
422         Reviewed by Dan Bernstein.
423
424         * Configurations/WebCore.xcconfig: Set PRODUCT_BUNDLE_IDENTIFIER to
425         com.apple.$(PRODUCT_NAME:rfc1034identifier).
426         * Info.plist: Changed CFBundleIdentifier's value from com.apple.${PRODUCT_NAME} to
427         ${PRODUCT_BUNDLE_IDENTIFIER}.
428
429 2016-12-02  Chris Dumez  <cdumez@apple.com>
430
431         HTML Interactive Form Validation popovers do not show in iOS WKWebViews
432         https://bugs.webkit.org/show_bug.cgi?id=165340
433         <rdar://problem/29489966>
434
435         Reviewed by Simon Fraser.
436
437         HTML Interactive Form Validation popovers do not show in iOS WKWebViews,
438         only in MobileSafari. To address the issue try to find an appropriate
439         UIViewController to present the popover when the client does not provide
440         a presenting view controller.
441
442         * platform/ValidationBubble.h:
443         * platform/ios/ValidationBubbleIOS.mm:
444         (WebCore::fallbackViewController):
445         (WebCore::ValidationBubble::setAnchorRect):
446         * platform/spi/ios/UIKitSPI.h:
447
448 2016-12-02  Zalan Bujtas  <zalan@apple.com>
449
450         Remove redundant LayoutUnit conversions.
451         https://bugs.webkit.org/show_bug.cgi?id=165338
452
453         Reviewed by Simon Fraser.
454
455         RenderBlockFlow::computeColumnCountAndWidth has some redundant LayoutUnti <-> unsigned conversions.
456
457         No change in functionality.
458
459         * rendering/RenderBlockFlow.cpp:
460         (WebCore::RenderBlockFlow::computeColumnCountAndWidth):
461
462 2016-12-02  Antoine Quint  <graouts@apple.com>
463
464         [Modern Media Controls] Add rewind and fast-forward support
465         https://bugs.webkit.org/show_bug.cgi?id=165294
466
467         Reviewed by Dean Jackson.
468
469         We implement support for rewinding and fast-forwarding the media by pressing dedicated
470         buttons in fullscreen on macOS. We introduce a new SeekButton class that the existing
471         RewindButton and ForwardButton classes now extend and which provides handling of
472         "mousedown" and "mouseup" events to indicate that a button is being pressed to the
473         UI delegate.
474
475         We also introduce a new SeekSupport class from which SeekBackwardSupport and
476         SeekForwardSupport inherit to integrate with those controls and update the media
477         time.
478
479         Tests: media/modern-media-controls/layout-node/layout-node-parent-of-type.html
480                media/modern-media-controls/seek-backward-support/seek-backward-support.html
481                media/modern-media-controls/seek-forward-support/seek-forward-support.html
482
483         * Modules/modern-media-controls/controls/forward-button.js:
484         * Modules/modern-media-controls/controls/layout-node.js:
485         (LayoutNode.prototype.parentOfType):
486         * Modules/modern-media-controls/controls/rewind-button.js:
487         * Modules/modern-media-controls/controls/seek-button.js: Added.
488         (SeekButton):
489         (SeekButton.prototype.handleEvent):
490         (SeekButton.prototype._didStartPressing):
491         (SeekButton.prototype._didStopPressing):
492         (SeekButton.prototype._notifyDelegateOfPressingState):
493         * Modules/modern-media-controls/js-files:
494         * Modules/modern-media-controls/media/media-controller.js:
495         (MediaController.prototype._updateControlsIfNeeded):
496         * Modules/modern-media-controls/media/seek-backward-support.js: Added.
497         (SeekBackwardSupport.prototype.get control):
498         (SeekBackwardSupport.prototype.get multiplier):
499         (SeekBackwardSupport):
500         * Modules/modern-media-controls/media/seek-forward-support.js: Added.
501         (SeekForwardSupport.prototype.get control):
502         (SeekForwardSupport.prototype.get multiplier):
503         (SeekForwardSupport):
504         * Modules/modern-media-controls/media/seek-support.js: Added.
505         (SeekSupport.prototype.get multiplier):
506         (SeekSupport.prototype.buttonPressedStateDidChange):
507         (SeekSupport.prototype._startSeeking):
508         (SeekSupport.prototype._stopSeeking):
509         (SeekSupport.prototype._seek):
510         (SeekSupport):
511         * WebCore.xcodeproj/project.pbxproj:
512
513 2016-12-02  Dave Hyatt  <hyatt@apple.com>
514
515         [CSS Parser] Need to set edit flags properly when user-modify/select are used.
516         https://bugs.webkit.org/show_bug.cgi?id=165334
517
518         Reviewed by Dean Jackson.
519
520         The old parser calls parserSetUsesStyleBasedEditability on
521         StyleSheetContents* from inside isValidKeywordPropertyAndValue. This
522         is pretty lame, but we have to do the same in order to pass editing
523         layout tests.
524
525         All of the functions below have been patched with the sole purpose of
526         propagating StyleSheetContents* through to isValidKeywordPropertyAndValue
527         in the new parser.
528
529         * css/parser/CSSParser.cpp:
530         (WebCore::CSSParser::parseValueWithVariableReferences):
531         * css/parser/CSSParser.h:
532         * css/parser/CSSParserFastPaths.cpp:
533         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
534         (WebCore::parseKeywordValue):
535         (WebCore::CSSParserFastPaths::maybeParseValue):
536         * css/parser/CSSParserFastPaths.h:
537         * css/parser/CSSParserImpl.cpp:
538         (WebCore::CSSParserImpl::consumeDeclarationValue):
539         * css/parser/CSSPropertyParser.cpp:
540         (WebCore::CSSPropertyParser::CSSPropertyParser):
541         (WebCore::CSSPropertyParser::parseValue):
542         (WebCore::CSSPropertyParser::parseSingleValue):
543         (WebCore::CSSPropertyParser::parseFontFaceDescriptor):
544         (WebCore::CSSPropertyParser::consumeFont):
545         (WebCore::CSSPropertyParser::parseShorthand):
546         * css/parser/CSSPropertyParser.h:
547
548 2016-12-02  Beth Dakin  <bdakin@apple.com>
549
550         REGRESSION (r208802): TouchBar pause button doesn't work
551         https://bugs.webkit.org/show_bug.cgi?id=165333
552         -and corresponding-
553         rdar://problem/29487187
554
555         Reviewed by Wenson Hsieh.
556
557         The previous code got this right by using self.playing. _playing was totally un-
558         used, so this patch just removes it.
559
560         * platform/mac/WebPlaybackControlsManager.h:
561         * platform/mac/WebPlaybackControlsManager.mm:
562         (-[WebPlaybackControlsManager setPlaying:]):
563
564 2016-12-02  John Wilander  <wilander@apple.com>
565
566         Require preflight for non-standard CORS-safelisted request headers Accept, Accept-Language, and Content-Language
567         https://bugs.webkit.org/show_bug.cgi?id=165178
568         <rdar://problem/18792250>
569
570         Reviewed by Youenn Fablet.
571
572         Fetch currently only restricts the header Content-Type for simple requests:
573         https://fetch.spec.whatwg.org/#cors-safelisted-request-header
574
575         This means simple CORS requests can send unexpected characters in Accept, 
576         Accept-Language, and Content-Language header values.
577
578         RFC 7231 implies restrictions on these header values:
579         - Accept https://tools.ietf.org/html/rfc7231#section-5.3.2
580         - Accept-Language https://tools.ietf.org/html/rfc7231#section-5.3.5
581         - Content-Language https://tools.ietf.org/html/rfc7231#section-3.1.3.2
582
583         As per discussions in the W3C WebAppSec group we should try to restrict 
584         these header values to help protect servers that do not expect simple CORS 
585         requests.
586
587         Non-standard, safelisted header values should trigger a preflight and require
588         the headers to be whitelisted in the response's Access-Control-Allow-Headers.
589         For Fetch in no-cors mode this change means non-standard header values are not
590         allowed to be set.
591
592         Test: http/tests/xmlhttprequest/cors-non-standard-safelisted-headers-should-trigger-preflight.html
593
594         * loader/CrossOriginAccessControl.cpp:
595         (WebCore::isSimpleCrossOriginAccessRequest):
596             Now calls WebCore::isCrossOriginSafeRequestHeader() instead of
597             WebCore::isOnAccessControlSimpleRequestHeaderWhitelist().
598         (WebCore::isOnAccessControlSimpleRequestHeaderWhitelist): Deleted.
599             It was a duplicate of WebCore::isCrossOriginSafeRequestHeader().
600         * loader/CrossOriginAccessControl.h:
601         * loader/CrossOriginPreflightResultCache.cpp:
602         (WebCore::CrossOriginPreflightResultCacheItem::allowsCrossOriginHeaders):
603             Now calls WebCore::isCrossOriginSafeRequestHeader() instead of
604             WebCore::isOnAccessControlSimpleRequestHeaderWhitelist().
605         * platform/network/HTTPParsers.cpp:
606         (WebCore::isValidAcceptHeaderValue):
607             Basic check that the characters are all ASCII alphanumeric, ' ', '*', '.',
608             '/', ';', or '='.
609         (WebCore::isValidLanguageHeaderValue):
610             Basic check that the characters are all ASCII alphanumeric, ' ', '*', '-',
611             '.', ';', or '='.
612         (WebCore::isSimpleHeader):
613             Removed duplicate code. Now calls WebCore::isCrossOriginSafeRequestHeader().
614         (WebCore::isCrossOriginSafeRequestHeader):
615             Now makes a call to WebCore::isValidAcceptHeaderValue() for Accept
616             headers and WebCore::isValidLanguageHeaderValue() for Accept-Language
617             and Content-Language headers.
618         * platform/network/HTTPParsers.h:
619
620 2016-12-02  Zalan Bujtas  <zalan@apple.com>
621
622         ASSERTION FAILED: flowThread->regionInRange(region, startRegion, endRegion) in WebCore::RenderBox::borderBoxRectInRegion
623         https://bugs.webkit.org/show_bug.cgi?id=152113
624         <rdar://problem/27720221>
625
626         Reviewed by David Hyatt.
627
628         In a nested column context, do not process a spanner if it belongs to an inner column.
629
630         While populating a flow, we search for possible spanners and construct multicolumnsets accordingly.
631         However due to the top-down nature of populating flows, a descendant spanner could belong to an inner
632         flow which hasn't been populated yet.
633         This patch checks if a potential spanner has an ancestor (which is also a descendant
634         of the flow that we are populating -> nested) that will eventually create a flow context. 
635
636         Test: fast/multicol/assert-with-nested-columns-and-spanner.html
637
638         * rendering/RenderBlockFlow.cpp:
639         (WebCore::RenderBlockFlow::computeColumnCountAndWidth):
640         (WebCore::RenderBlockFlow::willCreateColumns):
641         * rendering/RenderBlockFlow.h:
642         * rendering/RenderMultiColumnFlowThread.cpp:
643         (WebCore::isValidColumnSpanner):
644
645 2016-12-02  Dave Hyatt  <hyatt@apple.com>
646
647         [CSS Parser] Make sure the z-component of transform-origin can be implicit
648         https://bugs.webkit.org/show_bug.cgi?id=165326
649
650         Reviewed by Tim Horton.
651
652         * css/parser/CSSPropertyParser.cpp:
653         (WebCore::CSSPropertyParser::consumeTransformOrigin):
654
655 2016-12-02  Dave Hyatt  <hyatt@apple.com>
656
657         [CSS Parser] Fix :any/:host to allow pseudo-elements. Support -webkit-border-radius.
658         https://bugs.webkit.org/show_bug.cgi?id=165323
659
660         Reviewed by Dean Jackson.
661
662         * css/parser/CSSPropertyParser.cpp:
663         (WebCore::CSSPropertyParser::parseShorthand):
664         * css/parser/CSSSelectorParser.cpp:
665         (WebCore::CSSSelectorParser::consumePseudo):
666
667 2016-12-02  Chris Dumez  <cdumez@apple.com>
668
669         [iOS] Tapping on an HTML validation bubble should dismiss it
670         https://bugs.webkit.org/show_bug.cgi?id=165122
671         <rdar://problem/29429372>
672
673         Reviewed by Simon Fraser.
674
675         Tapping on an HTML validation bubble should dismiss it. Previously it did
676         nothing.
677
678         No new tests, I tried writing one but the validation popover does not
679         show in the simulator, only on device. I believe at least one reason is that
680         _presentingViewControllerForWebView() is required and is currently not
681         implemented by WKTR. I'll look into this issue separately.
682
683         * platform/ValidationBubble.h:
684         * platform/ios/ValidationBubbleIOS.mm:
685         (-[WebValidationBubbleTapRecognizer initWithPopoverController:withPopoverView:]):
686         (-[WebValidationBubbleTapRecognizer dismissPopover]):
687         (WebCore::ValidationBubble::ValidationBubble):
688
689 2016-12-02  Dave Hyatt  <hyatt@apple.com>
690
691         [CSS Parser] Add support for the SVG 'kerning' property
692         https://bugs.webkit.org/show_bug.cgi?id=165315
693
694         Reviewed by Zalan Bujtas.
695
696         * css/parser/CSSPropertyParser.cpp:
697         (WebCore::consumeKerning):
698         (WebCore::CSSPropertyParser::parseSingleValue):
699
700 2016-12-02  Sam Weinig  <sam@webkit.org>
701
702         [WebIDL] Remove support for the 'Nondeterministic' extended attribute
703         https://bugs.webkit.org/show_bug.cgi?id=165307
704
705         Reviewed by Chris Dumez.
706
707         We are not currently using the WebReplay functionality that the Nondeterministic
708         extended attribute is intended to aide. If we come back to WebReplay in the future,
709         we can bring it back.
710
711         * bindings/scripts/CodeGeneratorJS.pm:
712         (GenerateImplementation):
713         (GenerateImplementationFunctionCall):
714         (GetNativeTypeForMemoization): Deleted.
715         * bindings/scripts/IDLAttributes.txt:
716         * bindings/scripts/test/JS/JSTestNondeterministic.cpp: Removed.
717         * bindings/scripts/test/JS/JSTestNondeterministic.h: Removed.
718         * bindings/scripts/test/TestNondeterministic.idl: Removed.
719         * page/Navigator.idl:
720         * page/Screen.idl:
721
722 2016-12-02  Dave Hyatt  <hyatt@apple.com>
723
724         [CSS Parser] Support the -webkit-letterpress value for text-decoration
725         https://bugs.webkit.org/show_bug.cgi?id=165313
726
727         Reviewed by Dean Jackson.
728
729         * css/parser/CSSPropertyParser.cpp:
730         (WebCore::consumeTextDecorationLine):
731
732 2016-12-02  Dave Hyatt  <hyatt@apple.com>
733
734         [CSS Parser] Fix the color-gamut media query evaluator
735         https://bugs.webkit.org/show_bug.cgi?id=165309
736
737         Reviewed by Zalan Bujtas).
738
739         * css/MediaQueryEvaluator.cpp:
740         (WebCore::colorGamutEvaluate):
741         Unknown values should result in a failed match, not a successful match.
742
743 2016-12-02  Darin Adler  <darin@apple.com>
744
745         Remove use of WebCore::Dictionary in MediaSession
746         https://bugs.webkit.org/show_bug.cgi?id=165296
747
748         Reviewed by Chris Dumez.
749
750         I am not exactly sure of the status of this code. When I enabled it to test my
751         changes it did not compile until I fixed some things, and it's far out of date
752         of the latest draft of the Media Session Standard. But despite that I updated it.
753
754         * DerivedSources.make: Removed a line that was breaking the build for some
755         configurations, perhaps only for programmers from Apple, after r209198.
756
757         * Modules/mediasession/MediaSession.cpp:
758         (WebCore::MediaSession::MediaSession): Fixed so it compiles.
759         (WebCore::MediaSession::setMetadata): Changed argument to use a struct rather
760         htan a WebCore::Dictionary.
761         * Modules/mediasession/MediaSession.h: Added a Metadata struct, and used it.
762         Also fixed the arguments to the constructor.
763         * Modules/mediasession/MediaSession.idl: Added MediaMetadata and used it instead
764         of Dictionary.
765
766 2016-12-02  Dave Hyatt  <hyatt@apple.com>
767
768         [CSS Parser] Make sure margin and font set the implicit flag properly
769         https://bugs.webkit.org/show_bug.cgi?id=165306
770
771         Reviewed by Zalan Bujtas.
772
773         * css/parser/CSSPropertyParser.cpp:
774         (WebCore::CSSPropertyParser::consumeFont):
775         (WebCore::CSSPropertyParser::consume4Values):
776
777 2016-12-02  Dave Hyatt  <hyatt@apple.com>
778
779         [CSS Parser] Make sure the templatized consumeIdent uses CSSValuePool
780         https://bugs.webkit.org/show_bug.cgi?id=165302
781
782         Reviewed by Zalan Bujtas.
783
784         * css/parser/CSSPropertyParserHelpers.h:
785         (WebCore::CSSPropertyParserHelpers::consumeIdent):
786
787 2016-12-02  Dave Hyatt  <hyatt@apple.com>
788
789         [CSS Parser] Fix font-variant parsing 
790         https://bugs.webkit.org/show_bug.cgi?id=165301
791
792         Reviewed by Zalan Bujtas.
793
794         * css/parser/CSSPropertyParser.cpp:
795         (WebCore::consumeFontVariantEastAsian):
796         (WebCore::CSSPropertyParser::consumeFontVariantShorthand):
797         Fix a bug with font-variant-east-asian parsing where the id
798         was getting improperly consumed even when it didn't match.
799
800 2016-12-02  Dave Hyatt  <hyatt@apple.com>
801
802         [CSS Parser] Fix animation property parsing
803         https://bugs.webkit.org/show_bug.cgi?id=165305
804
805         Reviewed by Zalan Bujtas.
806
807         * css/parser/CSSPropertyParser.cpp:
808         (WebCore::consumeAnimationPropertyList):
809         Match the old parser by only creating a list for animation properties if there
810         are two or more comma-separated values. Otherwise just return the CSSValue for
811         the singleton without creating a list.
812
813 2016-12-02  Gustavo Sverzut Barbieri  <barbieri@profusion.mobi>
814
815         Fix build break when disabling some features.
816         https://bugs.webkit.org/show_bug.cgi?id=165254
817
818         Reviewed by Michael Catanzaro.
819
820         If we disable SVG_FONTS or XSLT, then
821         WebCore::CachedResource::isCORSSameOrigin() would have assertions
822         on non-existent members. These should be isolated within "#if" as
823         the other places.
824
825         If we're in DEVELOPER_MODE but did not provide
826         TEST_HYPHENATAION_PATH, then we must mark UNUSED_PARAM() if we're
827         not on GTK port (ie: EFL).
828
829         No new tests as this is a build fix.
830
831         * loader/cache/CachedResource.cpp:
832         (WebCore::CachedResource::isCORSSameOrigin):
833          - missing #if ENABLED(SVG_FONTS)
834          - missing #if ENABLED(XSLT)
835         * platform/text/hyphen/HyphenationLibHyphen.cpp:
836         (WebCore::scanTestDictionariesDirectoryIfNecessary):
837          - missing UNUSED_PARAM()
838
839
840 2016-12-02  Miguel Gomez  <magomez@igalia.com>
841
842         [GTK] Use an OpenGL < 3.0 compliant way to request the OpenGL version
843         https://bugs.webkit.org/show_bug.cgi?id=165253
844
845         Reviewed by Carlos Garcia Campos.
846
847         Use glGetString(GL_VERSION) to get the OpenGL version, as glGetIntegerv with GL_MAJOR_VERSION
848         and GL_MINOR_VERSION is only supported from 3.0 on.
849
850         Covered by existent tests.
851
852         * platform/graphics/GLContext.cpp:
853         (WebCore::GLContext::version):
854
855 2016-12-02  Alex Christensen  <achristensen@webkit.org>
856
857         Fix WinCairo build after r208997
858         https://bugs.webkit.org/show_bug.cgi?id=165283
859
860         Reviewed by Carlos Garcia Campos.
861
862         * platform/graphics/GLContext.cpp:
863         glGetIntegerv is defined in gl2.h.
864         GL_MAJOR_VERSION is defined in gl3.h.
865         These are not included in the WinCairo build.
866
867 2016-11-30  Darin Adler  <darin@apple.com>
868
869         Stop using WebCore::Dictionary in bindings for Fetch
870         https://bugs.webkit.org/show_bug.cgi?id=165241
871
872         Reviewed by Chris Dumez.
873
874         * Modules/fetch/DOMWindowFetch.idl: Use RequestInit instead of Dictionary.
875         No effect on code generated since this is a JSBuiltin.
876
877         * Modules/fetch/FetchRequest.cpp:
878         (WebCore::setReferrerPolicy): Deleted. Bindings handle this now.
879         (WebCore::setMode): Ditto.
880         (WebCore::setCredentials): Ditto.
881         (WebCore::setCache): Ditto.
882         (WebCore::setRedirect): Ditto.
883         (WebCore::setReferrer): Changed argument from Dictionary to String.
884         (WebCore::buildOptions): Changed argument from Dictionary to FetchRequest::Init,
885         and simplified the code accordingly.
886         (WebCore::FetchRequest::initializeOptions): Ditto.
887         (WebCore::FetchRequest::initializeWith): Ditto.
888         * Modules/fetch/FetchRequest.h: Updated for above changes. Also added the Init struct.
889
890         * Modules/fetch/FetchRequest.idl: Added missing "only-if-cached" value to RequestCache.
891         Added RequestInit dictionary and used it instead of Dictionary. Used more-specific string
892         types for the method and referrer attributes; no effect at runtime, since the code for
893         getters is the same for ByteString, USVString, and DOMString and these are read-only.
894
895         * Modules/fetch/WorkerGlobalScopeFetch.idl: Use RequestInit instead of Dictionary.
896         No effect on code generated since this is a JSBuiltin.
897
898 2016-12-01  Jiewen Tan  <jiewen_tan@apple.com>
899
900         Add a runtime flag for SubtleCrypto
901         https://bugs.webkit.org/show_bug.cgi?id=164982
902
903         Reviewed by Brent Fulgham.
904
905         * bindings/generic/RuntimeEnabledFeatures.h:
906         (WebCore::RuntimeEnabledFeatures::setSubtleCryptoEnabled):
907         (WebCore::RuntimeEnabledFeatures::subtleCryptoEnabled):
908         * page/Crypto.idl:
909
910 2016-12-01  Saam Barati  <sbarati@apple.com>
911
912         Rename CallFrame::callee() to CallFrame::jsCallee()
913         https://bugs.webkit.org/show_bug.cgi?id=165293
914
915         Reviewed by Keith Miller.
916
917         * bindings/js/JSDOMConstructor.h:
918         (WebCore::JSBuiltinConstructor<JSClass>::construct):
919         * bindings/js/JSDataCueCustom.cpp:
920         (WebCore::constructJSDataCue):
921         * bindings/js/JSHTMLAllCollectionCustom.cpp:
922         (WebCore::callHTMLAllCollection):
923         * bindings/js/JSHTMLElementCustom.cpp:
924         (WebCore::constructJSHTMLElement):
925         * bindings/js/JSImageConstructor.cpp:
926         (WebCore::JSImageConstructor::construct):
927         * bindings/js/JSMutationObserverCustom.cpp:
928         (WebCore::constructJSMutationObserver):
929         * bindings/js/JSPluginElementFunctions.cpp:
930         (WebCore::callPlugin):
931         * bindings/js/JSWorkerCustom.cpp:
932         (WebCore::constructJSWorker):
933         * bindings/scripts/CodeGeneratorJS.pm:
934         (GenerateConstructorDefinition):
935         * bindings/scripts/test/JS/JSFloat64Array.cpp:
936         (WebCore::JSFloat64ArrayConstructor::constructJSFloat64Array):
937         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
938         (WebCore::JSTestEventConstructorConstructor::construct):
939         * bindings/scripts/test/JS/JSTestInterface.cpp:
940         (WebCore::JSTestInterfaceConstructor::construct):
941         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
942         (WebCore::JSTestNamedConstructorNamedConstructor::construct):
943         * bindings/scripts/test/JS/JSTestNode.cpp:
944         (WebCore::JSTestNodeConstructor::construct):
945         * bindings/scripts/test/JS/JSTestObj.cpp:
946         (WebCore::JSTestObjConstructor::construct):
947         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
948         (WebCore::constructJSTestOverloadedConstructors1):
949         (WebCore::constructJSTestOverloadedConstructors2):
950         (WebCore::constructJSTestOverloadedConstructors3):
951         (WebCore::constructJSTestOverloadedConstructors4):
952         (WebCore::constructJSTestOverloadedConstructors5):
953         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
954         (WebCore::constructJSTestOverloadedConstructorsWithSequence1):
955         (WebCore::constructJSTestOverloadedConstructorsWithSequence2):
956         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
957         (WebCore::JSTestTypedefsConstructor::construct):
958         * bridge/objc/objc_runtime.mm:
959         (JSC::Bindings::callObjCFallbackObject):
960         * bridge/runtime_method.cpp:
961         (JSC::callRuntimeMethod):
962         * bridge/runtime_object.cpp:
963         (JSC::Bindings::callRuntimeObject):
964         (JSC::Bindings::callRuntimeConstructor):
965
966 2016-12-01  Antoine Quint  <graouts@apple.com>
967
968         [Modern Media Controls] Fade controls in when entering and exiting fullscreen
969         https://bugs.webkit.org/show_bug.cgi?id=165287
970
971         Reviewed by Dean Jackson.
972
973         Fade controls in when we enter and leave fullscreen.
974
975         Test: media/modern-media-controls/media-controller/media-controller-fade-controls-when-entering-fullscreen.html
976
977         * Modules/modern-media-controls/controls/media-controls.css:
978         (.media-controls.fade-in):
979         (@keyframes fade-in):
980         (to):
981         * Modules/modern-media-controls/controls/media-controls.js:
982         (MediaControls.prototype.presentInElement):
983         * Modules/modern-media-controls/media/fullscreen-support.js:
984         (FullscreenSupport.prototype.buttonWasClicked):
985         * Modules/modern-media-controls/media/media-controller.js:
986         (MediaController.prototype._updateControlsIfNeeded):
987
988 2016-12-01  Antoine Quint  <graouts@apple.com>
989
990         [Modern Media Controls] Show and populate the tracks panel
991         https://bugs.webkit.org/show_bug.cgi?id=165284
992
993         Reviewed by Dean Jackson.
994
995         We added a TracksPanel in https://bugs.webkit.org/show_bug.cgi?id=165239 which allows to
996         show a list of media tracks and text tracks to choose from. We now show this panel when
997         clicking on the tracks button in the controls bar and populate its content with the
998         list of audio and text tracks for the media element. As an item is picked from the tracks
999         panel, we toggle the represented track's enabled state and dismiss the panel.
1000
1001         We also pick up the text track container display mostly unchanged from current media controls.
1002
1003         Tests: media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html
1004                media/modern-media-controls/tracks-support/tracks-support-show-and-populate-panel.html
1005
1006         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
1007         (MacOSInlineMediaControls.prototype.showTracksPanel):
1008         * Modules/modern-media-controls/controls/text-tracks.css: Added.
1009         (video::-webkit-media-text-track-container):
1010         (video::cue):
1011         (video::-webkit-media-text-track-display):
1012         (video::-webkit-media-text-track-display-backdrop):
1013         (video::cue(:future)):
1014         (video::-webkit-media-text-track-container b):
1015         (video::-webkit-media-text-track-container u):
1016         (video::-webkit-media-text-track-container i):
1017         (video::-webkit-media-text-track-container .hidden):
1018         * Modules/modern-media-controls/media/media-controller.js:
1019         (MediaController):
1020         * Modules/modern-media-controls/media/tracks-support.js:
1021         (TracksSupport):
1022         (TracksSupport.prototype.destroy):
1023         (TracksSupport.prototype.buttonWasClicked):
1024         (TracksSupport.prototype.tracksPanelNumberOfSections):
1025         (TracksSupport.prototype.tracksPanelTitleForSection):
1026         (TracksSupport.prototype.tracksPanelNumberOfTracksInSection):
1027         (TracksSupport.prototype.tracksPanelTitleForTrackInSection):
1028         (TracksSupport.prototype.tracksPanelIsTrackInSectionSelected):
1029         (TracksSupport.prototype.tracksPanelSelectionDidChange):
1030         (TracksSupport.prototype.syncControl):
1031         (TracksSupport.prototype._textTracks):
1032         (TracksSupport.prototype._audioTracks):
1033         (TracksSupport.prototype._canPickAudioTracks):
1034         (TracksSupport.prototype._canPickTextTracks):
1035         (TracksSupport.prototype._sortedTrackList):
1036
1037 2016-12-01  Brent Fulgham  <bfulgham@apple.com>
1038
1039         Rare crash when preparing to print
1040         https://bugs.webkit.org/show_bug.cgi?id=165280
1041         <rdar://problem/28240254>
1042
1043         Reviewed by Dean Jackson.
1044
1045         * page/Frame.cpp:
1046         (WebCore::Frame::setPrinting): Only manipulate the FrameView if it is non-null.
1047         (WebCore::Frame::documentAtPoint): Drive-by fix to change a 0 return to nullptr.
1048
1049 2016-12-01  Simon Fraser  <simon.fraser@apple.com>
1050
1051         Put an obvious debug border on layers with backdrop filters
1052         https://bugs.webkit.org/show_bug.cgi?id=165291
1053
1054         Reviewed by Tim Horton.
1055
1056         Put a wide magenta border on layers with backdrop filters, to highlight their performance impact.
1057         
1058         Change the "contents layer" color (used by WebGL, video etc) to blue.
1059         
1060         Make the clipping layer border slightly narrower.
1061
1062         * platform/graphics/GraphicsLayer.cpp:
1063         (WebCore::GraphicsLayer::getDebugBorderInfo):
1064         * platform/graphics/ca/GraphicsLayerCA.cpp:
1065         (WebCore::GraphicsLayerCA::setBackdropFilters):
1066
1067 2016-12-01  Brian Burg  <bburg@apple.com>
1068
1069         Fix the Windows Release build after r209198
1070         https://bugs.webkit.org/show_bug.cgi?id=165285
1071
1072         Unreviewed build fix.
1073
1074         * Modules/webdriver/NavigatorWebDriver.cpp:
1075         Brute force include all the inlines to work around a JSC issue.
1076
1077 2016-12-01  Dave Hyatt  <hyatt@apple.com>
1078
1079         [CSS Parser] Only allow a single font-family in @font-face
1080         https://bugs.webkit.org/show_bug.cgi?id=165278
1081
1082         Reviewed by Zalan Bujtas.
1083
1084         * css/parser/CSSPropertyParser.cpp:
1085         (WebCore::consumeFontFamilyDescriptor):
1086         (WebCore::CSSPropertyParser::parseFontFaceDescriptor):
1087
1088 2016-12-01  Beth Dakin  <bdakin@apple.com>
1089
1090         Blacklist Netflix for TouchBar support
1091         https://bugs.webkit.org/show_bug.cgi?id=165104
1092
1093         Rubber-stamped by Tim Horton.
1094
1095         Meant to not have the www. in the first case because that is covered by the second 
1096         case.
1097
1098         * html/HTMLMediaElement.cpp:
1099         (WebCore::needsPlaybackControlsManagerQuirk):
1100
1101 2016-12-01  Dave Hyatt  <hyatt@apple.com>
1102
1103         [CSS Parser] Support -webkit-overflow-scrolling: touch
1104         https://bugs.webkit.org/show_bug.cgi?id=165275
1105
1106         Reviewed by Zalan Bujtas.
1107
1108         * css/parser/CSSParserFastPaths.cpp:
1109         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
1110
1111 2016-12-01  Jiewen Tan  <jiewen_tan@apple.com>
1112
1113         Update SubtleCrypto::unwrapKey to match the latest spec
1114         https://bugs.webkit.org/show_bug.cgi?id=164747
1115         <rdar://problem/29258198>
1116
1117         Reviewed by Brent Fulgham.
1118
1119         This patch does following few things:
1120         1. It updates the SubtleCrypto::unwrapKey method to match the latest spec:
1121            https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-unwrapKey.
1122            It also refers to the latest Editor's Draft to a certain degree:
1123            https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-unwrapKey.
1124         2. It implements unwrapKey operations of the following algorithms: AES-KW.
1125
1126         Tests: crypto/subtle/aes-cbc-import-key-unwrap-jwk-rsa-key-private.html
1127                crypto/subtle/aes-cbc-import-key-uwrap-jwk-rsa-key-public.html
1128                crypto/subtle/aes-kw-generate-key-wrap-key-unwrap-key.html
1129                crypto/subtle/aes-kw-import-key-unwrap-raw-key.html
1130                crypto/subtle/rsa-oaep-import-key-unwrap-jwk-oct-key.html
1131                crypto/subtle/unwrapKey-malformed-parameters.html
1132                crypto/workers/subtle/aes-cbc-import-key-unwrap-key.html
1133                crypto/workers/subtle/aes-kw-import-key-unwrap-key.html
1134                crypto/workers/subtle/rsa-oaep-import-key-unwrap-key.html
1135
1136         * bindings/js/JSSubtleCryptoCustom.cpp:
1137         (WebCore::normalizeCryptoAlgorithmParameters):
1138         (WebCore::jsSubtleCryptoFunctionWrapKeyPromise):
1139         Add some comments.
1140         (WebCore::jsSubtleCryptoFunctionUnwrapKeyPromise):
1141         (WebCore::JSSubtleCrypto::unwrapKey):
1142         * crypto/CryptoAlgorithm.cpp:
1143         (WebCore::CryptoAlgorithm::unwrapKey):
1144         * crypto/CryptoAlgorithm.h:
1145         * crypto/SubtleCrypto.idl:
1146         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
1147         (WebCore::CryptoAlgorithmAES_KW::unwrapKey):
1148         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
1149         * crypto/gnutls/CryptoAlgorithmAES_KWGnuTLS.cpp:
1150         (WebCore::CryptoAlgorithmAES_KW::platformUnwrapKey):
1151         * crypto/mac/CryptoAlgorithmAES_KWMac.cpp:
1152         (WebCore::unwrapKeyAES_KW):
1153         (WebCore::CryptoAlgorithmAES_KW::platformUnwrapKey):
1154         (WebCore::CryptoAlgorithmAES_KW::platformDecrypt):
1155
1156 2016-12-01  Dave Hyatt  <hyatt@apple.com>
1157
1158         [CSS Parser] Fix font-variant parsing
1159         https://bugs.webkit.org/show_bug.cgi?id=165266
1160
1161         Reviewed by Dean Jackson.
1162
1163         * css/parser/CSSPropertyParser.cpp:
1164         (WebCore::consumeFontVariantEastAsian):
1165         (WebCore::consumeFontVariantAlternates):
1166         (WebCore::consumeFontVariantPosition):
1167         (WebCore::CSSPropertyParser::parseSingleValue):
1168         (WebCore::CSSPropertyParser::parseFontFaceDescriptor):
1169         (WebCore::CSSPropertyParser::consumeFontVariantShorthand):
1170         (WebCore::consumeFontVariantList): Deleted.
1171
1172 2016-12-01  Brian Burg  <bburg@apple.com>
1173
1174         Web Automation: expose navigator.webdriver if the page is controlled by automation
1175         https://bugs.webkit.org/show_bug.cgi?id=165245
1176         <rdar://problem/29449874>
1177
1178         Reviewed by Joseph Pecoraro.
1179
1180         Move the implementation into OpenSource. It's in Modules/webdriver/.
1181
1182         * CMakeLists.txt:
1183         * DerivedSources.make:
1184         Add new paths and files.
1185
1186         * Modules/webdriver/NavigatorWebDriver.cpp: Added.
1187         (WebCore::NavigatorWebDriver::NavigatorWebDriver):
1188         (WebCore::NavigatorWebDriver::~NavigatorWebDriver):
1189         (WebCore::NavigatorWebDriver::supplementName):
1190         (WebCore::NavigatorWebDriver::isControlledByAutomation):
1191         (WebCore::NavigatorWebDriver::from):
1192         (WebCore::JSNavigator::webdriver):
1193         * Modules/webdriver/NavigatorWebDriver.h: Added.
1194         * Modules/webdriver/NavigatorWebDriver.idl: Added.
1195         * WebCore.xcodeproj/project.pbxproj:
1196
1197 2016-12-01  Brady Eidson  <beidson@apple.com>
1198
1199         IndexedDB 2.0: Implement IDBObjectStore.getKey().
1200         https://bugs.webkit.org/show_bug.cgi?id=165256
1201
1202         Reviewed by Alex Christensen.
1203
1204         Tests: storage/indexeddb/modern/idbobjectstore-getkey-1-private.html
1205                storage/indexeddb/modern/idbobjectstore-getkey-1.html
1206
1207         * Modules/indexeddb/IDBObjectStore.cpp:
1208         (WebCore::IDBObjectStore::get):
1209         (WebCore::IDBObjectStore::getKey):
1210         * Modules/indexeddb/IDBObjectStore.h:
1211         * Modules/indexeddb/IDBObjectStore.idl:
1212
1213         * Modules/indexeddb/IDBRequest.cpp:
1214         (WebCore::IDBRequest::createObjectStoreGet):
1215         (WebCore::IDBRequest::IDBRequest):
1216         (WebCore::IDBRequest::requestedObjectStoreRecordType):
1217         * Modules/indexeddb/IDBRequest.h:
1218
1219         * Modules/indexeddb/IDBTransaction.cpp:
1220         (WebCore::IDBTransaction::requestGetRecord):
1221         (WebCore::IDBTransaction::requestIndexRecord):
1222         (WebCore::IDBTransaction::didGetRecordOnServer):
1223
1224         * Modules/indexeddb/IndexedDB.h:
1225
1226         * Modules/indexeddb/server/IDBBackingStore.h:
1227
1228         * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
1229         (WebCore::IDBServer::MemoryIDBBackingStore::getRecord):
1230         * Modules/indexeddb/server/MemoryIDBBackingStore.h:
1231
1232         * Modules/indexeddb/server/MemoryObjectStore.h:
1233
1234         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
1235         (WebCore::IDBServer::SQLiteIDBBackingStore::getRecord):
1236         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
1237
1238         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1239         (WebCore::IDBServer::UniqueIDBDatabase::getRecord):
1240         (WebCore::IDBServer::UniqueIDBDatabase::performGetRecord):
1241         * Modules/indexeddb/server/UniqueIDBDatabase.h:
1242
1243         * Modules/indexeddb/shared/IDBGetRecordData.cpp:
1244         (WebCore::IDBGetRecordData::isolatedCopy):
1245         * Modules/indexeddb/shared/IDBGetRecordData.h:
1246         (WebCore::IDBGetRecordData::encode):
1247         (WebCore::IDBGetRecordData::decode):
1248
1249 2016-12-01  Joseph Pecoraro  <pecoraro@apple.com>
1250
1251         Misc. cleanup in Modules/fetch
1252         https://bugs.webkit.org/show_bug.cgi?id=165240
1253
1254         Reviewed by Darin Adler.
1255
1256         * Modules/fetch/DOMWindowFetch.h:
1257         * Modules/fetch/FetchBody.cpp:
1258         * Modules/fetch/FetchBody.h:
1259         * Modules/fetch/FetchBodyConsumer.cpp:
1260         * Modules/fetch/FetchBodyOwner.cpp:
1261         * Modules/fetch/FetchBodyOwner.h:
1262         * Modules/fetch/FetchInternals.js:
1263         (consumeStream):
1264         * Modules/fetch/FetchLoader.cpp:
1265         * Modules/fetch/FetchResponse.h:
1266         Remove unnecessary includes and forward declarations.
1267
1268         * Modules/fetch/DOMWindowFetch.js:
1269         (fetch):
1270         * Modules/fetch/FetchResponse.js:
1271         (initializeFetchResponse):
1272         * Modules/fetch/WorkerGlobalScopeFetch.js:
1273         (fetch):
1274         Improve style.
1275
1276 2016-12-01  Antoine Quint  <graouts@apple.com>
1277
1278         [Modern Media Controls] Turn off text selection
1279         https://bugs.webkit.org/show_bug.cgi?id=165261
1280
1281         Reviewed by Dean Jackson.
1282
1283         We turn off text selection and force a non-text cursor for all text in media controls.
1284
1285         Tests: media/modern-media-controls/airplay-placard/airplay-placard-text-section.html
1286                media/modern-media-controls/pip-placard/pip-placard-text-section.html
1287                media/modern-media-controls/status-label/status-label-text-selection.html
1288
1289         * Modules/modern-media-controls/controls/media-controls.css:
1290         (.media-controls):
1291
1292 2016-12-01  Chris Dumez  <cdumez@apple.com>
1293
1294         Parameter to DOMStringList.contains() should be mandatory
1295         https://bugs.webkit.org/show_bug.cgi?id=165257
1296
1297         Reviewed by Alex Christensen.
1298
1299         Parameter to DOMStringList.contains() should be mandatory.
1300         Gecko and Blink have it mandatory but WebKit had it optional and the
1301         string 'undefined" was used by default, which is not helpful.
1302
1303         No new tests, updated existing test.
1304
1305         * dom/DOMStringList.idl:
1306
1307 2016-12-01  Jiewen Tan  <jiewen_tan@apple.com>
1308
1309         SubtleCrypto::deriveBits always return NOT_SUPPORTED_ERR for now
1310         https://bugs.webkit.org/show_bug.cgi?id=164745
1311         <rdar://problem/29258118>
1312
1313         Reviewed by Darin Adler.
1314
1315         Since we don't support any cryptography algorithms that has deriveBits operations,
1316         SubtleCrypto::deriveBits will always return NOT_SUPPORTED_ERR for now.
1317
1318         Test: crypto/subtle/deriveBits-malformed-parameters.html
1319
1320         * bindings/js/JSSubtleCryptoCustom.cpp:
1321         (WebCore::normalizeCryptoAlgorithmParameters):
1322         (WebCore::jsSubtleCryptoFunctionDeriveBitsPromise):
1323         (WebCore::JSSubtleCrypto::deriveBits):
1324         * crypto/SubtleCrypto.idl:
1325
1326 2016-12-01  Eric Carlson  <eric.carlson@apple.com>
1327
1328         [MediaStream][Mac] Video presets sometimes don't work
1329         https://bugs.webkit.org/show_bug.cgi?id=165214
1330         <rdar://problem/29444533>
1331
1332         Reviewed by Jer Noble.
1333
1334         * platform/mediastream/mac/AVVideoCaptureSource.h:
1335         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1336         (WebCore::AVVideoCaptureSource::setPreset): Set videoSettings width and height.
1337         (WebCore::AVVideoCaptureSource::setupCaptureSession): Store videoSettings object for later use.
1338           Set videoSettings width and height.
1339         (WebCore::AVVideoCaptureSource::bestSessionPresetForVideoDimensions):
1340         (WebCore::AVVideoCaptureSource::sizeForPreset): New.
1341
1342 2016-12-01  Antoine Quint  <graouts@apple.com>
1343
1344         [Modern Media Controls] Promote the "on" property from AirPlayButton to IconButton
1345         https://bugs.webkit.org/show_bug.cgi?id=165260
1346
1347         Reviewed by Dean Jackson.
1348
1349         With the fix for https://bugs.webkit.org/show_bug.cgi?id=165239 we now set the "on"
1350         property for the TracksButton as well, so it makes sense to provide that property
1351         for all IconButton subclasses, not just AirplayButton.
1352
1353         Test: media/modern-media-controls/icon-button/icon-button-on.html
1354
1355         * Modules/modern-media-controls/controls/airplay-button.css:
1356         (button.airplay.on):
1357         * Modules/modern-media-controls/controls/airplay-button.js:
1358         (AirplayButton):
1359         (AirplayButton.prototype.get on): Deleted.
1360         (AirplayButton.prototype.set on): Deleted.
1361         * Modules/modern-media-controls/controls/icon-button.css:
1362         (button.icon:active,):
1363         (button.icon:active): Deleted.
1364         * Modules/modern-media-controls/controls/icon-button.js:
1365         (IconButton.prototype.get on):
1366         (IconButton.prototype.set on):
1367
1368 2016-11-30  Sam Weinig  <sam@webkit.org>
1369
1370         [WebIDL] Remove custom bindings for File and Blob constructors
1371         https://bugs.webkit.org/show_bug.cgi?id=165218
1372
1373         Reviewed by Darin Adler.
1374
1375         * CMakeLists.txt:
1376         * DerivedSources.make:
1377         * WebCore.xcodeproj/project.pbxproj:
1378         Add/remove new files.
1379
1380         * bindings/js/JSBlobCustom.cpp:
1381         (WebCore::constructJSBlob): Deleted.
1382         * bindings/js/JSFileCustom.cpp: Removed.
1383         Remove custom constructors.
1384
1385         * bindings/scripts/CodeGeneratorJS.pm:
1386         (GenerateDefaultValue):
1387         (GenerateDictionaryImplementationContent):
1388         (GenerateParametersCheck):
1389         Add support for optional sequences without default values. Move string default value
1390         optimizations into GenerateDefaultValue.
1391
1392         * fileapi/Blob.cpp:
1393         (WebCore::Blob::Blob):
1394         * fileapi/Blob.h:
1395         (WebCore::Blob::create):
1396         * fileapi/Blob.idl:
1397         * fileapi/File.cpp:
1398         (WebCore::File::File):
1399         * fileapi/File.h:
1400         * fileapi/File.idl:
1401         Add support for the generated constructors.
1402
1403         * fileapi/BlobBuilder.cpp: Copied from Source/WebCore/fileapi/WebKitBlobBuilder.cpp.
1404         * fileapi/BlobBuilder.h: Copied from Source/WebCore/fileapi/WebKitBlobBuilder.h.
1405         * fileapi/WebKitBlobBuilder.cpp: Removed.
1406         * fileapi/WebKitBlobBuilder.h: Removed.
1407         Rename WebKitBlobBuilder to BlobBuilder, and update to work with generated constructor.
1408
1409         * fileapi/BlobPropertyBag.h: Added.
1410         * fileapi/BlobPropertyBag.idl: Added.
1411         Added.
1412
1413         * fileapi/ThreadableBlobRegistry.cpp:
1414         (WebCore::ThreadableBlobRegistry::registerBlobURL):
1415         * fileapi/ThreadableBlobRegistry.h:
1416         * platform/network/BlobRegistry.h:
1417         * platform/network/BlobRegistryImpl.cpp:
1418         (WebCore::BlobRegistryImpl::registerBlobURL):
1419         * platform/network/BlobRegistryImpl.h:
1420         Avoid copies of the BlobPart Vector.
1421
1422         * platform/network/BlobPart.h:
1423         Replace header-guards with #pragma once.
1424
1425 2016-12-01  Antoine Quint  <graouts@apple.com>
1426
1427         [Modern Media Controls] Provide a UI object to show a list of tracks
1428         https://bugs.webkit.org/show_bug.cgi?id=165239
1429
1430         Reviewed by Dean Jackson.
1431
1432         We add a new TracksPanel object which we will be using to display a list of
1433         audio and text tracks. The tracks panel can be shown by calling showTracksPanel()
1434         on a MacOSMediaControls object and will be dismissed by hitting the Escape key
1435         or mousing down outside of the panel's bounds. While the tracks panel is up,
1436         arrows can be used to focus individual tracks which can be activated by either
1437         pressing the Space bar or Enter key.
1438
1439         Activating a track will briefly animate its background to indicate selection and
1440         dismissing the tracks panel is also animated with a quick fade-out animation.
1441
1442         Data for the tracks panel is provided by specifying a dataSource property and
1443         implementing the required methods to provide the number of sections in the panel,
1444         the number of tracks in each section, etc.
1445
1446         Tests: media/modern-media-controls/tracks-panel/tracks-panel-hide-click-outside.html
1447                media/modern-media-controls/tracks-panel/tracks-panel-hide-esc-key.html
1448                media/modern-media-controls/tracks-panel/tracks-panel-hide.html
1449                media/modern-media-controls/tracks-panel/tracks-panel-population.html
1450                media/modern-media-controls/tracks-panel/tracks-panel-right-x.html
1451                media/modern-media-controls/tracks-panel/tracks-panel-select-track-with-keyboard.html
1452                media/modern-media-controls/tracks-panel/tracks-panel-select-track-with-mouse.html
1453                media/modern-media-controls/tracks-panel/tracks-panel.html
1454
1455         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
1456         (.media-controls.mac.fullscreen):
1457         (.media-controls.mac.fullscreen > .controls-bar):
1458         (.media-controls.mac.fullscreen .tracks-panel):
1459         * Modules/modern-media-controls/controls/macos-inline-media-controls.css:
1460         (.media-controls.mac.inline .tracks-panel):
1461         * Modules/modern-media-controls/controls/macos-media-controls.js:
1462         (MacOSMediaControls.prototype.showTracksPanel):
1463         (MacOSMediaControls.prototype.hideTracksPanel):
1464         (MacOSMediaControls):
1465         * Modules/modern-media-controls/controls/media-controls.css:
1466         (.media-controls):
1467         * Modules/modern-media-controls/controls/placard.css:
1468         (.placard):
1469         * Modules/modern-media-controls/controls/status-label.css:
1470         (.status-label):
1471         * Modules/modern-media-controls/controls/tracks-panel.css: Added.
1472         (.tracks-panel):
1473         (.tracks-panel *):
1474         (.tracks-panel.fade-out):
1475         (.tracks-panel-section):
1476         (.tracks-panel-section:first-of-type):
1477         (.tracks-panel-section > h3):
1478         (.tracks-panel-section > ul):
1479         (.tracks-panel-section > ul > li):
1480         (.tracks-panel-section > ul > li:focus):
1481         (.tracks-panel-section > ul > li.selected:before):
1482         (.tracks-panel-section > ul > li.animated):
1483         (@keyframes tracks-panel-item-selection):
1484         (22.22%):
1485         * Modules/modern-media-controls/controls/tracks-panel.js: Added.
1486         (TracksPanel.prototype.get presented):
1487         (TracksPanel.prototype.presentInParent):
1488         (TracksPanel.prototype.hide):
1489         (TracksPanel.prototype.get rightX):
1490         (TracksPanel.prototype.set rightX):
1491         (TracksPanel.prototype.trackNodeSelectionAnimationDidEnd):
1492         (TracksPanel.prototype.mouseMovedOverTrackNode):
1493         (TracksPanel.prototype.mouseExitedTrackNode):
1494         (TracksPanel.prototype.commitProperty):
1495         (TracksPanel.prototype.handleEvent):
1496         (TracksPanel.prototype._childrenFromDataSource.):
1497         (TracksPanel.prototype._childrenFromDataSource):
1498         (TracksPanel.prototype._handleMousedown):
1499         (TracksPanel.prototype._handleKeydown):
1500         (TracksPanel.prototype._dismiss):
1501         (TracksPanel.prototype._focusTrackNode):
1502         (TracksPanel.prototype._focusPreviousTrackNode):
1503         (TracksPanel.prototype._focusNextTrackNode):
1504         (TracksPanel.prototype._focusFirstTrackNode):
1505         (TracksPanel.prototype._focusLastTrackNode):
1506         (TrackNode):
1507         (TrackNode.prototype.activate):
1508         (TrackNode.prototype.handleEvent):
1509         (TrackNode.prototype._animationDidEnd):
1510         * Modules/modern-media-controls/js-files:
1511         * WebCore.xcodeproj/project.pbxproj:
1512
1513 2016-12-01  Andreas Kling  <akling@apple.com>
1514
1515         Log some basic memory usage stats at interesting points in time
1516         <https://webkit.org/b/165206>
1517
1518         Reviewed by Antti Koivisto.
1519
1520         This patch adds a mechanism to mark points of interests where we might
1521         want to do performance-related logging:
1522
1523             class PerformanceLogging {
1524                 enum PointOfInterest {
1525                     MainFrameLoadStarted,
1526                     MainFrameLoadCompleted,
1527                 }
1528                 void didReachPointOfInterest(PointOfInterest)
1529             }
1530
1531         You get to this object via MainFrame::performanceLogging().
1532
1533         We respond to these callbacks by logging some basic data about memory usage
1534         to the PerformanceLogging channel.
1535
1536         More PointOfInterest values will be added soon.
1537
1538         * CMakeLists.txt:
1539         * WebCore.xcodeproj/project.pbxproj:
1540         * loader/FrameLoader.cpp:
1541         (WebCore::FrameLoader::loadWithDocumentLoader):
1542         (WebCore::FrameLoader::setState):
1543         * page/MainFrame.cpp:
1544         (WebCore::MainFrame::MainFrame):
1545         * page/MainFrame.h:
1546         * page/PerformanceLogging.cpp: Added.
1547         (WebCore::toString):
1548         (WebCore::getMemoryUsageStatistics):
1549         (WebCore::PerformanceLogging::PerformanceLogging):
1550         (WebCore::writeLog):
1551         (WebCore::PerformanceLogging::didReachPointOfInterest):
1552         (WebCore::PerformanceLogging::getPlatformMemoryUsageStatistics):
1553         * page/PerformanceLogging.h: Added.
1554         * page/cocoa/PerformanceLoggingCocoa.mm: Added.
1555         (WebCore::PerformanceLogging::getPlatformMemoryUsageStatistics):
1556         * platform/Logging.h:
1557
1558 2016-11-28  Sergio Villar Senin  <svillar@igalia.com>
1559
1560         [css-grid] Move more attributes from RenderGrid to the new Grid class
1561         https://bugs.webkit.org/show_bug.cgi?id=165094
1562
1563         Reviewed by Darin Adler.
1564
1565         Moved more attributes from RenderGrid to Grid as they are not really part of the state of
1566         the RenderGrid object. In particular m_autoRepeat{Columns|Rows},
1567         m_autoRepeatEmpty{Columns|Rows} and m_orderIterator. All of them are now private attributes
1568         of the Grid class so clients should use the getters/setters provided by this patch.
1569
1570         This change allows to definitely remove the grid{Column|Row}Count() methods from
1571         RenderGrid. These two became Grid::numTracks() which returns the number of tracks in the
1572         data structure used to represent the grid (currently a matrix). Contrary to that,
1573         RenderGrid::numTracks() returns the actual size of the grid.
1574
1575         No new tests as this is a refactoring.
1576
1577         * rendering/RenderGrid.cpp:
1578         (WebCore::RenderGrid::Grid::numTracks):
1579         (WebCore::RenderGrid::Grid::ensureGridSize):
1580         (WebCore::RenderGrid::Grid::setAutoRepeatTracks):
1581         (WebCore::RenderGrid::Grid::autoRepeatTracks):
1582         (WebCore::RenderGrid::Grid::setAutoRepeatEmptyColumns):
1583         (WebCore::RenderGrid::Grid::setAutoRepeatEmptyRows):
1584         (WebCore::RenderGrid::Grid::hasAutoRepeatEmptyTracks):
1585         (WebCore::RenderGrid::Grid::isEmptyAutoRepeatTrack):
1586         (WebCore::RenderGrid::Grid::autoRepeatEmptyTracks):
1587         (WebCore::RenderGrid::Grid::gridItemSpan):
1588         (WebCore::RenderGrid::Grid::clear):
1589         (WebCore::RenderGrid::RenderGrid):
1590         (WebCore::RenderGrid::computeTrackSizesForDirection):
1591         (WebCore::RenderGrid::guttersSize):
1592         (WebCore::RenderGrid::computeIntrinsicLogicalHeight):
1593         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
1594         (WebCore::RenderGrid::rawGridTrackSize):
1595         (WebCore::RenderGrid::gridTrackSize):
1596         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions):
1597         (WebCore::RenderGrid::computeEmptyTracksForAutoRepeat):
1598         (WebCore::RenderGrid::placeItemsOnGrid):
1599         (WebCore::RenderGrid::populateExplicitGridAndOrderIterator):
1600         (WebCore::RenderGrid::createEmptyGridAreaAtSpecifiedPositionsOutsideGrid):
1601         (WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid):
1602         (WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid):
1603         (WebCore::RenderGrid::trackSizesForComputedStyle):
1604         (WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
1605         (WebCore::RenderGrid::assumedRowsSizeForOrthogonalChild):
1606         (WebCore::RenderGrid::gridAreaBreadthForChild):
1607         (WebCore::RenderGrid::gridAreaBreadthForChildIncludingAlignmentOffsets):
1608         (WebCore::RenderGrid::populateGridPositionsForDirection):
1609         (WebCore::RenderGrid::columnAxisOffsetForChild):
1610         (WebCore::RenderGrid::rowAxisOffsetForChild):
1611         (WebCore::RenderGrid::numTracks):
1612         (WebCore::RenderGrid::paintChildren):
1613         (WebCore::RenderGrid::gridColumnCount): Deleted.
1614         (WebCore::RenderGrid::gridRowCount): Deleted.
1615         (WebCore::RenderGrid::hasAutoRepeatEmptyTracks): Deleted.
1616         (WebCore::RenderGrid::isEmptyAutoRepeatTrack): Deleted.
1617         (WebCore::RenderGrid::cachedGridSpan): Deleted.
1618         * rendering/RenderGrid.h:
1619         (WebCore::RenderGrid::autoRepeatCountForDirection): Deleted.
1620
1621 2016-11-30  Brady Eidson  <beidson@apple.com>
1622
1623         Unreviewed, rolling out r209168.
1624
1625         Caused 2 API tests to fail
1626
1627         Reverted changeset:
1628
1629         "IndexedDB: When doing puts, don't
1630         "updateAllIndexesForAddRecord" if there are no indexes."
1631         https://bugs.webkit.org/show_bug.cgi?id=165215
1632         http://trac.webkit.org/changeset/209168
1633
1634 2016-11-30  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
1635
1636         Build break when using --minimal
1637         https://bugs.webkit.org/show_bug.cgi?id=165238
1638
1639         Reviewed by Darin Adler.
1640
1641         * css/parser/CSSSelectorParser.cpp:
1642         (WebCore::CSSSelectorParser::consumePseudo): Use #if ENABLE(VIDEO_TRACK) guard.
1643
1644 2016-11-30  Antoine Quint  <graouts@apple.com>
1645
1646         [Modern Media Controls] Add support for right-to-left layouts
1647         https://bugs.webkit.org/show_bug.cgi?id=165229
1648
1649         Reviewed by Dean Jackson.
1650
1651         We implement the "usesLTRUserInterfaceLayoutDirection" property which is set by HTMLMediaElement
1652         and set a CSS class when the layout is left-to-right, flipping the fullscreen volume slider in the
1653         case that it would not be present (right-to-left).
1654
1655         Test: media/modern-media-controls/media-controller/media-controller-fullscreen-ltr.html
1656
1657         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
1658         (.media-controls.mac.fullscreen:not(.uses-ltr-user-interface-layout-direction) .volume.slider):
1659         * Modules/modern-media-controls/controls/media-controls.js:
1660         (MediaControls.prototype.get usesLTRUserInterfaceLayoutDirection):
1661         (MediaControls.prototype.set usesLTRUserInterfaceLayoutDirection):
1662         * Modules/modern-media-controls/media/media-controller.js:
1663         (MediaController.prototype.set usesLTRUserInterfaceLayoutDirection):
1664         (MediaController.prototype._updateControlsIfNeeded):
1665
1666 2016-11-30  Joseph Pecoraro  <pecoraro@apple.com>
1667
1668         Web Inspector: Remove unused parameter of InspectorInstrumentation::didFinishXHRLoading
1669         https://bugs.webkit.org/show_bug.cgi?id=165233
1670
1671         Reviewed by Brian Burg.
1672
1673         * inspector/InspectorInstrumentation.cpp:
1674         (WebCore::InspectorInstrumentation::didFinishXHRLoadingImpl):
1675         * inspector/InspectorInstrumentation.h:
1676         (WebCore::InspectorInstrumentation::didFinishXHRLoading):
1677         * inspector/InspectorNetworkAgent.cpp:
1678         (WebCore::InspectorNetworkAgent::didFinishXHRLoading):
1679         * inspector/InspectorNetworkAgent.h:
1680         * xml/XMLHttpRequest.cpp:
1681         (WebCore::XMLHttpRequest::didFinishLoading):
1682         Remove unused ThreadableLoaderClient parameter.
1683
1684 2016-11-30  Brady Eidson  <beidson@apple.com>
1685
1686         IndexedDB: When doing puts, don't "updateAllIndexesForAddRecord" if there are no indexes.
1687         https://bugs.webkit.org/show_bug.cgi?id=165215
1688
1689         Reviewed by Alex Christensen.
1690
1691         No new tests (No observable behavior change).
1692
1693         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
1694         (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): Don't "updateAllIndexesForAddRecord" if there are no indexes.
1695           Avoiding this saved us some IDBKey serialization and Javascript object manipulation.
1696
1697 2016-11-30  Antoine Quint  <graouts@apple.com>
1698
1699         [Modern Media Controls] LayoutNode: only mark properties as dirty if different than current value
1700         https://bugs.webkit.org/show_bug.cgi?id=165236
1701
1702         Reviewed by Simon Fraser.
1703
1704         Check that the new value is different than the current value before marking the property as dirty.
1705
1706         * Modules/modern-media-controls/controls/layout-node.js:
1707         (LayoutNode.prototype.set x):
1708         (LayoutNode.prototype.set y):
1709         (LayoutNode.prototype.set width):
1710         (LayoutNode.prototype.set height):
1711         (LayoutNode.prototype.set visible):
1712         (performScheduledLayout):
1713         * Modules/modern-media-controls/controls/scheduler.js:
1714         (const.scheduler.new.prototype.get hasScheduledLayoutCallbacks):
1715
1716 2016-11-30  Jiewen Tan  <jiewen_tan@apple.com>
1717
1718         SubtleCrypto::deriveKey always return NOT_SUPPORTED_ERR for now
1719         https://bugs.webkit.org/show_bug.cgi?id=164744
1720         <rdar://problem/29258083>
1721
1722         Reviewed by Darin Adler.
1723
1724         Since we don't support any cryptography algorithms that has deriveKey operations,
1725         SubtleCrypto::deriveKey will always return NOT_SUPPORTED_ERR for now.
1726
1727         Test: crypto/subtle/deriveKey-malformed-parameters.html
1728
1729         * bindings/js/JSSubtleCryptoCustom.cpp:
1730         (WebCore::normalizeCryptoAlgorithmParameters):
1731         (WebCore::jsSubtleCryptoFunctionDeriveKeyPromise):
1732         (WebCore::JSSubtleCrypto::deriveKey):
1733         * crypto/SubtleCrypto.idl:
1734
1735 2016-11-26  Jiewen Tan  <jiewen_tan@apple.com>
1736
1737         Update SubtleCrypto::digest to match the latest spec
1738         https://bugs.webkit.org/show_bug.cgi?id=164742
1739         <rdar://problem/29258037>
1740
1741         Reviewed by Darin Adler.
1742
1743         This patch updates the SubtleCrypto::digest method to match the latest spec:
1744         https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-digest.
1745         It also refers to the latest Editor's Draft to a certain degree:
1746         https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-digest.
1747         Currently supported digest algorithms are SHA-1, SHA-224, SHA-256, SHA-384,
1748         and SHA-512.
1749
1750         Tests: crypto/subtle/digest-malformed-parameters.html
1751                crypto/subtle/sha1-digest.html
1752                crypto/subtle/sha224-digest.html
1753                crypto/subtle/sha256-digest.html
1754                crypto/subtle/sha384-digest.html
1755                crypto/subtle/sha512-digest.html
1756                crypto/workers/subtle/sha1-digest.html
1757                crypto/workers/subtle/sha224-digest.html
1758                crypto/workers/subtle/sha256-digest.html
1759                crypto/workers/subtle/sha384-digest.html
1760                crypto/workers/subtle/sha512-digest.html
1761
1762         * bindings/js/JSSubtleCryptoCustom.cpp:
1763         (WebCore::jsSubtleCryptoFunctionDigestPromise):
1764         (WebCore::JSSubtleCrypto::digest):
1765         * crypto/CryptoAlgorithm.cpp:
1766         (WebCore::CryptoAlgorithm::digest):
1767         * crypto/CryptoAlgorithm.h:
1768         * crypto/SubtleCrypto.idl:
1769         * crypto/algorithms/CryptoAlgorithmSHA1.cpp:
1770         (WebCore::CryptoAlgorithmSHA1::digest):
1771         * crypto/algorithms/CryptoAlgorithmSHA1.h:
1772         * crypto/algorithms/CryptoAlgorithmSHA224.cpp:
1773         (WebCore::CryptoAlgorithmSHA224::digest):
1774         * crypto/algorithms/CryptoAlgorithmSHA224.h:
1775         * crypto/algorithms/CryptoAlgorithmSHA256.cpp:
1776         (WebCore::CryptoAlgorithmSHA256::digest):
1777         * crypto/algorithms/CryptoAlgorithmSHA256.h:
1778         * crypto/algorithms/CryptoAlgorithmSHA384.cpp:
1779         (WebCore::CryptoAlgorithmSHA384::digest):
1780         * crypto/algorithms/CryptoAlgorithmSHA384.h:
1781         * crypto/algorithms/CryptoAlgorithmSHA512.cpp:
1782         (WebCore::CryptoAlgorithmSHA512::digest):
1783         * crypto/algorithms/CryptoAlgorithmSHA512.h:
1784
1785 2016-11-30  Antoine Quint  <graouts@apple.com>
1786
1787         [Modern Media Controls] UI Library: <audio> controls
1788         https://bugs.webkit.org/show_bug.cgi?id=164619
1789         <rdar://problem/29207215>
1790
1791         Reviewed by Dean Jackson.
1792
1793         Add a default size for <audio> elements (200x50).
1794
1795         Tests: media/modern-media-controls/audio/audio-controls-buttons.html
1796                media/modern-media-controls/audio/audio-controls-metrics.html
1797
1798         * Modules/modern-media-controls/controls/media-controls.css:
1799         (:host(audio)):
1800
1801 2016-11-30  Brady Eidson  <beidson@apple.com>
1802
1803         REGRESSION (r209144): API test IndexedDB.DeleteRecovery failing.
1804         https://bugs.webkit.org/show_bug.cgi?id=165216
1805
1806         Rubberstamped by Tim Horton.
1807
1808         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
1809         (WebCore::IDBServer::SQLiteIDBBackingStore::closeSQLiteDB): Change invalid ASSERT into a null check.
1810
1811 2016-11-30  Said Abou-Hallawa  <sabouhallawa@apple.com>
1812
1813         Add separate settings and preferences to enable/disable async decoding for large images and animated images
1814         https://bugs.webkit.org/show_bug.cgi?id=165177
1815
1816         Reviewed by Simon Fraser.
1817
1818         Instead of having the async image decoding be controlled by one setting,
1819         two separate settings are added:
1820             largeImageAsyncDecodingEnabled
1821             animatedImageAsyncDecodingEnabled
1822             
1823         And an existing setting is removed:
1824             asyncImageDecodingEnabled
1825
1826         * loader/cache/CachedImage.cpp:
1827         (WebCore::CachedImage::load):
1828         * loader/cache/CachedImage.h:
1829         * page/Settings.in:
1830         * platform/graphics/BitmapImage.cpp:
1831         (WebCore::BitmapImage::internalStartAnimation):
1832         * platform/graphics/BitmapImage.h:
1833         * platform/graphics/ImageObserver.h:
1834
1835 2016-11-30  Zalan Bujtas  <zalan@apple.com>
1836
1837         ASSERTION FAILED: layoutState->m_renderer == this in WebCore::RenderBlock::offsetFromLogicalTopOfFirstPage
1838         https://bugs.webkit.org/show_bug.cgi?id=155364
1839         <rdar://problem/27720461>
1840
1841         Reviewed by David Hyatt.
1842
1843         RenderNamedFlowThread is considered to be a root for the current renderer context so
1844         we need to bail out from the containing block traversal here (like we do for the RenderView). 
1845
1846         Test: fast/replaced/replaced-element-with-percentage-width-inside-flow-asserts.html
1847
1848         * rendering/RenderBox.cpp:
1849         (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
1850
1851 2016-11-30  Brady Eidson  <beidson@apple.com>
1852
1853         IndexedDB 2.0: Send operations off to the server in batches instead of one at a time.
1854         https://bugs.webkit.org/show_bug.cgi?id=165221
1855
1856         Reviewed by Myles C. Maxfield.
1857
1858         No new tests (No observable behavior change).
1859
1860         On a profile of "Lots of writes to an IndexedDB", timer scheduling/firing presented as over 10% of the time.
1861
1862         This patch negates much of that.
1863
1864         * Modules/indexeddb/IDBTransaction.cpp:
1865         (WebCore::IDBTransaction::pendingOperationTimerFired): Send 100 operations off to the server
1866           before spinning the runloop, instead of only 1.
1867
1868 2016-11-30  Antoine Quint  <graouts@apple.com>
1869
1870         [Modern Media Controls] Controls are not visible when returning from picture-in-picture playback
1871         https://bugs.webkit.org/show_bug.cgi?id=165183
1872
1873         Reviewed by Dean Jackson.
1874
1875         We need to call MediaControlsHost::setPreparedToReturnVideoLayerToInline() when we return from
1876         picture-in-picture playback such that the video layer is correctly stacked under the media controls.
1877         We call that function in a rAF call to ensure it's performed in sync with the next scheduled layout
1878         or the media controls would not appear in sync with the video layer.
1879
1880         We also fix an error from a previous commit in ControlsVisibilitySupport.
1881
1882         * Modules/modern-media-controls/media/controls-visibility-support.js:
1883         (ControlsVisibilitySupport.prototype.syncControl):
1884         (ControlsVisibilitySupport):
1885         * Modules/modern-media-controls/media/media-controller.js:
1886         (MediaController):
1887         (MediaController.prototype.handleEvent):
1888         (MediaController.prototype._returnMediaLayerToInlineIfNeeded):
1889
1890 2016-11-30  Jiewen Tan  <jiewen_tan@apple.com>
1891
1892         Update SubtleCrypto::wrapKey to match the latest spec
1893         https://bugs.webkit.org/show_bug.cgi?id=164746
1894         <rdar://problem/29258160>
1895
1896         Reviewed by Brent Fulgham.
1897
1898         This patch does following few things:
1899         1. It updates the SubtleCrypto::wrapKey method to match the latest spec:
1900            https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-wrapKey.
1901            It also refers to the latest Editor's Draft to a certain degree:
1902            https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-wrapKey.
1903         2. It implements wrapKey operations of the following algorithms: AES-KW.
1904         3. It also replaces JSSubtleCrypto* with auto in all promise functions.
1905
1906         Tests: crypto/subtle/aes-cbc-import-key-wrap-jwk-rsa-key-private.html
1907                crypto/subtle/aes-cbc-import-key-wrap-jwk-rsa-key-public.html
1908                crypto/subtle/aes-kw-import-key-wrap-raw-key.html
1909                crypto/subtle/aes-kw-wrap-key-malformed-parameters.html
1910                crypto/subtle/rsa-oaep-import-key-wrap-jwk-oct-key.html
1911                crypto/subtle/wrapKey-malformed-parameters.html
1912                crypto/workers/subtle/aes-cbc-import-key-wrap-key.html
1913                crypto/workers/subtle/aes-kw-import-key-wrap-key.html
1914                crypto/workers/subtle/rsa-oaep-import-key-wrap-key.html
1915
1916         * bindings/js/JSSubtleCryptoCustom.cpp:
1917         (WebCore::normalizeCryptoAlgorithmParameters):
1918         (WebCore::supportExportKeyThrow):
1919         (WebCore::jsSubtleCryptoFunctionEncryptPromise):
1920         (WebCore::jsSubtleCryptoFunctionDecryptPromise):
1921         (WebCore::jsSubtleCryptoFunctionExportKeyPromise):
1922         (WebCore::jsSubtleCryptoFunctionWrapKeyPromise):
1923         (WebCore::JSSubtleCrypto::wrapKey):
1924         * crypto/CryptoAlgorithm.cpp:
1925         (WebCore::CryptoAlgorithm::wrapKey):
1926         * crypto/CryptoAlgorithm.h:
1927         * crypto/SubtleCrypto.idl:
1928         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
1929         (WebCore::CryptoAlgorithmAES_KW::wrapKey):
1930         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
1931         * crypto/gnutls/CryptoAlgorithmAES_KWGnuTLS.cpp:
1932         (WebCore::CryptoAlgorithmAES_KW::platformWrapKey):
1933         * crypto/mac/CryptoAlgorithmAES_KWMac.cpp:
1934         (WebCore::wrapKeyAES_KW):
1935         (WebCore::CryptoAlgorithmAES_KW::platformWrapKey):
1936         (WebCore::CryptoAlgorithmAES_KW::platformEncrypt):
1937
1938 2016-11-29  Sam Weinig  <sam@webkit.org>
1939
1940         [WebIDL] Add support for more missing / exotic IDLTypes
1941         https://bugs.webkit.org/show_bug.cgi?id=165156
1942
1943         Reviewed by Alex Christensen.
1944
1945         - Adds JSDOMConvert support for WebIDL's 'callback interface' and 'callback function'.
1946         - Adds JSDOMConvert support for WebIDL extensions for SerializedScriptValue, Dictionary, 
1947           EventListener and XPathNSResolver (moving much of their special casing out of perl and
1948           into JSDOMConvert).
1949
1950         * DerivedSources.make:
1951         Adds $(WebCore)/testing to the list of available IDL directories to keep internals
1952         compiling.
1953
1954         * Modules/webaudio/WaveShaperNode.cpp:
1955         * Modules/webaudio/WaveShaperNode.h:
1956         Update to take curve by reference.
1957
1958         * bindings/generic/IDLTypes.h:
1959         (WebCore::IDLWrapper):
1960         Add helper type, IDLWrapper, which serves as a base type for all IDLTypes that are
1961         RefCounted.
1962
1963         * bindings/js/JSDOMConvert.h:
1964         (WebCore::convert):
1965         (WebCore::Converter<IDLNullable<T>>::convert):
1966         (WebCore::Converter<IDLCallbackFunction<T>>::convert):
1967         (WebCore::JSConverter<IDLCallbackFunction<T>>::convert):
1968         (WebCore::JSConverter<IDLCallbackFunction<T>>::convertNewlyCreated):
1969         (WebCore::Converter<IDLCallbackInterface<T>>::convert):
1970         (WebCore::JSConverter<IDLCallbackInterface<T>>::convert):
1971         (WebCore::JSConverter<IDLCallbackInterface<T>>::convertNewlyCreated):
1972         (WebCore::Converter<IDLSerializedScriptValue<T>>::convert):
1973         (WebCore::JSConverter<IDLSerializedScriptValue<T>>::convert):
1974         (WebCore::Converter<IDLLegacyDictionary<T>>::convert):
1975         (WebCore::Converter<IDLEventListener<T>>::convert):
1976         (WebCore::Converter<IDLXPathNSResolver<T>>::convert):
1977         (WebCore::JSConverter<IDLXPathNSResolver<T>>::convert):
1978         (WebCore::JSConverter<IDLXPathNSResolver<T>>::convertNewlyCreated):
1979         Add converters for the new types. IDLSerializedScriptValue, IDLLegacyDictionary, IDLEventListener and IDLXPathNSResolver
1980         have been templatized to avoid including their implementation classes everywhere. We can improve this in the future by
1981         splitting JSDOMConvert up into to separate files.
1982
1983         * bindings/scripts/CodeGenerator.pm:
1984         (IsBuiltinType):
1985         (IsInterfaceType):
1986         (IsWrapperType):
1987         (ComputeIsCallbackInterface):
1988         (ComputeIsCallbackFunction):
1989         Add new predicates, IsBuiltinType and IsInterfaceType, and re-work IsWrapperType to determine all types that
1990         have a JS wrapper (and consequently a JS{name}.h file).
1991
1992         * bindings/scripts/CodeGeneratorJS.pm:
1993         (AddToIncludesForIDLType):
1994         Update to add include for EventListener.
1995
1996         (GetArgumentExceptionFunction):
1997         (GetArgumentExceptionThrower):
1998         (GetAttributeExceptionFunction):
1999         (GetAttributeExceptionThrower):
2000         Add support for exceptions for callbacks.
2001
2002         (PassArgumentExpression):
2003         Factor out logic on how to pass arguments to C++.
2004
2005         (GenerateHeader):
2006         Make toWrapped and JSDOMWrapperConverterTraits work with XPathNSResolver.
2007
2008         (GenerateImplementation):
2009         Update to use PassArgumentExpression and pass a global object reference to JSValueToNative.
2010
2011         (GenerateParametersCheck):
2012         Remove special casing for callbacks.
2013
2014         (GenerateCallbackHeaderContent):
2015         (GenerateCallbackImplementationContent):
2016         Simplify toJS functions. State and global object are not necessary.
2017
2018         (GetBaseIDLType):
2019         Add support for new types. Add assertion so that unknown types can't get through.
2020
2021         (ShouldPassArgumentByReference):
2022         Rename from ShouldPassWrapperByReference, and merge in CodeGenerator's ShouldPassWrapperByReference.
2023
2024         (JSValueToNativeDOMConvertNeedsThisObject):
2025         Added. Predicate to determine types that need a this object for conversion.
2026
2027         (JSValueToNativeDOMConvertNeedsGlobalObject):
2028         Added. Predicate to determine types that need a global object for conversion.
2029
2030         (JSValueToNative):
2031         Remove special cases for new types.
2032
2033         (NativeToJSValueDOMConvertNeedsState):
2034         Add SerializedScriptValue and XPathNSResolver.
2035
2036         (NativeToJSValueDOMConvertNeedsGlobalObject):
2037         Add SerializedScriptValue and XPathNSResolver.
2038
2039         (NativeToJSValueUsingReferences):
2040         (NativeToJSValueUsingPointers):
2041         (NativeToJSValue):
2042         Remove unused $statePointer and replace $globalObject with $globalObjectReference. Remove
2043         special cases for new types.
2044
2045         (GenerateConstructorDefinition):
2046         Use PassArgumentExpression.
2047
2048         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
2049         * bindings/scripts/test/JS/JSTestCallbackFunction.h:
2050         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
2051         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h:
2052         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
2053         * bindings/scripts/test/JS/JSTestCallbackInterface.h:
2054         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
2055         * bindings/scripts/test/JS/JSTestObj.cpp:
2056         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
2057         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
2058         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2059         * bindings/scripts/test/TestObj.idl:
2060         * bindings/scripts/test/TestSerializedScriptValueInterface.idl:
2061         Update tests. Remove test for a readonly attribute returning a Promise, which is not supported
2062         yet (this was caught by the assertion added to GetBaseIDLType). Add tests for passing and returning 
2063         SerializedScriptValues from functions.
2064
2065 2016-11-30  Jiewen Tan  <jiewen_tan@apple.com>
2066
2067         Update SubtleCrypto::verify to match the latest spec
2068         https://bugs.webkit.org/show_bug.cgi?id=164741
2069         <rdar://problem/29257935>
2070
2071         Reviewed by Brent Fulgham.
2072
2073         This patch does following few things:
2074         1. It updates the SubtleCrypto::verify method to match the latest spec:
2075            https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-verify.
2076            It also refers to the latest Editor's Draft to a certain degree:
2077            https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-verify.
2078         2. It implements verify operations of the following algorithms: HMAC, and
2079            RSASSA-PKCS1-V1_5.
2080
2081         Tests: crypto/subtle/hmac-generate-key-sign-verify.html
2082                crypto/subtle/hmac-import-key-verify-sha1.html
2083                crypto/subtle/hmac-import-key-verify-sha224.html
2084                crypto/subtle/hmac-import-key-verify-sha256.html
2085                crypto/subtle/hmac-import-key-verify-sha384.html
2086                crypto/subtle/hmac-import-key-verify-sha512.html
2087                crypto/subtle/rsassa-pkcs1-v1_5-generate-key-sign-verify.html
2088                crypto/subtle/rsassa-pkcs1-v1_5-import-key-verify-sha1.html
2089                crypto/subtle/rsassa-pkcs1-v1_5-import-key-verify-sha224.html
2090                crypto/subtle/rsassa-pkcs1-v1_5-import-key-verify-sha256.html
2091                crypto/subtle/rsassa-pkcs1-v1_5-import-key-verify-sha384.html
2092                crypto/subtle/rsassa-pkcs1-v1_5-import-key-verify-sha512.html
2093                crypto/subtle/verify-malformed-parameters.html
2094                crypto/workers/subtle/hmac-import-key-verify.html
2095                crypto/workers/subtle/rsassa-pkcs1-v1_5-import-key-verify.html
2096
2097         * bindings/js/JSSubtleCryptoCustom.cpp:
2098         (WebCore::normalizeCryptoAlgorithmParameters):
2099         (WebCore::jsSubtleCryptoFunctionVerifyPromise):
2100         (WebCore::JSSubtleCrypto::verify):
2101         * crypto/CryptoAlgorithm.cpp:
2102         (WebCore::CryptoAlgorithm::verify):
2103         * crypto/CryptoAlgorithm.h:
2104         * crypto/SubtleCrypto.idl:
2105         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
2106         (WebCore::CryptoAlgorithmHMAC::verify):
2107         * crypto/algorithms/CryptoAlgorithmHMAC.h:
2108         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
2109         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
2110         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
2111         * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp:
2112         (WebCore::CryptoAlgorithmHMAC::platformVerify):
2113         * crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp:
2114         (WebCore::CryptoAlgorithmHMAC::platformVerify):
2115         * crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp:
2116         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
2117         * crypto/mac/CryptoAlgorithmHMACMac.cpp:
2118         (WebCore::CryptoAlgorithmHMAC::platformVerify):
2119         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
2120         (WebCore::verifyRSASSA_PKCS1_v1_5):
2121         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
2122
2123 2016-11-30  Dave Hyatt  <hyatt@apple.com>
2124
2125         [CSS Parser] Fix columns shorthand parsing
2126         https://bugs.webkit.org/show_bug.cgi?id=165210
2127
2128         Reviewed by Zalan Bujtas.
2129
2130         * css/parser/CSSPropertyParser.cpp:
2131         (WebCore::CSSPropertyParser::consumeColumns):
2132         (WebCore::consumeColumnWidthOrCount): Deleted.
2133         Bring over the old parser code, since it was actually better at creating implicit values for auto.
2134
2135 2016-11-30  Andy Estes  <aestes@apple.com>
2136
2137         [Cocoa] Pass the embedding app's bundle ID to new instances of NEFilterSource
2138         https://bugs.webkit.org/show_bug.cgi?id=165168
2139         <rdar://problem/29003618>
2140
2141         Reviewed by Simon Fraser.
2142
2143         * platform/RuntimeApplicationChecks.h: Declared applicationBundleIdentifier().
2144         * platform/RuntimeApplicationChecks.mm:
2145         (WebCore::applicationBundleIdentifier): Made non-static.
2146         * platform/cocoa/NetworkExtensionContentFilter.mm:
2147         (WebCore::NetworkExtensionContentFilter::initialize): If the new NEFilterSource instance
2148         responds to -setSourceAppBundleID:, call it with applicationBundleIdentifier().
2149         * platform/spi/cocoa/NEFilterSourceSPI.h: Moved NEFilterSourceOptionsRedirectURL into the
2150         !USE(APPLE_INTERNAL_SDK) section and unconditionally declared @property sourceAppBundleID in
2151         a new category on NEFilterSource.
2152
2153 2016-11-30  Brent Fulgham  <bfulgham@apple.com>
2154
2155         Use 'childOfType' template when retrieving Shadow DOM elements
2156         https://bugs.webkit.org/show_bug.cgi?id=165145
2157         <rdar://problem/29331830>
2158
2159         Reviewed by Antti Koivisto.
2160
2161         Tests: fast/shadow-dom/color-input-element-shadow-manipulation.html
2162                fast/shadow-dom/file-input-element-shadow-manipulation.html
2163                fast/shadow-dom/keygen-shadow-manipulation.html
2164                fast/shadow-dom/media-shadow-manipulation.html
2165                fast/shadow-dom/range-input-element-shadow-manipulation.html
2166                fast/shadow-dom/textarea-shadow-manipulation.html
2167
2168         Switch to using 'childOfType' when retrieving Shadow DOM elements, rather
2169         than relying on expected element positions, as these can be changed by
2170         JavaScript.
2171
2172         Drive by fix: Make more use of is<> and downcast<> templates rather than blindly casting.
2173
2174         * dom/Element.h:
2175         (WebCore::Element::isUploadButton): Added.
2176         (WebCore::Element::isSliderContainerElement): Added.
2177         * html/ColorInputType.cpp:
2178         (WebCore::ColorInputType::shadowColorSwatch): Use 'childOfType' rather than assuming
2179         the first child is the one we want.
2180         * html/FileInputType.cpp:
2181         (isType): Added.
2182         (WebCore::FileInputType::disabledAttributeChanged): Use 'childOfType' rather than assuming
2183         the first child is the one we want.
2184         (WebCore::FileInputType::multipleAttributeChanged): Ditto.
2185         * html/HTMLKeygenElement.cpp:
2186         (WebCore::HTMLKeygenElement::shadowSelect): Ditto.
2187         * html/HTMLMediaElement.cpp:
2188         (WebCore::HTMLMediaElement::mediaControls): Ditto.
2189         (WebCore::HTMLMediaElement::hasMediaControls): Ditto.
2190         * html/HTMLTextAreaElement.cpp:
2191         (WebCore::HTMLTextAreaElement::innerTextElement): Ditto.
2192         * html/RangeInputType.cpp:
2193         (WebCore::RangeInputType::sliderTrackElement): Ditto.
2194         * html/shadow/SliderThumbElement.h:
2195         (isType): Added.
2196         * svg/SVGUseElement.cpp:
2197         (WebCore::SVGUseElement::targetClone): Use 'childOfType' rather than assuming
2198         the first child is the one we want.
2199
2200 2016-11-30  Brady Eidson  <beidson@apple.com>
2201
2202         IndexedDB 2.0: Cache and reuse SQLiteStatements in the SQLite backend.
2203         https://bugs.webkit.org/show_bug.cgi?id=164974
2204
2205         Reviewed by Alex Christensen.
2206
2207         No new tests (No behavior change other than being faster).
2208
2209         Instead of building new SQLiteStatements from scratch each time they're needed and then
2210         finalizing them after they're used for a single operation, we cache them.
2211
2212         For tests that do puts and/or gets in tight loops, this shows up as a 5%-20% speedup on profiles.
2213
2214         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
2215         (WebCore::IDBServer::SQLiteIDBBackingStore::~SQLiteIDBBackingStore):
2216         (WebCore::IDBServer::SQLiteIDBBackingStore::createAndPopulateInitialDatabaseInfo):
2217         (WebCore::IDBServer::SQLiteIDBBackingStore::getOrEstablishDatabaseInfo):
2218         (WebCore::IDBServer::SQLiteIDBBackingStore::createObjectStore):
2219         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteObjectStore):
2220         (WebCore::IDBServer::SQLiteIDBBackingStore::renameObjectStore):
2221         (WebCore::IDBServer::SQLiteIDBBackingStore::clearObjectStore):
2222         (WebCore::IDBServer::SQLiteIDBBackingStore::createIndex):
2223         (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedHasIndexRecord):
2224         (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedPutIndexRecord):
2225         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteIndex):
2226         (WebCore::IDBServer::SQLiteIDBBackingStore::renameIndex):
2227         (WebCore::IDBServer::SQLiteIDBBackingStore::keyExistsInObjectStore):
2228         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteUnusedBlobFileRecords):
2229         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRecord):
2230         (WebCore::IDBServer::SQLiteIDBBackingStore::updateAllIndexesForAddRecord):
2231         (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord):
2232         (WebCore::IDBServer::SQLiteIDBBackingStore::getBlobRecordsForObjectStoreRecord):
2233         (WebCore::IDBServer::SQLiteIDBBackingStore::getRecord):
2234         (WebCore::IDBServer::SQLiteIDBBackingStore::cachedStatementForGetAllObjectStoreRecords):
2235         (WebCore::IDBServer::SQLiteIDBBackingStore::getAllObjectStoreRecords):
2236         (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetKeyGeneratorValue):
2237         (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedSetKeyGeneratorValue):
2238         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteBackingStore):
2239         (WebCore::IDBServer::SQLiteIDBBackingStore::cachedStatement):
2240         (WebCore::IDBServer::SQLiteIDBBackingStore::closeSQLiteDB):
2241         (WebCore::IDBServer::queryForGetAllObjectStoreRecords): Deleted.
2242         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
2243
2244 2016-11-30  Dave Hyatt  <hyatt@apple.com>
2245
2246         [CSS Parser] Make sure -webkit-background-size coalesces identical values.
2247         https://bugs.webkit.org/show_bug.cgi?id=165207
2248
2249         Reviewed by Dean Jackson.
2250
2251         * css/parser/CSSPropertyParser.cpp:
2252         (WebCore::consumeBackgroundSize):
2253
2254 2016-11-30  Eric Carlson  <eric.carlson@apple.com>
2255
2256         [MediaStream] Sync video preview layer and parent layer sizes
2257         https://bugs.webkit.org/show_bug.cgi?id=165139
2258
2259         Reviewed by Jer Noble.
2260
2261         CALayer auto-resizing doesn't work on iOS, so manually reize the video capture preview layer
2262         whenever the background layer's bounds change.
2263
2264         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2265         (WebCore::AVVideoSourcePreview::AVVideoSourcePreview): Create layer observer.
2266         (WebCore::AVVideoSourcePreview::backgroundLayerBoundsChanged): Sync preview layer and background
2267           layer sizes.
2268         (WebCore::AVVideoSourcePreview::invalidate): Invalidate and clear observer.
2269         (-[WebCoreAVVideoCaptureSourceObserver initWithParent:]):
2270         (-[WebCoreAVVideoCaptureSourceObserver setParent:]): Add KVO bounds observer.
2271         (-[WebCoreAVVideoCaptureSourceObserver observeValueForKeyPath:ofObject:change:context:]): Call
2272         parent when "bounds" changes.
2273         (-[WebCoreAVVideoCaptureSourceObserver actionForKey:]): Return nil to disable all animations.
2274
2275 2016-11-30  Dave Hyatt  <hyatt@apple.com>
2276
2277         [CSS Parser] Fix crash in -webkit-shape-outside parsing
2278         https://bugs.webkit.org/show_bug.cgi?id=165202
2279
2280         Reviewed by Dean Jackson.
2281
2282         * css/CSSBasicShapes.cpp:
2283         (WebCore::buildSerializablePositionOffset):
2284         The old parser never passed in a singleton value ID for top/right/bottom/left.
2285         The new parser does, and it exposed a bug in the serialization code for
2286         shapes that didn't properly create the offset primitive value as a percentage
2287         in those cases.
2288
2289 2016-11-30  Carlos Garcia Campos  <cgarcia@igalia.com>
2290
2291         [GLIB] IndexedDB: Switch to use new encoder for IDBKeyData
2292         https://bugs.webkit.org/show_bug.cgi?id=165191
2293
2294         Reviewed by Sergio Villar Senin.
2295
2296         Instead of using KeyedEncoder.
2297
2298         * Modules/indexeddb/server/IDBSerialization.cpp:
2299         (WebCore::isLegacySerializedIDBKeyData): Helper function to check whether the given data were encoded with
2300         KeyedEncoder or not.
2301         (WebCore::serializedTypeForKeyType): Remove #ifdefs for CF and always use the new encoder.
2302         (WebCore::encodeKey): Ditto.
2303         (WebCore::serializeIDBKeyData): Ditto.
2304         (WebCore::decodeKey): Ditto.
2305         (WebCore::deserializeIDBKeyData): Ditto.
2306
2307 2016-11-30  Joseph Pecoraro  <pecoraro@apple.com>
2308
2309         Web Inspector: Null ResourceResponse Preflight requests cause crash
2310         https://bugs.webkit.org/show_bug.cgi?id=165120
2311         <rdar://problem/27911350>
2312
2313         Reviewed by Brian Burg.
2314
2315         * loader/CrossOriginPreflightChecker.cpp:
2316         (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
2317         Only inform Web Inspector about successful responses. Informing with a
2318         null response would break the expected Inspector API contract when
2319         notifying about did receive response. Also, when informing Web Inspector
2320         include a didFinishLoading event so the frontend knows this pre-flight
2321         request is complete.
2322
2323 2016-11-30  Brady Eidson  <beidson@apple.com>
2324
2325         REGRESSION (209086): IDB tests crash under GuardMalloc.
2326         https://bugs.webkit.org/show_bug.cgi?id=165201
2327
2328         Reviewed by Chris Dumez.
2329
2330         No new tests (Covered by literally every IDB test when run under GuardMalloc).
2331
2332         * Modules/indexeddb/IDBTransaction.cpp:
2333         (WebCore::IDBTransaction::commitOnServer): "Commit on Server" operations are special, in that they
2334           are the last operation a transaction does, and they remove themselves from the protector map right away.
2335           So when we remove them from the protector map we also need to remove their raw-pointer from the 
2336           "in-progress" queue.
2337
2338 2016-11-30  Said Abou-Hallawa  <sabouhallawa@apple.com>
2339
2340         Some animated image do not animate after reseting their animations
2341         https://bugs.webkit.org/show_bug.cgi?id=165131
2342
2343         Reviewed by Simon Fraser.
2344
2345         Test: fast/images/reset-image-animation.html
2346
2347         The bug happens because the ImageFrameCache does not reset its cached
2348         frames properly when the BitmapImage rests its animation.
2349
2350         -- We need to ignore caching the new NativeImage of an ImageFrame if the
2351         decoding thread is terminated after asynchronously calling  
2352         cacheFrameNativeImageAtIndex() on the main thread through callOnMainThread().
2353         Although the decoding thread was terminated this call is still scheduled
2354         to be executed later on the main thread.
2355
2356         -- We need to open the m_frameRequestQueue before starting a new decoding
2357         thread. Opening m_frameRequestQueue clears the enqueued requests from the 
2358         previous decoding thread and allows enqueueing requests for the new thread.
2359
2360         -- We need to clear the ImageFrames which were being decoded at the time
2361         the decoding queue was closing and their new NativeImages were not cached.
2362
2363         * platform/graphics/ImageFrameCache.cpp:
2364         (WebCore::ImageFrameCache::cacheFrameNativeImageAtIndex): Assert the NativeImage
2365         is cached for an ImageFrame which is still being decoded.
2366
2367         (WebCore::ImageFrameCache::startAsyncDecodingQueue): Open the m_frameRequestQueue
2368         before starting the decoding thread. Don't cache the NativeImage of an ImageFrame
2369         unless the decoding thread is still alive and it the same as the one that makes
2370         the asynchronous call to cacheFrameNativeImageAtIndex().
2371         
2372         (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Don't request an
2373         image frame to be be asynchronously decoded if it is already being decoded.
2374         
2375         (WebCore::ImageFrameCache::stopAsyncDecodingQueue): Clear the ImageFrames that
2376         were being decoded when the decoding thread terminates.
2377         
2378         * testing/Internals.cpp:
2379         (WebCore::Internals::resetImageAnimation):
2380         * testing/Internals.h:
2381         * testing/Internals.idl:
2382         Expose BitmapImage::resetAnimation() through Internals so tests can force it.
2383
2384 2016-11-30  Darin Adler  <darin@apple.com>
2385
2386         Streamline and speed up tokenizer and segmented string classes
2387         https://bugs.webkit.org/show_bug.cgi?id=165003
2388
2389         Reviewed by Sam Weinig.
2390
2391         Profiling Speedometer on my iMac showed the tokenizer as one of the
2392         hottest functions. This patch streamlines the segmented string class,
2393         removing various unused features, and also improves some other functions
2394         seen on the Speedometer profile. On my iMac I measured a speedup of
2395         about 3%. Changes include:
2396
2397         - Removed m_pushedChar1, m_pushedChar2, and m_empty data members from the
2398           SegmentedString class and all the code that used to handle them.
2399
2400         - Simplified the SegmentedString advance functions so they are small
2401           enough to get inlined in the HTML tokenizer.
2402
2403         - Updated callers to call the simpler SegmentedString advance functions
2404           that don't handle newlines in as many cases as possible.
2405
2406         - Cut down on allocations of SegmentedString and made code move the
2407           segmented string and the strings that are moved into it rather than
2408           copying them whenever possible.
2409
2410         - Simplified segmented string functions, removing some branches, mostly
2411           from the non-fast paths.
2412
2413         - Removed small unused functions and small functions used in only one
2414           or two places, made more functions private and renamed for clarity.
2415
2416         * bindings/js/JSHTMLDocumentCustom.cpp:
2417         (WebCore::documentWrite): Moved a little more of the common code in here
2418         from the two functions belwo. Removed obsolete comment saying this was not
2419         following the DOM specification because it is. Removed unneeded special
2420         cases for 1 argument and no arguments. Take a reference instead of a pointer.
2421         (WebCore::JSHTMLDocument::write): Updated for above.
2422         (WebCore::JSHTMLDocument::writeln): Ditto.
2423
2424         * css/parser/CSSTokenizer.cpp: Added now-needed include.
2425         * css/parser/CSSTokenizer.h: Removed unneeded include.
2426
2427         * css/parser/CSSTokenizerInputStream.h: Added definition of kEndOfFileMarker
2428         here; this is now separate from the use in the HTMLParser. In the long run,
2429         unclear to me whether it is really needed in either.
2430
2431         * dom/Document.cpp:
2432         (WebCore::Document::prepareToWrite): Added. Helper function used by the three
2433         different variants of write. Using this may prevent us from having to construct
2434         a SegmentedString just to append one string after future refactoring.
2435         (WebCore::Document::write): Updated to take an rvalue reference and move the
2436         value through.
2437         (WebCore::Document::writeln): Use a single write call instead of two.
2438
2439         * dom/Document.h: Changed write to take an rvalue reference to SegmentedString
2440         rather than a const reference.
2441
2442         * dom/DocumentParser.h: Changed insert to take an rvalue reference to
2443         SegmentedString. In the future, should probably overload to take a single
2444         string since that is the normal case.
2445
2446         * dom/RawDataDocumentParser.h: Updated for change to DocumentParser.
2447
2448         * html/FTPDirectoryDocument.cpp:
2449         (WebCore::FTPDirectoryDocumentParser::append): Refactored a bit, just enough
2450         so that we don't need an assignment operator for SegmentedString that can
2451         copy a String.
2452
2453         * html/parser/HTMLDocumentParser.cpp:
2454         (WebCore::HTMLDocumentParser::insert): Updated to take an rvalue reference,
2455         and move the value through.
2456         * html/parser/HTMLDocumentParser.h: Updated for the above.
2457
2458         * html/parser/HTMLEntityParser.cpp:
2459         (WebCore::HTMLEntityParser::consumeNamedEntity): Updated for name changes.
2460         Changed the twao calls to advance here to call advancePastNonNewline; no
2461         change in behavior, but asserts what the code was assuming before, that the
2462         character was not a newline.
2463
2464         * html/parser/HTMLInputStream.h:
2465         (WebCore::HTMLInputStream::appendToEnd): Updated to take an rvalue reference,
2466         and move the value through.
2467         (WebCore::HTMLInputStream::insertAtCurrentInsertionPoint): Ditto.
2468         (WebCore::HTMLInputStream::markEndOfFile): Removed the code to construct a
2469         SegmentedString, overkill since we can just append an individual string.
2470         (WebCore::HTMLInputStream::splitInto): Rewrote the move idiom here to actually
2471         use move, which will reduce reference count churn and other unneeded work.
2472
2473         * html/parser/HTMLMetaCharsetParser.cpp:
2474         (WebCore::HTMLMetaCharsetParser::checkForMetaCharset): Removed unneeded
2475         construction of a SegmentedString, just to append a string.
2476
2477         * html/parser/HTMLSourceTracker.cpp:
2478         (WebCore::HTMLSourceTracker::HTMLSourceTracker): Moved to the class definition.
2479         (WebCore::HTMLSourceTracker::source): Updated for function name change.
2480         * html/parser/HTMLSourceTracker.h: Updated for above.
2481
2482         * html/parser/HTMLTokenizer.cpp: Added now-needed include.
2483         (WebCore::HTMLTokenizer::emitAndResumeInDataState): Use advancePastNonNewline,
2484         since this function is never called in response to a newline character.
2485         (WebCore::HTMLTokenizer::commitToPartialEndTag): Ditto.
2486         (WebCore::HTMLTokenizer::commitToCompleteEndTag): Ditto.
2487         (WebCore::HTMLTokenizer::processToken): Use ADVANCE_PAST_NON_NEWLINE_TO macro
2488         instead of ADVANCE_TO in cases where the character we are advancing past is
2489         known not to be a newline, so we can use the more efficient advance function
2490         that doesn't check for the newline character.
2491
2492         * html/parser/InputStreamPreprocessor.h: Moved kEndOfFileMarker to
2493         SegmentedString.h; not sure that's a good place for it either. In the long run,
2494         unclear to me whether this is really needed.
2495         (WebCore::InputStreamPreprocessor::peek): Added UNLIKELY for the empty check.
2496         Added LIKELY for the not-special character check.
2497         (WebCore::InputStreamPreprocessor::advance): Updated for the new name of the
2498         advanceAndUpdateLineNumber function.
2499         (WebCore::InputStreamPreprocessor::advancePastNonNewline): Added. More
2500         efficient than advance for cases where the last characer is known not to be
2501         a newline character.
2502         (WebCore::InputStreamPreprocessor::skipNextNewLine): Deleted. Was unused.
2503         (WebCore::InputStreamPreprocessor::reset): Deleted. Was unused except in the
2504         constructor; added initial values for the data members to replace.
2505         (WebCore::InputStreamPreprocessor::processNextInputCharacter): Removed long
2506         FIXME comment that didn't really need to be here. Reorganized a bit.
2507         (WebCore::InputStreamPreprocessor::isAtEndOfFile): Renamed and made static.
2508
2509         * html/track/BufferedLineReader.cpp:
2510         (WebCore::BufferedLineReader::nextLine): Updated to not use the poorly named
2511         scanCharacter function to advance past a newline. Also renamed from getLine
2512         and changed to return Optional<String> instead of using a boolean to indicate
2513         failure and an out argument.
2514
2515         * html/track/BufferedLineReader.h:
2516         (WebCore::BufferedLineReader::BufferedLineReader): Use the default, putting
2517         initial values on each data member below.
2518         (WebCore::BufferedLineReader::append): Updated to take an rvalue reference,
2519         and move the value through.
2520         (WebCore::BufferedLineReader::scanCharacter): Deleted. Was poorly named,
2521         and easy to replace with two lines of code at its two call sites.
2522         (WebCore::BufferedLineReader::reset): Rewrote to correctly clear all the
2523         data members of the class, not just the segmented string.
2524
2525         * html/track/InbandGenericTextTrack.cpp:
2526         (WebCore::InbandGenericTextTrack::parseWebVTTFileHeader): Updated to take
2527         an rvalue reference and move the value through.
2528         * html/track/InbandGenericTextTrack.h: Updated for the above.
2529
2530         * html/track/InbandTextTrack.h: Updated since parseWebVTTFileHeader now
2531         takes an rvalue reference.
2532
2533         * html/track/WebVTTParser.cpp:
2534         (WebCore::WebVTTParser::parseFileHeader): Updated to take an rvalue reference
2535         and move the value through.
2536         (WebCore::WebVTTParser::parseBytes): Updated to pass ownership of the string
2537         in to the line reader append function.
2538         (WebCore::WebVTTParser::parseCueData): Use auto and WTFMove for WebVTTCueData.
2539         (WebCore::WebVTTParser::flush): More of the same.
2540         (WebCore::WebVTTParser::parse): Changed to use nextLine instead of getLine.
2541         * html/track/WebVTTParser.h: Updated for the above.
2542
2543         * html/track/WebVTTTokenizer.cpp:
2544         (WebCore::advanceAndEmitToken): Use advanceAndUpdateLineNumber by its new
2545         name, just advance. No change in behavior.
2546         (WebCore::WebVTTTokenizer::WebVTTTokenizer): Pass a String, not a
2547         SegmentedString, to add the end of file marker.
2548
2549         * platform/graphics/InbandTextTrackPrivateClient.h: Updated since
2550         parseWebVTTFileHeader takes an rvalue reference.
2551
2552         * platform/text/SegmentedString.cpp:
2553         (WebCore::SegmentedString::Substring::appendTo): Moved here from the header.
2554         The only caller is SegmentedString::toString, inside this file.
2555         (WebCore::SegmentedString::SegmentedString): Deleted the copy constructor.
2556         No longer needed.
2557         (WebCore::SegmentedString::operator=): Defined a move assignment operator
2558         rather than an ordinary assignment operator, since that's what the call
2559         sites really need.
2560         (WebCore::SegmentedString::length): Simplified since we no longer need to
2561         support pushed characters.
2562         (WebCore::SegmentedString::setExcludeLineNumbers): Simplified, since we
2563         can just iterate m_otherSubstrings without an extra check. Also changed to
2564         write directly to the data member of Substring instead of using a function.
2565         (WebCore::SegmentedString::updateAdvanceFunctionPointersForEmptyString):
2566         Added. Used when we run out of characters.
2567         (WebCore::SegmentedString::clear): Removed code to clear now-deleted members.
2568         Updated for changes to other member names.
2569         (WebCore::SegmentedString::appendSubstring): Renamed from just append to
2570         avoid ambiguity with the public append function. Changed to take an rvalue
2571         reference, and move in, and added code to set m_currentCharacter properly,
2572         so the caller doesn't have to deal with that.
2573         (WebCore::SegmentedString::close): Updated to use m_isClosed by its new name.
2574         Also removed unneeded comment about assertion that fires when trying to close
2575         an already closed string.
2576         (WebCore::SegmentedString::append): Added overloads for rvalue references of
2577         both entire SegmentedString objects and of String. Streamlined to just call
2578         appendSubstring and append to the deque.
2579         (WebCore::SegmentedString::pushBack): Tightened up since we don't allow empty
2580         strings and changed to take just a string, not an entire segmented string.
2581         (WebCore::SegmentedString::advanceSubstring): Moved logic into the
2582         advancePastSingleCharacterSubstringWithoutUpdatingLineNumber function.
2583         (WebCore::SegmentedString::toString): Simplified now that we don't need to
2584         support pushed characters.
2585         (WebCore::SegmentedString::advancePastNonNewlines): Deleted.
2586         (WebCore::SegmentedString::advance8): Deleted.
2587         (WebCore::SegmentedString::advanceWithoutUpdatingLineNumber16): Renamed from
2588         advance16. Simplified now that there are no pushed characters. Also changed to
2589         access data members of m_currentSubstring directly instead of calling a function.
2590         (WebCore::SegmentedString::advanceAndUpdateLineNumber8): Deleted.
2591         (WebCore::SegmentedString::advanceAndUpdateLineNumber16): Ditto.
2592         (WebCore::SegmentedString::advancePastSingleCharacterSubstringWithoutUpdatingLineNumber):
2593         Renamed from advanceSlowCase. Removed uneeded logic to handle pushed characters.
2594         Moved code in here from advanceSubstring.
2595         (WebCore::SegmentedString::advancePastSingleCharacterSubstring): Renamed from
2596         advanceAndUpdateLineNumberSlowCase. Simplified by calling the function above.
2597         (WebCore::SegmentedString::advanceEmpty): Broke assertion up into two.
2598         (WebCore::SegmentedString::updateSlowCaseFunctionPointers): Updated for name changes.
2599         (WebCore::SegmentedString::advancePastSlowCase): Changed name and meaning of
2600         boolean argument. Rewrote to use the String class less; it's now used only when
2601         we fail to match after the first character rather than being used for the actual
2602         comparison with the literal.
2603
2604         * platform/text/SegmentedString.h: Moved all non-trivial function bodies out of
2605         the class definition to make things easier to read. Moved the SegmentedSubstring
2606         class inside the SegmentedString class, making it a private struct named Substring.
2607         Removed the m_ prefix from data members of the struct, removed many functions from
2608         the struct and made its union be anonymous instead of naming it m_data. Removed
2609         unneeded StringBuilder.h include.
2610         (WebCore::SegmentedString::isEmpty): Changed to use the length of the substring
2611         instead of a separate boolean. We never create an empty substring, nor leave one
2612         in place as the current substring unless the entire segmented string is empty.
2613         (WebCore::SegmentedString::advancePast): Updated to use the new member function
2614         template instead of a non-template member function. The new member function is
2615         entirely rewritten and does the matching directly rather than allocating a string
2616         just to do prefix matching.
2617         (WebCore::SegmentedString::advancePastLettersIgnoringASCIICase): Renamed to make
2618         it clear that the literal must be all non-letters or lowercase letters as with
2619         the other "letters ignoring ASCII case" functions. The three call sites all fit
2620         the bill. Implement by calling the new function template.
2621         (WebCore::SegmentedString::currentCharacter): Renamed from currentChar.
2622         (WebCore::SegmentedString::Substring::Substring): Use an rvalue reference and
2623         move the string in.
2624         (WebCore::SegmentedString::Substring::currentCharacter): Simplified since this
2625         is never used on an empty substring.
2626         (WebCore::SegmentedString::Substring::incrementAndGetCurrentCharacter): Ditto.
2627         (WebCore::SegmentedString::SegmentedString): Overload to take an rvalue reference.
2628         Simplified since there are now fewer data members.
2629         (WebCore::SegmentedString::advanceWithoutUpdatingLineNumber): Renamed from
2630         advance, since this is only safe to use if there is some reason it is OK to skip
2631         updating the line number.
2632         (WebCore::SegmentedString::advance): Renamed from advanceAndUpdateLineNumber,
2633         since doing that is the normal desired behavior and not worth mentioning in the
2634         public function name.
2635         (WebCore::SegmentedString::advancePastNewline): Renamed from
2636         advancePastNewlineAndUpdateLineNumber.
2637         (WebCore::SegmentedString::numberOfCharactersConsumed): Greatly simplified since
2638         pushed characters are no longer supported.
2639         (WebCore::SegmentedString::characterMismatch): Added. Used by advancePast.
2640
2641         * xml/parser/CharacterReferenceParserInlines.h:
2642         (WebCore::unconsumeCharacters): Use toString rather than toStringPreserveCapacity
2643         because the SegmentedString is going to take ownership of the string.
2644         (WebCore::consumeCharacterReference): Updated to use the pushBack that takes just
2645         a String, not a SegmentedString. Also use advancePastNonNewline.
2646
2647         * xml/parser/MarkupTokenizerInlines.h: Added ADVANCE_PAST_NON_NEWLINE_TO.
2648
2649         * xml/parser/XMLDocumentParser.cpp:
2650         (WebCore::XMLDocumentParser::insert): Updated since this takes an rvalue reference.
2651         (WebCore::XMLDocumentParser::append): Removed unnecessary code to create a
2652         SegmentedString.
2653         * xml/parser/XMLDocumentParser.h: Updated for above. Also fixed indentation
2654         and initialized most data members.
2655         * xml/parser/XMLDocumentParserLibxml2.cpp:
2656         (WebCore::XMLDocumentParser::XMLDocumentParser): Moved most data member
2657         initialization into the class definition.
2658         (WebCore::XMLDocumentParser::resumeParsing): Removed code that copied a
2659         segmented string, but converted the whole thing into a string before using it.
2660         Now we convert to a string right away.
2661
2662 2016-11-30  Csaba Osztrogon√°c  <ossy@webkit.org>
2663
2664         Unreviewed speculative cmake buildfix after r209070.
2665
2666         * PlatformMac.cmake: New sources added.
2667
2668 2016-11-29  Philippe Normand  <pnormand@igalia.com>
2669
2670         [WebRTC][OpenWebRTC] Temporary device selection support
2671         https://bugs.webkit.org/show_bug.cgi?id=165141
2672
2673         Reviewed by Alejandro G. Castro.
2674
2675         Make sure the player handles only one audio and video track at
2676         most for now. The device choice can be influenced with the
2677         WEBKIT_VIDEO_DEVICE and WEBKIT_AUDIO_DEVICE environment variables.
2678         Each variable optionally holds the name of the device to use.
2679
2680         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
2681         (WebCore::MediaPlayerPrivateGStreamerOwr::play):
2682         (WebCore::MediaPlayerPrivateGStreamerOwr::load):
2683
2684 2016-11-29  Claudio Saavedra  <csaavedra@igalia.com>
2685
2686         Build fix with !HAVE(ACCESSIBILITY)
2687
2688         * accessibility/AXObjectCache.h:
2689         (WebCore::AccessibilityReplacedText::AccessibilityReplacedText):
2690         (WebCore::AccessibilityReplacedText::postTextStateChangeNotification):
2691
2692         Add dummy implementations.
2693
2694 2016-11-29  Commit Queue  <commit-queue@webkit.org>
2695
2696         Unreviewed, rolling out r209058 and r209074.
2697         https://bugs.webkit.org/show_bug.cgi?id=165188
2698
2699         These changes caused API test StringBuilderTest.Equal to crash
2700         and/or fail. (Requested by ryanhaddad on #webkit).
2701
2702         Reverted changesets:
2703
2704         "Streamline and speed up tokenizer and segmented string
2705         classes"
2706         https://bugs.webkit.org/show_bug.cgi?id=165003
2707         http://trac.webkit.org/changeset/209058
2708
2709         "REGRESSION (r209058): API test StringBuilderTest.Equal
2710         crashing"
2711         https://bugs.webkit.org/show_bug.cgi?id=165142
2712         http://trac.webkit.org/changeset/209074
2713
2714 2016-11-29  Nan Wang  <n_wang@apple.com>
2715
2716         AX: ARIA tree & treeitem roles & aria-expanded state not spoken to VoiceOver iOS 10
2717         https://bugs.webkit.org/show_bug.cgi?id=164936
2718         <rdar://problem/29334274>
2719
2720         Reviewed by Chris Fleizach.
2721
2722         Added a new container type on iOS for trees. Also, since the treeitem role is ignored
2723         on iOS, we should expose the expanded status of a treeitem to its accessible children.
2724
2725         Test: accessibility/ios-simulator/treeitem-expanded.html
2726
2727         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2728         (-[WebAccessibilityObjectWrapper _accessibilityTreeAncestor]):
2729         (-[WebAccessibilityObjectWrapper treeItemParentForObject:]):
2730         (-[WebAccessibilityObjectWrapper accessibilitySupportsARIAExpanded]):
2731         (-[WebAccessibilityObjectWrapper accessibilityIsExpanded]):
2732
2733 2016-11-29  Chris Dumez  <cdumez@apple.com>
2734
2735         Unreviewed, rolling out r209096, r209104, and r209114.
2736
2737         Caused over 200 layout test failures on the bots
2738
2739         Reverted changesets:
2740
2741         "IndexedDB 2.0: Cache and reuse SQLiteStatements in the SQLite
2742         backend."
2743         https://bugs.webkit.org/show_bug.cgi?id=164974
2744         http://trac.webkit.org/changeset/209096
2745
2746         "Followup to:"
2747         https://bugs.webkit.org/show_bug.cgi?id=164974
2748         http://trac.webkit.org/changeset/209104
2749
2750         "REGRESSION (r209104): storage/indexeddb/modern/gc-closes-
2751         database(-private).html timeout."
2752         https://bugs.webkit.org/show_bug.cgi?id=165186
2753         http://trac.webkit.org/changeset/209114
2754
2755 2016-11-29  Antoine Quint  <graouts@apple.com>
2756
2757         [Modern Media Controls] Localization
2758         https://bugs.webkit.org/show_bug.cgi?id=165176
2759
2760         Reviewed by Dean Jackson.
2761
2762         We add a new localization file for the purpose of modern media controls, since we may
2763         require different strings than the legacy one.
2764
2765         * English.lproj/modern-media-controls-localized-strings.js: Added.
2766         * Modules/modern-media-controls/controls/airplay-placard.js:
2767         (AirplayPlacard):
2768         * Modules/modern-media-controls/controls/pip-placard.js:
2769         (PiPPlacard):
2770         * Modules/modern-media-controls/main.js:
2771         (UIString):
2772         * Modules/modern-media-controls/media/status-support.js:
2773         (StatusSupport.prototype.syncControl):
2774         (StatusSupport):
2775         * WebCore.xcodeproj/project.pbxproj:
2776         * rendering/RenderThemeMac.mm:
2777         (WebCore::RenderThemeMac::mediaControlsScript):
2778
2779 2016-11-29  Antoine Quint  <graouts@apple.com>
2780
2781         [Modern Media Controls] Show an invalid placard when we fail to load a media file
2782         https://bugs.webkit.org/show_bug.cgi?id=165180
2783
2784         Reviewed by Dean Jackson.
2785
2786         We now show a placard with an "invalid" icon when we fail to load the media file.
2787
2788         Tests: media/modern-media-controls/invalid-placard/invalid-placard.html
2789                media/modern-media-controls/placard-support/placard-support-error.html
2790
2791         * Modules/modern-media-controls/controls/icon-service.js:
2792         * Modules/modern-media-controls/controls/invalid-placard.js: Added.
2793         (InvalidPlacard):
2794         * Modules/modern-media-controls/controls/media-controls.js:
2795         (MediaControls.prototype.get showsStartButton):
2796         (MediaControls.prototype.set showsStartButton):
2797         (MediaControls.prototype.get showsPlacard):
2798         (MediaControls.prototype.hidePlacard):
2799         (MediaControls.prototype._invalidateChildren):
2800         * Modules/modern-media-controls/controls/placard.css:
2801         (.placard .icon):
2802         * Modules/modern-media-controls/images/iOS/invalid-placard@1x.png: Added.
2803         * Modules/modern-media-controls/images/iOS/invalid-placard@2x.png: Added.
2804         * Modules/modern-media-controls/images/iOS/invalid-placard@3x.png: Added.
2805         * Modules/modern-media-controls/images/macOS/invalid-placard@1x.png: Added.
2806         * Modules/modern-media-controls/images/macOS/invalid-placard@2x.png: Added.
2807         * Modules/modern-media-controls/js-files:
2808         * Modules/modern-media-controls/media/placard-support.js:
2809         (PlacardSupport.prototype.get mediaEvents):
2810         (PlacardSupport.prototype._updatePlacard):
2811         (PlacardSupport):
2812         * WebCore.xcodeproj/project.pbxproj:
2813
2814 2016-11-29  Antoine Quint  <graouts@apple.com>
2815
2816         [Modern Media Controls] Only show controls when the controls attribute is set
2817         https://bugs.webkit.org/show_bug.cgi?id=165175
2818
2819         We now respect the value of the media's "controls" attribute so that the start button and the controls
2820         bar are only shown when that attribute is set to "true".
2821
2822         Reviewed by Dean Jackson.
2823
2824         Tests: media/modern-media-controls/controls-visibility-support/controls-visibility-support-controls-off-audio.html
2825                media/modern-media-controls/controls-visibility-support/controls-visibility-support-controls-off.html
2826                media/modern-media-controls/controls-visibility-support/controls-visibility-support-controls-on-audio.html
2827                media/modern-media-controls/controls-visibility-support/controls-visibility-support-controls-on.html
2828                media/modern-media-controls/controls-visibility-support/controls-visibility-support-controls-toggle.html
2829
2830         * Modules/modern-media-controls/controls/controls-bar.js: Added.
2831         (ControlsBar):
2832         * Modules/modern-media-controls/controls/media-controls.js:
2833         (MediaControls.): Deleted.
2834         * Modules/modern-media-controls/js-files:
2835         * Modules/modern-media-controls/media/controls-visibility-support.js: Added.
2836         (ControlsVisibilitySupport):
2837         (ControlsVisibilitySupport.prototype.destroy):
2838         (ControlsVisibilitySupport.prototype.get mediaEvents):
2839         (ControlsVisibilitySupport.prototype.syncControl):
2840         * Modules/modern-media-controls/media/media-controller-support.js:
2841         (MediaControllerSupport):
2842         (MediaControllerSupport.prototype.handleEvent):
2843         * Modules/modern-media-controls/media/media-controller.js:
2844         (MediaController.prototype._updateControlsIfNeeded):
2845         * WebCore.xcodeproj/project.pbxproj:
2846
2847 2016-11-29  Brady Eidson  <beidson@apple.com>
2848
2849         Followup to:
2850         IndexedDB 2.0: Cache and reuse SQLiteStatements in the SQLite backend.
2851         https://bugs.webkit.org/show_bug.cgi?id=164974
2852
2853         Unreviewed.
2854
2855         * Modules/indexeddb/IDBTransaction.h: Until I can explore further why these operations
2856           are not protected in the map, change these raw pointers to RefPtrs.
2857           This fixes issues seen under GuardMalloc.
2858
2859 2016-11-29  Antoine Quint  <graouts@apple.com>
2860
2861         [Modern Media Controls] Inline controls show when entering fullscreen
2862         https://bugs.webkit.org/show_bug.cgi?id=165161
2863
2864         Reviewed by Dean Jackson.
2865
2866         We would error when entering fullscreen due to the TracksSupport having its destroy() method
2867         called when tearing down the inline controls and the `mediaController` reference being incorrect.
2868
2869         * Modules/modern-media-controls/media/tracks-support.js:
2870         (TracksSupport.prototype.destroy):
2871
2872 2016-11-29  Antoine Quint  <graouts@apple.com>
2873
2874         [Modern Media Controls] Status text stuck saying "Loading" after media starts playing
2875         https://bugs.webkit.org/show_bug.cgi?id=165162
2876
2877         Reviewed by Dean Jackson.
2878
2879         We forgot to handle the case where none of the special messages need to be set and the
2880         status text should be just an empty string, meaning there is no status text shown in the
2881         controls bar and the scrubber appears instead.
2882
2883         Test: media/modern-media-controls/status-support/status-support-playing.html
2884
2885         * Modules/modern-media-controls/media/status-support.js:
2886         (StatusSupport.prototype.syncControl):
2887         (StatusSupport):
2888
2889 2016-11-29  Brady Eidson  <beidson@apple.com>
2890
2891         IndexedDB 2.0: Cache and reuse SQLiteStatements in the SQLite backend.
2892         https://bugs.webkit.org/show_bug.cgi?id=164974
2893
2894         Reviewed by Alex Christensen.
2895
2896         No new tests (No behavior change other than being faster).
2897
2898         Instead of building new SQLiteStatements from scratch each time they're needed and then
2899         finalizing them after used for a single operation, cache them.
2900
2901         For tests that do puts and/or gets in tight loops, this shows up as a 5%-20% speedup on profiles.
2902
2903         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
2904         (WebCore::IDBServer::SQLiteIDBBackingStore::createAndPopulateInitialDatabaseInfo):
2905         (WebCore::IDBServer::SQLiteIDBBackingStore::getOrEstablishDatabaseInfo):
2906         (WebCore::IDBServer::SQLiteIDBBackingStore::createObjectStore):
2907         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteObjectStore):
2908         (WebCore::IDBServer::SQLiteIDBBackingStore::renameObjectStore):
2909         (WebCore::IDBServer::SQLiteIDBBackingStore::clearObjectStore):
2910         (WebCore::IDBServer::SQLiteIDBBackingStore::createIndex):
2911         (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedHasIndexRecord):
2912         (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedPutIndexRecord):
2913         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteIndex):
2914         (WebCore::IDBServer::SQLiteIDBBackingStore::renameIndex):
2915         (WebCore::IDBServer::SQLiteIDBBackingStore::keyExistsInObjectStore):
2916         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteUnusedBlobFileRecords):
2917         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRecord):
2918         (WebCore::IDBServer::SQLiteIDBBackingStore::updateAllIndexesForAddRecord):
2919         (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord):
2920         (WebCore::IDBServer::SQLiteIDBBackingStore::getBlobRecordsForObjectStoreRecord):
2921         (WebCore::IDBServer::SQLiteIDBBackingStore::getRecord):
2922         (WebCore::IDBServer::SQLiteIDBBackingStore::cachedStatementForGetAllObjectStoreRecords):
2923         (WebCore::IDBServer::SQLiteIDBBackingStore::getAllObjectStoreRecords):
2924         (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetKeyGeneratorValue):
2925         (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedSetKeyGeneratorValue):
2926         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteBackingStore):
2927         (WebCore::IDBServer::SQLiteIDBBackingStore::cachedStatement):
2928         (WebCore::IDBServer::SQLiteIDBBackingStore::closeSQLiteDB):
2929         (WebCore::IDBServer::queryForGetAllObjectStoreRecords): Deleted.
2930         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
2931
2932 2016-11-22  Jiewen Tan  <jiewen_tan@apple.com>
2933
2934         Update SubtleCrypto::sign to match the latest spec
2935         https://bugs.webkit.org/show_bug.cgi?id=164740
2936         <rdar://problem/29257864>
2937
2938         Reviewed by Brent Fulgham.
2939
2940         This patch does following few things:
2941         1. It updates the SubtleCrypto::sign method to match the latest spec:
2942            https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-sign.
2943            It also refers to the latest Editor's Draft to a certain degree:
2944            https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-sign.
2945         2. It implements sign operations of the following algorithms: HMAC, and
2946            RSASSA-PKCS1-V1_5.
2947         3. It also replaces promise.copyRef() with WTFMove(promise) for all the
2948            capture lists of exception callbacks in promise functions.
2949
2950         Tests: crypto/subtle/hmac-import-key-sign-sha1.html
2951                crypto/subtle/hmac-import-key-sign-sha224.html
2952                crypto/subtle/hmac-import-key-sign-sha256.html
2953                crypto/subtle/hmac-import-key-sign-sha384.html
2954                crypto/subtle/hmac-import-key-sign-sha512.html
2955                crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha1.html
2956                crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha224.html
2957                crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha256.html
2958                crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha384.html
2959                crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha512.html
2960                crypto/subtle/sign-malformed-parameters.html
2961                crypto/workers/subtle/hmac-import-key-sign.html
2962                crypto/workers/subtle/rsassa-pkcs1-v1_5-import-key-sign.html
2963
2964         * bindings/js/JSSubtleCryptoCustom.cpp:
2965         (WebCore::normalizeCryptoAlgorithmParameters):
2966         (WebCore::jsSubtleCryptoFunctionDecryptPromise):
2967         Fix a minor bug.
2968         (WebCore::jsSubtleCryptoFunctionEncryptPromise):
2969         (WebCore::jsSubtleCryptoFunctionDecryptPromise):
2970         (WebCore::jsSubtleCryptoFunctionSignPromise):
2971         (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise):
2972         (WebCore::jsSubtleCryptoFunctionImportKeyPromise):
2973         (WebCore::jsSubtleCryptoFunctionExportKeyPromise):
2974         (WebCore::JSSubtleCrypto::sign):
2975         * crypto/CryptoAlgorithm.cpp:
2976         (WebCore::CryptoAlgorithm::sign):
2977         * crypto/CryptoAlgorithm.h:
2978         * crypto/SubtleCrypto.idl:
2979         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
2980         (WebCore::CryptoAlgorithmHMAC::sign):
2981         * crypto/algorithms/CryptoAlgorithmHMAC.h:
2982         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
2983         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
2984         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
2985         * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp:
2986         (WebCore::CryptoAlgorithmHMAC::platformSign):
2987         * crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp:
2988         (WebCore::CryptoAlgorithmHMAC::platformSign):
2989         * crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp:
2990         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
2991         * crypto/mac/CryptoAlgorithmHMACMac.cpp:
2992         (WebCore::commonCryptoHMACAlgorithm):
2993         (WebCore::calculateSignature):
2994         Remove a null guardance since the depending bug is resolved.
2995         (WebCore::CryptoAlgorithmHMAC::platformSign):
2996         (WebCore::CryptoAlgorithmHMAC::platformVerify):
2997         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
2998         (WebCore::signRSASSA_PKCS1_v1_5):
2999         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
3000
3001 2016-11-29  Chris Dumez  <cdumez@apple.com>
3002
3003         Can't download move.simple.com direct deposit transition PDF: Non user-triggered activations of anchors that have a download attribute are ignored
3004         https://bugs.webkit.org/show_bug.cgi?id=165148
3005         <rdar://problem/29421771>
3006
3007         Reviewed by Daniel Bates.
3008
3009         We were ignoring non user-triggered activations of anchors that have a
3010         download attribute which is stricter than Chrome and Firefox and breaks
3011         downloads on move.simple.com. This patch relaxes our policy to allow
3012         simulated clicks on such links, similarly to other browsers.
3013
3014         Web authors can anyway already trigger downloads using script by setting
3015         window.location to a specific URL and serving to right HTTP headers to
3016         trigger a download.
3017
3018         Note that our previous behavior matches the current version of the
3019         specification so I also filed a bug against the HTML specification to
3020         see if we can get it changed to match the behavior of browsers:
3021         - https://github.com/whatwg/html/issues/2116
3022
3023         No new tests, updated existing test.
3024
3025         * html/HTMLAnchorElement.cpp:
3026         (WebCore::HTMLAnchorElement::handleClick):
3027
3028 2016-11-29  Andy Estes  <aestes@apple.com>
3029
3030         [Cocoa] Enable two clang warnings recommended by Xcode
3031         https://bugs.webkit.org/show_bug.cgi?id=164498
3032
3033         Reviewed by Mark Lam.
3034
3035         * Configurations/Base.xcconfig: Enabled CLANG_WARN_INFINITE_RECURSION and CLANG_WARN_SUSPICIOUS_MOVE.
3036
3037 2016-11-29  Wenson Hsieh  <wenson_hsieh@apple.com>
3038
3039         Address post-review feedback following r209070 (AppKit momentum scrolling adoption for scroll snapping)
3040         https://bugs.webkit.org/show_bug.cgi?id=165147
3041
3042         Reviewed by Simon Fraser.
3043
3044         Addresses some additional review feedback after r209070, which adopts _NSScrollingMomentumCalculator for scroll
3045         snapping. See individual changes below for more details. No new tests, since there is no behavior change.
3046
3047         * page/EventHandler.cpp:
3048         (WebCore::handleWheelEventInAppropriateEnclosingBox):
3049         (WebCore::EventHandler::defaultWheelEventHandler):
3050         * page/Page.cpp:
3051         (WebCore::Page::ensureTestTrigger):
3052         * page/WheelEventDeltaFilter.cpp:
3053         (WebCore::WheelEventDeltaFilter::filteredVelocity):
3054         * page/WheelEventDeltaFilter.h:
3055         * page/mac/WheelEventDeltaFilterMac.mm:
3056         (WebCore::WheelEventDeltaFilterMac::updateFromDelta):
3057         * page/scrolling/AsyncScrollingCoordinator.cpp:
3058         (WebCore::AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView):
3059         * page/scrolling/AsyncScrollingCoordinator.h:
3060         * page/scrolling/ScrollingCoordinator.h:
3061         (WebCore::ScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView):
3062
3063         Rather than force a complete layout pass when the Page first acquires a WheelEventTestTrigger, we now simply
3064         have the scrolling coordinator update its frame node to expect a wheel event test trigger.
3065
3066         * page/scrolling/ScrollingMomentumCalculator.cpp:
3067         (WebCore::ScrollingMomentumCalculator::ScrollingMomentumCalculator):
3068         (WebCore::ScrollingMomentumCalculator::create):
3069         (WebCore::BasicScrollingMomentumCalculator::BasicScrollingMomentumCalculator):
3070         (WebCore::BasicScrollingMomentumCalculator::scrollOffsetAfterElapsedTime):
3071         (WebCore::BasicScrollingMomentumCalculator::animationDuration):
3072         (WebCore::BasicScrollingMomentumCalculator::initializeSnapProgressCurve):
3073         (WebCore::BasicScrollingMomentumCalculator::animationProgressAfterElapsedTime):
3074         * page/scrolling/ScrollingMomentumCalculator.h:
3075         * page/scrolling/mac/ScrollingMomentumCalculatorMac.h:
3076         * page/scrolling/mac/ScrollingMomentumCalculatorMac.mm:
3077         (WebCore::ScrollingMomentumCalculator::create):
3078         (WebCore::ScrollingMomentumCalculatorMac::ScrollingMomentumCalculatorMac):
3079         (WebCore::ScrollingMomentumCalculatorMac::scrollOffsetAfterElapsedTime):
3080         (WebCore::ScrollingMomentumCalculatorMac::animationDuration):
3081         (WebCore::ScrollingMomentumCalculatorMac::ensurePlatformMomentumCalculator):
3082         * platform/PlatformWheelEvent.h:
3083         (WebCore::PlatformWheelEvent::copyWithDeltasAndVelocity):
3084         (WebCore::PlatformWheelEvent::scrollingVelocity):
3085
3086         Change scrolling velocity in PlatformWheelEvent to be a FloatSize instead of a FloatPoint. This change
3087         propagates to the ScrollController, where state variables and arguments pertaining to scrolling velocity are
3088         also now sizes instead of points.
3089
3090         * platform/cocoa/ScrollController.h:
3091         * platform/cocoa/ScrollController.mm:
3092         (WebCore::ScrollController::scheduleStatelessScrollSnap):
3093         * platform/cocoa/ScrollSnapAnimatorState.h:
3094         * platform/cocoa/ScrollSnapAnimatorState.mm:
3095         (WebCore::ScrollSnapAnimatorState::transitionToGlideAnimationState):
3096         (WebCore::ScrollSnapAnimatorState::setupAnimationForState):
3097         (WebCore::ScrollSnapAnimatorState::teardownAnimationForState):
3098         (WebCore::ScrollSnapAnimatorState::currentAnimatedScrollOffset):
3099
3100         Refactor elapsed time to be Seconds instead of double. Additionally, use MonotonicTime::now() instead of
3101         monotonicallyIncreasingTime(), and MonotonicTime instead of double for keeping track of the start time.
3102
3103         * platform/spi/mac/NSScrollingMomentumCalculatorSPI.h:
3104
3105 2016-11-29  Brady Eidson  <beidson@apple.com>
3106
3107         IndexedDB 2.0: The client's transaction operation queue should flush as much to the server as possible.
3108         https://bugs.webkit.org/show_bug.cgi?id=164932
3109
3110         Reviewed by Alex Christensen.
3111
3112         No new tests (No new test necessary, covered extensively by all existing tests).
3113
3114         Profiles showed that on tests with lots of rapid IDBRequests in a row, both the main thread and database 
3115         threads were largely idle.
3116
3117         The explanation was simple. Currently the client IDBTransaction queues up operations and only vends them out 
3118         to the server 1 at a time, waiting for the previous operation to complete.
3119
3120         While some operations do need to wait for the server to reply, by making the change to send most operations 
3121         (all operations with an associated IDBRequest) to the server without waiting we get rid of most of the idleness.
3122
3123         It is possible we can find a few other types of operations to send without waiting, but we haven't yet seen any
3124         test case where they would show up on profiles.
3125
3126         Sending more than one operation at a time was actually a very small part of this change.
3127         As many "edge case" regression tests revealed, we also needed to start having IDBTransaction track all of their
3128         "in progress" operations such that they could be aborted on the client side in exceptional circumstances.
3129
3130         * Modules/indexeddb/IDBTransaction.cpp:
3131         (WebCore::IDBTransaction::abortInProgressOperations): Abort's all in-progress operations (ones that have already
3132           been sent to the server)
3133         (WebCore::IDBTransaction::abortOnServerAndCancelRequests): Abort in-progress operations before pending ones.
3134         (WebCore::IDBTransaction::operationTimerFired): If we just started an operation with an associated IDBRequest,
3135           schedule the timer to send another one right away.
3136         (WebCore::IDBTransaction::operationDidComplete):
3137         (WebCore::IDBTransaction::connectionClosedFromServer): Abort in-progress operations before pending ones.
3138         * Modules/indexeddb/IDBTransaction.h:
3139
3140         * Modules/indexeddb/client/TransactionOperation.cpp:
3141         (WebCore::IDBClient::TransactionOperation::TransactionOperation):
3142         * Modules/indexeddb/client/TransactionOperation.h:
3143         (WebCore::IDBClient::TransactionOperation::completed):
3144         (WebCore::IDBClient::TransactionOperation::hasIDBRequest):
3145
3146 2016-11-29  Dave Hyatt  <hyatt@apple.com>
3147
3148         [CSS Parser] Fix ::cue parsing
3149         https://bugs.webkit.org/show_bug.cgi?id=165152
3150
3151         Reviewed by Zalan Bujtas.
3152
3153         * css/parser/CSSParserValues.h:
3154         (WebCore::CSSParserSelector::setPseudoElementType):
3155         * css/parser/CSSSelectorParser.cpp:
3156         (WebCore::isOnlyPseudoClassFunction):
3157         (WebCore::isOnlyPseudoElementFunction):
3158         (WebCore::CSSSelectorParser::consumePseudo):
3159         (WebCore::isPseudoClassFunction): Deleted.
3160         (WebCore::isPseudoElementFunction): Deleted.
3161
3162 2016-11-28  Gavin Barraclough  <barraclough@apple.com>
3163
3164         HTMLMediaElement::updateVolume should updateIsPlayingMedia
3165         https://bugs.webkit.org/show_bug.cgi?id=165132
3166
3167         Reviewed by Darin Adler & Jer Noble.
3168
3169         HTMLMediaElement::mediaState takes the volume into account when determining whether media
3170         is playing (audio is not considered to be playing if volume is 0). As such, any change to
3171         the volume may require mediaState to be recomputed.
3172
3173         * html/HTMLMediaElement.cpp:
3174         (WebCore::HTMLMediaElement::updateVolume):
3175
3176 2016-11-29  Daniel Bates  <dabates@apple.com>
3177
3178         Avoid ref-count churn in ShadowParseContext::commitColor()
3179         https://bugs.webkit.org/show_bug.cgi?id=165125
3180
3181         Reviewed by Simon Fraser.
3182
3183         Avoid ref-count churn in ShadowParseContext::commitColor() by moving the passed
3184         color into its instance variable.
3185
3186         Also modified ShadowParseContext::commitColor() to take a Ref<> instead of a
3187         RefPtr<> because it is never passed a nullptr.
3188
3189         * css/parser/CSSParser.cpp:
3190         (WebCore::ShadowParseContext::commitColor):
3191
3192 2016-11-29  Daniel Bates  <dabates@apple.com>
3193
3194         Avoid ref-count churn in CSSParser::ValueWithCalculation::setCalculation()
3195         https://bugs.webkit.org/show_bug.cgi?id=165127
3196
3197         Reviewed by Simon Fraser.
3198
3199         Use WTFMove() to move the passed RefPtr into CSSParser::ValueWithCalculation::m_calculation
3200         instead of copying it.
3201
3202         * css/parser/CSSParser.h:
3203         (WebCore::CSSParser::ValueWithCalculation::setCalculation):
3204
3205 2016-11-29  Daniel Bates  <dabates@apple.com>
3206
3207         CryptoAlgorithm::generateKey() should take lvalue reference to const CryptoAlgorithmParameters
3208         https://bugs.webkit.org/show_bug.cgi?id=165111
3209
3210         Reviewed by Darin Adler.
3211
3212         CryptoAlgorithm::generateKey() and its overrides always expect to receive a non-null pointer
3213         to a CryptoAlgorithmParameter object and never take ownership of it. This kind of relationship
3214         is best expressed by modifying CryptoAlgorithm::generateKey() to take a lvalue reference to
3215         a const CryptoAlgorithmParameter object.
3216
3217         * bindings/js/JSSubtleCryptoCustom.cpp:
3218         (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise):
3219         * crypto/CryptoAlgorithm.cpp:
3220         (WebCore::CryptoAlgorithm::generateKey):
3221         * crypto/CryptoAlgorithm.h:
3222         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
3223         (WebCore::CryptoAlgorithmAES_CBC::generateKey):
3224         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
3225         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
3226         (WebCore::CryptoAlgorithmAES_KW::generateKey):
3227         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
3228         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
3229         (WebCore::CryptoAlgorithmHMAC::generateKey):
3230         * crypto/algorithms/CryptoAlgorithmHMAC.h:
3231         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
3232         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::generateKey):
3233         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
3234         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
3235         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey):
3236         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
3237         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
3238         (WebCore::CryptoAlgorithmRSA_OAEP::generateKey):
3239         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
3240
3241 2016-11-29  Andy Estes  <aestes@apple.com>
3242
3243         window.name leaks information across domains
3244         https://bugs.webkit.org/show_bug.cgi?id=158216
3245         <rdar://problem/14548481>
3246
3247         Reviewed by Brent Fulgham.
3248
3249         When updating the history after a cross-origin navigation, the HTML Standard says:
3250
3251         "If the browsing context is a top-level browsing context, but not an auxiliary browsing
3252         context, then set the browsing context's name to the empty string."
3253
3254         https://html.spec.whatwg.org/multipage/browsers.html#resetBCName
3255
3256         Tests: http/tests/security/window-name-after-cross-origin-aux-frame-navigation.html
3257                http/tests/security/window-name-after-cross-origin-main-frame-navigation.html
3258                http/tests/security/window-name-after-cross-origin-sub-frame-navigation.html
3259                http/tests/security/window-name-after-same-origin-aux-frame-navigation.html
3260                http/tests/security/window-name-after-same-origin-main-frame-navigation.html
3261                http/tests/security/window-name-after-same-origin-sub-frame-navigation.html
3262
3263         * loader/FrameLoader.cpp:
3264         (WebCore::shouldClearWindowName): Returns true if frame is a main frame with no opener and
3265         newDocument does not have the same origin as the frame's current document.
3266         (WebCore::FrameLoader::clear): Changed to set m_frame's name to nullAtom if
3267         clearWindowProperties and shouldClearWindowName() are true.
3268         * page/SecurityOrigin.cpp:
3269         (WebCore::SecurityOrigin::canAccessStorage): Changed to call isSameOriginAs() and check
3270         m_universalAccess.
3271         (WebCore::SecurityOrigin::isSameOriginAs): Renamed from isThirdParty(); removed the check
3272         for m_universalAccess.
3273         (WebCore::SecurityOrigin::isThirdParty): Renamed to isSameOriginAs().
3274         * page/SecurityOrigin.h: Renamed isThirdParty() to isSameOriginAs() and made it public.
3275
3276 2016-11-29  Dave Hyatt  <hyatt@apple.com>
3277
3278         [CSS Parser] Fix parsing of "all" in transitions
3279         https://bugs.webkit.org/show_bug.cgi?id=165144
3280
3281         Reviewed by Dean Jackson.
3282
3283         * css/parser/CSSPropertyParser.cpp:
3284         (WebCore::consumeTransitionProperty):
3285
3286 2016-11-29  Dave Hyatt  <hyatt@apple.com>
3287
3288         [CSS Parser] Fix @page rule parsing
3289         https://bugs.webkit.org/show_bug.cgi?id=165143
3290
3291         Reviewed by Zalan Bujtas.
3292
3293         * css/parser/CSSParserImpl.cpp:
3294         (WebCore::CSSParserImpl::parsePageSelector):
3295
3296 2016-11-29  Wenson Hsieh  <wenson_hsieh@apple.com>
3297
3298         Unreviewed, fix the build after r209070
3299
3300         -[ScrollingMomentumCalculatorMac calculateToReachDestination] is only available on Sierra.
3301
3302         * page/scrolling/mac/ScrollingMomentumCalculatorMac.mm:
3303         (WebCore::ScrollingMomentumCalculatorMac::ensurePlatformMomentumCalculator):
3304         * platform/spi/mac/NSScrollingMomentumCalculatorSPI.h:
3305
3306 2016-11-28  Wenson Hsieh  <wenson_hsieh@apple.com>
3307
3308         Scroll snapping on Mac should use AppKit animations
3309         https://bugs.webkit.org/show_bug.cgi?id=147261
3310         <rdar://problem/29395293>
3311
3312         Reviewed by Brent Fulgham.
3313
3314         Refactors the scroll snapping animation logic to support arbitrary scrolling momentum calculators and
3315         introduces ScrollingMomentumCalculatorMac, which wraps AppKit's _NSScrollingMomentumCalculator. On macOS El
3316         Capitan and later, we use the platform scrolling momentum calculator and for all other cases, we fall back to
3317         the preexissting platform-invariant momentum calculator.
3318
3319         Previously, the scroll snapping animation logic was shared between the ScrollSnapAnimatorState and
3320         ScrollController -- namely, the ScrollController would update various parameters of the ScrollSnapAnimatorState
3321         and then tell it to compute animation-specific constants and coefficients. After this patch, ScrollController
3322         will no longer directly set the ScrollSnapAnimatorState's member variables. Instead, it will tell the animator
3323         state to transition to a new ScrollSnapState with the necessary parameters, and the ScrollSnapAnimatorState is
3324         responsible for modifying itself accordingly. Furthermore, logic pertaining to computing animated scroll offsets
3325         is now split out into a new ScrollingMomentumCalculator, which may have different platform-dependent
3326         implementations. The correct calculator is initialized via ScrollingMomentumCalculator::create, which currently
3327         returns a ScrollingMomentumCalculatorMac on El Capitan and later, and a BasicScrollingMomentumCalculator
3328         otherwise.
3329
3330         The new abstracted ScrollingMomentumCalculator is initialized with various parameters describing the scrolled
3331         content and viewport, as well as the initial and target scrolling offsets. The momentum calculator is then able
3332         to compute the animated scroll offset at any given elapsed time, as well as the total duration of the snapping
3333         animation. The ScrollController's scroll snap timer uses this information (via the ScrollSnapAnimatorState) to
3334         animate its client's scroll offset during a snap or glide.
3335
3336         Also reenables 8 failing and/or flaky scroll snapping tests and adds a new layout test. This patch addresses
3337         two causes for failures and flakiness in these scroll snapping tests:
3338
3339         1.  When starting or stopping the scroll snap animation timer, we call deferTestsForReason and
3340             removeTestDeferralForReason, respectively. These were actually noops for the first simulated scroll gesture
3341             on each of the failing mainframe scrolling tests due to m_expectsWheelEventTestTrigger being false. This
3342             member variable is updated when AsyncScrollingCoordinator::frameViewLayoutUpdated is invoked, wherein we
3343             call ScrollingStateFrameScrollingNode::setExpectsWheelEventTestTrigger(true) when the test has started
3344             monitoring wheel events. However, if this does not happen before scrolling begins in the test (which is the
3345             case here), then the mainframe scrolling node will not expect a wheel event test trigger even though
3346             eventSender.monitorWheelEvents() has been called. To fix this, we simply make the Page trigger a layout of
3347             the main FrameView when first ensuring the wheel event test trigger on the Page.
3348
3349         2.  The second reason for flakiness affects both overflow and mainframe scrolling. Previously, due to the way
3350             we would wait for multiple momentum scroll events before starting to glide, we would end up starting the
3351             scroll snap timer for a snapping animation, stopping it, and then starting it again for the glide animation.
3352             Thus, if the wheel event test trigger's timer fires right after the scroll snap timer stops and before it
3353             starts again due to a glide animation, it will erroneously think that scroll snapping is complete, even
3354             though it's only just about to begin! Now that we know scrolling velocity when we receive the initial
3355             "momentum begin", we now directly transition the scroll snap state from a snapping state to a gliding state
3356             and no longer stop and start the timer during this transition, which means that the test trigger will be
3357             deferred for at least the entire duration of the scroll snapping animation (starting right after the first
3358             "drag end" wheel event).
3359
3360         Test: tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-vertical-then-horizontal.html
3361
3362         * WebCore.xcodeproj/project.pbxproj:
3363         * page/EventHandler.cpp:
3364         (WebCore::handleWheelEventInAppropriateEnclosingBox):
3365         (WebCore::EventHandler::defaultWheelEventHandler):
3366         * page/Page.cpp:
3367         (WebCore::Page::ensureTestTrigger):
3368
3369         Addresses test failures by forcing the mainframe scrolling node to expect wheel event test triggers.
3370
3371         * page/WheelEventDeltaFilter.cpp:
3372         (WebCore::WheelEventDeltaFilter::create):
3373         (WebCore::WheelEventDeltaFilter::filteredVelocity):
3374         * page/WheelEventDeltaFilter.h:
3375         * page/mac/WheelEventDeltaFilterMac.mm:
3376         (WebCore::WheelEventDeltaFilterMac::updateFromDelta):
3377
3378         Add support for plumbing filtered scrolling velocity over to the ScrollController.
3379
3380         * page/scrolling/ScrollingMomentumCalculator.cpp: Copied from Source/WebCore/platform/cocoa/ScrollSnapAnimatorState.mm.
3381         (WebCore::ScrollingMomentumCalculator::ScrollingMomentumCalculator):
3382         (WebCore::ScrollingMomentumCalculator::create):
3383
3384         Creates a platform-independent BasicScrollingMomentumCalculator.
3385
3386         (WebCore::BasicScrollingMomentumCalculator::BasicScrollingMomentumCalculator):
3387         (WebCore::BasicScrollingMomentumCalculator::linearlyInterpolatedOffsetAtProgress):
3388         (WebCore::BasicScrollingMomentumCalculator::cubicallyInterpolatedOffsetAtProgress):
3389         (WebCore::BasicScrollingMomentumCalculator::scrollOffsetAfterElapsedTime):
3390         (WebCore::BasicScrollingMomentumCalculator::animationDuration):
3391         (WebCore::BasicScrollingMomentumCalculator::initializeInterpolationCoefficientsIfNecessary):
3392         (WebCore::BasicScrollingMomentumCalculator::initializeSnapProgressCurve):
3393         (WebCore::BasicScrollingMomentumCalculator::animationProgressAfterElapsedTime):
3394
3395         Interpolation logic ported over from Scroll