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