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