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