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