ee4e749c65c8593449187c0e2e9573fa8b9d9d83
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-11-12  Dan Bernstein  <mitz@apple.com>
2
3         Tried to fix the iOS build after r208666.
4
5         * platform/SuddenTermination.h:
6
7 2016-11-12  Simon Fraser  <simon.fraser@apple.com>
8
9         Add a way to get the UI-side scrolling tree as text via UIScriptController
10         https://bugs.webkit.org/show_bug.cgi?id=164697
11
12         Reviewed by Zalan Bujtas.
13
14         Add dumping to ScrollingTreeNode and subclasses (previously, we could only dump
15         the scrolling state tree). This re-uses the flags used for state tree dumping.
16
17         NodeIDs are not dumped by default because they can depend on earlier tests.
18
19         Test: scrollingcoordinator/ios/ui-scrolling-tree.html
20
21         * page/scrolling/ScrollingStateNode.h:
22         * page/scrolling/ScrollingTree.cpp:
23         (WebCore::ScrollingTree::scrollingTreeAsText):
24         * page/scrolling/ScrollingTree.h:
25         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
26         (WebCore::ScrollingTreeFrameScrollingNode::dumpProperties):
27         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
28         * page/scrolling/ScrollingTreeNode.cpp:
29         (WebCore::ScrollingTreeNode::dumpProperties):
30         (WebCore::ScrollingTreeNode::dump):
31         * page/scrolling/ScrollingTreeNode.h:
32         * page/scrolling/ScrollingTreeScrollingNode.cpp:
33         (WebCore::ScrollingTreeScrollingNode::dumpProperties):
34         * page/scrolling/ScrollingTreeScrollingNode.h:
35         * page/scrolling/mac/ScrollingTreeFixedNode.h:
36         * page/scrolling/mac/ScrollingTreeFixedNode.mm:
37         (WebCore::ScrollingTreeFixedNode::dumpProperties):
38         * page/scrolling/mac/ScrollingTreeStickyNode.h:
39         * page/scrolling/mac/ScrollingTreeStickyNode.mm:
40         (WebCore::ScrollingTreeStickyNode::dumpProperties):
41
42 2016-11-12  Darin Adler  <darin@apple.com>
43
44         Remove some use of ExceptionCode in MediaStream
45         https://bugs.webkit.org/show_bug.cgi?id=164690
46
47         Reviewed by Sam Weinig.
48
49         * Modules/mediastream/MediaDevices.cpp:
50         (WebCore::MediaDevices::MediaDevices): Take a Document&.
51         (WebCore::MediaDevices::create): Ditto.
52         (WebCore::MediaDevices::~MediaDevices): Deleted.
53         (WebCore::MediaDevices::getUserMedia): Check document for null and
54         pass a reference to UserMediaRequest::start. Removed unused ExceptionCode
55         argument to UserMediaRequest::start, since the only exception was for
56         a null document.
57         (WebCore::MediaDevices::enumerateDevices): Check document for null and
58         pass a reference to MediaDevicesRequest::create. Removed exception
59         handling entirely because MediaDevicesRequest::create was not ever
60         raising an exception before.
61         * Modules/mediastream/MediaDevices.h: Updated for above changes.
62         * Modules/mediastream/MediaDevices.idl: Removed MayThrowException from
63         enumerateDevices, because it never throws an exception.
64
65         * Modules/mediastream/MediaDevicesRequest.cpp:
66         (WebCore::MediaDevicesRequest::MediaDevicesRequest): Take a Document&.
67         Removed unused ExceptionCode& argument.
68         (WebCore::MediaDevicesRequest::create): Ditto.
69         * Modules/mediastream/MediaDevicesRequest.h: Updated for above changes.
70
71         * Modules/mediastream/NavigatorMediaDevices.cpp:
72         (WebCore::NavigatorMediaDevices::mediaDevices): Pass a reference.
73
74         * Modules/mediastream/UserMediaRequest.cpp:
75         (WebCore::UserMediaRequest::start): Use ExceptionOr.
76         (WebCore::UserMediaRequest::UserMediaRequest): Take a Document& and
77         a UserMediaController&.
78         * Modules/mediastream/UserMediaRequest.h: Updated for above changes.
79
80 2016-11-12  Simon Fraser  <simon.fraser@apple.com>
81
82         [iOS WK2] Share some code with Mac for post-async-scroll state reconciliation
83         https://bugs.webkit.org/show_bug.cgi?id=164694
84
85         Reviewed by Zalan Bujtas.
86
87         When an async scroll notifications get back to the main thread in
88         AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll(), we call 
89         syncViewportConstrainedLayerPositions() to poke the new layer positions on the
90         GraphicsLayers to match the changes made on the scrolling thread.
91
92         However, this was not done on iOS, which will be problematic for a future patch
93         where we require GraphicsLayer positions and the current fixedPositionViewport rect
94         to have been computed when in a consistent state.
95
96         Fix by factoring some code into reconcileScrollingState(), which is called on iOS/WK2
97         from WebPage::updateVisibleContentRects() rather than setting the FrameView's scroll offset
98         directly.
99
100         Test: scrollingcoordinator/ios/sync-layer-positions-after-scroll.html
101
102         * page/WheelEventDeltaFilter.cpp:
103         (WebCore::WheelEventDeltaFilter::filteredDelta):
104         * page/scrolling/AsyncScrollingCoordinator.cpp:
105         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
106         (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
107         (WebCore::AsyncScrollingCoordinator::syncViewportConstrainedLayerPositions):
108         (WebCore::AsyncScrollingCoordinator::syncChildPositions): Deleted.
109         * page/scrolling/AsyncScrollingCoordinator.h:
110         * page/scrolling/ScrollingCoordinator.h:
111         (WebCore::ScrollingCoordinator::reconcileScrollingState):
112         (WebCore::ScrollingCoordinator::syncViewportConstrainedLayerPositions):
113         (WebCore::ScrollingCoordinator::syncChildPositions): Deleted.
114         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
115         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition):
116         * platform/Logging.h:
117         * platform/ScrollView.cpp:
118         (WebCore::ScrollView::setScrollOffset):
119         * platform/graphics/ca/TileController.cpp:
120         (WebCore::TileController::adjustTileCoverageRect):
121         * rendering/RenderLayer.cpp:
122         (WebCore::RenderLayer::updateLayerPositionsAfterDocumentScroll):
123
124 2016-11-12  Zalan Bujtas  <zalan@apple.com>
125
126         RenderObject::flowThreadState should follow containing block instead of parent.
127         https://bugs.webkit.org/show_bug.cgi?id=164629
128
129         Reviewed by Simon Fraser.
130
131         Currently every descendant of a region/multicolumn container is considered to be part of the
132         flowthread including out-of-flow renderers. They all have the InsideFlowThread flag set.
133         However since out-of-flow renderers are not really part of the flowthread layout context,
134         whenever the layout code actually checks for their flowthread containers, we return nullptr and
135         try to handle this seemingly defective state gracefully (that is, flag indicates "inside the flow thread" state,
136         but there's no flow tread container).
137  
138         This patch fixes this confused state by setting the RenderObject::flowThreadState flag based on
139         the containing block's state instead of the parent's.
140
141         Not testable, since we seem to manage out-of-flow elements just fine even
142         when they have the InsideFlowThread flag set. 
143
144         * rendering/RenderBlock.cpp:
145         (WebCore::RenderBlock::styleDidChange):
146         * rendering/RenderElement.cpp:
147         (WebCore::RenderElement::setStyle):
148         (WebCore::RenderElement::adjustFlowThreadStateIncludingDescendants): This is an iterative DFS pre-order traversal so
149         we set the flow state first on containers.
150         * rendering/RenderElement.h:
151         * rendering/RenderObject.cpp:
152         (WebCore::RenderObject::computedFlowThreadState):
153         (WebCore::RenderObject::initializeFlowThreadStateOnInsertion):
154         * rendering/RenderObject.h:
155
156 2016-11-12  Ryosuke Niwa  <rniwa@webkit.org>
157
158         document.currentScript should be null when running a script inside a shadow tree
159         https://bugs.webkit.org/show_bug.cgi?id=164693
160
161         Reviewed by Yusuke Suzuki.
162
163         Fixed the bug that we were returning the old or outer script element in document.currentScript
164         while executing a script element inside a shadow tree. Return null instead.
165
166         New behavior matches the latest HTML5 specification:
167         https://html.spec.whatwg.org/multipage/scripting.html#execute-the-script-block
168         where it says for the classic script type, "if the script element's root is not a shadow root, then set
169         the script element's node document's currentScript attribute to the script element. Otherwise, set it to null."
170
171         No new tests. imported/w3c/web-platform-tests/shadow-dom/Document-prototype-currentScript.html covers it.
172
173         * dom/CurrentScriptIncrementer.h:
174         (WebCore::CurrentScriptIncrementer::CurrentScriptIncrementer): Push nullptr when the script element
175         is inside a shadow tree.
176         (WebCore::CurrentScriptIncrementer::~CurrentScriptIncrementer): Changed to use an early exit.
177         * dom/Document.cpp:
178         (WebCore::Document::pushCurrentScript): Removed the assertion since the argument can now be nullptr.
179
180 2016-11-12  Darin Adler  <darin@apple.com>
181
182         Remove a few assorted uses of ExceptionCode
183         https://bugs.webkit.org/show_bug.cgi?id=164683
184
185         Reviewed by Chris Dumez.
186
187         * Modules/applepay/PaymentContact.h: Removed include of ExceptionCode.h.
188         Also tidied up the constructor and destructor.
189
190         * Modules/indexeddb/IDBFactory.h: Removed typedef of ExceptionCode.
191         * Modules/indexeddb/IDBKeyRange.h: Ditto.
192
193         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
194         (WebCore::getObjectParameter): Removed local ExceptionCode variable that
195         was always 0.
196         (WebCore::JSWebGLRenderingContextBase::getAttachedShaders): Ditto.
197         (WebCore::dataFunctionf): Ditto.
198         (WebCore::dataFunctioni): Ditto.
199         (WebCore::dataFunctionMatrix): Ditto.
200         * dom/ContainerNode.cpp:
201         (WebCore::ContainerNode::cloneChildNodes): Ditto.
202
203         * dom/Document.h: Removed typedef of ExceptionCode.
204         * dom/TreeWalker.h: Ditto.
205         * editing/markup.h: Ditto.
206         * html/ImageData.h: Ditto.
207         * html/InputType.h: Ditto.
208         * html/canvas/CanvasRenderingContext2D.h: Ditto.
209         * html/canvas/WebGLDebugShaders.h: Ditto.
210
211         * page/DOMWindow.cpp:
212         (WebCore::DOMWindow::setTimeout): Fixed typo where this was using
213         ExceptionCode instead of Exception. The code would return an integer
214         instead of an exception in this case. I could not produce a test that
215         exercises this code path; I suspect it is an unreachable error condition.
216         (WebCore::DOMWindow::setInterval): Ditto.
217
218         * replay/MemoizedDOMResult.h: Changed typedef of ExceptionCode into
219         a using statement. Not sure what the longer term fix is.
220
221         * xml/parser/XMLDocumentParserLibxml2.cpp:
222         (WebCore::PendingCallbacks::appendStartElementNSCallback): Renamed to use
223         WebKit-style "numXXX" rather than "nb_xxx".
224         (WebCore::PendingCallbacks::PendingStartElementNSCallback::~PendingStartElementNSCallback):
225         Ditto.
226         (WebCore::handleNamespaceAttributes): Ditto. Replaced ExceptionCode out
227         argument with a boolean return value.
228         (WebCore::handleElementAttributes): Ditto.
229         (WebCore::XMLDocumentParser::startElementNs): Ditto. Updated for changes
230         to the handle functions above.
231         (WebCore::startElementNsHandler): More of the same.
232         (WebCore::attributesStartElementNsHandler): Ditto.
233
234 2016-11-11  Darin Adler  <darin@apple.com>
235
236         Remove LegacyException support from bindings script
237         https://bugs.webkit.org/show_bug.cgi?id=164516
238
239         Reviewed by Youenn Fablet.
240
241         Besides removing LegacyException support from the bindings script, this patch
242         also removes most uses of ExceptionCodePlaceholder.h. Also, some call sites of
243         createElement were using ASSERT_NO_EXCEPTION on an argument that was not even an
244         ExceptionCode&, so to fix that, this changes most call sites to use specific create
245         functions for specific element classes, rather than using Document::createElement.
246
247         * Modules/mediasource/SourceBuffer.cpp: Removed include of
248         ExceptionCodePlaceholder.h.
249         * Modules/mediastream/MediaStreamTrack.cpp: Ditto.
250         * Modules/websockets/WebSocketChannel.cpp: Ditto.
251         * bindings/js/JSBlobCustom.cpp: Ditto.
252
253         * bindings/scripts/CodeGeneratorJS.pm:
254         (GenerateImplementation): Removed support for GetterMayThrowLegacyException,
255         SetterMayThrowLegacyException, and MayThrowLegacyException.
256         (GenerateParametersCheck): Ditto.
257         (GenerateImplementationFunctionCall): Ditto.
258         (GenerateConstructorDefinition): Ditto.
259
260         * bindings/scripts/IDLAttributes.txt: Removed ConstructorMayThrowLegacyException,
261         GetterMayThrowLegacyException, MayThrowLegacyException, and SetterMayThrowLegacyException.
262
263         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
264         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
265         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
266         * bindings/scripts/test/JS/JSTestInterface.cpp:
267         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
268         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
269         * bindings/scripts/test/JS/JSTestObj.cpp:
270         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
271         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
272         Updated exepected results.
273
274         * bindings/scripts/test/TestImplements.idl: Use non-legacy exceptions.
275         * bindings/scripts/test/TestInterface.idl: Ditto.
276         * bindings/scripts/test/TestNamedConstructor.idl: Ditto.
277         * bindings/scripts/test/TestObj.idl: Ditto.
278         * bindings/scripts/test/TestSupplemental.idl: Ditto.
279         * bindings/scripts/test/TestTypedefs.idl: Ditto.
280
281         * dom/ContainerNode.h: Removed include of ExceptionCodePlaceholder.h.
282         * editing/AlternativeTextController.cpp: Ditto.
283         * editing/AppendNodeCommand.cpp: Ditto.
284
285         * editing/CompositeEditCommand.cpp:
286         (WebCore::CompositeEditCommand::moveParagraphs): Use specific create function
287         instead of Document::createElement.
288
289         * editing/DeleteFromTextNodeCommand.cpp: Removed include of
290         ExceptionCodePlaceholder.h.
291         * editing/Editor.cpp: Ditto.
292         * editing/EditorCommand.cpp: Ditto.
293         * editing/FormatBlockCommand.cpp: Ditto.
294
295         * editing/IndentOutdentCommand.cpp:
296         (WebCore::IndentOutdentCommand::tryIndentingAsListItem): Use specific create
297         function instead of Document::createElement.
298
299         * editing/InsertListCommand.cpp: Removed include of ExceptionCodePlaceholder.h.
300         * editing/InsertNodeBeforeCommand.cpp: Ditto.
301         * editing/RemoveNodeCommand.cpp: Ditto.
302         * editing/ReplaceSelectionCommand.cpp: Ditto.
303         * editing/TextIterator.cpp: Ditto.
304         * editing/WrapContentsInDummySpanCommand.cpp: Ditto.
305
306         * editing/cocoa/EditorCocoa.mm:
307         (WebCore::Editor::styleForSelectionStart): Use specific create function instead
308         of Document::createElement.
309         * editing/htmlediting.cpp:
310         (WebCore::createTabSpanElement): Ditto.
311         * editing/ios/EditorIOS.mm:
312         (WebCore::Editor::WebContentReader::readURL): Ditto.
313         * editing/mac/EditorMac.mm:
314         (WebCore::Editor::WebContentReader::readURL): Ditto.
315
316         * editing/markup.cpp: Removed include of ExceptionCodePlaceholder.h.
317
318         * html/FTPDirectoryDocument.cpp:
319         (WebCore::FTPDirectoryDocumentParser::appendEntry): Use specific create function
320         instead of Document::createElement.
321         (WebCore::FTPDirectoryDocumentParser::createTDForFilename): Ditto.
322         (WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate): Ditto.
323         (WebCore::FTPDirectoryDocumentParser::createBasicDocument): Ditto.
324
325         * html/HTMLEmbedElement.cpp:
326         (WebCore::HTMLEmbedElement::create): Added overload that just takes a Document.
327         * html/HTMLEmbedElement.h: Updated for above.
328
329         * html/HTMLMediaElement.cpp: Removed include of ExceptionCodePlaceholder.h.
330
331         * html/HTMLMetaElement.cpp:
332         (WebCore::HTMLMetaElement::create): Added overload that just takes a Document.
333         * html/HTMLMetaElement.h: Updated for above.
334
335         * html/HTMLOutputElement.cpp: Removed include of ExceptionCodePlaceholder.h.
336
337         * html/HTMLSelectElement.cpp: Ditto.
338         (WebCore::HTMLSelectElement::setLength): Use specific create function
339         instead of Document::createElement.
340
341         * html/HTMLSourceElement.cpp:
342         (WebCore::HTMLSourceElement::create): Added overload that just takes a Document.
343         * html/HTMLSourceElement.h: Updated for above.
344
345         * html/HTMLStyleElement.cpp:
346         (WebCore::HTMLStyleElement::HTMLStyleElement): Moved data member initialization
347         to class definition.
348         (WebCore::HTMLStyleElement::create): Added overload that just takes a Document.
349         * html/HTMLStyleElement.h: Updated for above. Also made finishParsingChildren public.
350
351         * html/HTMLTableElement.cpp: Removed include of ExceptionCodePlaceholder.h.
352         * html/HTMLTextAreaElement.cpp: Ditto.
353
354         * html/HTMLVideoElement.cpp:
355         (WebCore::HTMLVideoElement::create): Added overload that just takes a Document.
356         * html/HTMLVideoElement.h: Updated for above.
357
358         * html/ImageDocument.cpp:
359         (WebCore::ImageDocument::createDocumentStructure): Use specific create function
360         instead of Document::createElement.
361
362         * html/InputType.cpp: Removed include of ExceptionCodePlaceholder.h.
363
364         * html/MediaDocument.cpp:
365         (WebCore::MediaDocumentParser::createDocumentStructure): Use specific create
366         function instead of Document::createElement.
367         (WebCore::MediaDocument::replaceMediaElementTimerFired): Ditto.
368         * html/PluginDocument.cpp:
369         (WebCore::PluginDocumentParser::createDocumentStructure): Ditto.
370
371         * html/RangeInputType.cpp: Removed include of ExceptionCodePlaceholder.h.
372
373         * html/RubyElement.cpp:
374         (WebCore::RubyElement::create): Added overload that just takes a Document.
375         * html/RubyElement.h: Updated for above.
376
377         * html/RubyTextElement.cpp:
378         (WebCore::RubyTextElement::create): Added overload that just takes a Document.
379         * html/RubyTextElement.h: Updated for above.
380
381         * html/ValidationMessage.cpp: Removed include of ExceptionCodePlaceholder.h.
382         * html/canvas/CanvasRenderingContext2D.cpp: Ditto.
383         * html/shadow/MediaControlElementTypes.cpp: Ditto.
384
385         * html/shadow/MediaControlElements.cpp:
386         (WebCore::MediaControlClosedCaptionsTrackListElement::rebuildTrackListMenu):
387         Use specific create function instead of Document::createElement.
388
389         * html/shadow/MediaControls.cpp: Removed include of ExceptionCodePlaceholder.h.
390         * html/shadow/MediaControlsApple.cpp: Ditto.
391         * html/track/InbandDataTextTrack.cpp: Ditto.
392         * html/track/InbandGenericTextTrack.cpp: Ditto.
393         * html/track/InbandTextTrack.cpp: Ditto.
394         * html/track/VTTRegion.cpp: Ditto.
395
396         * html/track/WebVTTElement.cpp:
397         (WebCore::WebVTTElement::createEquivalentHTMLElement): Use specific create
398         function instead of Document::createElement.
399         * inspector/InspectorCSSAgent.cpp:
400         (WebCore::InspectorCSSAgent::createInspectorStyleSheetForDocument): Ditto.
401
402         * page/ContextMenuController.cpp: Removed include of ExceptionCodePlaceholder.h.
403         * page/DOMWindow.cpp: Ditto.
404         * page/DragController.cpp: Ditto.
405         * page/EventHandler.cpp: Ditto.
406         * page/Page.cpp: Ditto.
407         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: Ditto.
408         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm: Ditto.
409         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: Ditto.
410         * platform/mac/PasteboardMac.mm: Ditto.
411         * platform/mac/WebVideoFullscreenHUDWindowController.mm: Ditto.
412         * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp: Ditto.
413         * platform/mock/mediasource/MockMediaSourcePrivate.cpp: Ditto.
414         * rendering/RenderNamedFlowThread.cpp: Ditto.
415         * rendering/RenderThemeEfl.cpp: Ditto.
416         * rendering/RenderThemeMac.mm: Ditto.
417         * rendering/style/SVGRenderStyle.h: Ditto.
418         * svg/SVGTRefElement.cpp: Ditto.
419
420         * xml/XMLErrors.cpp:
421         (WebCore::XMLErrors::XMLErrors): Take a reference and initialize data member
422         in class definition.
423         (WebCore::createXHTMLParserErrorHeader): Take a reference, and mostly use
424         specific create functions instead of createElement.
425         (WebCore::XMLErrors::insertErrorMessageBlock): Ditto.
426         * xml/XMLErrors.h: Updated for above.
427
428         * xml/XMLTreeViewer.cpp: Removed include of ExceptionCodePlaceholder.h.
429
430         * xml/parser/XMLDocumentParser.cpp:
431         (WebCore::XMLDocumentParser::handleError): Pass a reference.
432
433         * xml/parser/XMLDocumentParserLibxml2.cpp: Removed include of
434         ExceptionCodePlaceholder.h.
435
436 2016-11-12  Dan Bernstein  <mitz@apple.com>
437
438         Clean up a couple of macOS *SPI headers
439         https://bugs.webkit.org/show_bug.cgi?id=164687
440
441         Reviewed by Sam Weinig.
442
443         * platform/spi/cocoa/NSTouchBarSPI.h: Replaced hardcoded strings with global declarations.
444         * platform/spi/mac/NSSpellCheckerSPI.h: Addressed FIXME by importing private header, and removed declarations
445           that already appear in the SDK.
446
447 2016-11-12  Wenson Hsieh  <wenson_hsieh@apple.com>
448
449         The main content heuristic should be robust when handling large media elements
450         https://bugs.webkit.org/show_bug.cgi?id=164676
451         <rdar://problem/29211503>
452
453         Reviewed by Eric Carlson.
454
455         Handles integer overflow gracefully when performing the main content check for very large media elements. If the
456         heuristic comes across such an element, it will now bail early and reject the video as main content. Also adds a
457         new API test: VideoControlsManager.VideoControlsManagerPageWithEnormousVideo.
458
459         * html/MediaElementSession.cpp:
460         (WebCore::isElementRectMostlyInMainFrame):
461
462 2016-11-12  Chris Dumez  <cdumez@apple.com>
463
464         Speed up setting attributes of input elements of type 'text'
465         https://bugs.webkit.org/show_bug.cgi?id=164674
466
467         Reviewed by Ryosuke Niwa.
468
469         Speed up setting attributes of input elements of type 'text' by calling
470         updateInnerTextValue() only when needed. It was previously called
471         whenever an attribute was set, no matter it could impact its text value
472         or not.
473
474         No new tests, no Web-exposed behavior change.
475
476         * html/HTMLInputElement.cpp:
477         (WebCore::HTMLInputElement::parseAttribute):
478         * html/InputType.cpp:
479         (WebCore::InputType::attributeChanged):
480         * html/InputType.h:
481         * html/TextFieldInputType.cpp:
482         (WebCore::TextFieldInputType::attributeChanged):
483         * html/TextFieldInputType.h:
484
485 2016-11-12  Dan Bernstein  <mitz@apple.com>
486
487         Tried to fix the 32-bit build.
488
489         * platform/mac/WebPlaybackControlsManager.mm:
490
491 2016-11-12  Dan Bernstein  <mitz@apple.com>
492
493         Tried to fix the 32-bit build.
494
495         * platform/mac/WebPlaybackControlsManager.h:
496
497 2016-11-12  Dan Bernstein  <mitz@apple.com>
498
499         Tried to fix the build.
500
501         * platform/mac/WebPlaybackControlsManager.h: Declared conformance to
502           AVFunctionBarPlaybackControlsControlling, which is expected in WebKit::WebViewImpl.
503           Added ivar.
504         * platform/mac/WebPlaybackControlsManager.mm:
505           Synthesize seekToTime property needed for AVFunctionBarPlaybackControlsControlling
506           conformance.
507         (-[WebPlaybackControlsManager isSeeking]): Implement this
508           AVFunctionBarPlaybackControlsControlling method.
509         (-[WebPlaybackControlsManager seekToTime:toleranceBefore:toleranceAfter:]): Ditto.
510
511 2016-11-12  Dan Bernstein  <mitz@apple.com>
512
513         Tried to fix the build.
514
515         * platform/spi/cocoa/NSTouchBarSPI.h: Removed duplicate @interface declarations.
516
517 2016-11-12  Frederic Wang  <fwang@igalia.com>
518
519         Ensure MathML render tree are clean by the end of FrameView::layout().
520         https://bugs.webkit.org/show_bug.cgi?id=162824
521
522         Reviewed by Darin Adler.
523
524         clearNeedsLayout is not called during the layout of invalid MathML markup. We introduce a new
525         helper function to perform proper layout of such markup and we now call it from the various
526         MathML layoutBlock functions. Additionally, we ensure that the preferred width is dirty after
527         computation in RenderMathMLScripts::computePreferredLogicalWidths.
528
529         Test: mathml/invalid-markup.html
530
531         * rendering/mathml/RenderMathMLBlock.cpp:
532         (WebCore::RenderMathMLBlock::layoutInvalidMarkup): Helper function to layout invalid markup.
533         * rendering/mathml/RenderMathMLBlock.h: Declare layoutInvalidMarkup.
534         * rendering/mathml/RenderMathMLFraction.cpp:
535         (WebCore::RenderMathMLFraction::layoutBlock): Call layoutInvalidMarkup.
536         * rendering/mathml/RenderMathMLRoot.cpp:
537         (WebCore::RenderMathMLRoot::layoutBlock): Ditto.
538         * rendering/mathml/RenderMathMLScripts.cpp:
539         (WebCore::RenderMathMLScripts::computePreferredLogicalWidths): Set the preferred width dirty
540         after computation to avoid that it is computed again and again.
541         (WebCore::RenderMathMLScripts::layoutBlock): Call layoutInvalidMarkup.
542         * rendering/mathml/RenderMathMLUnderOver.cpp:
543         (WebCore::RenderMathMLUnderOver::layoutBlock): Ditto.
544
545 2016-11-12  Frederic Wang  <fwang@igalia.com>
546
547         Remove RenderMathMLOperator::shouldAllowStretching
548         https://bugs.webkit.org/show_bug.cgi?id=164313
549
550         Reviewed by Darin Adler.
551
552         RenderMathMLOperator::shouldAllowStretching is an old function from early implementations of
553         MathML. Its name is now confusing since it also includes non-stretchy large operators.
554         Moreover, it is not really useful and is actually only used by two functions: useMathOperator
555         and updateMathOperator. The former is almost equivalent and is used as a replacement of
556         shouldAllowStretching everywhere else. We rewrite the two remaining calls with the finer
557         test functions isStretchy() and isLargeOperatorInDisplayStyle().
558
559         No new tests, behavior unchanged.
560
561         * rendering/mathml/RenderMathMLOperator.cpp:
562         (WebCore::RenderMathMLOperator::updateMathOperator): Reorder the conditionals to avoid the
563         use of RenderMathMLOperator::shouldAllowStretching and match useMathOperator.
564         (WebCore::RenderMathMLOperator::useMathOperator): Rewrite shouldAllowStretching() using
565         isStretchy() and isLargeOperatorInDisplayStyle().
566         (WebCore::RenderMathMLOperator::shouldAllowStretching): Deleted.
567         * rendering/mathml/RenderMathMLOperator.h: Remove declaration of shouldAllowStretching.
568
569 2016-11-12  Joseph Pecoraro  <pecoraro@apple.com>
570
571         Use #pragma once in WebCore
572         https://bugs.webkit.org/show_bug.cgi?id=164373
573
574         Reviewed by Darin Adler.
575
576         * Modules/*.h:
577         * crypto/*.h:
578         * cssjit/*.h:
579         * editing/*.h:
580         * fileapi/*.h:
581         * history/*.h:
582         * loader/*.h:
583         * mathml/*.h:
584         * page/*.h:
585         * replay/*.h:
586         * storage/*.h:
587         * xml/*.h:
588
589         * editing/FrameSelection.cpp:
590         * loader/ResourceLoadStatisticsStore.cpp:
591         Remove unused LOG and DEBUG defines.
592
593 2016-11-12  Wenson Hsieh  <wenson_hsieh@apple.com>
594
595         Follow-up: fix the OpenSource build on Mac after r208642
596         https://bugs.webkit.org/show_bug.cgi?id=164677
597
598         Reviewed by Ryosuke Niwa.
599
600         The playbackControlsController property should also be `assign`.
601
602         * platform/spi/cocoa/AVKitSPI.h:
603
604 2016-11-11  Wenson Hsieh  <wenson_hsieh@apple.com>
605
606         SPI imports in AVKitSPI.h should be guarded by USE(APPLE_INTERNAL_SDK)
607         https://bugs.webkit.org/show_bug.cgi?id=164672
608
609         Reviewed by Dan Bernstein.
610
611         Fixes the OpenSource build when ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER) is on.
612
613         * platform/spi/cocoa/AVKitSPI.h: Add USE(APPLE_INTERNAL_SDK) guards around AVKit function bar SPI headers.
614         Additionally, define AVFunctionBarPlaybackControlsProvider in the case where AVKit SPI is unavailable.
615
616 2016-11-11  Ryosuke Niwa  <rniwa@webkit.org>
617
618         event.composedPath() does not include window
619         https://bugs.webkit.org/show_bug.cgi?id=164609
620         <rdar://problem/29210383>
621
622         Reviewed by Antti Koivisto.
623
624         Fixed the bug by including WindowContext be a part of the regular EventPath. This also simplifies
625         dispatchEventInDOM which used to had a special logic for dispatching an event on the window.
626
627         Also fixed a bug in EventDispatcher::dispatchEvent that event.target would be nullptr when an event was
628         dispatched inside a disconnected shadow tree or prevented from propagating to the document tree.
629         Preserve the final target by simply saving event.target() prior to invoking the default event handler instead.
630
631         Test: fast/shadow-dom/event-path-with-window.html
632
633         * dom/EventDispatcher.cpp:
634         (WebCore::WindowEventContext): Deleted. Moved to EventPath.cpp.
635         (WebCore::dispatchEventInDOM): Removed the code for WindowContext. The generic event dispatching logic
636         will do the same work now.
637         (WebCore::EventDispatcher::dispatchEvent): Restore the original target instead of using that of WindowContext.
638         * dom/EventPath.cpp:
639         (WebCore::WindowEventContext): Moved from EventDispatcher.cpp. Also made it a subclass of EventContext.
640         (WebCore::WindowEventContext::handleLocalEvents): Added.
641         (WebCore::EventPath::EventPath): When the parent's nullptr, check if the current node is Document. If it is,
642         follow https://dom.spec.whatwg.org/#interface-document where it says:
643         "A document’s get the parent algorithm, given an event, returns null if event’s type attribute value is 'load'
644          or document does not have a browsing context, and the document’s associated Window object otherwise."
645         (WebCore::EventPath::setRelatedTarget): Skip over WindowContext.
646         (WebCore::EventPath::retargetTouch): Ditto.
647         (WebCore::EventPath::computePathUnclosedToTarget): When the target is DOMWindow, use its document as the target.
648         Also, include any event target that is not a node in the event path.
649
650 2016-11-11  Dave Hyatt  <hyatt@apple.com>
651
652         [CSS Parser] Support all the correct blend modes
653         https://bugs.webkit.org/show_bug.cgi?id=164669
654
655         Reviewed by Dean Jackson.
656
657         * css/parser/CSSParserFastPaths.cpp:
658         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
659
660 2016-11-11  Alex Christensen  <achristensen@webkit.org>
661
662         Use SecurityOriginData as keys in StorageManager
663         https://bugs.webkit.org/show_bug.cgi?id=159834
664         <rdar://problem/27346948>
665
666         Reviewed by Brady Eidson.
667
668         No change in behavior.
669
670         * page/SecurityOriginData.h:
671         (WebCore::SecurityOriginData::SecurityOriginData):
672         (WebCore::SecurityOriginData::isEmpty):
673         (WebCore::SecurityOriginData::isHashTableDeletedValue):
674         (WebCore::SecurityOriginDataHashTraits::isEmptyValue):
675         (WebCore::SecurityOriginDataHash::hash):
676         (WebCore::SecurityOriginDataHash::equal):
677         Add some hash functions so a SecurityOriginData can be used as a key in a HashMap.
678
679 2016-11-11  Ryosuke Niwa  <rniwa@webkit.org>
680
681         Hovering over a slotted Text node clears hover state
682         https://bugs.webkit.org/show_bug.cgi?id=164002
683         <rdar://problem/29040471>
684
685         Reviewed by Simon Fraser.
686
687         The bug was caused by HitTestResult::innerElement returning the parent element of a Text node without
688         taking the shadow root or slots into account. For hit testing, we always want to use the "flat tree"
689         or "composed tree" (imprecisely but close enough in this case).
690
691         Fixed the bug by making HitTestResult::innerElement use parentNodeInComposedTree. Also renamed it to
692         HitTestResult::targetElement to be consistent with HitTestResult::targetNode.
693
694         Tests: fast/shadow-dom/activate-over-slotted-content.html
695                fast/shadow-dom/hover-over-slotted-content.html
696
697         * dom/Document.cpp:
698         (WebCore::Document::prepareMouseEvent):
699         * html/MediaElementSession.cpp:
700         (WebCore::isMainContentForPurposesOfAutoplay):
701         * page/EventHandler.cpp:
702         (WebCore::EventHandler::eventMayStartDrag):
703         (WebCore::EventHandler::hitTestResultAtPoint):
704         (WebCore::EventHandler::handleWheelEvent):
705         (WebCore::EventHandler::sendContextMenuEventForKey):
706         (WebCore::EventHandler::hoverTimerFired):
707         (WebCore::EventHandler::handleDrag):
708         (WebCore::EventHandler::handleTouchEvent):
709         * rendering/HitTestResult.cpp:
710         (WebCore::HitTestResult::targetElement): Renamed from innerElement.
711         Now finds the parent element in the composed tree.
712         * rendering/HitTestResult.h:
713         (WebCore::HitTestResult::innerNode):
714
715 2016-11-11  Brent Fulgham  <bfulgham@apple.com>
716
717         Unreviewed build fix after r208628
718
719         * bindings/js/SerializedScriptValue.cpp:
720         (WebCore::CloneDeserializer::readTerminal): Cast pointer arithmetic to
721         uint32_t to avoid warning.
722
723 2016-11-11  Brent Fulgham  <bfulgham@apple.com>
724
725         Neutered ArrayBuffers are not properly serialized
726         https://bugs.webkit.org/show_bug.cgi?id=164647
727         <rdar://problem/29213490>
728
729         Reviewed by David Kilzer.
730
731         Correct binding logic to handle ImageBuffers being deserialized from neutered ArrayBuffers.
732
733         Test: fast/canvas/neutered-imagedata.html
734
735         * bindings/js/SerializedScriptValue.cpp:
736         (WebCore::CloneDeserializer::readTerminal):
737
738 2016-11-11  Wenson Hsieh  <wenson_hsieh@apple.com>
739
740         [WK2] autocorrect and autocapitalize attributes do not work in contenteditable elements
741         https://bugs.webkit.org/show_bug.cgi?id=164538
742         <rdar://problem/8418711>
743
744         Reviewed by Ryosuke Niwa.
745
746         Adds autocorrect and autocapitalize getters and setters to HTMLElements. These check the `autocorrect` and
747         `autocapitalize` attributes and return whether or not the element supports autocorrect, and the
748         autocapitalization type, respectively. By default, autocorrection is enabled and autocapitalization is enabled
749         on the sentence level for elements. Also refactors/renames WebAutocapitalizeType so that in WebCore, we deal
750         solely with AutocapitalizeTypes and WebKit1 converts from AutocapitalizeType to WebAutocapitalizeType as needed
751         for UIKit.
752
753         Tests: fast/events/ios/contenteditable-autocapitalize.html
754                fast/events/ios/contenteditable-autocorrect.html
755
756         * WebCore.xcodeproj/project.pbxproj:
757         * html/Autocapitalize.cpp:
758         (WebCore::autocapitalizeTypeForAttributeValue):
759         (WebCore::stringForAutocapitalizeType):
760         * html/Autocapitalize.h:
761         * html/AutocapitalizeTypes.h: Renamed from Source/WebCore/html/WebAutocapitalize.h.
762
763         Move WebAutocapitalizeType into AutocapitalizeTypes.h as simply AutocapitalizeType.
764
765         * html/HTMLElement.cpp:
766         (WebCore::HTMLElement::autocapitalize):
767         (WebCore::HTMLElement::autocapitalizeType):
768         (WebCore::HTMLElement::setAutocapitalize):
769         (WebCore::HTMLElement::shouldAutocorrect):
770         (WebCore::HTMLElement::setAutocorrect):
771         * html/HTMLElement.h:
772         (WebCore::HTMLElement::autocorrect):
773         * html/HTMLElement.idl:
774         * html/HTMLFormControlElement.cpp:
775         (WebCore::HTMLFormControlElement::shouldAutocorrect):
776         (WebCore::HTMLFormControlElement::autocapitalizeType):
777         (WebCore::HTMLFormControlElement::autocorrect): Deleted.
778         (WebCore::HTMLFormControlElement::setAutocorrect): Deleted.
779         (WebCore::HTMLFormControlElement::autocapitalize): Deleted.
780         (WebCore::HTMLFormControlElement::setAutocapitalize): Deleted.
781
782         Fold autocorrect/autocapitalize member functions into HTMLElement and remove element-specific code in
783         HTML(FormControl|Form)Element.cpp.
784
785         * html/HTMLFormControlElement.h:
786         * html/HTMLFormElement.cpp:
787         (WebCore::HTMLFormElement::shouldAutocorrect):
788         (WebCore::HTMLFormElement::autocorrect): Deleted.
789         (WebCore::HTMLFormElement::setAutocorrect): Deleted.
790         (WebCore::HTMLFormElement::autocapitalizeType): Deleted.
791         (WebCore::HTMLFormElement::autocapitalize): Deleted.
792         (WebCore::HTMLFormElement::setAutocapitalize): Deleted.
793         * html/HTMLFormElement.h:
794         * html/HTMLFormElement.idl:
795         * html/HTMLInputElement.idl:
796         * html/HTMLTextAreaElement.idl:
797
798 2016-11-11  Dave Hyatt  <hyatt@apple.com>
799
800         [CSS Parser] Add support for paths as basic shapes.
801         https://bugs.webkit.org/show_bug.cgi?id=164661
802
803         Reviewed by Dean Jackson.
804
805         * css/parser/CSSPropertyParser.cpp:
806         (WebCore::consumeBasicShapePath):
807         (WebCore::consumeBasicShape):
808
809 2016-11-11  Dave Hyatt  <hyatt@apple.com>
810
811         [CSS Parser] Support margin-box in shape parsing.
812         https://bugs.webkit.org/show_bug.cgi?id=164658
813
814         Reviewed by Sam Weinig.
815
816         * css/parser/CSSPropertyParser.cpp:
817         (WebCore::consumeBasicShapeOrBox):
818
819 2016-11-11  Dave Hyatt  <hyatt@apple.com>
820
821         [CSS Parser] Add support for -webkit-mask-source-type
822         https://bugs.webkit.org/show_bug.cgi?id=164657
823
824         Reviewed by Dean Jackson.
825
826         * css/parser/CSSPropertyParser.cpp:
827         (WebCore::consumeWebkitMaskSourceType):
828         (WebCore::consumeBackgroundComponent):
829         (WebCore::CSSPropertyParser::parseSingleValue):
830
831 2016-11-11  Antti Koivisto  <antti@apple.com>
832
833         Updating class name doesn't update the slotted content's style
834         https://bugs.webkit.org/show_bug.cgi?id=164577
835         <rdar://problem/29205873>
836
837         Reviewed by Ryosuke Niwa.
838
839         Test: fast/shadow-dom/css-scoping-slotted-invalidation.html
840
841         Teach style invalidation code for attribute/class/id mutations about slotted rules.
842
843         * dom/ShadowRoot.cpp:
844         (WebCore::assignedShadowRootsIfSlotted):
845
846             Helper to find all assigned shadow roots (there may be more than one if slots are assigned to slots).
847
848         * dom/ShadowRoot.h:
849         * style/AttributeChangeInvalidation.cpp:
850         (WebCore::Style::mayBeAffectedByAttributeChange):
851         (WebCore::Style::mayBeAffectedByHostRules):
852         (WebCore::Style::mayBeAffectedBySlottedRules):
853         (WebCore::Style::AttributeChangeInvalidation::invalidateStyle):
854         (WebCore::Style::mayBeAffectedByHostStyle): Deleted.
855         * style/ClassChangeInvalidation.cpp:
856         (WebCore::Style::mayBeAffectedByHostRules):
857         (WebCore::Style::mayBeAffectedBySlottedRules):
858         (WebCore::Style::ClassChangeInvalidation::invalidateStyle):
859         (WebCore::Style::mayBeAffectedByHostStyle): Deleted.
860         * style/ClassChangeInvalidation.h:
861         * style/IdChangeInvalidation.cpp:
862         (WebCore::Style::mayBeAffectedByHostRules):
863         (WebCore::Style::mayBeAffectedBySlottedRules):
864         (WebCore::Style::IdChangeInvalidation::invalidateStyle):
865         (WebCore::Style::mayBeAffectedByHostStyle): Deleted.
866         * style/StyleSharingResolver.cpp:
867         (WebCore::Style::SharingResolver::canShareStyleWithElement):
868
869             Fix a bug in style sharing where we were checking wrong element for host rules.
870             Tested by the included test too (the last empty div).
871
872 2016-11-11  Dave Hyatt  <hyatt@apple.com>
873
874         [CSS Parser] Support the spring animation timing function
875         https://bugs.webkit.org/show_bug.cgi?id=164654
876
877         Reviewed by Dean Jackson.
878
879         * css/CSSValueKeywords.in:
880         * css/parser/CSSPropertyParser.cpp:
881         (WebCore::consumeSpringFunction):
882         (WebCore::consumeAnimationTimingFunction):
883         (WebCore::consumeAnimationValue):
884
885 2016-11-11  Chris Dumez  <cdumez@apple.com>
886
887         WorkerGlobalScope's indexedDB property should be on the prototype, not the instance
888         https://bugs.webkit.org/show_bug.cgi?id=164644
889
890         Reviewed by Brady Eidson.
891
892         WorkerGlobalScope's indexedDB property should be on the prototype, not the instance
893         as per:
894         - https://heycam.github.io/webidl/#es-attributes
895
896         This is because WorkerGlobalScope is not marked as [Global] or [PrimaryGlobal] in
897         the IDL:
898         - https://html.spec.whatwg.org/multipage/workers.html#the-workerglobalscope-common-interface
899
900         DedicatedWorkerGlobalScope is the one that is marked as [Global] and that should
901         have its attributes on the instance:
902         - https://html.spec.whatwg.org/multipage/workers.html#dedicated-workers-and-the-dedicatedworkerglobalscope-interface
903
904         We were getting this mostly right, except for runtime-enabled attributes / operations
905         which would end up on the instance instead of the prototype. This patch adds support
906         for [PrimaryGlobal] / [Global] IDL extended attributes which determine the location
907         of properties. It also improves support for runtime-enabled properties so that they
908         can now be on either the instance or the prototype, exactly as if they were not
909         runtimed-enabled.
910
911         This gives us 100% pass rate on:
912         - http://w3c-test.org/IndexedDB/interfaces.worker.html
913
914         No new tests, updated existing test.
915
916         * bindings/scripts/CodeGeneratorJS.pm:
917         (IsGlobalOrPrimaryGlobalInterface):
918         (InterfaceRequiresAttributesOnInstance):
919         (AttributeShouldBeOnInstance):
920         (OperationShouldBeOnInstance):
921         (GenerateHeader):
922         (GeneratePropertiesHashTable):
923         (GenerateImplementation):
924         * bindings/scripts/IDLAttributes.txt:
925         * bindings/scripts/test/JS/JSInterfaceName.cpp:
926         (WebCore::JSInterfaceName::finishCreation):
927         * bindings/scripts/test/JS/JSInterfaceName.h:
928         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
929         (WebCore::JSTestActiveDOMObject::finishCreation):
930         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
931         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
932         (WebCore::JSTestCEReactions::finishCreation):
933         * bindings/scripts/test/JS/JSTestCEReactions.h:
934         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
935         (WebCore::JSTestCEReactionsStringifier::finishCreation):
936         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.h:
937         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
938         (WebCore::JSTestClassWithJSBuiltinConstructor::finishCreation):
939         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h:
940         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
941         (WebCore::JSTestCustomConstructorWithNoInterfaceObject::finishCreation):
942         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h:
943         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
944         (WebCore::JSTestCustomNamedGetter::finishCreation):
945         * bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
946         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
947         (WebCore::JSTestDOMJIT::finishCreation):
948         * bindings/scripts/test/JS/JSTestDOMJIT.h:
949         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
950         (WebCore::JSTestEventConstructor::finishCreation):
951         * bindings/scripts/test/JS/JSTestEventConstructor.h:
952         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
953         (WebCore::JSTestEventTarget::finishCreation):
954         * bindings/scripts/test/JS/JSTestEventTarget.h:
955         * bindings/scripts/test/JS/JSTestException.cpp:
956         (WebCore::JSTestException::finishCreation):
957         * bindings/scripts/test/JS/JSTestException.h:
958         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
959         (WebCore::JSTestGenerateIsReachable::finishCreation):
960         * bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
961         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
962         (WebCore::JSTestGlobalObject::finishCreation):
963         * bindings/scripts/test/JS/JSTestGlobalObject.h:
964         * bindings/scripts/test/JS/JSTestInterface.cpp:
965         (WebCore::JSTestInterface::finishCreation):
966         * bindings/scripts/test/JS/JSTestInterface.h:
967         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
968         (WebCore::JSTestInterfaceLeadingUnderscore::finishCreation):
969         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.h:
970         * bindings/scripts/test/JS/JSTestIterable.cpp:
971         (WebCore::JSTestIterable::finishCreation):
972         * bindings/scripts/test/JS/JSTestIterable.h:
973         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
974         (WebCore::JSTestJSBuiltinConstructor::finishCreation):
975         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h:
976         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
977         (WebCore::JSTestMediaQueryListListener::finishCreation):
978         * bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
979         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
980         (WebCore::JSTestNamedConstructor::finishCreation):
981         * bindings/scripts/test/JS/JSTestNamedConstructor.h:
982         * bindings/scripts/test/JS/JSTestNode.cpp:
983         (WebCore::JSTestNode::finishCreation):
984         * bindings/scripts/test/JS/JSTestNode.h:
985         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
986         (WebCore::JSTestNondeterministic::finishCreation):
987         * bindings/scripts/test/JS/JSTestNondeterministic.h:
988         * bindings/scripts/test/JS/JSTestObj.cpp:
989         (WebCore::JSTestObj::finishCreation):
990         * bindings/scripts/test/JS/JSTestObj.h:
991         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
992         (WebCore::JSTestOverloadedConstructors::finishCreation):
993         * bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
994         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
995         (WebCore::JSTestOverloadedConstructorsWithSequence::finishCreation):
996         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h:
997         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
998         (WebCore::JSTestOverrideBuiltins::finishCreation):
999         * bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
1000         * bindings/scripts/test/JS/JSTestSerialization.cpp:
1001         (WebCore::JSTestSerialization::finishCreation):
1002         * bindings/scripts/test/JS/JSTestSerialization.h:
1003         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
1004         (WebCore::JSTestSerializedScriptValueInterface::finishCreation):
1005         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
1006         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1007         (WebCore::JSTestTypedefs::finishCreation):
1008         * bindings/scripts/test/JS/JSTestTypedefs.h:
1009         * bindings/scripts/test/TestGlobalObject.idl:
1010         * page/DOMWindow.idl:
1011         * workers/DedicatedWorkerGlobalScope.idl:
1012
1013 2016-11-11  Antti Koivisto  <antti@apple.com>
1014
1015         Shadow DOM: Toggling class in `.class ::slotted(*)` does not trigger style recalc
1016         https://bugs.webkit.org/show_bug.cgi?id=160864
1017
1018         Reviewed by Ryosuke Niwa.
1019
1020         Also fix similar issue with ::host
1021
1022         Test: fast/shadow-dom/css-scoping-host-and-slotted-context-invalidation.html
1023
1024         * css/StyleInvalidationAnalysis.cpp:
1025         (WebCore::StyleInvalidationAnalysis::invalidateIfNeeded):
1026
1027             If we have ::slotted rules and encounter a <slot>, invalidate the slotted host children.
1028
1029         (WebCore::StyleInvalidationAnalysis::invalidateStyle):
1030
1031             Invalidate the shadow host if we have ::host rules.
1032
1033         * css/StyleInvalidationAnalysis.h:
1034         * dom/InlineStyleSheetOwner.cpp:
1035         (WebCore::InlineStyleSheetOwner::createSheet):
1036
1037             Fix a bug where it was possible to mutate stylesheets in the inline stylesheet cache.
1038             The included test covers this.
1039
1040         * style/StyleScope.cpp:
1041         (WebCore::Style::Scope::updateActiveStyleSheets):
1042
1043             Handle the full invalidation case.
1044
1045 2016-11-11  Brady Eidson  <beidson@apple.com>
1046
1047         IndexedDB 2.0: "close pending flag" and firing blocked events all need fixing.
1048         https://bugs.webkit.org/show_bug.cgi?id=164641
1049
1050         Reviewed by Alex Christensen.
1051
1052         No new tests (Covered by at least 3 existing tests).
1053
1054         * Modules/indexeddb/IDBDatabase.cpp:
1055         (WebCore::IDBDatabase::close):
1056         (WebCore::IDBDatabase::maybeCloseInServer):
1057
1058         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
1059         (WebCore::IDBClient::IDBConnectionProxy::databaseConnectionPendingClose):
1060         * Modules/indexeddb/client/IDBConnectionProxy.h:
1061
1062         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
1063         (WebCore::IDBClient::IDBConnectionToServer::databaseConnectionPendingClose):
1064         * Modules/indexeddb/client/IDBConnectionToServer.h:
1065         * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
1066
1067         * Modules/indexeddb/server/IDBServer.cpp:
1068         (WebCore::IDBServer::IDBServer::databaseConnectionPendingClose):
1069         * Modules/indexeddb/server/IDBServer.h:
1070
1071         * Modules/indexeddb/server/ServerOpenDBRequest.cpp:
1072         (WebCore::IDBServer::ServerOpenDBRequest::maybeNotifyRequestBlocked):
1073         (WebCore::IDBServer::ServerOpenDBRequest::notifyRequestBlocked): Deleted.
1074         * Modules/indexeddb/server/ServerOpenDBRequest.h:
1075         (WebCore::IDBServer::ServerOpenDBRequest::hasNotifiedBlocked): Deleted.
1076
1077         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1078         (WebCore::IDBServer::UniqueIDBDatabase::allConnectionsAreClosedOrClosing):
1079         (WebCore::IDBServer::UniqueIDBDatabase::maybeNotifyConnectionsOfVersionChange):
1080         (WebCore::IDBServer::UniqueIDBDatabase::notifyCurrentRequestConnectionClosedOrFiredVersionChangeEvent):
1081         * Modules/indexeddb/server/UniqueIDBDatabase.h:
1082
1083         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
1084         (WebCore::IDBServer::UniqueIDBDatabaseConnection::connectionPendingCloseFromClient):
1085         (WebCore::IDBServer::UniqueIDBDatabaseConnection::connectionClosedFromClient):
1086         (WebCore::IDBServer::UniqueIDBDatabaseConnection::connectionIsClosing):
1087         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:
1088
1089         * Modules/indexeddb/shared/InProcessIDBServer.cpp:
1090         (WebCore::InProcessIDBServer::databaseConnectionPendingClose):
1091         * Modules/indexeddb/shared/InProcessIDBServer.h:
1092
1093 2016-11-11  Dave Hyatt  <hyatt@apple.com>
1094
1095         [CSS Parser] Fix time unit parsing
1096         https://bugs.webkit.org/show_bug.cgi?id=164649
1097
1098         Reviewed by Dean Jackson.
1099         
1100         Make sure that a unitless value gets changed to milliseconds properly.
1101
1102         * css/parser/CSSPropertyParserHelpers.cpp:
1103         (WebCore::CSSPropertyParserHelpers::consumeTime):
1104
1105 2016-11-11  Keith Rollin  <krollin@apple.com>
1106
1107         Reduce number of platformMemoryUsage calls
1108         https://bugs.webkit.org/show_bug.cgi?id=164375
1109
1110         Reviewed by Andreas Kling.
1111
1112         platformMemoryUsage was being called all the time while logging the
1113         results of various memory-purging operations. This logging is
1114         subordinate to the needs of performance and so can be removed.
1115         Behavior is now as follows:
1116
1117         - If memory-pressure relief logging is enabled, logging includes
1118         memory usage information. On Cocoa, this logging is disabled by
1119         default but can be enabled by setting LogMemoryJetsamDetails in
1120         `defaults`.
1121         - Otherwise, if release-logging is enabled (as it is on Cocoa),
1122         abbreviated memory pressure relief logging is performed: the logging
1123         lines are printed but without any memory usage information.
1124         - Otherwise, no logging is performed.
1125
1126         No new tests -- no tests for logging.
1127
1128         * platform/MemoryPressureHandler.cpp:
1129         (WebCore::MemoryPressureHandler::ReliefLogger::logMemoryUsageChange):
1130         * platform/MemoryPressureHandler.h:
1131         (WebCore::MemoryPressureHandler::ReliefLogger::ReliefLogger):
1132         (WebCore::MemoryPressureHandler::ReliefLogger::~ReliefLogger):
1133
1134 2016-11-11  Eric Carlson  <eric.carlson@apple.com>
1135
1136         [MediaStream] defer resolution of getUserMedia promise made in a background tab
1137         https://bugs.webkit.org/show_bug.cgi?id=164643
1138         <rdar://problem/29048317>
1139
1140         Reviewed by Brady Eidson.
1141
1142         Test: fast/mediastream/get-user-media-background-tab.html
1143
1144         Do not start producing data when the document does not allow media
1145         to start playing. Instead, register with the document for a callback 
1146         when playback is allowed and start then.
1147         * Modules/mediastream/MediaStream.cpp:
1148         (WebCore::MediaStream::~MediaStream):
1149         (WebCore::MediaStream::mediaCanStart):
1150         (WebCore::MediaStream::startProducingData):
1151         (WebCore::MediaStream::stopProducingData):
1152         (WebCore::MediaStream::pageMutedStateDidChange):
1153         * Modules/mediastream/MediaStream.h:
1154
1155         * Modules/webaudio/AudioContext.cpp:
1156         (WebCore::AudioContext::mediaCanStart): Deal with API change.
1157         * Modules/webaudio/AudioContext.h:
1158
1159         * html/HTMLMediaElement.cpp:
1160         (WebCore::HTMLMediaElement::mediaCanStart): Ditto.
1161         * html/HTMLMediaElement.h:
1162         * page/MediaCanStartListener.h:
1163
1164         * page/Page.cpp:
1165         (WebCore::Page::takeAnyMediaCanStartListener): Return the listener and document.
1166         (WebCore::Page::setCanStartMedia): Pass the document to the listener.
1167         * page/Page.h:
1168
1169 2016-11-11  Zalan Bujtas  <zalan@apple.com>
1170
1171         RenderFlowThread's containing block cache should be invalidated before calling styleDidChange.
1172         https://bugs.webkit.org/show_bug.cgi?id=164646
1173
1174         Reviewed by Simon Fraser.
1175
1176         We have to invalidate the containing block cache for RenderFlowThreads soon after the containing block context
1177         changes. Invalidating it in RenderBlock::styleDidChange is too late since we might run some code in some
1178         of the subclasses that use this stale containing block cache.  
1179
1180         No known behaviour change.
1181
1182         * rendering/RenderBlock.cpp:
1183         (WebCore::RenderBlock::styleDidChange): This change could trigger double invalidation.
1184         However running this code twice shouldn't impact performance greatly.
1185         (WebCore::RenderBlock::resetFlowThreadContainingBlockAndChildInfoIncludingDescendants):
1186         (WebCore::RenderBlock::invalidateFlowThreadContainingBlockIncludingDescendants): Deleted.
1187         * rendering/RenderBlock.h:
1188         * rendering/RenderElement.cpp:
1189         (WebCore::RenderElement::setStyle): We don't need to call the invalidation from initializeStyle(), since
1190         we don't yet have cache at that point.
1191         * rendering/RenderInline.cpp:
1192         (WebCore::RenderInline::splitInlines):
1193
1194 2016-11-11  Darin Adler  <darin@apple.com>
1195
1196         Move Node from ExceptionCode to ExceptionOr
1197         https://bugs.webkit.org/show_bug.cgi?id=164515
1198
1199         Reviewed by Sam Weinig.
1200
1201         * bindings/js/JSHTMLSelectElementCustom.cpp:
1202         (WebCore::selectElementIndexSetter): Call remove instead of removeByIndex.
1203         Was renamed now that there is no conflict.
1204
1205         * bindings/js/JSNodeCustom.cpp:
1206         (WebCore::JSNode::insertBefore): Use ExceptionOr.
1207         (WebCore::JSNode::replaceChild): Ditto.
1208         (WebCore::JSNode::removeChild): Ditto.
1209         (WebCore::JSNode::appendChild): Ditto.
1210
1211         * dom/Attr.cpp:
1212         (WebCore::Attr::Attr): Take a reference.
1213         (WebCore::Attr::create): Ditto.
1214         (WebCore::Attr::createTextChild): Use a Ref.
1215         (WebCore::Attr::setPrefix): Use ExceptionOr.
1216         (WebCore::Attr::setNodeValue): Ditto.
1217         (WebCore::Attr::attachToElement): Take a reference.
1218         * dom/Attr.h: Updated for above. Also made setPrefix private.
1219
1220         * dom/CharacterData.cpp:
1221         (WebCore::CharacterData::setNodeValue): Use ExceptionOr.
1222         * dom/CharacterData.h: Updated for the above.
1223
1224         * dom/ContainerNode.cpp:
1225         (WebCore::collectChildrenAndRemoveFromOldParent): Use ExceptionOr.
1226         (WebCore::checkAcceptChild): Ditto.
1227         (WebCore::checkAcceptChildGuaranteedNodeTypes): Ditto.
1228         (WebCore::ContainerNode::ensurePreInsertionValidity): Ditto.
1229         (WebCore::checkPreReplacementValidity): Ditto.
1230         (WebCore::ContainerNode::insertBefore): Ditto.
1231         (WebCore::ContainerNode::replaceChild): Ditto.
1232         (WebCore::ContainerNode::removeChild): Ditto.
1233         (WebCore::ContainerNode::appendChild): Ditto.
1234         (WebCore::ContainerNode::appendChildWithoutPreInsertionValidityCheck): Ditto.
1235         (WebCore::ContainerNode::cloneChildNodes): Ditto.
1236         (WebCore::ContainerNode::append): Ditto.
1237         (WebCore::ContainerNode::prepend): Ditto.
1238         * dom/ContainerNode.h: Updated for above changes.
1239
1240         * dom/Document.cpp:
1241         (WebCore::Document::setTitle): Removed unneeded ASSERT_NO_EXCEPTION.
1242         (WebCore::Document::setBodyOrFrameset): Removed unneeded ignored
1243         exception code.
1244
1245         * dom/Element.cpp:
1246         (WebCore::Element::setPrefix): Use ExceptionOr.
1247         (WebCore::Element::setAttributeNode): Updated for changes to Attr.
1248         (WebCore::Element::setAttributeNodeNS): Ditto.
1249         (WebCore::Element::setOuterHTML): Use ExceptionOr.
1250         (WebCore::Element::ensureAttr): Updated for changes to Attr.
1251         (WebCore::Element::insertAdjacent): Use ExceptionOr.
1252         * dom/Element.h: Updated for above.
1253
1254         * dom/Node.cpp:
1255         (WebCore::Node::setNodeValue): Use ExceptionOr.
1256         (WebCore::Node::insertBefore): Ditto.
1257         (WebCore::Node::replaceChild): Ditto.
1258         (WebCore::Node::removeChild): Ditto.
1259         (WebCore::Node::appendChild): Ditto.
1260         (WebCore::Node::convertNodesOrStringsIntoNode): Ditto.
1261         (WebCore::Node::before): Ditto.
1262         (WebCore::Node::after): Ditto.
1263         (WebCore::Node::replaceWith): Ditto.
1264         (WebCore::Node::remove): Ditto.
1265         (WebCore::Node::cloneNodeForBindings): Ditto.
1266         (WebCore::Node::setPrefix): Ditto.
1267         (WebCore::Node::checkSetPrefix): Ditto.
1268         (WebCore::Node::setTextContent): Ditto.
1269         * dom/Node.h: Updated for above.
1270         * dom/Node.idl: Use non-legacy exceptions.
1271
1272         * dom/Range.cpp:
1273         (WebCore::Range::processContents): Use ExceptionOr.
1274         (WebCore::processContentsBetweenOffsets): Ditto.
1275         (WebCore::processNodes): Ditto.
1276         (WebCore::processAncestorsAndTheirSiblings): Ditto.
1277         (WebCore::Range::insertNode): Ditto.
1278         (WebCore::Range::surroundContents): Ditto.
1279
1280         * dom/Text.cpp:
1281         (WebCore::Text::splitText): Use ExceptionOr.
1282         (WebCore::Text::replaceWholeText): Removed unneeded IGNORE_EXCEPTION.
1283
1284         * editing/AppendNodeCommand.cpp:
1285         (WebCore::AppendNodeCommand::doApply): Removed unneeded IGNORE_EXCEPTION.
1286         * editing/CompositeEditCommand.cpp:
1287         (WebCore::CompositeEditCommand::insertNewDefaultParagraphElementAt): Ditto.
1288
1289         * editing/EditorCommand.cpp:
1290         (WebCore::executeInsertNode): Use ExceptionOr.
1291
1292         * editing/InsertNodeBeforeCommand.cpp:
1293         (WebCore::InsertNodeBeforeCommand::doApply): Removed unneeded IGNORE_EXCEPTION.
1294         * editing/MergeIdenticalElementsCommand.cpp:
1295         (WebCore::MergeIdenticalElementsCommand::doApply): Ditto.
1296         (WebCore::MergeIdenticalElementsCommand::doUnapply): Use ExceptionOr.
1297
1298         * editing/RemoveNodeCommand.cpp:
1299         (WebCore::RemoveNodeCommand::doUnapply): Removed unneeded IGNORE_EXCEPTION.
1300         * editing/ReplaceNodeWithSpanCommand.cpp:
1301         (WebCore::swapInNodePreservingAttributesAndChildren): Removed unneeded
1302         ASSERT_NO_EXCEPTION.
1303         * editing/ReplaceSelectionCommand.cpp:
1304         (WebCore::ReplacementFragment::removeNode): Ditto.
1305         (WebCore::ReplacementFragment::insertNodeBefore): Ditto.
1306         (WebCore::ReplacementFragment::insertFragmentForTestRendering): Ditto.
1307         (WebCore::ReplacementFragment::restoreAndRemoveTestRenderingNodesToFragment): Ditto.
1308         (WebCore::ReplaceSelectionCommand::insertAsListItems): Ditto.
1309
1310         * editing/SplitElementCommand.cpp:
1311         (WebCore::SplitElementCommand::executeApply): Use ExceptionOr.
1312         (WebCore::SplitElementCommand::doUnapply): Removed unneeded IGNORE_EXCEPTION.
1313
1314         * editing/SplitTextNodeCommand.cpp:
1315         (WebCore::SplitTextNodeCommand::insertText1AndTrimText2): Use ExceptionOr.
1316
1317         * editing/WrapContentsInDummySpanCommand.cpp:
1318         (WebCore::WrapContentsInDummySpanCommand::executeApply): Removed unneeded
1319         IGNORE_EXCEPTION.
1320         (WebCore::WrapContentsInDummySpanCommand::doUnapply): Ditto.
1321
1322         * editing/cocoa/EditorCocoa.mm:
1323         (WebCore::Editor::styleForSelectionStart): Removed unneeded ASSERT_NO_EXCEPTION
1324         and IGNORE_EXCEPTION.
1325         * editing/htmlediting.cpp:
1326         (WebCore::createTabSpanElement): Ditto.
1327         * editing/markup.cpp:
1328         (WebCore::fillContainerFromString): Ditto.
1329         (WebCore::createFragmentFromText): Ditto.
1330         (WebCore::removeElementFromFragmentPreservingChildren): Ditto.
1331         (WebCore::replaceChildrenWithFragment): Use ExceptionOr.
1332         (WebCore::replaceChildrenWithText): Ditto.
1333
1334         * editing/ios/EditorIOS.mm:
1335         (WebCore::Editor::WebContentReader::addFragment): Removed unneeded exception
1336         ignoring code.
1337         (WebCore::Editor::setDictationPhrasesAsChildOfElement): Ditto.
1338         (WebCore::Editor::setTextAsChildOfElement): Ditto.
1339
1340         * html/ColorInputType.cpp:
1341         (WebCore::ColorInputType::createShadowSubtree): Removed unneeded
1342         ASSERT_NO_EXCEPTION.
1343
1344         * html/FTPDirectoryDocument.cpp:
1345         (WebCore::FTPDirectoryDocumentParser::appendEntry): Removed unneeded
1346         IGNORE_EXCEPTION.
1347         (WebCore::FTPDirectoryDocumentParser::createTDForFilename): Ditto.
1348         (WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate): Ditto.
1349         (WebCore::FTPDirectoryDocumentParser::createBasicDocument): Ditto.
1350         * html/FileInputType.cpp:
1351         (WebCore::FileInputType::createShadowSubtree): Ditto.
1352
1353         * html/HTMLAnchorElement.cpp:
1354         (WebCore::HTMLAnchorElement::setText): Removed unneeded ASSERT_NO_EXCEPTION.
1355         * html/HTMLDetailsElement.cpp:
1356         (WebCore::HTMLDetailsElement::didAddUserAgentShadowRoot): Ditto.
1357
1358         * html/HTMLElement.cpp:
1359         (WebCore::HTMLElement::textToFragment): Use ExceptionOr.
1360         (WebCore::HTMLElement::setOuterText): Ditto.
1361
1362         * html/HTMLKeygenElement.cpp:
1363         (WebCore::HTMLKeygenElement::HTMLKeygenElement): Removed unneeded
1364         ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
1365         * html/HTMLMediaElement.cpp:
1366         (WebCore::HTMLMediaElement::createMediaControls): Ditto.
1367         * html/HTMLMeterElement.cpp:
1368         (WebCore::HTMLMeterElement::didAddUserAgentShadowRoot): Ditto.
1369         * html/HTMLOptionElement.cpp:
1370         (WebCore::HTMLOptionElement::createForJSConstructor): Use ExceptionOr.
1371         (WebCore::HTMLOptionElement::setText): Removed unneeded
1372         ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
1373
1374         * html/HTMLOptionsCollection.cpp:
1375         (WebCore::HTMLOptionsCollection::remove): Call remove, not removeByIndex,
1376         since we were able to change the name.
1377
1378         * html/HTMLOutputElement.cpp:
1379         (WebCore::HTMLOutputElement::setTextContentInternal): Removed unneeded
1380         ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
1381         * html/HTMLProgressElement.cpp:
1382         (WebCore::HTMLProgressElement::didAddUserAgentShadowRoot): Ditto.
1383         * html/HTMLScriptElement.cpp:
1384         (WebCore::HTMLScriptElement::setText): Ditto.
1385
1386         * html/HTMLSelectElement.cpp:
1387         (WebCore::HTMLSelectElement::add): Use ExceptionOr.
1388         (WebCore::HTMLSelectElement::remove): Renamed from removeByIndex since
1389         there is no conflict with remove any more.
1390         (WebCore::HTMLSelectElement::setOption): Call remove.
1391         * html/HTMLSelectElement.h: Updated for above.
1392         * html/HTMLSelectElement.idl: Got rid of ImplementedAs=removeByIndex.
1393
1394         * html/HTMLSummaryElement.cpp:
1395         (WebCore::HTMLSummaryElement::didAddUserAgentShadowRoot): Removed unneeded
1396         ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
1397         * html/HTMLTableElement.cpp:
1398         (WebCore::HTMLTableElement::HTMLTableElement): Initialize data members in
1399         class definition instead of here.
1400         (WebCore::HTMLTableElement::caption): Simplified using childrenOfType.
1401         (WebCore::HTMLTableElement::setCaption): Use ExceptionOr.
1402         (WebCore::HTMLTableElement::setTHead): Ditto.
1403         (WebCore::HTMLTableElement::setTFoot): Ditto.
1404         (WebCore::HTMLTableElement::deleteTFoot): Removed unneeded ASSERT_NO_EXCEPTION
1405         and IGNORE_EXCEPTION.
1406         (WebCore::HTMLTableElement::createTBody): Ditto.
1407         (WebCore::HTMLTableElement::deleteCaption): Ditto.
1408         (WebCore::HTMLTableElement::insertRow): Use ExceptionOr.
1409         * html/HTMLTableElement.h: Updated for above.
1410
1411         * html/HTMLTableRowElement.cpp:
1412         (WebCore::HTMLTableRowElement::insertCell): Use ExceptionOr.
1413         (WebCore::HTMLTableRowElement::deleteCell): Ditto.
1414         * html/HTMLTableSectionElement.cpp:
1415         (WebCore::HTMLTableSectionElement::insertRow): Ditto.
1416         (WebCore::HTMLTableSectionElement::deleteRow): Ditto.
1417
1418         * html/HTMLTextAreaElement.cpp:
1419         (WebCore::HTMLTextAreaElement::didAddUserAgentShadowRoot): Removed unneeded
1420         ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
1421         (WebCore::HTMLTextAreaElement::setDefaultValue): Ditto.
1422         (WebCore::HTMLTextAreaElement::updatePlaceholderText): Ditto.
1423         * html/HTMLTextFormControlElement.cpp:
1424         (WebCore::HTMLTextFormControlElement::setInnerTextValue): Ditto.
1425         * html/HTMLTitleElement.cpp:
1426         (WebCore::HTMLTitleElement::setText): Ditto.
1427         * html/MediaDocument.cpp:
1428         (WebCore::MediaDocumentParser::createDocumentStructure): Ditto.
1429         (WebCore::MediaDocument::replaceMediaElementTimerFired): Ditto.
1430         * html/PluginDocument.cpp:
1431         (WebCore::PluginDocumentParser::createDocumentStructure): Ditto.
1432         * html/RangeInputType.cpp:
1433         (WebCore::RangeInputType::createShadowSubtree): Ditto.
1434         * html/SearchInputType.cpp:
1435         (WebCore::SearchInputType::createShadowSubtree): Ditto.
1436         * html/TextFieldInputType.cpp:
1437         (WebCore::TextFieldInputType::createShadowSubtree): Ditto.
1438         (WebCore::TextFieldInputType::updatePlaceholderText): Ditto.
1439         (WebCore::TextFieldInputType::createContainer): Ditto.
1440         (WebCore::TextFieldInputType::createAutoFillButton): Ditto.
1441         * html/ValidationMessage.cpp:
1442         (WebCore::ValidationMessage::setMessageDOMAndStartTimer): Ditto.
1443         (WebCore::ValidationMessage::buildBubbleTree): Ditto.
1444         (WebCore::ValidationMessage::deleteBubbleTree): Ditto.
1445         * html/shadow/MediaControlElements.cpp:
1446         (WebCore::MediaControlTextTrackContainerElement::updateDisplay): Ditto.
1447         * html/shadow/MediaControls.cpp:
1448         (WebCore::MediaControls::createTextTrackDisplay): Ditto.
1449
1450         * html/shadow/MediaControlsApple.cpp:
1451         (WebCore::MediaControlsApple::MediaControlsApple): Initialize data members
1452         in class definition instead of here.
1453         (WebCore::MediaControlsApple::tryCreateControls): Use ExceptionOr.
1454         * html/shadow/MediaControlsApple.h: Updated for above.
1455
1456         * html/track/VTTCue.cpp:
1457         (WebCore::VTTCue::copyWebVTTNodeToDOMTree): Removed unneeded ASSERT_NO_EXCEPTION
1458         and IGNORE_EXCEPTION.
1459         (WebCore::VTTCue::getDisplayTree): Ditto.
1460         * html/track/VTTRegion.cpp:
1461         (WebCore::VTTRegion::appendTextTrackCueBox): Ditto.
1462
1463         * inspector/DOMEditor.cpp: Use ExceptionOr in action classes.
1464         (WebCore::DOMEditor::DOMEditor): Take a reference.
1465         (WebCore::DOMEditor::insertBefore): Use ExceptionOr.
1466         (WebCore::DOMEditor::removeChild): Ditto.
1467         (WebCore::DOMEditor::setAttribute): Ditto.
1468         (WebCore::DOMEditor::removeAttribute): Ditto.
1469         (WebCore::DOMEditor::setOuterHTML): Ditto.
1470         (WebCore::DOMEditor::replaceWholeText): Ditto.
1471         (WebCore::DOMEditor::replaceChild): Ditto.
1472         (WebCore::DOMEditor::setNodeValue): Ditto.
1473         (WebCore::populateErrorString): Ditto.
1474         * inspector/DOMEditor.h: Updated for above changes.
1475
1476         * inspector/DOMPatchSupport.cpp:
1477         (WebCore::DOMPatchSupport::patchDocument): Updated to use references,
1478         to use ExceptionOr, and to use a struct without a constructor for Digest.
1479         (WebCore::DOMPatchSupport::DOMPatchSupport): Ditto.
1480         (WebCore::DOMPatchSupport::patchNode): Ditto.
1481         (WebCore::DOMPatchSupport::innerPatchNode): Ditto.
1482         (WebCore::DOMPatchSupport::diff): Ditto.
1483         (WebCore::DOMPatchSupport::innerPatchChildren): Ditto.
1484         (WebCore::DOMPatchSupport::createDigest): Ditto.
1485         (WebCore::DOMPatchSupport::insertBeforeAndMarkAsUsed): Ditto.
1486         (WebCore::DOMPatchSupport::removeChildAndMoveToNew): Ditto.
1487         (WebCore::DOMPatchSupport::markNodeAsUsed): Ditto.
1488         * inspector/DOMPatchSupport.h: Updated for above.
1489
1490         * inspector/InspectorCSSAgent.cpp: Use ExceptionOr in the action classes.
1491         (WebCore::InspectorCSSAgent::getStyleSheetText): Use ExceptionOr.
1492         (WebCore::InspectorCSSAgent::setStyleSheetText): Ditto.
1493         (WebCore::InspectorCSSAgent::setStyleText): Ditto.
1494         (WebCore::InspectorCSSAgent::setRuleSelector): Ditto.
1495         (WebCore::InspectorCSSAgent::createInspectorStyleSheetForDocument): Ditto.
1496         (WebCore::InspectorCSSAgent::addRule): Ditto.
1497         * inspector/InspectorDOMAgent.cpp:
1498         (WebCore::InspectorDOMAgent::didCreateFrontendAndBackend): Ditto.
1499         (WebCore::InspectorDOMAgent::setAttributeValue): Ditto.
1500         (WebCore::InspectorDOMAgent::setAttributesAsText): Ditto.
1501         (WebCore::InspectorDOMAgent::removeAttribute): Ditto.
1502         (WebCore::InspectorDOMAgent::setOuterHTML): Ditto.
1503         (WebCore::InspectorDOMAgent::setNodeValue): Ditto.
1504         (WebCore::InspectorDOMAgent::undo): Ditto.
1505         (WebCore::InspectorDOMAgent::redo): Ditto.
1506
1507         * inspector/InspectorHistory.cpp:
1508         (WebCore::InspectorHistory::Action::Action): Moved to header.
1509         (WebCore::InspectorHistory::Action::~Action): Ditto.
1510         (WebCore::InspectorHistory::Action::toString): Ditto.
1511         (WebCore::InspectorHistory::Action::isUndoableStateMark): Ditto.
1512         (WebCore::InspectorHistory::Action::mergeId): Ditto.
1513         (WebCore::InspectorHistory::Action::merge): Ditto.
1514         (WebCore::InspectorHistory::InspectorHistory): Deleted.
1515         (WebCore::InspectorHistory::~InspectorHistory): Deleted.
1516         (WebCore::InspectorHistory::perform): Updated exception handling.
1517         (WebCore::InspectorHistory::markUndoableState): Ditto.
1518         (WebCore::InspectorHistory::undo): Ditto.
1519         (WebCore::InspectorHistory::redo): Ditto.
1520         * inspector/InspectorHistory.h: Updated for above.
1521
1522         * inspector/InspectorPageAgent.cpp:
1523         (WebCore::InspectorPageAgent::setDocumentContent): Use reference.
1524
1525         * inspector/InspectorStyleSheet.cpp:
1526         (WebCore::InspectorStyle::text): Use ExceptionOr and renamed from
1527         getText since this now has a return value.
1528         (WebCore::InspectorStyle::populateAllProperties): Updated for above.
1529         (WebCore::InspectorStyle::setText): Use ExceptionOr.
1530         (WebCore::InspectorStyleSheet::setText): Ditto.
1531         (WebCore::InspectorStyleSheet::ruleSelector): Ditto.
1532         (WebCore::InspectorStyleSheet::setRuleSelector): Ditto.
1533         (WebCore::InspectorStyleSheet::addRule): Ditto.
1534         (WebCore::InspectorStyleSheet::deleteRule): Ditto.
1535         (WebCore::InspectorStyleSheet::buildObjectForStyleSheet): Ditto.
1536         (WebCore::InspectorStyleSheet::buildObjectForStyle): Ditto.
1537         (WebCore::InspectorStyleSheet::setStyleText): Ditto.
1538         (WebCore::InspectorStyleSheet::text): Use ExceptionOr and renamed.
1539         (WebCore::InspectorStyleSheet::checkPageStyleSheet): Deleted.
1540         Just wrote this code inline in each place this was called since it's
1541         just a single null check.
1542         (WebCore::InspectorStyleSheetForInlineStyle::text): Use ExceptionOr
1543         and renamed.
1544         (WebCore::InspectorStyleSheetForInlineStyle::setStyleText): Ditto.
1545         (WebCore::InspectorStyle::getText): Deleted.
1546         * inspector/InspectorStyleSheet.h: Updated for above changes.
1547
1548         * page/DragController.cpp:
1549         (WebCore::documentFragmentFromDragData): Removed unneeded
1550         ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
1551         * page/ios/FrameIOS.mm:
1552         (WebCore::Frame::initWithSimpleHTMLDocument): Ditto.
1553         * svg/SVGTRefElement.cpp:
1554         (WebCore::SVGTRefElement::updateReferencedText): Ditto.
1555         (WebCore::SVGTRefElement::detachTarget): Ditto.
1556         * xml/XMLTreeViewer.cpp:
1557         (WebCore::XMLTreeViewer::transformDocumentToTreeView): Ditto.
1558
1559 2016-11-10  Jiewen Tan  <jiewen_tan@apple.com>
1560
1561         Rename CryptoKeyUsage to CryptoKeyUsageBitmap and CryptoKey::Usage to CryptoKeyUsage
1562         https://bugs.webkit.org/show_bug.cgi?id=164624
1563         <rdar://problem/29210140>
1564
1565         Reviewed by Brent Fulgham.
1566
1567         This patch allows IDLType CryptoKeyUsage to be shared among different IDLs, i.e. CryptoKey.idl,
1568         SubtleCrypto.idl and JsonWebKey.idl such that it can simplify the customized binding codes.
1569
1570         Covered by existing tests.
1571
1572         * CMakeLists.txt:
1573         * DerivedSources.make:
1574         * WebCore.xcodeproj/project.pbxproj:
1575         * bindings/js/JSCryptoKeySerializationJWK.cpp:
1576         * bindings/js/JSCryptoKeySerializationJWK.h:
1577         * bindings/js/JSSubtleCryptoCustom.cpp:
1578         (WebCore::toCryptoKeyUsageBitmap):
1579         (WebCore::cryptoKeyUsageBitmapFromJSValue):
1580         (WebCore::toKeyData):
1581         (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise):
1582         (WebCore::jsSubtleCryptoFunctionImportKeyPromise):
1583         (WebCore::cryptoKeyUsageFromString): Deleted.
1584         (WebCore::cryptoKeyUsagesFromJSValue): Deleted.
1585         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
1586         * bindings/js/SerializedScriptValue.cpp:
1587         * crypto/CryptoAlgorithm.cpp:
1588         * crypto/CryptoAlgorithm.h:
1589         * crypto/CryptoKey.cpp:
1590         * crypto/CryptoKey.h:
1591         * crypto/CryptoKey.idl:
1592         * crypto/CryptoKeySerialization.h:
1593         * crypto/CryptoKeyUsage.h:
1594         * crypto/CryptoKeyUsage.idl: Added.
1595         * crypto/gnutls/CryptoKeyRSAGnuTLS.cpp:
1596         * crypto/JsonWebKey.h:
1597         * crypto/JsonWebKey.idl:
1598         * crypto/SubtleCrypto.idl:
1599         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
1600         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
1601         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
1602         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
1603         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
1604         * crypto/algorithms/CryptoAlgorithmHMAC.h:
1605         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
1606         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
1607         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
1608         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
1609         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
1610         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
1611         * crypto/keys/CryptoKeyAES.cpp:
1612         * crypto/keys/CryptoKeyAES.h:
1613         * crypto/keys/CryptoKeyHMAC.cpp:
1614         * crypto/keys/CryptoKeyHMAC.h:
1615         * crypto/keys/CryptoKeyRSA.cpp:
1616         * crypto/keys/CryptoKeyRSA.h:
1617         * crypto/keys/CryptoKeySerializationRaw.cpp:
1618         * crypto/keys/CryptoKeySerializationRaw.h:
1619         * crypto/mac/CryptoKeyRSAMac.cpp:
1620
1621 2016-11-11  Dave Hyatt  <hyatt@apple.com>
1622
1623         [CSS Parser] Fix basic shape parsing
1624         https://bugs.webkit.org/show_bug.cgi?id=164645
1625
1626         Reviewed by Dean Jackson.
1627
1628         * css/parser/CSSPropertyParser.cpp:
1629         (WebCore::consumeBasicShape):
1630
1631 2016-11-11  Zalan Bujtas  <zalan@apple.com>
1632
1633         RenderFlowThread::removeLineRegionInfo shouldn't call HashMap::contains before HashMap::remove
1634         https://bugs.webkit.org/show_bug.cgi?id=164639
1635
1636         Reviewed by Simon Fraser.
1637
1638         Also instead of asserting that the incoming renderer is not nullptr, we could just pass a reference in. 
1639
1640         No change in functionality.
1641
1642         * rendering/RenderBlock.cpp:
1643         (WebCore::RenderBlock::invalidateFlowThreadContainingBlockIncludingDescendants):
1644         (WebCore::canComputeRegionRangeForBox):
1645         (WebCore::RenderBlock::computeRegionRangeForBoxChild):
1646         (WebCore::RenderBlock::estimateRegionRangeForBoxChild):
1647         (WebCore::RenderBlock::updateRegionRangeForBoxChild):
1648         * rendering/RenderBox.cpp:
1649         (WebCore::RenderBox::hasRegionRangeInFlowThread):
1650         * rendering/RenderElement.cpp:
1651         (WebCore::RenderElement::removeFromRenderFlowThreadIncludingDescendants):
1652         * rendering/RenderFlowThread.cpp:
1653         (WebCore::RenderFlowThread::removeFlowChildInfo):
1654         (WebCore::RenderFlowThread::validateRegions):
1655         (WebCore::RenderFlowThread::removeRenderBoxRegionInfo):
1656         (WebCore::RenderFlowThread::removeLineRegionInfo):
1657         (WebCore::RenderFlowThread::clearRenderBoxRegionInfoAndCustomStyle):
1658         (WebCore::RenderFlowThread::setRegionRangeForBox):
1659         (WebCore::RenderFlowThread::hasCachedRegionRangeForBox):
1660         (WebCore::RenderFlowThread::computedRegionRangeForBox):
1661         (WebCore::RenderFlowThread::checkLinesConsistency):
1662         * rendering/RenderFlowThread.h:
1663         * rendering/RenderMultiColumnFlowThread.cpp:
1664         (WebCore::RenderMultiColumnFlowThread::setRegionRangeForBox):
1665         * rendering/RenderMultiColumnFlowThread.h:
1666         * rendering/RenderNamedFlowFragment.cpp:
1667         (WebCore::RenderNamedFlowFragment::clearObjectStyleInRegion):
1668         * rendering/RenderNamedFlowFragment.h:
1669         * rendering/RenderNamedFlowThread.cpp:
1670         (WebCore::RenderNamedFlowThread::clearRenderObjectCustomStyle):
1671         (WebCore::RenderNamedFlowThread::removeFlowChildInfo):
1672         * rendering/RenderNamedFlowThread.h:
1673         * rendering/RenderRegion.cpp:
1674         (WebCore::RenderRegion::removeRenderBoxRegionInfo):
1675         * rendering/RenderRegion.h:
1676
1677 2016-11-11  Megan Gardner  <megan_gardner@apple.com>
1678
1679         [Cocoa] Support wide gamut for Drag Image UI
1680         https://bugs.webkit.org/show_bug.cgi?id=164490
1681
1682         Reviewed by Tim Horton.
1683
1684         Fixed an error in the support define for wide gamut on Mac.
1685
1686         The testing infrastructure to test this does not exist, and will be landing in another patch.
1687
1688         * platform/graphics/cg/GraphicsContextCG.cpp:
1689         (WebCore::extendedSRGBColorSpaceRef):
1690
1691 2016-11-11  Beth Dakin  <bdakin@apple.com>
1692
1693         Get touch bar code building for open source builds
1694         https://bugs.webkit.org/show_bug.cgi?id=164610
1695
1696         Reviewed by Wenson Hsieh.
1697
1698         * config.h:
1699
1700 2016-11-11  Dave Hyatt  <hyatt@apple.com>
1701
1702         [CSS Parser] Fix SVG markers and colors
1703         https://bugs.webkit.org/show_bug.cgi?id=164640
1704
1705         Reviewed by Dean Jackson.
1706
1707         * css/StyleBuilderConverter.h:
1708         (WebCore::StyleBuilderConverter::convertSVGColor):
1709         * css/parser/CSSPropertyParser.cpp:
1710         (WebCore::CSSPropertyParser::parseShorthand):
1711
1712 2016-11-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1713
1714         Composition state should be cleared when changing focus to a non-editable element
1715         https://bugs.webkit.org/show_bug.cgi?id=164595
1716         <rdar://problem/26412551>
1717
1718         Reviewed by Enrica Casucci.
1719
1720         When canceling or confirming a composition, always ensure that the composition node and composition underlines
1721         being tracked are reset, even when there is no current selection. This prevents us from getting into a bad state
1722         where focus has already changed from an element with a pending composition to a different element and the
1723         composition is canceled, but the Editor still maintains its composition node.
1724
1725         Test: editing/input/focus-change-with-marked-text.html
1726
1727         * editing/Editor.cpp:
1728         (WebCore::Editor::setComposition):
1729
1730 2016-11-11  Dave Hyatt  <hyatt@apple.com>
1731
1732         [CSS Parser] Support -webkit-svg-shadow
1733         https://bugs.webkit.org/show_bug.cgi?id=164637
1734
1735         Reviewed by Zalan Bujtas.
1736
1737         * css/parser/CSSPropertyParser.cpp:
1738         (WebCore::CSSPropertyParser::parseSingleValue):
1739
1740 2016-11-11  Alejandro G. Castro  <alex@igalia.com>
1741
1742         [WebRTC][OpenWebRTC] Implement device permissions handling solution for owr backend in the UI process
1743         https://bugs.webkit.org/show_bug.cgi?id=164010
1744
1745         Reviewed by Philippe Normand.
1746
1747         Move the capture of the sources for the OWR backend to the
1748         WebProcess. In the UI we continue checking if the user allows
1749         access to the audio and video capture. When device handling is
1750         added in the future we will need some persistent ID and API to
1751         pass from the UI process to the Web process.
1752
1753         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
1754         (WebCore::RealtimeMediaSourceCenterOwr::validateRequestConstraints):
1755         Add the proper audio and video sources to allow the UI message to
1756         be properly rendered. We are adding the specific devices, even
1757         though the dialog just asks for general audio and video. There was
1758         already a FIXME about improving this.
1759         (WebCore::RealtimeMediaSourceCenterOwr::createMediaStream): We are
1760         capturing the devices here when the allowed message arrived from
1761         the UI process. We store the completion handler to use it later
1762         when the aync owr API finishes capture devices process.
1763         (WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable): We
1764         now call the completion handler in this callback called when the
1765         owr library finishes the capture of the devices. Now this happens
1766         in the WebProcess for OWR port.
1767         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h:
1768         Add an attribute to store the completion handler.
1769
1770 2016-11-11  Manuel Rego Casasnovas  <rego@igalia.com>
1771
1772         [css-grid] ASSERTION FAILED: !m_gridIsDirty in WebCore::RenderGrid::gridRowCount
1773         https://bugs.webkit.org/show_bug.cgi?id=163450
1774
1775         Reviewed by Darin Adler.
1776
1777         The issue is that in the test case a simplifiedLayout() is performed.
1778         So in RenderGrid::layoutBlock() we early return and the grid is not populated,
1779         so the m_gridIsDirty flag is not cleared when we try to check the size of the grid
1780         in RenderGrid::layoutPositionedObject().
1781
1782         We should avoid to do a simplified layout if we have to layout
1783         some positioned grid items and the grid is dirty.
1784
1785         The problem was not only the ASSERT, but the current behavior was wrong too.
1786         As we didn't do a proper layout of the grid container, the positioned item
1787         won't be placed on the expected position. Added tests verifying this.
1788
1789         Tests: fast/css-grid-layout/grid-positioned-item-dynamic-change.html
1790                fast/css-grid-layout/grid-simplified-layout-positioned.html
1791
1792         * rendering/RenderBlock.cpp:
1793         (WebCore::RenderBlock::canPerformSimplifiedLayout): Check if we can perform or not
1794         a simplified layout.
1795         (WebCore::RenderBlock::simplifiedLayout): Extract initial check
1796         into canPerformSimplifiedLayout().
1797         * rendering/RenderBlock.h: Add new header for canPerformSimplifiedLayout().
1798         * rendering/RenderGrid.cpp: Implement our own version of canPerformSimplifiedLayout()
1799         to verify that the grid is not dirty if we have to layout some positioned items.
1800         (WebCore::RenderGrid::canPerformSimplifiedLayout):
1801         * rendering/RenderGrid.h: Add canPerformSimplifiedLayout() header.
1802
1803 2016-11-11  Antoine Quint  <graouts@apple.com>
1804
1805         [Modern Media Controls] Media Controller: media tracks control support
1806         https://bugs.webkit.org/show_bug.cgi?id=164618
1807         <rdar://problem/27989483>
1808
1809         Reviewed by Dean Jackson.
1810
1811         We introduce the TracksSupport class to only enable the media tracks button
1812         in the media controls when text tracks and/or multiple audio tracks are available.
1813
1814         Tests: media/modern-media-controls/tracks-support/tracks-support-audio-tracks.html
1815                media/modern-media-controls/tracks-support/tracks-support-no-tracks.html
1816                media/modern-media-controls/tracks-support/tracks-support-text-tracks.html
1817
1818         * Modules/modern-media-controls/js-files:
1819         * Modules/modern-media-controls/media/media-controller.js:
1820         (MediaController.prototype._updateControlsIfNeeded):
1821         * Modules/modern-media-controls/media/tracks-support.js: Added.
1822         (TracksSupport):
1823         (TracksSupport.prototype.destroy):
1824         (TracksSupport.prototype.get control):
1825         (TracksSupport.prototype.get mediaEvents):
1826         (TracksSupport.prototype.buttonWasClicked):
1827         (TracksSupport.prototype.syncControl):
1828         * WebCore.xcodeproj/project.pbxproj:
1829
1830 2016-11-10  Yusuke Suzuki  <utatane.tea@gmail.com>
1831
1832         [DOMJIT] DOMJIT accessor attribute in IDL should say like DOMJIT=Getter
1833         https://bugs.webkit.org/show_bug.cgi?id=164632
1834
1835         Reviewed by Sam Weinig.
1836
1837         Currently, DOMJIT patchpoint is only allowed for getter in attributes.
1838         To make it explicit, we use IDL attribute DOMJIT=Getter instead of
1839         DOMJIT.
1840
1841         * bindings/scripts/CodeGeneratorJS.pm:
1842         (GenerateHeader):
1843         (GenerateImplementation):
1844         * bindings/scripts/IDLAttributes.txt:
1845         * bindings/scripts/test/TestDOMJIT.idl:
1846         * dom/Document.idl:
1847         * dom/Node.idl:
1848
1849 2016-11-10  Sam Weinig  <sam@webkit.org>
1850
1851         [SVG] Start moving special casing of SVG out of the bindings - SVGPreserveAspectRatio
1852         https://bugs.webkit.org/show_bug.cgi?id=164622
1853
1854         Reviewed by Darin Adler.
1855
1856         Part 2 of moving special casing of SVG out of the bindings.
1857
1858         * CMakeLists.txt:
1859         * WebCore.xcodeproj/project.pbxproj:
1860         Add new files.
1861
1862         * bindings/scripts/CodeGenerator.pm:
1863         (GenerateCompileTimeCheckForEnumsIfNeeded):
1864         * bindings/scripts/IDLAttributes.txt:
1865         Allow specifying a different scope for the constants to be declared in.
1866         This allows us to have only one copy of the constants in the implementation
1867         of SVGAngle/SVGAngleValue and SVGPreserveAspectRatio/SVGPreserveAspectRatioValue.
1868
1869         * loader/FrameLoader.cpp:
1870         * rendering/svg/RenderSVGImage.h:
1871         Remove unnecessary #include.
1872
1873         * svg/SVGAngle.h:
1874         Remove redundant enum declaration.
1875
1876         * svg/SVGAngle.idl:
1877         Specify a ConstantsScope of SVGAngleValue.
1878
1879         * rendering/svg/RenderSVGImage.cpp:
1880         (WebCore::RenderSVGImage::updateImageViewport):
1881         * svg/PatternAttributes.h:
1882         (WebCore::PatternAttributes::preserveAspectRatio):
1883         (WebCore::PatternAttributes::setPreserveAspectRatio):
1884         * svg/SVGAnimatedPreserveAspectRatio.cpp:
1885         (WebCore::SVGAnimatedPreserveAspectRatioAnimator::constructFromString):
1886         (WebCore::SVGAnimatedPreserveAspectRatioAnimator::calculateAnimatedValue):
1887         * svg/SVGAnimatedPreserveAspectRatio.h:
1888         * svg/SVGAnimatedType.cpp:
1889         (WebCore::SVGAnimatedType::createPreserveAspectRatio):
1890         * svg/SVGAnimatedType.h:
1891         (WebCore::SVGAnimatedType::preserveAspectRatio):
1892         * svg/SVGFEImageElement.cpp:
1893         (WebCore::SVGFEImageElement::parseAttribute):
1894         * svg/SVGFitToViewBox.cpp:
1895         (WebCore::SVGFitToViewBox::viewBoxToViewTransform):
1896         * svg/SVGFitToViewBox.h:
1897         (WebCore::SVGFitToViewBox::parseAttribute):
1898         * svg/SVGImageElement.cpp:
1899         (WebCore::SVGImageElement::parseAttribute):
1900         * svg/SVGViewSpec.cpp:
1901         (WebCore::SVGViewSpec::preserveAspectRatioString):
1902         (WebCore::SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper):
1903         (WebCore::SVGViewSpec::reset):
1904         (WebCore::SVGViewSpec::parseViewSpec):
1905         * svg/SVGViewSpec.h:
1906         * svg/graphics/SVGImage.cpp:
1907         (WebCore::SVGImage::computeIntrinsicDimensions):
1908         * svg/graphics/filters/SVGFEImage.cpp:
1909         (WebCore::FEImage::FEImage):
1910         (WebCore::FEImage::createWithImage):
1911         (WebCore::FEImage::createWithIRIReference):
1912         * svg/graphics/filters/SVGFEImage.h:
1913         Replace SVGPreserveAspectRatio usage with SVGPreserveAspectRatioValue.
1914
1915         * svg/SVGPreserveAspectRatio.cpp: Removed.
1916         * svg/SVGPreserveAspectRatio.h: Replaced.
1917         * svg/SVGPreserveAspectRatio.idl:
1918         * svg/SVGPreserveAspectRatioValue.cpp: Copied from Source/WebCore/svg/SVGPreserveAspectRatio.cpp.
1919         * svg/SVGPreserveAspectRatioValue.h: Copied from Source/WebCore/svg/SVGPreserveAspectRatio.h.
1920         Rename SVGPreserveAspectRatio to SVGPreserveAspectRatioValue and add a new SVGPreserveAspectRatio
1921         that acts as the binding object. 
1922
1923 2016-11-10  Yusuke Suzuki  <utatane.tea@gmail.com>
1924
1925         [DOMJIT] Document#body should have DOMJIT patchpoint
1926         https://bugs.webkit.org/show_bug.cgi?id=164627
1927
1928         Reviewed by Darin Adler.
1929
1930         This patch implements document.body accessor. To implement it, we need,
1931
1932         1. DOM traversing ability from ASM.
1933         2. Checking HTMLElement.
1934         3. Checking HTMLElement's localName.
1935
1936         The above features are already implemented in CSSJIT.
1937         We extract some of utilities from CSSJIT to share them with DOMJIT.
1938
1939         Test: js/dom/domjit-accessor-document-body.html
1940
1941         * cssjit/SelectorCompiler.cpp:
1942         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateWalkToParentElement):
1943         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateWalkToNextAdjacentElement):
1944         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateWalkToPreviousAdjacentElement):
1945         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeMatching):
1946         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeValueExactMatching):
1947         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeFunctionCallValueMatching):
1948         (WebCore::SelectorCompiler::jumpIfElementIsNotEmpty):
1949         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementHasTagName):
1950         (WebCore::SelectorCompiler::testIsElementFlagOnNode): Deleted.
1951         (WebCore::SelectorCompiler::testIsHTMLFlagOnNode): Deleted.
1952         * dom/Document.idl:
1953         * dom/Element.h:
1954         * dom/QualifiedName.h:
1955         * domjit/DOMJITAbstractHeapRepository.yaml:
1956         * domjit/DOMJITHelpers.h:
1957         (WebCore::DOMJIT::branchTestIsElementFlagOnNode):
1958         (WebCore::DOMJIT::branchTestIsHTMLFlagOnNode):
1959         * domjit/JSDocumentDOMJIT.cpp:
1960         (WebCore::DocumentBodyDOMJIT::checkDOM):
1961         (WebCore::loadLocalName):
1962         (WebCore::DocumentBodyDOMJIT::callDOMGetter):
1963
1964 2016-11-10  John Wilander  <wilander@apple.com>
1965
1966         Remove unused parameter name to fix build error on iOS
1967         https://bugs.webkit.org/show_bug.cgi?id=163468
1968
1969         No review.
1970
1971         No new tests.
1972
1973         * platform/ios/PasteboardIOS.mm:
1974         (WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
1975             Removed parameter name 'pasteboardURL' in unimplemented function.
1976
1977 2016-11-10  Chris Dumez  <cdumez@apple.com>
1978
1979         Speed up HTMLInputElement validation
1980         https://bugs.webkit.org/show_bug.cgi?id=164603
1981
1982         Reviewed by Ryosuke Niwa.
1983
1984         Speed up HTMLInputElement validation by doing 1 virtual function call
1985         instead of 9 and calling HTMLInputElement::value() only once per
1986         validation instead of 9 times. Calling value() is expensive because
1987         of sanitization.
1988
1989         No new tests, no Web-exposed behavior change.
1990
1991         * html/BaseCheckableInputType.cpp:
1992         (WebCore::BaseCheckableInputType::fallbackValue):
1993         * html/FormAssociatedElement.cpp:
1994         (WebCore::FormAssociatedElement::isValid):
1995         * html/FormAssociatedElement.h:
1996         * html/HTMLFormControlElement.cpp:
1997         (WebCore::HTMLFormControlElement::isValidFormControlElement):
1998         (WebCore::HTMLFormControlElement::updateValidity):
1999         * html/HTMLInputElement.cpp:
2000         (WebCore::HTMLInputElement::isValid):
2001         (WebCore::HTMLInputElement::value):
2002         * html/HTMLInputElement.h:
2003         * html/TextFieldInputType.cpp:
2004         (WebCore::limitLength):
2005         * html/ValidityState.idl:
2006
2007 2016-11-10  John Wilander  <wilander@apple.com>
2008
2009         Add link information to data transfer pasteboard for drag and drop links
2010         https://bugs.webkit.org/show_bug.cgi?id=163468
2011         <rdar://problem/20634630>
2012
2013         Reviewed by Brent Fulgham.
2014
2015         Test: editing/pasteboard/drag-link-with-data-transfer-adds-trusted-link-to-pasteboard.html
2016         This test ensures data transfers still work for types 'text' and 'url', i.e. that we don't
2017         regress in-page use of the drag pasteboard.
2018
2019         * page/DragController.cpp:
2020         (WebCore::DragController::startDrag):
2021             Now adds trustworthy link information to the drag pasteboard.
2022         * platform/Pasteboard.h:
2023             New function declaration Pasteboard::writeTrustworthyWebURLsPboardType.
2024         * platform/efl/PasteboardEfl.cpp:
2025         (WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
2026             Empty, i.e. not implemented.
2027         * platform/gtk/PasteboardGtk.cpp:
2028         (WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
2029             Empty, i.e. not implemented.
2030         * platform/ios/PasteboardIOS.mm:
2031         (WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
2032             Calls ASSERT_NOT_REACHED() to make sure we don't use this function before we have
2033             decided on a trustrworthy URL pasteboard type on iOS. Currently not used since we
2034             don't support drag & drop on iOS.
2035         * platform/mac/PasteboardMac.mm:
2036         (WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
2037             Writes the given URL to the WebURLsWithTitlesPboardType. This pasteboard type
2038             serves as a trusted drop source.
2039         * platform/win/PasteboardWin.cpp:
2040         (WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
2041             Empty, i.e. not implemented.
2042
2043 2016-11-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
2044
2045         REGRESSION(r207182): [iOS] Crash because of passing freed CFDictionaryRef to CG when decoding a sub-sampled large image
2046         https://bugs.webkit.org/show_bug.cgi?id=164617
2047
2048         Reviewed by Tim Horton.
2049
2050         This covered by the test fast/images/image-subsampling.html but it should
2051         run with --guard-malloc --repeat-each=10 to show the bug or to verify the
2052         fix.
2053
2054         imageSourceOptions() returns a non static RetainPtr<CFDictionaryRef> if
2055         the subsamplingLevel is not zero. Because we are assigning the raw pointer
2056         to a local variable in ImageDecoder::createFrameImageAtIndex(), CFRelease()
2057         is called for the CFDictionaryRef immediately after this assignment. This
2058         causes its memory to be freed in this case even before calling CG.
2059
2060         This bug does not happen if the subsamplingLevel is zero because we cache
2061         the returned value in a static NeverDestroyed<RetainPtr<CFDictionaryRef> in
2062         imageSourceOptions(). This cache prevents the CFDictionaryRef from being
2063         freed in ImageDecoder::createFrameImageAtIndex() no matter where CFRelease()
2064         is called.
2065
2066         The fix is hold the returned value in a RetainPtr<CFDictionaryRef>. This
2067         will ensure the CFDictionaryRef raw pointer is valid till the end of
2068         ImageDecoder::createFrameImageAtIndex().
2069
2070         * platform/graphics/cg/ImageDecoderCG.cpp:
2071         (WebCore::ImageDecoder::createFrameImageAtIndex): Ensure the pointer is retained.
2072
2073 2016-11-10  Brent Fulgham  <bfulgham@apple.com>
2074
2075         [Win][Direct2D] Add transparency layer support
2076         https://bugs.webkit.org/show_bug.cgi?id=164614
2077
2078         Reviewed by Dean Jackson.
2079
2080         Provide a stackable implementation of transparency layers so that
2081         multiple layers with opacity draw propery.
2082
2083         Tested by fast/layers/opacity-stacking.html and others.
2084
2085         * platform/graphics/win/GraphicsContextDirect2D.cpp:
2086         (WebCore::GraphicsContext::platformContext): Remove unneeded assertion.
2087         (WebCore::GraphicsContextPlatformPrivate::renderTarget): Return current context taking
2088         into account the presence of transparency layers.
2089         (WebCore::GraphicsContextPlatformPrivate::setAlpha): Added.
2090         (WebCore::GraphicsContextPlatformPrivate::currentGlobalAlpha): Get current global
2091         alpha for current layer.
2092         (WebCore::GraphicsContext::colorWithGlobalAlpha): Compute proper color taking into
2093         account the current layer.
2094         (WebCore::drawWithShadowHelper): Helper function to share code.
2095         (WebCore::GraphicsContext::drawWithShadow): Use new helper function.
2096         (WebCore::GraphicsContextPlatformPrivate::beginTransparencyLayer): Added.
2097         (WebCore::GraphicsContext::beginPlatformTransparencyLayer): Call new implementation.
2098         (WebCore::GraphicsContextPlatformPrivate::endTransparencyLayer): Added.
2099         (WebCore::GraphicsContext::endPlatformTransparencyLayer): Call new implementation.
2100         (WebCore::GraphicsContext::clearRect): Clear to transparent color.
2101         (WebCore::GraphicsContext::setPlatformAlpha): Pass new alpha on to any active
2102         transparency layer.
2103         * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h:
2104         (WebCore::GraphicsContextPlatformPrivate::renderTarget): Deleted.
2105
2106 2016-11-10  Dean Jackson  <dino@apple.com>
2107
2108         Add CSS Color Level 4 to features.
2109
2110         * features.json:
2111
2112 2016-11-10  Zalan Bujtas  <zalan@apple.com>
2113
2114         Move update image calls to RenderElement::styleDidChange.
2115         https://bugs.webkit.org/show_bug.cgi?id=164623
2116
2117         Reviewed by Simon Fraser.
2118
2119         There should be no dependency on the image update between ::styleWillChange and ::styleDidChange.
2120
2121         Covered by existing tests.
2122
2123         * rendering/RenderElement.cpp:
2124         (WebCore::RenderElement::initializeStyle):
2125         (WebCore::RenderElement::setStyle):
2126         (WebCore::RenderElement::styleDidChange):
2127
2128 2016-11-10  Joseph Pecoraro  <pecoraro@apple.com>
2129
2130         After r207459 ASSERT in CachedResourceLoader under InspectorPageAgent::cachedResource
2131         https://bugs.webkit.org/show_bug.cgi?id=164621
2132
2133         Reviewed by Youenn Fablet.
2134
2135         * inspector/InspectorPageAgent.cpp:
2136         (WebCore::InspectorPageAgent::cachedResource):
2137         CachedResourceLoader expects a sanitized URL.
2138
2139 2016-11-10  Brady Eidson  <beidson@apple.com>
2140
2141         IndexedDB 2.0 Support the IDBDatabase.onclose event.
2142         https://bugs.webkit.org/show_bug.cgi?id=164602
2143
2144         Reviewed by Alex Christensen.
2145
2146         No new tests (Covered by existing tests).
2147
2148         * Modules/indexeddb/IDBDatabase.cpp:
2149         (WebCore::IDBDatabase::connectionToServerLost): Fire "onclose" after "onerror"
2150         * Modules/indexeddb/IDBDatabase.idl:
2151
2152 2016-11-10  Ryosuke Niwa  <rniwa@webkit.org>
2153
2154         Copied text would contain text inside CDATA sections and comments
2155         https://bugs.webkit.org/show_bug.cgi?id=164578
2156         <rdar://problem/19834542>
2157
2158         Reviewed by Darin Adler.
2159
2160         The bug was caused by HTMLConverter::_traverseNode always including the content of a Text node.
2161         Since Comment and CDataSection nodes are also Text nodes, we need to exclude them.
2162
2163         In the long term, we should check the visibility of the text as done in MarkupAccumulator.
2164
2165         Test: editing/mac/attributed-string/comment-cdata-section.html
2166
2167         * editing/cocoa/HTMLConverter.mm:
2168         (HTMLConverter::_traverseNode):
2169
2170 2016-11-10  Eric Carlson  <eric.carlson@apple.com>
2171
2172         [MediaStream] apply constraints passed to getUserMedia()
2173         https://bugs.webkit.org/show_bug.cgi?id=164561
2174
2175         Reviewed by Youenn Fablet.
2176         <rdar://problem/29191384>
2177
2178         No new tests, updated existing tests.
2179
2180         * Modules/mediastream/UserMediaRequest.cpp:
2181         (WebCore::UserMediaRequest::allow): Pass constraints into createMediaStream instead of applying
2182           them after the stream has been created.
2183
2184         * WebCore.xcodeproj/project.pbxproj: Remove MediaConstraintsMock.cpp/.h.
2185
2186         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2187         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updatePausedImage): Remove a bogus assert.
2188         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentReadyState): Drive-by fix: a stream
2189           that is receiving media data is as ready as it will ever be so it's readyState should be
2190           at HAVE_ENOUGH_DATA.
2191
2192         Simplify CaptureDeviceManager by removing all code for constraint validation because some
2193         constraints can't be validated without a live capture device. Ports that are able to resolve
2194         constraints without creating a live source can do so in a derived capture device class.
2195         * platform/mediastream/CaptureDeviceManager.cpp:
2196         (CaptureDeviceManager::bestSourcesForTypeAndConstraints): Return a list of UIDs, not a list
2197           of live sources, because that is all the caller will use. This will allows ports to avoid
2198           source creation in some cases.
2199         (CaptureDeviceManager::sourceWithUID): Add parameters for new source constraints and invalid
2200           constraint.
2201         (CaptureDeviceManager::verifyConstraintsForMediaType): Deleted.
2202         (CaptureDeviceManager::bestDeviceForFacingMode): Deleted.
2203         (facingModeFromString): Deleted.
2204         (CaptureDeviceManager::sessionSupportsConstraint): Deleted.
2205         (CaptureDeviceManager::isSupportedFrameRate): Deleted.
2206         * platform/mediastream/CaptureDeviceManager.h:
2207         (WebCore::CaptureDeviceManager::defaultCaptureSession): Deleted.
2208
2209         * platform/mediastream/MediaConstraints.cpp:
2210         (WebCore::FlattenedConstraint::find): New, make it possible to examine resolved constraints.
2211         * platform/mediastream/MediaConstraints.h:
2212         (WebCore::NumericConstraint::fitnessDistance): Reject invalid constraints.
2213         (WebCore::NumericConstraint::valueForCapabilityRange): New, resolve a constraint for a 
2214           capability range.
2215         (WebCore::MediaTrackConstraintSetMap::width): Expose constraints held in the map.
2216         (WebCore::MediaTrackConstraintSetMap::height):
2217         (WebCore::MediaTrackConstraintSetMap::sampleRate):
2218         (WebCore::MediaTrackConstraintSetMap::sampleSize):
2219         (WebCore::MediaTrackConstraintSetMap::aspectRatio):
2220         (WebCore::MediaTrackConstraintSetMap::frameRate):
2221         (WebCore::MediaTrackConstraintSetMap::volume):
2222         (WebCore::MediaTrackConstraintSetMap::echoCancellation):
2223         (WebCore::MediaTrackConstraintSetMap::facingMode):
2224         (WebCore::MediaTrackConstraintSetMap::deviceId):
2225         (WebCore::MediaTrackConstraintSetMap::groupId):
2226
2227         Resolve and apply width, height, and frameRate all at once because the ability to support
2228         one may depend on the value of another.
2229         * platform/mediastream/RealtimeMediaSource.cpp:
2230         (WebCore::RealtimeMediaSource::supportsSizeAndFrameRate): 
2231         (WebCore::applyNumericConstraint): Move the guts of the logic into valueForCapabilityRange.
2232         (WebCore::RealtimeMediaSource::applySizeAndFrameRate):
2233         (WebCore::RealtimeMediaSource::selectSettings):
2234         (WebCore::RealtimeMediaSource::supportsConstraints):
2235         (WebCore::RealtimeMediaSource::applyConstraints): Support null success/failure lambdas.
2236         * platform/mediastream/RealtimeMediaSource.h:
2237
2238         * platform/mediastream/RealtimeMediaSourceCenter.h:
2239         * platform/mediastream/mac/AVAudioCaptureSource.h:
2240         * platform/mediastream/mac/AVAudioCaptureSource.mm:
2241         (WebCore::AVAudioCaptureSource::create): Add parameter for creation constraints.
2242         (WebCore::AVAudioCaptureSource::AVAudioCaptureSource): Ditto.
2243
2244         Remove all constraint validation code, it is done by the audio and video capture sources. Add
2245         support for stream creation constraints.
2246         * platform/mediastream/mac/AVCaptureDeviceManager.h:
2247         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
2248         (WebCore::AVCaptureDeviceManager::captureDeviceList):
2249         (WebCore::AVCaptureDeviceManager::createMediaSourceForCaptureDeviceWithConstraints):
2250         (WebCore::AVCaptureDeviceManager::bestSourcesForTypeAndConstraints): Deleted.
2251         (WebCore::AVCaptureDeviceManager::sourceWithUID): Deleted.
2252         (WebCore::AVCaptureDeviceManager::verifyConstraintsForMediaType): Deleted.
2253         (WebCore::AVCaptureDeviceManager::defaultCaptureSession): Deleted.
2254         (WebCore::AVCaptureDeviceManager::sessionSupportsConstraint): Deleted.
2255         (WebCore::AVCaptureDeviceManager::isSupportedFrameRate): Deleted.
2256         (WebCore::AVCaptureDeviceManager::supportedConstraints): Deleted.
2257
2258         * platform/mediastream/mac/AVMediaCaptureSource.h:
2259         (WebCore::AVMediaCaptureSource::constraints): Deleted.
2260         * platform/mediastream/mac/AVMediaCaptureSource.mm:
2261         (WebCore::AVMediaCaptureSource::AVMediaCaptureSource):
2262         (WebCore::AVMediaCaptureSource::~AVMediaCaptureSource):
2263         (WebCore::AVMediaCaptureSource::startProducingData):
2264         (WebCore::AVMediaCaptureSource::stopProducingData):
2265         (WebCore::AVMediaCaptureSource::beginConfiguration):
2266         (WebCore::AVMediaCaptureSource::commitConfiguration):
2267         (WebCore::AVMediaCaptureSource::capabilities):
2268         (WebCore::AVMediaCaptureSource::setupSession):
2269         (WebCore::AVMediaCaptureSource::reset):
2270
2271         Validate and apply constraints, support source creation constraints, initialize capabilities
2272         and supported constraints by examining device capabilities.
2273         * platform/mediastream/mac/AVVideoCaptureSource.h:
2274         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2275         (WebCore::AVVideoCaptureSource::create):
2276         (WebCore::AVVideoCaptureSource::AVVideoCaptureSource):
2277         (WebCore::updateSizeMinMax):
2278         (WebCore::updateAspectRatioMinMax):
2279         (WebCore::AVVideoCaptureSource::initializeCapabilities):
2280         (WebCore::AVVideoCaptureSource::initializeSupportedConstraints):
2281         (WebCore::AVVideoCaptureSource::applySize):
2282         (WebCore::AVVideoCaptureSource::setPreset):
2283         (WebCore::AVVideoCaptureSource::applyFrameRate):
2284         (WebCore::AVVideoCaptureSource::applySizeAndFrameRate):
2285         (WebCore::AVVideoCaptureSource::setupCaptureSession):
2286         (WebCore::AVVideoCaptureSource::currentFrameCGImage):
2287         (WebCore::AVVideoCaptureSource::bestSessionPresetForVideoDimensions):
2288         (WebCore::AVVideoCaptureSource::supportsSizeAndFrameRate):
2289
2290         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
2291         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
2292         (WebCore::MockRealtimeVideoSource::create): Apply creation constraints, return null if they
2293           can not be applied successfully.
2294         (WebCore::MockRealtimeVideoSourceMac::MockRealtimeVideoSourceMac):
2295         (WebCore::MockRealtimeVideoSource::createMuted):
2296
2297         Update RealtimeMediaSourceCenters for API changes.
2298         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
2299         (WebCore::RealtimeMediaSourceCenterMac::validateRequestConstraints):
2300         (WebCore::RealtimeMediaSourceCenterMac::createMediaStream):
2301         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
2302         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
2303         (WebCore::RealtimeMediaSourceCenterOwr::validateRequestConstraints):
2304         (WebCore::RealtimeMediaSourceCenterOwr::createMediaStream):
2305         (WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable):
2306         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h:
2307
2308         Mock media sources support constraint validation and application directly so "mock constraints"
2309         are no longer necessary.
2310         * platform/mock/MediaConstraintsMock.cpp: Removed.
2311         * platform/mock/MediaConstraintsMock.h: Removed.
2312         * platform/mock/MockRealtimeAudioSource.cpp:
2313         (WebCore::MockRealtimeAudioSource::create):
2314         (WebCore::MockRealtimeAudioSource::createMuted):
2315         (WebCore::MockRealtimeAudioSource::updateSettings):
2316         (WebCore::MockRealtimeAudioSource::initializeCapabilities):
2317         (WebCore::MockRealtimeAudioSource::initializeSupportedConstraints):
2318         * platform/mock/MockRealtimeAudioSource.h:
2319         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
2320         (WebCore::MockRealtimeMediaSourceCenter::validateRequestConstraints):
2321         (WebCore::MockRealtimeMediaSourceCenter::createMediaStream):
2322         * platform/mock/MockRealtimeMediaSourceCenter.h:
2323         * platform/mock/MockRealtimeVideoSource.cpp:
2324         (WebCore::MockRealtimeVideoSource::create):
2325         (WebCore::MockRealtimeVideoSource::createMuted):
2326         * platform/mock/MockRealtimeVideoSource.h:
2327         * platform/mock/RTCPeerConnectionHandlerMock.cpp:
2328
2329 2016-11-10  Alex Christensen  <achristensen@webkit.org>
2330
2331         Move SecurityOrigin::databaseIdentifier() to SecurityOriginData
2332         https://bugs.webkit.org/show_bug.cgi?id=164573
2333
2334         Reviewed by Brady Eidson.
2335
2336         No change in behavior.
2337
2338         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
2339         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory):
2340         * Modules/indexeddb/IDBDatabaseIdentifier.cpp:
2341         (WebCore::IDBDatabaseIdentifier::databaseDirectoryRelativeToRoot):
2342         * Modules/indexeddb/server/IDBServer.cpp:
2343         (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesForOrigins):
2344         * Modules/webdatabase/DatabaseTracker.cpp:
2345         (WebCore::DatabaseTracker::hasEntryForOriginNoLock):
2346         (WebCore::DatabaseTracker::hasEntryForDatabase):
2347         (WebCore::DatabaseTracker::originPath):
2348         (WebCore::DatabaseTracker::fullPathForDatabaseNoLock):
2349         (WebCore::DatabaseTracker::databaseNamesForOriginNoLock):
2350         (WebCore::DatabaseTracker::detailsForNameAndOrigin):
2351         (WebCore::DatabaseTracker::setDatabaseDetails):
2352         (WebCore::DatabaseTracker::originLockFor):
2353         (WebCore::DatabaseTracker::deleteOriginLockFor):
2354         (WebCore::DatabaseTracker::quotaForOriginNoLock):
2355         (WebCore::DatabaseTracker::setQuota):
2356         (WebCore::DatabaseTracker::addDatabase):
2357         (WebCore::DatabaseTracker::deleteOrigin):
2358         (WebCore::DatabaseTracker::deleteDatabase):
2359         (WebCore::DatabaseTracker::removeDeletedOpenedDatabases):
2360         * Modules/webdatabase/SQLTransactionCoordinator.cpp:
2361         (WebCore::getDatabaseIdentifier):
2362         * dom/Document.cpp:
2363         (WebCore::Document::origin):
2364         * html/HTMLMediaElement.cpp:
2365         (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory):
2366         * loader/appcache/ApplicationCacheStorage.cpp:
2367         (WebCore::ApplicationCacheStorage::calculateQuotaForOrigin):
2368         (WebCore::ApplicationCacheStorage::calculateUsageForOrigin):
2369         (WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache):
2370         (WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin):
2371         (WebCore::ApplicationCacheStorage::store):
2372         (WebCore::ApplicationCacheStorage::ensureOriginRecord):
2373         * page/SecurityOrigin.cpp:
2374         (WebCore::SecurityOrigin::databaseIdentifier): Deleted.
2375         * page/SecurityOrigin.h:
2376         * page/SecurityOriginData.cpp:
2377         (WebCore::SecurityOriginData::databaseIdentifier):
2378         * page/SecurityOriginData.h:
2379
2380 2016-11-10  Zalan Bujtas  <zalan@apple.com>
2381
2382         RenderElement::invalidateFlowThreadContainingBlockIncludingDescendants should be on RenderBlock.
2383         https://bugs.webkit.org/show_bug.cgi?id=164601
2384
2385         Reviewed by Simon Fraser.
2386
2387         FlowThread containing blocks are cached at RenderBlocks. It makes no sense to call the invalidate function on a RenderElement.
2388         Move invalidateFlowThreadContainingBlockIncludingDescendants to RenderBlock.
2389
2390         No change in functionality.
2391
2392         * rendering/RenderBlock.cpp:
2393         (WebCore::RenderBlock::invalidateFlowThreadContainingBlockIncludingDescendants):
2394         * rendering/RenderBlock.h:
2395         * rendering/RenderElement.cpp:
2396         (WebCore::RenderElement::invalidateFlowThreadContainingBlockIncludingDescendants): Deleted.
2397         * rendering/RenderElement.h:
2398         * rendering/RenderInline.cpp:
2399         (WebCore::RenderInline::splitInlines):
2400
2401 2016-11-10  Brent Fulgham  <bfulgham@apple.com>
2402
2403         Local file restrictions should not block sessionStorage access.
2404         https://bugs.webkit.org/show_bug.cgi?id=155609
2405         <rdar://problem/25229461> 
2406
2407         Reviewed by Andy Estes.
2408
2409         Re-landing this fix that was lost when the localStorage change was rolled out.
2410
2411         Use of 'sessionStorage' is governed by SecurityOrigin with third party access
2412         set to 'ShouldAllowFromThirdParty::AlwaysAllowFromThirdParty'. We should not
2413         reject local files for this combination of arguments.
2414
2415         Tested by storage/domstorage/sessionstorage/blocked-file-access.html.
2416
2417         * page/SecurityOrigin.cpp:
2418         (WebCore::SecurityOrigin::canAccessStorage): For the case of sessionStorage,
2419         allow local file access.
2420
2421 2016-11-10  Daniel Bates  <dabates@apple.com>
2422
2423         REGRESSION (r195004): Scripts and plugins blocked for subsequent loads in same WebContent
2424         process after receiving HTTP 0.9 response
2425         https://bugs.webkit.org/show_bug.cgi?id=164387
2426         <rdar://problem/28987537>
2427
2428         Reviewed by Brent Fulgham.
2429
2430         Fixes an issue where the HTTP 0.9 sandbox persisted across subsequent loads in the same
2431         WebContent process.
2432
2433         Currently when an HTTP 0.9 response is received for a request made to a default port
2434         (e.g. 80) we apply a sandbox policy on the FrameLoader for the main resource that
2435         disallows scripts and plugins. A FrameLoader may be re-used for navigations. Therefore,
2436         the sandbox policy applied to one site may be applied to another site. Moreover the
2437         sandbox policy was applied to the FrameLoader of the main resource regardless of whether
2438         the HTTP response was for a subresource. Instead we should apply the sandbox on a per-
2439         Document basis and only if we receive an HTTP 0.9 response for the document when the
2440         corresponding HTTP request was made to a default port.
2441
2442         As a side benefit of this change, we emit exactly one console message to Web Inspector
2443         when the HTTP 0.9 sandbox is applied to a document as opposed to three console messages.
2444         Moreover, we only emit this console message when the document load is not blocked.
2445
2446         Test: http/tests/security/http-0.9/sandbox-should-not-persist-on-navigation.html
2447
2448         * dom/Document.cpp:
2449         (WebCore::Document::initSecurityContext): Disallow scripts and plugins if an HTTP 0.9
2450         response was received for this document. Note that if this function is called for a
2451         document associated with an HTTP 0.9 response then the corresponding HTTP request was
2452         made to a default port. DocumentLoader::responseReceived() blocks the load for a document
2453         with an HTTP 0.9 response corresponding to an HTTP request made to a non-default port.
2454         This invariant is covered by the tests LayoutTests/http/tests/security/http-0.9/default-port-{plugin, script}-blocked.html.
2455         (WebCore::Document::shouldEnforceHTTP0_9Sandbox): Added. Returns whether an HTTP 0.9 response
2456         was received for this document.
2457         * dom/Document.h:
2458         * loader/DocumentLoader.cpp:
2459         (WebCore::DocumentLoader::responseReceived): Remove logic to apply sandbox policy to the
2460         FrameLoader associated with the main resource. We will apply the sandbox during initialization
2461         of the document.
2462         * loader/ResourceLoader.cpp:
2463         (WebCore::ResourceLoader::didReceiveResponse): Ditto.
2464         * loader/SubresourceLoader.cpp:
2465         (WebCore::SubresourceLoader::didReceiveResponse): Ditto.
2466
2467 2016-11-04  Jiewen Tan  <jiewen_tan@apple.com>
2468
2469         Update SubtleCrypto::importKey to match the latest spec
2470         https://bugs.webkit.org/show_bug.cgi?id=164446
2471         <rdar://problem/29123621>
2472
2473         Reviewed by Brent Fulgham.
2474
2475         This patch does following few things:
2476         1. It updates the SubtleCrypto::importKey method to match the latest spec:
2477            https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-importKey.
2478            It also refers to the latest Editor's Draft at a certain degree:
2479            https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-importKey.
2480         2. It implements importKey operations of following algorithms: AES-CBC, AES-KW,
2481            HMAC, RSAES-PKCS1-V1_5, RSASSA-PKCS1-V1_5, and RSA-OAEP.
2482         3. It fixes some minor problems of SubtleCrypto::generateKey.
2483         4. It addes move constructors for CryptoKeyAES, CryptoKeyHMAC, CryptoKeyRSA and
2484            CryptoKeyDataRSAComponents.
2485         5. It renames HmacKeyGenParams to HmacKeyParams to serve the purpose of both
2486            HmacKeyGenParams and HmacImportParams which are essentially the same.
2487         6. It enforces the key length in bits of CryptoKeyHMAC to be multiples of 8.
2488         7. It also fixes the following bugs:
2489            https://bugs.webkit.org/show_bug.cgi?id=126033,
2490            https://bugs.webkit.org/show_bug.cgi?id=126034,
2491            https://bugs.webkit.org/show_bug.cgi?id=151308.
2492         P.S. We currently only support Raw and Jwk key format.
2493
2494         Tests: crypto/subtle/aes-cbc-import-jwk-key-length-128.html
2495                crypto/subtle/aes-cbc-import-jwk-key-length-192.html
2496                crypto/subtle/aes-cbc-import-jwk-key-length-256.html
2497                crypto/subtle/aes-cbc-import-jwk-key-minimum.html
2498                crypto/subtle/aes-cbc-import-jwk-key-non-extractable.html
2499                crypto/subtle/aes-cbc-import-raw-key-length-128.html
2500                crypto/subtle/aes-cbc-import-raw-key-length-192.html
2501                crypto/subtle/aes-cbc-import-raw-key-length-256.html
2502                crypto/subtle/aes-import-key-malformed-parameters.html
2503                crypto/subtle/aes-kw-import-jwk-key-length-128.html
2504                crypto/subtle/aes-kw-import-jwk-key-length-192.html
2505                crypto/subtle/aes-kw-import-jwk-key-length-256.html
2506                crypto/subtle/aes-kw-import-raw-key.html
2507                crypto/subtle/generate-key-malformed-parameters.html
2508                crypto/subtle/hmac-import-jwk-key-minimum.html
2509                crypto/subtle/hmac-import-jwk-key-non-extractable.html
2510                crypto/subtle/hmac-import-jwk-key-sha1.html
2511                crypto/subtle/hmac-import-jwk-key-sha224.html
2512                crypto/subtle/hmac-import-jwk-key-sha256.html
2513                crypto/subtle/hmac-import-jwk-key-sha384.html
2514                crypto/subtle/hmac-import-jwk-key-sha512.html
2515                crypto/subtle/hmac-import-malformed-parameters.html
2516                crypto/subtle/hmac-import-raw-key-customized-length.html
2517                crypto/subtle/hmac-import-raw-key.html
2518                crypto/subtle/import-key-malformed-parameters.html
2519                crypto/subtle/rsa-import-key-malformed-parameters.html
2520                crypto/subtle/rsa-oaep-import-jwk-private-key.html
2521                crypto/subtle/rsa-oaep-import-jwk-public-key-sha1.html
2522                crypto/subtle/rsa-oaep-import-jwk-public-key-sha224.html
2523                crypto/subtle/rsa-oaep-import-jwk-public-key-sha256.html
2524                crypto/subtle/rsa-oaep-import-jwk-public-key-sha384.html
2525                crypto/subtle/rsa-oaep-import-jwk-public-key-sha512.html
2526                crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-private-key.html
2527                crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-leading-zero.html
2528                crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-minimum.html
2529                crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-non-extractable.html
2530                crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key.html
2531                crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-private-key.html
2532                crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha1.html
2533                crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha224.html
2534                crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha256.html
2535                crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha384.html
2536                crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha512.html
2537                crypto/workers/subtle/aes-import-jwk-key.html
2538                crypto/workers/subtle/aes-import-raw-key.html
2539                crypto/workers/subtle/hmac-import-jwk-key.html
2540                crypto/workers/subtle/hmac-import-raw-key.html
2541                crypto/workers/subtle/rsa-import-jwk-private-key.html
2542                crypto/workers/subtle/rsa-import-jwk-public-key.html
2543
2544         * CMakeLists.txt:
2545         * DerivedSources.make:
2546         * PlatformEfl.cmake:
2547         * PlatformGTK.cmake:
2548         * PlatformMac.cmake:
2549         * WebCore.xcodeproj/project.pbxproj:
2550         * bindings/js/JSSubtleCryptoCustom.cpp:
2551         (WebCore::normalizeCryptoAlgorithmParameters):
2552         (WebCore::cryptoKeyUsageFromString):
2553         (WebCore::cryptoKeyUsagesFromJSValue):
2554         (WebCore::toKeyData):
2555         (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise):
2556         (WebCore::jsSubtleCryptoFunctionImportKeyPromise):
2557         (WebCore::JSSubtleCrypto::importKey):
2558         * crypto/CryptoAlgorithm.cpp:
2559         (WebCore::CryptoAlgorithm::importKey):
2560         * crypto/CryptoAlgorithm.h:
2561         * crypto/CryptoAlgorithmParameters.h:
2562         * crypto/JsonWebKey.h: Added.
2563         * crypto/JsonWebKey.idl: Added.
2564         * crypto/RsaOtherPrimesInfo.h: Added.
2565         * crypto/RsaOtherPrimesInfo.idl: Added.
2566         * crypto/SubtleCrypto.h:
2567         * crypto/SubtleCrypto.idl:
2568         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
2569         (WebCore::CryptoAlgorithmAES_CBC::generateKey):
2570         (WebCore::CryptoAlgorithmAES_CBC::importKey):
2571         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
2572         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
2573         (WebCore::CryptoAlgorithmAES_KW::generateKey):
2574         (WebCore::CryptoAlgorithmAES_KW::importKey):
2575         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
2576         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
2577         (WebCore::CryptoAlgorithmHMAC::generateKey):
2578         (WebCore::CryptoAlgorithmHMAC::importKey):
2579         * crypto/algorithms/CryptoAlgorithmHMAC.h:
2580         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
2581         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
2582         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
2583         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
2584         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
2585         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
2586         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
2587         (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
2588         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
2589         * crypto/keys/CryptoKeyAES.cpp:
2590         (WebCore::CryptoKeyAES::CryptoKeyAES):
2591         (WebCore::CryptoKeyAES::generate):
2592         (WebCore::CryptoKeyAES::importRaw):
2593         (WebCore::CryptoKeyAES::importJwk):
2594         * crypto/keys/CryptoKeyAES.h:
2595         * crypto/keys/CryptoKeyDataRSAComponents.cpp:
2596         (WebCore::CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents):
2597         * crypto/keys/CryptoKeyDataRSAComponents.h:
2598         * crypto/keys/CryptoKeyHMAC.cpp:
2599         (WebCore::CryptoKeyHMAC::CryptoKeyHMAC):
2600         (WebCore::CryptoKeyHMAC::generate):
2601         (WebCore::CryptoKeyHMAC::importRaw):
2602         (WebCore::CryptoKeyHMAC::importJwk):
2603         (WebCore::CryptoKeyHMAC::buildAlgorithm):
2604         * crypto/keys/CryptoKeyHMAC.h:
2605         * crypto/keys/CryptoKeyRSA.cpp: Added.
2606         (WebCore::CryptoKeyRSA::importJwk):
2607         * crypto/keys/CryptoKeyRSA.h:
2608         * crypto/parameters/CryptoAlgorithmHmacKeyParams.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmHmacKeyGenParams.h.
2609         * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h: Added.
2610         * crypto/parameters/HmacKeyParams.idl: Renamed from Source/WebCore/crypto/parameters/HmacKeyGenParams.idl.
2611         * crypto/parameters/RsaHashedImportParams.idl: Added.
2612
2613 2016-11-10  Brady Eidson  <beidson@apple.com>
2614
2615         IndexedDB 2.0: REGRESSION(r208467) Fix flaky crashes in IDB GC-related code.
2616         https://bugs.webkit.org/show_bug.cgi?id=164596
2617
2618         Reviewed by Eric Carlson.
2619
2620         No new tests (Covered by existing tests).
2621
2622         We can't just WTFMove the pointers from the deleted-IDBObject maps...
2623         We need to remove the entries, too.
2624
2625         * Modules/indexeddb/IDBObjectStore.cpp:
2626         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
2627
2628         * Modules/indexeddb/IDBTransaction.cpp:
2629         (WebCore::IDBTransaction::internalAbort):
2630
2631 2016-11-10  Youenn Fablet  <youennf@gmail.com>
2632
2633         MediaStreamTrack should use more Ref<> and less RefPtr<>
2634         https://bugs.webkit.org/show_bug.cgi?id=164560
2635
2636         Reviewed by Eric Carlson.
2637
2638         No change of behavior.
2639
2640         Make MediaStreamTrack take a Ref<>& instead of a reference.
2641         Using Ref<>&& instead of RefPtr<>&& in MediaStreamTrackPrivate.
2642         Updating constness of some methods accordingly.
2643
2644         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2645         (WebCore::MediaEndpointPeerConnection::createReceiver):
2646         * Modules/mediastream/MediaStreamTrack.cpp:
2647         (WebCore::MediaStreamTrack::create):
2648         (WebCore::MediaStreamTrack::MediaStreamTrack):
2649         (WebCore::MediaStreamTrack::clone):
2650         * Modules/mediastream/MediaStreamTrack.h:
2651         * Modules/webaudio/MediaStreamAudioSource.cpp:
2652         (WebCore::MediaStreamAudioSource::capabilities):
2653         (WebCore::MediaStreamAudioSource::settings):
2654         * Modules/webaudio/MediaStreamAudioSource.h:
2655         * platform/mediastream/MediaEndpoint.cpp:
2656         * platform/mediastream/MediaStreamPrivate.cpp:
2657         (WebCore::MediaStreamPrivate::create):
2658         * platform/mediastream/MediaStreamTrackPrivate.cpp:
2659         (WebCore::MediaStreamTrackPrivate::create):
2660         (WebCore::MediaStreamTrackPrivate::MediaStreamTrackPrivate):
2661         (WebCore::MediaStreamTrackPrivate::clone):
2662         * platform/mediastream/MediaStreamTrackPrivate.h:
2663         (WebCore::MediaStreamTrackPrivate::setMuted):
2664         (WebCore::MediaStreamTrackPrivate::source):
2665         * platform/mediastream/RealtimeMediaSource.h:
2666         * platform/mediastream/mac/AVMediaCaptureSource.h:
2667         * platform/mediastream/mac/AVMediaCaptureSource.mm:
2668         (WebCore::AVMediaCaptureSource::initializeSettings):
2669         (WebCore::AVMediaCaptureSource::settings):
2670         (WebCore::AVMediaCaptureSource::initializeCapabilities):
2671         (WebCore::AVMediaCaptureSource::capabilities):
2672         * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h:
2673         (WebCore::RealtimeMediaSourceOwr::capabilities):
2674         (WebCore::RealtimeMediaSourceOwr::settings):
2675         * platform/mock/MockRealtimeMediaSource.cpp:
2676         (WebCore::MockRealtimeMediaSource::initializeCapabilities):
2677         (WebCore::MockRealtimeMediaSource::capabilities):
2678         (WebCore::MockRealtimeMediaSource::initializeSettings):
2679         (WebCore::MockRealtimeMediaSource::settings):
2680         * platform/mock/MockRealtimeMediaSource.h:
2681
2682 2016-11-10  Per Arne Vollan  <pvollan@apple.com>
2683
2684         [Win32] Crash in layout tests.
2685         https://bugs.webkit.org/show_bug.cgi?id=164411
2686
2687         Reviewed by Mark Lam.
2688
2689         Use the calling convention expected by the callers of the generated functions.
2690
2691         * bindings/scripts/CodeGeneratorJS.pm:
2692         (GenerateImplementation):
2693         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
2694         (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetAttribute):
2695         (WebCore::unsafeJsTestDOMJITPrototypeFunctionItem):
2696         (WebCore::unsafeJsTestDOMJITPrototypeFunctionHasAttribute):
2697         (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetElementById):
2698         (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetElementsByName):
2699
2700 2016-11-10  Aaron Chu  <aaron_chu@apple.com>
2701
2702         Web Inspector: AXI: clarify button roles (e.g. toggle or popup button)
2703         https://bugs.webkit.org/show_bug.cgi?id=130726
2704         <rdar://problem/16420420>
2705
2706         Reviewed by Brian Burg.
2707
2708         Test: accessibility/ax-differentiate-button-types.html
2709
2710         Added special case logic to make sure PopUpButtonRole and ToggleButtonRole to user ButtonRole as role.
2711         Added an "isPopUpButton" property to be exposed to the Inspector's use.
2712
2713         * accessibility/AccessibilityObject.cpp:
2714         (WebCore::AccessibilityObject::computedRoleString):
2715         * inspector/InspectorDOMAgent.cpp:
2716         (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
2717
2718 2016-11-10  Zan Dobersek  <zdobersek@igalia.com>
2719
2720         [EME] Add no-op Web-facing APIs
2721         https://bugs.webkit.org/show_bug.cgi?id=164028
2722
2723         Reviewed by Jer Noble.
2724
2725         Add no-op implementation of the Web-facing APIs as defined in
2726         the EME specification. This will be the basis for implementing
2727         the various algorithms the same specification defines, and for
2728         implementing the relevant platform abstractions.
2729
2730         Dictionaries and enumerations defined by the specification are
2731         defined in separate headers, and not in the implementation files
2732         for the class where they are used. This will ease their use
2733         across different implementation files.
2734
2735         BufferSource now exposes the Variant object it holds. This is
2736         needed to support the iterable property on the MediaKeyStatusMap
2737         class.
2738
2739         CodeGeneratorJS is fixed to support JS-to-native conversion of
2740         sequences of dictionaries.
2741
2742         * CMakeLists.txt:
2743         * DerivedSources.cpp:
2744         * DerivedSources.make:
2745         * Modules/encryptedmedia/MediaKeyMessageEvent.cpp: Added.
2746         (WebCore::MediaKeyMessageEvent::MediaKeyMessageEvent):
2747         (WebCore::MediaKeyMessageEvent::eventInterface):
2748         * Modules/encryptedmedia/MediaKeyMessageEvent.h: Added.
2749         * Modules/encryptedmedia/MediaKeyMessageEvent.idl: Added.
2750         * Modules/encryptedmedia/MediaKeyMessageEventInit.h: Added.
2751         (WebCore::MediaKeyMessageEventInit::MediaKeyMessageEventInit):
2752         * Modules/encryptedmedia/MediaKeyMessageType.h: Added.
2753         * Modules/encryptedmedia/MediaKeySession.cpp: Added.
2754         (WebCore::MediaKeySession::create):
2755         (WebCore::MediaKeySession::MediaKeySession):
2756         (WebCore::MediaKeySession::sessionId):
2757         (WebCore::MediaKeySession::expiration):
2758         (WebCore::MediaKeySession::keyStatuses):
2759         (WebCore::MediaKeySession::generateRequest):
2760         (WebCore::MediaKeySession::load):
2761         (WebCore::MediaKeySession::update):
2762         (WebCore::MediaKeySession::close):
2763         (WebCore::MediaKeySession::remove):
2764         (WebCore::MediaKeySession::hasPendingActivity):
2765         (WebCore::MediaKeySession::activeDOMObjectName):
2766         (WebCore::MediaKeySession::canSuspendForDocumentSuspension):
2767         (WebCore::MediaKeySession::stop):
2768         * Modules/encryptedmedia/MediaKeySession.h: Added.
2769         * Modules/encryptedmedia/MediaKeySession.idl: Added.
2770         * Modules/encryptedmedia/MediaKeySessionType.h: Added.
2771         * Modules/encryptedmedia/MediaKeyStatus.h: Added.
2772         * Modules/encryptedmedia/MediaKeyStatusMap.cpp: Added.
2773         (WebCore::MediaKeyStatusMap::size):
2774         (WebCore::MediaKeyStatusMap::has):
2775         (WebCore::MediaKeyStatusMap::get):
2776         (WebCore::MediaKeyStatusMap::Iterator::Iterator):
2777         (WebCore::MediaKeyStatusMap::Iterator::next):
2778         * Modules/encryptedmedia/MediaKeyStatusMap.h: Added.
2779         (WebCore::MediaKeyStatusMap::create):
2780         (WebCore::MediaKeyStatusMap::createIterator):
2781         * Modules/encryptedmedia/MediaKeyStatusMap.idl: Added.
2782         * Modules/encryptedmedia/MediaKeySystemAccess.cpp: Added.
2783         (WebCore::MediaKeySystemAccess::keySystem):
2784         (WebCore::MediaKeySystemAccess::getConfiguration):
2785         (WebCore::MediaKeySystemAccess::createMediaKeys):
2786         * Modules/encryptedmedia/MediaKeySystemAccess.h: Added.
2787         (WebCore::MediaKeySystemAccess::create):
2788         * Modules/encryptedmedia/MediaKeySystemAccess.idl: Added.
2789         * Modules/encryptedmedia/MediaKeySystemConfiguration.h: Added.
2790         * Modules/encryptedmedia/MediaKeySystemConfiguration.idl: Added.
2791         * Modules/encryptedmedia/MediaKeySystemMediaCapability.h: Added.
2792         * Modules/encryptedmedia/MediaKeySystemMediaCapability.idl: Added.
2793         * Modules/encryptedmedia/MediaKeys.cpp: Added.
2794         (WebCore::MediaKeys::createSession):
2795         (WebCore::MediaKeys::setServerCertificate):
2796         * Modules/encryptedmedia/MediaKeys.h: Added.
2797         (WebCore::MediaKeys::create):
2798         * Modules/encryptedmedia/MediaKeys.idl: Added.
2799         * Modules/encryptedmedia/MediaKeysRequirement.h: Added.
2800         * Modules/encryptedmedia/NavigatorEME.cpp: Added.
2801         (WebCore::NavigatorEME::requestMediaKeySystemAccess):
2802         * Modules/encryptedmedia/NavigatorEME.h: Added.
2803         * Modules/encryptedmedia/NavigatorEME.idl: Added.
2804         * WebCore.xcodeproj/project.pbxproj:
2805         * bindings/js/BufferSource.h:
2806         (WebCore::BufferSource::BufferSource):
2807         (WebCore::BufferSource::variant):
2808         * bindings/js/JSMediaKeySessionCustom.cpp: Added.
2809         (WebCore::JSMediaKeySession::closed):
2810         * bindings/js/JSMediaKeySystemAccessCustom.cpp: Added.
2811         (WebCore::JSMediaKeySystemAccess::getConfiguration):
2812         * bindings/scripts/CodeGeneratorJS.pm:
2813         (GetNativeVectorInnerType):
2814         * dom/EventNames.h:
2815         * dom/EventNames.in:
2816         * dom/EventTargetFactory.in:
2817         * html/HTMLMediaElement.cpp:
2818         (WebCore::HTMLMediaElement::mediaKeys):
2819         (WebCore::HTMLMediaElement::setMediaKeys):
2820         * html/HTMLMediaElement.h:
2821         * html/HTMLMediaElement.idl:
2822         * html/MediaEncryptedEvent.cpp: Added.
2823         (WebCore::MediaEncryptedEvent::MediaEncryptedEvent):
2824         (WebCore::MediaEncryptedEvent::eventInterface):
2825         (WebCore::MediaEncryptedEvent::initDataType):
2826         (WebCore::MediaEncryptedEvent::initData):
2827         * html/MediaEncryptedEvent.h: Added.
2828         * html/MediaEncryptedEvent.idl: Added.
2829         * html/MediaEncryptedEventInit.h: Added.
2830         (WebCore::MediaEncryptedEventInit::MediaEncryptedEventInit):
2831
2832 2016-11-10  Antoine Quint  <graouts@apple.com>
2833
2834         [Modern Media Controls] Media Controller: update controls based on fullscreen playback on macOS
2835         https://bugs.webkit.org/show_bug.cgi?id=164554
2836         <rdar://problem/29183439>
2837
2838         Reviewed by Dean Jackson.
2839
2840         When toggling fullscreen on macOS, toggle between MacOSInlineMediaControls and MacOSFullscreenMediaControls.
2841         To facilitate this, support objects are created and destroyed when changing the controls in order for the
2842         right control objects to be hooked up to the media controller. A new destroy() method on MediaControllerSupport
2843         subclasses can be overridden to remove event listeners added by support objects in their constructor.
2844
2845         Test: media/modern-media-controls/media-controller/media-controller-fullscreen-change.html
2846
2847         * Modules/modern-media-controls/media/fullscreen-support.js:
2848         (FullscreenSupport.prototype.destroy):
2849         * Modules/modern-media-controls/media/media-controller-support.js:
2850         (MediaControllerSupport.prototype.destroy):
2851         * Modules/modern-media-controls/media/media-controller.js:
2852         (MediaController):
2853         (MediaController.prototype.get layoutTraits):
2854         (MediaController.prototype.handleEvent):
2855         (MediaController.prototype._updateControlsIfNeeded):
2856         (MediaController.prototype._controlsClass):
2857
2858 2016-11-10  Carlos Garcia Campos  <cgarcia@igalia.com>
2859
2860         [Linux] Memory values shown by memory pressure handler logger are not useful
2861         https://bugs.webkit.org/show_bug.cgi?id=164589
2862
2863         Reviewed by Michael Catanzaro.
2864
2865         We are currently using the VmSize field from /proc/self/status which is the virtual memory size of the process
2866         and doesn't normally change even when the memory pressure handler manages to release memory. So, most of the
2867         time we see that there's no changes in memory usage in the logs.
2868         We should use the actual memory used by the process, memory that the process can release and then it's relevant
2869         for the memory pressure handler. Using other fields from /proc/self/status we could do something like VmRSS -
2870         (RssFile + RssShme), but there's also /proc/self/statm that provides the same information in a single. The main
2871         different is that statm provides both resident and shared memory directly, but in number of pages, so we need to
2872         multiply by the size of the page.
2873         This patch adds a method to parse /proc/self/statm in its given file, because I plan to use this for the linux
2874         memory sampler that is incorrectly parsing /proc/self/statm.
2875
2876         * platform/Linux.cmake: Add new files to compilation.
2877         * platform/linux/CurrentProcessMemoryStatus.cpp: Added.
2878         (WebCore::systemPageSize): Return the page size.
2879         (WebCore::currentProcessMemoryStatus): Parse /proc/self/statm and fill the given ProcessMemoryStatus.
2880         * platform/linux/CurrentProcessMemoryStatus.h: Added.
2881         * platform/linux/MemoryPressureHandlerLinux.cpp:
2882         (WebCore::MemoryPressureHandler::processMemoryUsage(): Helper function to return the memory used by the process
2883         in bytes.
2884         (WebCore::MemoryPressureHandler::ReliefLogger::platformMemoryUsage): Use processMemoryUsage().
2885
2886 2016-10-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2887
2888         MemoryPressureHandler shouldn't know how to release WebCore memory
2889         https://bugs.webkit.org/show_bug.cgi?id=160497
2890
2891         Reviewed by Michael Catanzaro.
2892
2893         All processes should set their own low memory handler, instead of leaving the web process using the default one
2894         that needs to access APIs that are not in platform layer. This patch fixes all the layering violations in the
2895         MemoryPressureHandler. Since the default implementation, that releases the WebCore memory, is shared by the
2896         WebProcess in WebKit2 and WebKit1 ports, it has been moved to its own file to the WebCore layer.
2897
2898         * CMakeLists.txt: Add new files to compilation.
2899         * PlatformMac.cmake: Ditto.
2900         * WebCore.xcodeproj/project.pbxproj: Ditto.
2901         * loader/FrameLoader.cpp:
2902         (WebCore::FrameLoader::commitProvisionalLoad): Use WebCore::jettisonExpensiveObjectsOnTopLevelNavigation().
2903         * page/MemoryRelease.cpp: Added.
2904         (WebCore::releaseNoncriticalMemory):
2905         (WebCore::releaseCriticalMemory):
2906         (WebCore::releaseMemory):
2907         (WebCore::platformReleaseMemory):
2908         (WebCore::jettisonExpensiveObjectsOnTopLevelNavigation):
2909         (WebCore::registerMemoryReleaseNotifyCallbacks):
2910         * page/MemoryRelease.h: Added.
2911         * page/cocoa/MemoryReleaseCocoa.mm: Added.
2912         (WebCore::platformReleaseMemory):
2913         (WebCore::jettisonExpensiveObjectsOnTopLevelNavigation):
2914         (WebCore::registerMemoryReleaseNotifyCallbacks):
2915         * platform/MemoryPressureHandler.cpp:
2916         (WebCore::MemoryPressureHandler::MemoryPressureHandler):
2917         (WebCore::MemoryPressureHandler::beginSimulatedMemoryPressure):
2918         (WebCore::MemoryPressureHandler::releaseMemory): Use the current handler if it has been set.
2919         (WebCore::MemoryPressureHandler::platformReleaseMemory): Deleted.
2920         * platform/MemoryPressureHandler.h:
2921         (WebCore::MemoryPressureHandler::setLowMemoryHandler):
2922         (WebCore::MemoryPressureHandler::m_releaseMemoryBlock):
2923         * platform/cocoa/MemoryPressureHandlerCocoa.mm:
2924         (WebCore::MemoryPressureHandler::respondToMemoryPressure): Call releaseMemory() instead of using the handler directly.
2925         (WebCore::MemoryPressureHandler::platformReleaseMemory): Deleted.
2926         * platform/linux/MemoryPressureHandlerLinux.cpp:
2927         * platform/win/MemoryPressureHandlerWin.cpp:
2928         (WebCore::MemoryPressureHandler::respondToMemoryPressure): Call releaseMemory() instead of using the handler directly.
2929
2930 2016-11-08  Sergio Villar Senin  <svillar@igalia.com>
2931
2932         [css-grid] Fix fr tracks sizing under min|max-size constraints
2933         https://bugs.webkit.org/show_bug.cgi?id=150674
2934
2935         Reviewed by Darin Adler.
2936
2937         The min|max-sizes must be used to compute the flex fraction for indefinite free
2938         spaces. According to the spec "If using this flex fraction would cause the grid to be
2939         smaller than the grid container’s min-width/height (or larger than the grid container’s
2940         max-width/height), then redo this step, treating the free space as definite and the
2941         available grid space as equal to the grid container’s content box size when it’s sized to
2942         its min-width/height (max-width/height)."
2943
2944         This only affects indefinite heights because during layout both definite sizes and any kind
2945         of widths are properly constrained by min|max-width restrictions.
2946
2947         Tests: fast/css-grid-layout/flex-sizing-columns-min-max-width.html
2948                fast/css-grid-layout/flex-sizing-rows-min-max-height.html
2949
2950         * rendering/RenderGrid.cpp:
2951         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
2952         (WebCore::RenderGrid::computeFlexSizedTracksGrowth):
2953         * rendering/RenderGrid.h:
2954
2955 2016-11-10  Alejandro G. Castro  <alex@igalia.com>
2956
2957         [WebRTC] [OpenWebRTC] RTX default parameters broken after r207952
2958         https://bugs.webkit.org/show_bug.cgi?id=164541
2959
2960         Reviewed by Philippe Normand.
2961
2962         Fixed typo in refactoring.
2963
2964         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
2965         (WebCore::MediaEndpointOwr::getDefaultVideoPayloads):
2966
2967 2016-11-08  Philippe Normand  <pnormand@igalia.com>
2968
2969         [WebRTC] white-list turns urls from the RTCConfiguration
2970         https://bugs.webkit.org/show_bug.cgi?id=164506
2971
2972         Reviewed by Alejandro G. Castro.
2973
2974         * Modules/mediastream/RTCConfiguration.cpp:
2975         (WebCore::validateIceServerURL): Add the turns URL scheme to the
2976         list of supported relay and signaling server protocols.
2977
2978 2016-11-09  Joseph Pecoraro  <pecoraro@apple.com>
2979
2980         Web Inspector: DebuggerManager.Event.Resumed introduces test flakiness
2981         https://bugs.webkit.org/show_bug.cgi?id=161951
2982         <rdar://problem/28295767>
2983
2984         Reviewed by Brian Burg.
2985
2986         Covered by existing tests that would ASSERT otherwise.
2987
2988         * inspector/InspectorClient.cpp:
2989         (WebCore::InspectorClient::doDispatchMessageOnFrontendPage):
2990         When paused on an exception in the inspected page and evaluating
2991         commands in the inspector frontend page (which evaluates JavaScript)
2992         we ASSERT when entering the Global DOM VM with an existing exception.
2993         This makes it so when we evaluate JavaScript in the frontend we
2994         suspend / ignore the state of the VM for the inspected page, and
2995         restore it when we return from the inspector.
2996
2997 2016-11-09  Joseph Pecoraro  <pecoraro@apple.com>
2998
2999         Web Inspector: Associate Worker Resources with the Worker and not the Page
3000         https://bugs.webkit.org/show_bug.cgi?id=164342
3001         <rdar://problem/29075775>
3002
3003         Reviewed by Timothy Hatcher.
3004
3005         Test: inspector/worker/resources-in-worker.html
3006
3007         Provide a way to associate an initiator identifier with a ResourceRequest.
3008         This will allow Web Inspector to identify who started particular resource
3009         loads. This is important to associate Worker(...), importScript(...), and
3010         XMLHttpRequest / Fetch loads with that specific Worker.
3011
3012         * platform/network/ResourceRequestBase.cpp:
3013         (WebCore::ResourceRequestBase::setAsIsolatedCopy):
3014         * platform/network/ResourceRequestBase.h:
3015         (WebCore::ResourceRequestBase::initiatorIdentifier):
3016         (WebCore::ResourceRequestBase::setInitiatorIdentifier):
3017         Optional initiator identifier. Currently used only be Web Inspector.
3018
3019         * dom/ScriptExecutionContext.h:
3020         (WebCore::ScriptExecutionContext::resourceRequestIdentifier):
3021         Non-page execution contexts, like WorkerGlobalScope, should provide
3022         a unique identifier that may be used to distinguish loads initiated
3023         from within that context.
3024
3025         * xml/XMLHttpRequest.cpp:
3026         (WebCore::XMLHttpRequest::createRequest):
3027         * Modules/fetch/FetchLoader.cpp:
3028         (WebCore::FetchLoader::start):
3029         * Modules/fetch/FetchRequest.cpp:
3030         (WebCore::FetchRequest::initializeWith):
3031         XHR / Fetch loads should include the ScriptExecutionContext's
3032         initiator identifier.
3033
3034         * workers/WorkerScriptLoader.cpp:
3035         (WebCore::WorkerScriptLoader::WorkerScriptLoader):
3036         (WebCore::WorkerScriptLoader::loadSynchronously):
3037         (WebCore::WorkerScriptLoader::loadAsynchronously):
3038         (WebCore::WorkerScriptLoader::createResourceRequest):
3039         * workers/WorkerScriptLoader.h:
3040         Provide a way to provide initiator identifier information for
3041         Worker script loads. Currently this is `new Worker(...)` and
3042         `importScripts(...)` resource loads.
3043
3044         * workers/Worker.cpp:
3045         (WebCore::Worker::Worker):
3046         (WebCore::Worker::create):
3047         * workers/Worker.h:
3048         * workers/WorkerGlobalScope.cpp:
3049         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
3050         (WebCore::WorkerGlobalScope::importScripts):
3051         * workers/WorkerGlobalScope.h:
3052         Give Worker itself the unique identifier, because `new Worker(...)`
3053         loads happen before the WorkerGlobalScript (ScriptExecutionContext)
3054         is actually created, but we want to associate it with this Worker.
3055
3056         * workers/DedicatedWorkerGlobalScope.cpp:
3057         (WebCore::DedicatedWorkerGlobalScope::create):
3058         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
3059         * workers/DedicatedWorkerGlobalScope.h:
3060         * workers/DedicatedWorkerThread.cpp:
3061         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
3062         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
3063         * workers/DedicatedWorkerThread.h:
3064         * workers/WorkerInspectorProxy.cpp:
3065         (WebCore::WorkerInspectorProxy::WorkerInspectorProxy):
3066         * workers/WorkerInspectorProxy.h:
3067         * workers/WorkerMessagingProxy.cpp:
3068         (WebCore::WorkerMessagingProxy::WorkerMessagingProxy):
3069         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
3070         * workers/WorkerThread.cpp:
3071         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
3072         (WebCore::WorkerThread::WorkerThread):
3073         (WebCore::WorkerThread::workerThread):
3074         * workers/WorkerThread.h:
3075         Pass the MainThread's Worker identifier through to the WorkerGlobalScope
3076         created on the WorkerThread. They should be the same identifier.
3077
3078         * inspector/InspectorNetworkAgent.cpp:
3079         (WebCore::InspectorNetworkAgent::willSendRequest):
3080         * inspector/InspectorPageAgent.cpp:
3081         (WebCore::InspectorPageAgent::buildObjectForFrameTree):
3082         Pass the initiator identifier data to the frontend. This identifier is
3083         equivalent to a "target identifier" in the frontend. Currently the only
3084         non-Page targets are Workers.
3085
3086         * loader/cache/CachedResourceLoader.cpp:
3087         (WebCore::CachedResourceLoader::shouldContinueAfterNotifyingLoadedFromMemoryCache):
3088         When using the memory cache we create a new resource request. Be sure
3089         to copy over useful inspector data, like the initiator identifier,
3090         from the original request.
3091
3092         * platform/network/cf/ResourceRequestCFNet.cpp:
3093         (WebCore::ResourceRequest::updateFromDelegatePreservingOldProperties):
3094         When rebuilding a ResourceRequest from NSURLRequest, copy over the
3095         initiator identifier property that wouldn't otherwise have survived
3096         the transition.
3097
3098 2016-11-09  Brady Eidson  <beidson@apple.com>
3099
3100         IndexedDB 2.0: Clean up some exception ordering.
3101         https://bugs.webkit.org/show_bug.cgi?id=164566
3102
3103         Reviewed by Alex Christensen.
3104
3105         No new tests (Covered by existing tests).
3106
3107         * Modules/indexeddb/IDBCursor.cpp:
3108         (WebCore::IDBCursor::advance):
3109         (WebCore::IDBCursor::continueFunction):
3110
3111         * Modules/indexeddb/IDBObjectStore.cpp:
3112         (WebCore::IDBObjectStore::createIndex):
3113
3114 2016-11-09  Alex Christensen  <achristensen@webkit.org>
3115
3116         Unreviewed, rolling out r208438.
3117
3118         crashes
3119
3120         Reverted changeset:
3121
3122         "[WK2][NETWORK_SESSION] Add support for downloading file
3123         backed blobs"
3124         https://bugs.webkit.org/show_bug.cgi?id=164458
3125         http://trac.webkit.org/changeset/208438
3126
3127 2016-11-09  Said Abou-Hallawa  <sabouhallawa@apple.com>
3128
3129         Change the decoding for some animated images to be asynchronous
3130         https://bugs.webkit.org/show_bug.cgi?id=161566
3131
3132         Reviewed by Simon Fraser.
3133
3134         Tests: fast/images/slower-animation-than-decoding-image.html
3135                fast/images/slower-decoding-than-animation-image.html
3136                fast/images/stopped-animation-deleted-image.html
3137                
3138         Request the next frame before firing the animation timer. The asynchronous
3139         image decoding work queue notifies the BitmapImage when the frame finishes
3140         decoding. If the timer fires before the frame is decoded, no repaint will
3141         be requested. Only when the image frame is ready, the animation will be
3142         advanced and the image will be repainted.
3143
3144         * loader/cache/CachedImage.cpp:
3145         (WebCore::CachedImage::load): Cache the image settings in CachedImage.
3146         (WebCore::CachedImage::createImage): No need to pass allowSubsampling to BitmapImage. It can be retrieved through Image::imageObserver().
3147         (WebCore::CachedImage::changedInRect): Change the parameter to notifyObservers() to be a pointer.
3148         * loader/cache/CachedImage.h: Cache the settings: allowSubsampling, allowAsyncImageDecoding and showDebugBackground through m_loader.
3149         * platform/graphics/BitmapImage.cpp:
3150         (WebCore::BitmapImage::dataChanged): Fix a logging message.
3151         (WebCore::BitmapImage::draw): Store the current SubsamplingLevel to be used when requesting decoding the image of the next frame.
3152         Draw a debug rectangle if the next frame is missed because it is being decoded and the setting showDebugBackground is on.
3153         (WebCore::BitmapImage::startAnimation): Deleted. Moved to the header file.
3154         (WebCore::BitmapImage::internalStartAnimation): Added. Request asynchronous image decoding for the next frame if required. Return the
3155         result of starting the animation.
3156         (WebCore::BitmapImage::advanceAnimation): Call internalAdvanceAnimation() if the frame image is not being decoded. If it is being decoded
3157         and the setting showDebugBackground is on, force repaint so the debug rectangle is drawn.
3158         (WebCore::BitmapImage::internalAdvanceAnimation): This is the old body of advanceAnimation().
3159         (WebCore::BitmapImage::stopAnimation): Stop the asynchronous image decoding if it is started.
3160         (WebCore::BitmapImage::newFrameNativeImageAvailableAtIndex): This function is called from the async image decoding work queue when finishing decoding a native image frame.
3161         * platform/graphics/BitmapImage.h:
3162         (WebCore::BitmapImage::startAnimation): Added. It is now calls internalStartAnimation().
3163         * platform/graphics/Color.h: Define a constant for the yellow color.
3164         * platform/graphics/ImageFrameCache.cpp:
3165         (WebCore::ImageFrameCache::clearMetadata): Delete unreferenced member.
3166         (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Return true if the frame is requested for async decoding.
3167         * platform/graphics/ImageFrameCache.h:
3168         * platform/graphics/ImageObserver.h:  Add virtual functions for allowSubsampling, allowAsyncImageDecoding and showDebugBackground.
3169         * platform/graphics/ImageSource.cpp:
3170         (WebCore::ImageSource::maximumSubsamplingLevel): Move checking allowSubsampling() to the caller BitmapImage::draw().
3171         * platform/graphics/ImageSource.h: Remove the setting allowSubsampling(); it can be retrieved from imageObserver().
3172         (WebCore::ImageSource::setAllowSubsampling): Deleted.
3173         * rendering/RenderImageResource.cpp:
3174         (WebCore::RenderImageResource::shutdown): Stop the animation of an image when shutting down the resource.
3175         * rendering/RenderImageResourceStyleImage.cpp:
3176         (WebCore::RenderImageResourceStyleImage::shutdown): Ditto.
3177         svg/graphics/SVGImageClients.h: Change the parameter to ImageObserver::changedInRect() to be a pointer.
3178         (WebCore::SVGImageChromeClient::invalidateContentsAndRootView):
3179         * testing/Internals.cpp:
3180         (WebCore::Internals::setImageFrameDecodingDuration): Sets a fixed frame decoding duration for testing.
3181         * testing/Internals.h:
3182         * testing/Internals.idl: Adds an internal option for ImageFrameDecodingDuration.
3183
3184 2016-11-04  Brent Fulgham  <bfulgham@apple.com>
3185
3186         Local HTML should be blocked from localStorage access unless "Disable Local File Restrictions" is checked
3187         https://bugs.webkit.org/show_bug.cgi?id=155185
3188         <rdar://problem/11101440>
3189
3190         Reviewed by Brady Eidson.
3191
3192         Add a new quirk for localStorage that defaults to 'on'. When active, this quirk says that
3193         localStorage access should be granted, without needing to grant universal file access.
3194
3195         If the quirk is turned off, then localStorage is blocked unless the WebKit client explicitly
3196         grants universal file access.
3197
3198         Tests: storage/domstorage/localstorage/blocked-file-access-permitted-by-quirk.html
3199                storage/domstorage/localstorage/blocked-file-access.html
3200
3201         * dom/Document.cpp:
3202         (WebCore::Document::initSecurityContext): Set localStorage quirk mode based on settings.
3203         * page/SecurityOrigin.cpp:
3204         (WebCore::SecurityOrigin::SecurityOrigin): Use more C++11 initializers.
3205         (WebCore::SecurityOrigin::canAccessStorage): If the origin is a local file, and we are NOT in
3206         localStorage quirks mode, and we have not been granted universal file access, prevent access
3207         to DOM localStorage.
3208         (WebCore::SecurityOrigin::setNeedsLocalStorageQuirk): Added.
3209         * page/SecurityOrigin.h:
3210         (WebCore::SecurityOrigin::needsLocalStorageQuirk): Added.
3211         * page/Settings.in:
3212         * workers/WorkerGlobalScope.cpp:
3213         (WebCore::WorkerGlobalScope::WorkerGlobalScope): Make sure Workers know what the
3214         localStorage quirks mode is set to.
3215
3216 2016-11-09  Alex Christensen  <achristensen@webkit.org>
3217
3218         URLParser should not consider path of URLs with no host to start at the first slash after the colon
3219         https://bugs.webkit.org/show_bug.cgi?id=164555
3220
3221         Reviewed by Tim Horton.
3222
3223         When we see a url that is only scheme:// we treated the // as the path.  Firefox did this with unrecognized schemes,
3224         but based on https://github.com/whatwg/url/issues/148 they seem willing to change.  We had added similar behavior to
3225         URL::parse, and I added this to URLParser in r206783 which this effectively reverts.
3226
3227         Covered by API and layout tests.
3228
3229         * platform/URLParser.cpp:
3230         (WebCore::URLParser::parse):
3231         Don't move m_userStart to m_pathStart back by two when we see an empty host.
3232
3233 2016-11-09  Alex Christensen  <achristensen@webkit.org>
3234
3235         Simplify logic of SecurityOrigin::databaseIdentifier
3236         https://bugs.webkit.org/show_bug.cgi?id=164565
3237
3238         Reviewed by Brady Eidson.
3239
3240         No change in behavior.
3241
3242         SecurityOrigins with the file scheme need a special database identifier to be backwards-compatible with existing storage.
3243         Instead of determining whether this is a file SecurityOrigin at parsing time and only using that information when
3244         making the database identifier, just determine whether we need this quirk when making the database identifier.
3245         I'm planning to move this logic to SecurityOriginData in another patch.
3246
3247         * page/SecurityOrigin.cpp:
3248         (WebCore::SecurityOrigin::SecurityOrigin):
3249         (WebCore::SecurityOrigin::create):
3250         (WebCore::SecurityOrigin::databaseIdentifier):
3251         * page/SecurityOrigin.h:
3252
3253 2016-11-09  Jaehun Lim  <ljaehun.lim@samsung.com>
3254
3255         Unreviewed, build fix after r208460
3256
3257         isValidColorString() was renamed isValidSimpleColorString().
3258
3259         * html/ColorInputType.cpp:
3260         (WebCore::ColorInputType::suggestions):
3261
3262 2016-11-09  Anders Carlsson  <andersca@apple.com>
3263
3264         Fix STP build.
3265
3266         * WebCorePrefix.h:
3267
3268 2016-11-09  Simon Fraser  <simon.fraser@apple.com>
3269
3270         Implement visual-viewport based position:fixed handling for Mac async scrolling
3271         https://bugs.webkit.org/show_bug.cgi?id=164495
3272
3273         Reviewed by Tim Horton.
3274
3275         Educate the scrolling tree about visual and layout viewports. This is runtime-switchable,
3276         so we push the enable flag to via the root state node, then push the layout viewport,
3277         and the min/max scroll position that contstrain it, through frame state nodes.
3278
3279         When a scroll happens, we compute a new layout viewport when the visual viewport hits
3280         an edge, and push that down through setScrollLayerPosition() since it's used to position
3281         fixed and sticky layers.
3282
3283         When the main thread gets notified about an async scroll, we set the new layout viewport
3284         on the FrameView, but do so in such a way that does not trigger layout. This is OK because
3285         we do a RenderLayer update which udpates all the layoutViewport-dependent state, and is
3286         necessary to avoid repaints every main thread update.
3287
3288         The iOS code is made to compile, but not work yet.
3289
3290         Tests: compositing/tiling/visiblerect-accumulated-offset.html
3291                fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolled-down-then-up.html
3292                fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolled-down.html
3293                fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolling-layers-state.html
3294
3295         * page/FrameView.cpp:
3296         (WebCore::FrameView::setLayoutViewportOrigin):
3297         (WebCore::FrameView::updateLayoutViewport):
3298         (WebCore::FrameView::visualViewportRect):
3299         (WebCore::FrameView::unscaledMinimumScrollPosition):
3300         (WebCore::FrameView::scrollPositionChanged):
3301         * page/FrameView.h:
3302         * page/scrolling/AsyncScrollingCoordinator.cpp:
3303         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
3304         (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
3305         (WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll):
3306         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScrollTimerFired):
3307         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
3308         (WebCore::AsyncScrollingCoordinator::visualViewportEnabled):
3309         * page/scrolling/AsyncScrollingCoordinator.h:
3310         (WebCore::AsyncScrollingCoordinator::ScheduledScrollUpdate::ScheduledScrollUpdate):
3311         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
3312         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
3313         (WebCore::ScrollingStateFrameScrollingNode::setLayoutViewport):
3314         (WebCore::ScrollingStateFrameScrollingNode::setMinLayoutViewportOrigin):
3315         (WebCore::ScrollingStateFrameScrollingNode::setMaxLayoutViewportOrigin):
3316         (WebCore::ScrollingStateFrameScrollingNode::setVisualViewportEnabled):
3317         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties):
3318         * page/scrolling/ScrollingStateFrameScrollingNode.h:
3319         * page/scrolling/ScrollingTree.cpp:
3320         (WebCore::ScrollingTree::viewportChangedViaDelegatedScrolling):
3321         (WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling):
3322         (WebCore::ScrollingTree::commitTreeState):
3323         * page/scrolling/ScrollingTree.h:
3324         (WebCore::ScrollingTree::visualViewportEnabled):
3325         (WebCore::ScrollingTree::setVisualViewportEnabled):
3326         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
3327         (WebCore::ScrollingTreeFrameScrollingNode::commitStateBeforeChildren):
3328         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition):
3329         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
3330         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewport):
3331         (WebCore::ScrollingTreeFrameScrollingNode::minLayoutViewportOrigin):
3332         (WebCore::ScrollingTreeFrameScrollingNode::maxLayoutViewportOrigin):
3333         * page/scrolling/ScrollingTreeScrollingNode.cpp:
3334         (WebCore::ScrollingTreeScrollingNode::setScrollPositionWithoutContentEdgeConstraints):
3335         * page/scrolling/ScrollingTreeScrollingNode.h:
3336         * page/scrolling/ThreadedScrollingTree.cpp:
3337         (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
3338         * page/scrolling/ThreadedScrollingTree.h:
3339         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h:
3340         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
3341         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollPositionWithoutContentEdgeConstraints):
3342         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollLayerPosition):
3343         * page/scrolling/ios/ScrollingTreeIOS.cpp:
3344         (WebCore::ScrollingTreeIOS::scrollingTreeNodeDidScroll):
3345         * page/scrolling/ios/ScrollingTreeIOS.h:
3346         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
3347         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
3348         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints):
3349         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition):
3350
3351 2016-11-09  Brady Eidson  <beidson@apple.com>
3352
3353         IndexedDB 2.0: W3C test IndexedDB/idbtransaction_objectStoreNames.html fails.
3354         https://bugs.webkit.org/show_bug.cgi?id=164528
3355
3356         Reviewed by Alex Christensen.
3357
3358         No new tests (Covered by existing test).
3359
3360         * Modules/indexeddb/IDBDatabase.cpp:
3361         (WebCore::IDBDatabase::transaction): De-dupe the input names.
3362
3363 2016-11-09  Brady Eidson  <beidson@apple.com>
3364
3365         IndexedDB 2.0: Implement new IDBCursor.continuePrimaryKey function.
3366         https://bugs.webkit.org/show_bug.cgi?id=164404
3367
3368         Reviewed by Alex Christensen.
3369
3370         Tests: storage/indexeddb/modern/idbcursor-continue-primary-key-1-private.html
3371                storage/indexeddb/modern/idbcursor-continue-primary-key-1.html
3372                Also covered by existing tests.
3373
3374         * Modules/indexeddb/IDBCursor.cpp:
3375         (WebCore::IDBCursor::continuePrimaryKey):
3376         (WebCore::IDBCursor::uncheckedIterateCursor):
3377         * Modules/indexeddb/IDBCursor.h:
3378         * Modules/indexeddb/IDBCursor.idl:
3379
3380         * Modules/indexeddb/IDBKeyData.h:
3381         (WebCore::IDBKeyData::operator>):
3382         (WebCore::IDBKeyData::operator<=):
3383         (WebCore::IDBKeyData::operator>=):
3384
3385         * Modules/indexeddb/server/MemoryCursor.h:
3386
3387         * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
3388         (WebCore::IDBServer::MemoryIDBBackingStore::iterateCursor):
3389
3390         * Modules/indexeddb/server/MemoryIndexCursor.cpp:
3391         (WebCore::IDBServer::MemoryIndexCursor::iterate):
3392         * Modules/indexeddb/server/MemoryIndexCursor.h:
3393
3394         * Modules/indexeddb/server/MemoryObjectStoreCursor.cpp:
3395         (WebCore::IDBServer::MemoryObjectStoreCursor::iterate):
3396         * Modules/indexeddb/server/MemoryObjectStoreCursor.h:
3397
3398         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
3399         (WebCore::IDBServer::SQLiteIDBBackingStore::iterateCursor):
3400
3401         * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
3402         (WebCore::IDBServer::SQLiteIDBCursor::iterate):
3403         * Modules/indexeddb/server/SQLiteIDBCursor.h:
3404
3405         * Modules/indexeddb/shared/IDBIterateCursorData.cpp:
3406         (WebCore::IDBIterateCursorData::isolatedCopy):
3407         * Modules/indexeddb/shared/IDBIterateCursorData.h:
3408         (WebCore::IDBIterateCursorData::encode):
3409         (WebCore::IDBIterateCursorData::decode):
3410
3411 2016-11-09  Antoine Quint  <graouts@apple.com>
3412
3413         [Modern Media Controls] Media Controller: set status label according to media state
3414         https://bugs.webkit.org/show_bug.cgi?id=164557
3415         <rdar://problem/29184097>
3416
3417         Reviewed by Dean Jackson.
3418
3419         Correctly set the StatusLabel text based on the media loading and network state.
3420
3421         Tests: http/tests/media/modern-media-controls/status-support/status-support-live-broadcast.html
3422                http/tests/media/modern-media-controls/status-support/status-support-loading.html
3423                media/modern-media-controls/status-support/status-support-error.html
3424
3425         * Modules/modern-media-controls/js-files:
3426         * Modules/modern-media-controls/media/media-controller.js:
3427         (MediaController):
3428         * Modules/modern-media-controls/media/status-support.js: Added.
3429         (StatusSupport.prototype.get control):
3430         (StatusSupport.prototype.get mediaEvents):
3431         (StatusSupport.prototype.syncControl):
3432         (StatusSupport):
3433         * WebCore.xcodeproj/project.pbxproj:
3434
3435 2016-11-09  Zalan Bujtas  <zalan@apple.com>
3436
3437         No need to set setFlowThreadState on RenderText in createTextRenderer.
3438         https://bugs.webkit.org/show_bug.cgi?id=164559
3439
3440         Reviewed by Antti Koivisto.
3441
3442        setFlowThreadState in create*Renderer ensures that by the time we issue the initial call to
3443        styleWillChange/styleDidChange through initializeStyle, the state is already set.
3444        However since RenderText does not have its own style, it's sufficient to have the flow state set
3445        through the normal RenderElement::insertChildInternal code path.
3446
3447         No change in functionality.
3448
3449         * style/RenderTreeUpdater.cpp:
3450         (WebCore::createTextRenderer):
3451
3452 2016-11-09  Brady Eidson  <beidson@apple.com>
3453
3454         IndexedDB 2.0: Encapsulate cursor iteration parameters for easy future expansion.
3455         https://bugs.webkit.org/show_bug.cgi?id=164504
3456
3457         Reviewed by Darin Adler.
3458
3459         No new tests (Refactor, no behavior change).
3460
3461         This patch literally just takes the "key" and "count" arguments and encapsulates them in a struct.
3462         That struct will then be easily expandable in the future (e.g. bug 164404).
3463
3464         * Modules/indexeddb/IDBCursor.cpp:
3465         (WebCore::IDBCursor::uncheckedIterateCursor):
3466         
3467         * Modules/indexeddb/IDBTransaction.cpp:
3468         (WebCore::IDBTransaction::iterateCursor):
3469         (WebCore::IDBTransaction::iterateCursorOnServer):
3470         * Modules/indexeddb/IDBTransaction.h:
3471         
3472         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
3473         (WebCore::IDBClient::IDBConnectionProxy::iterateCursor):
3474         * Modules/indexeddb/client/IDBConnectionProxy.h:
3475         
3476         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
3477         (WebCore::IDBClient::IDBConnectionToServer::iterateCursor):
3478         * Modules/indexeddb/client/IDBConnectionToServer.h:
3479         * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
3480         
3481         * Modules/indexeddb/server/IDBBackingStore.h:
3482         
3483         * Modules/indexeddb/server/IDBServer.cpp:
3484         (WebCore::IDBServer::IDBServer::iterateCursor):
3485         * Modules/indexeddb/server/IDBServer.h:
3486         
3487         * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
3488         (WebCore::IDBServer::MemoryIDBBackingStore::iterateCursor):
3489         * Modules/indexeddb/server/MemoryIDBBackingStore.h:
3490         
3491         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
3492         (WebCore::IDBServer::SQLiteIDBBackingStore::iterateCursor):
3493         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
3494         
3495         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
3496         (WebCore::IDBServer::UniqueIDBDatabase::iterateCursor):
3497         (WebCore::IDBServer::UniqueIDBDatabase::performIterateCursor):
3498         * Modules/indexeddb/server/UniqueIDBDatabase.h:
3499         
3500         * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
3501         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::iterateCursor):
3502         * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:
3503         
3504         * Modules/indexeddb/shared/IDBIterateCursorData.cpp: Added.
3505         (WebCore::IDBIterateCursorData::isolatedCopy):
3506         * Modules/indexeddb/shared/IDBIterateCursorData.h: Added.
3507         (WebCore::IDBIterateCursorData::encode):
3508         (WebCore::IDBIterateCursorData::decode):
3509
3510         * Modules/indexeddb/shared/InProcessIDBServer.cpp:
3511         (WebCore::InProcessIDBServer::iterateCursor):
3512         * Modules/indexeddb/shared/InProcessIDBServer.h:
3513
3514         * CMakeLists.txt:
3515         * WebCore.xcodeproj/project.pbxproj:
3516
3517 2016-11-09  Ryosuke Niwa  <rniwa@webkit.org>
3518
3519         StyledElement::attributeChanged shouldn't do any work when the attribute value didn't change
3520         https://bugs.webkit.org/show_bug.cgi?id=129476
3521
3522         Reviewed by Andreas Kling.
3523
3524         Avoid calling styleAttributeChanged and setPresentationAttributeStyleIsDirty
3525         when the attribute value didn't change as in r164856.
3526
3527         * dom/StyledElement.cpp:
3528         (WebCore::StyledElement::attributeChanged):
3529
3530 2016-11-09  Yusuke Suzuki  <utatane.tea@gmail.com>
3531
3532         [DOMJIT] Implement Node::ownerDocument
3533         https://bugs.webkit.org/show_bug.cgi?id=164004
3534
3535         Reviewed by Darin Adler.
3536
3537         Test: js/dom/domjit-accessor-owner-document.html
3538
3539         Still I cannot reproduce this crash in x64 environment, according to the crash log, it accesses 0x8 address.
3540         This can happen if document() accidentally returns nullptr. In the C++ ownerDocument implementation,
3541         if document() returns nullptr, it just returns nullptr. But in the DOMJIT implementation, we assume that
3542         document() won't return nullptr and access the member of it.
3543
3544         This patch aligns the DOMJIT implementation strictly to the C++ one.
3545
3546         * dom/Node.idl:
3547         * domjit/JSNodeDOMJIT.cpp:
3548         (WebCore::NodeOwnerDocumentDOMJIT::checkDOM):
3549         (WebCore::NodeOwnerDocumentDOMJIT::callDOMGetter):
3550
3551 2016-11-09  Sam Weinig  <sam@webkit.org>
3552
3553         [SVG] Start moving special casing of SVG out of the bindings - SVGAngle
3554         https://bugs.webkit.org/show_bug.cgi?id=164496
3555
3556         Reviewed by Darin Adler.
3557
3558         There is quite a bit of special casing of SVG types in the bindings that adds
3559         a lot of complexity and is relatively fragile, as it is based on type naming.
3560
3561         Instead of keeping the complexity in the bindings, I am going to move it into
3562         the implementation, where it has also longed to be. 
3563
3564         Starting small, with just SVGAngle. It has been split in two, with the existing
3565         SVGAngle being renamed SVGAngleValue, and the bound instance, which used to be name
3566         SVGPropertyTearOff<SVGAngle>, taking the name SVGAngle (and inheriting from 
3567         SVGPropertyTearOff<SVGAngleValue>).
3568
3569         * CMakeLists.txt:
3570         * WebCore.xcodeproj/project.pbxproj:
3571         Add SVGAngleValue.cpp
3572
3573         * bindings/scripts/CodeGenerator.pm:
3574         Remove SVGAngle as a special case.
3575
3576         * svg/SVGAngle.cpp: Removed.
3577         * svg/SVGAngle.h:
3578         Added. Implements the SVGAngle interface explicitly, getting to
3579         the SVGAngleValue through propertyReference().
3580
3581         * svg/SVGAngle.idl:
3582         * svg/SVGAngleValue.cpp: Copied from Source/WebCore/svg/SVGAngle.cpp.
3583         * svg/SVGAngleValue.h: Copied from Source/WebCore/svg/SVGAngle.h.
3584         Move old SVGAngle implementation to SVGAngleValue.
3585
3586         * svg/SVGAnimatedAngle.cpp:
3587         Replace SVGAngle usage with SVGAngleValue.
3588
3589         * svg/SVGAnimatedAngle.h:
3590         Switch SVGAnimatedAngle to be a type alias. This remains SVGAnimatedPropertyTearOff<SVGAngle>
3591         as SVGAnimatedPropertyTearOff has been changed to take the TearOff type as its parameter.
3592
3593         * svg/SVGAnimatedLength.h:
3594         * svg/SVGAnimatedPreserveAspectRatio.h:
3595         * svg/SVGAnimatedRect.h:
3596         Switch to using type aliases and pass the TearOff to SVGAnimatedPropertyTearOff.
3597
3598         * svg/SVGAnimatedType.cpp:
3599         (WebCore::SVGAnimatedType::createAngleAndEnumeration):
3600         * svg/SVGAnimatedType.h:
3601         (WebCore::SVGAnimatedType::angleAndEnumeration):
3602         Use SVGAngleValue.
3603
3604         * svg/SVGComponentTransferFunctionElement.h:
3605         Add missing include of SVGElement.h (need because it removed from SVGPropertyTearOff).
3606
3607         * svg/SVGMarkerElement.cpp:
3608         (WebCore::SVGMarkerElement::parseAttribute):
3609         (WebCore::SVGMarkerElement::setOrient):
3610         Switch to take an SVGAngleValue.
3611
3612         (WebCore::SVGMarkerElement::setOrientToAngle):
3613         Update to pull the value out via propertyReference().
3614
3615         * svg/SVGMarkerElement.h:
3616         Switch to take an SVGAngleValue.
3617
3618         * svg/SVGLengthList.h:
3619         * svg/SVGNumberList.h:
3620         * svg/SVGPathSegList.h:
3621         * svg/SVGPointList.h:
3622         * svg/SVGStringList.h:
3623         * svg/SVGTransformList.h:
3624         Switch to using type aliases in SVGPropertyTraits and add an alias for
3625         ListItemTearOff.
3626
3627         * svg/SVGSVGElement.cpp:
3628         (WebCore::SVGSVGElement::createSVGAngle):
3629         * svg/SVGSVGElement.h:
3630         Change createSVGAngle to return a Ref<SVGAngle> and create one.
3631
3632         * svg/SVGSVGElement.idl:
3633         Annotate IDL to indicate that a new value is being returned.
3634
3635         * svg/SVGTransform.cpp:
3636         Remove unnecessary include of SVGAngle.h.
3637
3638         * svg/SVGViewSpec.cpp:
3639         Add missing include of SVGElement.h (need because it removed from SVGPropertyTearOff).
3640
3641         * svg/properties/SVGAnimatedPropertyTearOff.h:
3642         Change to be parameterized on the TearOffType, rather than the PropertyType itself. Get the
3643         Property type from the TearOffType.
3644
3645         * svg/properties/SVGListProperty.h:
3646         * svg/properties/SVGListPropertyTearOff.h:
3647         Fix assumption that all TearOffTypes are just a SVGPropertyTearOff templatized on a property
3648         type. This is no longer true for SVGAngle. Instead, get the TearOffType for lists via SVGPropertyTraits.
3649
3650         * svg/properties/SVGPropertyTearOff.h:
3651         Make the PropertyType available by exposing it as a type alias.
3652
3653 2016-11-09  Darin Adler  <darin@apple.com>
3654
3655         Move Range from ExceptionCode to ExceptionOr
3656         https://bugs.webkit.org/show_bug.cgi?id=164457
3657
3658         Reviewed by Alex Christensen.
3659
3660         * accessibility/AXObjectCache.cpp:
3661         (WebCore::AXObjectCache::rangeForNodeContents): Update to use ExceptionOr,
3662         keeping behavior the same.
3663         (WebCore::characterOffsetsInOrder): Ditto.
3664         (WebCore::setRangeStartOrEndWithCharacterOffset): Changed argument to a
3665         reference instead of a pointer. Use a boolean return value to indicate
3666         success rather than an exception, since the callers don't need to know
3667         which exception it is.
3668         (WebCore::AXObjectCache::rangeForUnorderedCharacterOffsets): Updated for
3669         the above.
3670         (WebCore::AXObjectCache::nextBoundary): Ditto.
3671         (WebCore::AXObjectCache::previousBoundary): Ditto.
3672
3673         * accessibility/AccessibilityObject.cpp:
3674         (WebCore::AccessibilityObject::rangeOfStringClosestToRangeInDirection):
3675         Update to use ExceptionOr, keeping behavior the same.
3676         * accessibility/AccessibilityRenderObject.cpp:
3677         (WebCore::AccessibilityRenderObject::documentBasedSelectedTextRange): Ditto.
3678         * accessibility/atk/WebKitAccessibleUtil.cpp:
3679         (selectionBelongsToObject): Ditto.
3680         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
3681         (-[WebAccessibilityObjectWrapper _convertToNSRange:]): Ditto.
3682         * dom/Node.cpp:
3683         (WebCore::Node::textRects): Ditto.
3684
3685         * dom/Range.cpp:
3686         (WebCore::Range::~Range): Remove old comment that no longer makes sense now
3687         that the detach function no longer does anything.
3688         (WebCore::checkForDifferentRootContainer): Updated to use ExceptionOr,
3689         keeping behavior the same.
3690         (WebCore::Range::setStart): Ditto.
3691         (WebCore::Range::setEnd): Ditto.
3692         (WebCore::Range::isPointInRange): Ditto.
3693         (WebCore::Range::comparePoint): Ditto.
3694         (WebCore::Range::compareNode): Ditto.
3695         (WebCore::top): Added helper function so that compareBoundaryPoints doesn't
3696         need to have two identical loops in it.
3697         (WebCore::Range::compareBoundaryPoints): Updated to use ExceptionOr,
3698         keeping behavior the same.
3699         (WebCore::Range::compareBoundaryPointsForBindings): Ditto. Also use a switch
3700         instead of relying on the order of the values to check for unsupported values.
3701         (WebCore::Range::boundaryPointsValid): Ditto.
3702         (WebCore::Range::deleteContents): Ditto.
3703         (WebCore::Range::intersectsNode): Ditto.
3704         (WebCore::Range::processContents): Ditto.
3705         (WebCore::deleteCharacterData): Ditto.
3706         (WebCore::processContentsBetweenOffsets): Ditto. Also changed to be a
3707         non-member function and private to this file instead of in the class.
3708         (WebCore::processNodes): Ditto. Also changed one argument to be a RefPtr
3709         since the code relies on using it after mutating the DOM.
3710         (WebCore::processAncestorsAndTheirSiblings): Ditto. Changed one argument type
3711         to use ExceptionOr so the caller doesn't have to check the exception first.
3712         (WebCore::Range::extractContents): Ditto.
3713         (WebCore::Range::cloneContents): Ditto.
3714         (WebCore::Range::insertNode): Ditto. Also fixed to only call nodeType once
3715         instead of three times.
3716         (WebCore::Range::toString): Ditto. Also fixed to call nodeType only once
3717         per node instead of twice, to use downcast instead of static_cast, and to
3718         use the word "node" instead of "n" for the local variable name.
3719         (WebCore::Range::createContextualFragment): Ditto.
3720         (WebCore::Range::checkNodeWOffset): Ditto.
3721         (WebCore::Range::setStartAfter): Ditto.
3722         (WebCore::Range::setEndBefore): Ditto.
3723         (WebCore::Range::setEndAfter): Ditto.
3724         (WebCore::Range::selectNode): Ditto.
3725         (WebCore::Range::selectNodeContents): Ditto.
3726         (WebCore::Range::surroundContents): Ditto.
3727         (WebCore::Range::setStartBefore): Ditto.
3728         (WebCore::Range::contains): Ditto. Except added code to handle exception
3729         case to return false without asserting because I saw at least one crash
3730         that seemed to imply this behavior was needed.
3731         (WebCore::rangesOverlap): Ditto.
3732         (WebCore::rangeOfContents): Ditto.
3733         (WebCore::Range::expand): Ditto.
3734         (WebCore::Range::getClientRects): Ditto.
3735         (WebCore::Range::getBoundingClientRect): Ditto.
3736         (WebCore::Range::borderAndTextQuads): Changed to use return value
3737         instead of out argument, since it's a private function used only
3738         within this class so it was easy to update all call sites.
3739         (WebCore::Range::boundingRect): Updated for above. Also renamed since
3740         there was no need for the name "internal" in this.
3741         (WebCore::Range::absoluteBoundingRect): Ditto.
3742         * dom/Range.h: Updated for above.
3743         * dom/Range.idl: Use non-legacy exceptions. Also changed the default value
3744         of the string argument to the expand function to the empty string rather
3745         than "undefined", because the function silently does nothing when passed
3746         any unrecognized string, and so this leaves behavior unchanged. I removed
3747         the comment saying that the "undefined" default is wrong.
3748
3749         * editing/AlternativeTextController.cpp:
3750         (WebCore::AlternativeTextController::applyAlternativeTextToRange): Updated
3751         to use ExceptionOr but behave the same.
3752         * editing/Editor.cpp:
3753         (WebCore::Editor::advanceToNextMisspelling): Ditto.
3754         (WebCore::Editor::markAndReplaceFor): Ditto.
3755         (WebCore::isFrameInRange): Ditto. Also made a few style tweaks.
3756         (WebCore::Editor::countMatchesForText): Ditto.
3757         * editing/EditorCommand.cpp:
3758         (WebCore::unionDOMRanges): Ditto.
3759         * editing/FrameSelection.cpp:
3760         (WebCore::FrameSelection::respondToNodeModification): Ditto.
3761         * editing/InsertListCommand.cpp:
3762         (WebCore::InsertListCommand::doApplyForSingleParagraph): Ditto.
3763         * editing/TextCheckingHelper.cpp:
3764         (WebCore::TextCheckingParagraph::offsetTo): Ditto.
3765         * editing/TextCheckingHelper.h: Updated for above and also deleted
3766         unneeded private function checkingRange, which just churned the
3767         reference count unnecessarily; instead use m_checkingRange directly.
3768         * editing/TextIterator.cpp:
3769         (WebCore::TextIterator::getLocationAndLengthFromRange): Ditto.
3770         * editing/VisiblePosition.cpp:
3771         (WebCore::setStart): Ditto.
3772         (WebCore::setEnd): Ditto.
3773         * editing/VisibleSelection.cpp:
3774         (WebCore::makeSearchRange): Ditto.
3775
3776         * editing/VisibleUnits.cpp:
3777         (WebCore::suffixLengthForRange): Changed argument from RefPtr to
3778         a reference.
3779         (WebCore::prefixLengthForRange): Ditto.
3780         (WebCore::previousBoundary): Updated for ExceptionOr and the change
3781         above.
3782         (WebCore::nextBoundary): Ditto.
3783         * editing/VisibleUnits.h: Updated for above.
3784
3785         * editing/htmlediting.cpp:
3786         (WebCore::comparePositions): Updated to use ExceptionOr but behave
3787         the same.
3788         (WebCore::visiblePositionForIndexUsingCharacterIterator): Ditto.
3789         (WebCore::isNodeVisiblyContainedWithin): Ditto.
3790         * editing/ios/EditorIOS.mm:
3791         (WebCore::Editor::setDictationPhrasesAsChildOfElement): Ditto.
3792         (WebCore::Editor::setTextAsChildOfElement): Ditto.
3793         * editing/mac/EditorMac.mm:
3794         (WebCore::Editor::adjustedSelectionRange): Ditto.
3795         * editing/markup.cpp:
3796         (WebCore::createMarkupInternal): Ditto.
3797         * page/ContextMenuController.cpp:
3798         (WebCore::ContextMenuController::contextMenuItemSelected): Ditto.
3799         * page/DOMSelection.cpp:
3800         (WebCore::DOMSelection::addRange): Ditto.
3801         (WebCore::DOMSelection::deleteFromDocument): Ditto.
3802         (WebCore::DOMSelection::containsNode): Ditto.
3803
3804         * page/EventHandler.cpp:
3805         (WebCore::EventHandler::dispatchMouseEvent): Updated for change to
3806         use ExceptionOr in Ragne::compareNode. Also refactored the function
3807         to make the logic a little mroe straightforward and nest less of it
3808         inside a loop.
3809
3810         * page/Page.cpp:
3811         (WebCore::Page::findStringMatchingRanges): Updated for ExceptionOr
3812         without changing behavior.
3813         * page/TextIndicator.cpp:
3814         (WebCore::hasNonInlineOrReplacedElements): Ditto.
3815         * rendering/RenderNamedFlowThread.cpp:
3816         (WebCore::RenderNamedFlowThread::getRanges): Ditto.
3817
3818 2016-11-09  Dave Hyatt  <hyatt@apple.com>
3819
3820         [CSS Parser] Fix grid layout parsing
3821         https://bugs.webkit.org/show_bug.cgi?id=164489
3822
3823         Reviewed by Dean Jackson.
3824
3825         * css/CSSValueKeywords.in:
3826         * css/parser/CSSPropertyParser.cpp:
3827         (WebCore::consumeFitContent):
3828         (WebCore::isGridTrackFixedSized):
3829         (WebCore::consumeGridTrackSize):
3830         (WebCore::consumeGridTrackRepeatFunction):
3831         (WebCore::consumeGridTrackList):
3832         (WebCore::isCustomIdentValue):
3833         (WebCore::CSSPropertyParser::consumeGridItemPositionShorthand):
3834         (WebCore::CSSPropertyParser::consumeGridAreaShorthand):
3835         (WebCore::consumeImplicitGridAutoFlow):
3836         (WebCore::CSSPropertyParser::consumeGridShorthand):
3837
3838 2016-11-09  Darin Adler  <darin@apple.com>
3839
3840         Move EventTarget from ExceptionCode to ExceptionOr
3841         https://bugs.webkit.org/show_bug.cgi?id=164465
3842
3843         Reviewed by Youenn Fablet.
3844
3845         * Modules/indexeddb/IDBRequest.h: Added now-needed forward
3846         class declarations.
3847         * Modules/webaudio/AudioContext.h: Ditto.
3848
3849         * bindings/js/JSEventListener.cpp:
3850         (WebCore::eventHandlerAttribute): Updated for name change of the
3851         attributeEventListener function.
3852         (WebCore::documentEventHandlerAttribute): Ditto.
3853         * dom/Document.cpp:
3854         (WebCore::Document::getWindowAttributeEventListener): Ditto.
3855
3856         * dom/EventTarget.cpp:
3857         (WebCore::EventTarget::setAttributeEventListener): Updated for
3858         name change.
3859         (WebCore::EventTarget::attributeEventListener): Ditto.
3860         (WebCore::EventTarget::dispatchEventForBindings): Use ExceptionOr.
3861         (WebCore::legacyType): Use null instead of empty for no type, since
3862         it's more efficient to check for null.
3863         (WebCore::EventTarget::fireEventListeners): Check for null.
3864         Also streamlined logic a little bit and removed a very old comment.
3865         (WebCore::EventTarget::eventListeners): Renamed from getEventListeners.
3866         * dom/EventTarget.h: Removed lots of unneeded declarations. Renamed
3867         some functions to remove get prefix. Updated for above changes.
3868         Moved one inline function out of the class header. Made the destructor
3869         for EventTarget be inline to make the destructors for derived classes
3870         slightly more efficient.
3871         * dom/EventTarget.idl: Use non-legacy exception.
3872
3873         * dom/Node.cpp:
3874         (WebCore::Node::didMoveToNewDocument): Updated for name change.
3875         * editing/ReplaceSelectionCommand.cpp:
3876         (WebCore::ReplacementFragment::ReplacementFragment): Ditto.
3877
3878         * inspector/InspectorCSSAgent.h: Added now-needed forward declaration.
3879
3880         * inspector/InspectorDOMAgent.cpp:
3881         (WebCore::InspectorDOMAgent::getEventListeners): Updated for name change.
3882
3883         * inspector/InspectorInstrumentation.h: Added now-needed forward declaration.
3884         * page/DOMWindow.h: Ditto.
3885         * xml/XMLHttpRequest.h: Ditto.
3886
3887 2016-11-09  Daniel Bates  <dabates@apple.com>
3888
3889         Add test infrastructure and tests for existing HTTP 0.9 sandbox machinery
3890         https://bugs.webkit.org/show_bug.cgi?id=164389
3891         <rdar://problem/29101072>
3892
3893         Reviewed by Alex Christensen.
3894
3895         Add test infrastructure to support registering an arbitrary port as the default port
3896         for a protocol. The behavior of various machinery, including the HTTP 0.9 machinery,
3897         can be effected by whether the resource request was made using the default port for
3898         the protocol. We expose window.internals.registerDefaultPortForProtocol() to allow
3899         a test to override the default port associated with a protocol so as to support
3900         testing these code paths using the existing port 8000 server started by run-webkit-httpd.
3901         Without window.internals.registerDefaultPortForProtocol() we would need to teach
3902         run-webkit-httpd to run a web server on port 80, which requires superuser privileges
3903         (since it is a privileged port number) and is more likely to interfere with an
3904         existing web server setup.
3905
3906         Tests: http/tests/security/http-0.9/default-port-plugin-blocked.html
3907                http/tests/security/http-0.9/default-port-script-blocked.html
3908                http/tests/security/http-0.9/iframe-blocked.html
3909                http/tests/security/http-0.9/image-blocked.html
3910                http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-ref-test.html
3911                http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed.html
3912                http/tests/security/http-0.9/image-on-HTTP-0.9-page-blocked.html
3913                http/tests/security/http-0.9/worker-connect-src-blocked.html
3914                http/tests/security/http-0.9/worker-importScripts-blocked.html
3915                http/tests/security/http-0.9/xhr-asynchronous-blocked.html
3916
3917         * platform/URL.cpp:
3918         (WebCore::defaultPortForProtocolMapForTesting): Added.
3919         (WebCore::registerDefaultPortForProtocolForTesting): Adds the specified (protocol, port) to the
3920         mapping used for testing.
3921         (WebCore::clearDefaultPortForProtocolMapForTesting): Clears the protocol to default port testing map.
3922         We call this function from Internals::resetToConsistentState() so that the mapping is cleared between
3923         test runs.
3924         (WebCore::defaultPortForProtocol): Modified to check the protocol to default port map for testing
3925         before consulting URLParser::defaultPortForProtocol().
3926         * platform/URL.h:
3927         * testing/Internals.cpp:
3928         (WebCore::Internals::resetToConsistentState): Clear the default port mapping used for testing.
3929         (WebCore::Internals::registerDefaultPortForProtocol): Added.
3930         * testing/Internals.h:
3931         * testing/Internals.idl: Added declaration for registerDefaultPortForProtocol().
3932
3933 2016-11-09  Sam Weinig  <sam@webkit.org>
3934
3935         [WebIDL] Add proper parsing for Promises
3936         https://bugs.webkit.org/show_bug.cgi?id=164497
3937
3938         Reviewed by Tim Horton.
3939
3940         * bindings/scripts/IDLParser.pm:
3941         (parseNonAnyType):
3942         (parseStringType):
3943         Require Promise types to declare the type they resolve to.
3944         
3945         * bindings/js/JSDOMPromise.h:
3946         Allow DOMPromise to be be parameterized on void. Add an SFINAE guarded
3947         overload of resolve that takes no arguments when in a DOMPromise<void>.
3948
3949         * Modules/applepay/ApplePaySession.idl:
3950         * Modules/fetch/DOMWindowFetch.idl:
3951         * Modules/fetch/FetchBody.idl:
3952         * Modules/fetch/FetchResponse.idl:
3953         * Modules/fetch/WorkerGlobalScopeFetch.idl: