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