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