fd5ba591b402701cd5709cfb4be47a9ee20f2d60
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-06-05  Yusuke Suzuki  <utatane.tea@gmail.com>
2
3         Change ProxyObject.[[Get]] not to use custom accessor
4         https://bugs.webkit.org/show_bug.cgi?id=157080
5
6         Reviewed by Darin Adler.
7
8         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
9         (WebCore::getProperty):
10         * bindings/js/JSDOMBinding.h:
11         (WebCore::nonCachingStaticFunctionGetter):
12         * bindings/js/JSDOMWindowCustom.cpp:
13         (WebCore::jsDOMWindowWebKit):
14         * bindings/js/JSDictionary.cpp:
15         (WebCore::JSDictionary::tryGetProperty):
16         * bindings/js/JSPluginElementFunctions.cpp:
17         (WebCore::pluginElementPropertyGetter):
18         * bindings/js/JSPluginElementFunctions.h:
19         * bindings/scripts/CodeGeneratorJS.pm:
20         (GenerateHeader):
21         (GenerateImplementation):
22         * bindings/scripts/test/JS/JSInterfaceName.cpp:
23         (WebCore::jsInterfaceNameConstructor):
24         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
25         (WebCore::jsTestActiveDOMObjectExcitingAttr):
26         (WebCore::jsTestActiveDOMObjectConstructor):
27         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
28         (WebCore::jsTestClassWithJSBuiltinConstructorConstructor):
29         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
30         (WebCore::jsTestCustomConstructorWithNoInterfaceObjectConstructor):
31         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
32         (WebCore::jsTestCustomNamedGetterConstructor):
33         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
34         (WebCore::jsTestEventConstructorAttr1):
35         (WebCore::jsTestEventConstructorAttr2):
36         (WebCore::jsTestEventConstructorAttr3):
37         (WebCore::jsTestEventConstructorConstructor):
38         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
39         (WebCore::jsTestEventTargetConstructor):
40         * bindings/scripts/test/JS/JSTestException.cpp:
41         (WebCore::jsTestExceptionName):
42         (WebCore::jsTestExceptionConstructor):
43         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
44         (WebCore::jsTestGenerateIsReachableConstructor):
45         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
46         (WebCore::jsTestGlobalObjectRegularAttribute):
47         (WebCore::jsTestGlobalObjectEnabledAtRuntimeAttribute):
48         (WebCore::jsTestGlobalObjectConstructor):
49         * bindings/scripts/test/JS/JSTestInterface.cpp:
50         (WebCore::jsTestInterfaceConstructorImplementsStaticReadOnlyAttr):
51         (WebCore::jsTestInterfaceConstructorImplementsStaticAttr):
52         (WebCore::jsTestInterfaceImplementsStr1):
53         (WebCore::jsTestInterfaceImplementsStr2):
54         (WebCore::jsTestInterfaceImplementsStr3):
55         (WebCore::jsTestInterfaceImplementsNode):
56         (WebCore::jsTestInterfaceConstructorSupplementalStaticReadOnlyAttr):
57         (WebCore::jsTestInterfaceConstructorSupplementalStaticAttr):
58         (WebCore::jsTestInterfaceSupplementalStr1):
59         (WebCore::jsTestInterfaceSupplementalStr2):
60         (WebCore::jsTestInterfaceSupplementalStr3):
61         (WebCore::jsTestInterfaceSupplementalNode):
62         (WebCore::jsTestInterfaceConstructor):
63         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
64         (WebCore::jsTestJSBuiltinConstructorTestAttributeCustom):
65         (WebCore::jsTestJSBuiltinConstructorTestAttributeRWCustom):
66         (WebCore::jsTestJSBuiltinConstructorConstructor):
67         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
68         (WebCore::jsTestMediaQueryListListenerConstructor):
69         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
70         (WebCore::jsTestNamedConstructorConstructor):
71         * bindings/scripts/test/JS/JSTestNode.cpp:
72         (WebCore::jsTestNodeName):
73         (WebCore::jsTestNodeConstructor):
74         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
75         (WebCore::jsTestNondeterministicNondeterministicReadonlyAttr):
76         (WebCore::jsTestNondeterministicNondeterministicWriteableAttr):
77         (WebCore::jsTestNondeterministicNondeterministicExceptionAttr):
78         (WebCore::jsTestNondeterministicNondeterministicGetterExceptionAttr):
79         (WebCore::jsTestNondeterministicNondeterministicSetterExceptionAttr):
80         (WebCore::jsTestNondeterministicConstructor):
81         * bindings/scripts/test/JS/JSTestObj.cpp:
82         (WebCore::jsTestObjReadOnlyLongAttr):
83         (WebCore::jsTestObjReadOnlyStringAttr):
84         (WebCore::jsTestObjReadOnlyTestObjAttr):
85         (WebCore::jsTestObjConstructorStaticReadOnlyLongAttr):
86         (WebCore::jsTestObjConstructorStaticStringAttr):
87         (WebCore::jsTestObjConstructorTestSubObj):
88         (WebCore::jsTestObjTestSubObjEnabledBySettingConstructor):
89         (WebCore::jsTestObjEnumAttr):
90         (WebCore::jsTestObjByteAttr):
91         (WebCore::jsTestObjOctetAttr):
92         (WebCore::jsTestObjShortAttr):
93         (WebCore::jsTestObjClampedShortAttr):
94         (WebCore::jsTestObjEnforceRangeShortAttr):
95         (WebCore::jsTestObjUnsignedShortAttr):
96         (WebCore::jsTestObjLongAttr):
97         (WebCore::jsTestObjLongLongAttr):
98         (WebCore::jsTestObjUnsignedLongLongAttr):
99         (WebCore::jsTestObjStringAttr):
100         (WebCore::jsTestObjTestObjAttr):
101         (WebCore::jsTestObjTestNullableObjAttr):
102         (WebCore::jsTestObjLenientTestObjAttr):
103         (WebCore::jsTestObjUnforgeableAttr):
104         (WebCore::jsTestObjStringAttrTreatingNullAsEmptyString):
105         (WebCore::jsTestObjXMLObjAttr):
106         (WebCore::jsTestObjCreate):
107         (WebCore::jsTestObjReflectedStringAttr):
108         (WebCore::jsTestObjReflectedIntegralAttr):
109         (WebCore::jsTestObjReflectedUnsignedIntegralAttr):
110         (WebCore::jsTestObjReflectedBooleanAttr):
111         (WebCore::jsTestObjReflectedURLAttr):
112         (WebCore::jsTestObjReflectedCustomIntegralAttr):
113         (WebCore::jsTestObjReflectedCustomBooleanAttr):
114         (WebCore::jsTestObjReflectedCustomURLAttr):
115         (WebCore::jsTestObjEnabledAtRuntimeAttribute):
116         (WebCore::jsTestObjTypedArrayAttr):
117         (WebCore::jsTestObjAttrWithGetterException):
118         (WebCore::jsTestObjAttrWithGetterExceptionWithMessage):
119         (WebCore::jsTestObjAttrWithSetterException):
120         (WebCore::jsTestObjAttrWithSetterExceptionWithMessage):
121         (WebCore::jsTestObjStringAttrWithGetterException):
122         (WebCore::jsTestObjStringAttrWithSetterException):
123         (WebCore::jsTestObjStrictTypeCheckingAttribute):
124         (WebCore::jsTestObjCustomAttr):
125         (WebCore::jsTestObjOnfoo):
126         (WebCore::jsTestObjOnwebkitfoo):
127         (WebCore::jsTestObjWithScriptStateAttribute):
128         (WebCore::jsTestObjWithCallWithAndSetterCallWithAttribute):
129         (WebCore::jsTestObjWithScriptExecutionContextAttribute):
130         (WebCore::jsTestObjWithScriptStateAttributeRaises):
131         (WebCore::jsTestObjWithScriptExecutionContextAttributeRaises):
132         (WebCore::jsTestObjWithScriptExecutionContextAndScriptStateAttribute):
133         (WebCore::jsTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
134         (WebCore::jsTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute):
135         (WebCore::jsTestObjWithScriptArgumentsAndCallStackAttribute):
136         (WebCore::jsTestObjConditionalAttr1):
137         (WebCore::jsTestObjConditionalAttr2):
138         (WebCore::jsTestObjConditionalAttr3):
139         (WebCore::jsTestObjConditionalAttr4Constructor):
140         (WebCore::jsTestObjConditionalAttr5Constructor):
141         (WebCore::jsTestObjConditionalAttr6Constructor):
142         (WebCore::jsTestObjCachedAttribute1):
143         (WebCore::jsTestObjCachedAttribute2):
144         (WebCore::jsTestObjAnyAttribute):
145         (WebCore::jsTestObjContentDocument):
146         (WebCore::jsTestObjMutablePoint):
147         (WebCore::jsTestObjImmutablePoint):
148         (WebCore::jsTestObjStrawberry):
149         (WebCore::jsTestObjStrictFloat):
150         (WebCore::jsTestObjDescription):
151         (WebCore::jsTestObjId):
152         (WebCore::jsTestObjHash):
153         (WebCore::jsTestObjReplaceableAttribute):
154         (WebCore::jsTestObjNullableDoubleAttribute):
155         (WebCore::jsTestObjNullableLongAttribute):
156         (WebCore::jsTestObjNullableBooleanAttribute):
157         (WebCore::jsTestObjNullableStringAttribute):
158         (WebCore::jsTestObjNullableLongSettableAttribute):
159         (WebCore::jsTestObjNullableStringSettableAttribute):
160         (WebCore::jsTestObjNullableStringValue):
161         (WebCore::jsTestObjAttribute):
162         (WebCore::jsTestObjAttributeWithReservedEnumType):
163         (WebCore::jsTestObjPutForwardsAttribute):
164         (WebCore::jsTestObjPutForwardsNullableAttribute):
165         (WebCore::jsTestObjConstructor):
166         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
167         (WebCore::jsTestOverloadedConstructorsConstructor):
168         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
169         (WebCore::jsTestOverrideBuiltinsConstructor):
170         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
171         (WebCore::jsTestSerializedScriptValueInterfaceValue):
172         (WebCore::jsTestSerializedScriptValueInterfaceReadonlyValue):
173         (WebCore::jsTestSerializedScriptValueInterfaceCachedValue):
174         (WebCore::jsTestSerializedScriptValueInterfacePorts):
175         (WebCore::jsTestSerializedScriptValueInterfaceCachedReadonlyValue):
176         (WebCore::jsTestSerializedScriptValueInterfaceConstructor):
177         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
178         (WebCore::jsTestTypedefsUnsignedLongLongAttr):
179         (WebCore::jsTestTypedefsImmutableSerializedScriptValue):
180         (WebCore::jsTestTypedefsConstructorTestSubObj):
181         (WebCore::jsTestTypedefsAttrWithGetterException):
182         (WebCore::jsTestTypedefsAttrWithSetterException):
183         (WebCore::jsTestTypedefsStringAttrWithGetterException):
184         (WebCore::jsTestTypedefsStringAttrWithSetterException):
185         (WebCore::jsTestTypedefsConstructor):
186         * bindings/scripts/test/JS/JSattribute.cpp:
187         (WebCore::jsattributeReadonly):
188         (WebCore::jsattributeConstructor):
189         * bindings/scripts/test/JS/JSreadonly.cpp:
190         (WebCore::jsreadonlyConstructor):
191         * bridge/runtime_array.cpp:
192         (JSC::RuntimeArray::lengthGetter):
193         * bridge/runtime_array.h:
194         * bridge/runtime_method.cpp:
195         (JSC::RuntimeMethod::lengthGetter):
196         * bridge/runtime_method.h:
197         * bridge/runtime_object.cpp:
198         (JSC::Bindings::RuntimeObject::fallbackObjectGetter):
199         (JSC::Bindings::RuntimeObject::fieldGetter):
200         (JSC::Bindings::RuntimeObject::methodGetter):
201         * bridge/runtime_object.h:
202
203 2016-06-03  Gavin & Ellie Barraclough  <barraclough@apple.com>
204
205         Deprecate remaining uses of Lookup getStatic*, use HasStaticPropertyTable instead.
206         https://bugs.webkit.org/show_bug.cgi?id=158178
207
208         Reviewed by Darin Adler.
209
210         As of bug #158059 most JSC static table property access no longer requires getOwnPropertySlot to be
211         overridden. Port remaining calls to the getStatic* functions in Lookup.h over to the new mechanism.
212
213         Part 1: Switch JSGlobalObject & JSDOMWindow to use HasStaticPropertyTable.
214
215         * bindings/js/JSDOMWindowCustom.cpp:
216         (WebCore::JSDOMWindow::getOwnPropertySlot):
217             - getStaticPropertySlot -> Base::getOwnPropertySlot.
218         * bindings/js/JSPluginElementFunctions.h:
219         (WebCore::pluginElementCustomGetOwnPropertySlot):
220             - Switch call from getStaticValueSlot to Type::getOwnPropertySlot.
221               For any element where Type::hasStaticPropertyTable is true the HasStaticPropertyTable
222               structure flag will also be set, so Type::getOwnPropertySlot will do the same thing.
223         * bindings/scripts/CodeGeneratorJS.pm:
224         (PrototypeHasStaticPropertyTable):
225             - Was PrototypeOverridesGetOwnPropertySlot; prototypes now never need override getOwnPropertySlot so renaming accordingly.
226         (GenerateImplementation):
227             - Removed generation of getOwnPropertySlot body for DOMGlobalObjects.
228         (GeneratePrototypeDeclaration):
229             - For DOMGlobalObjects, set HasStaticPropertyTable instead of OverridesGetOwnPropertySlot & removed getOwnPropertySlot declaration.
230         (PrototypeOverridesGetOwnPropertySlot): Deleted.
231             Renamed to PrototypeHasStaticPropertyTable.
232         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
233         * bindings/scripts/test/JS/JSTestGlobalObject.h:
234             - Updating bindings test results.
235
236 2016-06-05  Antti Koivisto  <antti@apple.com>
237
238         Find on page finds too many matches
239         https://bugs.webkit.org/show_bug.cgi?id=158395
240         rdar://problem/7440637
241
242         Reviewed by Dan Bernstein and Darin Adler.
243
244         There is a long standing bug where in some cases WebKit may find non-visible text matches when doing find on page.
245         For example searching patch review view in bugs.webkit.org returns twice as many matches as there actually are
246         on the page. This happens because the text content is replicated in an invisible subframe.
247
248         Fix by making TextIterator ignore content in non-visible subframes in findPlainText.
249
250         Test: editing/text-iterator/count-matches-in-frames.html
251
252         * editing/TextIterator.cpp:
253         (WebCore::nextInPreOrderCrossingShadowBoundaries):
254
255             Remove support for an uninteresting assertion.
256
257         (WebCore::fullyClipsContents):
258
259             Elements without renderer clip their content (except for display:contents).
260             Test the content rect instead of the size rect for emptiness.
261
262         (WebCore::ignoresContainerClip):
263         (WebCore::pushFullyClippedState):
264         (WebCore::setUpFullyClippedStack):
265         (WebCore::isClippedByFrameAncestor):
266
267             Test if the frame owner element is clipped in any of the parent frames.
268
269         (WebCore::TextIterator::TextIterator):
270
271             If the frame is clipped by its ancestors the iterator is initialized to end state.
272             Clipped frame never renders anything so there is no need to maintain clip stack and traverse.
273
274         (WebCore::findPlainText):
275
276             Use TextIteratorClipsToFrameAncestors behavior. There might be other places where
277             this behavior should be used (or perhaps it should be used always?) but limit this to
278             text search for now.
279
280         (WebCore::depthCrossingShadowBoundaries): Deleted.
281         * editing/TextIterator.h:
282         * editing/TextIteratorBehavior.h:
283
284             Add TextIteratorClipsToFrameAncestors behavior.
285
286         * testing/Internals.cpp:
287         (WebCore::Internals::countMatchesForText):
288         (WebCore::Internals::countFindMatches):
289         (WebCore::Internals::numberOfLiveNodes):
290         * testing/Internals.h:
291         * testing/Internals.idl:
292
293             Testing support
294
295 2016-06-05  Konstantin Tokarev  <annulen@yandex.ru>
296
297         Do not construct temporary copy of String from AtomicString.
298         https://bugs.webkit.org/show_bug.cgi?id=158400
299
300         Reviewed by Darin Adler.
301
302         No new tests needed.
303
304         * accessibility/AccessibilityObject.cpp:
305         (WebCore::AccessibilityObject::ariaReadOnlyValue):
306
307 2016-06-05  Andreas Kling  <akling@apple.com>
308
309         Give RuleFeatures::classesMatchingAncestors some inline capacity.
310         <https://webkit.org/b/158356>
311
312         Reviewed by Darin Adler.
313
314         Avoid 362'000 heap allocations on PLUM (1.3% of all transient fastMallocs) by giving
315         RuleFeatures::classesMatchingAncestors some inline capacity (32).
316         This class is only ever allocated on the stack anyway.
317
318         * css/RuleFeature.h:
319
320 2016-06-05  Brady Eidson  <beidson@apple.com>
321
322         Unreviewed, rolling out r201693.
323
324         Can't fix right now
325
326         Reverted changeset:
327
328         "Modern IDB: Crash seen in IDBConnectionProxy::putOrAdd on
329         GuardMalloc bot"
330         https://bugs.webkit.org/show_bug.cgi?id=158124
331         http://trac.webkit.org/changeset/201693
332
333 2016-06-04  Brady Eidson  <beidson@apple.com>
334
335         Modern IDB: Crash seen in IDBConnectionProxy::putOrAdd on GuardMalloc bot
336         https://bugs.webkit.org/show_bug.cgi?id=158124
337
338         Reviewed by Darin Adler.
339
340         No new tests (Covered by existing test configurations).
341
342         * Modules/indexeddb/IDBTransaction.cpp:
343         (WebCore::IDBTransaction::putOrAddOnServer):
344         
345         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
346         (WebCore::IDBClient::IDBConnectionProxy::putOrAdd):
347         
348         * Modules/indexeddb/client/IDBConnectionProxy.h:
349         (WebCore::IDBClient::IDBConnectionProxy::callConnectionOnMainThread):
350         
351         * bindings/js/SerializedScriptValue.cpp:
352         (WebCore::SerializedScriptValue::writeBlobsToDiskForIndexedDB):
353         * bindings/js/SerializedScriptValue.h:
354         
355         * platform/network/BlobRegistry.h:
356         * platform/network/BlobRegistryImpl.cpp:
357         (WebCore::BlobRegistryImpl::writeBlobsToTemporaryFiles):
358         * platform/network/BlobRegistryImpl.h:
359
360 2016-06-03  Ada Chan  <adachan@apple.com>
361
362         REGRESSION (r201474): Should set overflow: hidden on -webkit-media-controls when placeholder is showing
363         https://bugs.webkit.org/show_bug.cgi?id=158377
364
365         Reviewed by Darin Adler.
366
367         In r201474, we defer removing the hidden class from inlinePlaybackPlaceholder until
368         showInlinePlaybackPlaceholderWhenSafe(). We also need to move the code that adds the
369         placeholder-showing class to -webkit-media-controls to that method.
370
371         * Modules/mediacontrols/mediaControlsApple.js:
372         (Controller.prototype.showInlinePlaybackPlaceholderWhenSafe):
373         Add the "placeholder-showing" class to -webkit-media-controls when we show the placeholder.
374         (Controller.prototype.handlePresentationModeChange):
375         Remove the "placeholder-showing" class from -webkit-media-controls when we hide the
376         placeholder. Remove the old code that adds and removes that class.
377
378 2016-06-04  Darin Adler  <darin@apple.com>
379
380         leaks seen in fast/css/variables tests
381         https://bugs.webkit.org/show_bug.cgi?id=150728
382
383         Reviewed by Anders Carlsson.
384
385         Fixes leaks seen running fast/css/variables tests with leak checking turned on.
386
387         * css/CSSPrimitiveValue.cpp:
388         (WebCore::isStringType): Added. For debugging purposes so we catch cases where we
389         are not treating strings consistently between construction and destruction.
390         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Assert isStringType returns true.
391         (WebCore::CSSPrimitiveValue::cleanup): Added CSS_DIMENSION and CSS_PARSER_IDENTIFIER
392         to the list of types that have to decrement the reference count of the string we own.
393         Both types are passed to the string constructor above.
394
395         * css/CSSValueList.cpp:
396         (WebCore::CSSValueList::buildParserValueListSubstitutingVariables): Restructured the
397         code so we destroy any CSSParserValue that we don't use. This is needed because of the
398         peculiar requirements of CSSParserValue: it has a be a struct without a destructor so
399         it can be used in the CSS grammar, so we have to destroy it explicitly. Ideally we would
400         minimize any use of it outside the CSSParser itself, but as long as we are using it, we
401         need to do this explicit destruction.
402
403 2016-06-04  Anders Carlsson  <andersca@apple.com>
404
405         32-bit build fix
406         https://bugs.webkit.org/show_bug.cgi?id=158383
407         rdar://problem/26628125
408
409         Reviewed by Dan Bernstein.
410
411         Synthesize the webPlaybackSessionInterfaceMac property.
412
413         * platform/mac/WebPlaybackControlsManager.mm:
414
415 2016-06-04  Chris Dumez  <cdumez@apple.com>
416
417         Avoid redundant isUndefined() check for parameters that are both optional and nullable in overloads
418         https://bugs.webkit.org/show_bug.cgi?id=158380
419
420         Reviewed by Brady Eidson.
421
422         * bindings/scripts/CodeGeneratorJS.pm:
423         (GenerateParametersCheckExpression):
424         * bindings/scripts/test/JS/JSTestObj.cpp:
425         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter):
426
427 2016-06-04  Brent Fulgham  <bfulgham@apple.com>
428
429         CSP: Content Security Policy directive, upgrade-insecure-requests (UIR)
430         https://bugs.webkit.org/show_bug.cgi?id=143653
431         <rdar://problem/23032067>
432
433         Reviewed by Andy Estes.
434
435         Modify our loading logic so that we recognize and upgrade insecure requests to secure
436         requests if the Content Security Policy directive 'upgrade-insecure-requests' is
437         present.
438         
439         Add a static helper function to ContentSecurityPolicy to upgrade insecure URLs so
440         that we don't have to sprinkle the same code all over the loader system.
441
442         Tests: http/tests/security/contentSecurityPolicy/report-only-upgrade-insecure.php
443                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/basic-upgrade-cors.https.html
444                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/basic-upgrade.https.html
445                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/form-upgrade.html
446                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/https-header-auxiliary.html
447                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/https-header-nested.html
448                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/https-header-subresource.html
449                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/https-header-top-level.html
450                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https.html
451                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/proper-nested-upgrades.html
452                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/proper-open-window-upgrades.html
453                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrade-insecure-audio-video-in-main-frame.html
454                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrade-insecure-css-in-iframe.html
455                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrade-insecure-image-in-main-frame.html
456                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrade-simple-ws.html
457                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrade-insecure-xhr-in-main-frame.html
458                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrade-redirect-http-to-https-script-in-iframe.html
459                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrade-redirect-https-to-http-script-in-iframe.html
460                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrades-mixed-content.html
461                http/tests/ssl/iframe-upgrade.https.html
462                http/tests/ssl/upgrade-origin-usage.html
463                http/tests/websocket/tests/hybi/upgrade-simple-ws.html
464
465         * Modules/websockets/WebSocket.cpp:
466         (WebCore::WebSocket::connect): Upgrade insecure requests if the CSP
467         indicates we should.
468         * dom/Document.cpp:
469         (WebCore::Document::initSecurityContext): Populate new document CSP with sets of upgrade host and port combinations.
470         * dom/ScriptElement.cpp:
471         (WebCore::ScriptElement::requestScript): Upgrade insecure requests if
472         the CSP indicates we should.
473         * html/HTMLMediaElement.cpp:
474         (WebCore::HTMLMediaElement::loadResource): Ditto.
475         * loader/DocumentWriter.cpp:
476         (WebCore::DocumentWriter::begin): Ditto.
477         * loader/FormSubmission.cpp:
478         (WebCore::FormSubmission::create): Ditto.
479         (WebCore::FormSubmission::populateFrameLoadRequest): Add "Upgrade-Insecure-Requests"
480         header to frame load requests.
481         * loader/FrameLoader.cpp:
482         (WebCore::FrameLoader::addExtraFieldsToMainResourceRequest): Add the
483         'Update-Insecure-Requests' header field if necessary.
484         (WebCore::FrameLoader::addHTTPUpgradeInsecureRequestsIfNeeded): Added helper function.
485         (WebCore::FrameLoader::loadPostRequest): Upgrade insecure requests if the CSP
486         indicates we should.
487         (WebCore::FrameLoader::loadResourceSynchronously): Ditto.
488         (WebCore::FrameLoader::loadDifferentDocumentItem): If loading a form, add the
489         'Update-Insecure-Requests' header field if necessary.
490         (WebCore::createWindow): Upgrade insecure requests if the CSP
491         indicates we should.
492         * loader/FrameLoader.h:
493         * loader/PingLoader.cpp:
494         (WebCore::PingLoader::loadImage): Upgrade insecure requests if the CSP
495         indicates we should.
496         (WebCore::PingLoader::sendPing): Ditto.
497         (WebCore::PingLoader::sendViolationReport): Ditto.
498         * loader/ResourceLoader.cpp:
499         (WebCore::ResourceLoader::willSendRequestInternal): Ditto.
500         * loader/SubframeLoader.cpp:
501         (WebCore::SubframeLoader::requestFrame): Ditto.
502         (WebCore::SubframeLoader::requestObject): Ditto.
503         * loader/appcache/ApplicationCacheHost.cpp:
504         (WebCore::ApplicationCacheHost::shouldLoadResourceFromApplicationCache): Ditto.
505         * loader/cache/CachedResourceLoader.cpp:
506         (WebCore::CachedResourceLoader::requestImage): Ditto.
507         (WebCore::CachedResourceLoader::requestResource): Ditto.
508         * page/DOMWindow.cpp:
509         (WebCore::DOMWindow::createWindow): Add the 'Update-Insecure-Requests' header
510         field if necessary.
511         * page/csp/ContentSecurityPolicy.cpp:
512         (WebCore::ContentSecurityPolicy::copyStateFrom): Populate upgraded resource set
513         from other context.
514         (WebCore::ContentSecurityPolicy::upgradeInsecureRequestIfNeeded): Added helper function
515         to upgrade requests when the upgrade-insecure-requests CSP policy is present, or if
516         the host and port combination have previously been upgraded.
517         (WebCore::ContentSecurityPolicy::upgradeInsecureNavigationRequestIfNeeded): Added
518         helper function to upgrade requests that have been previously upgraded. Cross-site
519         navigations only get upgraded when they have been previously upgraded.
520         (WebCore::ContentSecurityPolicy::addInsecureNavigationRequestsToUpgrade): Added.
521         (WebCore::ContentSecurityPolicy::populateInsecureNavigationRequestsToUpgradeFromOther): Added.
522         * page/csp/ContentSecurityPolicy.h:
523         (WebCore::ContentSecurityPolicy::setUpgradeInsecureRequests): Added.
524         (WebCore::ContentSecurityPolicy::upgradeInsecureRequests): Added.
525         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
526         (WebCore::ContentSecurityPolicyDirectiveList::ContentSecurityPolicyDirectiveList): Use
527         more C++11 initializations.
528         (WebCore::ContentSecurityPolicyDirectiveList::setUpgradeInsecureRequests): Added.
529         (WebCore::ContentSecurityPolicyDirectiveList::addDirective): Teach this function to
530         recognize the new directive.
531         * page/csp/ContentSecurityPolicyDirectiveList.h:
532         * page/csp/ContentSecurityPolicyDirectiveNames.cpp:
533         * page/csp/ContentSecurityPolicyDirectiveNames.h:
534         * platform/network/HTTPHeaderNames.in: Add new 'Upgrade-Insecure-Requests' header field.
535         * xml/XMLHttpRequest.cpp:
536         (WebCore::XMLHttpRequest::open): Upgrade insecure requests if the CSP if needed.
537
538 2016-06-03  Myles C. Maxfield  <mmaxfield@apple.com>
539
540         Bopomofo ruby in Dictionary.app is written horizontally (when it should be written vertically)
541         https://bugs.webkit.org/show_bug.cgi?id=158245
542         <rdar://problem/25675318>
543
544         Reviewed by Darin Adler.
545
546         With orthogonal flows, the inner element gets a logical width that is computed from two values:
547         - The containing block's available logical height
548         - The FrameView's visibleHeight
549
550         In Dictionary.app, the FrameView's height changes, but this element doesn't get relaid out.
551         This is because of our optimization where normal-flow elements don't get relaid out if their
552         parent's width doesn't change (which is the case here).
553
554         Therefore, this orthogonal writing mode element should be relaid out when the FrameView changes
555         size. Luckily, we already have machinery for doing this: percentage heights. In quirks mode, a
556         div with a percentage height may walk arbitrarily far up the DOM tree in order to determine which
557         element the percentage should be resolved against. Therefore, we have a map of percentage-sizing-
558         ancestors to percentage-sizing-descendants which speeds up this search. If a percentage-sizing-
559         ancestor gets relaid out, all the relevant percentage-sizing-descendants get relaid out too.
560
561         Therefore, we can simply mark the FrameView as a percentage-sizing-ancestor and the orthogonal
562         flow element as a percentage-sizing-descendant. The lifetime of this relationship is already
563         managed correctly - it gets reset when style changes and when the renderer is destroyed, and
564         is created during layout.
565
566         Unfortunately, this same treatment should also be done to the element which dictates the
567         containing block's logical height (which caused https://bugs.webkit.org/show_bug.cgi?id=158286).
568         Implementing this would require giving RenderBox::availableLogicalHeight() a second result
569         of the necessary element which dictates the return. In an effort to keep this patch small and
570         focused, I'll do this secondary (much larger) work in a patch on that bug. This patch,
571         therefore, is kept small and focused.
572
573         Test: fast/text/orthogonal-writing-mode-containing-block-frameView-resize-relayout.html
574
575         * rendering/RenderBox.cpp:
576         (WebCore::RenderBox::perpendicularContainingBlockLogicalHeight):
577
578 2016-06-03  Myles C. Maxfield  <mmaxfield@apple.com>
579
580         Text not visible while external font downloading
581         https://bugs.webkit.org/show_bug.cgi?id=25207
582         <rdar://problem/15167413>
583
584         Reviewed by Dean Jackson.
585
586         I already laid the groundwork for this when implementing the CSS Font Loading API.
587         We only have to create a timer and correctly respond to it timing out (by setting
588         state).
589
590         This patch also adds a new internal setting which puts us in a mode where font
591         loads never complete and the timeout occurs immediately. This is so we can test
592         the fallback behavior.
593
594         Test: fast/text/web-font-load-fallback-during-loading.html
595
596         * css/CSSFontFace.cpp:
597         (WebCore::CSSFontFace::CSSFontFace):
598         (WebCore::CSSFontFace::fontLoadEventOccurred):
599         (WebCore::CSSFontFace::timeoutFired):
600         (WebCore::CSSFontFace::setStatus):
601         (WebCore::CSSFontFace::fontLoaded):
602         (WebCore::CSSFontFace::webFontsShouldAlwaysFallBack):
603         (WebCore::CSSFontFace::pump):
604         (WebCore::CSSFontFace::font):
605         * css/CSSFontFace.h:
606         * css/CSSFontFaceSource.cpp:
607         (WebCore::CSSFontFaceSource::fontLoaded):
608         * css/FontFace.cpp:
609         (WebCore::FontFace::fontStateChanged):
610         * page/Settings.cpp:
611         (WebCore::Settings::Settings):
612         (WebCore::Settings::setWebFontsAlwaysFallBack):
613         * page/Settings.h:
614         (WebCore::Settings::webFontsAlwaysFallBack):
615         * testing/InternalSettings.cpp:
616         (WebCore::InternalSettings::Backup::Backup):
617         (WebCore::InternalSettings::Backup::restoreTo):
618         (WebCore::InternalSettings::setWebFontsAlwaysFallBack):
619         * testing/InternalSettings.h:
620         * testing/InternalSettings.idl:
621
622 2016-06-03  Chris Dumez  <cdumez@apple.com>
623
624         Modernize a few more lambda captures
625         https://bugs.webkit.org/show_bug.cgi?id=158370
626
627         Reviewed by Brady Eidson.
628
629         * workers/DedicatedWorkerGlobalScope.cpp:
630         (WebCore::DedicatedWorkerGlobalScope::postMessage):
631         * workers/DedicatedWorkerGlobalScope.h:
632         * workers/Worker.cpp:
633         (WebCore::Worker::postMessage):
634         * workers/Worker.h:
635         * workers/WorkerEventQueue.cpp:
636         (WebCore::WorkerEventQueue::enqueueEvent):
637         * workers/WorkerGlobalScopeProxy.h:
638         * workers/WorkerMessagingProxy.cpp:
639         (WebCore::WorkerMessagingProxy::postMessageToWorkerObject):
640         (WebCore::WorkerMessagingProxy::postMessageToWorkerGlobalScope):
641         * workers/WorkerMessagingProxy.h:
642         * workers/WorkerObjectProxy.h:
643
644 2016-06-03  Commit Queue  <commit-queue@webkit.org>
645
646         Unreviewed, rolling out r201663.
647         https://bugs.webkit.org/show_bug.cgi?id=158374
648
649         Broke the Windows build (Requested by andersca on #webkit).
650
651         Reverted changeset:
652
653         "Rename NoncopyableFunction to Function"
654         https://bugs.webkit.org/show_bug.cgi?id=158354
655         http://trac.webkit.org/changeset/201663
656
657 2016-06-03  Ryosuke Niwa  <rniwa@webkit.org>
658
659         Crash under VisibleSelection::firstRange()
660         https://bugs.webkit.org/show_bug.cgi?id=158241
661
662         Reviewed by Enrica Casucci.
663
664         The crash was commonly caused by parentAnchoredEquivalent returning null when the anchored node was a shadow root.
665         Fixed it by returning a shadow root in parentAnchoredEquivalent.
666
667         Also guard against other kinds of crashes by adding a null check in VisibleSelection::firstRange() since we've seen
668         a crash in the same code path outside of a shadow tree.
669
670         This patch also fixes other Position methods to stop using nonShadowBoundaryParentNode in place of parentNode as
671         that would cause a similar crash and/or a bug elsewhere.
672
673         Test: fast/shadow-dom/selection-at-shadow-root-crash.html
674
675         * accessibility/AXObjectCache.cpp:
676         (AXObjectCache::startCharacterOffsetOfParagraph): Fixed a bug uncovered by the assertion fix in Position::Position.
677         This code was sometimes creating a position inside a BR, which is wrong.
678         (AXObjectCache::endCharacterOffsetOfParagraph): Ditto.
679         * dom/Position.cpp:
680         (WebCore::Position::Position): Fixed an assertion which was checking that this constructor wasn't being called
681         with m_anchorNode set to an element editing ignores content of. ||ing it with isShadowRoot() made this assertion
682         useless because it's true whenever m_anchorNode is not a shadow root.
683         (WebCore::Position::containerNode): Use parentNode() instead of findParent() which calls nonShadowBoundaryParentNode
684         since Position should
685         (WebCore::Position::parentAnchoredEquivalent): Fixed the bug by letting this function return a shadow root.
686         (WebCore::Position::previous): Use parentNode() instead of findParent().
687         (WebCore::Position::next): Ditto.
688         (WebCore::Position::atStartOfTree): Ditto.
689         (WebCore::Position::atEndOfTree): Ditto.
690         (WebCore::Position::findParent): Deleted.
691         * dom/Position.h:
692         * editing/VisibleSelection.cpp:
693         (VisibleSelection::firstRange): Added a null check. 
694
695 2016-06-03  Zalan Bujtas  <zalan@apple.com>
696
697         Incorrect rendering on boostmobile FAQ page
698         https://bugs.webkit.org/show_bug.cgi?id=158303
699         <rdar://problem/26603462>
700
701         Reviewed by Chris Dumez.
702
703         Initial value for background-color is 'transparent'. see https://drafts.csswg.org/css-backgrounds-3/#background-color
704
705         Test: fast/selectors/non-visited-link-backround-color.html
706
707         * css/CSSPropertyNames.in:
708
709 2016-06-03  Brady Eidson  <beidson@apple.com>
710
711         More miscellaneous IDBBindingUtilities cleanup.
712         https://bugs.webkit.org/show_bug.cgi?id=158359
713
714         Reviewed by Tim Horton.
715
716         No new tests (Straight refactor, yo).
717
718         Replace more ScriptExecutionContext&s with ExecState&s.
719         Combine more unnecessarily separate functions.
720         Remove some cruft.
721         
722         * Modules/indexeddb/IDBCursor.cpp:
723         (WebCore::IDBCursor::setGetResult):
724         
725         * Modules/indexeddb/IDBRequest.cpp:
726         (WebCore::IDBRequest::setResult):
727         (WebCore::IDBRequest::setResultToStructuredClone):
728         
729         * Modules/indexeddb/server/MemoryObjectStore.cpp:
730         (WebCore::IDBServer::MemoryObjectStore::updateIndexesForPutRecord):
731         (WebCore::IDBServer::MemoryObjectStore::populateIndexWithExistingRecords):
732         
733         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
734         (WebCore::IDBServer::SQLiteIDBBackingStore::updateOneIndexForAddRecord):
735         (WebCore::IDBServer::SQLiteIDBBackingStore::updateAllIndexesForAddRecord):
736         
737         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
738         (WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd):
739         
740         * bindings/js/IDBBindingUtilities.cpp:
741         (WebCore::deserializeIDBValueToJSValue):
742         (WebCore::idbKeyDataToScriptValue):
743         (WebCore::deserializeIDBValueDataToJSValue): Deleted.
744         * bindings/js/IDBBindingUtilities.h:
745
746 2016-06-03  Chris Dumez  <cdumez@apple.com>
747
748         CanvasRenderingContext2D.createPattern() / putImageData() throw wrong exception type
749         https://bugs.webkit.org/show_bug.cgi?id=158322
750
751         Reviewed by Ryosuke Niwa.
752
753         CanvasRenderingContext2D.createPattern() / putImageData() were throwing the wrong
754         exception type when the first parameter was null. It should throw a TypeError
755         but it was throwing a legacy TYPE_MISMATCH_ERR:
756         - http://www.w3.org/TR/2dcontext/#canvasrenderingcontext2d
757         - http://www.w3.org/TR/2dcontext/#canvasimagesource
758
759         This patch aligns our behavior with the specification.
760
761         No new tests, covered by existing tests.
762
763         * html/canvas/CanvasRenderingContext2D.cpp:
764         (WebCore::CanvasRenderingContext2D::createPattern):
765         (WebCore::CanvasRenderingContext2D::putImageData):
766         (WebCore::CanvasRenderingContext2D::webkitPutImageDataHD):
767         (WebCore::CanvasRenderingContext2D::didDraw): Deleted.
768         (WebCore::CanvasRenderingContext2D::drawFocusIfNeeded): Deleted.
769         (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal): Deleted.
770         (WebCore::CanvasRenderingContext2D::font): Deleted.
771         * html/canvas/CanvasRenderingContext2D.h:
772         * html/canvas/CanvasRenderingContext2D.idl:
773
774 2016-06-03  Anders Carlsson  <andersca@apple.com>
775
776         Rename NoncopyableFunction to Function
777         https://bugs.webkit.org/show_bug.cgi?id=158354
778
779         Reviewed by Chris Dumez.
780
781         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
782         (WebCore::MediaEndpointPeerConnection::runTask):
783         * Modules/mediastream/MediaEndpointPeerConnection.h:
784         * Modules/webaudio/AudioDestinationNode.h:
785         (WebCore::AudioDestinationNode::resume):
786         (WebCore::AudioDestinationNode::suspend):
787         (WebCore::AudioDestinationNode::close):
788         * Modules/webaudio/DefaultAudioDestinationNode.cpp:
789         (WebCore::DefaultAudioDestinationNode::resume):
790         (WebCore::DefaultAudioDestinationNode::suspend):
791         (WebCore::DefaultAudioDestinationNode::close):
792         * Modules/webaudio/DefaultAudioDestinationNode.h:
793         * dom/ActiveDOMCallbackMicrotask.cpp:
794         (WebCore::ActiveDOMCallbackMicrotask::ActiveDOMCallbackMicrotask):
795         * dom/ActiveDOMCallbackMicrotask.h:
796         * dom/ScriptExecutionContext.h:
797         (WebCore::ScriptExecutionContext::Task::Task):
798         * fileapi/AsyncFileStream.cpp:
799         (WebCore::callOnFileThread):
800         (WebCore::AsyncFileStream::perform):
801         * fileapi/AsyncFileStream.h:
802         * page/FrameView.cpp:
803         (WebCore::FrameView::queuePostLayoutCallback):
804         (WebCore::FrameView::flushPostLayoutTasksQueue):
805         * page/FrameView.h:
806         * page/scrolling/ScrollingThread.cpp:
807         (WebCore::ScrollingThread::dispatch):
808         (WebCore::ScrollingThread::dispatchBarrier):
809         (WebCore::ScrollingThread::dispatchFunctionsFromScrollingThread):
810         * page/scrolling/ScrollingThread.h:
811         * platform/GenericTaskQueue.cpp:
812         (WebCore::TaskDispatcher<Timer>::postTask):
813         * platform/GenericTaskQueue.h:
814         (WebCore::TaskDispatcher::postTask):
815         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
816         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
817         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::scheduleDeferredTask):
818         * platform/mediastream/MediaStreamPrivate.cpp:
819         (WebCore::MediaStreamPrivate::scheduleDeferredTask):
820         * platform/mediastream/MediaStreamPrivate.h:
821         * platform/mediastream/mac/AVMediaCaptureSource.h:
822         * platform/mediastream/mac/AVMediaCaptureSource.mm:
823         (WebCore::AVMediaCaptureSource::scheduleDeferredTask):
824         * style/StyleTreeResolver.cpp:
825         (WebCore::Style::postResolutionCallbackQueue):
826         (WebCore::Style::queuePostResolutionCallback):
827         * style/StyleTreeResolver.h:
828
829 2016-06-03  Ada Chan  <adachan@apple.com>
830
831         REGRESSION(r201474): Subtitles are not resizing in other fullscreen modes
832         https://bugs.webkit.org/show_bug.cgi?id=158355
833
834         Reviewed by Eric Carlson.
835
836         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
837         (WebCore::MediaPlayerPrivateAVFoundationObjC::syncTextTrackBounds):
838         Set the text track representation layer's frame based on the active video layer.
839
840 2016-06-03  Brady Eidson  <beidson@apple.com>
841
842         Miscellaneous IDBBindingUtilities cleanup.
843         https://bugs.webkit.org/show_bug.cgi?id=158353
844
845         Reviewed by Tim Horton.
846
847         No new tests (Straight refactor, yo).
848
849         Starting with removing a single form of scriptValueToIDBKey(), and making the return value be
850         Ref<IDBKey> instead of RefPtr<IDBKey>, update a whole bunch of code to understand that the ExecState
851         is non-null and the resulting key is non-null.
852         
853         * Modules/indexeddb/IDBCursor.cpp:
854         (WebCore::IDBCursor::continueFunction):
855         
856         * Modules/indexeddb/IDBFactory.cpp:
857         (WebCore::IDBFactory::cmp):
858         
859         * Modules/indexeddb/IDBIndex.cpp:
860         (WebCore::IDBIndex::count):
861         (WebCore::IDBIndex::get):
862         (WebCore::IDBIndex::getKey):
863         
864         * Modules/indexeddb/IDBKey.cpp:
865         (WebCore::IDBKey::compare):
866         (WebCore::IDBKey::isLessThan):
867         (WebCore::IDBKey::isEqual):
868         * Modules/indexeddb/IDBKey.h:
869         (WebCore::IDBKey::createMultiEntryArray):
870         
871         * Modules/indexeddb/IDBKeyRange.cpp:
872         (WebCore::IDBKeyRange::only):
873         (WebCore::IDBKeyRange::lowerBound):
874         (WebCore::IDBKeyRange::upperBound):
875         (WebCore::IDBKeyRange::bound):
876         (WebCore::IDBKeyRange::isOnlyKey):
877         
878         * Modules/indexeddb/IDBObjectStore.cpp:
879         (WebCore::IDBObjectStore::get):
880         (WebCore::IDBObjectStore::modernDelete):
881         (WebCore::IDBObjectStore::count):
882         
883         * bindings/js/IDBBindingUtilities.cpp:
884         (WebCore::get):
885         (WebCore::set):
886         (WebCore::createIDBKeyFromValue):
887         (WebCore::getNthValueOnKeyPath):
888         (WebCore::internalCreateIDBKeyFromScriptValueAndKeyPath):
889         (WebCore::ensureNthValueOnKeyPath):
890         (WebCore::canInjectNthValueOnKeyPath):
891         (WebCore::injectIDBKeyIntoScriptValue):
892         (WebCore::maybeCreateIDBKeyFromScriptValueAndKeyPath):
893         (WebCore::canInjectIDBKeyIntoScriptValue):
894         (WebCore::deserializeIDBValueToJSValue):
895         (WebCore::scriptValueToIDBKey):
896         (WebCore::createKeyPathArray):
897         * bindings/js/IDBBindingUtilities.h:
898
899 2016-06-03  Benjamin Poulain  <benjamin@webkit.org>
900
901         Rename CheckedRadioButtons into RadioButtonGroups
902         https://bugs.webkit.org/show_bug.cgi?id=158326
903
904         Reviewed by Alex Christensen.
905
906         CheckedRadioButtons handles the set of all the Radio Button Groups
907         for a particular form or document.
908         The name is wrong and apparently comes from former uses of this class
909         (see the comment above the class declaration).
910
911         This patch renames "CheckedRadioButtons" to "RadioButtonGroups" to reflect that it handles
912         all the Radio Button Group from a given context (form or document).
913         Internally it has a set of RadioButtonGroup but that is never explicitely
914         exposed.
915
916         * CMakeLists.txt:
917         * WebCore.xcodeproj/project.pbxproj:
918         * dom/CheckedRadioButtons.cpp:
919         (WebCore::RadioButtonGroup::isEmpty): Deleted.
920         (WebCore::RadioButtonGroup::isRequired): Deleted.
921         (WebCore::RadioButtonGroup::checkedButton): Deleted.
922         (WebCore::RadioButtonGroup::RadioButtonGroup): Deleted.
923         (WebCore::RadioButtonGroup::isValid): Deleted.
924         (WebCore::RadioButtonGroup::members): Deleted.
925         (WebCore::RadioButtonGroup::setCheckedButton): Deleted.
926         (WebCore::RadioButtonGroup::add): Deleted.
927         (WebCore::RadioButtonGroup::updateCheckedState): Deleted.
928         (WebCore::RadioButtonGroup::requiredAttributeChanged): Deleted.
929         (WebCore::RadioButtonGroup::remove): Deleted.
930         (WebCore::RadioButtonGroup::updateValidityForAllButtons): Deleted.
931         (WebCore::RadioButtonGroup::contains): Deleted.
932         (WebCore::CheckedRadioButtons::CheckedRadioButtons): Deleted.
933         (WebCore::CheckedRadioButtons::~CheckedRadioButtons): Deleted.
934         (WebCore::CheckedRadioButtons::addButton): Deleted.
935         (WebCore::CheckedRadioButtons::groupMembers): Deleted.
936         (WebCore::CheckedRadioButtons::updateCheckedState): Deleted.
937         (WebCore::CheckedRadioButtons::requiredAttributeChanged): Deleted.
938         (WebCore::CheckedRadioButtons::checkedButtonForGroup): Deleted.
939         (WebCore::CheckedRadioButtons::isInRequiredGroup): Deleted.
940         (WebCore::CheckedRadioButtons::removeButton): Deleted.
941         * dom/RadioButtonGroups.cpp: Renamed from Source/WebCore/dom/CheckedRadioButtons.cpp.
942         (WebCore::RadioButtonGroup::isEmpty):
943         (WebCore::RadioButtonGroup::isRequired):
944         (WebCore::RadioButtonGroup::checkedButton):
945         (WebCore::RadioButtonGroup::RadioButtonGroup):
946         (WebCore::RadioButtonGroup::isValid):
947         (WebCore::RadioButtonGroup::members):
948         (WebCore::RadioButtonGroup::setCheckedButton):
949         (WebCore::RadioButtonGroup::add):
950         (WebCore::RadioButtonGroup::updateCheckedState):
951         (WebCore::RadioButtonGroup::requiredAttributeChanged):
952         (WebCore::RadioButtonGroup::remove):
953         (WebCore::RadioButtonGroup::updateValidityForAllButtons):
954         (WebCore::RadioButtonGroup::contains):
955         (WebCore::RadioButtonGroups::RadioButtonGroups):
956         (WebCore::RadioButtonGroups::~RadioButtonGroups):
957         (WebCore::RadioButtonGroups::addButton):
958         (WebCore::RadioButtonGroups::groupMembers):
959         (WebCore::RadioButtonGroups::updateCheckedState):
960         (WebCore::RadioButtonGroups::requiredAttributeChanged):
961         (WebCore::RadioButtonGroups::checkedButtonForGroup):
962         (WebCore::RadioButtonGroups::isInRequiredGroup):
963         (WebCore::RadioButtonGroups::removeButton):
964         * dom/RadioButtonGroups.h: Renamed from Source/WebCore/dom/CheckedRadioButtons.h.
965         * html/FormController.h:
966         (WebCore::FormController::radioButtonGroups):
967         (WebCore::FormController::checkedRadioButtons): Deleted.
968         * html/HTMLFormElement.h:
969         * html/HTMLInputElement.cpp:
970         (WebCore::HTMLInputElement::~HTMLInputElement):
971         (WebCore::HTMLInputElement::setChecked):
972         (WebCore::HTMLInputElement::didMoveToNewDocument):
973         (WebCore::HTMLInputElement::requiredAttributeChanged):
974         (WebCore::HTMLInputElement::isInRequiredRadioButtonGroup):
975         (WebCore::HTMLInputElement::radioButtonGroup):
976         (WebCore::HTMLInputElement::checkedRadioButtonForGroup):
977         (WebCore::HTMLInputElement::radioButtonGroups):
978         (WebCore::HTMLInputElement::addToRadioButtonGroup):
979         (WebCore::HTMLInputElement::removeFromRadioButtonGroup):
980         (WebCore::HTMLInputElement::checkedRadioButtons): Deleted.
981         * html/HTMLInputElement.h:
982
983 2016-06-03  Chris Dumez  <cdumez@apple.com>
984
985         Unreviewed, roll out r196633 as it broke PageCache on iOS for WebKit.org
986         <rdar://problem/26521101>
987
988         * dom/Document.cpp:
989         (WebCore::Document::setInPageCache): Deleted.
990         * history/CachedPage.cpp:
991         (WebCore::CachedPage::restore):
992         (WebCore::CachedPage::clear):
993         * history/CachedPage.h:
994         (WebCore::CachedPage::markForVisitedLinkStyleRecalc):
995         (WebCore::CachedPage::markForFullStyleRecalc):
996         * history/PageCache.cpp:
997         (WebCore::PageCache::markPagesForVisitedLinkStyleRecalc):
998         (WebCore::PageCache::markPagesForFullStyleRecalc):
999         * history/PageCache.h:
1000         * page/Frame.cpp:
1001         (WebCore::Frame::setPageAndTextZoomFactors):
1002         * page/Page.cpp:
1003         (WebCore::Page::setViewScaleFactor):
1004         (WebCore::Page::setDeviceScaleFactor):
1005         (WebCore::Page::setPagination):
1006         (WebCore::Page::setPaginationLineGridEnabled):
1007         (WebCore::Page::setVisitedLinkStore):
1008
1009 2016-06-03  Antoine Quint  <graouts@apple.com>
1010
1011         Reflection of element does not respect backdrop-filter property
1012         https://bugs.webkit.org/show_bug.cgi?id=158201
1013
1014         Reviewed by Dean Jackson.
1015
1016         We weren't cloning the PlatformCALayer for the backdrop so reflections would simply
1017         not show their backdrops. We now follow the same pattern as other PlatformCALayers
1018         owned by a GraphicsLayerCA and keep a list of backdrop layer clones that we add
1019         to the structural layer when cloning to match the layer order of the original
1020         and update the backdrop layer clone properties to match the original when the
1021         backdrop filters or rectangle changes.
1022
1023         Tests: css3/filters/backdrop/backdrop-filter-with-reflection-add-backdrop.html
1024                css3/filters/backdrop/backdrop-filter-with-reflection-remove-backdrop.html
1025                css3/filters/backdrop/backdrop-filter-with-reflection-value-change.html
1026                css3/filters/backdrop/backdrop-filter-with-reflection.html
1027
1028         * platform/graphics/ca/GraphicsLayerCA.cpp:
1029         (WebCore::GraphicsLayerCA::updateBackdropFilters):
1030         (WebCore::GraphicsLayerCA::updateBackdropFiltersRect):
1031         Update backdrop layer clones to match new values set when the backdrop filter
1032         configuration changes.
1033
1034         (WebCore::GraphicsLayerCA::ensureCloneLayers):
1035         Create the backdrop layer clones map if needed and clone the existing backdrop layer.
1036
1037         (WebCore::GraphicsLayerCA::clearClones):
1038         Clear the backdrop layer clones map.
1039
1040         (WebCore::GraphicsLayerCA::fetchCloneLayers):
1041         Obtain a clone for the backdrop layer, and if we have a valid clone, add it to the
1042         structural layer clone as its first child to match the operation in updateSublayerList().
1043
1044         * platform/graphics/ca/GraphicsLayerCA.h:
1045         Modify the signature for ensureCloneLayers() to account for the new backdrop layer clone and
1046         declare the backdrop layer clone map.
1047
1048         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
1049         (PlatformCALayerCocoa::clone):
1050         Reflect the backdrop layer type when cloning a PlatformCALayer.
1051
1052 2016-06-03  Brady Eidson  <beidson@apple.com>
1053
1054         ResourceResponseBase cleanup.
1055         https://bugs.webkit.org/show_bug.cgi?id=158348
1056
1057         Reviewed by Chris Dumez.
1058
1059         No new tests (Refactor, no behavior change).
1060
1061         CrossThreadData can be noncopyable and WTFMove()'ed around, instead of 
1062         being in a unique_ptr.
1063         
1064         * platform/network/ResourceResponseBase.cpp:
1065         (WebCore::ResourceResponseBase::crossThreadData):
1066         (WebCore::ResourceResponseBase::fromCrossThreadData):
1067         * platform/network/ResourceResponseBase.h:
1068
1069 2016-06-03  Antoine Quint  <graouts@apple.com>
1070
1071         REGRESSION: WebGL doesn't show up in CSS reflections
1072         https://bugs.webkit.org/show_bug.cgi?id=76489
1073
1074         Reviewed by Dean Jackson.
1075
1076         The WebGLLayer needs to notify its owning GraphicsLayer that it was displayed
1077         such that its clones, in GraphicsLayerCA::layerDidDisplay, may have their contents
1078         updated to match that layer's contents. The test at compositing/webgl/webgl-reflection.html
1079         already covers this test and its expectation on Mac has been updated.
1080
1081         * platform/graphics/mac/WebGLLayer.mm:
1082         (-[WebGLLayer display]):
1083
1084 2016-06-02  Gavin Barraclough  <barraclough@apple.com>
1085
1086         Refactor showModalDialog handling in JSDOMWindowCustom
1087         https://bugs.webkit.org/show_bug.cgi?id=158294
1088
1089         Reviewed by Ryosuke Niwa.
1090
1091         The showModalDialog property is currently implemented in a way that  effectively
1092         results in duplication of the tail of the function, but modified to call
1093         Base::getOwnPropertySlot instead of getStaticPropertySlot. It does so based on the
1094         assumption that Base::getOwnPropertySlot is not going to search the static tables
1095         (containing the property we wish to omit).
1096
1097         However as a part of bug #158178 I plan to change it such that Base::getOwnPropertySlot
1098         does also search the static tables. So, refactoring this code to no longer depend on
1099         using a function that bypasses the static tables. Always perform a lookup that will
1100         check both property storage & static tables. If the object does contain the property,
1101         then check explicitly for the value we're intending to suppress.
1102
1103         Covered by exsiting tests.
1104
1105         * bindings/js/JSDOMWindowCustom.cpp:
1106         (WebCore::JSDOMWindow::getOwnPropertySlot):
1107             - Check result of getStaticPropertySlot for showModalDialog function.
1108
1109 2016-06-02  Brady Eidson  <beidson@apple.com>
1110
1111         Fix AtomicString regression caused by r201603.
1112         https://bugs.webkit.org/show_bug.cgi?id=158338
1113
1114         Reviewed by Chris Dumez.
1115
1116         No new tests (Refactor, plus already caught by existing test configs).
1117
1118         * loader/WorkerThreadableLoader.cpp:
1119         (WebCore::WorkerThreadableLoader::MainThreadBridge::didReceiveResponse):
1120         
1121         * platform/network/ResourceResponseBase.cpp:
1122         (WebCore::ResourceResponseBase::crossThreadData): Re-introduce the cross thread data concept,
1123           but more modern and clean this time.
1124         (WebCore::ResourceResponseBase::fromCrossThreadData):
1125         (WebCore::ResourceResponseBase::isolatedCopy): Deleted.
1126         * platform/network/ResourceResponseBase.h:
1127
1128 2016-06-02  Chris Dumez  <cdumez@apple.com>
1129
1130         Drop BlobRegistryContext class as it is no longer needed
1131         https://bugs.webkit.org/show_bug.cgi?id=158328
1132
1133         Reviewed by Brady Eidson.
1134
1135         Drop BlobRegistryContext class as it is no longer needed. We can now
1136         call isolatedCopy() as we capture in the lambda.
1137
1138         * fileapi/ThreadableBlobRegistry.cpp:
1139         (WebCore::ThreadableBlobRegistry::registerFileBlobURL):
1140         (WebCore::ThreadableBlobRegistry::registerBlobURL):
1141         (WebCore::ThreadableBlobRegistry::registerBlobURLForSlice):
1142         (WebCore::ThreadableBlobRegistry::blobSize):
1143         (WebCore::ThreadableBlobRegistry::unregisterBlobURL):
1144         (WebCore::BlobRegistryContext::BlobRegistryContext): Deleted.
1145
1146 2016-06-02  Zalan Bujtas  <zalan@apple.com>
1147
1148         Repaint issue with vertical text in an out of flow container.
1149         https://bugs.webkit.org/show_bug.cgi?id=102665
1150         <rdar://problem/26605298>
1151
1152         Reviewed by David Hyatt.
1153
1154         Since the renderer’s offset for positioned objects is always physical, we only
1155         need to flip the repaint rect(always logical) for writing root, when we see the first positioned object.
1156         All subsequent writing root changes for positioned objects are okay and they don't need flipping.
1157
1158         Test: fast/repaint/vertical-text-repaint.html
1159
1160         * rendering/RenderBox.cpp:
1161         (WebCore::RenderBox::computeRectForRepaint):
1162         * rendering/RenderBox.h:
1163         (WebCore::RenderBox::computeRectForRepaint):
1164         * rendering/RenderInline.cpp:
1165         (WebCore::RenderInline::computeRectForRepaint):
1166         * rendering/RenderInline.h:
1167         (WebCore::RenderInline::computeRectForRepaint):
1168         * rendering/RenderObject.cpp:
1169         (WebCore::RenderObject::computeRectForRepaint):
1170         * rendering/RenderObject.h:
1171         (WebCore::RenderObject::computeAbsoluteRepaintRect):
1172         (WebCore::RenderObject::computeRectForRepaint):
1173         * rendering/RenderTableCell.cpp:
1174         (WebCore::RenderTableCell::computeRectForRepaint):
1175         * rendering/RenderTableCell.h:
1176         * rendering/RenderView.cpp:
1177         (WebCore::RenderView::computeRectForRepaint):
1178         * rendering/RenderView.h:
1179         * rendering/svg/RenderSVGForeignObject.cpp:
1180         (WebCore::RenderSVGForeignObject::computeRectForRepaint):
1181         * rendering/svg/RenderSVGForeignObject.h:
1182         * rendering/svg/RenderSVGRoot.cpp:
1183         (WebCore::RenderSVGRoot::computeFloatRectForRepaint):
1184         * rendering/svg/RenderSVGText.cpp:
1185         (WebCore::RenderSVGText::computeRectForRepaint):
1186         * rendering/svg/RenderSVGText.h:
1187
1188 2016-06-02  Anders Carlsson  <andersca@apple.com>
1189
1190         Fix build
1191         https://bugs.webkit.org/show_bug.cgi?id=158337
1192         rdar://problem/26429419
1193
1194         Reviewed by Dan Bernstein.
1195
1196         * WebCore.xcodeproj/project.pbxproj:
1197         Add QTKitSPI.h header.
1198
1199         * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
1200         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
1201         * platform/graphics/mac/MediaTimeQTKit.h:
1202         * platform/graphics/mac/MediaTimeQTKit.mm:
1203         * platform/mac/WebVideoFullscreenController.mm:
1204         Include QTKitSPI.h.
1205
1206         * platform/spi/cocoa/QuartzCoreSPI.h:
1207         * platform/spi/mac/AVFoundationSPI.h:
1208         Use MAX_ALLOWED instead of MIN_REQUIRED.
1209
1210         * platform/spi/mac/QTKitSPI.h:
1211         Add new QTKit header.
1212
1213 2016-06-02  Said Abou-Hallawa  <sabouhallawa@apple,com>
1214
1215         [iOS] PDFDocumentImage should not create a cached image larger than 4M pixels
1216         https://bugs.webkit.org/show_bug.cgi?id=157857
1217
1218         Reviewed by Darin Adler.
1219
1220         On iOS, if the scaled size of the PDFDocumentImage cached image will exceed
1221         the 4M pixels limit and the system physical memory is 1GB or less, do not
1222         create it. PDFDocumentImage::draw() falls back peacefully if the cached image
1223         couldn't be created for any reason. The PDF will be drawn directly to the
1224         GraphicsContext without having to go through the cached image. This means
1225         the whole PDF will be drawn multiple times; one time for each tile. I think
1226         this is okay for zooming a large PDFDocumentImage on a low end device.
1227         
1228         * html/canvas/CanvasRenderingContext2D.cpp:
1229         (WebCore::CanvasRenderingContext2D::drawTextInternal): Call the static function
1230         ImageBuffer::createCompatibleBuffer() without having to go through the GraphicsContext.
1231         
1232         * platform/graphics/BitmapImage.cpp:
1233         (WebCore::BitmapImage::drawPattern): Ditto.
1234         
1235         * platform/graphics/FloatSize.h:
1236         (WebCore::FloatSize::area): A helper function similar to IntSize::area().
1237         (WebCore::operator*): Scale a FloatSize by another FloatSize and return the result.
1238         
1239         * platform/graphics/GradientImage.cpp:
1240         (WebCore::GradientImage::drawPattern): Call ImageBuffer::createCompatibleBuffer().
1241         
1242         * platform/graphics/GraphicsContext.cpp:
1243         (WebCore::GraphicsContext::scaleFactor):: Return the scaling part of the current CTM.
1244         (WebCore::scalesMatch): Deleted.
1245         (WebCore::GraphicsContext::createCompatibleBuffer): Deleted.
1246         (WebCore::GraphicsContext::isCompatibleWithBuffer): Deleted.
1247         * platform/graphics/GraphicsContext.h:
1248         Move these image buffer functions to ImageBuffer.
1249         
1250         * platform/graphics/ImageBuffer.cpp:
1251         (WebCore::ImageBuffer::createCompatibleBuffer): Make createCompatibleBuffer
1252         a static function of the ImageBuffer. There is no need to go through the
1253         GraphicsContext just to get the GraphicsContext scaleFactor.
1254         
1255         (WebCore::ImageBuffer::compatibleBufferSize):  Scale the size of the cachedImage
1256         by the scaleFactor of the context.
1257         
1258         (WebCore::ImageBuffer::isCompatibleWithContext): Returns true if the drawing
1259         context and the ImageBuffer context have the same scaleFactor.
1260         
1261         * platform/graphics/ImageBuffer.h:
1262         
1263         * platform/graphics/NamedImageGeneratedImage.cpp:
1264         (WebCore::NamedImageGeneratedImage::drawPattern): Call ImageBuffer::createCompatibleBuffer().
1265         
1266         * platform/graphics/cg/PDFDocumentImage.cpp:
1267         (WebCore::PDFDocumentImage::updateCachedImageIfNeeded): On iOS, if the
1268         physical memory is less than 1GB, do not allocate more than 16MB for the
1269         PDF cachedImage.
1270         
1271         * rendering/RenderBoxModelObject.cpp:
1272         (WebCore::RenderBoxModelObject::paintFillLayerExtended): Call ImageBuffer::createCompatibleBuffer().
1273         * rendering/svg/SVGRenderingContext.cpp:
1274         (WebCore::SVGRenderingContext::bufferForeground): Ditto.
1275
1276 2016-06-02  Chris Dumez  <cdumez@apple.com>
1277
1278         [WebIDL] 'undefined' should be an acceptable value for nullable parameters
1279         https://bugs.webkit.org/show_bug.cgi?id=158321
1280
1281         Reviewed by Ryosuke Niwa.
1282
1283         'undefined' should be an acceptable value for nullable parameters (and
1284         should be converted to null):
1285         - https://heycam.github.io/webidl/#es-nullable-type
1286
1287         Our bindings got most of the cases right but there was a bug in our
1288         overload resolution code. This patch fixes it.
1289
1290         No new tests, already covered by existing tests.
1291
1292         * bindings/scripts/CodeGeneratorJS.pm:
1293         (GenerateParametersCheckExpression):
1294         * bindings/scripts/test/JS/JSTestObj.cpp:
1295         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod):
1296         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter):
1297
1298 2016-06-02  Brady Eidson  <beidson@apple.com>
1299
1300         Modernize how many platform/network classes do isolatedCopy().
1301         https://bugs.webkit.org/show_bug.cgi?id=158313
1302
1303         Reviewed by Alex Christensen.
1304
1305         No new tests (Refactor, no behavior change).
1306
1307         * loader/WorkerThreadableLoader.h:
1308         
1309         * platform/network/FormData.cpp:
1310         (WebCore::FormData::isolatedCopy):
1311         (WebCore::FormDataElement::isolatedCopy):
1312         (WebCore::FormData::FormData): Deleted.
1313         (WebCore::FormData::deepCopy): Deleted.
1314         * platform/network/FormData.h:
1315         
1316         * platform/network/HTTPHeaderMap.cpp:
1317         (WebCore::HTTPHeaderMap::isolatedCopy):
1318         (WebCore::HTTPHeaderMap::copyData): Deleted.
1319         (WebCore::HTTPHeaderMap::adopt): Deleted.
1320         * platform/network/HTTPHeaderMap.h:
1321         
1322         * platform/network/ResourceErrorBase.cpp:
1323         (WebCore::ResourceErrorBase::asResourceError):
1324         (WebCore::ResourceErrorBase::isolatedCopy):
1325         * platform/network/ResourceErrorBase.h:
1326         (WebCore::ResourceErrorBase::platformCopy): Deleted.
1327
1328         * platform/network/ResourceLoadTiming.h:
1329         (WebCore::ResourceLoadTiming::isolatedCopy): Not strictly needed for now, but makes it obvious
1330           that changes will be needed if new members are added later.
1331
1332         * platform/network/ResourceRequestBase.cpp:
1333         (WebCore::ResourceRequestBase::isolatedCopy):
1334         (WebCore::ResourceRequestBase::setAsIsolatedCopy):
1335         (WebCore::ResourceRequestBase::copyData): Deleted.
1336         * platform/network/ResourceRequestBase.h:
1337         
1338         * platform/network/ResourceResponseBase.cpp:
1339         (WebCore::ResourceResponseBase::isolatedCopy):
1340         (WebCore::ResourceResponseBase::copyData): Deleted.
1341         * platform/network/ResourceResponseBase.h:
1342         (WebCore::CrossThreadResourceResponseDataBase::CrossThreadResourceResponseDataBase): Deleted.
1343         
1344         * platform/network/cf/ResourceError.h:
1345         * platform/network/cf/ResourceErrorCF.cpp:
1346         (WebCore::ResourceError::doPlatformIsolatedCopy):
1347         (WebCore::ResourceError::platformCopy): Deleted.
1348         
1349         * platform/network/cf/ResourceRequest.h:
1350         * platform/network/cf/ResourceRequestCFNet.cpp:
1351         (WebCore::ResourceRequest::doPlatformSetAsIsolatedCopy):
1352         (WebCore::ResourceRequest::doPlatformCopyData): Deleted.
1353         (WebCore::ResourceRequest::doPlatformAdopt): Deleted.
1354         
1355         * platform/network/cf/ResourceResponse.h:
1356         (WebCore::ResourceResponse::doPlatformCopyData): Deleted.
1357         (WebCore::ResourceResponse::doPlatformAdopt): Deleted.
1358         
1359         * platform/network/curl/ResourceError.h:
1360         (WebCore::ResourceError::doPlatformIsolatedCopy):
1361         
1362         * platform/network/curl/ResourceRequest.h:
1363         (WebCore::ResourceRequest::doPlatformSetAsIsolatedCopy):
1364         (WebCore::ResourceRequest::doPlatformCopyData): Deleted.
1365         (WebCore::ResourceRequest::doPlatformAdopt): Deleted.
1366         
1367         * platform/network/curl/ResourceResponse.h:
1368         (WebCore::ResourceResponse::doPlatformCopyData): Deleted.
1369         (WebCore::ResourceResponse::doPlatformAdopt): Deleted.
1370         
1371         * platform/network/mac/ResourceErrorMac.mm:
1372         (WebCore::ResourceError::doPlatformIsolatedCopy):
1373         
1374         * platform/network/soup/ResourceError.h:
1375         * platform/network/soup/ResourceErrorSoup.cpp:
1376         (WebCore::ResourceError::doPlatformIsolatedCopy):
1377         (WebCore::ResourceError::platformCopy): Deleted.
1378         
1379         * platform/network/soup/ResourceRequest.h:
1380         (WebCore::ResourceRequest::doPlatformSetAsIsolatedCopy):
1381         (WebCore::ResourceRequest::doPlatformCopyData): Deleted.
1382         (WebCore::ResourceRequest::doPlatformAdopt): Deleted.
1383         
1384         * platform/network/soup/ResourceResponse.h:
1385         (WebCore::ResourceResponse::doPlatformCopyData): Deleted.
1386         (WebCore::ResourceResponse::doPlatformAdopt): Deleted.
1387
1388 2016-06-02  Chris Dumez  <cdumez@apple.com>
1389
1390         Crash under CachedResource::addClientToSet()
1391         https://bugs.webkit.org/show_bug.cgi?id=158310
1392         <rdar://problem/23643359>
1393
1394         Reviewed by Eric Carlson.
1395
1396         Only call CachedResource::addClient() on the resource returned
1397         by CachedResourceLoader::requestMedia() if the resource is
1398         non-null. CachedResourceLoader::requestMedia() can return null
1399         in some cases so we need to handle this properly.
1400
1401         No new tests, no known reproduction case.
1402
1403         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
1404         (WebCore::WebCoreAVFResourceLoader::startLoading):
1405
1406 2016-06-02  Chris Dumez  <cdumez@apple.com>
1407
1408         ScriptExecutionContext::Task constructor should take a NoncopyableFunction<void ()> as parameter
1409         https://bugs.webkit.org/show_bug.cgi?id=158309
1410
1411         Reviewed by Brady Eidson.
1412
1413         ScriptExecutionContext::Task constructor should take a NoncopyableFunction<void ()>
1414         as parameter for consistency with the other constructor and because this can be
1415         called cross-thread.
1416
1417         * Modules/webaudio/AudioContext.cpp:
1418         (WebCore::AudioContext::suspend):
1419         (WebCore::AudioContext::resume):
1420         (WebCore::AudioContext::close):
1421         (WebCore::AudioContext::suspendPlayback):
1422         (WebCore::AudioContext::mayResumePlayback):
1423         * Modules/webaudio/AudioDestinationNode.h:
1424         (WebCore::AudioDestinationNode::resume):
1425         (WebCore::AudioDestinationNode::suspend):
1426         (WebCore::AudioDestinationNode::close):
1427         * Modules/webaudio/DefaultAudioDestinationNode.cpp:
1428         (WebCore::DefaultAudioDestinationNode::resume):
1429         (WebCore::DefaultAudioDestinationNode::suspend):
1430         (WebCore::DefaultAudioDestinationNode::close):
1431         * Modules/webaudio/DefaultAudioDestinationNode.h:
1432         * dom/ScriptExecutionContext.h:
1433         (WebCore::ScriptExecutionContext::Task::Task):
1434
1435 2016-06-02  Darin Adler  <darin@apple.com>
1436
1437         Fix a couple of mistakes in CSSParserValue memory management
1438         https://bugs.webkit.org/show_bug.cgi?id=158307
1439         <rdar://problem/26127225>
1440
1441         Reviewed by Daniel Bates.
1442
1443         * css/CSSGrammar.y.in: Added a destructor for calc_func_term. This presumably
1444         fixes some memory leaks in error cases. Removed an assertion about not needing
1445         a call to destroy that was far too limited. Tweaked formatting of the percentage
1446         ase in the key production. Indented calc_func_term to make it consistent with
1447         other productions nearby.
1448
1449         * css/CSSParserValues.cpp:
1450         (WebCore::CSSParserValueList::~CSSParserValueList): Use a modern for loop.
1451         (WebCore::CSSParserValueList::deleteValueAt): Deleted. Unused function, and also
1452         would have resulted in a memory leak unless the code already extracted the value
1453         from the list.
1454         (WebCore::CSSParserValueList::extend): Properly transfer ownership from one value
1455         list to the other by setting the unit to 0 in the donor.
1456
1457         * css/CSSParserValues.h: Removed unused deleteValueAt function.
1458
1459 2016-06-02  Said Abou-Hallawa  <sabouhallawa@apple.com>
1460
1461         SVG content renders in incorrect vertical position when padding-left is not specified
1462         https://bugs.webkit.org/show_bug.cgi?id=158234
1463
1464         Reviewed by Darin Adler.
1465
1466         Fix the optimization in RenderSVGRoot::buildLocalToBorderBoxTransform().
1467         Use LayoutSize::isZero() instead of LayoutSize::isEmpty() to decide whether
1468         there is borderAndPadding applied or not.
1469
1470         Test: svg/custom/svg-root-padding-individual.html
1471
1472         * rendering/svg/RenderSVGRoot.cpp:
1473         (WebCore::RenderSVGRoot::buildLocalToBorderBoxTransform):
1474
1475 2016-06-02  Brady Eidson  <beidson@apple.com>
1476
1477         Overhaul cross-thread use of ResourceRequest, ResourceResponse, and ResourceError.
1478         https://bugs.webkit.org/show_bug.cgi?id=158293
1479
1480         Reviewed by Darin Adler.
1481
1482         No new tests (Refactor, no behavior change).
1483
1484         * loader/WorkerThreadableLoader.cpp:
1485         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
1486         (WebCore::WorkerThreadableLoader::MainThreadBridge::didReceiveResponse):
1487         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFail):
1488         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFailAccessControlCheck):
1489
1490         * loader/cache/MemoryCache.cpp:
1491         (WebCore::MemoryCache::removeRequestFromSessionCaches):
1492
1493         * platform/network/ResourceErrorBase.cpp:
1494         (WebCore::ResourceErrorBase::isolatedCopy):
1495         (WebCore::ResourceErrorBase::copy): Deleted.
1496         * platform/network/ResourceErrorBase.h:
1497
1498         * platform/network/ResourceRequestBase.cpp:
1499         (WebCore::ResourceRequestBase::isolatedCopy):
1500         (WebCore::ResourceRequestBase::setAsIsolatedCopy):
1501         (WebCore::ResourceRequestBase::adopt): Deleted.
1502         
1503         Made copyData private, and made "adopt" be "isolatedCopy".
1504         Rest of the changes are all re-indenting the file.
1505         * platform/network/ResourceRequestBase.h:
1506         (WebCore::ResourceRequestBase::responseContentDispositionEncodingFallbackArray):
1507         (WebCore::ResourceRequestBase::reportUploadProgress):
1508         (WebCore::ResourceRequestBase::setReportUploadProgress):
1509         (WebCore::ResourceRequestBase::reportLoadTiming):
1510         (WebCore::ResourceRequestBase::setReportLoadTiming):
1511         (WebCore::ResourceRequestBase::reportRawHeaders):
1512         (WebCore::ResourceRequestBase::setReportRawHeaders):
1513         (WebCore::ResourceRequestBase::hiddenFromInspector):
1514         (WebCore::ResourceRequestBase::setHiddenFromInspector):
1515         (WebCore::ResourceRequestBase::requester):
1516         (WebCore::ResourceRequestBase::setRequester):
1517         (WebCore::ResourceRequestBase::encodingRequiresPlatformData):
1518         (WebCore::ResourceRequestBase::ResourceRequestBase):
1519         (WebCore::ResourceRequestBase::platformCompare):
1520         (WebCore::operator==):
1521         (WebCore::operator!=):
1522
1523         * platform/network/ResourceResponseBase.cpp:
1524         (WebCore::ResourceResponseBase::isolatedCopy):
1525         (WebCore::ResourceResponseBase::adopt): Deleted.
1526         * platform/network/ResourceResponseBase.h:
1527
1528         * platform/network/cf/ResourceError.h:
1529         (WebCore::ResourceError::isolatedCopy): Deleted.
1530
1531         Removed platform-specific isolatedCopy, and re-indented the header:
1532         * platform/network/cf/ResourceRequest.h:
1533         (WebCore::ResourceRequest::ResourceRequest):
1534         (WebCore::ResourceRequest::encodingRequiresPlatformData):
1535         (WebCore::ResourceRequest::cachePartition):
1536         (WebCore::ResourceRequest::setCachePartition):
1537         (WebCore::ResourceRequest::setDomainForCachePartition):
1538         (WebCore::ResourceRequest::resourcePrioritiesEnabled):
1539         (WebCore::ResourceRequest::isolatedCopy): Deleted.
1540
1541         * platform/network/cf/ResourceResponse.h:
1542         (WebCore::ResourceResponse::isolatedCopy): Deleted.
1543
1544 2016-06-02  Chris Dumez  <cdumez@apple.com>
1545
1546         Modernize various lambda captures
1547         https://bugs.webkit.org/show_bug.cgi?id=158292
1548
1549         Reviewed by Brady Eidson.
1550
1551         Modernize various lambda captures, especially the ones unnecessarily
1552         allocating objects on the heap and destroying them in the lambda.
1553
1554         * Modules/websockets/ThreadableWebSocketChannelClientWrapper.cpp:
1555         (WebCore::ThreadableWebSocketChannelClientWrapper::didConnect):
1556         (WebCore::ThreadableWebSocketChannelClientWrapper::didReceiveMessage):
1557         (WebCore::ThreadableWebSocketChannelClientWrapper::didReceiveBinaryData):
1558         (WebCore::ThreadableWebSocketChannelClientWrapper::didUpdateBufferedAmount):
1559         (WebCore::ThreadableWebSocketChannelClientWrapper::didStartClosingHandshake):
1560         (WebCore::ThreadableWebSocketChannelClientWrapper::didClose):
1561         (WebCore::ThreadableWebSocketChannelClientWrapper::didReceiveMessageError):
1562         (WebCore::ThreadableWebSocketChannelClientWrapper::processPendingTasks):
1563         (WebCore::ThreadableWebSocketChannelClientWrapper::resume): Deleted.
1564         * Modules/websockets/WorkerThreadableWebSocketChannel.cpp:
1565         (WebCore::WorkerThreadableWebSocketChannel::Bridge::disconnect):
1566         * bindings/js/JSCallbackData.h:
1567         (WebCore::DeleteCallbackDataTask::DeleteCallbackDataTask):
1568         * loader/WorkerThreadableLoader.cpp:
1569         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
1570         (WebCore::WorkerThreadableLoader::MainThreadBridge::destroy):
1571         (WebCore::WorkerThreadableLoader::MainThreadBridge::didSendData):
1572         (WebCore::WorkerThreadableLoader::MainThreadBridge::didReceiveResponse):
1573         (WebCore::WorkerThreadableLoader::MainThreadBridge::didReceiveData):
1574         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishLoading):
1575         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFail):
1576         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFailAccessControlCheck):
1577         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFailRedirectCheck):
1578         (WebCore::WorkerThreadableLoader::MainThreadBridge::cancel): Deleted.
1579
1580 2016-06-02  Adam Bergkvist  <adam.bergkvist@ericsson.com>
1581
1582         WebRTC: Update RTCPeerConnection.addTrack() to create (or reuse) an RTCRtpTransceiver
1583         https://bugs.webkit.org/show_bug.cgi?id=158191
1584
1585         Reviewed by Eric Carlson.
1586
1587         Update RTCPeerConnection.addTrack to create an RTCRtpTranscevier, or reuse an existing
1588         transceiver that has not been used to send [1].
1589
1590         A new RtpTransceiverSet type is added that wraps a vector of RTCRtpTransceiver objects
1591         and internally maintains two lists for efficient access to RTCRtpSender and RTCRtpReceiver
1592         objects.
1593
1594         [1] https://w3c.github.io/webrtc-pc/archives/20160513/webrtc.html#dom-rtcpeerconnection-addtrack
1595
1596         Updated existing test: fast/mediastream/RTCPeerConnection-add-removeTrack.html
1597
1598         * Modules/mediastream/PeerConnectionBackend.h:
1599         * Modules/mediastream/RTCPeerConnection.cpp:
1600         (WebCore::RTCPeerConnection::addTrack):
1601         (WebCore::RTCPeerConnection::removeTrack):
1602         (WebCore::RTCPeerConnection::completeAddTransceiver):
1603         (WebCore::RTCPeerConnection::close):
1604         * Modules/mediastream/RTCPeerConnection.h:
1605         * Modules/mediastream/RTCRtpTransceiver.cpp:
1606         (WebCore::RtpTransceiverSet::append):
1607         * Modules/mediastream/RTCRtpTransceiver.h:
1608         (WebCore::RtpTransceiverSet::list):
1609         (WebCore::RtpTransceiverSet::getSenders):
1610         (WebCore::RtpTransceiverSet::getReceivers):
1611
1612 2016-06-02  Youenn Fablet  <youenn.fablet@crf.canon.fr>
1613
1614         Use more references in ResourceLoader related code
1615         https://bugs.webkit.org/show_bug.cgi?id=158222
1616
1617         Reviewed by Darin Adler.
1618
1619         No change of behavior.
1620
1621         * css/CSSFontFaceSource.cpp:
1622         (WebCore::CSSFontFaceSource::load):
1623         * css/CSSFontSelector.cpp:
1624         (WebCore::CSSFontSelector::clearDocument):
1625         (WebCore::CSSFontSelector::beginLoadingFontSoon):
1626         (WebCore::CSSFontSelector::beginLoadTimerFired):
1627         * css/CSSFontSelector.h:
1628         * loader/DocumentLoader.cpp:
1629         (WebCore::DocumentLoader::scheduleArchiveLoad):
1630         * loader/DocumentLoader.h:
1631         * loader/LoaderStrategy.h:
1632         * loader/NetscapePlugInStreamLoader.cpp:
1633         (WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader):
1634         (WebCore::NetscapePlugInStreamLoader::create):
1635         * loader/NetscapePlugInStreamLoader.h:
1636         * loader/ResourceLoader.cpp:
1637         (WebCore::ResourceLoader::ResourceLoader):
1638         (WebCore::ResourceLoader::start):
1639         * loader/ResourceLoader.h:
1640         * loader/SubresourceLoader.cpp:
1641         (WebCore::SubresourceLoader::RequestCountTracker::RequestCountTracker):
1642         (WebCore::SubresourceLoader::SubresourceLoader):
1643         (WebCore::SubresourceLoader::create):
1644         (WebCore::SubresourceLoader::didReceiveResponse):
1645         (WebCore::SubresourceLoader::notifyDone):
1646         * loader/SubresourceLoader.h:
1647         * loader/appcache/ApplicationCacheHost.cpp:
1648         (WebCore::ApplicationCacheHost::maybeLoadResource):
1649         * loader/appcache/ApplicationCacheHost.h:
1650         * loader/cache/CachedResource.cpp:
1651         (WebCore::CachedResource::load):
1652         * loader/cache/CachedResourceLoader.cpp:
1653         (WebCore::CachedResourceLoader::incrementRequestCount):
1654         (WebCore::CachedResourceLoader::decrementRequestCount):
1655         * loader/cache/CachedResourceLoader.h:
1656
1657 2016-06-02  Carlos Garcia Campos  <cgarcia@igalia.com>
1658
1659         [Wayland] PlatformDisplayWayland destructor is super crashy
1660         https://bugs.webkit.org/show_bug.cgi?id=157973
1661
1662         Reviewed by Michael Catanzaro.
1663
1664         EGL registers two at exist callbacks one to finish the display and another one to unload drivers, the one to
1665         finish the display happens first. When our destructor is called the _eglFiniDisplay callback has already been
1666         called, so we have a valid pointer for an already finished display. Then eglTerminate tries to find the display
1667         in the global display list, but fails and for some reason it crashes when trying to return an error.
1668         If atexit is called after the global PlatformDisplay constructor, the atexit handler is called before the
1669         destructor. The atexit callbacks are called in reverse order, so if we register an atexit handler after the
1670         global instace has been created and after EGL has been initialized, we could terminate the EGL display before
1671         the EGL atexit handlers and the global PlatformDisplay destructor.
1672
1673         * platform/graphics/PlatformDisplay.cpp:
1674         (WebCore::PlatformDisplay::initializeEGLDisplay):
1675
1676 2016-06-01  Brady Eidson  <beidson@apple.com>
1677
1678         Get rid of StringCapture.
1679         https://bugs.webkit.org/show_bug.cgi?id=158285
1680
1681         Reviewed by Chris Dumez.
1682
1683         No new tests (Refactor, no behavior change).
1684
1685         * dom/Document.cpp:
1686         (WebCore::Document::addConsoleMessage):
1687         (WebCore::Document::addMessage):
1688         
1689         * dom/ScriptExecutionContext.h:
1690         (WebCore::ScriptExecutionContext::AddConsoleMessageTask::AddConsoleMessageTask):
1691         
1692         * loader/DocumentLoader.cpp:
1693         (WebCore::DocumentLoader::installContentFilterUnblockHandler):
1694         
1695         * loader/WorkerThreadableLoader.cpp:
1696         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
1697         
1698         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
1699         (WebVideoFullscreenControllerContext::setExternalPlayback):
1700         
1701         * workers/WorkerGlobalScope.cpp:
1702         (WebCore::WorkerGlobalScope::addConsoleMessage):
1703         (WebCore::WorkerGlobalScope::addMessage):
1704         
1705         * workers/WorkerMessagingProxy.cpp:
1706         (WebCore::WorkerMessagingProxy::postExceptionToWorkerObject):
1707         (WebCore::WorkerMessagingProxy::postConsoleMessageToWorkerObject):
1708
1709 2016-05-31  Darin Adler  <darin@apple.com>
1710
1711         Audit RenderObject casts and fix problems and style issues found
1712         https://bugs.webkit.org/show_bug.cgi?id=158221
1713
1714         Reviewed by Chris Dumez.
1715
1716         * bindings/objc/DOM.mm:
1717         (-[DOMElement image]): Use auto to get more specific types in code getting
1718         the renderer for an element instead of dumbing down the type to RenderObject.
1719
1720         * dom/Element.cpp:
1721         (WebCore::Element::scrollByUnits): Call renderer only once. The comment in
1722         Node advises we should do this since it has a branch in it.
1723         (WebCore::Element::absoluteEventBounds): Call renderer only once. Also use
1724         auto for a rect type to clarify that we are not changing the type of the
1725         rect returned by the fucntion.
1726         (WebCore::Element::webkitGetRegionFlowRanges): Call renderer only once.
1727
1728         * editing/CompositeEditCommand.cpp:
1729         (WebCore::CompositeEditCommand::addBlockPlaceholderIfNeeded): Use auto
1730         to get a mroe specific renderer type.
1731
1732         * editing/SimplifyMarkupCommand.cpp:
1733         (WebCore::SimplifyMarkupCommand::doApply): Call renderer only once.
1734
1735         * editing/cocoa/HTMLConverter.mm:
1736         (HTMLConverter::_addAttachmentForElement): Add an obviously missing
1737         null check for something that is null checked elsewhere.
1738         (fileWrapperForURL): Ditto.
1739         (fileWrapperForElement): Changed argument type to HTMLImageElement& since
1740         the call site already checks the type of the object. Use HTMLImageElement::src
1741         instead of repeating the code here. Check the type of the renderer instead of
1742         assuming it's a RenderImage.
1743         (WebCore::editingAttributedStringFromRange): Pass a reference, not a pointer.
1744
1745         * html/HTMLAnchorElement.cpp:
1746         (WebCore::appendServerMapMousePosition): Take a reference to an event rather
1747         than a "known to be non-null" pointer. Call renderer only once. Round the
1748         floating point values rather than truncating them.
1749         (WebCore::HTMLAnchorElement::handleClick): Pass a reference.
1750
1751         * html/HTMLAttachmentElement.cpp:
1752         (WebCore::HTMLAttachmentElement::setFile): Removed the now-unneeded cast since
1753         the renderer function returns a pointer of a more specific type now.
1754         (WebCore::HTMLAttachmentElement::parseAttribute): Ditto.
1755         (WebCore::HTMLAttachmentElement::attachmentTitle): Use auto& to avoid a bit of
1756         reference count churn.
1757
1758         * html/HTMLAttachmentElement.h: Override renderer to return a more specific type.
1759         This follows the pattern that ContainerNode::renderer uses.
1760
1761         * html/HTMLButtonElement.h: Ditto.
1762
1763         * html/HTMLCanvasElement.cpp: Gave the constants at the top of the file more
1764         normal names. Removed unneeded "static" from them. Moved the
1765         defaultInterpolationQuality constant here from the header because it doesn't
1766         need to be there.
1767         (WebCore::HTMLCanvasElement::HTMLCanvasElement): Updated for name changes.
1768         (WebCore::HTMLCanvasElement::createElementRenderer): Removed unneeded code to
1769         set m_rendererIsCanvas to record renderer type; we can just check the type.
1770         (WebCore::HTMLCanvasElement::setHeight): Updated for name changes.
1771         (WebCore::HTMLCanvasElement::setWidth): Ditto.
1772         (WebCore::HTMLCanvasElement::reset): Check the type of the renderer directly
1773         instead of calling m_rendererIsCanvas. This helped make it clear we were
1774         do extra unneeded checks since a renderer can't both be a RenderCanvas and
1775         not be a RenderBox.
1776         (WebCore::HTMLCanvasElement::createImageBuffer): Updated for name changes.
1777
1778         * html/HTMLCanvasElement.h: Moved DefaultInterpolationQuality into the cpp file.
1779         Use nullptr instead of 0. Removed m_rendererIsCanvas.
1780
1781         * html/HTMLFieldSetElement.cpp:
1782         (WebCore::HTMLFieldSetElement::HTMLFieldSetElement): Initialize m_documentVersion
1783         in the class definition.
1784         (WebCore::HTMLFieldSetElement::~HTMLFieldSetElement): Use m_hasDisabledAttribute.
1785         (WebCore::updateFromControlElementsAncestorDisabledStateUnder): Fixed typo.
1786         (WebCore::HTMLFieldSetElement::disabledAttributeChanged): Fixed mistake in this
1787         function that would cause the number of disabled fieldset elements to be too high
1788         if the disabled attribute's value was changed from one value to another. Use a
1789         boolean to track the old value; can't think of a solution that works without that.
1790         (WebCore::HTMLFieldSetElement::childrenChanged): Fixed typo.
1791         (WebCore::HTMLFieldSetElement::didMoveToNewDocument): Use m_hasDisabledAttribute.
1792         (WebCore::HTMLFieldSetElement::updateAssociatedElements): Changed name to make it
1793         clearer what this function does. Tweaked a bit without changing behavior.
1794         (WebCore::HTMLFieldSetElement::associatedElements): Updated for name change.
1795         (WebCore::HTMLFieldSetElement::length): Changed to call associatedElements instead of
1796         repeating that it does.
1797
1798         * html/HTMLFieldSetElement.h: Override renderer to return a more specific type.
1799         Also updated for other changes mentioned above.
1800
1801         * html/HTMLFrameElement.cpp:
1802         (WebCore::HTMLFrameElement::HTMLFrameElement): Initialize booleans in the class
1803         definition rather than doing it here.
1804         (WebCore::HTMLFrameElement::parseAttribute): Call renderer only once.
1805
1806         * html/HTMLFrameElement.h: Override renderer to return a more specific type.
1807         Also initialize some booleans in the class definition.
1808
1809         * html/HTMLIFrameElement.h: Override renderer to return a more specific type.
1810
1811         * html/HTMLMediaElement.cpp:
1812         (WebCore::HTMLMediaElement::updateRenderer): Added. Helper for a common idiom.
1813         (WebCore::HTMLMediaElement::didAttachRenderers): Use auto to get a more specific
1814         type for the renderer.
1815         (WebCore::HTMLMediaElement::willDetachRenderers): Call renderer only once.
1816         (WebCore::HTMLMediaElement::didRecalcStyle): Use updateRenderer to call renderer
1817         only once.
1818         (WebCore::HTMLMediaElement::loadResource): Ditto.
1819         (WebCore::HTMLMediaElement::waitForSourceChange): Ditto.
1820         (WebCore::HTMLMediaElement::noneSupported): Ditto.
1821         (WebCore::HTMLMediaElement::setReadyState): Ditto.
1822         (WebCore::HTMLMediaElement::progressEventTimerFired): Ditto.
1823         (WebCore::HTMLMediaElement::selectNextSourceChild): Renamed goto label to use a style
1824         that fits WebKit coding style. Call renderer only once in MediaQuery code.
1825         (WebCore::HTMLMediaElement::mediaPlayerRepaint): Call renderer only once.
1826         (WebCore::HTMLMediaElement::mediaPlayerSizeChanged): Use updateRenderer to call
1827         renderer only once.
1828         (WebCore::HTMLMediaElement::mediaPlayerRenderingCanBeAccelerated): Call renderer
1829         only once.
1830         (WebCore::HTMLMediaElement::mediaPlayerGraphicsDeviceAdapter): Call page only once.
1831         (WebCore::HTMLMediaElement::mediaEngineWasUpdated): Use updateRenderer to call
1832         renderer only once.
1833         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): Ditto.
1834         (WebCore::HTMLMediaElement::updatePlayState): Ditto.
1835         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer): Ditto.
1836         (WebCore::HTMLMediaElement::resume): Ditto.
1837         (WebCore::HTMLMediaElement::mediaPlayerContentBoxRect): Call renderer only once.
1838         (WebCore::mediaElementIsAllowedToAutoplay): Use auto to get a more specific type.
1839
1840         * html/HTMLMediaElement.h: Removed conditionals around forward declarations.
1841         Tweaked formatting a bit. Added the updateRender function. Override renderer to
1842         return a more specific type.
1843
1844         * html/HTMLSelectElement.cpp:
1845         (WebCore::HTMLSelectElement::optionElementChildrenChanged): Don't use the renderer
1846         just to get to the document for the AXObjectCache.
1847         (WebCore::HTMLSelectElement::setLength): Use auto for the list items vector.
1848         (WebCore::HTMLSelectElement::nextValidIndex): Ditto.
1849         (WebCore::HTMLSelectElement::firstSelectableListIndex): Ditto.
1850         (WebCore::HTMLSelectElement::nextSelectableListIndexPageAway): Ditto. Also add a
1851         null check for the renderer.
1852         (WebCore::HTMLSelectElement::updateListBoxSelection): Split an assertion with &&
1853         in it into two separate assertions. Use auto for the list items vector and use
1854         a reference for the list items.
1855         (WebCore::HTMLSelectElement::listBoxOnChange): Use auto for the list items vector
1856         and use a reference for the list items.
1857         (WebCore::HTMLSelectElement::setRecalcListItems): Don't use the renderer
1858         just to get to the document for the AXObjectCache.
1859         (WebCore::HTMLSelectElement::selectOption): Use auto for the list items vector.
1860         (WebCore::HTMLSelectElement::optionToListIndex): Ditto.
1861         (WebCore::HTMLSelectElement::listToOptionIndex): Ditto.
1862         (WebCore::HTMLSelectElement::searchOptionsForValue): Ditto.
1863         (WebCore::HTMLSelectElement::restoreFormControlState): Ditto.
1864         (WebCore::HTMLSelectElement::platformHandleKeydownEvent): Call renderer only once.
1865         (WebCore::HTMLSelectElement::menuListDefaultEventHandler): Split an assertion with
1866         && in it into two separate assertions. Use auto for the list items vector. Call
1867         renderer only once.
1868         (WebCore::HTMLSelectElement::updateSelectedState): Use a reference for the list
1869         item.
1870         (WebCore::HTMLSelectElement::listBoxDefaultEventHandler): Use auto for the list
1871         items vvector. Call renderer less often; could not quite get it down to once.
1872         (WebCore::HTMLSelectElement::defaultEventHandler): Call renderer only once.
1873         (WebCore::HTMLSelectElement::lastSelectedListIndex): Use auto for the list items
1874         vector and use a reference for the list items.
1875         (WebCore::HTMLSelectElement::optionAtIndex): Use a reference for the list item.
1876         (WebCore::HTMLSelectElement::accessKeySetSelectedIndex): Use auto for the list
1877         items vector and use a reference for the list items.
1878         (WebCore::HTMLSelectElement::length): Use auto for the list items vector.
1879
1880         * html/HTMLTextAreaElement.h: Override renderer to return a more specific type.
1881
1882         * html/HTMLVideoElement.cpp:
1883         (WebCore::HTMLVideoElement::didAttachRenderers): Call renderer only once and
1884         don't downcast it. There was no obvious type check because the renderer has a
1885         guaranteed type, but this is now clearer because it's the renderer function
1886         that returns a more specific type.
1887         (WebCore::HTMLVideoElement::parseAttribute): Ditto.
1888         (WebCore::HTMLVideoElement::setDisplayMode): Ditto.
1889
1890         * html/HTMLVideoElement.h: Override renderer to return a more specific type.
1891         * html/HTMLWBRElement.h: Ditto.
1892
1893         * html/MediaElementSession.cpp:
1894         (WebCore::MediaElementSession::canControlControlsManager): Removed
1895         unneeded typecast in code that null checks a renderer.
1896         (WebCore::isMainContent): Remove now-unneeded downcast of a renderer
1897         obtained from an HTMLMediaElement. Fixed awkward formatting by splitting
1898         an if statement into two.
1899         (WebCore::isElementLargeEnoughForMainContent): Remove now unneeded downcast
1900         of a renderer obtained from an HTMLMediaElement.
1901
1902         * html/TextFieldInputType.cpp:
1903         (WebCore::TextFieldInputType::forwardEvent): Call renderer only once.
1904         Also use auto more in the code rather than writing out types.
1905
1906         * html/shadow/SliderThumbElement.cpp:
1907         (WebCore::SliderThumbElement::setPositionFromPoint): Used the renderBox
1908         function more consistently for all the renderers used here; before,
1909         some had null checks and others did not.
1910
1911         * html/shadow/TextControlInnerElements.cpp:
1912         (WebCore::SearchFieldResultsButtonElement::defaultEventHandler): Use auto
1913         a bit more.
1914
1915         * page/EventHandler.cpp:
1916         (WebCore::enclosingScrollableArea): Removed a redundant null check and
1917         stopped using the name "element" for a local variable that was not
1918         always an element.
1919
1920         * page/PrintContext.cpp:
1921         (WebCore::enclosingBoxModelObject): Rewrote loop to be simpler and tighter.
1922         Also marked this inline since it's used only one place.
1923         (WebCore::PrintContext::pageNumberForElement): Use auto for the return
1924         value rather than writing out the type.
1925
1926         * page/SpatialNavigation.cpp:
1927         (WebCore::isScrollableNode): Tighten the code and use auto a bit.
1928
1929         * platform/ios/WebVideoFullscreenControllerAVKit.mm: Add an include of
1930         RenderVideo.h since this gets at the renderer for a video.
1931
1932         * rendering/RenderAttachment.h:
1933         (WebCore::HTMLAttachmentElement::renderer): Added. Function is here because
1934         it can only be called by code that includes this header. This matches the
1935         pattern of RenderElement.h and ContainerNode::renderer.
1936
1937         * rendering/RenderFrame.cpp: Added now-needed include.
1938
1939         * rendering/RenderFrame.h:
1940         (WebCore::HTMLFrameElement::renderer): Added. Same logic as above.
1941
1942         * rendering/RenderLayerFilterInfo.cpp:
1943         (WebCore::RenderLayer::FilterInfo::updateReferenceFilterClients): Use auto
1944         a bit and call rendeer only once.
1945
1946         * rendering/RenderMedia.h:
1947         (WebCore::HTMLMediaElement::renderer): Added. Same logic as above.
1948         * rendering/RenderTextControlMultiLine.h:
1949         (WebCore::HTMLTextAreaElement::renderer): Ditto.
1950
1951         * rendering/RenderVideo.cpp:
1952         (WebCore::placeholder): Renamed. Tightened up argument type to match what
1953         is passed at all the call sites. Use auto instead of RenderObject.
1954         (WebCore::RenderVideo::offsetLeft): Use auto and the renamed function above.
1955         (WebCore::RenderVideo::offsetTop): Ditto.
1956         (WebCore::RenderVideo::offsetWidth): Ditto.
1957         (WebCore::RenderVideo::offsetHeight): Ditto.
1958
1959         * rendering/RenderVideo.h:
1960         (WebCore::HTMLVideoElement::renderer): Added. Same logic as above.
1961
1962         * svg/SVGGElement.cpp:
1963         (WebCore::SVGGElement::createElementRenderer): Fixed typo.
1964
1965         * svg/SVGGraphicsElement.cpp:
1966         (WebCore::SVGGraphicsElement::createElementRenderer): Removed
1967         non-helpful oblique comment.
1968         * svg/SVGPathElement.cpp:
1969         (WebCore::SVGPathElement::createElementRenderer): Ditto.
1970
1971 2016-06-01  Chris Fleizach  <cfleizach@apple.com>
1972
1973         LayoutTest accessibility/ios-simulator/attributed-string-for-range.html failing on ios-simulator debug
1974         https://bugs.webkit.org/show_bug.cgi?id=158279
1975
1976         Reviewed by Alexey Proskuryakov.
1977
1978         Just use the same description for debug and release. We're not getting any benefit from having two.
1979
1980         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1981         (-[WebAccessibilityObjectWrapper description]):
1982
1983 2016-06-01  Chris Dumez  <cdumez@apple.com>
1984
1985         Use HashMap::ensure() in DocumentOrderedMap::add()
1986         https://bugs.webkit.org/show_bug.cgi?id=158283
1987
1988         Reviewed by Ryosuke Niwa.
1989
1990         Use HashMap::ensure() in DocumentOrderedMap::add() to avoid constructing
1991         a MapEntry if the key is already present in the HashMap.
1992
1993         * dom/DocumentOrderedMap.cpp:
1994         (WebCore::DocumentOrderedMap::add):
1995
1996 2016-06-01  Alexey Proskuryakov  <ap@apple.com>
1997
1998         Update QuartzCoreSPI.h for <rdar://problem/26584828>.
1999
2000         * platform/spi/cocoa/QuartzCoreSPI.h:
2001
2002 2016-06-01  Brady Eidson  <beidson@apple.com>
2003
2004         Modernize lambda usage for all callers of RunLoop::dispatch().
2005         https://bugs.webkit.org/show_bug.cgi?id=158265
2006
2007         Reviewed by Chris Dumez.
2008
2009         No new tests (Refactor, no behavior change).
2010
2011         * Modules/indexeddb/shared/InProcessIDBServer.cpp:
2012         (WebCore::InProcessIDBServer::deleteDatabase):
2013         (WebCore::InProcessIDBServer::didDeleteDatabase):
2014         (WebCore::InProcessIDBServer::openDatabase):
2015         (WebCore::InProcessIDBServer::didOpenDatabase):
2016         (WebCore::InProcessIDBServer::didAbortTransaction):
2017         (WebCore::InProcessIDBServer::didCommitTransaction):
2018         (WebCore::InProcessIDBServer::didCreateObjectStore):
2019         (WebCore::InProcessIDBServer::didDeleteObjectStore):
2020         (WebCore::InProcessIDBServer::didClearObjectStore):
2021         (WebCore::InProcessIDBServer::didCreateIndex):
2022         (WebCore::InProcessIDBServer::didDeleteIndex):
2023         (WebCore::InProcessIDBServer::didPutOrAdd):
2024         (WebCore::InProcessIDBServer::didGetRecord):
2025         (WebCore::InProcessIDBServer::didGetCount):
2026         (WebCore::InProcessIDBServer::didDeleteRecord):
2027         (WebCore::InProcessIDBServer::didOpenCursor):
2028         (WebCore::InProcessIDBServer::didIterateCursor):
2029         (WebCore::InProcessIDBServer::abortTransaction):
2030         (WebCore::InProcessIDBServer::commitTransaction):
2031         (WebCore::InProcessIDBServer::didFinishHandlingVersionChangeTransaction):
2032         (WebCore::InProcessIDBServer::createObjectStore):
2033         (WebCore::InProcessIDBServer::deleteObjectStore):
2034         (WebCore::InProcessIDBServer::clearObjectStore):
2035         (WebCore::InProcessIDBServer::createIndex):
2036         (WebCore::InProcessIDBServer::deleteIndex):
2037         (WebCore::InProcessIDBServer::putOrAdd):
2038         (WebCore::InProcessIDBServer::getRecord):
2039         (WebCore::InProcessIDBServer::getCount):
2040         (WebCore::InProcessIDBServer::deleteRecord):
2041         (WebCore::InProcessIDBServer::openCursor):
2042         (WebCore::InProcessIDBServer::iterateCursor):
2043         (WebCore::InProcessIDBServer::establishTransaction):
2044         (WebCore::InProcessIDBServer::fireVersionChangeEvent):
2045         (WebCore::InProcessIDBServer::didStartTransaction):
2046         (WebCore::InProcessIDBServer::didCloseFromServer):
2047         (WebCore::InProcessIDBServer::notifyOpenDBRequestBlocked):
2048         (WebCore::InProcessIDBServer::databaseConnectionClosed):
2049         (WebCore::InProcessIDBServer::abortOpenAndUpgradeNeeded):
2050         (WebCore::InProcessIDBServer::didFireVersionChangeEvent):
2051         (WebCore::InProcessIDBServer::openDBRequestCancelled):
2052         (WebCore::InProcessIDBServer::confirmDidCloseFromServer):
2053         (WebCore::InProcessIDBServer::getAllDatabaseNames):
2054         (WebCore::InProcessIDBServer::didGetAllDatabaseNames):
2055         
2056         * Modules/websockets/WebSocket.cpp:
2057         (WebCore::WebSocket::connect):
2058         
2059         * bindings/js/SerializedScriptValue.cpp:
2060         (WebCore::SerializedScriptValue::writeBlobsToDiskForIndexedDBSynchronously):
2061         
2062         * page/scrolling/ThreadedScrollingTree.cpp:
2063         (WebCore::ThreadedScrollingTree::invalidate):
2064         (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
2065         (WebCore::ThreadedScrollingTree::currentSnapPointIndicesDidChange):
2066         (WebCore::ThreadedScrollingTree::handleWheelEventPhase):
2067         (WebCore::ThreadedScrollingTree::setActiveScrollSnapIndices):
2068         (WebCore::ThreadedScrollingTree::deferTestsForReason):
2069         (WebCore::ThreadedScrollingTree::removeTestDeferralForReason):
2070         
2071         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2072         (WebCore::FontCache::platformPrecache):
2073         
2074         * platform/graphics/mac/DisplayRefreshMonitorMac.cpp:
2075         (WebCore::DisplayRefreshMonitorMac::displayLinkFired):
2076         
2077         * platform/network/DataURLDecoder.cpp:
2078         (WebCore::DataURLDecoder::createDecodeTask):
2079         (WebCore::DataURLDecoder::decode):
2080
2081 2016-06-01  Eric Carlson  <eric.carlson@apple.com>
2082
2083         REGRESSION(r201385) ASSERT in WebCore::HTMLMediaElement::updateActiveTextTrackCues + 5688
2084         https://bugs.webkit.org/show_bug.cgi?id=158164
2085         <rdar://problem/26498634>
2086
2087         Reviewed by Jer Noble.
2088
2089         No new tests, this prevents an assert in existing tests.
2090
2091         * html/HTMLMediaElement.cpp:
2092         (WebCore::HTMLMediaElement::~HTMLMediaElement): Call beginIgnoringTrackDisplayUpdateRequests
2093           so we avoid doing unnecessary work triggered by destruction.
2094
2095 2016-06-01  Dean Jackson  <dino@apple.com>
2096
2097         Fix iOS build.
2098
2099         * platform/spi/cg/CoreGraphicsSPI.h: No ColorSync on iOS.
2100
2101 2016-06-01  Chris Dumez  <cdumez@apple.com>
2102
2103         Crash under eventTargetRespectingTargetRules()
2104         https://bugs.webkit.org/show_bug.cgi?id=158273
2105         <rdar://problem/26343998>
2106
2107         Reviewed by Alex Christensen.
2108
2109         The code would call nodeOrHostIfPseudoElement(), which can return null
2110         and then dereference it in eventTargetRespectingTargetRules() without
2111         null check. This patch adds a null check. When the node is null, the
2112         while loop after will do nothing and thus the target will not be used.
2113
2114         No new tests, we do not have a good reproduction case.
2115
2116         * dom/EventPath.cpp:
2117         (WebCore::EventPath::EventPath):
2118
2119 2016-06-01  Commit Queue  <commit-queue@webkit.org>
2120
2121         Unreviewed, rolling out r201551 and r201552.
2122         https://bugs.webkit.org/show_bug.cgi?id=158275
2123
2124         This change caused 3 API tests to crash on ios-simulator
2125         (Requested by ryanhaddad on #webkit).
2126
2127         Reverted changesets:
2128
2129         "Precache primary font in a secondary thread"
2130         https://bugs.webkit.org/show_bug.cgi?id=158243
2131         http://trac.webkit.org/changeset/201551
2132
2133         "Remove accidental fprintf."
2134         http://trac.webkit.org/changeset/201552
2135
2136 2016-06-01  Chris Fleizach  <cfleizach@apple.com>
2137
2138         AX: iOS: VoiceOver can't access attachments in mail messages
2139         https://bugs.webkit.org/show_bug.cgi?id=158198
2140
2141         Reviewed by Joanmarie Diggs.
2142
2143         Replaced elements, like attachemnts, were not being exposed in the attributed string returned to VoiceOver.
2144         Make sure they are exposed with the attachment character, pointing to the actual element.
2145
2146         Test: accessibility/ios-simulator/attributed-string-for-range.html
2147
2148         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2149         (AccessibilityUnignoredAncestor):
2150         (-[WebAccessibilityObjectWrapper _stringForRange:attributed:]):
2151
2152 2016-06-01  Jer Noble  <jer.noble@apple.com>
2153
2154         setVideoFullscreenGravity() has no effect on the fullscreen video layer
2155         https://bugs.webkit.org/show_bug.cgi?id=158267
2156
2157         Reviewed by Eric Carlson.
2158
2159         When we moved to a 2-AVPlayerLayer solution, we didn't update setVideoFullscreenGravity()
2160         to change the correct layer's videoGravity property.
2161
2162         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2163         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenGravity):
2164
2165 2016-06-01  Alex Christensen  <achristensen@webkit.org>
2166
2167         Fix null dereferencing in ResourceTimingInformation::addResourceTiming
2168         https://bugs.webkit.org/show_bug.cgi?id=158266
2169         rdar://problem/26528466
2170
2171         Reviewed by Chris Dumez.
2172
2173         This would crash sometimes in http/tests/security/cross-frame-access-custom.html
2174
2175         * loader/ResourceTimingInformation.cpp:
2176         (WebCore::ResourceTimingInformation::addResourceTiming):
2177         * loader/ResourceTimingInformation.h:
2178         * loader/cache/CachedResourceLoader.cpp:
2179         (WebCore::CachedResourceLoader::requestResource):
2180         (WebCore::CachedResourceLoader::loadDone):
2181         We would dereference a null pointer on the first instruction when calling 
2182         Document::parentDocument from ResourceTimingInformation::addResourceTiming, 
2183         which means the document was null.  CachedResourceLoader::document even has
2184         a comment saying it can be null, so we should check it before using it.
2185
2186 2016-06-01  Said Abou-Hallawa  <sabouhallawa@apple.com>
2187
2188         SVGImage should report its memory cost to JS garbage collector
2189         https://bugs.webkit.org/show_bug.cgi?id=158139
2190
2191         Reviewed by Geoffrey Garen.
2192
2193         Like what we do in HTMLImageLoader::notifyFinished() by reporting the memory
2194         cost of the BitmapImage, we need to do something similar for the SVGImage. In
2195         SVGImage::dataChange() and when allDataReceived is true, we can calculate
2196         the size of all DOM nodes and their renderers. The size of the encoded data
2197         has to be added as well to the total memory cost. An approximation for the
2198         memory cost has to be used since it is costly to get an accurate number.
2199
2200         * bindings/js/JSDocumentCustom.cpp: 
2201         (WebCore::reportMemoryForDocumentIfFrameless): Use Node::approximateMemoryCost()
2202         instead of sizeof(Node). A Node's descendant can override this function and
2203         return a more accurate memory cost.
2204         
2205         * dom/Node.h:
2206         (WebCore::Node::approximateMemoryCost): Define this new virtual function in the
2207         Node class. Its default value is sizeof(Node) but any descendant can return a
2208         more accurate number.
2209         
2210         * platform/graphics/Image.h:
2211         (WebCore::Image::data): Define a const version of data() so it can be called
2212         the const function SVGImage::reportApproximateMemoryCost().
2213         
2214         * svg/SVGGraphicsElement.h: Override approximateMemoryCost() to return 
2215         sizeof(SVGGraphicsElement).
2216         
2217         * svg/SVGPathElement.cpp:
2218         (WebCore::SVGPathElement::approximateMemoryCost): Override this function to return
2219         the memory cost of the points and the m_path of the renderer.
2220         * svg/SVGPathElement.h:
2221         
2222         * svg/SVGPolyElement.cpp:
2223         (WebCore::SVGPolyElement::approximateMemoryCost): Override this function to return
2224         the memory cost of the points and the m_path of the renderer.
2225         * svg/SVGPolyElement.h:
2226         
2227         * svg/graphics/SVGImage.cpp:
2228         (WebCore::SVGImage::reportApproximateMemoryCost): Calculate the memory cost of the 
2229         nodes in the SVGDocument of an SVGImage. Then report this number to the JS garbage 
2230         collector.
2231         
2232         (WebCore::SVGImage::dataChanged): After loading all the SVG encoded data and building
2233         its DOM tree and the render tree, report the total memory cost to the JS garbage collector.
2234         * svg/graphics/SVGImage.h:
2235
2236 2016-06-01  Andreas Kling  <akling@apple.com>
2237
2238         Use inline capacity for StylePropertyShorthand Vectors.
2239         <https://webkit.org/b/158260>
2240
2241         Reviewed by Antti Koivisto.
2242
2243         Vector<StylePropertyShorthand> was a huge source of heap allocations,
2244         just over 0.5% of all fastMalloc() bytes on PLUM. Giving it an inline capacity
2245         of 4 turns all of it into stack allocations.
2246
2247         * css/CSSParser.cpp:
2248         (WebCore::CSSParser::addProperty):
2249         * css/CSSProperty.cpp:
2250         (WebCore::StylePropertyMetadata::shorthandID):
2251         * css/StylePropertyShorthand.cpp:
2252         (WebCore::indexOfShorthandForLonghand):
2253         * css/StylePropertyShorthand.h:
2254         * css/makeprop.pl:
2255         (constructShorthandsVector):
2256
2257 2016-06-01  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
2258
2259         POST request on a blob resource should return a "network error" instead of HTTP 500 response
2260         https://bugs.webkit.org/show_bug.cgi?id=158022
2261
2262         Reviewed by Alex Christensen.
2263
2264         Not allowed HTTP method is notified as failed in BlobResourceHandle as per Fetch
2265         specification (5.2 Basic fetch). This behavior is observable in fetch WPT tests.
2266
2267         The behavior of XHR is slightly changed for asynchronous request on a blob resource with not
2268         allowed or invalid HTTP methods. The onError callback is called instead of throwing an
2269         exception as per XHR specification (https://xhr.spec.whatwg.org/#request-error-steps).
2270
2271         WPT tests expected results have been updated for fetch tests on blob resources which are
2272         now correct.
2273
2274         Test: fast/files/xhr-blob-request.html ensures XHR response to requests on a blob resource is
2275         correct.
2276
2277         * platform/network/BlobResourceHandle.cpp:
2278         (WebCore::BlobResourceHandle::doStart):
2279         * xml/XMLHttpRequest.cpp:
2280         (WebCore::XMLHttpRequest::createRequest):
2281
2282 2016-06-01  Youenn Fablet  <youenn.fablet@crf.canon.fr>
2283
2284         Remove allocation of SubresourceLoader::m_requestCountTracker
2285         https://bugs.webkit.org/show_bug.cgi?id=158255
2286
2287         Reviewed by Chris Dumez.
2288
2289         No change of behavior.
2290
2291         Making m_requestCountTracker an Optional in lieu of a unique_ptr.
2292         This requires constructing m_requestCountTracker in place so that constructor and destructor are called only once.
2293
2294         * loader/SubresourceLoader.cpp:
2295         (WebCore::SubresourceLoader::SubresourceLoader):
2296         (WebCore::SubresourceLoader::didReceiveResponse):
2297         (WebCore::SubresourceLoader::notifyDone):
2298         * loader/SubresourceLoader.h:
2299
2300 2016-06-01  Antti Koivisto  <antti@apple.com>
2301
2302         Remove accidental fprintf.
2303
2304         * platform/graphics/FontCache.cpp:
2305         (WebCore::FontCache::precache):
2306
2307 2016-05-31  Antti Koivisto  <antti@apple.com>
2308
2309         Precache primary font in a secondary thread
2310         https://bugs.webkit.org/show_bug.cgi?id=158243
2311
2312         Reviewed by Andreas Kling.
2313
2314         We know the font families and descriptions to use on style resolution. The actual fonts are only needed for
2315         layout. There is often time to load and cache fonts asynchronously before they are accessed. This can substantially
2316         reduce font related workload in the main thread.
2317
2318         * css/CSSFontFace.cpp:
2319         (WebCore::CSSFontFace::font):
2320         (WebCore::CSSFontFace::resolveFamilies):
2321         (WebCore::CSSFontFace::hasSVGFontFaceSource):
2322         * css/CSSFontFace.h:
2323         * css/CSSFontFaceSource.cpp:
2324         (WebCore::CSSFontFaceSource::font):
2325         (WebCore::CSSFontFaceSource::url):
2326         (WebCore::CSSFontFaceSource::isSVGFontFaceSource):
2327         * css/CSSFontFaceSource.h:
2328         * css/CSSFontSelector.cpp:
2329         (WebCore::CSSFontSelector::fallbackFontAt):
2330         (WebCore::CSSFontSelector::resolveFamilies):
2331
2332             Add a function for resolving font families of a cascade to their final values.
2333
2334         * css/CSSFontSelector.h:
2335         * css/CSSSegmentedFontFace.cpp:
2336         (WebCore::CSSSegmentedFontFace::fontRanges):
2337         (WebCore::CSSSegmentedFontFace::resolveFamilies):
2338         * css/CSSSegmentedFontFace.h:
2339         * platform/graphics/FontCache.cpp:
2340         (WebCore::fontPlatformDataCache):
2341         (WebCore::precacheTasksInProgress):
2342         (WebCore::alternateFamilyName):
2343         (WebCore::FontCache::getCachedFontPlatformData):
2344         (WebCore::FontCache::invalidate):
2345         (WebCore::FontCache::precache):
2346
2347             Precache fonts by trying to load them asyncronously one by one. On success the font is cached into font platform data cache.
2348
2349         (WebCore::FontCache::similarFont):
2350         * platform/graphics/FontCache.h:
2351         * platform/graphics/FontCascade.cpp:
2352         (WebCore::pruneSystemFallbackFonts):
2353         (WebCore::precachePrimaryFamily):
2354
2355             When initializing a new font cascade resolve any platform fonts to their actual names using FontSelector,
2356             then precache the primary font for the cascade.
2357
2358             Web fonts are ignored for now.
2359
2360         (WebCore::retrieveOrAddCachedFonts):
2361         * platform/graphics/FontSelector.h:
2362         (WebCore::FontSelector::~FontSelector):
2363         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2364         (WebCore::FontCache::setFontWhitelist):
2365         (WebCore::fontWithFamily):
2366         (WebCore::autoActivateFont):
2367         (WebCore::createFontPlatformDataThreadSafe):
2368
2369             Factor thread safe part of createFontPlatformData to a function.
2370
2371         (WebCore::FontCache::createFontPlatformData):
2372
2373             Do the main thread only hash lookups here then call to createFontPlatformDataThreadSafe.
2374
2375         (WebCore::fallbackDedupSet):
2376         (WebCore::FontCache::systemFallbackForCharacters):
2377         (WebCore::FontCache::platformPrecache):
2378
2379             Try to initialize font asynchronously in a dispatch queue, call completion handler on success or failure.
2380
2381         (WebCore::FontCache::platformCancelPrecache):
2382
2383             Cancel ongoing precache operation.
2384
2385         (WebCore::platformFontLookupWithFamily): Deleted.
2386
2387             This was inlined to the only client, fontWithFamily.
2388
2389 2016-06-01  Adam Bergkvist  <adam.bergkvist@ericsson.com>
2390
2391         WebRTC: Add RTCRtpTransceiver interface and RTCPeerConnection.addTransceiver()
2392         https://bugs.webkit.org/show_bug.cgi?id=158189
2393
2394         Reviewed by Darin Adler.
2395
2396         The RTCRtpTransceiver interface represents a combination of an RTCRtpSender and an
2397         RTCRtpReceiver that share a common mid [1].
2398
2399         RTCPeerConnection.addTransceiver() [2] creates an RTCRtpTransceiver object, either directly
2400         from a MediaStreamTrack [3], or with a specific media type (kind).
2401
2402         This change introduces the RTCRtpTransceiver object, follow-up patches will integrate it
2403         into the offer/answer machinery.
2404
2405         [1] https://w3c.github.io/webrtc-pc/archives/20160513/webrtc.html#rtcrtptransceiver-interface
2406         [2] https://w3c.github.io/webrtc-pc/archives/20160513/webrtc.html#dom-rtcpeerconnection-addtransceiver
2407         [3] http://w3c.github.io/mediacapture-main/archives/20160513/getusermedia.html#mediastreamtrack
2408
2409         Test: fast/mediastream/RTCPeerConnection-addTransceiver.html
2410
2411         * CMakeLists.txt:
2412         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2413         (WebCore::MediaEndpointPeerConnection::createOfferTask):
2414         (WebCore::MediaEndpointPeerConnection::createReceiver):
2415         An RTCTransceiver always has a receiver (RTCRtpReceiver) with a track (MediaStreamTrack) that
2416         can be rendered. Before that remote track is receiving data from the remote peer, it's muted.
2417         createReceiver() uses MediaEndponit::createMutedRemoteSource() to create a source to represent
2418         future incoming media.
2419         * Modules/mediastream/MediaEndpointPeerConnection.h:
2420         * Modules/mediastream/PeerConnectionBackend.h:
2421         * Modules/mediastream/RTCPeerConnection.cpp:
2422         (WebCore::RTCPeerConnection::addTransceiver):
2423         (WebCore::RTCPeerConnection::completeAddTransceiver):
2424         (WebCore::RTCPeerConnection::addReceiver): Deleted.
2425         We now create the receiver explicitly with createReceiver.
2426         * Modules/mediastream/RTCPeerConnection.h:
2427         * Modules/mediastream/RTCPeerConnection.idl:
2428         * Modules/mediastream/RTCRtpSender.cpp:
2429         (WebCore::RTCRtpSender::create):
2430         (WebCore::RTCRtpSender::RTCRtpSender):
2431         (WebCore::RTCRtpSender::setTrack):
2432         (WebCore::RTCRtpSender::replaceTrack):
2433         * Modules/mediastream/RTCRtpSender.h:
2434         (WebCore::RTCRtpSender::trackId):
2435         (WebCore::RTCRtpSender::trackKind):
2436         (WebCore::RTCRtpSender::setMediaStreamIds):
2437         (WebCore::RTCRtpSender::isStopped):
2438         (WebCore::RTCRtpSender::create): Deleted.
2439         * Modules/mediastream/RTCRtpSenderReceiverBase.h:
2440         (WebCore::RTCRtpSenderReceiverBase::track):
2441         (WebCore::RTCRtpSenderReceiverBase::RTCRtpSenderReceiverBase):
2442         * Modules/mediastream/RTCRtpTransceiver.cpp: Added.
2443         (WebCore::RTCRtpTransceiver::create):
2444         (WebCore::RTCRtpTransceiver::getNextMid):
2445         (WebCore::RTCRtpTransceiver::RTCRtpTransceiver):
2446         (WebCore::RTCRtpTransceiver::directionString):
2447         (WebCore::RTCRtpTransceiver::hasSendingDirection):
2448         (WebCore::RTCRtpTransceiver::enableSendingDirection):
2449         (WebCore::RTCRtpTransceiver::disableSendingDirection):
2450         * Modules/mediastream/RTCRtpTransceiver.h: Added.
2451         (WebCore::RTCRtpTransceiver::~RTCRtpTransceiver):
2452         (WebCore::RTCRtpTransceiver::direction):
2453         (WebCore::RTCRtpTransceiver::setDirection):
2454         (WebCore::RTCRtpTransceiver::provisionalMid):
2455         (WebCore::RTCRtpTransceiver::setProvisionalMid):
2456         (WebCore::RTCRtpTransceiver::mid):
2457         (WebCore::RTCRtpTransceiver::setMid):
2458         (WebCore::RTCRtpTransceiver::sender):
2459         (WebCore::RTCRtpTransceiver::receiver):
2460         (WebCore::RTCRtpTransceiver::stopped):
2461         (WebCore::RTCRtpTransceiver::stop):
2462         * Modules/mediastream/RTCRtpTransceiver.idl: Added.
2463         * WebCore.xcodeproj/project.pbxproj:
2464         * platform/mediastream/MediaEndpoint.h:
2465         Added createMutedRemoteSource() that creates a muted remote source that will become unmuted
2466         when media arrives from the remote peer.
2467         * platform/mediastream/RealtimeMediaSource.cpp:
2468         (WebCore::RealtimeMediaSource::RealtimeMediaSource): Deleted.
2469         * platform/mediastream/RealtimeMediaSource.h:
2470         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
2471         (WebCore::MockRealtimeVideoSource::create):
2472         Use Ref instead of RefPtr.
2473         * platform/mock/MockMediaEndpoint.cpp:
2474         (WebCore::MockMediaEndpoint::createMutedRemoteSource):
2475         * platform/mock/MockMediaEndpoint.h:
2476         * platform/mock/MockRealtimeAudioSource.cpp:
2477         (WebCore::MockRealtimeAudioSource::create):
2478         (WebCore::MockRealtimeAudioSource::createMuted):
2479         (WebCore::MockRealtimeAudioSource::MockRealtimeAudioSource):
2480         * platform/mock/MockRealtimeAudioSource.h:
2481         * platform/mock/MockRealtimeVideoSource.cpp:
2482         (WebCore::MockRealtimeVideoSource::create):
2483         (WebCore::MockRealtimeVideoSource::createMuted):
2484         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource):
2485         * platform/mock/MockRealtimeVideoSource.h:
2486
2487 2016-06-01  Per Arne Vollan  <pvollan@apple.com>
2488
2489         [Win][IndexedDB] Crash when running blob test.
2490         https://bugs.webkit.org/show_bug.cgi?id=158224
2491
2492         Reviewed by Brady Eidson.
2493
2494         Avoid calling WTFMove(x) before calling x->method().
2495
2496         * Modules/indexeddb/IDBTransaction.cpp:
2497         (WebCore::IDBTransaction::putOrAddOnServer):
2498
2499 2016-06-01  Manuel Rego Casasnovas  <rego@igalia.com>
2500
2501         [css-grid] Positioned items can be placed on the implicit grid
2502         https://bugs.webkit.org/show_bug.cgi?id=158197
2503
2504         Reviewed by Sergio Villar Senin.
2505
2506         The old code wrongly assumed that positioned items couldn't be placed
2507         on the implicit grid. However, the spec doesn't mention anything about this.
2508
2509         The patch fixes this issue, so now positioned items can be actually
2510         placed on the implicit tracks.
2511
2512         Test: fast/css-grid-layout/grid-positioned-items-within-grid-implicit-track.html
2513
2514         * rendering/RenderGrid.cpp:
2515         (WebCore::RenderGrid::offsetAndBreadthForPositionedChild): Use the lines
2516         of the implicit grid instead of the explicit one.
2517
2518 2016-05-31  Chris Dumez  <cdumez@apple.com>
2519
2520         Modernize lambda captures in WorkerThreadableWebSocketChannel
2521         https://bugs.webkit.org/show_bug.cgi?id=158246
2522
2523         Reviewed by Brady Eidson.
2524
2525         Modernize lambda captures in WorkerThreadableWebSocketChannel and drop
2526         legacy URLCapture as it is no longer needed / used.
2527
2528         * Modules/websockets/WorkerThreadableWebSocketChannel.cpp:
2529         (WebCore::WorkerThreadableWebSocketChannel::Peer::send):
2530         (WebCore::WorkerThreadableWebSocketChannel::Peer::bufferedAmount):
2531         (WebCore::WorkerThreadableWebSocketChannel::Peer::didConnect):
2532         (WebCore::WorkerThreadableWebSocketChannel::Peer::didReceiveMessage):
2533         (WebCore::WorkerThreadableWebSocketChannel::Peer::didReceiveBinaryData):
2534         (WebCore::WorkerThreadableWebSocketChannel::Peer::didUpdateBufferedAmount):
2535         (WebCore::WorkerThreadableWebSocketChannel::Peer::didStartClosingHandshake):
2536         (WebCore::WorkerThreadableWebSocketChannel::Peer::didClose):
2537         (WebCore::WorkerThreadableWebSocketChannel::Peer::didReceiveMessageError):
2538         (WebCore::WorkerThreadableWebSocketChannel::Bridge::mainThreadInitialize):
2539         (WebCore::WorkerThreadableWebSocketChannel::Bridge::initialize):
2540         (WebCore::WorkerThreadableWebSocketChannel::Bridge::connect):
2541         (WebCore::WorkerThreadableWebSocketChannel::Bridge::send):
2542         (WebCore::WorkerThreadableWebSocketChannel::Bridge::bufferedAmount):
2543         (WebCore::WorkerThreadableWebSocketChannel::Bridge::close):
2544         (WebCore::WorkerThreadableWebSocketChannel::Bridge::fail):
2545         (WebCore::WorkerThreadableWebSocketChannel::Bridge::disconnect):
2546         (WebCore::WorkerThreadableWebSocketChannel::Bridge::suspend):
2547         (WebCore::WorkerThreadableWebSocketChannel::Bridge::resume):
2548         (WebCore::WorkerThreadableWebSocketChannel::Bridge::setMethodNotCompleted): Deleted.
2549         (WebCore::WorkerThreadableWebSocketChannel::Bridge::waitForMethodCompletion): Deleted.
2550         * Modules/websockets/WorkerThreadableWebSocketChannel.h:
2551         * platform/URL.h:
2552         (WebCore::operator==): Deleted.
2553
2554 2016-05-31  Joseph Pecoraro  <pecoraro@apple.com>
2555
2556         Web Inspector: ReportExtraMemoryCost IDL attribute should also be used to generate estimatedSize method
2557         https://bugs.webkit.org/show_bug.cgi?id=158144
2558
2559         Reviewed by Darin Adler.
2560
2561         * bindings/scripts/CodeGeneratorJS.pm:
2562         (InstanceNeedsEstimatedSize):
2563         (GenerateHeader):
2564         (GenerateImplementation):
2565         When an interface includes ReportExtraMemoryCost, generate an estimatedSize
2566         method which includes the Base::estimatedSize and the memoryCost().
2567
2568         * bindings/scripts/test/GObject/WebKitDOMInterfaceName.cpp: Added.
2569         (WebKit::kit):
2570         (WebKit::core):
2571         (WebKit::wrapInterfaceName):
2572         (webkit_dom_interface_name_finalize):
2573         (webkit_dom_interface_name_constructor):
2574         (webkit_dom_interface_name_class_init):
2575         (webkit_dom_interface_name_init):
2576         * bindings/scripts/test/GObject/WebKitDOMInterfaceName.h: Added.
2577         * bindings/scripts/test/GObject/WebKitDOMInterfaceNamePrivate.h: Added.
2578         * bindings/scripts/test/JS/JSInterfaceName.cpp: Added.
2579         (WebCore::JSInterfaceNamePrototype::create):
2580         (WebCore::JSInterfaceNamePrototype::createStructure):
2581         (WebCore::JSInterfaceNamePrototype::JSInterfaceNamePrototype):
2582         (WebCore::JSInterfaceNameConstructor::prototypeForStructure):
2583         (WebCore::JSInterfaceNameConstructor::initializeProperties):
2584         (WebCore::JSInterfaceNamePrototype::finishCreation):
2585         (WebCore::JSInterfaceName::JSInterfaceName):
2586         (WebCore::JSInterfaceName::createPrototype):
2587         (WebCore::JSInterfaceName::prototype):
2588         (WebCore::JSInterfaceName::destroy):
2589         (WebCore::jsInterfaceNameConstructor):
2590         (WebCore::setJSInterfaceNameConstructor):
2591         (WebCore::JSInterfaceName::getConstructor):
2592         (WebCore::JSInterfaceName::visitChildren):
2593         (WebCore::JSInterfaceName::estimatedSize):
2594         (WebCore::JSInterfaceNameOwner::isReachableFromOpaqueRoots):
2595         (WebCore::JSInterfaceNameOwner::finalize):
2596         (WebCore::toJSNewlyCreated):
2597         (WebCore::toJS):
2598         (WebCore::JSInterfaceName::toWrapped):
2599         * bindings/scripts/test/JS/JSInterfaceName.h: Added.
2600         (WebCore::JSInterfaceName::create):
2601         (WebCore::JSInterfaceName::createStructure):
2602         (WebCore::JSInterfaceName::finishCreation):
2603         (WebCore::wrapperOwner):
2604         (WebCore::wrapperKey):
2605         (WebCore::toJS):
2606         (WebCore::toJSNewlyCreated):
2607         * bindings/scripts/test/ObjC/DOMInterfaceName.h: Added.
2608         * bindings/scripts/test/ObjC/DOMInterfaceName.mm: Added.
2609         (-[DOMInterfaceName dealloc]):
2610         (core):
2611         (kit):
2612         * bindings/scripts/test/ObjC/DOMInterfaceNameInternal.h: Added.
2613         * bindings/scripts/test/TestReportExtraMemoryCost.idl: Added.
2614         Include a test for the ReportExtraMemoryCost attribute.
2615
2616 2016-05-31  Alex Christensen  <achristensen@webkit.org>
2617
2618         Fix assertion after r201447
2619         https://bugs.webkit.org/show_bug.cgi?id=158244
2620
2621         Reviewed by Jer Noble.
2622
2623         * loader/cache/CachedResourceLoader.cpp:
2624         (WebCore::CachedResourceLoader::loadResource):
2625         If we are loading media using WebCoreNSURLSession, we could be making a request for a
2626         resource we already have in the memory cache because we are ignoring all caches.
2627
2628 2016-05-31  Chris Dumez  <cdumez@apple.com>
2629
2630         Clean up / modernize iOS text autosizing code
2631         https://bugs.webkit.org/show_bug.cgi?id=158217
2632
2633         Reviewed by Darin Adler.
2634
2635         Clean up / modernize iOS text autosizing code.
2636
2637         I think iOS text autosizing code is too intrusive inside the RenderStyle
2638         class but I have not updated this part of the code yet to limit patch
2639         size. This patch focuses on the TextAutoSizing.* and text autosizing
2640         code in the Document class.
2641
2642         * WebCore.xcodeproj/project.pbxproj:
2643         * dom/Document.cpp:
2644         (WebCore::TextAutoSizingTraits::constructDeletedValue): Deleted.
2645         (WebCore::TextAutoSizingTraits::isDeletedValue): Deleted.
2646         Move TextAutoSizingTraits to the TextAutoSizing header to
2647         promote reuse and make the text autosizing code a little less
2648         intrusive.
2649
2650         (WebCore::Document::addAutoSizingNode):
2651         - Drop local 'key' variable as it is only used once.
2652         - Use std::make_unique<> to construct the TextAutoSizingValue
2653           as it is no longer ref-counted.
2654
2655         (WebCore::Document::validateAutoSizingNodes):
2656         Iterate over the textAutosizedNodes HashMap only once instead
2657         of twice. TextAutoSizingValue::adjustTextNodeSizes() was updated
2658         to return an enum class so we know from that value if we can
2659         remove the value from the HashSet or not, without having to rely
2660         on TextAutoSizingValue::numNodes(), which I removed in this
2661         patch.
2662
2663         (WebCore::Document::clearAutoSizingNodes):
2664         Updated the TextAutoSizingValue destructor to call reset() so
2665         we don't have to explicitly call reset() on each value before
2666         clearing the textAutosizedNodes HashMap.
2667
2668         * dom/Document.h:
2669         - Move TextAutoSizingTraits to the TextAutosizing header.
2670         - Rename resetAutosizingNodes() to clearAutoSizingNodes() as
2671           the method now only clears the textAutosizedNodes HashMap
2672           and reset() is now an implementation detail for
2673           TextAutoSizingValue.
2674
2675         * rendering/RenderElement.cpp:
2676         (WebCore::RenderElement::resetTextAutosizing):
2677         Call clearAutoSizingNodes() as it was renamed.
2678
2679         * rendering/TextAutoSizing.cpp:
2680         (WebCore::TextAutoSizingKey::TextAutoSizingKey):
2681         - Use value of -1 for std::unique_ptr m_style member for distinguishing
2682         a HashTable deleted value, instead of having an extra m_isDeleted
2683         data member for this purpose.
2684         - Take RenderStyle parameter by reference and drop the null check as the
2685           call site can never pass nullptr.
2686
2687         (WebCore::TextAutoSizingValue::addTextNode):
2688         - Rename addNode() to addTextNode() for clarity.
2689
2690         (WebCore::TextAutoSizingValue::~TextAutoSizingValue):
2691         Update destructor to call reset() so that the Document does not have to
2692         call it explicitly and can instead just clear the HashMap, which will
2693         destroy the TextAutoSizingValue objects.
2694
2695         (WebCore::TextAutoSizingValue::reset):
2696         Rename text to renderer for clarity.
2697
2698         * rendering/TextAutoSizing.h:
2699         - Make TextAutoSizingValue as fast allocated.
2700         - Update TextAutoSizingValue to no longer be refcounted as ownership is never
2701           shared. The Document owns those.
2702         - Drop the factory function for TextAutoSizingValue and make the constructor
2703           public now that the class is no longer refcounted.
2704         - Make reset() method private now that it is called from the destructor and
2705           the Document is no longer expected to explicitly call it.
2706         - Update adjustTextNodeSizes() to return a StillHasNodes enum class and the
2707           Document can rely on the determine if it can drop the TextAutoSizingValue
2708           from its HashMap (and therefore destroy the object).
2709         - Drop numNodes() method as it is no longer needed.
2710
2711
2712 2016-05-31  Dave Hyatt  <hyatt@apple.com>
2713
2714         REGRESSION(r201040): Repainting of moving overflow:hidden objects is broken.
2715         https://bugs.webkit.org/show_bug.cgi?id=158079
2716
2717         Reviewed by Zalan Bujtas.
2718
2719         Added new test fast/repaint/overflow-hidden-movement.html
2720
2721         Change checkForRepaintDuringLayout() to only be true for self-painting layers
2722         and not for all layers.
2723
2724         * rendering/RenderObject.cpp:
2725         (WebCore::RenderObject::hasSelfPaintingLayer):
2726         (WebCore::RenderObject::checkForRepaintDuringLayout):
2727         * rendering/RenderObject.h:
2728         (WebCore::RenderObject::hasSelfPaintingLayer):
2729
2730 2016-05-31  Zalan Bujtas  <zalan@apple.com>
2731
2732         ShowRenderTree: Print location information for relative/sticky inlines.
2733         https://bugs.webkit.org/show_bug.cgi?id=158235
2734
2735         Reviewed by David Hyatt.
2736
2737         * rendering/RenderObject.cpp:
2738         (WebCore::RenderObject::showRenderObject):
2739
2740 2016-05-31  Jer Noble  <jer.noble@apple.com>
2741
2742         Unreviewed build fix; use ASSERT_UNUSED rather than ASSERT to fix release builds.
2743
2744         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2745         (WebCore::MediaPlayerPrivateAVFoundationObjC::removeSession):
2746
2747 2016-05-31  Jer Noble  <jer.noble@apple.com>
2748
2749         [EME] Sound continues playing when video's src is changed
2750         https://bugs.webkit.org/show_bug.cgi?id=158233
2751
2752         Reviewed by Eric Carlson.
2753
2754         When CDMSessionAVFoundation began listening for outputObscuredDueToInsufficientExternalProtection
2755         KVO notifications, it retained the AVPlayer owned by MediaPlayerPrivateAVFoundationObjC, which
2756         caused the AVPlayer to outlive its original owner, and to continue playing even after the
2757         MediaPlayerPrivateAVFoundationObjC had been destroyed.
2758
2759         Rather than observe for outputObscuredDueToInsufficientExternalProtection changes in
2760         CDMSessionAVFoundation, add a backreference from the media player to the session, listen for changes
2761         in the player, and have the player notify the session when the value of that property changes.
2762
2763         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h:
2764         (WebCore::CDMSessionAVFoundationObjC::createWeakPtr):
2765         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
2766         (WebCore::CDMSessionAVFoundationObjC::CDMSessionAVFoundationObjC):
2767         (-[WebCDMSessionAVFoundationObjCListener initWithParent:player:]): Deleted.
2768         (-[WebCDMSessionAVFoundationObjCListener invalidate]): Deleted.
2769         (-[WebCDMSessionAVFoundationObjCListener observeValueForKeyPath:ofObject:change:context:]): Deleted.
2770         (WebCore::CDMSessionAVFoundationObjC::~CDMSessionAVFoundationObjC): Deleted.
2771         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
2772         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2773         (WebCore::MediaPlayerPrivateAVFoundationObjC::removeSession):
2774         (WebCore::MediaPlayerPrivateAVFoundationObjC::createSession):
2775         (WebCore::MediaPlayerPrivateAVFoundationObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
2776         (WebCore::playerKVOProperties):
2777         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
2778
2779 2016-05-31  Eric Carlson  <eric.carlson@apple.com>
2780
2781         [Mac] AirPlay route is sometimes reset when changing video.src
2782         https://bugs.webkit.org/show_bug.cgi?id=158226
2783         <rdar://problem/24197592>
2784
2785         Reviewed by Jer Noble.
2786
2787         Test: media/airplay-autoplay.html
2788
2789         * html/HTMLMediaElement.cpp:
2790         (WebCore::HTMLMediaElement::webkitShowPlaybackTargetPicker): Remove the gesture requirement
2791           if currently processing a user gesture.
2792         (WebCore::HTMLMediaElement::dispatchEvent): Set m_failedToPlayToWirelessTarget to false when
2793           dispatching webkitcurrentplaybacktargetiswirelesschanged so an element can succeed after failing.
2794
2795 2016-05-31  Chris Dumez  <cdumez@apple.com>
2796
2797         Regression(r201482): Crash under dispatch_semaphore_wait
2798         https://bugs.webkit.org/show_bug.cgi?id=158230
2799         <rdar://problem/26534698>
2800
2801         Reviewed by Eric Carlson.
2802
2803         Stop moving hasSessionSemaphore in the lambda capture since it is used in
2804         dispatch_semaphore_wait() call after the callOnMainThread() call.
2805
2806         No new tests, already covered by tests that are crashing on the bots.
2807
2808         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2809         (-[WebAVStreamDataParserListener streamDataParser:didProvideContentKeyRequestInitializationData:forTrackID:]):
2810
2811 2016-05-31  Brady Eidson  <beidson@apple.com>
2812
2813         Make createCrossThreadTask() functions return on the stack instead of the heap.
2814         https://bugs.webkit.org/show_bug.cgi?id=158215
2815
2816         Reviewed by Darin Adler.
2817
2818         No new tests (Refactor, no change in behavior).
2819
2820         * Modules/indexeddb/client/IDBConnectionProxy.h:
2821         
2822         * Modules/indexeddb/server/IDBServer.cpp:
2823         (WebCore::IDBServer::IDBServer::postDatabaseTask):
2824         (WebCore::IDBServer::IDBServer::postDatabaseTaskReply):
2825         (WebCore::IDBServer::IDBServer::databaseRunLoop):
2826         * Modules/indexeddb/server/IDBServer.h:
2827         
2828         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2829         (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTask):
2830         (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTaskReply):
2831         * Modules/indexeddb/server/UniqueIDBDatabase.h:
2832         
2833         * dom/ScriptExecutionContext.h:
2834         (WebCore::ScriptExecutionContext::postCrossThreadTask):
2835         
2836         * fileapi/ThreadableBlobRegistry.cpp:
2837         (WebCore::threadableQueue):
2838
2839 2016-05-31  Dave Hyatt  <hyatt@apple.com>
2840
2841         REGRESSION (r189567): Elements with aspect ratios not handled correctly inside flexbox.
2842         https://bugs.webkit.org/show_bug.cgi?id=158040
2843
2844         Reviewed by Zalan Bujtas.
2845
2846         Added new tests in fast/flexbox.
2847
2848         * rendering/RenderFlexibleBox.cpp:
2849         (WebCore::RenderFlexibleBox::clientLogicalBottomAfterRepositioning):
2850         (WebCore::RenderFlexibleBox::hasOrthogonalFlow):
2851         (WebCore::RenderFlexibleBox::mainAxisContentExtent):
2852         (WebCore::RenderFlexibleBox::computeMainAxisExtentForChild):
2853         (WebCore::RenderFlexibleBox::mainAxisBorderAndPaddingExtentForChild):
2854         (WebCore::RenderFlexibleBox::mainAxisLengthIsDefinite):
2855         (WebCore::RenderFlexibleBox::mainAxisScrollbarExtentForChild):
2856         (WebCore::RenderFlexibleBox::prepareOrderIteratorAndMargins):
2857         (WebCore::RenderFlexibleBox::crossAxisLengthIsDefinite):
2858         (WebCore::RenderFlexibleBox::computeMainSizeFromAspectRatioUsing):
2859         (WebCore::RenderFlexibleBox::adjustChildSizeForAspectRatioCrossAxisMinAndMax):
2860         (WebCore::RenderFlexibleBox::useChildAspectRatio):
2861         (WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax):
2862         (WebCore::RenderFlexibleBox::resetAutoMarginsAndLogicalTopInCrossAxis):
2863         (WebCore::RenderFlexibleBox::mainAxisOverflowForChild):
2864         (WebCore::RenderFlexibleBox::mainAxisExtentIsDefinite): Deleted.
2865         (WebCore::RenderFlexibleBox::mainAxisLengthIsIndefinite): Deleted.
2866         * rendering/RenderFlexibleBox.h:
2867         (WebCore::RenderFlexibleBox::isFlexibleBoxImpl):
2868
2869 2016-05-31  Alex Christensen  <achristensen@webkit.org>
2870
2871         Build fix after r201482.
2872
2873         * platform/network/curl/CurlDownload.cpp:
2874         (WebCore::CurlDownload::didReceiveHeader):
2875         header used to be capturedHeader, which was a StringCapture, which needed .string() to get the String.
2876         Now it's a WTF::String, so we already have the String.  Hooray for c++14!
2877
2878 2016-05-31  Sergio Villar Senin  <svillar@igalia.com>
2879
2880         Unreviewed build fix.
2881
2882         * rendering/RenderGrid.cpp:
2883         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
2884         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions):
2885
2886 2016-05-25  Sergio Villar Senin  <svillar@igalia.com>
2887
2888         [css-grid] Empty grid without explicit tracks shouldn't have any size
2889         https://bugs.webkit.org/show_bug.cgi?id=155197
2890
2891         Reviewed by Darin Adler.
2892
2893         The internal representation of the grid is a Vector of Vector representing rows and
2894         columns. Because of that it was not possible to have columns without having at least one
2895         row. That forced us to have a 1x1 internal representation of the grid even if it was
2896         actually empty. That works for most of the cases except when the grid is actually empty.
2897
2898         By changing the way we compute the sizes we can overcome that implementation
2899         restriction. This allowed us also to thighten the conditions under we could use the
2900         GridIterator. From now on it won't be possible to use it on empty grids so callers should
2901         enforce that restriction.
2902
2903         A new bool was added to verify that placeItemsOnGrid() has been already called. The previous
2904         code was relying on the fact that there were items in the internal representation, which is
2905         wrong, as there might be no items in the grid.
2906
2907         Test: fast/css-grid-layout/empty-grid.html
2908
2909         * rendering/RenderGrid.cpp:
2910         (WebCore::RenderGrid::GridIterator::GridIterator): Added ASSERTs.
2911         (WebCore::RenderGrid::GridIterator::nextGridItem): Ditto.
2912         (WebCore::RenderGrid::GridIterator::isEmptyAreaEnough): Ditto.
2913         (WebCore::RenderGrid::GridIterator::nextEmptyGridArea): Ditto.
2914         (WebCore::RenderGrid::gridColumnCount): Use the style to resolve the number of columns if
2915         the internal representation is empty.
2916         (WebCore::RenderGrid::gridRowCount):
2917         (WebCore::RenderGrid::guttersSize): Allow to pass 0 as span, this permits using the return
2918         value of gridColumnCount|gridRowCount directly to call this method.
2919         (WebCore::RenderGrid::computeIntrinsicLogicalWidths): Use m_gridIsDirty.
2920         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks): Do not examine the contents of grid
2921         tracks if there are no items in the grid.
2922         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions): Ditto.
2923         (WebCore::RenderGrid::placeItemsOnGrid): Set m_gridIsDirty to false.
2924         (WebCore::RenderGrid::populateExplicitGridAndOrderIterator):
2925         (WebCore::RenderGrid::clearGrid):
2926         (WebCore::RenderGrid::populateGridPositionsForDirection):
2927         * rendering/RenderGrid.h: Moved gridColumnCount/gridRowCount to cpp file.
2928
2929 2016-05-30  Brady Eidson  <beidson@apple.com>
2930
2931         Move CrossThreadCopier/CrossThreadTask to WTF.
2932         https://bugs.webkit.org/show_bug.cgi?id=158207
2933
2934         Reviewed by Alex Christensen.
2935
2936         No new tests (Refactor, no behavior change).
2937
2938         * CMakeLists.txt:
2939         * WebCore.xcodeproj/project.pbxproj:
2940
2941         * Modules/indexeddb/IDBActiveDOMObject.h:
2942         * Modules/indexeddb/IDBValue.cpp:
2943         * Modules/indexeddb/client/IDBConnectionProxy.h:
2944         * Modules/indexeddb/server/IDBServer.cpp:
2945         * Modules/indexeddb/server/IDBServer.h:
2946         * Modules/indexeddb/server/UniqueIDBDatabase.h:
2947         * dom/ScriptExecutionContext.h:
2948         * fileapi/ThreadableBlobRegistry.cpp:
2949         
2950         * platform/WebCoreCrossThreadCopier.cpp: Added.
2951         (WTF::WebCore::SessionID>::copy):
2952         (WTF::WebCore::ThreadSafeDataBuffer>::copy):
2953         * platform/WebCoreCrossThreadCopier.h: Added.
2954         
2955         * platform/network/cf/ResourceError.h:
2956         (WebCore::ResourceError::isolatedCopy):
2957         
2958         * platform/network/cf/ResourceRequest.h:
2959         (WebCore::ResourceRequest::isolatedCopy):
2960         
2961         * platform/network/cf/ResourceResponse.h:
2962         (WebCore::ResourceResponse::isolatedCopy):
2963
2964 2016-05-30  Per Arne Vollan  <pvollan@apple.com>
2965
2966         http/tests/websocket/tests/hybi/stop-on-resume-in-error-handler.html crashes on Windows almost all the time
2967         https://bugs.webkit.org/show_bug.cgi?id=144057
2968
2969         Reviewed by Brent Fulgham.
2970
2971         Protect SocketStreamHandle object before trying to access it on the main thread, and make sure
2972         CFWriteStreamRef parameter is valid before calling CFWriteStreamCanAcceptBytes. 
2973
2974         * platform/network/cf/SocketStreamHandleCFNet.cpp:
2975         (WebCore::SocketStreamHandle::readStreamCallback):
2976         (WebCore::SocketStreamHandle::writeStreamCallback):
2977
2978 2016-05-30  Javier Fernandez  <jfernandez@igalia.com>
2979
2980         [CSS Box Alignment] New CSS Value 'normal' for Self Alignment
2981         https://bugs.webkit.org/show_bug.cgi?id=156254
2982
2983         Reviewed by Darin Adler.
2984
2985         The Box Alignment specification defines a new value 'normal' to be used
2986         as default for the different layout models, which will define the
2987         specific behavior for each case. This patch adds a new CSS value in the
2988         parsing logic and adapts the Self Alignment properties to the new
2989         value.
2990
2991         The 'auto' value is no longer valid for the 'align-items' property and
2992         the Computed Value will be always the specified value. Hence, I removed
2993         the StyleResolver logic because is not required now; the specific
2994         behavior of the 'normal' value will be resolved at layout time.
2995
2996         Additionally, this patch updates the layout logic as well, for both
2997         Flexbox and Grid layout models.
2998
2999         Test: css3/parse-alignment-of-root-elements.html
3000
3001         * css/CSSComputedStyleDeclaration.cpp:
3002         (WebCore::resolveLegacyJustifyItems): Added.
3003         (WebCore::resolveJustifyItemsAuto): Added.
3004         (WebCore::resolveJustifySelfAuto): Added.
3005         (WebCore::resolveAlignSelfAuto): Added.
3006         (WebCore::valueForItemPositionWithOverflowAlignment): Using a StyleSelfAlignmentData argument.
3007         (WebCore::ComputedStyleExtractor::propertyValue): Using the new resolving functions.
3008         * css/CSSParser.cpp:
3009         (WebCore::CSSParser::parseItemPositionOverflowPosition): A new value 'normal' is now valid.
3010         * css/CSSPrimitiveValueMappings.h:
3011         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Mappings for the new value 'normal'.
3012         (WebCore::CSSPrimitiveValue::operator ItemPosition): Mappings for the new value 'normal'.
3013         * css/CSSPropertyNames.in:
3014         * css/StyleResolver.cpp:
3015         (WebCore::StyleResolver::adjustRenderStyle): We don't need to resolve 'legacy" keyword.
3016         * rendering/RenderBox.cpp:
3017         (WebCore::flexItemHasStretchAlignment):
3018         (WebCore::RenderBox::hasStretchedLogicalWidth):
3019         * rendering/RenderFlexibleBox.cpp:
3020         (WebCore::RenderFlexibleBox::styleDidChange):
3021         (WebCore::RenderFlexibleBox::alignmentForChild):
3022         (WebCore::contentAlignmentNormalBehaviorFlexibleBox):
3023         (WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
3024         (WebCore::RenderFlexibleBox::layoutColumnReverse):
3025         (WebCore::RenderFlexibleBox::alignFlexLines):
3026         (WebCore::RenderFlexibleBox::alignChildren):
3027         * rendering/RenderGrid.cpp:
3028         (WebCore::defaultAlignmentChangedToStretchInRowAxis):
3029         (WebCore::defaultAlignmentChangedFromStretchInRowAxis):
3030         (WebCore::defaultAlignmentChangedFromStretchInColumnAxis):
3031         (WebCore::selfAlignmentChangedToStretchInRowAxis):
3032         (WebCore::selfAlignmentChangedFromStretchInRowAxis):
3033         (WebCore::selfAlignmentChangedFromStretchInColumnAxis):
3034         (WebCore::contentAlignmentNormalBehaviorGrid):
3035         (WebCore::RenderGrid::applyStretchAlignmentToTracksIfNeeded):
3036         (WebCore::RenderGrid::needToStretchChildLogicalHeight):
3037         (WebCore::RenderGrid::applyStretchAlignmentToChildIfNeeded):
3038         (WebCore::RenderGrid::columnAxisPositionForChild):
3039         (WebCore::RenderGrid::rowAxisPositionForChild):
3040         (WebCore::RenderGrid::columnAxisOffsetForChild):
3041         (WebCore::RenderGrid::rowAxisOffsetForChild):
3042         (WebCore::RenderGrid::computeContentPositionAndDistributionOffset):
3043         * rendering/style/RenderStyle.cpp:
3044         (WebCore::resolvedSelfAlignment):
3045         (WebCore::RenderStyle::resolvedAlignItems):
3046         (WebCore::RenderStyle::resolvedAlignSelf):
3047         (WebCore::RenderStyle::resolvedJustifyItems):
3048         (WebCore::RenderStyle::resolvedJustifySelf):
3049         * rendering/style/RenderStyle.h:
3050         * rendering/style/RenderStyleConstants.h:
3051         * rendering/style/StyleRareNonInheritedData.cpp:
3052         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): align-items uses now a different initial function.
3053
3054 2016-05-29  Brady Eidson  <beidson@apple.com>
3055
3056         Transition various Task/Function queues from std::function to NoncopyableFunction.
3057         https://bugs.webkit.org/show_bug.cgi?id=158196
3058
3059         Reviewed by Chris Dumez.
3060
3061         No new tests (Refactor, no behavior change).
3062
3063         * dom/ActiveDOMCallbackMicrotask.cpp:
3064         (WebCore::ActiveDOMCallbackMicrotask::ActiveDOMCallbackMicrotask):
3065         * dom/ActiveDOMCallbackMicrotask.h:
3066
3067         * html/HTMLMediaElement.cpp:
3068         (WebCore::HTMLMediaElement::layoutSizeChanged):
3069
3070         * page/FrameView.cpp:
3071         (WebCore::FrameView::queuePostLayoutCallback):
3072         (WebCore::FrameView::flushPostLayoutTasksQueue):
3073         * page/FrameView.h:
3074
3075         * platform/GenericTaskQueue.cpp:
3076         (WebCore::TaskDispatcher<Timer>::postTask):
3077         (WebCore::TaskDispatcher<Timer>::dispatchOneTask):
3078         * platform/GenericTaskQueue.h:
3079         (WebCore::TaskDispatcher::postTask):
3080         (WebCore::GenericTaskQueue::enqueueTask):
3081
3082         * style/StyleTreeResolver.cpp:
3083         (WebCore::Style::postResolutionCallbackQueue):
3084         (WebCore::Style::queuePostResolutionCallback):
3085         (WebCore::Style::suspendMemoryCacheClientCalls):
3086         * style/StyleTreeResolver.h:
3087
3088 2016-05-29  Brady Eidson  <beidson@apple.com>
3089
3090         Make ScriptExecutionContext::Task work in terms of wtf::NoncopyableFunction instead of std::function.
3091         https://bugs.webkit.org/show_bug.cgi?id=158187
3092
3093         Reviewed by Chris Dumez.
3094
3095         No new tests (Refactor, no behavior change).
3096
3097         Also make postTask take an rvalue reference.
3098
3099         * bindings/js/JSDOMGlobalObjectTask.cpp:
3100         (WebCore::JSGlobalObjectTask::JSGlobalObjectTask):
3101         
3102         * dom/Document.cpp:
3103         (WebCore::Document::postTask):
3104         * dom/Document.h:
3105         
3106         * dom/ScriptExecutionContext.h:
3107         (WebCore::ScriptExecutionContext::Task::Task):
3108         
3109         * workers/WorkerGlobalScope.cpp:
3110         (WebCore::WorkerGlobalScope::postTask):
3111         * workers/WorkerGlobalScope.h:
3112
3113 2016-05-28  Chris Dumez  <cdumez@apple.com>
3114
3115         Templatize NoncopyableFunction class similarly to std::function
3116         https://bugs.webkit.org/show_bug.cgi?id=158185
3117
3118         Reviewed by Darin Adler.
3119
3120         Templatize NoncopyableFunction class similarly to std::function, so
3121         that it can be used as a std::function replacement in more places.
3122
3123         Previously, NoncopyableFunction could only support "void()" lambdas.
3124
3125         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
3126         (WebCore::MediaEndpointPeerConnection::runTask):
3127         * Modules/mediastream/MediaEndpointPeerConnection.h:
3128         * fileapi/AsyncFileStream.cpp:
3129         (WebCore::callOnFileThread):
3130         (WebCore::AsyncFileStream::perform):
3131         (WebCore::AsyncFileStream::getSize):
3132         (WebCore::AsyncFileStream::openForRead):
3133         (WebCore::AsyncFileStream::openForWrite):
3134         (WebCore::AsyncFileStream::write):
3135         * fileapi/AsyncFileStream.h:
3136         * page/scrolling/ScrollingThread.cpp:
3137         (WebCore::ScrollingThread::dispatch):
3138         (WebCore::ScrollingThread::dispatchBarrier):
3139         (WebCore::ScrollingThread::dispatchFunctionsFromScrollingThread):
3140         * page/scrolling/ScrollingThread.h:
3141         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
3142         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3143         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::scheduleDeferredTask):
3144         * platform/mediastream/MediaStreamPrivate.cpp:
3145         (WebCore::MediaStreamPrivate::scheduleDeferredTask):
3146         * platform/mediastream/MediaStreamPrivate.h:
3147         * platform/mediastream/mac/AVMediaCaptureSource.h:
3148         * platform/mediastream/mac/AVMediaCaptureSource.mm:
3149         (WebCore::AVMediaCaptureSource::scheduleDeferredTask):
3150
3151 2016-05-28  Alexey Proskuryakov  <ap@apple.com>
3152
3153         Fix the build with newer clang and other custom configuration options
3154         https://bugs.webkit.org/show_bug.cgi?id=158161
3155
3156         Reviewed by Dan Bernstein.
3157
3158         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
3159         (WebCore::WebVideoFullscreenInterfaceMac::rateChanged): Added UNUSED_PARAMs for the
3160         case where this function is unimplemented.
3161         (WebCore::WebVideoFullscreenInterfaceMac::setExternalPlayback): Added a non-additions
3162         version of this function.
3163         * platform/spi/cf/CFNetworkSPI.h: Silence nullability-completeness (and other) warnings.
3164         I doubt that it's practical to get these right for every SDK version at this time. Added
3165         functions for overriding HTTPS certicate behavior that we used to declare in .m files.
3166         * platform/spi/mac/AVFoundationSPI.h: Define AVAssetCache conditionally.
3167
3168 2016-05-28  Ryosuke Niwa  <rniwa@webkit.org>
3169
3170         Autocorrection makes it hard to type "doesn't" and to type @ in email addresses
3171         https://bugs.webkit.org/show_bug.cgi?id=158177
3172         <rdar://problem/20490862>
3173         <rdar://problem/24707954>
3174
3175         Reviewed by Darin Adler.
3176
3177         When the user had typed "doesn'", some unified spellchecker may try to autocorrect it to "doesn't" or "does"
3178         but we should ignore this for a moment until the next character is typed by the user. The code to deal with
3179         this situation which checks the existence of an "ambiguous boundary character" was not robust when the
3180         replacement text was longer than the corrected text.
3181
3182         Fixed this bug by fixing the logic to detect this case. Also added '@' as an ambiguous boundary character
3183         since autocorrecting letters that appear right before '@' would not be useful in many cases.
3184
3185         Tests: ManualTests/autocorrection/autocorrection-at-mark.html
3186                ManualTests/autocorrection/autocorrection-contraction-2.html
3187
3188         * editing/AlternativeTextController.cpp:
3189         (WebCore::AlternativeTextController::timerFired): Fixed a bug that we can show an empty reversion panel.
3190         * editing/Editor.cpp:
3191         (WebCore::Editor::markAndReplaceFor): When the user had typed "doesn'" and our autocorrection result is
3192         "doesn't", resultEndLocation (the end of "doesn't") is larger than selectionOffset (the end of "doesn'").
3193         When the correction is "does", resultEndLocation (the end of "does") is one less than selectionOffset.
3194         Updated the condition to deal with both of these conditions as well as cases where the correction result
3195         contains more than one letter after '.
3196         * editing/htmlediting.cpp:
3197         (WebCore::isAmbiguousBoundaryCharacter): Moved from the header file since this is not a hot function and
3198         doesn't need to be inlined everywhere. Added '@' as an ambiguous boundary character.
3199         * editing/htmlediting.h:
3200         (WebCore::isAmbiguousBoundaryCharacter): Moved to the cpp file.
3201
3202 2016-05-28  Konstantin Tokarev  <annulen@yandex.ru>
3203
3204         FileSystem: use OS(WINDOWS) instead of PLATFORM(WIN).
3205         https://bugs.webkit.org/show_bug.cgi?id=158168
3206
3207         Reviewed by Darin Adler.
3208
3209         No new tests needed.
3210
3211         * platform/FileSystem.cpp:
3212         (WebCore::lastComponentOfPathIgnoringTrailingSlash):
3213         (WebCore::MappedFileData::~MappedFileData):
3214         (WebCore::MappedFileData::MappedFileData):
3215         * platform/FileSystem.h: Removed unused PlatformFilePathSeparator
3216         constant.
3217
3218 2016-05-28  Konstantin Tokarev  <annulen@yandex.ru>
3219
3220         Use COMPILER(MSVC) instead of PLATFORM(WIN) for MSVC-specific workaround
3221         https://bugs.webkit.org/show_bug.cgi?id=158169
3222
3223         Reviewed by Darin Adler.
3224
3225         No new tests needed.
3226
3227         * platform/PlatformMouseEvent.h:
3228         * platform/win/PlatformMouseEventWin.cpp: Moved operators'
3229         implementations to PlatformMouseEvent.h
3230
3231 2016-05-27  Chris Dumez  <cdumez@apple.com>
3232
3233         callOnMainThread() should not copy captured lambda variables
3234         https://bugs.webkit.org/show_bug.cgi?id=158166
3235
3236         Reviewed by Brady Eidson.
3237
3238         callOnMainThread() should not copy captured lambda variables. This 
3239         function is usually called cross-thread with a lambda and copying
3240         the lambda (and its captured variables) can lead to thread-safety
3241         issues.
3242
3243         This patch updates callOnMainThread() to take a NoncopyableFunction&&
3244         in parameter instead of a std::function. The call sites of
3245         callOnMainThread() have also been updated to use C++14's lambda
3246         capture with initializer.
3247
3248         * Modules/indexeddb/IDBTransaction.cpp:
3249         (WebCore::IDBTransaction::putOrAddOnServer):
3250         * Modules/mediastream/MediaDevicesRequest.cpp:
3251         (WebCore::MediaDevicesRequest::didCompletePermissionCheck):
3252         (WebCore::MediaDevicesRequest::didCompleteTrackSourceInfoRequest):
3253         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
3254         (WebCore::MediaEndpointPeerConnection::runTask):
3255         * Modules/mediastream/MediaEndpointPeerConnection.h:
3256         * Modules/mediastream/UserMediaRequest.cpp:
3257         (WebCore::UserMediaRequest::constraintsValidated):
3258         (WebCore::UserMediaRequest::userMediaAccessGranted):
3259         * Modules/webaudio/AudioContext.cpp:
3260         (WebCore::AudioContext::scheduleNodeDeletion):
3261         (WebCore::AudioContext::isPlayingAudioDidChange):
3262         * dom/Document.cpp:
3263         (WebCore::Document::postTask):
3264         (WebCore::Document::pendingTasksTimerFired): Deleted.
3265         * dom/ScriptElement.cpp:
3266         (WebCore::ScriptElement::requestScript):
3267         * fileapi/AsyncFileStream.cpp:
3268         (WebCore::callOnFileThread):
3269         (WebCore::AsyncFileStream::~AsyncFileStream):
3270         (WebCore::AsyncFileStream::perform):
3271         * fileapi/AsyncFileStream.h:
3272         * fileapi/ThreadableBlobRegistry.cpp:
3273         (WebCore::ThreadableBlobRegistry::registerFileBlobURL):
3274         (WebCore::ThreadableBlobRegistry::registerBlobURL):
3275         (WebCore::ThreadableBlobRegistry::registerBlobURLForSlice):
3276         (WebCore::ThreadableBlobRegistry::blobSize):
3277         (WebCore::ThreadableBlobRegistry::unregisterBlobURL):
3278         (WebCore::ThreadableBlobRegistry::registerBlobURLOptionallyFileBacked): Deleted.
3279         * loader/icon/IconDatabase.cpp:
3280         (WebCore::IconDatabase::dispatchDidImportIconURLForPageURLOnMainThread):
3281         (WebCore::IconDatabase::dispatchDidImportIconDataForPageURLOnMainThread):
3282         * page/ResourceUsageThread.cpp:
3283         (WebCore::ResourceUsageThread::notifyObservers):
3284         (WebCore::ResourceUsageThread::threadBody):
3285         * page/ResourceUsageThread.h:
3286         * page/scrolling/ScrollingThread.cpp:
3287         (WebCore::ScrollingThread::dispatch):
3288         (WebCore::ScrollingThread::dispatchBarrier):
3289         (WebCore::ScrollingThread::dispatchFunctionsFromScrollingThread):
3290         * page/scrolling/ScrollingThread.h:
3291         * page/scrolling/ios/ScrollingTreeIOS.cpp:
3292         (WebCore::ScrollingTreeIOS::invalidate):
3293         (WebCore::ScrollingTreeIOS::scrollingTreeNodeDidScroll):
3294         (WebCore::ScrollingTreeIOS::currentSnapPointIndicesDidChange):
3295         (WebCore::ScrollingTreeIOS::createScrollingTreeNode): Deleted.
3296         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
3297         (WebCore::ScrollingTreeFrameScrollingNodeMac::releaseReferencesToScrollerImpsOnTheMainThread):
3298         * platform/MemoryPressureHandler.cpp:
3299         (WebCore::MemoryPressureHandler::releaseMemory):
3300         * platform/audio/ios/MediaSessionManagerIOS.mm:
3301         (-[WebMediaSessionHelper dealloc]):
3302         (-[WebMediaSessionHelper startMonitoringAirPlayRoutes]):
3303         (-[WebMediaSessionHelper stopMonitoringAirPlayRoutes]):
3304         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
3305         (WebCore::AudioSourceProviderAVFObjC::prepare):
3306         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
3307         (WebCore::MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification):
3308         (WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification):
3309         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
3310         (-[WebCDMSessionAVFoundationObjCListener observeValueForKeyPath:ofObject:change:context:]):
3311         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
3312         (-[WebAVOutputDeviceMenuControllerHelper observeValueForKeyPath:ofObject:change:context:]):
3313         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3314         (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoLayer):
3315         (-[WebCoreAVFMovieObserver legibleOutput:didOutputAttributedStrings:nativeSampleBuffers:forItemTime:]):
3316         (-[WebCoreAVFMovieObserver outputSequenceWasFlushed:]):
3317         (-[WebCoreAVFLoaderDelegate resourceLoader:shouldWaitForLoadingOfRequestedResource:]):
3318         (-[WebCoreAVFLoaderDelegate resourceLoader:shouldWaitForResponseToAuthenticationChallenge:]):
3319         (-[WebCoreAVFLoaderDelegate resourceLoader:didCancelLoadingRequest:]):
3320         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3321         (WebCore::CMTimebaseEffectiveRateChangedCallback):
3322         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::play):
3323         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::pause):
3324         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
3325         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3326         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::scheduleDeferredTask):
3327         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3328         (-[WebAVStreamDataParserListener streamDataParser:didParseStreamDataAsAsset:]):
3329         (-[WebAVStreamDataParserListener streamDataParser:didParseStreamDataAsAsset:withDiscontinuity:]):
3330         (-[WebAVStreamDataParserListener streamDataParser:didFailToParseStreamDataWithError:]):
3331         (-[WebAVStreamDataParserListener streamDataParser:didProvideMediaData:forTrackID:mediaType:flags:]):
3332         (-[WebAVStreamDataParserListener streamDataParser:didReachEndOfTrackWithTrackID:mediaType:]):
3333         (-[WebAVStreamDataParserListener streamDataParser:didProvideContentKeyRequestInitializationData:forTrackID:]):
3334         (-[WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]):
3335         (-[WebAVSampleBufferErrorListener layerFailedToDecode:]):
3336         * platform/graphics/cg/GraphicsContextCG.cpp:
3337         (WebCore::patternReleaseCallback):
3338         * platform/graphics/cg/PatternCG.cpp:
3339         (WebCore::patternReleaseCallback):
3340         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
3341         (WebCore::MediaPlayerPrivateMediaFoundation::endCreatedMediaSource):
3342         (WebCore::MediaPlayerPrivateMediaFoundation::endGetEvent):
3343         (WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::processInputNotify):
3344         * platform/mediastream/MediaStreamPrivate.cpp:
3345         (WebCore::MediaStreamPrivate::scheduleDeferredTask):
3346         * platform/mediastream/MediaStreamPrivate.h:
3347         * platform/mediastream/mac/AVMediaCaptureSource.h:
3348         * platform/mediastream/mac/AVMediaCaptureSource.mm:
3349         (WebCore::AVMediaCaptureSource::scheduleDeferredTask):
3350         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
3351         (WebCore::RealtimeMediaSourceCenterMac::getMediaStreamTrackSources):
3352         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
3353         (WebCore::WebAudioSourceProviderAVFObjC::prepare):
3354         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
3355         (WebCore::MockRealtimeMediaSourceCenter::getMediaStreamTrackSources):
3356         * platform/network/BlobResourceHandle.cpp:
3357         (WebCore::BlobResourceHandle::start):
3358         (WebCore::BlobResourceHandle::notifyFinish):
3359         * platform/network/DataURLDecoder.cpp:
3360         (WebCore::DataURLDecoder::decode):
3361         * platform/network/DataURLDecoder.h:
3362         * platform/network/cocoa/WebCoreNSURLSession.mm:
3363         (-[WebCoreNSURLSession dealloc]):
3364         (-[WebCoreNSURLSessionDataTask cancel]):
3365         (-[WebCoreNSURLSessionDataTask suspend]):
3366         (-[WebCoreNSURLSessionDataTask resume]):
3367         * platform/network/curl/CurlDownload.cpp:
3368         (WebCore::CurlDownload::didReceiveHeader):
3369         (WebCore::CurlDownload::didReceiveData): Deleted.
3370
3371 2016-05-27  Tim Horton  <timothy_horton@apple.com>
3372
3373         REGRESSION (r190574): Swipe snapshots are always black on iPhone 5
3374         https://bugs.webkit.org/show_bug.cgi?id=158171
3375         <rdar://problem/24639709>
3376
3377         Reviewed by Beth Dakin.
3378
3379         * platform/graphics/cocoa/IOSurface.mm:
3380         (optionsForBiplanarSurface):
3381         (optionsFor32BitSurface):
3382         (IOSurface::IOSurface):
3383         (IOSurface::format):
3384         We are supposed to be using bi-planar 422f, not yuvf. They're the same
3385         size, but different formats, and 422f is supported in more places.
3386
3387         Clean up the IOSurface constructor so we don't have a switch inside an if
3388         with random ASSERT_NOT_REACHED, making helper functions to build the
3389         options dictionary for arbitrary-size biplanar and 32-bit single-planar
3390         surfaces.
3391
3392         I don't know how to write a test because IOSurface is not supported
3393         in the simulator.
3394
3395 2016-05-27  Zalan Bujtas  <zalan@apple.com>
3396
3397         EventHandler finds incorrect scrollable container.
3398         https://bugs.webkit.org/show_bug.cgi?id=158132
3399         <rdar://problem/26423126>
3400
3401         Reviewed by Brent Fulgham.
3402
3403         Fix the logic that checks whether we are at the beginning or at the end of the container (horizontally).
3404         While scrolling to the right, deltaX has negative values. So in case of deltaX < 0, we need to check if
3405         the container is not scrolled all the way to the right.
3406
3407         Test: fast/scrolling/scroll-container-horizontally.html
3408
3409         * page/mac/EventHandlerMac.mm:
3410         (WebCore::findEnclosingScrollableContainer):
3411
3412 2016-05-27  Jeremy Jones  <jeremyj@apple.com>
3413
3414         Decrease flicker when changing video presentation mode.
3415         https://bugs.webkit.org/show_bug.cgi?id=158148
3416         rdar://problem/24476949
3417
3418         Reviewed by Jer Noble.
3419
3420         No new tests because there is no behavior change. This change is about the timing of
3421         moving AVPlayerLayers between layers to prevent flicker.
3422
3423         1) Moving an AVPlayerLayer between CAContexts can flicker. So always keep two
3424         AVPlayerLayers around and add and remove them from the inline and fullscreen contexts.
3425         2) Wait to show the inline placeholder until the fullscreen video layer has been installed.
3426         3) Wait to remove the fullscreen video layer until the placeholder has been removed.
3427
3428         * Modules/mediacontrols/MediaControlsHost.cpp:
3429         (WebCore::MediaControlsHost::isVideoLayerInline): Expose isVideoLayerInline to the shadow DOM.
3430         (WebCore::MediaControlsHost::setPreparedForInline): Expose setPreparedForInline to the shadow DOM.
3431         * Modules/mediacontrols/MediaControlsHost.h: Add setPreparedForInline and isVideoLayerInline
3432         * Modules/mediacontrols/MediaControlsHost.idl: Add setPreparedForInline and isVideoLayerInline
3433         * Modules/mediacontrols/mediaControlsApple.js:
3434         (Controller.prototype.showInlinePlaybackPlaceholderWhenSafe): Wait to show placeholder when entering fullscreen.
3435         (Controller.prototype.handlePresentationModeChange): Wait to show placeholder, and notify when placeholder is removed.
3436         * html/HTMLMediaElement.cpp:
3437         (WebCore::HTMLMediaElement::setPreparedForInline):
3438         (WebCore::HTMLMediaElement::waitForPreparedForInlineThen): Used to delay fullscreen cleanup until placeholder is removed.
3439         (WebCore::HTMLMediaElement::setVideoFullscreenLayer): Add a callback so we can wait until this completes before continuing.
3440         * html/HTMLMediaElement.h:
3441         (WebCore::HTMLMediaElement::isVideoLayerInline):
3442         (WebCore::HTMLMediaElement::waitForPreparedForInlineThen):
3443         (WebCore::HTMLMediaElement::setVideoFullscreenLayer): Add completionHandler.
3444         * platform/cocoa/WebVideoFullscreenModelVideoElement.h:
3445         (WebCore::WebVideoFullscreenModelVideoElement::setVideoFullscreenLayer): Add completionHandler.
3446         (WebCore::WebVideoFullscreenModelVideoElement::waitForPreparedForInlineThen): Added.
3447         * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
3448         (WebVideoFullscreenModelVideoElement::setVideoFullscreenLayer): Add completionHandler.
3449         (WebVideoFullscreenModelVideoElement::waitForPreparedForInlineThen):
3450         * platform/graphics/MediaPlayer.cpp:
3451         (WebCore::MediaPlayer::setVideoFullscreenLayer): Add completionHandler.
3452         * platform/graphics/MediaPlayer.h:
3453         (WebCore::MediaPlayer::setVideoFullscreenLayer): Add completionHandler.
3454         * platform/graphics/MediaPlayerPrivate.h:
3455         (WebCore::MediaPlayerPrivateInterface::setVideoFullscreenLayer): Add completionHandler.
3456         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
3457         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3458         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Create two video layers.
3459         (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer): Allow two video layers.
3460         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer): Add completionHandler.
3461         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoLayerGravity): Allow two video layers.
3462         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
3463         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3464         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addDisplayLayer): Allow two video layers.
3465         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer): Add completionHandler.
3466         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
3467         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3468         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::createPreviewLayers): Allow two video layers.
3469         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenLayer): Add completionHandler.
3470         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h:
3471         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:
3472         (WebCore::VideoFullscreenLayerManager::setVideoLayers): Allow two video layers.
3473         (WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer): Add completionHandler.
3474         (WebCore::VideoFullscreenLayerManager::setVideoFullscreenFrame): Allow two video layers.
3475         (WebCore::VideoFullscreenLayerManager::didDestroyVideoLayer): Allow two video layers.
3476         (WebCore::VideoFullscreenLayerManager::setVideoLayer): Deleted.
3477         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
3478         (WebVideoFullscreenControllerContext::didSetupFullscreen): Use completionHandler. 
3479         (WebVideoFullscreenControllerContext::didExitFullscreen): Use completionHandler.
3480
3481 2016-05-26  Ryosuke Niwa  <rniwa@webkit.org>
3482
3483         Crash in TreeScope::focusedElement
3484         https://bugs.webkit.org/show_bug.cgi?id=158108
3485
3486         Reviewed by Enrica Casucci.
3487
3488         The bug was caused by a flawed sequence of steps we took to remove an element. When an element is removed,
3489         willRemoveChild and willRemoveChildren fire blur events on removed focused element and its ancestors and
3490         unload event on any removed iframes. However, it was possible to focus an element on which we had fired blur
3491         during an unload event, leaving m_focusedElement point to an element that's not in the document anymore.
3492
3493         Changing the order doesn't help because that would make it possible to insert the removed iframes back into
3494         the document inside a event listener of the blur event, which was specifically fixed by r127534 four years ago.
3495
3496         Instead, fix the bug by not firing blur and change events on removed nodes. New behavior matches Firefox and HTML5
3497         specification: https://html.spec.whatwg.org/multipage/interaction.html#focus-fixup-rule-one
3498
3499         Test: fast/shadow-dom/shadow-root-active-element-crash.html
3500
3501         * dom/ContainerNode.cpp:
3502         (WebCore::willRemoveChild): Made this function static local since it didn't need to have access to any private
3503         member variables. Call Document::nodeWillBeRemoved after disconnecting iframes since unload event handler could
3504         allocate new Ranges just like mutation events.
3505         (WebCore::willRemoveChildren): Ditto.
3506         (WebCore::ContainerNode::removeChild): Removed the calls to removeFullScreenElementOfSubtree and
3507         removeFocusedNodeOfSubtree as they're now called in Document::nodeWillBeRemoved.
3508         (WebCore::ContainerNode::removeChildren): Ditto.
3509         * dom/ContainerNode.h:
3510         * dom/Document.cpp:
3511         (WebCore::Document::removeFocusedNodeOfSubtree): Don't dispatch blur and change events when a node is removed.
3512         (WebCore::Document::setFocusedElement): Added FocusRemovalEventsMode as the third argument. Avoid dispatching blur
3513         and change events when FocusRemovalEventsMode::Dispatch is set.
3514         (WebCore::Document::nodeChildrenWillBeRemoved): Added calls to removeFullScreenElementOfSubtree and
3515         removeFocusedNodeOfSubtree. Also assert that no events are fired within this function. If we ever fire an event here,
3516         "unloaded" iframes can be inserted back into a document before ContainerNode::removeChild actually removes them.
3517         (WebCore::Document::nodeWillBeRemoved): Ditto.
3518         * dom/Document.h:
3519         * dom/TreeScope.cpp:
3520         (WebCore::TreeScope::focusedElement): Added a release assertion to make sure the focused element is in the document
3521         of the tree scope, and added an explicit type check just in case.
3522
3523 2016-05-27  Brent Fulgham  <bfulgham@apple.com>
3524
3525         CSP: Fire 'load' events even when blocking loads via 'frame-src'.
3526         https://bugs.webkit.org/show_bug.cgi?id=153150
3527         <rdar://problem/24383162>
3528
3529         Reviewed by Daniel Bates.
3530
3531         Always fire a load event, even when the load is blocked by CSP rules, so that
3532         attackers cannot gain knowledge about the URL in the frame by blocking the
3533         load and waiting long enough to be sure that a 'load' event would have
3534         fired if the load wasn't blocked.
3535
3536         Inspired by Blink patch:
3537         <https://src.chromium.org/viewvc/blink?view=rev&revision=165743>
3538
3539         Tests: http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load.html
3540
3541         * loader/PolicyChecker.cpp:
3542         (WebCore::PolicyChecker::checkNavigationPolicy):
3543
3544 2016-05-27  Andreas Kling  <akling@apple.com>
3545
3546         Document abandons its EventTargetData.
3547         <https://webkit.org/b/158158>
3548
3549         Reviewed by Darin Adler.
3550
3551         Node::willBeDeletedFrom() is called when destroying all Node types *except* Document.
3552         If a Document had an associated EventTargetData, it would not get cleaned up.
3553
3554         This patch moves the EventTargetData cleanup to ~Node() where it's guaranteed to run.
3555
3556         * dom/Node.cpp:
3557         (WebCore::Node::~Node):
3558         (WebCore::Node::willBeDeletedFrom):
3559
3560 2016-05-27  Ryan Haddad  <ryanhaddad@apple.com>
3561
3562         Attempt to fix the iOS build.
3563
3564         Unreviewed build fix.
3565
3566         * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
3567         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
3568         (-[WebAVPlayerLayer layoutSublayers]):
3569
3570 2016-05-27  Brady Eidson  <beidson@apple.com>
3571
3572         Modern IDB: After closing a Netflix video, trying to watch it again fails.
3573         <rdar://problem/25092473> and https://bugs.webkit.org/show_bug.cgi?id=158160
3574
3575         Reviewed by Alex Christensen.
3576
3577         New APITest: IndexedDB.WebProcessKillIDBCleanup
3578
3579         * Modules/indexeddb/IDBTransaction.cpp:
3580         (WebCore::IDBTransaction::stop):
3581         
3582         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
3583         (WebCore::IDBServer::UniqueIDBDatabase::connectionClosedFromClient): All active transactions need to be aborted
3584           (without callback, since there's no connection to callback to).
3585         (WebCore::IDBServer::UniqueIDBDatabase::takeNextRunnableTransaction):
3586
3587 2016-05-27  Adam Bergkvist  <adam.bergkvist@ericsson.com>
3588
3589         WebRTC: Update RTCPeerConnection overloaded legacy operations to return a Promise
3590         https://bugs.webkit.org/show_bug.cgi?id=158114
3591
3592         Reviewed by Eric Carlson.
3593
3594         Update overloaded operations so that the legacy callback versions also return a promise
3595         and never throw [1].
3596
3597         [1] https://w3c.github.io/webrtc-pc/archives/20160513/webrtc.html#legacy-interface-extensions
3598
3599         Updated existing tests.
3600         - fast/mediastream/RTCPeerConnection-overloaded-operations-params.html
3601         - fast/mediastream/RTCPeerConnection-overloaded-operations.html
3602
3603         * Modules/mediastream/RTCPeerConnection.idl:
3604         Updated legacy signatures (just for documentation purposes)
3605         * Modules/mediastream/RTCPeerConnection.js:
3606         Implements the promise overload and the legacy callbacks overload (using the promise version)
3607         as specified in [1] (above).
3608         (createOffer):
3609         (createAnswer):
3610         (setLocalDescription):
3611         (setRemoteDescription):
3612         (addIceCandidate):
3613         (getStats):
3614         * Modules/mediastream/RTCPeerConnectionInternals.js:
3615         Added helper functions objectAndCallbacksOverload and callbacksAndDictionaryOverload that
3616         process an argument list and determine which overloaded version to use.
3617         (callbacksAndDictionaryOverload):
3618         (setLocalOrRemoteDescription): Deleted.
3619         (extractCallbackArg): Deleted.
3620
3621 2016-05-27  Antoine Quint  <graouts@apple.com>
3622
3623         Video play glyph not visible if initially invisible when contained in a "-webkit-overflow-scrolling: touch" container
3624         https://bugs.webkit.org/show_bug.cgi?id=158146
3625         <rdar://problem/25816307>
3626
3627         Reviewed by Dean Jackson.
3628
3629         We now force the <video> controls play glyph into being composited due to webkit.org/b/158147. In most scenarios,
3630         this element gets composited anyway, this is just to ensure that this happens in all cases until we get the
3631         general fix for webkit.org/b/158147.
3632
3633         Test: platform/ios-simulator/media/video-play-glyph-composited-outside-overflow-scrolling-touch-container.html
3634
3635         * Modules/mediacontrols/mediaControlsiOS.css:
3636         (video::-webkit-media-controls-start-playback-button .webkit-media-controls-start-playback-glyph):
3637
3638 2016-05-26  Yoav Weiss  <yoav@yoav.ws>
3639
3640         Preload single download tests.
3641         https://bugs.webkit.org/show_bug.cgi?id=157988
3642
3643         Reviewed by Alex Christensen.
3644
3645         ResourceTiming entries for some subresource weren't registered as resource->response().isHTTP() was false, since
3646         resource->response().url() was empty. I switched the check to use resource->resourceRequest().url() directly instead.
3647
3648         Test: http/tests/preload/single_download_preload_runner.html
3649
3650         * loader/ResourceTimingInformation.cpp:
3651         (WebCore::ResourceTimingInformation::addResourceTiming):
3652
3653 2016-05-26  Nan Wang  <n_wang@apple.com>
3654
3655         AX: Wrong CharacterOffset from VisiblePosition with composed characters
3656         https://bugs.webkit.org/show_bug.cgi?id=158138
3657
3658         Reviewed by Chris Fleizach.
3659
3660         The conversion logic is not correct when the text node contains composed characters. 
3661         We should use VisiblePosition's offset directly for text nodes so we won't mess things up.
3662
3663         Test: accessibility/mac/character-offset-visible-position-conversion-with-emoji.html
3664
3665         * accessibility/AXObjectCache.cpp:
3666         (WebCore::AXObjectCache::visiblePositionFromCharacterOffset):
3667         (WebCore::AXObjectCache::characterOffsetFromVisiblePosition):
3668
3669 2016-05-26  Darin Adler  <darin@apple.com>
3670
3671         Media queries and platform screen modernization and streamlining
3672         https://bugs.webkit.org/show_bug.cgi?id=158067
3673
3674         Reviewed by Alex Christensen.
3675
3676         * bindings/objc/DOM.mm:
3677         (-[DOMHTMLLinkElement _mediaQueryMatches]): Use references, use fastGetAttribute,
3678         pass a document instead of a frame to the media query evaluator and a reference instead
3679         of a pointer.
3680
3681         * css/CSSGrammar.y.in: Use "expression" instead of "exp" for media query expressions.
3682         Update vectors and arguments to move media query expressions instead of using unique_ptr.
3683
3684         * css/CSSImportRule.h: Use pragma once. Removed unneeded forward declarations.
3685         Made more overrides private and marked them final.
3686
3687         * css/CSSParser.cpp:
3688         (WebCore::CSSParser::SourceSize::SourceSize): Added missing WTFMove to avoid reference
3689         count churn. Changed type of expression to no longer use unique_ptr.
3690         (WebCore::CSSParser::sourceSize): Ditto.
3691
3692         * css/CSSParser.h: Changed SourceSize::expression to no longer use unique_ptr.
3693         Also changed SourceSize::length to be Ref instead of RefPtr.
3694
3695         * css/DocumentRuleSets.cpp:
3696         (WebCore::DocumentRuleSets::appendAuthorStyleSheets): Updated for changes to
3697         MediaQueryEvaluator.
3698
3699         * css/MediaFeatureNames.cpp:
3700         (WebCore::MediaFeatureNames::init): Streamlined a bit. Removed "MediaFeature" suffix from
3701         names of media feature strings.
3702
3703         * css/MediaFeatureNames.h: Use pragma once. Changed media feature name globals
3704         to use normal WebKit naming style instead of all lowercase with underscores.
3705         Sorted alphabetically. Removed "MediaFeature" suffix from names of media feature strings.
3706
3707         * css/MediaList.cpp:
3708         (WebCore::MediaQuerySet::MediaQuerySet): Simplified copy constructor since the queries
3709         vector can now be copied normally.
3710         (WebCore::parseMediaDescriptor): Normalized types and changed to use isASCIIAlphanumeric.
3711         The old code was not handling '0' the way the comment said it did.
3712         (WebCore::MediaQuerySet::internalParse): Added. Helper function to cut down on redundant
3713         code in functions below.
3714         (WebCore::MediaQuerySet::parse): Use stripLeadingAndTrailingHTMLSpaces instead of
3715         stripWhiteSpace. Streamlined logic using helper function. Updated to use a vector of
3716         queries instead of a vector of unique_ptr.
3717         (WebCore::MediaQuerySet::add): Use internalParse.
3718         (WebCore::MediaQuerySet::remove): Ditto.
3719         (WebCore::MediaQuerySet::addMediaQuery): Changed argument type to not be unique_ptr.
3720         (WebCore::MediaQuerySet::mediaText): Use modern for loop.
3721         (WebCore::MediaList::MediaList): Initialize pointers to null in the class definition
3722         rather than in these constructors.
3723         (WebCore::MediaList::setMediaText): Removed unhelpful local variable.
3724         (WebCore::MediaList::item): Updated since queries no longer use unique_ptr.
3725         (WebCore::addResolutionWarningMessageToConsole): Changed argument types to references
3726         instead of pointers with assertions.
3727         (WebCore::reportMediaQueryWarningIfNeeded): Updated to modernize.
3728
3729         * css/MediaList.h: Use pragma once. Removed unneeded includes and forward declarations.
3730         Changed vector to contain media queries instead of unique_ptr. Use nullptr instead of 0.
3731         Initialize pointers to null here.
3732
3733         * css/MediaQuery.cpp: Deleted now-unneeded copy constructor and destructor. Both are
3734         correctly generated without us writing them explicitly.
3735         (WebCore::MediaQuery::serialize): Rewrote to streamline.
3736         (WebCore::MediaQuery::MediaQuery): Updates since expressions are no longer unique_ptr.
3737         (WebCore::MediaQuery::cssText): Changed return type to reference.
3738
3739         * css/MediaQuery.h: Use pragma once. Added include since this now includes media query
3740         expressions, not just unique_ptr. Deleted the unneeded copy function.
3741
3742         * css/MediaQueryEvaluator.cpp:
3743         (WebCore::isViewportDependent): Moved this here. It used to be a member function of
3744         MediaQueryExp, but this file has a lot more functions about specific features and how
3745         they are evaluated, so it really belongs here.
3746         (WebCore::MediaQueryEvaluator::MediaQueryEvaluator): Changed constructor to take a
3747         document instead of a frame. Initialize the fallback result in the class definition.
3748         (WebCore::MediaQueryEvaluator::evaluate): Changed the argument type to a reference.
3749         (WebCore::compareValue): Made both of the arguments separate template types. This
3750         helps us compare an integer to a double without lots of type casts.
3751         (WebCore::compareAspectRatioValue): Changed to use early return style and got rid of
3752         the casts to int so we will do the work in double instead.
3753         (WebCore::doubleValue): Replaced the old numberValue function with this. Since values
3754         are stored as doubles, it's much better to use double rather than float.
3755         (WebCore::zeroEvaluate): Added. Helpful for the many functions that just need to
3756         evaluate as 0.
3757         (WebCore::oneEvaluate): Ditto.
3758         (WebCore::colorEvaluate): Renamed this and all the functions below. Simplified the logic
3759         to use the new doubleValue function.
3760         (WebCore::colorIndexEvaluate): Use zeroEvaluate.
3761         (WebCore::colorGamutEvaluate): No longer use page just to get from the frame to the
3762         main frame.
3763         (WebCore::monochromeEvaluate): Simplify logic using zeroEvaluate.
3764         (WebCore::invertedColorsEvaluate): Use auto for the keyword; easier to read.
3765         (WebCore::orientationEvaluate): Use early return style.
3766         (WebCore::aspectRatioEvaluate): Ditto.
3767         (WebCore::deviceAspectRatioEvaluate): Simplified logic and removed type casts.
3768         (WebCore::evaluateResolution): Added a couple null checks.
3769         (WebCore::devicePixelRatioEvaluate): Renamed. Added missing type check.
3770         (WebCore::resolutionEvaluate): Ditto.
3771         (WebCore::gridEvaluate): Use zeroEvaluate.
3772         (WebCore::computeLength): Added a null check.
3773         (WebCore::deviceHeightEvaluate): Use early return.
3774         (WebCore::deviceWidthEvaluate): Ditto.
3775         (WebCore::heightEvaluate): Ditto.
3776         (WebCore::widthEvaluate): Ditto.
3777         (WebCore::minColorEvaluate): Updated name only.
3778         (WebCore::maxColorEvaluate): Ditto.
3779         (WebCore::minColorIndexEvaluate): Ditto.
3780         (WebCore::maxColorIndexEvaluate): Ditto.
3781         (WebCore::minMonochromeEvaluate): Ditto.
3782         (WebCore::maxMonochromeEvaluate): Ditto.
3783         (WebCore::minAspectRatioEvaluate): Ditto.
3784         (WebCore::maxAspectRatioEvaluate): Ditto.
3785         (WebCore::minDeviceAspectRatioEvaluate): Ditto.
3786         (WebCore::maxDeviceAspectRatioEvaluate): Ditto.
3787         (WebCore::minDevicePixelRatioEvaluate): Ditto.
3788         (WebCore::maxDevicePixelRatioEvaluate): Ditto.
3789         (WebCore::minHeightEvaluate): Ditto.
3790         (WebCore::maxHeightEvaluate): Ditto.
3791         (WebCore::minWidthEvaluate): Ditto.
3792         (WebCore::maxWidthEvaluate): Ditto.
3793         (WebCore::minDeviceHeightEvaluate): Ditto.
3794         (WebCore::maxDeviceHeightEvaluate): Ditto.
3795         (WebCore::minDeviceWidthEvaluate): Ditto.
3796         (WebCore::maxDeviceWidthEvaluate): Ditto.
3797         (WebCore::minResolutionEvaluate): Ditto.
3798         (WebCore::maxResolutionEvaluate): Ditto.
3799         (WebCore::animationEvaluate): Use oneEvaluate.
3800         (WebCore::transitionEvaluate): Ditto.
3801         (WebCore::transform2dEvaluate): Ditto.
3802         (WebCore::transform3dEvaluate): Simplify using zeroEvaluate and oneEvaluate.
3803         (WebCore::viewModeEvaluate): Simplified logic with fewer local variables and the name "keyword".
3804         (WebCore::videoPlayableInlineEvaluate): Use reference.
3805         (WebCore::hoverEvaluate): Simplify using keyword.
3806         (WebCore::anyHoverEvaluate): Just updated name.
3807         (WebCore::pointerEvaluate): Simplify using keyword.
3808         (WebCore::anyPointerEvaluate): Just updated name.
3809         (WebCore::add): Added. Helper for building up the media query function map.
3810         (WebCore::MediaQueryEvaluator::evaluate): Moved code to build the function map in here in
3811         a lambda, rather than having it in a separate global function.
3812
3813         * css/MediaQueryEvaluator.h: Use pragma once. Removed uneeded includes. Simplified comments and
3814         modernized their style.
3815
3816         * css/MediaQueryExp.cpp:
3817         (WebCore::isFeatureValidWithIdentifier): Renamed to make it clearer what this does. Updated
3818         to take a reference and use te new feature names.
3819         (WebCore::isFeatureValidWithNonNegativeLengthOrNumber): Ditto.
3820         (WebCore::isFeatureValidWithDensity): Ditto.
3821         (WebCore::isFeatureValidWithNonNegativeInteger): Ditto.
3822         (WebCore::isFeatureValidWithNonNegativeNumber): Ditto.
3823         (WebCore::isFeatureValidWithZeroOrOne): Ditto.
3824         (WebCore::isAspectRatioFeature): Ditto.
3825         (WebCore::isFeatureValidWithoutValue): Ditto.
3826         (WebCore::isFeatureValidWithNumberWithUnit): Added. Helper that calls multiple functions above.
3827         (WebCore::isFeatureValidWithNumber): Ditto.
3828         (WebCore::isSlash): Added. Helper to make aspect ratio code below easier to read.
3829         (WebCore::isPositiveIntegerValue): Ditto.
3830         (WebCore::MediaQueryExpression::MediaQueryExpression): Rearranged code to be much less wordy and
3831         to not use current/next.
3832
3833         * css/MediaQueryExp.h: Use pragma once. Renamed class to MediaQueryExpression. Removed
3834         the isViewportDependent function, now part of MediaQueryEvaluator. Removed unneeded includes.
3835
3836         * css/MediaQueryList.cpp:
3837         (WebCore::MediaQueryList::MediaQueryList): Marked this inline. Use a reference and a Ref&&
3838         instead of PassRefPtr.
3839         (WebCore::MediaQueryList::create): Updated argument types.
3840         (WebCore::MediaQueryList::addListener): Updated argument type and use releaseNonNull.
3841         (WebCore::MediaQueryList::removeListener): Updated argument types.
3842         (WebCore::MediaQueryList::evaluate): Ditto.
3843         (WebCore::MediaQueryList::matches): More of the same.
3844
3845         * css/MediaQueryList.h: Use pragma once. Changed types to use references, RefPtr&& and Ref&&.
3846
3847         * css/MediaQueryMatcher.cpp:
3848         (WebCore::MediaQueryMatcher::MediaQueryMatcher): Take a reference.
3849         (WebCore::MediaQueryMatcher::documentDestroyed): Use nullptr.
3850         (WebCore::MediaQueryMatcher::documentElementUserAgentStyle): Use auto.
3851         (WebCore::MediaQueryMatcher::evaluate): Take a reference. Updated for changes to MediaQueryEvaluator.
3852         (WebCore::MediaQueryMatcher::matchMedia): Updated for above changes.
3853         (WebCore::MediaQueryMatcher::addListener): Use Ref&& and reference for arguments. Simplify code.
3854         (WebCore::MediaQueryMatcher::removeListener): Ditto.
3855         (WebCore::MediaQueryMatcher::styleResolverChanged): Moved the logic for evaluating each query here.
3856         Updated for changes to MediaQueryEvaluator.
3857
3858         * css/MediaQueryMatcher.h: Use pragma once. Changed create to take a reference. Tightened argument
3859         types for addListener and removeListener. Made the private Listener a simple struct rather than a
3860         class. Initialized m_evaluationRound.
3861
3862         * css/RuleSet.cpp:
3863         (WebCore::RuleSet::addChildRules): Updated for changes to MediaQueryEvaluator.
3864         (WebCore::RuleSet::addRulesFromSheet): Ditto.
3865
3866         * css/SourceSizeList.cpp:
3867         (WebCore::match): Updated to use MediaQueryEvaluator in a simpler way.
3868         (WebCore::defaultLength): Use a reference and simpler syntax.
3869         (WebCore::computeLength): Ditto.
3870         (WebCore::parseSizesAttribute): Changed arguments to take a Document instead of both a
3871         RenderView and a Frame.
3872
3873         * css/SourceSizeList.h: Use #pragma once. Change parseSizesAttribute to take a Document.
3874
3875         * css/StyleMedia.cpp:
3876         (WebCore::StyleMedia::matchMedium): Update for changes to MediaQueryEvaluator.
3877
3878         * css/StyleResolver.cpp:
3879         (WebCore::StyleResolver::StyleResolver): Use a MediaQueryEvaluator instead of a unique_ptr
3880         to one.
3881         (WebCore::StyleResolver::appendAuthorStyleSheets): Ditto.
3882         (WebCore::StyleResolver::styleForElement): Ditto.
3883         (WebCore::StyleResolver::pseudoStyleForElement): Ditto.
3884         (WebCore::StyleResolver::pseudoStyleRulesForElement): Ditto.
3885         (WebCore::StyleResolver::addViewportDependentMediaQueryResult): Use references instead of
3886         ponters, and use a vector of MediaQueryResult instead of unique_ptr.
3887         (WebCore::StyleResolver::hasMediaQueriesAffectedByViewportChange): Use a modern for loop.
3888
3889         * css/StyleResolver.h: Use a MediaQueryEvaluator instead of a unique_ptr to one.
3890         Use a vector of MediaQueryResult instead of a vector of unique_ptr.
3891
3892         * dom/Document.cpp:
3893         (WebCore::Document::mediaQueryMatcher): Pass a reference instead of a pointer.
3894
3895         * dom/InlineStyleSheetOwner.cpp:
3896         (WebCore::InlineStyleSheetOwner::createSheet): Updated for changes to MediaQueryEvaluator.
3897
3898         * editing/TextIterator.cpp:
3899         (WebCore::SimplifiedBackwardsTextIterator::advance): Removed a stray space (unrelated to
3900         the rest of the patch).
3901
3902         * html/HTMLImageElement.cpp:
3903         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement): Updated for changes to the
3904         MediaQueryEvaluator class. Also use auto a bit more and eliminated a double hash table
3905         lookup in code that used hasAttribute followed by fastGetAttribute.
3906         (WebCore::HTMLImageElement::selectImageSource): Updated for changes to parseSizesAttribute.
3907
3908         * html/HTMLLinkElement.cpp:
3909         (WebCore::HTMLLinkElement::process): Updated for changes to MediaQueryEvaluator.
3910         (WebCore::HTMLLinkElement::setCSSStyleSheet): Use auto.
3911
3912         * html/HTMLMediaElement.cpp:
3913         (WebCore::HTMLMediaElement::selectNextSourceChild): Updated for changes to MediaQueryEvaluator.
3914
3915         * html/HTMLPictureElement.cpp:
3916         (WebCore::HTMLPictureElement::viewportChangeAffectedPicture): Updated for changes to
3917         MediaQueryEvaluator.
3918
3919         * html/HTMLPictureElement.h: Use #pragma once. Changed viewport dependent media query results
3920         vector to be a vector of results, not of unique_ptr.
3921
3922         * html/parser/HTMLPreloadScanner.cpp:
3923         (WebCore::TokenPreloadScanner::StartTagScanner::processAttributes): Updated for changes to
3924         parseSizesAttribute.
3925         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): Updated for changes to
3926         MediaQueryEvaluator.
3927
3928         * html/parser/HTMLResourcePreloader.cpp:
3929         (WebCore::mediaAttributeMatches): Updated for changes to MediaQueryEvaluator.
3930         (WebCore::HTMLResourcePreloader::preload): Ditto.
3931
3932         * page/DOMWindow.cpp: Removed unneeded include of PlatformScreen.h.
3933
3934         * page/mac/EventHandlerMac.mm:
3935         (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll): Simplified code and
3936         updated for changes to PlatformScreenMac functions.
3937
3938         * platform/PlatformScreen.h: U