Align the innerText setter with the HTML spec and Gecko
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-01-14  Chris Dumez  <cdumez@apple.com>
2
3         Align the innerText setter with the HTML spec and Gecko
4         https://bugs.webkit.org/show_bug.cgi?id=160971
5
6         Reviewed by Alex Christensen.
7
8         Align the innerText setter and createContextualFragment() with the
9         HTML specification and Gecko. In particular, they no longer throw
10         when the context element is a void element. This behavior was there
11         to match an old IE behavior but Edge dropped this behavior.
12
13         Test: fast/dom/br-set-outerText.html
14
15         * dom/Element.cpp:
16         * dom/Element.h:
17         * editing/markup.cpp:
18         (WebCore::createContextualFragment):
19         * html/HTMLElement.cpp:
20         (WebCore::HTMLElement::setInnerText):
21         (WebCore::HTMLElement::setOuterText):
22
23 2017-01-13  Joseph Pecoraro  <pecoraro@apple.com>
24
25         Remove ENABLE(DETAILS_ELEMENT) guards
26         https://bugs.webkit.org/show_bug.cgi?id=167042
27
28         Reviewed by Alex Christensen.
29
30         * Configurations/FeatureDefines.xcconfig:
31         * DerivedSources.make:
32         * accessibility/AccessibilityNodeObject.cpp:
33         (WebCore::AccessibilityNodeObject::setIsExpanded):
34         * html/HTMLDetailsElement.cpp:
35         * html/HTMLDetailsElement.idl:
36         * html/HTMLSummaryElement.cpp:
37         * html/HTMLTagNames.in:
38         * html/shadow/DetailsMarkerControl.cpp:
39         * rendering/RenderDetailsMarker.cpp:
40         * rendering/RenderDetailsMarker.h:
41         * rendering/RenderObject.h:
42         (WebCore::RenderObject::isDetailsMarker):
43         * rendering/RenderTreeAsText.cpp:
44         (WebCore::RenderTreeAsText::writeRenderObject):
45
46 2017-01-13  Alex Christensen  <achristensen@webkit.org>
47
48         Fix WinCairo build after r210753.
49         https://bugs.webkit.org/show_bug.cgi?id=166730
50
51         * platform/WebGLStateTracker.h:
52         WTF::Function apparently needs to explicitly be differentiated from JSC::Attribute Function in PropertySlot.h.
53
54 2017-01-13  Brent Fulgham  <bfulgham@apple.com>
55
56         Potential nullptr dereference in RenderLayer::updateLayerPosition()
57         https://bugs.webkit.org/show_bug.cgi?id=167036
58         <rdar://problem/30023019>
59
60         Reviewed by Dean Jackson.
61
62         A value was being used without nullptr checking, even though it had been checked for null a
63         few lines prior.
64
65         * rendering/RenderLayer.cpp:
66         (WebCore::RenderLayer::updateLayerPosition): Add missing nullptr check.
67
68 2017-01-11  Darin Adler  <darin@apple.com>
69
70         Remove PassRefPtr from more of "platform"
71         https://bugs.webkit.org/show_bug.cgi?id=166809
72
73         Reviewed by Sam Weinig.
74
75         * CMakeLists.txt: Removed DeviceMotionClientMock.cpp.
76
77         * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.h:
78         Added now-needed include.
79
80         * Modules/speech/SpeechSynthesisUtterance.cpp:
81         (WebCore::SpeechSynthesisUtterance::SpeechSynthesisUtterance):
82         Pass a reference instead of a pointer.
83
84         * Modules/speech/SpeechSynthesisUtterance.h: Tweaks, msade a few things
85         more private and final.
86
87         * bindings/js/JSDOMConvert.h:
88         (WebCore::Detail::getPtrOrRef): Removed no-longer-needed const_cast.
89         * bindings/js/JSDOMWrapper.h:
90         (WebCore::JSDOMWrapper::wrapped): Ditto.
91         * bindings/js/ScriptModuleLoader.cpp:
92         (WebCore::ScriptModuleLoader::~ScriptModuleLoader): Ditto.
93
94         * css/BasicShapeFunctions.cpp:
95         (WebCore::convertToLengthSize): Updated for LengthSize struct.
96         (WebCore::convertToCenterCoordinate): Ditto.
97
98         * css/CSSComputedStyleDeclaration.cpp:
99         (WebCore::createPositionListForLayer): Take a reference.
100         (WebCore::getBorderRadiusCornerValues): Updated for LengthSize struct.
101         (WebCore::getBorderRadiusCornerValue): Ditto.
102         (WebCore::getBorderRadiusShorthandValue): Ditto.
103         (WebCore::fillSizeToCSSValue): Ditto.
104         (WebCore::ComputedStyleExtractor::propertyValue): Updated many properties
105         since the layer properties now return references rather than pointers.
106
107         * css/CSSImageGeneratorValue.cpp:
108         (WebCore::CSSImageGeneratorValue::CachedGeneratedImage::image): Removed
109         no-longer-needed const_cast.
110         * css/CSSKeyframesRule.cpp:
111         (WebCore::CSSKeyframesRule::item): Ditto.
112
113         * css/CSSPrimitiveValue.cpp:
114         (WebCore::CSSPrimitiveValue::init): Updated for LengthSize struct.
115
116         * css/CSSStyleRule.h: Removed no-longer-needed const_cast.
117
118         * css/CSSToStyleMap.cpp:
119         (WebCore::convertToLengthSize): Updated for LengthSize struct.
120
121         * css/FontFace.cpp:
122         (WebCore::FontFace::family): Removed no-longer-needed const_cast.
123         (WebCore::FontFace::style): Ditto.
124         (WebCore::FontFace::weight): Ditto.
125         (WebCore::FontFace::unicodeRange): Ditto.
126         (WebCore::FontFace::variant): Ditto.
127         (WebCore::FontFace::featureSettings): Ditto.
128
129         * css/LengthFunctions.cpp:
130         (WebCore::sizeForLengthSize): Added.
131         (WebCore::floatSizeForLengthSize): Updated for LengthSize struct.
132         * css/LengthFunctions.h: Added sizeForLengthSize.
133
134         * css/SVGCSSComputedStyleDeclaration.cpp:
135         (WebCore::paintOrder): Cut down on creation of unused objects.
136         We now create only what we actually use.
137
138         * css/StyleBuilderConverter.h:
139         (WebCore::StyleBuilderConverter::convertRadius): Updated for
140         LengthSize struct.
141         (WebCore::StyleBuilderConverter::convertShapeValue): Pass references
142         when creating ShapeValue.
143
144         * css/StyleBuilderCustom.h:
145         (WebCore::forwardInheritedValue): Added. This set of overloaded
146         functions allows us to use move semantics for some types, but copy
147         them when inheriting. Doing it with special cases here allows us to
148         resolve this without adding overloads someone might be tempted to
149         call outside the style builder, and without adding special cases to
150         the JSON file for each property.
151         (WebCore::StyleBuilderCustom::applyValueWebkitDashboardRegion):
152         Add WTFMove as needed to work with rvalue references.
153         (WebCore::StyleBuilderCustom::applyValueSize): Ditto.
154         (WebCore::StyleBuilderCustom::applyInheritTextIndent): Ditto.
155         (WebCore::StyleBuilderCustom::applyValueTextIndent): Ditto.
156         (WebCore::StyleBuilderCustom::applyInheritLineHeight): Ditto.
157         (WebCore::StyleBuilderCustom::applyValueLineHeight): Ditto.
158         (WebCore::StyleBuilderCustom::applyInheritClip): Ditto.
159         (WebCore::StyleBuilderCustom::applyValueClip): Ditto.
160
161         * css/StyleResolver.cpp:
162         (WebCore::StyleResolver::State::cacheBorderAndBackground): Use
163         references instead of pointers.
164         (WebCore::StyleResolver::applyMatchedProperties): Ditto.
165         (WebCore::StyleResolver::applyProperty): Update for changes to the
166         custom property data in RenderStyle.
167
168         * css/makeprop.pl: Use auto quite a bit more in the generated code.
169         Updated special cases for layers to expect references. Added a WTFMove
170         so we can get move semantics for converted values that come out in
171         an optional. Added call to forwardInheritedValue (see above).
172
173         * dom/Document.cpp:
174         (WebCore::Document::pageSizeAndMarginsInPixels): Use auto and update
175         since LengthSize is a struct.
176
177         * dom/EventPath.cpp:
178         (WebCore::EventPath::computePathUnclosedToTarget): Use auto.
179
180         * dom/LiveNodeList.h:
181         (WebCore::LiveNodeList::ownerNode): Removed no-longer-needed const_cast.
182
183         * dom/MessageEvent.cpp:
184         (WebCore::MessageEvent::source): Removed unneeded static_cast.
185
186         * dom/Node.cpp:
187         (WebCore::nodeSetPreTransformedFromNodeOrStringVector): Tweaked formatting.
188
189         * dom/Range.h:
190         (WebCore::Range::ownerDocument): Removed no-longer-needed const_cast.
191         * dom/RegisteredEventListener.h:
192         (WebCore::RegisteredEventListener::callback): Ditto.
193         * dom/ScriptRunner.cpp:
194         (WebCore::ScriptRunner::~ScriptRunner): Ditto.
195         * html/HTMLCollection.h:
196         (WebCore::HTMLCollection::ownerNode): Ditto.
197         * html/parser/HTMLStackItem.h:
198         (WebCore::HTMLStackItem::node): Ditto.
199
200         * inspector/PageScriptDebugServer.cpp:
201         (WebCore::PageScriptDebugServer::setJavaScriptPaused): Cut down on the number
202         of different functions here. Also use reference rather than pointer.
203         * inspector/PageScriptDebugServer.h: Updated for above change.
204
205         * loader/HistoryController.cpp:
206         (WebCore::HistoryController::recursiveSetProvisionalItem): Removed
207         no-longer-needed const_cast.
208         (WebCore::HistoryController::recursiveGoToItem): Ditto.
209
210         * page/Frame.cpp:
211         (WebCore::Frame::ownerRenderer): Use auto. Let the is<> function do null
212         checking for us.
213         (WebCore::Frame::frameForWidget): Take a reference rather than a pointer.
214         * page/Frame.h: Updated for the above.
215
216         * page/FrameView.cpp:
217         (WebCore::FrameView::invalidateRect): Use Chrome directly instead of using
218         HostWindow. HostWindow is an abstraction for the platform layer, and there
219         is no good reason to use it here.
220         (WebCore::FrameView::scheduleAnimation): Ditto.
221         (WebCore::FrameView::graphicsLayerForPlatformWidget): Updated to use reference
222         when calling RenderWidget::find.
223         (WebCore::FrameView::scrollContentsFastPath): Use Chrome instead of HostWindow.
224         (WebCore::FrameView::hostWindow): Use early return.
225         (WebCore::FrameView::updateScrollCorner): Removed unneeded call through to base
226         class function, which was empty.
227         (WebCore::FrameView::hasCustomScrollbars): Updated since the children set now
228         contains Ref rather than RefPtr.
229         (WebCore::FrameView::parentFrameView): Use early return.
230         (WebCore::FrameView::updateWidgetPositions): Use reference instead of pointer.
231         * page/FrameView.h: Use final instead of override. Remove now-unneeded const_cast.
232
233         * page/Page.cpp:
234         (WebCore::Page::pluginViews): Updated since the children set now contains
235         Ref rather than RefPtr.
236
237         * page/PrintContext.cpp:
238         (WebCore::PrintContext::pageProperty): Updated for LengthSize struct.
239
240         * page/animation/AnimationBase.cpp:
241         (WebCore::AnimationBase::fireAnimationEventsIfNeeded): Updated for changes to
242         the types in animation function members.
243         (WebCore::AnimationBase::timeToNextService): Ditto.
244         (WebCore::AnimationBase::progress): Ditto.
245         (WebCore::AnimationBase::getElapsedTime): Ditto.
246
247         * page/animation/CSSPropertyAnimation.cpp:
248         (WebCore::blendFunc): Updated for LengthSize struct.
249         (WebCore::LengthPropertyWrapper::LengthPropertyWrapper): Updated since we now
250         use rvalue references and move semantics when setting length properties.
251
252         * page/scrolling/ScrollingCoordinator.cpp:
253         (WebCore::ScrollingCoordinator::absoluteEventTrackingRegionsForFrame): Tweaked to
254         use auto, pass references.
255
256         * platform/KeyedCoding.h: Return RefPtr instead of PassRefPtr.
257
258         * platform/LengthBox.h: Added a constructor that moves the lengths in, rather
259         than always copying them.
260
261         * platform/LengthSize.cpp:
262         (WebCore::operator<<): Updated since LengthSize is a struct.
263         * platform/LengthSize.h: Turned LengthSize into a struct and removed all the
264         getter and setter code.
265
266         * platform/PlatformSpeechSynthesis.h: Removed. Unused.
267
268         * platform/PlatformSpeechSynthesisUtterance.cpp:
269         (WebCore::PlatformSpeechSynthesisUtterance::create): Return Ref rather than PassRefPtr.
270         (WebCore::PlatformSpeechSynthesisUtterance::PlatformSpeechSynthesisUtterance): Take
271         a reference. Initialize data members in class definition.
272         * platform/PlatformSpeechSynthesisUtterance.h: Updated for the above.
273
274         * platform/PlatformSpeechSynthesisVoice.cpp:
275         (WebCore::PlatformSpeechSynthesisVoice::create): Return Ref rather than PassRefPtr.
276         * platform/PlatformSpeechSynthesisVoice.h: Updated for the above.
277
278         * platform/ScrollView.cpp:
279         (WebCore::ScrollView::addChild): Take a reference rather than a PassRefPtr.
280         (WebCore::ScrollView::setHasScrollbarInternal): Updated for change to addChild
281         (WebCore::ScrollView::scrollContentsFastPath): Deleted. This was never called,
282         so made it pure virtual.
283         (WebCore::ScrollView::frameRectsChanged): Use a modern for loop.
284         (WebCore::ScrollView::clipRectChanged): Ditto.
285         (WebCore::ScrollView::updateScrollCorner): Deleted. This was empty so made it pure
286         virtual and changed FrameView to not call it.
287         (WebCore::ScrollView::setParentVisible): Use a modern for loop.
288         (WebCore::ScrollView::show): Ditto.
289         (WebCore::ScrollView::hide): Ditto.
290         * platform/ScrollView.h: Changed the children set to contain Ref instead of RefPtr.
291         Changed functions that were never overridden to either be final or non-virtual,
292         Changed functions that were never called to be pure virtual.
293
294         * platform/Theme.h:
295         (WebCore::Theme::minimumControlSize): Updated for LengthSize struct.
296
297         * platform/animation/Animation.h: Changed timingFunction and trigger to return
298         raw pointers instead of PassRefPtr. Changed setTimingFunction and setTrigger to
299         take RefPtr&& and Ref&& instead of PassRefPtr. CHanged initialTimingfunction and
300         initialTrigger to return Ref.
301
302         * platform/animation/AnimationList.cpp: Removed redundant check in FILL_UNSET_PROPERTY.
303         (WebCore::AnimationList::AnimationList): Use modern for loop, reserveInitialCapacity,
304         and uncheckedAppend.
305         * platform/animation/AnimationList.h: Changed append to take Ref&& instead of PassRefPtr.
306         changed vecto to contain Ref instead of RefPtr. Added move constructor and assignment
307         operator.
308
309         * platform/animation/AnimationTrigger.h:
310         (WebCore::AutoAnimationTrigger::clone): Return Ref instead of PassRefPtr.
311         (WebCore::AutoAnimationTrigger::create): Ditto.
312         (WebCore::AutoAnimationTrigger::clone): Ditto.
313         (WebCore::ScrollAnimationTrigger::create): Ditto.
314         (WebCore::ScrollAnimationTrigger::clone): Ditto.
315
316         * platform/animation/TimingFunction.h:
317         (WebCore::LinearTimingFunction::create): Return Ref instead of PassRefPtr.
318         (WebCore::CubicBezierTimingFunction::create): Ditto.
319         (WebCore::CubicBezierTimingFunction::defaultTimingFunction): Return a reference
320         instead of a pointer.
321         (WebCore::CubicBezierTimingFunction::createReversed): Return Ref instead of PassRefPtr.
322         (WebCore::CubicBezierTimingFunction::clone): Ditto.
323         (WebCore::StepsTimingFunction::create): Ditto.
324         (WebCore::StepsTimingFunction::clone): Ditto.
325         (WebCore::SpringTimingFunction::create): Ditto.
326         (WebCore::SpringTimingFunction::clone): Ditto.
327
328         * platform/audio/AudioBus.h:
329         (WebCore::AudioBus::channel): Removed no-longer-needed const_cast.
330
331         * platform/cf/KeyedEncoderCF.cpp:
332         (WebCore::KeyedEncoderCF::finishEncoding): Return RefPtr instead of PassRefPtr.
333         * platform/cf/KeyedEncoderCF.h: Use final instead of override. Made even more
334         private. Changed return value of finishEncoding to Ref instead of PassRefPtr.
335
336         * platform/efl/PlatformSpeechSynthesisProviderEfl.h: Removed include of PassRefPtr.h.
337
338         * platform/glib/KeyedEncoderGlib.cpp:
339         (WebCore::KeyedEncoderGlib::finishEncoding): Return RefPtr instead of PassRefPtr.
340         * platform/glib/KeyedEncoderGlib.h: Use final instead of override. Made even more
341         private. Changed return value of finishEncoding to Ref instead of PassRefPtr.
342
343         * platform/graphics/filters/FilterOperations.cpp:
344         (WebCore::outsetSizeForBlur): Simplified, removing unnecessary floating point math.
345         (WebCore::FilterOperations::FilterOperations): Deleted. Let the compiler generate this.
346         (WebCore::FilterOperations::operator=): Deleted. Let the compiler generate this.
347         (WebCore::FilterOperations::operator==): Streamlined.
348         (WebCore::FilterOperations::operationsMatch): Ditto.
349         (WebCore::FilterOperations::hasReferenceFilter): Ditto.
350         (WebCore::FilterOperations::hasOutsets): Ditto.
351         (WebCore::FilterOperations::outsets): Ditto.
352         (WebCore::FilterOperations::hasFilterThatAffectsOpacity): Ditto.
353         (WebCore::FilterOperations::hasFilterThatMovesPixels): Ditto.
354         * platform/graphics/filters/FilterOperations.h: Updated for above changes.
355
356         * platform/graphics/FontCache.h: Removed included of PassRefPtr.h.
357
358         * platform/graphics/FontPlatformData.h: Tweaked formatting. Removed nesting
359         from #if since our formatting makes it hard to see nesting. Let the compiler
360         generate the default move and copy constructors and assignemnt operators except
361         in the USE(FREETYPE) case.
362
363         * platform/graphics/GraphicsLayer.h:
364         (WebCore::AnimationValue::AnimationValue): Updated since clone now returns a Ref
365         rather than a RefPtr.
366         (WebCore::FloatAnimationValue::FloatAnimationValue): Deleted. Let the compiler
367         generate the copy constructor without defining it explicitly.
368         (WebCore::TransformAnimationValue::TransformAnimationValue): Use a modern for
369         loop, reserveInitialCapacity, and unchecked append. Also tell the compiler to
370         generate the move constructor, since the special work is only needed for the
371         copy constructor.
372         (WebCore::FilterAnimationValue::FilterAnimationValue): Ditto.
373         (WebCore::KeyframeValueList::KeyframeValueList): Ditto.
374
375         * platform/graphics/LegacyCDMSession.h: Removed include of PassRefPtr.h.
376
377         * platform/graphics/PathUtilities.cpp:
378         (WebCore::PathUtilities::pathWithShrinkWrappedRectsForOutline): Updated
379         for LengthSize struct.
380
381         * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp:
382         (WebCore::CDMSessionAVFoundationCF::CDMSessionAVFoundationCF): Take a reference.
383         Don't bother setting m_client since we never use it.
384         (WebCore::CDMSessionAVFoundationCF::generateKeyRequest): Clean up code a bit
385         by using auto a lot more.
386         * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.h: Added include
387         that is now needed since it was removed from the base class. Tidied the class
388         up a bit, marking it final, making everything private, taking a reference, and
389         removing an unused data member, m_client.
390
391         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
392         (WebCore::MediaPlayerPrivateAVFoundationCF::createSession): Pass a reference.
393
394         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h:
395         added include of WTFString.h, now needed because of removing an unneeded
396         include from another header file.
397
398         * platform/graphics/ca/GraphicsLayerCA.cpp:
399         (WebCore::GraphicsLayerCA::animationCanBeAccelerated): Updated since trigger
400         is a raw pointer now.
401         (WebCore::GraphicsLayerCA::timingFunctionForAnimationValue): Updated to
402         return a reference rather than a pointer.
403         (WebCore::GraphicsLayerCA::setAnimationEndpoints): Updated for the above change.
404         (WebCore::GraphicsLayerCA::setAnimationKeyframes): Ditto.
405         (WebCore::GraphicsLayerCA::setTransformAnimationEndpoints): Ditto.
406         (WebCore::GraphicsLayerCA::setTransformAnimationKeyframes): Ditto.
407         (WebCore::GraphicsLayerCA::setFilterAnimationEndpoints): Ditto.
408         (WebCore::GraphicsLayerCA::setFilterAnimationKeyframes): Ditto.
409         * platform/graphics/ca/GraphicsLayerCA.h: Ditto.
410
411         * platform/ios/PlatformSpeechSynthesizerIOS.mm:
412         (-[WebSpeechSynthesisWrapper speakUtterance:]): CHanged argument to be a
413         RefPtr&& instead of a PassRefPtr.
414
415         * platform/mac/ThemeMac.mm:
416         (WebCore::sizeFromNSControlSize): Updated for LenghtSize struct.
417         (WebCore::checkboxSize): Ditto.
418         (WebCore::radioSize): Ditto.
419         (WebCore::ThemeMac::controlSize): Ditto.
420         (WebCore::ThemeMac::minimumControlSize): Ditto.
421
422         * platform/mac/WidgetMac.mm:
423         (WebCore::Widget::setFocus): Updated to pass a reference.
424
425         * platform/mock/DeviceMotionClientMock.cpp: Removed. Unused.
426         * platform/mock/DeviceMotionClientMock.h: Removed. Unused.
427
428         * platform/win/CursorWin.cpp:
429         (WebCore::createSharedCursor): Return a Ref instead of a PassRefPtr.
430         (WebCore::loadSharedCursor): Ditto.
431         (WebCore::loadCursorByName): Ditto.
432
433         * rendering/FilterEffectRenderer.cpp:
434         (WebCore::FilterEffectRenderer::output): Removed a no-longer-needed const_cast.
435         (WebCore::FilterEffectRenderer::outputRect): Ditto.
436
437         * rendering/ImageQualityController.cpp:
438         (WebCore::ImageQualityController::chooseInterpolationQuality): Tweaked formatting.
439
440         * rendering/InlineFlowBox.cpp:
441         (WebCore::InlineFlowBox::paintFillLayers): Updated to take a reference. Also
442         used a vector to iterate the linked list in reverse order instead of recursion.
443         (WebCore::InlineFlowBox::paintFillLayer): Take a reference.
444         (WebCore::InlineFlowBox::paintMask):
445         * rendering/InlineFlowBox.h: Updated for the above.
446
447         * rendering/RenderBox.cpp:
448         (WebCore::RenderBox::paintRootBoxFillLayers): Use auto a bit.
449         (WebCore::RenderBox::getBackgroundPaintedExtent): Use reference for the layers.
450         (WebCore::RenderBox::backgroundIsKnownToBeOpaqueInRect): Ditto.
451         (WebCore::RenderBox::backgroundHasOpaqueTopLayer): Ditto.
452         (WebCore::RenderBox::paintMaskImages): Ditto.
453         (WebCore::RenderBox::maskClipRect): Ditto.
454         (WebCore::RenderBox::paintFillLayers): Ditto.
455         (WebCore::RenderBox::paintFillLayer): Ditto.
456         (WebCore::layersUseImage): Ditto.
457         (WebCore::RenderBox::repaintLayerRectsForImage): Ditto.
458         * rendering/RenderBox.h: Updated for the above.
459
460         * rendering/RenderBoxModelObject.cpp:
461         (WebCore::RenderBoxModelObject::paintFillLayerExtended): Use reference for
462         the layers.
463         (WebCore::RenderBoxModelObject::calculateFillTileSize): Ditto.
464         (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry): Ditto.
465         (WebCore::RenderBoxModelObject::getGeometryForBackgroundImage): Ditto.
466         (WebCore::RenderBoxModelObject::boxShadowShouldBeAppliedToBackground): Ditto.
467         * rendering/RenderBoxModelObject.h: Updated for the above.
468
469         * rendering/RenderElement.cpp:
470         (WebCore::RenderElement::~RenderElement): Use references for the layers.
471         (WebCore::RenderElement::adjustStyleDifference): Ditto.
472         (WebCore::RenderElement::updateFillImages): Ditto.
473         (WebCore::RenderElement::setStyle): Use RenderStyle::replace to replace the
474         old style with the new style, and get the old one out at the same time.
475         (WebCore::RenderElement::styleDidChange): Use references for the layers.
476         (WebCore::mustRepaintFillLayers): Ditto.
477         (WebCore::RenderElement::repaintAfterLayoutIfNeeded): Ditto.
478         * rendering/RenderElement.h: Updated for the above.
479
480         * rendering/RenderGrid.cpp:
481         (WebCore::RenderGrid::computeContentPositionAndDistributionOffset):
482         Refactor so we don't need so many functions in RenderStyle.
483         * rendering/RenderMenuList.cpp:
484         (WebCore::RenderMenuList::adjustInnerStyle): Ditto.
485
486         * rendering/RenderLayer.cpp:
487         (WebCore::RenderLayer::createScrollbar): Pass widget as reference to addChild.
488         Also did a few other tweaks and used more specific types.
489
490         * rendering/RenderLayerBacking.cpp:
491         (WebCore::canCreateTiledImage): Updated since layers are references.
492         (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundImage): Ditto.
493
494         * rendering/RenderListBox.cpp:
495         (WebCore::RenderListBox::createScrollbar): Pass widget as reference to addChild.
496
497         * rendering/RenderTableCell.cpp:
498         (WebCore::RenderTableCell::paintBackgroundsBehindCell): Updated to use
499         references for layers.
500
501         * rendering/RenderTheme.cpp:
502         (WebCore::RenderTheme::adjustStyle): Use WTFMove to pass a LengthBox.
503         (WebCore::RenderTheme::isControlStyled): Updated since LengthSize is a struct,
504         more WTFMove, change since layers are ferences.
505
506         * rendering/RenderThemeEfl.cpp:
507         (WebCore::RenderThemeEfl::adjustSizeConstraints): Update for Length and
508         LengthSize changes.
509         (WebCore::RenderThemeEfl::paintThemePart): Use reference instead of pointer.
510         (WebCore::RenderThemeEfl::applyPartDescriptionFallback): Update for Length and
511         LengthSize changes.
512         (WebCore::RenderThemeEfl::applyPartDescription): Ditto.
513         (WebCore::RenderThemeEfl::adjustCheckboxStyle): Ditto.
514         (WebCore::RenderThemeEfl::adjustRadioStyle): Ditto.
515
516         * rendering/RenderThemeGtk.cpp:
517         (WebCore::borderRadiiFromStyle): Update for Length and LengthSize changes.
518
519         * rendering/RenderThemeIOS.mm:
520         (WebCore::RenderThemeIOS::adjustCheckboxStyle): Update for Length and
521         LengthSize changes.
522         (WebCore::RenderThemeIOS::isControlStyled): Ditto.
523         (WebCore::RenderThemeIOS::adjustRadioStyle): Ditto.
524         (WebCore::RenderThemeIOS::adjustRoundBorderRadius): Ditto.
525         (WebCore::RenderThemeIOS::paintMenuListButtonDecorations): Ditto.
526         (WebCore::RenderThemeIOS::adjustSliderTrackStyle): Ditto.
527         (WebCore::RenderThemeIOS::adjustSliderThumbSize): Ditto.
528
529         * rendering/RenderWidget.cpp:
530         (WebCore::WidgetHierarchyUpdatesSuspensionScope::moveWidgets): Use move
531         insteead of swap and modern for loop instead of iterators.
532         (WebCore::moveWidgetToParentSoon): Take a reference instead of a pointer.
533         (WebCore::RenderWidget::setWidget): Update for above change.
534         (WebCore::RenderWidget::find): Take a reference instead of a pointer.
535         * rendering/RenderWidget.h: Updated for above changes.
536
537         * rendering/TextAutoSizing.cpp:
538         (WebCore::TextAutoSizingValue::reset): Updated since Length is passed as
539         rvalue reference now.
540
541         * rendering/mathml/MathMLStyle.cpp:
542         (WebCore::MathMLStyle::getMathMLStyle): Updated since mathMLStyle returns
543         a reference.
544         (WebCore::MathMLStyle::resolveMathMLStyleTree): Ditto.
545
546         * rendering/mathml/RenderMathMLBlock.h:
547         (WebCore::RenderMathMLBlock::mathMLStyle): Removed no-longer needed const_cast,
548         changed to return a reference rather than a pointer.
549         (WebCore::RenderMathMLTable::mathMLStyle): Ditto.
550
551         * rendering/mathml/RenderMathMLFraction.cpp:
552         (WebCore::RenderMathMLFraction::fractionParameters): Updated since mathMLStyle
553         returns a reference.
554         (WebCore::RenderMathMLFraction::stackParameters): Ditto.
555         * rendering/mathml/RenderMathMLOperator.h:
556         (WebCore::RenderMathMLOperator::isLargeOperatorInDisplayStyle): Ditto.
557         (WebCore::RenderMathMLOperator::shouldMoveLimits): Ditto.
558         * rendering/mathml/RenderMathMLRoot.cpp:
559         (WebCore::RenderMathMLRoot::verticalParameters): Ditto.
560         * rendering/mathml/RenderMathMLToken.cpp:
561         (WebCore::RenderMathMLToken::updateMathVariantGlyph): Ditto.
562
563         * rendering/style/BasicShapes.cpp:
564         (WebCore::floatSizeForLengthSize): Updated for LengthSize struct.
565         * rendering/style/BorderData.h:
566         (WebCore::BorderData::BorderData): Ditto.
567         (WebCore::BorderData::hasBorderRadius): Ditto.
568
569         * rendering/style/ContentData.cpp:
570         (WebCore::ContentData::clone): Updated member names.
571         * rendering/style/ContentData.h: Ditto.
572
573         * rendering/style/NinePieceImage.cpp:
574         (WebCore::NinePieceImage::computeSlices): Use initializer lists so we get
575         move optimization without requiring explicit WTFMove.
576
577         * rendering/style/DataRef.h:
578         (WebCore::DataRef::DataRef): Removed no-longer needed const_cast.
579         (WebCore::DataRef::replace): Added. This function is like Ref::replace, and
580         can be used to put a new value in and get an old value out without running into
581         the rule Ref has about not being reused once it becomes null because of being
582         moved out of. This function is a lot like std::exchange.
583         (WebCore::DataRef::operator const T&): Added operator so we can use these
584         as references without any function call in read-only contexts.
585         (WebCore::DataRef::get): Changed to return a reference rather than pointer.
586         (WebCore::DataRef::access): Ditto.
587
588         * rendering/style/KeyframeList.cpp:
589         (WebCore::KeyframeValue::timingFunction): Updated since timingFunction
590         returns a raw pointer.
591         (WebCore::KeyframeList::~KeyframeList): Removed unneeded call to clear,
592         which does things that are redundant since we are about to destroy all the
593         data members.
594         (WebCore::KeyframeList::operator==): Tweaked codign style a bit.
595
596         * rendering/style/NinePieceImage.h: Updated most functions in this class
597         for the changes to DataRef.
598
599         * rendering/style/RenderStyle.cpp: Updated nearly every function in this
600         class for the changes to DataRef, to eliminate the peculiar naming and use
601         our standard data member naming, m_memberName in a class, and memberName in a
602         struct or struct-like class for publicly accessible members, to pass, take,
603         and return more references and rvalue references, and to use modern for loops.
604         Other changes listed below function by function.
605         (WebCore::RenderStyle::defaultStyle): Use NeverDestroyed instead of allocating
606         on the heap.
607         (WebCore::RenderStyle::RenderStyle): Added a new constructor that performs
608         the replace operation, using a combination of DataRef::replace and std::exchange.
609         (WebCore::RenderStyle::replace): Added. Calls the above constructor.
610         (WebCore::RenderStyle::setScrollSnapType): Use SET_NESTED_VAR so we get equality
611         checks on this property, for the normal efficiency benefit.
612         (WebCore::RenderStyle::setDashboardRegion): Moved this here from the header.
613         (WebCore::RenderStyle::appendContent): Deleted.
614         (WebCore::RenderStyle::setContent): Refactored this set of functions to simplify.
615
616         * rendering/style/RenderStyle.h: Updated most functions as mentioned above.
617         Also updated macros to use the do/while(0) technique. Removed the long list of
618         friend classes with the elaborate comments; turned out none needed friendship
619         despite the comments. Made more things private. Moved large functions out of the
620         class definition.
621         (WebCore::RenderStyle::getTextShadowExtent): Deleted.
622         (WebCore::RenderStyle::getTextShadowHorizontalExtent): Deleted.
623         (WebCore::RenderStyle::getTextShadowVerticalExtent): Deleted.
624         (WebCore::RenderStyle::aspectRatio): Deleted.
625         (WebCore::RenderStyle::alignContentPosition): Deleted.
626         (WebCore::RenderStyle::alignContentDistribution): Deleted.
627         (WebCore::RenderStyle::alignContentOverflowAlignment): Deleted.
628         (WebCore::RenderStyle::alignItemsPosition): Deleted.
629         (WebCore::RenderStyle::alignItemsOverflowAlignment): Deleted.
630         (WebCore::RenderStyle::alignSelfPosition): Deleted.
631         (WebCore::RenderStyle::alignSelfOverflowAlignment): Deleted.
632         (WebCore::RenderStyle::justifyContentPosition): Deleted.
633         (WebCore::RenderStyle::justifyContentDistribution): Deleted.
634         (WebCore::RenderStyle::justifyContentOverflowAlignment): Deleted.
635         (WebCore::RenderStyle::justifyItemsPosition): Deleted.
636         (WebCore::RenderStyle::justifyItemsOverflowAlignment): Deleted.
637         (WebCore::RenderStyle::justifyItemsPositionType): Deleted.
638         (WebCore::RenderStyle::justifySelfPosition): Deleted.
639         (WebCore::RenderStyle::justifySelfOverflowAlignment): Deleted.
640         (WebCore::RenderStyle::setAlignContentPosition): Deleted.
641         (WebCore::RenderStyle::setAlignContentOverflow): Deleted.
642         (WebCore::RenderStyle::setAlignContentDistribution): Deleted.
643         (WebCore::RenderStyle::setAlignItemsOverflow): Deleted.
644         (WebCore::RenderStyle::setAlignSelfOverflow): Deleted.
645         (WebCore::RenderStyle::setJustifyContentOverflow): Deleted.
646         (WebCore::RenderStyle::setJustifyContentDistribution): Deleted.
647         (WebCore::RenderStyle::setJustifyItemsPosition): Deleted.
648         (WebCore::RenderStyle::setJustifyItemsOverflow): Deleted.
649         (WebCore::RenderStyle::setJustifyItemsPositionType): Deleted.
650         (WebCore::RenderStyle::setJustifySelfPosition): Deleted.
651         (WebCore::RenderStyle::setJustifySelfOverflow): Deleted.
652         (WebCore::RenderStyle::noninheritedFlagsMemoryOffset): Deleted.
653
654         * rendering/style/SVGRenderStyle.cpp: Similar changes to RenderStyle.cpp above.
655         * rendering/style/SVGRenderStyle.h: Ditto.
656
657         * rendering/style/ShapeValue.h:
658         (WebCore::ShapeValue::create): Take a Ref&& instead of a RefPtr.
659         (WebCore::ShapeValue::ShapeValue): Ditto.
660
661         * rendering/style/StyleBackgroundData.cpp: Update data member names.
662         * rendering/style/StyleBackgroundData.h: Ditto; make them public and remove the
663         getter functions.
664
665         * rendering/style/StyleCachedImage.cpp:
666         (WebCore::StyleCachedImage::cssValue): Removed no-longer-needed const_cast.
667
668         * rendering/style/StyleCustomPropertyData.h: Update data member names.
669         (WebCore::StyleCustomPropertyData::operator==): Removed unnecessary reference
670         count churn.
671         (WebCore::StyleCustomPropertyData::setCustomPropertyValue): Take an rvalue
672         reference.
673         (WebCore::StyleCustomPropertyData::getCustomPropertyValue): Deleted.
674         (WebCore::StyleCustomPropertyData::values): Deleted.
675         (WebCore::StyleCustomPropertyData::hasCustomProperty): Deleted.
676         (WebCore::StyleCustomPropertyData::containsVariables): Deleted.
677         (WebCore::StyleCustomPropertyData::setContainsVariables): Deleted.
678
679         * rendering/style/StyleFilterData.cpp: Update data member names.
680         * rendering/style/StyleFilterData.h: Ditto.
681         * rendering/style/StyleFlexibleBoxData.cpp: Ditto.
682         * rendering/style/StyleFlexibleBoxData.h: Ditto.
683         * rendering/style/StyleGridData.cpp: Ditto.
684         * rendering/style/StyleGridData.h: Ditto.
685         * rendering/style/StyleGridItemData.cpp: Ditto.
686         * rendering/style/StyleGridItemData.h: Ditto.
687
688         * rendering/style/StyleGeneratedImage.cpp:
689         (WebCore::StyleGeneratedImage::cssValue): Removed no-longer-needed const_cast.
690         (WebCore::StyleGeneratedImage::imageSize): Ditto.
691         (WebCore::StyleGeneratedImage::image): Ditto.
692
693         * rendering/style/StyleInheritedData.cpp: Update data member names.
694         * rendering/style/StyleInheritedData.h: Ditto.
695         * rendering/style/StyleRareInheritedData.cpp: Ditto.
696         * rendering/style/StyleRareInheritedData.h: Ditto.
697         * rendering/style/StyleMultiColData.cpp: Ditto.
698         * rendering/style/StyleMultiColData.h: Ditto.
699         * rendering/style/StyleRareNonInheritedData.cpp: Ditto.
700         * rendering/style/StyleRareNonInheritedData.h: Ditto.
701         * rendering/style/StyleTransformData.cpp: Ditto.
702         * rendering/style/StyleTransformData.h: Ditto.
703         * rendering/style/StyleVisualData.cpp: Ditto.
704         * rendering/style/StyleVisualData.h: Ditto.
705
706         * style/StylePendingResources.cpp:
707         (WebCore::Style::loadPendingResources): Update since layers are references.
708
709
710 2017-01-13  Chris Dumez  <cdumez@apple.com>
711
712         [WK2] Add diagnostic logging to measure WebGL usage
713         https://bugs.webkit.org/show_bug.cgi?id=166730
714         <rdar://problem/29883469>
715
716         Reviewed by Alex Christensen.
717
718         Add diagnostic logging to measure high performance WebGL usage. We report
719         at regular intervals in which WebGL state Safari is:
720         - Inactive
721         - ActiveInForegroundTab
722         - ActiveInBackgroundTabOnly
723
724         This should give us an estimate of:
725         - What % of the time is Safari using high performance graphics
726         - What % of this time is only due to background tabs
727
728         No new tests, no Web-facing behavior change.
729
730         * WebCore.xcodeproj/project.pbxproj:
731         * html/canvas/WebGLRenderingContextBase.cpp:
732         (WebCore::WebGLRenderingContextBase::create):
733         (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
734         (WebCore::WebGLRenderingContextBase::registerWithWebGLStateTracker):
735         * html/canvas/WebGLRenderingContextBase.h:
736         * page/DiagnosticLoggingKeys.cpp:
737         (WebCore::DiagnosticLoggingKeys::inactiveKey):
738         (WebCore::DiagnosticLoggingKeys::activeInForegroundTabKey):
739         (WebCore::DiagnosticLoggingKeys::activeInBackgroundTabOnlyKey):
740         (WebCore::DiagnosticLoggingKeys::stateKey):
741         (WebCore::WebCore::DiagnosticLoggingKeys::webGLKey):
742         * page/DiagnosticLoggingKeys.h:
743         * page/Page.cpp:
744         (WebCore::Page::Page):
745         * page/Page.h:
746         (WebCore::Page::webGLStateTracker):
747         * page/PageConfiguration.cpp:
748         * page/PageConfiguration.h:
749         * platform/WebGLStateTracker.cpp: Copied from Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h.
750         (WebCore::WebGLStateTracker::WebGLStateTracker):
751         (WebCore::m_stateChangeHandler):
752         (WebCore::WebGLStateTracker::updateWebGLState):
753         * platform/WebGLStateTracker.h: Copied from Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h.
754         * platform/graphics/GraphicsContext3DAttributes.h:
755
756 2017-01-13  Brent Fulgham  <bfulgham@apple.com>
757
758         Avoid nullptr frame dereference when scrollTo is called on a disconnected DOMWindow
759         https://bugs.webkit.org/show_bug.cgi?id=167030
760         <rdar://problem/29995070>
761
762         Reviewed by Dean Jackson.
763
764         Correct DOMWindow::scrollTo to match all other functions in the class so that the it
765         checks that the current frame is valid before attempting to use it.
766
767         * page/DOMWindow.cpp:
768         (WebCore::DOMWindow::scrollTo):
769
770 2017-01-13  Jer Noble  <jer.noble@apple.com>
771
772         Use a strong reference when calling callOnMainThread to schedule events in AudioScheduledSourceNode.
773         https://bugs.webkit.org/show_bug.cgi?id=166983
774
775         Reviewed by Brent Fulgham.
776
777         * Modules/webaudio/AudioScheduledSourceNode.cpp:
778         (WebCore::AudioScheduledSourceNode::finish):
779         * Modules/webaudio/AudioScheduledSourceNode.h:
780
781 2017-01-12  Jer Noble  <jer.noble@apple.com>
782
783         Protect MediaPlayer from being destroyed mid-load()
784         https://bugs.webkit.org/show_bug.cgi?id=166976
785
786         Reviewed by Eric Carlson.
787
788         It's possible for a message sent by MediaPlayer to HTMLMediaElement to cause
789         MediaPlayer to be destroyed before MediaPlayer::load() completes. We have
790         previously protected against this same problem in HTMLMediaElement::loadResource()
791         by ref'ing at the beginning of the function and deref'ing on exit. To do the
792         same in MediaPlayer, it must become RefCounted.
793
794         To keep the same semantics about m_client in MediaPlayer (always available without
795         requiring a null-check), make a new static MediaPlayerClient object which can
796         replace the real (HTMLMediaElement) client when the MediaPlayer is invalidated.
797
798         * html/HTMLMediaElement.cpp:
799         (WebCore::HTMLMediaElement::~HTMLMediaElement):
800         (WebCore::HTMLMediaElement::clearMediaPlayer):
801         (WebCore::HTMLMediaElement::createMediaPlayer):
802         * html/HTMLMediaElement.h:
803         * platform/graphics/MediaPlayer.cpp:
804         (WebCore::nullMediaPlayerClient):
805         (WebCore::MediaPlayer::create):
806         (WebCore::MediaPlayer::MediaPlayer):
807         (WebCore::MediaPlayer::invalidate):
808         (WebCore::MediaPlayer::load):
809         (WebCore::MediaPlayer::loadWithNextMediaEngine):
810         (WebCore::MediaPlayer::inMediaDocument):
811         (WebCore::MediaPlayer::fullscreenMode):
812         (WebCore::MediaPlayer::requestedRate):
813         (WebCore::MediaPlayer::currentPlaybackTargetIsWirelessChanged):
814         (WebCore::MediaPlayer::networkStateChanged):
815         (WebCore::MediaPlayer::readyStateChanged):
816         (WebCore::MediaPlayer::volumeChanged):
817         (WebCore::MediaPlayer::muteChanged):
818         (WebCore::MediaPlayer::timeChanged):
819         (WebCore::MediaPlayer::sizeChanged):
820         (WebCore::MediaPlayer::repaint):
821         (WebCore::MediaPlayer::durationChanged):
822         (WebCore::MediaPlayer::rateChanged):
823         (WebCore::MediaPlayer::playbackStateChanged):
824         (WebCore::MediaPlayer::firstVideoFrameAvailable):
825         (WebCore::MediaPlayer::characteristicChanged):
826         (WebCore::MediaPlayer::cachedKeyForKeyId):
827         (WebCore::MediaPlayer::keyNeeded):
828         (WebCore::MediaPlayer::mediaKeysStorageDirectory):
829         (WebCore::MediaPlayer::referrer):
830         (WebCore::MediaPlayer::userAgent):
831         (WebCore::MediaPlayer::graphicsDeviceAdapter):
832         (WebCore::MediaPlayer::cachedResourceLoader):
833         (WebCore::MediaPlayer::createResourceLoader):
834         (WebCore::MediaPlayer::addAudioTrack):
835         (WebCore::MediaPlayer::removeAudioTrack):
836         (WebCore::MediaPlayer::addTextTrack):
837         (WebCore::MediaPlayer::removeTextTrack):
838         (WebCore::MediaPlayer::addVideoTrack):
839         (WebCore::MediaPlayer::removeVideoTrack):
840         (WebCore::MediaPlayer::outOfBandTrackSources):
841         (WebCore::MediaPlayer::shouldWaitForResponseToAuthenticationChallenge):
842         (WebCore::MediaPlayer::handlePlaybackCommand):
843         (WebCore::MediaPlayer::sourceApplicationIdentifier):
844         (WebCore::MediaPlayer::preferredAudioCharacteristics):
845         (WebCore::MediaPlayer::doesHaveAttribute):
846         (WebCore::MediaPlayer::mediaPlayerNetworkInterfaceName):
847         (WebCore::MediaPlayer::getRawCookies):
848         (WebCore::MediaPlayer::shouldDisableSleep):
849         * platform/graphics/MediaPlayer.h:
850         (WebCore::MediaPlayer::platformVolumeConfigurationRequired):
851         (WebCore::MediaPlayer::client):
852
853 2017-01-13  Eric Carlson  <eric.carlson@apple.com>
854
855         [MediaStream, Mac] Add mock audio source
856         https://bugs.webkit.org/show_bug.cgi?id=166974
857
858         Reviewed by Jer Noble.
859         
860         Add a mock audio source for testing media streams.
861
862         No new tests, updated webaudio/mediastreamaudiosourcenode.html.
863
864         * WebCore.xcodeproj/project.pbxproj:
865         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
866         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueAudioSample):
867         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample):
868
869         * platform/mediastream/mac/AVAudioCaptureSource.h:
870         (WebCore::AVAudioCaptureSource::Observer::~Observer): Deleted.
871
872         * platform/mediastream/mac/AVAudioCaptureSource.mm:
873         (WebCore::AVAudioCaptureSource::addObserver):
874         (WebCore::AVAudioCaptureSource::removeObserver):
875         (WebCore::AVAudioCaptureSource::start):
876
877         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h: Added.
878         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm: Added.
879         (WebCore::MockRealtimeAudioSource::create):
880         (WebCore::MockRealtimeAudioSourceMac::MockRealtimeAudioSourceMac):
881         (WebCore::MockRealtimeAudioSource::createMuted):
882         (WebCore::MockRealtimeAudioSourceMac::addObserver):
883         (WebCore::MockRealtimeAudioSourceMac::removeObserver):
884         (WebCore::MockRealtimeAudioSourceMac::start):
885         (WebCore::MockRealtimeAudioSourceMac::emitSampleBuffers):
886         (WebCore::MockRealtimeAudioSourceMac::reconfigure):
887         (WebCore::MockRealtimeAudioSourceMac::render):
888         (WebCore::MockRealtimeAudioSourceMac::applySampleRate):
889         (WebCore::MockRealtimeAudioSourceMac::audioSourceProvider):
890
891         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h:
892         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
893         (WebCore::WebAudioSourceProviderAVFObjC::create):
894         (WebCore::WebAudioSourceProviderAVFObjC::WebAudioSourceProviderAVFObjC):
895         (WebCore::WebAudioSourceProviderAVFObjC::~WebAudioSourceProviderAVFObjC):
896         (WebCore::WebAudioSourceProviderAVFObjC::provideInput):
897         (WebCore::WebAudioSourceProviderAVFObjC::setClient):
898         (WebCore::WebAudioSourceProviderAVFObjC::startProducingData): Deleted.
899         (WebCore::WebAudioSourceProviderAVFObjC::stopProducingData): Deleted.
900
901         * platform/mock/MockRealtimeAudioSource.cpp:
902         (WebCore::MockRealtimeAudioSource::MockRealtimeAudioSource):
903         (WebCore::MockRealtimeAudioSource::startProducingData):
904         (WebCore::MockRealtimeAudioSource::stopProducingData):
905         (WebCore::MockRealtimeAudioSource::elapsedTime):
906         (WebCore::MockRealtimeAudioSource::tick):
907
908         * platform/mock/MockRealtimeAudioSource.h:
909         (WebCore::MockRealtimeAudioSource::render):
910         (WebCore::MockRealtimeAudioSource::renderInterval):
911         (WebCore::MockRealtimeAudioSource::~MockRealtimeAudioSource): Deleted.
912
913 2017-01-13  Sam Weinig  <sam@webkit.org>
914
915         [WebIDL] Remove custom bindings for DeviceMotionEvent and DeviceOrientationEvent
916         https://bugs.webkit.org/show_bug.cgi?id=167006
917
918         Reviewed by Geoffrey Garen.
919
920         * CMakeLists.txt:
921         * WebCore.xcodeproj/project.pbxproj:
922         * bindings/js/JSBindingsAllInOne.cpp:
923         * bindings/js/JSDeviceMotionEventCustom.cpp: Removed.
924         * bindings/js/JSDeviceOrientationEventCustom.cpp: Removed.
925         Remove Custom bindings files.
926
927         * dom/DeviceMotionData.cpp:
928         (WebCore::DeviceMotionData::create):
929         (WebCore::DeviceMotionData::DeviceMotionData):
930         (WebCore::DeviceMotionData::Acceleration::create): Deleted.
931         (WebCore::DeviceMotionData::Acceleration::Acceleration): Deleted.
932         (WebCore::DeviceMotionData::RotationRate::create): Deleted.
933         (WebCore::DeviceMotionData::RotationRate::RotationRate): Deleted.
934         * dom/DeviceMotionData.h:
935         (WebCore::DeviceMotionData::Acceleration::create):
936         (WebCore::DeviceMotionData::Acceleration::x):
937         (WebCore::DeviceMotionData::Acceleration::y):
938         (WebCore::DeviceMotionData::Acceleration::z):
939         (WebCore::DeviceMotionData::Acceleration::Acceleration):
940         (WebCore::DeviceMotionData::RotationRate::create):
941         (WebCore::DeviceMotionData::RotationRate::alpha):
942         (WebCore::DeviceMotionData::RotationRate::beta):
943         (WebCore::DeviceMotionData::RotationRate::gamma):
944         (WebCore::DeviceMotionData::RotationRate::RotationRate):
945         (WebCore::DeviceMotionData::interval):
946         (WebCore::DeviceMotionData::Acceleration::canProvideX): Deleted.
947         (WebCore::DeviceMotionData::Acceleration::canProvideY): Deleted.
948         (WebCore::DeviceMotionData::Acceleration::canProvideZ): Deleted.
949         (WebCore::DeviceMotionData::RotationRate::canProvideAlpha): Deleted.
950         (WebCore::DeviceMotionData::RotationRate::canProvideBeta): Deleted.
951         (WebCore::DeviceMotionData::RotationRate::canProvideGamma): Deleted.
952         (WebCore::DeviceMotionData::canProvideInterval): Deleted.
953         Re-work using std::optional rather than an explicit bool/value pair.
954
955         * dom/DeviceMotionEvent.cpp:
956         (WebCore::convert):
957         (WebCore::DeviceMotionEvent::acceleration):
958         (WebCore::DeviceMotionEvent::accelerationIncludingGravity):
959         (WebCore::DeviceMotionEvent::rotationRate):
960         (WebCore::DeviceMotionEvent::interval):
961         (WebCore::DeviceMotionEvent::initDeviceMotionEvent):
962         * dom/DeviceMotionEvent.h:
963         Implement IDL interface. For now, we have duplicate structs for
964         Acceleration and RotationRate (one here, one in DeviceMotionData)
965         which can be consolidated in the future.
966
967         * dom/DeviceMotionEvent.idl:
968         Add dictionaries for Acceleration and RotationRate, and update IDL to
969         specify the correct nullability of attributes and arguments.
970
971         * dom/DeviceOrientationData.cpp:
972         (WebCore::DeviceOrientationData::create):
973         (WebCore::DeviceOrientationData::DeviceOrientationData):
974         (WebCore::DeviceOrientationData::alpha): Deleted.
975         (WebCore::DeviceOrientationData::beta): Deleted.
976         (WebCore::DeviceOrientationData::gamma): Deleted.
977         (WebCore::DeviceOrientationData::absolute): Deleted.
978         (WebCore::DeviceOrientationData::canProvideAlpha): Deleted.
979         (WebCore::DeviceOrientationData::canProvideBeta): Deleted.
980         (WebCore::DeviceOrientationData::canProvideGamma): Deleted.
981         (WebCore::DeviceOrientationData::compassHeading): Deleted.
982         (WebCore::DeviceOrientationData::compassAccuracy): Deleted.
983         (WebCore::DeviceOrientationData::canProvideCompassHeading): Deleted.
984         (WebCore::DeviceOrientationData::canProvideCompassAccuracy): Deleted.
985         (WebCore::DeviceOrientationData::canProvideAbsolute): Deleted.
986         * dom/DeviceOrientationData.h:
987         (WebCore::DeviceOrientationData::create):
988         (WebCore::DeviceOrientationData::alpha):
989         (WebCore::DeviceOrientationData::beta):
990         (WebCore::DeviceOrientationData::gamma):
991         (WebCore::DeviceOrientationData::compassHeading):
992         (WebCore::DeviceOrientationData::compassAccuracy):
993         (WebCore::DeviceOrientationData::absolute):
994         Re-work using std::optional rather than an explicit bool/value pair.
995
996         * dom/DeviceOrientationEvent.cpp:
997         (WebCore::DeviceOrientationEvent::alpha):
998         (WebCore::DeviceOrientationEvent::beta):
999         (WebCore::DeviceOrientationEvent::gamma):
1000         (WebCore::DeviceOrientationEvent::compassHeading):
1001         (WebCore::DeviceOrientationEvent::compassAccuracy):
1002         (WebCore::DeviceOrientationEvent::initDeviceOrientationEvent):
1003         (WebCore::DeviceOrientationEvent::absolute):
1004         * dom/DeviceOrientationEvent.h:
1005         Implement IDL interface.
1006
1007         * dom/DeviceOrientationEvent.idl:
1008         Update IDL to specify the correct nullability of attributes and arguments.
1009
1010         * platform/ios/DeviceMotionClientIOS.mm:
1011         (WebCore::DeviceMotionClientIOS::motionChanged):
1012         * platform/ios/DeviceOrientationClientIOS.mm:
1013         (WebCore::DeviceOrientationClientIOS::orientationChanged):
1014         Update for use of std:optional.
1015
1016 2017-01-13  Zan Dobersek  <zdobersek@igalia.com>
1017
1018         [GStreamer] Cache the accelerated capability of MediaPlayerClient in MediaPlayerPrivateGStreamerBase
1019         https://bugs.webkit.org/show_bug.cgi?id=167015
1020
1021         Reviewed by Jer Noble.
1022
1023         In MediaPlayerPrivateGStreamerBase, avoid continuously querying the MediaPlayerClient
1024         object about the accelerated compositing capabilities. Instead, cache this information
1025         when creating the video sink (which is most affected by this information anyway), storing
1026         it in a new protected boolean member variable in the MediaPlayerPrivateGStreamerBase class.
1027
1028         All calls to MediaPlayerClient::mediaPlayerRenderingCanBeAccelerated() and
1029         MediaPlayerClient::mediaPlayerAcceleratedCompositingEnabled() are replaced by tests
1030         on the value of this new member variable.
1031
1032         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1033         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
1034         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1035         (WebCore::MediaPlayerPrivateGStreamerBase::naturalSize):
1036         (WebCore::MediaPlayerPrivateGStreamerBase::repaint):
1037         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
1038         (WebCore::MediaPlayerPrivateGStreamerBase::paint):
1039         (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink):
1040         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1041
1042 2017-01-13  Chris Dumez  <cdumez@apple.com>
1043
1044         Report post-page load CPU usage using diagnostic logging
1045         https://bugs.webkit.org/show_bug.cgi?id=166950
1046         <rdar://problem/30014496>
1047
1048         Reviewed by Alex Christensen.
1049
1050         Shortly after page load (5 seconds), we measure the WebContent process'
1051         CPU usage over 10 seconds and report the percentage back via release
1052         logging. We also log the percentage using diagnostic logging using the
1053         following buckets:
1054         - Below 10%
1055         - 10 to 20%
1056         - 20 to 40%
1057         - 60 to 80%
1058         - Over 80%
1059
1060         The logging works on both Mac and iOS. I verified that I get results
1061         consistent with Activity Monitor or top.
1062
1063         No new tests, no Web-facing behavior change, only extra logging.
1064
1065         * CMakeLists.txt:
1066         * WebCore.xcodeproj/project.pbxproj:
1067         * loader/FrameLoader.cpp:
1068         (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
1069         * page/DiagnosticLoggingKeys.cpp:
1070         (WebCore::DiagnosticLoggingKeys::postPageLoadKey):
1071         (WebCore::DiagnosticLoggingKeys::cpuUsageKey):
1072         * page/DiagnosticLoggingKeys.h:
1073         * page/Page.cpp:
1074         (WebCore::Page::Page):
1075         (WebCore::Page::didFinishLoad):
1076         (WebCore::cpuUsageToDiagnosticLogginKey):
1077         (WebCore::Page::measurePostLoadCPUUsage):
1078         * page/Page.h:
1079         * page/Settings.cpp:
1080         (WebCore::Settings::isPostLoadCPUUsageMeasurementEnabled):
1081         * page/Settings.h:
1082         * platform/CPUTime.cpp: Added.
1083         (WebCore::getCPUTime):
1084         (WebCore::CPUTime::percentageCPUUsageSince):
1085         * platform/CPUTime.h: Added.
1086         * platform/cocoa/CPUTimeCocoa.mm: Added.
1087         (WebCore::timeValueToMicroseconds):
1088         (WebCore::getCPUTime):
1089
1090 2017-01-13  Michael Catanzaro  <mcatanzaro@igalia.com>
1091
1092         Unreviewed, rolling out r210677.
1093         https://bugs.webkit.org/show_bug.cgi?id=167007
1094
1095         Caused many layout test timeouts on GTK+ bots
1096
1097         Reverted changeset:
1098
1099         "Protect MediaPlayer from being destroyed mid-load()"
1100         https://bugs.webkit.org/show_bug.cgi?id=166976
1101         http://trac.webkit.org/changeset/210677
1102
1103 2017-01-13  Konstantin Tokarev  <annulen@yandex.ru>
1104
1105         Added preprocessor guard for iOS-specific piece of code in GraphicsContext3DOpenGL
1106         https://bugs.webkit.org/show_bug.cgi?id=167005
1107
1108         Reviewed by Alex Christensen.
1109
1110         Variable "boundFrameBuffer" is used only in iOS-specific code
1111
1112         No new tests needed.
1113
1114         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
1115         (WebCore::GraphicsContext3D::resolveMultisamplingIfNecessary):
1116
1117 2017-01-13  Eric Carlson  <eric.carlson@apple.com>
1118
1119         REGRESSION (r210621): [mac-wk2] LayoutTest fast/mediastream/MediaStream-video-element-video-tracks-disabled-then-enabled.html timing out
1120         https://bugs.webkit.org/show_bug.cgi?id=166980
1121
1122         Unreviewed, fix test broken by r210621.
1123
1124         No new tests, updated fast/mediastream/MediaStream-video-element-video-tracks-disabled-then-enabled.html
1125         and results.
1126
1127         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1128         (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]):
1129           Drive-by fix: null-check parent.
1130         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerStatusDidChange): Do nothing if the layer
1131           has changed since the KVO notification.
1132
1133 2017-01-13  Carlos Garcia Campos  <cgarcia@igalia.com>
1134
1135         [SOUP] Simplify cookie storage handling
1136         https://bugs.webkit.org/show_bug.cgi?id=166967
1137
1138         Reviewed by Sergio Villar Senin.
1139
1140         We currently have a global cookie storage, and several create() methods in SoupNetworkSession to create sessions
1141         with different cookie jars. This could be simplified by moving the cookie storage handling to
1142         NetworkStorageSession and removing all create() methods from SoupNetworkSession. This patch also removes the
1143         default SoupNetworkSession in favor of using the default NetworkStorageSession.
1144
1145         * platform/network/NetworkStorageSession.h: Add a default cookie storage to be used when the
1146         NetworkStorageSession doesn't have a platform soup session.
1147         * platform/network/soup/CookieJarSoup.cpp: Remove the global cookie storage handling.
1148         (WebCore::setCookiesFromDOM): Use NetworkStorageSession::cookieStorage() instead.
1149         (WebCore::cookiesForSession): Ditto.
1150         (WebCore::cookiesEnabled): Check the policy instead like all other ports do, since now we will always have a
1151         default shared cookie jar.
1152         (WebCore::getRawCookies): Use NetworkStorageSession::cookieStorage() instead.
1153         (WebCore::deleteCookie): Ditto.
1154         (WebCore::addCookie): Ditto.
1155         (WebCore::getHostnamesWithCookies): Ditto.
1156         (WebCore::deleteCookiesForHostnames): Ditto.
1157         (WebCore::deleteAllCookies): Ditto.
1158         * platform/network/soup/CookieJarSoup.h: Removed.
1159         * platform/network/soup/CookieStorageSoup.cpp:
1160         (WebCore::soupCookiesChanged): Use the cookie storage from the NetworkStorageSession::defaultStorageSession().
1161         (WebCore::startObservingCookieChanges): Ditto.
1162         (WebCore::stopObservingCookieChanges): Ditto.
1163         * platform/network/soup/DNSSoup.cpp:
1164         (WebCore::DNSResolveQueue::updateIsUsingProxy): Get the SoupSession from the NetworkStorageSession::defaultStorageSession().
1165         (WebCore::DNSResolveQueue::platformResolve): Ditto.
1166         * platform/network/soup/NetworkStorageSessionSoup.cpp:
1167         (WebCore::NetworkStorageSession::NetworkStorageSession):
1168         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession): Create a new SoupNetworkSession without
1169         providing a cookie storage to ensure it creates its own private one.
1170         (WebCore::NetworkStorageSession::switchToNewTestingSession): Ditto.
1171         (WebCore::NetworkStorageSession::soupNetworkSession): Create the SoupNetworkSession on demand passing the global
1172         shared cookie storage.
1173         (WebCore::NetworkStorageSession::cookieStorage): Return the cookie storage from the SoupNetworkSession if we
1174         have one, otherwise create the global shared one and return it.
1175         * platform/network/soup/ResourceHandleSoup.cpp:
1176         (WebCore::sessionFromContext): Get the SoupSession from the NetworkStorageSession::defaultStorageSession().
1177         * platform/network/soup/SoupNetworkSession.cpp:
1178         (WebCore::SoupNetworkSession::SoupNetworkSession): Remove all create methods and the unused constructor that
1179         receives a SoupSession. Allow to pass a nullptr SoupCookieJar and create one in such case.
1180         * platform/network/soup/SoupNetworkSession.h:
1181
1182 2017-01-12  Tim Horton  <timothy_horton@apple.com>
1183
1184         Keyboard accessory bar can appear on top of full-screen video
1185         https://bugs.webkit.org/show_bug.cgi?id=166902
1186         <rdar://problem/29668223>
1187
1188         Reviewed by Darin Adler.
1189
1190         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
1191         (WebVideoFullscreenInterfaceAVKit::setupFullscreen):
1192         Increase the full-screen video window level to one above the keyboard,
1193         to ensure that the video is never obscured by the keyboard or its
1194         accessory views.
1195
1196 2017-01-12  Joseph Pecoraro  <pecoraro@apple.com>
1197
1198         Remove unnecessary includes of Page.h
1199         https://bugs.webkit.org/show_bug.cgi?id=166996
1200
1201         Reviewed by Yusuke Suzuki.
1202
1203         * Modules/plugins/QuickTimePluginReplacement.mm:
1204         * Modules/plugins/YouTubePluginReplacement.cpp:
1205         * Modules/webdatabase/Database.cpp:
1206         * Modules/webdatabase/DatabaseTracker.cpp:
1207         * Modules/webdriver/NavigatorWebDriver.cpp:
1208         * accessibility/AccessibilityNodeObject.cpp:
1209         * dom/Range.cpp:
1210         * dom/ScriptElement.cpp:
1211         * dom/ViewportArguments.cpp:
1212         * html/HTMLBodyElement.cpp:
1213         * html/HTMLCanvasElement.cpp:
1214         * html/HTMLDocument.cpp:
1215         * html/HTMLFormControlElementWithState.cpp:
1216         * html/HTMLImageElement.cpp:
1217         * html/HTMLLinkElement.cpp:
1218         * html/PluginDocument.cpp:
1219         * inspector/InspectorApplicationCacheAgent.cpp:
1220         * loader/LoadTiming.cpp:
1221         * loader/cache/CachedImage.cpp:
1222         * loader/cache/CachedResource.cpp:
1223         * page/DeviceController.cpp:
1224         * page/TextIndicator.cpp:
1225         * page/efl/DragControllerEfl.cpp:
1226         * platform/audio/ios/AudioDestinationIOS.cpp:
1227         * platform/ios/PasteboardIOS.mm:
1228         * platform/ios/ScrollAnimatorIOS.mm:
1229         * platform/ios/WidgetIOS.mm:
1230         * platform/mac/PasteboardMac.mm:
1231         * platform/network/mac/ResourceHandleMac.mm:
1232         * platform/win/MainThreadSharedTimerWin.cpp:
1233         * platform/win/PasteboardWin.cpp:
1234         * platform/win/PlatformScreenWin.cpp:
1235         * platform/win/WidgetWin.cpp:
1236         * rendering/InlineBox.cpp:
1237         * rendering/RenderAttachment.cpp:
1238         * rendering/RenderBoxModelObject.cpp:
1239         * rendering/RenderIFrame.cpp:
1240         * rendering/RenderInline.cpp:
1241         * rendering/RenderReplaced.cpp:
1242         * rendering/RenderTextControlSingleLine.cpp:
1243         * rendering/RootInlineBox.cpp:
1244         * rendering/svg/RenderSVGResourceFilter.cpp:
1245         * rendering/svg/SVGRenderingContext.cpp:
1246         * style/StyleScope.cpp:
1247         * svg/SVGDocumentExtensions.cpp:
1248         * svg/graphics/SVGImageCache.cpp:
1249         * xml/XSLTProcessor.cpp:
1250         * xml/parser/XMLDocumentParserLibxml2.cpp:
1251
1252 2017-01-12  Chris Dumez  <cdumez@apple.com>
1253
1254         Add KEYBOARD_KEY_ATTRIBUTE / KEYBOARD_CODE_ATTRIBUTE to FeatureDefines.xcconfig
1255         https://bugs.webkit.org/show_bug.cgi?id=166995
1256
1257         Reviewed by Jer Noble.
1258
1259         Add KEYBOARD_KEY_ATTRIBUTE / KEYBOARD_CODE_ATTRIBUTE to FeatureDefines.xcconfig
1260         as some people are having trouble building without it.
1261
1262         * Configurations/FeatureDefines.xcconfig:
1263
1264 2017-01-12  Ryan Haddad  <ryanhaddad@apple.com>
1265
1266         Unreviewed, rolling out r210680.
1267
1268         This change caused LayoutTest timeouts and assertion failures.
1269
1270         Reverted changeset:
1271
1272         "Use GenericEventQueue rather than callOnMainThread to
1273         schedule events in AudioScheduledSourceNode."
1274         https://bugs.webkit.org/show_bug.cgi?id=166983
1275         http://trac.webkit.org/changeset/210680
1276
1277 2017-01-12  Chris Dumez  <cdumez@apple.com>
1278
1279         [iOS] HTML form validation popover sometimes does not go away
1280         https://bugs.webkit.org/show_bug.cgi?id=166990
1281         <rdar://problem/29985957>
1282
1283         Reviewed by Tim Horton.
1284
1285         The issue was that [UIViewController presentViewController:] is asynchronous
1286         and that we sometimes tried to call [m_popoverController dismissViewControllerAnimated:]
1287         before presentViewController had completed. This is something that UIKit does
1288         not handle nicely and the popover just stays visible even though we have
1289         asked for the controller to be dismissed and destroyed the ValidationBubble
1290         object.
1291
1292         To address the issue, I made ValidationBubble RefCounted and make sure the
1293         ValidationBubble object stays alive at least until the completion handler for
1294         [UIViewController presentViewController:] has been called. This is done via
1295         protecting the object using a RefPtr<> and capturing it in the lambda.
1296         Because dismissViewControllerAnimated is called in the destructor, it is no
1297         longer possible to call dismissViewControllerAnimated before the call to
1298         presentViewController has completed.
1299
1300         No new tests, no easily testable since the popover was staying visible
1301         after being destroyed (held on by UIKit).
1302
1303         * platform/ValidationBubble.h:
1304         (WebCore::ValidationBubble::create):
1305         * platform/ios/ValidationBubbleIOS.mm:
1306         (WebCore::ValidationBubble::show):
1307
1308 2017-01-12  Andreas Kling  <akling@apple.com>
1309
1310         [iOS] Purge GraphicsServices font cache on memory warning.
1311         <https://webkit.org/b/154343>
1312
1313         Reviewed by Antti Koivisto.
1314
1315         The GS font cache was retaining CSS fonts after we stopped using them.
1316         Call SPI to release them on memory pressure. This is one of multiple
1317         steps necessary to actually free the fonts.
1318
1319         * Configurations/WebCore.xcconfig:
1320         * page/cocoa/MemoryReleaseCocoa.mm:
1321         (WebCore::platformReleaseMemory):
1322         * platform/cocoa/MemoryPressureHandlerCocoa.mm:
1323         * platform/spi/ios/GraphicsServicesSPI.h:
1324
1325 2017-01-12  Chris Dumez  <cdumez@apple.com>
1326
1327         Unreviewed EFL/GTK build fix after r210684.
1328
1329         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1330         (WebCore::IDBServer::UniqueIDBDatabase::performPrefetchCursor):
1331
1332 2017-01-12  Brady Eidson  <beidson@apple.com>
1333
1334         REGRESSION (r209977): Crash in UniqueIDBDatabase::executeNextDatabaseTask.
1335         https://bugs.webkit.org/show_bug.cgi?id=166984
1336
1337         Reviewed by Alex Christensen.
1338
1339         No new tests (Unable to reproduce, speculative fix).
1340
1341         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1342         (WebCore::IDBServer::UniqueIDBDatabase::performIterateCursor): If we're not already prefetching for this cursor,
1343           starting doing so after holding a protector ref.
1344         (WebCore::IDBServer::UniqueIDBDatabase::performPrefetchCursor): If we're now done prefetching for this cursor,
1345           schedule the protector ref to be destroyed on the main thread.
1346         * Modules/indexeddb/server/UniqueIDBDatabase.h:
1347
1348 2017-01-12  Youenn Fablet  <youenn@apple.com>
1349
1350         Make ApplicationCacheHost::maybeLoadSynchronously more robust
1351         https://bugs.webkit.org/show_bug.cgi?id=165192
1352
1353         Reviewed by Alex Christensen.
1354
1355         No change of behavior.
1356         Currently, in case out parameter "data" is not null and shouldLoadResourceFromApplicationCache returns false and resource is null, we might dereference a null pointer when calling maybeLoadSynchronously.
1357         We refactor the code to ensure that this case cannot happen anymore.
1358
1359         * loader/appcache/ApplicationCacheHost.cpp:
1360         (WebCore::bufferFromResource):
1361         (WebCore::ApplicationCacheHost::maybeLoadSynchronously):
1362
1363 2017-01-12  Alex Christensen  <achristensen@webkit.org>
1364
1365         Update style of ResourceHandleInternal
1366         https://bugs.webkit.org/show_bug.cgi?id=166952
1367
1368         Reviewed by Andreas Kling.
1369
1370         No change in behavior.  Just un-indent and use initializer lists.
1371
1372         * platform/network/ResourceHandleInternal.h:
1373         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
1374         (WebCore::ResourceHandleInternal::client):
1375
1376 2017-01-12  Jer Noble  <jer.noble@apple.com>
1377
1378         Use GenericEventQueue rather than callOnMainThread to schedule events in AudioScheduledSourceNode.
1379         https://bugs.webkit.org/show_bug.cgi?id=166983
1380
1381         Reviewed by Brent Fulgham.
1382
1383         * Modules/webaudio/AudioScheduledSourceNode.cpp:
1384         (WebCore::AudioScheduledSourceNode::AudioScheduledSourceNode):
1385         (WebCore::AudioScheduledSourceNode::finish):
1386         * Modules/webaudio/AudioScheduledSourceNode.h:
1387
1388 2017-01-12  Youenn Fablet  <youenn@apple.com>
1389
1390         OneDrive application crashes upon launch
1391         https://bugs.webkit.org/show_bug.cgi?id=166975
1392
1393         Reviewed by Brady Eidson.
1394
1395         Checking whether load is terminated just after calling ResourceLoader::willSendRequestInternal.
1396         The reason is that delegate call may actually cancel the load at that point.
1397
1398         * loader/SubresourceLoader.cpp:
1399         (WebCore::SubresourceLoader::willSendRequestInternal):
1400
1401 2017-01-12  Jer Noble  <jer.noble@apple.com>
1402
1403         Protect MediaPlayer from being destroyed mid-load()
1404         https://bugs.webkit.org/show_bug.cgi?id=166976
1405
1406         Reviewed by Eric Carlson.
1407
1408         It's possible for a message sent by MediaPlayer to HTMLMediaElement to cause
1409         MediaPlayer to be destroyed before MediaPlayer::load() completes. We have
1410         previously protected against this same problem in HTMLMediaElement::loadResource()
1411         by ref'ing at the beginning of the function and deref'ing on exit. To do the
1412         same in MediaPlayer, it must become RefCounted.
1413
1414         To keep the same semantics about m_client in MediaPlayer (always available without
1415         requiring a null-check), make a new static MediaPlayerClient object which can
1416         replace the real (HTMLMediaElement) client when the MediaPlayer is invalidated.
1417
1418         * html/HTMLMediaElement.cpp:
1419         (WebCore::HTMLMediaElement::~HTMLMediaElement):
1420         (WebCore::HTMLMediaElement::clearMediaPlayer):
1421         (WebCore::HTMLMediaElement::createMediaPlayer):
1422         * html/HTMLMediaElement.h:
1423         * platform/graphics/MediaPlayer.cpp:
1424         (WebCore::nullMediaPlayerClient):
1425         (WebCore::MediaPlayer::create):
1426         (WebCore::MediaPlayer::MediaPlayer):
1427         (WebCore::MediaPlayer::invalidate):
1428         (WebCore::MediaPlayer::load):
1429         (WebCore::MediaPlayer::loadWithNextMediaEngine):
1430         (WebCore::MediaPlayer::inMediaDocument):
1431         (WebCore::MediaPlayer::fullscreenMode):
1432         (WebCore::MediaPlayer::requestedRate):
1433         (WebCore::MediaPlayer::currentPlaybackTargetIsWirelessChanged):
1434         (WebCore::MediaPlayer::networkStateChanged):
1435         (WebCore::MediaPlayer::readyStateChanged):
1436         (WebCore::MediaPlayer::volumeChanged):
1437         (WebCore::MediaPlayer::muteChanged):
1438         (WebCore::MediaPlayer::timeChanged):
1439         (WebCore::MediaPlayer::sizeChanged):
1440         (WebCore::MediaPlayer::repaint):
1441         (WebCore::MediaPlayer::durationChanged):
1442         (WebCore::MediaPlayer::rateChanged):
1443         (WebCore::MediaPlayer::playbackStateChanged):
1444         (WebCore::MediaPlayer::firstVideoFrameAvailable):
1445         (WebCore::MediaPlayer::characteristicChanged):
1446         (WebCore::MediaPlayer::cachedKeyForKeyId):
1447         (WebCore::MediaPlayer::keyNeeded):
1448         (WebCore::MediaPlayer::mediaKeysStorageDirectory):
1449         (WebCore::MediaPlayer::referrer):
1450         (WebCore::MediaPlayer::userAgent):
1451         (WebCore::MediaPlayer::graphicsDeviceAdapter):
1452         (WebCore::MediaPlayer::cachedResourceLoader):
1453         (WebCore::MediaPlayer::createResourceLoader):
1454         (WebCore::MediaPlayer::addAudioTrack):
1455         (WebCore::MediaPlayer::removeAudioTrack):
1456         (WebCore::MediaPlayer::addTextTrack):
1457         (WebCore::MediaPlayer::removeTextTrack):
1458         (WebCore::MediaPlayer::addVideoTrack):
1459         (WebCore::MediaPlayer::removeVideoTrack):
1460         (WebCore::MediaPlayer::outOfBandTrackSources):
1461         (WebCore::MediaPlayer::shouldWaitForResponseToAuthenticationChallenge):
1462         (WebCore::MediaPlayer::handlePlaybackCommand):
1463         (WebCore::MediaPlayer::sourceApplicationIdentifier):
1464         (WebCore::MediaPlayer::preferredAudioCharacteristics):
1465         (WebCore::MediaPlayer::doesHaveAttribute):
1466         (WebCore::MediaPlayer::mediaPlayerNetworkInterfaceName):
1467         (WebCore::MediaPlayer::getRawCookies):
1468         (WebCore::MediaPlayer::shouldDisableSleep):
1469         * platform/graphics/MediaPlayer.h:
1470         (WebCore::MediaPlayer::platformVolumeConfigurationRequired):
1471         (WebCore::MediaPlayer::client):
1472
1473 2017-01-12  Sam Weinig  <sam@webkit.org>
1474
1475         Update bindings test results.
1476
1477         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
1478         (WebCore::JSTestCustomNamedGetter::getOwnPropertySlot):
1479         (WebCore::JSTestCustomNamedGetter::getOwnPropertySlotByIndex):
1480         * bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
1481         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1482         (WebCore::JSTestEventTarget::getOwnPropertySlot):
1483         (WebCore::JSTestEventTarget::getOwnPropertySlotByIndex):
1484         (WebCore::JSTestEventTarget::getOwnPropertyNames):
1485         * bindings/scripts/test/JS/JSTestEventTarget.h:
1486         * bindings/scripts/test/JS/JSTestInterface.cpp:
1487         (WebCore::JSTestInterface::put):
1488         (WebCore::JSTestInterface::putByIndex):
1489         * bindings/scripts/test/JS/JSTestInterface.h:
1490         * bindings/scripts/test/JS/JSTestObj.cpp:
1491         (WebCore::JSTestObj::getOwnPropertySlot):
1492         (WebCore::JSTestObj::getOwnPropertySlotByIndex):
1493         (WebCore::JSTestObj::getOwnPropertyNames):
1494         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
1495         (WebCore::JSTestOverrideBuiltins::getOwnPropertySlot):
1496         (WebCore::JSTestOverrideBuiltins::getOwnPropertySlotByIndex):
1497         (WebCore::JSTestOverrideBuiltins::getOwnPropertyNames):
1498         * bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
1499
1500 2017-01-12  Zan Dobersek  <zdobersek@igalia.com>
1501
1502         [GTK] WebKitWebProcess at 100% CPU loading hyphenation dictionaries
1503         https://bugs.webkit.org/show_bug.cgi?id=165601
1504
1505         Reviewed by Carlos Garcia Campos.
1506
1507         In HyphenationLibHyphen, retrieve the canonicalized absolute pathname of the dictionary file
1508         in order to avoid storing symbolic links as the target files for specific locales. libhyphen
1509         distributes its dictionary files by linking a set of similar locales files to a single file.
1510         Not resolving those symbolic links means we'll be opening a single file via multiple
1511         HyphenationDictionary objects, which is far from optimal.
1512
1513         To add insult to injury, these HyphenationDictionary objects were stored in a TinyLRUCache
1514         with a slim capacity of 4. This meant that while already loading one single file through
1515         multiple symlinks, because of continuous eviciton from this LRU cache the same symlinks
1516         continued to be processed, in some cases resulting in opening the same dictionary file
1517         hundreds or thousands of times. The capacity of this TinyLRUCache is increased to 32
1518         to keep the amount of open libhyphen dictionaries capped at some reasonable number.
1519
1520         * platform/text/hyphen/HyphenationLibHyphen.cpp:
1521         (WebCore::scanDirectoryForDicionaries):
1522
1523 2017-01-12  Javier Fernandez  <jfernandez@igalia.com>
1524
1525         [css-grid] Make the grid sizing data persistent through layouts
1526         https://bugs.webkit.org/show_bug.cgi?id=166883
1527
1528         Reviewed by Darin Adler and Manuel Rego Casasnovas.
1529
1530         We want to keep the grid sizing data structures through different
1531         layouts. This will allow to optimize some operations, reusing
1532         these data while still valid. Additionally, operations like
1533         determining the baseline position when the grid container is under
1534         an inline formatting context need these data once the grid has
1535         been laid out.
1536
1537         This patch controls the sizing data validity and make the data
1538         structures persistent after layout.
1539
1540         Tests: fast/css-grid-layout/grid-add-item-with-positioned-items.html
1541                fast/css-grid-layout/grid-add-positioned-block-item-after-inline-item.html
1542                fast/css-grid-layout/grid-container-change-explicit-grid-recompute-child.html
1543                fast/css-grid-layout/grid-item-change-order-auto-flow.html
1544
1545         * rendering/RenderBox.cpp:
1546         (WebCore::RenderBox::styleDidChange): Evaluate if the style change made the grid data invalid.
1547         (WebCore::RenderBox::updateGridPositionAfterStyleChange): Evaluate if the style change made the grid data invalid.
1548         * rendering/RenderBox.h:
1549         * rendering/RenderGrid.cpp:
1550         (WebCore::RenderGrid::Grid::setNeedsItemsPlacement): The grid must execute the items placement logic before continue processing the layout.
1551         (WebCore::RenderGrid::addChild): Mark the grid data as dirty.
1552         (WebCore::RenderGrid::removeChild): Mark the grid data as dirty.
1553         (WebCore::RenderGrid::styleDidChange): Evaluate grid data validity.
1554         (WebCore::RenderGrid::explicitGridDidResize): Mark the grid data as dirty.
1555         (WebCore::RenderGrid::namedGridLinesDefinitionDidChange): Mark the grid data as dirty.
1556         (WebCore::RenderGrid::layoutBlock): We don't need to clear the grid data anymore.
1557         (WebCore::RenderGrid::dirtyGrid): Clearing the grid data and mark is as needing to execute the items placement logic.
1558         (WebCore::RenderGrid::trackSizesForComputedStyle): Assert we don't need to perform the items placement logic.
1559         (WebCore::RenderGrid::paintChildren): Assert we don't need to perform the items placement logic.
1560         * rendering/RenderGrid.h:
1561         (WebCore::RenderGrid::clear): Deleted.
1562
1563 2017-01-12  Chris Dumez  <cdumez@apple.com>
1564
1565         [iOS] Implement support for KeyboardEvent.code
1566         https://bugs.webkit.org/show_bug.cgi?id=166932
1567         <rdar://problem/29972518>
1568
1569         Reviewed by Darin Adler.
1570
1571         Implement support for KeyboardEvent.code on iOS.
1572
1573         No new tests, updated existing test.
1574
1575         * platform/ios/PlatformEventFactoryIOS.h:
1576         * platform/ios/PlatformEventFactoryIOS.mm:
1577         (WebCore::codeForKeyEvent):
1578         (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
1579
1580 2017-01-12  Sam Weinig  <sam@webkit.org>
1581
1582         [WebIDL] Autogenerate named getters
1583         https://bugs.webkit.org/show_bug.cgi?id=166835
1584
1585         Reviewed by Alex Christensen.
1586
1587         * Modules/mediastream/RTCStatsResponse.idl:
1588         Update type to be nullable, since generator expects that for now.
1589
1590         * WebCore.xcodeproj/project.pbxproj:
1591         * bindings/js/JSCustomSQLStatementErrorCallback.cpp: Removed.
1592         * bindings/js/JSDOMMimeTypeArrayCustom.cpp: Removed.
1593         * bindings/js/JSDOMNamedFlowCollectionCustom.cpp: Removed.
1594         * bindings/js/JSDOMPluginArrayCustom.cpp: Removed.
1595         * bindings/js/JSDOMPluginCustom.cpp: Removed.
1596         * bindings/js/JSNamedNodeMapCustom.cpp: Removed.
1597         * bindings/js/JSRTCStatsResponseCustom.cpp: Removed.
1598         * bindings/js/JSStyleSheetListCustom.cpp: Removed.
1599         Remove deleted files.
1600
1601         * bindings/js/JSSQLStatementErrorCallbackCustom.cpp: 
1602         Renamed from Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp for consistency.
1603
1604         * bindings/IDLTypes.h:
1605         (WebCore::IDLNullable::nullValue):
1606         (WebCore::IDLNullable::isNullValue):
1607         (WebCore::IDLNullable::extractValueFromNullable):
1608         Add Nullable traits for IDLNullable, that call down to the underlying type. This allows
1609         us to more easily tests for nullability without stripping the IDLNullable off.
1610
1611         * bindings/js/JSDOMStringMapCustom.cpp:
1612         (WebCore::JSDOMStringMap::getOwnPropertySlotDelegate): Deleted.
1613         (WebCore::JSDOMStringMap::getOwnPropertyNames): Deleted.
1614         Remove overriden getOwnPropertySlot and getOwnPropertyNames.
1615
1616         * bindings/js/JSHTMLCollectionCustom.cpp:
1617         (WebCore::JSHTMLCollection::nameGetter): Deleted.
1618         * bindings/js/JSHTMLFormElementCustom.cpp:
1619         (WebCore::JSHTMLFormElement::nameGetter): Deleted.
1620         * bindings/js/JSHTMLOptionsCollectionCustom.cpp:
1621         (WebCore::JSHTMLOptionsCollection::nameGetter): Deleted.
1622         * bindings/js/JSStorageCustom.cpp:
1623         (WebCore::JSStorage::nameGetter): Deleted.
1624         Remove custom name getters.
1625
1626         * bindings/js/JSHTMLSelectElementCustom.cpp:
1627         (WebCore::selectElementIndexSetter):
1628         * html/HTMLSelectElement.cpp:
1629         (WebCore::HTMLSelectElement::setItem):
1630         (WebCore::HTMLSelectElement::setLength):
1631         (WebCore::HTMLSelectElement::setOption): Deleted.
1632         * html/HTMLSelectElement.h:
1633         Add implementation of HTMLSelectElement::setItem() that does properly
1634         removes if the option is null. Re-implement selectElementIndexSetter to
1635         use it and switch conversion code to use JSDOMConvert.
1636
1637         * bindings/scripts/CodeGeneratorJS.pm:
1638         (GenerateIndexedGetter):
1639         (GenerateNamedGetter):
1640         Extract typed getter generation into their own functions.
1641
1642         (GenerateGetOwnPropertySlotBody):
1643         (GenerateGetOwnPropertySlotBodyByIndex):
1644         Extract getOwnPropertySlotBody / getOwnPropertySlotBodyByIndex generation
1645         into their own functions. Add support for generating name getters.
1646
1647         (GenerateGetOwnPropertyNames):
1648         Extract getOwnPropertyNames generation into its own function, adding support
1649         for respecting the LegacyUnenumerableNamedProperties attribute and switching
1650         the default to not include named properties in the enumerated names.
1651
1652         (GeneratePut):
1653         (GeneratePutByIndex):
1654         Extract put / putByIndex generators into their own functions in preparation
1655         of supporting namedSetters in the future.
1656
1657         (GetIndexedSetterFunction):
1658         (GetNamedSetterFunction):
1659         (GetNamedDeleterFunction):
1660         Add helper getter functions to extract named/index setter/deleters.
1661
1662         (InstanceOverridesPut):
1663         Add helper predicate to determine if an interface needs an implementation
1664         of put.
1665
1666         (GenerateHeader):
1667         Place custom helper functions (e.g. nameGetter/putDelegate/etc.) together
1668         in the generated header.
1669
1670         (GenerateImplementation):
1671         (GenerateCallbackImplementationContent):
1672         Replace inline generation with calls to the new helper generator functions.
1673
1674         (NativeToJSValueUsingReferences):
1675         (NativeToJSValueUsingPointers):
1676         (NativeToJSValue):
1677         Remove unused inFunctionCall parameter, and add new suppressExceptionCheck
1678         parameter, which is used for nameGetters.
1679
1680         * bindings/scripts/IDLAttributes.txt:
1681         Add LegacyUnenumerableNamedProperties.
1682     
1683         * css/StyleSheetList.cpp:
1684         (WebCore::StyleSheetList::namedItem):
1685         (WebCore::StyleSheetList::getNamedItem): Deleted.
1686         * css/StyleSheetList.h:
1687         * css/StyleSheetList.idl:
1688         Rename getNamedItem to namedItem, and make it return a CSSStyleSheet*
1689         which is what the bindings specify.
1690
1691         * dom/DOMNamedFlowCollection.idl:
1692         Add LegacyUnenumerableNamedProperties to match existing behavior.
1693
1694         * dom/DOMStringMap.h:
1695         Switch from typedef to type alias.
1696
1697         * dom/DOMStringMap.idl:
1698         Remove CustomEnumerateProperty and JSCustomGetOwnPropertySlotAndDescriptor
1699         and add the getter. Also add the missing setter and deleter commented out.
1700
1701         * dom/DatasetDOMStringMap.h:
1702         * dom/DatasetDOMStringMap.cpp:
1703         (WebCore::DatasetDOMStringMap::supportedPropertyNames):
1704         (WebCore::DatasetDOMStringMap::names): Deleted.
1705         Rename names to supportedPropertyNames to support the bindings.
1706
1707         (WebCore::DatasetDOMStringMap::item):
1708         (WebCore::DatasetDOMStringMap::namedItem):
1709         Add namedItems (to support the bindings), and rework item to return
1710         an optional rather than using a bool out parameter.
1711
1712         * dom/NamedNodeMap.idl:
1713         Add LegacyUnenumerableNamedProperties matching the spec.
1714
1715         * html/HTMLAllCollection.idl:
1716         Add CustomNamedGetter and LegacyUnenumerableNamedProperties. Update signatures
1717         to match the spec. Commenting out ones not implemented yet.
1718
1719         * html/HTMLCollection.idl:
1720         Add LegacyUnenumerableNamedProperties matching the spec.
1721
1722         * html/HTMLFormControlsCollection.idl:
1723         Add CustomNamedGetter. Update signature of the getter to match the spec.
1724         The reason this can't be generated yet is that we don't have a good strategy
1725         for functions with differing return types that shadow each other.
1726
1727         * html/HTMLFormElement.h:
1728         * html/HTMLFormElement.cpp:
1729         (WebCore::HTMLFormElement::namedItem):
1730         (WebCore::HTMLFormElement::supportedPropertyNames):
1731         Add implementation of namedItem and stub of supportedPropertyNames.
1732
1733         * html/HTMLFormElement.idl:
1734         Add LegacyUnenumerableNamedProperties and remove CustomNamedGetter. Update
1735         the signatures to match the spec.
1736
1737         * page/DOMWindow.idl:
1738         Add LegacyUnenumerableNamedProperties matching the spec.
1739
1740         * plugins/DOMMimeTypeArray.idl:
1741         * plugins/DOMPlugin.idl:
1742         * plugins/DOMPluginArray.idl:
1743         Add LegacyUnenumerableNamedProperties and add nullability to return types.
1744
1745 2017-01-12  Said Abou-Hallawa  <sabouhallawa@apple.com>
1746
1747         [iOS][WK1] Fix initialization of CADisplayLink::preferredFramesPerSecond
1748         https://bugs.webkit.org/show_bug.cgi?id=166956
1749
1750         Reviewed by Tim Horton.
1751         
1752         Set this option to 60fps instead of leaving set to the default.
1753
1754         * platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
1755         (-[WebDisplayLinkHandler initWithMonitor:]):
1756
1757 2017-01-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1758
1759         Unreviewed, build fix for macOS ports
1760         https://bugs.webkit.org/show_bug.cgi?id=166925
1761
1762         * WebCore.xcodeproj/project.pbxproj:
1763
1764 2017-01-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1765
1766         Implement InlineClassicScript
1767         https://bugs.webkit.org/show_bug.cgi?id=166925
1768
1769         Reviewed by Ryosuke Niwa.
1770
1771         As of r210585, ScriptFetcher functionality is decoupled from ScriptElement.
1772         This patch is a further cleanup. We introduce InlineClassicScript, which is
1773         similar to LoadableClassicScript / LoadableModuleScript. And we move ScriptFetcher
1774         functionality from LoadableScript to CachedScriptFetcher, which is the base
1775         class of InlineClassicScript and LoadableScript.
1776
1777         And we start setting this CachedScriptFetcher to the member of JSC::SourceOrigin.
1778         This allows us to examine the ScriptFetcher from the SourceOrigin.
1779         When dynamic-import operator is called, we need to get the ScriptFetcher from the
1780         caller script SourceOrigin since the subsequent module loading needs to know the
1781         metadata about fetching and ScriptFetcher delivers it.
1782
1783         No behavior change.
1784
1785         * CMakeLists.txt:
1786         * bindings/js/CachedModuleScript.cpp:
1787         (WebCore::CachedModuleScript::load):
1788         * bindings/js/CachedModuleScript.h:
1789         * bindings/js/CachedModuleScriptLoader.cpp:
1790         (WebCore::CachedModuleScriptLoader::create):
1791         (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader):
1792         (WebCore::CachedModuleScriptLoader::load):
1793         * bindings/js/CachedModuleScriptLoader.h:
1794         * bindings/js/CachedScriptFetcher.cpp: Copied from Source/WebCore/dom/LoadableScript.cpp.
1795         (WebCore::CachedScriptFetcher::requestScriptWithCache):
1796         * bindings/js/CachedScriptFetcher.h: Copied from Source/JavaScriptCore/runtime/SourceOrigin.h.
1797         (WebCore::CachedScriptFetcher::CachedScriptFetcher):
1798         * bindings/js/CachedScriptSourceProvider.h:
1799         (WebCore::CachedScriptSourceProvider::create):
1800         (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider):
1801         (WebCore::makeSource): Deleted.
1802         * bindings/js/ScriptController.cpp:
1803         (WebCore::ScriptController::loadModuleScriptInWorld):
1804         (WebCore::ScriptController::loadModuleScript):
1805         * bindings/js/ScriptController.h:
1806         * bindings/js/ScriptModuleLoader.cpp:
1807         (WebCore::ScriptModuleLoader::fetch):
1808         (WebCore::ScriptModuleLoader::notifyFinished):
1809         * bindings/js/ScriptSourceCode.h:
1810         (WebCore::ScriptSourceCode::ScriptSourceCode):
1811         (WebCore::ScriptSourceCode::m_url):
1812         * dom/InlineClassicScript.cpp: Added.
1813         (WebCore::InlineClassicScript::create):
1814         * dom/InlineClassicScript.h: Added.
1815         * dom/LoadableClassicScript.cpp:
1816         (WebCore::LoadableClassicScript::execute):
1817         * dom/LoadableScript.cpp:
1818         (WebCore::LoadableScript::requestScriptWithCache): Deleted.
1819         * dom/LoadableScript.h:
1820         (WebCore::LoadableScript::LoadableScript):
1821         (): Deleted.
1822         * dom/ScriptElement.cpp:
1823         (WebCore::ScriptElement::prepareScript):
1824         (WebCore::ScriptElement::requestModuleScript):
1825         (WebCore::ScriptElement::executePendingScript):
1826         * html/parser/HTMLScriptRunner.cpp:
1827         (WebCore::HTMLScriptRunner::runScript):
1828         * xml/parser/XMLDocumentParserLibxml2.cpp:
1829         (WebCore::XMLDocumentParser::endElementNs):
1830
1831 2017-01-11  Eric Carlson  <eric.carlson@apple.com>
1832
1833         [MediaStream, Mac] Render media stream audio buffers
1834         https://bugs.webkit.org/show_bug.cgi?id=159836
1835         <rdar://problem/27380390>
1836
1837         Reviewed by Jer Noble.
1838
1839         No new tests, it isn't possible to test audio rendering directly. A follow-up patch will
1840         add a mock audio source that will enable audio testing.
1841
1842         * platform/cf/CoreMediaSoftLink.cpp: Include new functions used.
1843         * platform/cf/CoreMediaSoftLink.h:
1844
1845         * WebCore.xcodeproj/project.pbxproj: Remove references to the deleted previews.
1846
1847         * platform/Logging.h: Add MediaCaptureSamples.
1848
1849         * platform/MediaSample.h: Add outputPresentationTime and outputDuration.
1850
1851         * platform/cf/CoreMediaSoftLink.cpp: Add CMSampleBufferGetOutputDuration, CMSampleBufferGetOutputPresentationTimeStamp,
1852         CMTimeConvertScale, CMTimebaseGetEffectiveRate, CMAudioSampleBufferCreateWithPacketDescriptions, 
1853         CMSampleBufferSetDataBufferFromAudioBufferList, CMSampleBufferSetDataReady, 
1854         CMAudioFormatDescriptionCreate, CMClockGetHostTimeClock, and CMClockGetTime.
1855         * platform/cf/CoreMediaSoftLink.h:
1856
1857         Create and use an AVSampleBufferAudioRenderer each audio stream track, when it is available,
1858         to render for audio samples. Store the offset between the first sample received from a track's
1859         output presentation and the synchronizer time so we can adjust sample timestamps to be 
1860         relative to the synchronizer's timeline regardless of their source. Remove the use of source
1861         previews because not all sources will have them.
1862
1863         * platform/graphics/avfoundation/MediaSampleAVFObjC.h:
1864         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
1865         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1866         
1867         Add an ObjC helper to catch renderer status changes.
1868         (-[WebAVSampleBufferStatusChangeListener initWithParent:]): 
1869         (-[WebAVSampleBufferStatusChangeListener dealloc]):
1870         (-[WebAVSampleBufferStatusChangeListener invalidate]):
1871         (-[WebAVSampleBufferStatusChangeListener beginObservingLayer:]):
1872         (-[WebAVSampleBufferStatusChangeListener stopObservingLayer:]):
1873         (-[WebAVSampleBufferStatusChangeListener beginObservingRenderer:]):
1874         (-[WebAVSampleBufferStatusChangeListener stopObservingRenderer:]):
1875         (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]):
1876         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC):
1877         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC):
1878         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::removeOldSamplesFromPendingQueue):
1879         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::addSampleToPendingQueue):
1880         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateSampleTimes):
1881         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueAudioSample):
1882         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample):
1883         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForVideoData):
1884         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForAudioData):
1885         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::createAudioRenderer):
1886         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyAudioRenderer):
1887         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyAudioRenderers):
1888         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::audioSourceProvider):
1889         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::rendererStatusDidChange):
1890         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerStatusDidChange):
1891         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::flushRenderers):
1892         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer):
1893         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer):
1894         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::platformLayer):
1895         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentDisplayMode):
1896         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play):
1897         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueAudioSampleBufferFromTrack): Deleted.
1898         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForMediaData): Deleted.
1899         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSampleBuffer): Deleted.
1900         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::prepareVideoSampleBufferFromTrack): Deleted.
1901         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::internalSetVolume): Deleted.
1902
1903         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
1904         (WebCore::MediaSampleAVFObjC::outputPresentationTime): New.
1905         (WebCore::MediaSampleAVFObjC::outputDuration): New.
1906         (WebCore::MediaSampleAVFObjC::dump): Log outputPresentationTime.
1907
1908         * platform/mediastream/AudioTrackPrivateMediaStream.h: Add timelineOffset.
1909
1910         * platform/mediastream/MediaStreamTrackPrivate.cpp:
1911         (WebCore::MediaStreamTrackPrivate::setEnabled): No more m_preview.
1912         (WebCore::MediaStreamTrackPrivate::endTrack): Ditto.
1913         (WebCore::MediaStreamTrackPrivate::preview): Deleted.
1914         * platform/mediastream/MediaStreamTrackPrivate.h:
1915
1916         * platform/mediastream/RealtimeMediaSource.h:
1917         (WebCore::RealtimeMediaSource::preview): Deleted.
1918
1919         * platform/mediastream/RealtimeMediaSourcePreview.h: Removed.
1920
1921         * platform/mediastream/VideoTrackPrivateMediaStream.h: Add timelineOffset.
1922
1923         * platform/mediastream/mac/AVAudioCaptureSource.h:
1924         * platform/mediastream/mac/AVAudioCaptureSource.mm:
1925         (WebCore::AVAudioCaptureSource::updateSettings):
1926         (WebCore::AVAudioCaptureSource::captureOutputDidOutputSampleBufferFromConnection): Pass the
1927         sample buffer up the chain.
1928         (WebCore::AVAudioSourcePreview::create): Deleted.
1929         (WebCore::AVAudioSourcePreview::AVAudioSourcePreview): Deleted.
1930         (WebCore::AVAudioSourcePreview::invalidate): Deleted.
1931         (WebCore::AVAudioSourcePreview::play): Deleted.
1932         (WebCore::AVAudioSourcePreview::pause): Deleted.
1933         (WebCore::AVAudioSourcePreview::setEnabled): Deleted.
1934         (WebCore::AVAudioSourcePreview::setVolume): Deleted.
1935         (WebCore::AVAudioSourcePreview::updateState): Deleted.
1936         (WebCore::AVAudioCaptureSource::createPreview): Deleted.
1937
1938         * platform/mediastream/mac/AVMediaCaptureSource.h:
1939         (WebCore::AVMediaSourcePreview): Deleted.
1940         (WebCore::AVMediaCaptureSource::createWeakPtr): Deleted.
1941
1942         * platform/mediastream/mac/AVMediaCaptureSource.mm:
1943         (WebCore::AVMediaCaptureSource::AVMediaCaptureSource): No more preview.
1944         (WebCore::AVMediaCaptureSource::reset):
1945         (WebCore::AVMediaCaptureSource::preview): Deleted.
1946         (WebCore::AVMediaCaptureSource::removePreview): Deleted.
1947         (WebCore::AVMediaSourcePreview::AVMediaSourcePreview): Deleted.
1948         (WebCore::AVMediaSourcePreview::~AVMediaSourcePreview): Deleted.
1949         (WebCore::AVMediaSourcePreview::invalidate): Deleted.
1950
1951         * platform/mediastream/mac/AVVideoCaptureSource.h:
1952         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1953         (WebCore::AVVideoCaptureSource::processNewFrame): Don't set the "display immediately" attachment.
1954         (WebCore::AVVideoSourcePreview::create): Deleted.
1955         (WebCore::AVVideoSourcePreview::AVVideoSourcePreview): Deleted.
1956         (WebCore::AVVideoSourcePreview::backgroundLayerBoundsChanged): Deleted.
1957         (WebCore::AVVideoSourcePreview::invalidate): Deleted.
1958         (WebCore::AVVideoSourcePreview::play): Deleted.
1959         (WebCore::AVVideoSourcePreview::pause): Deleted.
1960         (WebCore::AVVideoSourcePreview::setPaused): Deleted.
1961         (WebCore::AVVideoSourcePreview::setEnabled): Deleted.
1962         (WebCore::AVVideoCaptureSource::createPreview): Deleted.
1963         (-[WebCoreAVVideoCaptureSourceObserver setParent:]): Deleted.
1964         (-[WebCoreAVVideoCaptureSourceObserver observeValueForKeyPath:ofObject:change:context:]): Deleted.
1965
1966         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
1967         (WebCore::MockRealtimeVideoSourceMac::CMSampleBufferFromPixelBuffer): Use a more typical video
1968         time scale. Set the sample decode time.
1969         (WebCore::MockRealtimeVideoSourceMac::pixelBufferFromCGImage): Use a static for colorspace
1970         instead of fetching it for every frame.
1971
1972         * platform/mock/mediasource/MockSourceBufferPrivate.cpp: Add outputPresentationTime and outputDuration.
1973
1974 2017-01-11  Youenn Fablet  <youenn@apple.com>
1975
1976         Remove request.formData property until it gets implemented
1977         https://bugs.webkit.org/show_bug.cgi?id=166920
1978         <rdar://problem/29971105>
1979
1980         Reviewed by Chris Dumez.
1981
1982         Covered by rebased tests.
1983
1984         * Modules/fetch/FetchBody.idl:
1985
1986 2017-01-11  Ryan Haddad  <ryanhaddad@apple.com>
1987
1988         Reverting r210598, r210597, and r210591 to fix the iOS simulator build.
1989         https://bugs.webkit.org/show_bug.cgi?id=166672
1990
1991         Unreviewed build fix.
1992
1993         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1994         (WebCore::preparePlatformFont):
1995         (WebCore::fontIsSystemFont): Deleted.
1996
1997 2017-01-11  Andreas Kling  <akling@apple.com>
1998
1999         Crash when WebCore's GC heap grows way too large.
2000         <https://webkit.org/b/166875>
2001         <rdar://problem/27896585>
2002
2003         Reviewed by Mark Lam.
2004
2005         Cap the common WebCore VM at 4 GB of live JavaScript heap objects.
2006
2007         * bindings/js/CommonVM.cpp:
2008         (WebCore::commonVMSlow):
2009
2010 2017-01-11  Nan Wang  <n_wang@apple.com>
2011
2012         AX: role=treeitem accessible name not spoken to VoiceOver macOS when using string contained inside element
2013         https://bugs.webkit.org/show_bug.cgi?id=164950
2014         <rdar://problem/29337573>
2015
2016         Reviewed by Chris Fleizach.
2017
2018         From the spec: https://www.w3.org/TR/wai-aria-practices/#TreeView
2019         The element with role treeitem missing a label is labeled by its child elements.
2020
2021         Test: accessibility/mac/aria-tree-item-name.html
2022
2023         * accessibility/AccessibilityNodeObject.cpp:
2024         (WebCore::AccessibilityNodeObject::alternativeText):
2025
2026 2017-01-11  Brent Fulgham  <bfulgham@apple.com>
2027
2028         [GTK] Unreviewed build fix after r210600.
2029
2030         * platform/glib/FileSystemGlib.cpp:
2031         (WebCore::getFileDeviceId): Attempting to use proper API here.
2032
2033 2017-01-11  Brent Fulgham  <bfulgham@apple.com>
2034
2035         [GTK] Unreviewed build fix after r210599.
2036
2037         * platform/glib/FileSystemGlib.cpp:
2038         (WebCore::getFileDeviceId): Revise for new signature.
2039
2040 2017-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
2041
2042         ASSERTION FAILED: run->m_stop > 0 in *WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment
2043         https://bugs.webkit.org/show_bug.cgi?id=166030
2044
2045         Reviewed by Ryosuke Niwa.
2046
2047         Ordinarily, we don't process empty BiDi runs (because we filter them out).
2048         However, when using isolates, we invoke extra machinery to create a
2049         placeholder BiDi run, and replace it with the runs for the isolate. The
2050         isolate's runs, though, can be empty, and rather than just deleting the
2051         placeholder run, we will keep it around so that the m_logicallyLastRun is
2052         still valid. This means that it is possible when all is said and done to
2053         have empty runs, and computeInlineDirectionPositionsForSegment() needs to
2054         not ASSERT() in this case.
2055
2056         Test: fast/text/bidi-isolate-empty-run.html
2057
2058         * rendering/RenderBlockLineLayout.cpp:
2059         (WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment):
2060
2061 2017-01-11  Brent Fulgham  <bfulgham@apple.com>
2062
2063         File scheme should not allow access of a resource on a different volume.
2064         https://bugs.webkit.org/show_bug.cgi?id=158552
2065         <rdar://problem/15307582>
2066
2067         Reviewed by Alex Christensen.
2068
2069         Revise SecurityOrigin to prevent files from one storage device (volume) from accessing content
2070         on a different storage device (volume) unless universal access is enabled.
2071
2072         Pass the current file device as part of the NSURLRequest so that CFNetwork can reject loads
2073         where the device changes in the midst of a load.
2074
2075         Also properly reflect that SecurityOrigin is never null by passing as a reference,
2076         rather than as a pointer.
2077
2078         Tests: Tools/TestWebKitAPI/Tests/mac/CrossPartitionFileSchemeAccess.mm
2079
2080         * page/SecurityOrigin.cpp:
2081         (WebCore::SecurityOrigin::canAccess): Pass argument as reference.
2082         (WebCore::SecurityOrigin::canDisplay): Add check that files share the same volume.
2083         (WebCore::SecurityOrigin::isSameSchemeHostPort): Pass argument as reference.
2084         * page/SecurityOrigin.h:
2085         * platform/FileSystem.cpp:
2086         (WebCore::filesHaveSameVolume): Added.
2087         * platform/FileSystem.h:
2088         * platform/network/cocoa/ResourceRequestCocoa.mm:
2089         (WebCore::ResourceRequest::doUpdatePlatformRequest): If loading a file URL, tell CFNetwork
2090         the storage device at the time of the start of the load so we can trigger a failure if this
2091         changes during the load operation.
2092         * platform/posix/FileSystemPOSIX.cpp:
2093         (WebCore::getFileDeviceId): Added.
2094         * platform/win/FileSystemWin.cpp:
2095         (WebCore::getFileDeviceId): Added.
2096
2097 2017-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
2098
2099         [Cocoa] Testing fix after r210597
2100         https://bugs.webkit.org/show_bug.cgi?id=166672
2101
2102         Unreviewed.
2103
2104         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2105         (WebCore::preparePlatformFont):
2106
2107 2017-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
2108
2109         [Cocoa] Testing fix after r210591
2110         https://bugs.webkit.org/show_bug.cgi?id=166672
2111
2112         Unreviewed.
2113
2114         Fixes fast/text/trak-optimizeLegibility.html and
2115         fast/text/system-font-features.html
2116
2117         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2118         (WebCore::fontIsSystemFont):
2119         (WebCore::preparePlatformFont):
2120
2121 2017-01-11  Chris Dumez  <cdumez@apple.com>
2122
2123         Iterating over URLSearchParams does not work
2124         https://bugs.webkit.org/show_bug.cgi?id=166921
2125         <rdar://problem/29970907>
2126
2127         Reviewed by Alex Christensen.
2128
2129         Make URLSearchParams iterable, as per:
2130         - https://url.spec.whatwg.org/#urlsearchparams
2131
2132         Test: fast/dom/DOMURL/searchparams-iterable.html
2133
2134         * html/URLSearchParams.cpp:
2135         (WebCore::URLSearchParams::Iterator::next):
2136         (WebCore::URLSearchParams::Iterator::Iterator):
2137         * html/URLSearchParams.h:
2138         (WebCore::URLSearchParams::createIterator):
2139         * html/URLSearchParams.idl:
2140
2141 2017-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
2142
2143         [Cocoa] Variation fonts without variations specified are not rendered as if the default variations were specified
2144         https://bugs.webkit.org/show_bug.cgi?id=166672
2145         <rdar://problem/29779119>
2146         <rdar://problem/29848883>
2147
2148         Reviewed by Simon Fraser.
2149
2150         CoreText has a bug (<rdar://problem/29859207>) where variation fonts without
2151         a specified variation value are rendered as if the minimum value is specified,
2152         rather than the default value. The solution is to apply default values where
2153         they are omitted.
2154
2155         Test: fast/text/variations/advances.html
2156
2157         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2158         (WebCore::preparePlatformFont):
2159
2160 2017-01-11  Ryan Haddad  <ryanhaddad@apple.com>
2161
2162         Attempt to fix the Windows build after r210588.
2163
2164         Unreviewed build fix.
2165
2166         * bindings/js/JSBindingsAllInOne.cpp:
2167
2168 2017-01-11  Sam Weinig  <sam@webkit.org>
2169
2170         Address some feedback from r210567.
2171
2172         * bindings/scripts/CodeGeneratorJS.pm:
2173         (NativeToJSValueDOMConvertNeedsState):
2174         (NativeToJSValueDOMConvertNeedsGlobalObject):
2175         Fix typo. robost -> robust.
2176
2177 2017-01-10  Sam Weinig  <sam@webkit.org>
2178
2179         Rename JSCustomSQLStatementErrorCallback.cpp to JSSQLStatementErrorCallbackCustom.cpp
2180         https://bugs.webkit.org/show_bug.cgi?id=166913
2181
2182         Reviewed by Alex Christensen.
2183
2184         * CMakeLists.txt:
2185         * WebCore.xcodeproj/project.pbxproj:
2186         * bindings/js/JSCustomSQLStatementErrorCallback.cpp: Removed.
2187         * bindings/js/JSSQLStatementErrorCallbackCustom.cpp: Copied from Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp.
2188         Rename to match conventions.
2189
2190 2017-01-11  Ryan Haddad  <ryanhaddad@apple.com>
2191
2192         Unreviewed, rolling out r210571.
2193
2194         This change broke the 32-bit macOS build and caused LayoutTest
2195         failures.
2196
2197         Reverted changeset:
2198
2199         "File scheme should not allow access of a resource on a
2200         different volume."
2201         https://bugs.webkit.org/show_bug.cgi?id=158552
2202         http://trac.webkit.org/changeset/210571
2203
2204 2017-01-11  Yusuke Suzuki  <utatane.tea@gmail.com>
2205
2206         Decouple module loading initiator from ScriptElement
2207         https://bugs.webkit.org/show_bug.cgi?id=166888
2208
2209         Reviewed by Saam Barati and Ryosuke Niwa.
2210
2211         Previously, we use ScriptElement (JSElement for ScriptElement) as the module loading initiator.
2212         This element is used to transfer the metadata like charset throughout the module pipeline.
2213         As a result, our module loader in the browser side is tightly coupled with ScriptElement.
2214         It is not good since it prevent us from using the module loader in the non-DOM environment like
2215         Web Workers.
2216
2217         So we decouple the necessary informations from ScriptElement. We move these information to
2218         LoadableScript. And we use JSScriptFetcher to transfer LoadableScript through the JS implemented
2219         module loader pipeline. We select LoadableScript instead of LoadableModuleScript since this initiator
2220         information will be leveraged even in classic scripts once we implement the dynamic import.
2221
2222         No behavior change.
2223
2224         * ForwardingHeaders/runtime/JSScriptFetcher.h: Copied from Source/WebCore/dom/LoadableScript.cpp.
2225         * ForwardingHeaders/runtime/ScriptFetcher.h: Copied from Source/WebCore/dom/LoadableScript.cpp.
2226         * bindings/js/CachedModuleScript.cpp:
2227         (WebCore::CachedModuleScript::create):
2228         (WebCore::CachedModuleScript::load):
2229         (WebCore::CachedModuleScript::CachedModuleScript): Deleted.
2230         * bindings/js/CachedModuleScript.h:
2231         Now we can merge CachedModuleScript to LoadableScript. But we do not do this in this patch since
2232         we focus on decoupling the initiator information from ScriptElement.
2233
2234         (WebCore::CachedModuleScript::nonce): Deleted.
2235         (WebCore::CachedModuleScript::crossOriginMode): Deleted.
2236         * bindings/js/CachedModuleScriptLoader.cpp:
2237         (WebCore::CachedModuleScriptLoader::load):
2238         * bindings/js/CachedModuleScriptLoader.h:
2239         * bindings/js/JSDOMWindowBase.cpp:
2240         (WebCore::JSDOMWindowBase::moduleLoaderResolve):
2241         (WebCore::JSDOMWindowBase::moduleLoaderFetch):
2242         (WebCore::JSDOMWindowBase::moduleLoaderEvaluate):
2243         * bindings/js/JSMainThreadExecState.h:
2244         (WebCore::JSMainThreadExecState::loadModule):
2245         (WebCore::JSMainThreadExecState::linkAndEvaluateModule):
2246         * bindings/js/ScriptController.cpp:
2247         (WebCore::ScriptController::loadModuleScriptInWorld):
2248         (WebCore::ScriptController::loadModuleScript):
2249         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
2250         (WebCore::ScriptController::linkAndEvaluateModuleScript):
2251         * bindings/js/ScriptController.h:
2252         * bindings/js/ScriptModuleLoader.cpp:
2253         (WebCore::ScriptModuleLoader::fetch):
2254         * bindings/js/ScriptModuleLoader.h:
2255         * dom/LoadableClassicScript.cpp:
2256         (WebCore::LoadableClassicScript::create):
2257         (WebCore::LoadableClassicScript::~LoadableClassicScript):
2258         (WebCore::LoadableClassicScript::isLoaded):
2259         (WebCore::LoadableClassicScript::error):
2260         (WebCore::LoadableClassicScript::wasCanceled):
2261         (WebCore::LoadableClassicScript::notifyFinished):
2262         (WebCore::LoadableClassicScript::load):
2263         * dom/LoadableClassicScript.h:
2264         * dom/LoadableModuleScript.cpp:
2265         (WebCore::LoadableModuleScript::create):
2266         (WebCore::LoadableModuleScript::LoadableModuleScript):
2267         (WebCore::LoadableModuleScript::load):
2268         * dom/LoadableModuleScript.h:
2269         * dom/LoadableScript.cpp:
2270         (WebCore::LoadableScript::requestScriptWithCache):
2271         * dom/LoadableScript.h:
2272         (WebCore::LoadableScript::LoadableScript):
2273         * dom/ScriptElement.cpp:
2274         (WebCore::ScriptElement::requestClassicScript):
2275         (WebCore::ScriptElement::requestModuleScript):
2276         (WebCore::ScriptElement::executeModuleScript):
2277         (WebCore::ScriptElement::requestScriptWithCacheForModuleScript): Deleted.
2278         (WebCore::ScriptElement::requestScriptWithCache): Deleted.
2279         * dom/ScriptElement.h:
2280
2281 2017-01-11  Carlos Garcia Campos  <cgarcia@igalia.com>
2282
2283         [GStreamer] Use smart pointers and modernize code in WebKitWebAudioSourceGStreamer
2284         https://bugs.webkit.org/show_bug.cgi?id=166886
2285
2286         Reviewed by Xabier Rodriguez-Calvar.
2287
2288         This patch doesn't change the behavior, so it's covered by existing Web Audio tests. It replaces pointers with
2289         smart pointers, uses WTF::Vector instead of GSList and simplifies the code to map/unmap GstBuffers.
2290
2291         * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
2292         (webKitWebAudioSrcConstructed):
2293         (webKitWebAudioSrcFinalize):
2294         (webKitWebAudioSrcLoop):
2295         (webKitWebAudioSrcChangeState):
2296         * platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
2297         (WTF::derefGPtr<GstBufferList>):
2298         (WTF::adoptGRef):
2299         (WTF::refGPtr<GstBufferPool>):
2300         (WTF::derefGPtr<GstBufferPool>):
2301         * platform/graphics/gstreamer/GRefPtrGStreamer.h:
2302         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
2303         (WebCore::mapGstBuffer):
2304         * platform/graphics/gstreamer/GStreamerUtilities.h:
2305         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2306         (StreamingClient::createReadBuffer):
2307
2308 2017-01-11  Commit Queue  <commit-queue@webkit.org>
2309
2310         Unreviewed, rolling out r182947.
2311         https://bugs.webkit.org/show_bug.cgi?id=166922
2312
2313         Caused huge memory leak see https://webkit.org/b/166884
2314         (Requested by KaL on #webkit).
2315
2316         Reverted changeset:
2317
2318         "[GStreamer] Silent WebAudio buffers support"
2319         https://bugs.webkit.org/show_bug.cgi?id=143869
2320         http://trac.webkit.org/changeset/182947
2321
2322 2017-01-11  Carlos Garcia Campos  <cgarcia@igalia.com>
2323
2324         Unreviewed, rolling out r210579.
2325
2326         That was not the right fix
2327
2328         Reverted changeset:
2329
2330         "Unreviewed GTK buildfix after r210571."
2331         http://trac.webkit.org/changeset/210579
2332
2333 2017-01-11  Carlos Garcia Campos  <cgarcia@igalia.com>
2334
2335         Unreviewed. Fix GTK+ build after r210571.
2336
2337         Add getFileDeviceId implementation to FileSystemGlib.cpp.
2338
2339         * platform/glib/FileSystemGlib.cpp:
2340         (WebCore::getFileDeviceId):
2341
2342 2017-01-11  Csaba Osztrogonác  <ossy@webkit.org>
2343
2344         Unreviewed GTK buildfix after r210571.
2345
2346         * PlatformGTK.cmake:
2347
2348 2017-01-10  Yusuke Suzuki  <utatane.tea@gmail.com>
2349
2350         Implement JSSourceCode to propagate SourceCode in module pipeline
2351         https://bugs.webkit.org/show_bug.cgi?id=166861
2352
2353         Reviewed by Saam Barati.
2354
2355         Now SourceOrigin is correctly propagated through the module pipeline.
2356         So the error reported by http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.html
2357         is updated.
2358
2359         * ForwardingHeaders/runtime/JSSourceCode.h: Added.
2360         * bindings/js/JSDOMPromise.h:
2361         (WebCore::DeferredPromise::resolveWithCallback):
2362         * bindings/js/ScriptModuleLoader.cpp:
2363         (WebCore::ScriptModuleLoader::notifyFinished):
2364
2365 2017-01-10  Brent Fulgham  <bfulgham@apple.com>
2366
2367         File scheme should not allow access of a resource on a different volume.
2368         https://bugs.webkit.org/show_bug.cgi?id=158552
2369         <rdar://problem/15307582>
2370
2371         Reviewed by Alex Christensen.
2372
2373         Revise SecurityOrigin to prevent files from one storage device (volume) from accessing content
2374         on a different storage device (volume) unless universal access is enabled.
2375
2376         Pass the current file device as part of the NSURLRequest so that CFNetwork can reject loads
2377         where the device changes in the midst of a load.
2378
2379         Also properly reflect that SecurityOrigin is never null by passing as a reference,
2380         rather than as a pointer.
2381
2382         Tests: Tools/TestWebKitAPI/Tests/mac/CrossPartitionFileSchemeAccess.mm
2383
2384         * page/SecurityOrigin.cpp:
2385         (WebCore::SecurityOrigin::canAccess): Pass argument as reference.
2386         (WebCore::SecurityOrigin::passesFileCheck): Add check that file URLs refer to files in
2387         the same storage volume.
2388         (WebCore::SecurityOrigin::canDisplay): Add check that files share the same volume.
2389         (WebCore::SecurityOrigin::isSameSchemeHostPort): Pass argument as reference.
2390         * page/SecurityOrigin.h:
2391         * platform/FileSystem.cpp:
2392         (WebCore::filesHaveSameVolume): Added.
2393         * platform/FileSystem.h:
2394         * platform/network/cocoa/ResourceRequestCocoa.mm:
2395         (WebCore::ResourceRequest::doUpdatePlatformRequest): If loading a file URL, tell CFNetwork
2396         the storage device at the time of the start of the load so we can trigger a failure if this
2397         changes during the load operation.
2398         * platform/posix/FileSystemPOSIX.cpp:
2399         (WebCore::getFileDeviceId): Added.
2400         * platform/win/FileSystemWin.cpp:
2401         (WebCore::getFileDeviceId): Added.
2402
2403 2017-01-10  Sam Weinig  <sam@webkit.org>
2404
2405         [WebIDL] Remove most of the custom bindings for the WebGL code
2406         https://bugs.webkit.org/show_bug.cgi?id=166834
2407
2408         Reviewed by Alex Christensen.
2409
2410         Removes all but one custom getter (getExtension) from the WebGL code.
2411
2412         * Modules/indexeddb/IDBKeyRange.idl:
2413         Replace use of non-standard type, with new OverrideIDLType extended attribute, allowing us
2414         to stay more consistent with the IDL files spec's provide.
2415
2416         * WebCore.xcodeproj/project.pbxproj:
2417         Move JSWebGL2RenderingContextCustom to the GC/Wrapping only group.
2418
2419         * bindings/IDLTypes.h:
2420         Add IDLWebGLAny, and simplify IDLIDBKey to not be templatized.
2421
2422         * bindings/js/JSDOMConvert.h:
2423         (WebCore::Converter<IDLLong>::convert):
2424         (WebCore::Converter<IDLFloat>::convert):
2425         (WebCore::Converter<IDLUnrestrictedFloat>::convert):
2426         (WebCore::Converter<IDLDouble>::convert):
2427         (WebCore::Converter<IDLUnrestrictedDouble>::convert):
2428         Add overloads of convert that convert a double to the numeric type.
2429
2430         (WebCore::Detail::GenericSequenceConverter::convert):
2431         Add optimized specialization for JSArrays that does not use the iterator protocol.
2432
2433         (WebCore::Detail::NumericSequenceConverter::convert):
2434         Add an even more optimized specialization for numeric types, which checks to see
2435         if the array's butterfly has an optimized shape, and extracts the numeric values
2436         from that.
2437
2438         (WebCore::Detail::SequenceConverter::convert):
2439         (WebCore::Detail::SequenceConverter<IDLLong>::convert):
2440         (WebCore::Detail::SequenceConverter<IDLFloat>::convert):
2441         (WebCore::Detail::SequenceConverter<IDLUnrestrictedFloat>::convert):
2442         (WebCore::Detail::SequenceConverter<IDLDouble>::convert):
2443         (WebCore::Detail::SequenceConverter<IDLUnrestrictedDouble>::convert):
2444         Select the right specialization based on type.
2445
2446         (WebCore::Converter<IDLSequence<T>>::convert):
2447         (WebCore::Converter<IDLFrozenArray<T>>::convert):
2448         Rename converter to be more accurate.
2449
2450         (WebCore::JSConverter<IDLWebGLAny>::convert):
2451         Added. Calls through to converter in WebGLAny.h. We should replace this with a
2452         call to the IDLUnion JSConverter when feasible.
2453
2454         * bindings/js/JSWebGL2RenderingContextCustom.cpp:
2455         (WebCore::JSWebGL2RenderingContext::getInternalformatParameter): Deleted.
2456         (WebCore::JSWebGL2RenderingContext::getQueryParameter): Deleted.
2457         (WebCore::JSWebGL2RenderingContext::getSamplerParameter): Deleted.
2458         (WebCore::JSWebGL2RenderingContext::getSyncParameter): Deleted.
2459         (WebCore::JSWebGL2RenderingContext::getIndexedParameter): Deleted.
2460         (WebCore::JSWebGL2RenderingContext::getActiveUniformBlockParameter): Deleted.
2461         (WebCore::JSWebGL2RenderingContext::getActiveUniformBlockName): Deleted.
2462         Remove unnecessary custom functions.
2463
2464         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
2465         (WebCore::objectParameter): Deleted.
2466         (WebCore::JSWebGLRenderingContextBase::getAttachedShaders): Deleted.
2467         (WebCore::JSWebGLRenderingContextBase::getBufferParameter): Deleted.
2468         (WebCore::JSWebGLRenderingContextBase::getFramebufferAttachmentParameter): Deleted.
2469         (WebCore::JSWebGLRenderingContextBase::getParameter): Deleted.
2470         (WebCore::JSWebGLRenderingContextBase::getProgramParameter): Deleted.
2471         (WebCore::JSWebGLRenderingContextBase::getRenderbufferParameter): Deleted.
2472         (WebCore::JSWebGLRenderingContextBase::getShaderParameter): Deleted.
2473         (WebCore::JSWebGLRenderingContextBase::getSupportedExtensions): Deleted.
2474         (WebCore::JSWebGLRenderingContextBase::getTexParameter): Deleted.
2475         (WebCore::JSWebGLRenderingContextBase::getUniform): Deleted.
2476         (WebCore::JSWebGLRenderingContextBase::getVertexAttrib): Deleted.
2477         (WebCore::toNumberVector): Deleted.
2478         (WebCore::functionForUniform): Deleted.
2479         (WebCore::dataFunctionf): Deleted.
2480         (WebCore::dataFunctioni): Deleted.
2481         (WebCore::dataFunctionMatrix): Deleted.
2482         (WebCore::JSWebGLRenderingContextBase::uniform1fv): Deleted.
2483         (WebCore::JSWebGLRenderingContextBase::uniform1iv): Deleted.
2484         (WebCore::JSWebGLRenderingContextBase::uniform2fv): Deleted.
2485         (WebCore::JSWebGLRenderingContextBase::uniform2iv): Deleted.
2486         (WebCore::JSWebGLRenderingContextBase::uniform3fv): Deleted.
2487         (WebCore::JSWebGLRenderingContextBase::uniform3iv): Deleted.
2488         (WebCore::JSWebGLRenderingContextBase::uniform4fv): Deleted.
2489         (WebCore::JSWebGLRenderingContextBase::uniform4iv): Deleted.
2490         (WebCore::JSWebGLRenderingContextBase::uniformMatrix2fv): Deleted.
2491         (WebCore::JSWebGLRenderingContextBase::uniformMatrix3fv): Deleted.
2492         (WebCore::JSWebGLRenderingContextBase::uniformMatrix4fv): Deleted.
2493         (WebCore::JSWebGLRenderingContextBase::vertexAttrib1fv): Deleted.
2494         (WebCore::JSWebGLRenderingContextBase::vertexAttrib2fv): Deleted.
2495         (WebCore::JSWebGLRenderingContextBase::vertexAttrib3fv): Deleted.
2496         (WebCore::JSWebGLRenderingContextBase::vertexAttrib4fv): Deleted.
2497         Remove unnecessary custom functions.
2498
2499         * bindings/scripts/CodeGenerator.pm:
2500         (IsBuiltinType):
2501         Remove specialization of IDBKey.
2502
2503         * bindings/scripts/CodeGeneratorJS.pm:
2504         (GetBaseIDLType):
2505         (GetIDLType):
2506         (NativeToJSValueDOMConvertNeedsState):
2507         (NativeToJSValueDOMConvertNeedsGlobalObject):
2508         (NativeToJSValue):
2509         Allow IDL files to override the type of signature using a new OverrideIDLType
2510         extended attribute. Currently this only works conversion to JS, but could be
2511         extended to support more.
2512
2513         * bindings/scripts/IDLAttributes.txt:
2514         Add OverrideIDLType.
2515
2516         * html/canvas/WebGL2RenderingContext.idl:
2517         Add OverrideIDLType=IDLWebGLAny annotations to remove the need for custom functions.
2518
2519         * html/canvas/WebGLAny.cpp:
2520         (WebCore::convertToJSValue):
2521         (WebCore::toJS): Deleted.
2522         * html/canvas/WebGLAny.h:
2523         Rename the toJS function to convertToJSValue to avoid a template specialization issue.
2524
2525         * html/canvas/WebGLRenderingContextBase.cpp:
2526         (WebCore::WebGLRenderingContextBase::getAttachedShaders):
2527         Update signature to match IDL, replacing bool return value plus out parameter with an
2528         optional return value. Modernize the code a bit.
2529
2530         (WebCore::WebGLRenderingContextBase::uniform2f):
2531         (WebCore::WebGLRenderingContextBase::uniform3f):
2532         (WebCore::WebGLRenderingContextBase::uniform4f):
2533         (WebCore::WebGLRenderingContextBase::uniform1i):
2534         (WebCore::WebGLRenderingContextBase::uniform3i):
2535         (WebCore::WebGLRenderingContextBase::uniform4i):
2536         (WebCore::WebGLRenderingContextBase::uniform1fv):
2537         (WebCore::WebGLRenderingContextBase::uniform2fv):
2538         (WebCore::WebGLRenderingContextBase::uniform3fv):
2539         (WebCore::WebGLRenderingContextBase::uniform4fv):
2540         (WebCore::WebGLRenderingContextBase::uniform1iv):
2541         (WebCore::WebGLRenderingContextBase::uniform2iv):
2542         (WebCore::WebGLRenderingContextBase::uniform3iv):
2543         (WebCore::WebGLRenderingContextBase::uniform4iv):
2544         (WebCore::WebGLRenderingContextBase::uniformMatrix2fv):
2545         (WebCore::WebGLRenderingContextBase::uniformMatrix3fv):
2546         (WebCore::WebGLRenderingContextBase::uniformMatrix4fv):
2547         (WebCore::WebGLRenderingContextBase::vertexAttrib4f):
2548         (WebCore::WebGLRenderingContextBase::vertexAttrib1fv):
2549         (WebCore::WebGLRenderingContextBase::vertexAttrib2fv):
2550         (WebCore::WebGLRenderingContextBase::vertexAttrib3fv):
2551         (WebCore::WebGLRenderingContextBase::vertexAttrib4fv):
2552         (WebCore::WebGLRenderingContextBase::validateUniformParameters):
2553         (WebCore::WebGLRenderingContextBase::validateUniformMatrixParameters):
2554         (WebCore::WebGLRenderingContextBase::vertexAttribfvImpl):
2555         * html/canvas/WebGLRenderingContextBase.h:
2556         (WebCore::WebGLRenderingContextBase::TypedList::TypedList):
2557         (WebCore::WebGLRenderingContextBase::TypedList::data):
2558         (WebCore::WebGLRenderingContextBase::TypedList::length):
2559         Re-order/group to match order in the IDL file. Remove overloads taking a pointer and 
2560         length, and replace it by having the main function take a specialized TypedList. TypedList
2561         allows the bindings to pass the correct Variant type, but then the code to only think in
2562         terms of the data() and length() functions.
2563
2564         * html/canvas/WebGLRenderingContextBase.idl:
2565         Remove [Custom] annotations and re-order/group to match the spec. Update types of uniform*fv/iv
2566         functions to take typedef'd unions.
2567
2568 2017-01-10  Ryosuke Niwa  <rniwa@webkit.org>
2569
2570         :active and :hover states may not be updated across slots
2571         https://bugs.webkit.org/show_bug.cgi?id=166881
2572         <rdar://problem/29944582>
2573
2574         Reviewed by Antti Koivisto.
2575
2576         The bug was caused by updateHoverActiveState not updating :hover and :active states on elements
2577         when nodes are assigned to slots because they were walking up the tree using parentOrShadowHostElement
2578         and parentNode. Fixed the bug by using parentElementInComposedTree instead since :hover and :active
2579         states need to be updated in accordance with the render tree, which is created from the "flat tree"
2580         or the "composed tree" in WebKit's terminology (this is old terminology in the spec).
2581
2582         Tests: fast/shadow-dom/clear-active-state-in-shadow.html
2583                fast/shadow-dom/hover-over-nested-slotted-content.html
2584
2585         * dom/Document.cpp:
2586         (WebCore::Document::updateHoverActiveState): Fixed the bug.
2587         * dom/Node.cpp:
2588         (WebCore::Node::parentElementInComposedTree): Added.
2589         * dom/Node.h:
2590
2591 2017-01-10  Keith Rollin  <krollin@apple.com>
2592
2593         Missing logging in IconLoader::startLoading
2594         https://bugs.webkit.org/show_bug.cgi?id=166904
2595
2596         Reviewed by Sam Weinig.
2597
2598         The LOG_ERROR in startLoading references 'resourceRequest', which has
2599         been WTF::Moved as part of a preceding function call. As such, the
2600         logging statement doesn't print out a possibly useful URL. Fix this by
2601         making a copy of the URL before it's affected by the Move.
2602
2603         No new tests -- change only affects logging code.
2604
2605         * loader/icon/IconLoader.cpp:
2606         (WebCore::IconLoader::startLoading):
2607
2608 2017-01-10  Wenson Hsieh  <wenson_hsieh@apple.com>
2609
2610         Implement "proximity" scroll snapping
2611         https://bugs.webkit.org/show_bug.cgi?id=135994
2612         <rdar://problem/18162418>
2613
2614         Reviewed by Dean Jackson.
2615
2616         Adds support for proximity scroll snapping. To do this, we introduce scroll offset ranges, a list of scroll
2617         offset ranges that are plumbed alongside the list of scroll snap offsets. Similar to a snap offset, a snap
2618         offset range contains scroll offsets on which scrolling is allowed to come to a rest within a scroll snapping
2619         container. However, unlike normal snap offsets, scrolling may only come to rest within a snap offset range if
2620         the predicted scroll offset already lies within the range. The new algorithm for selecting a target scroll snap
2621         position given a destination offset is now:
2622
2623         -   If the scroll destination lies within a snap offset range, return the scroll destination
2624         -   Otherwise, compute the nearest lower/upper snap offsets and lower/upper snap offset ranges
2625         -   If scrolling ended with no velocity, return the nearest snap offset
2626         -   If scrolling ended with positive velocity, choose the upper snap offset only if there is no snap offset
2627             range in between the scroll destination and the snap offset; else, choose the lower snap offset
2628         -   If scrolling ended with negative velocity, choose the lower snap offset only if there is no snap offset
2629             range in between the scroll destination and the snap offset; else, choose the upper snap offset
2630
2631         The extra rule accounting for scroll offset ranges in between the scroll destination and a potential snap offset
2632         handles the corner case where the user scrolls with momentum very lightly away from a snap offset, such that the
2633         predicted scroll destination is still within proximity of the snap offset. In this case, the regular (mandatory
2634         scroll snapping) behavior would be to snap to the next offset in the direction of momentum scrolling, but
2635         instead, it is more intuitive to return to the original snap position.
2636
2637         We also move scrolling prediction logic into ScrollingMomentumCalculator and adopt the platform
2638         _NSScrollingMomentumCalculator's destinationOrigin property when computing the predicted scroll destination.
2639         Previously, we were simply multiplying by an empirically-derived constant to approximate the scroll destination,
2640         but now that we are supporting proximity scroll snapping, we need more exact scroll destinaton prediction in
2641         order to make sure that scrolling to a snap offset range feels natural.
2642
2643         Tests: tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-then-proximity.html
2644                tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-mainframe.html
2645                tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-overflow.html
2646
2647         * WebCore.xcodeproj/project.pbxproj:
2648         * page/scrolling/AsyncScrollingCoordinator.cpp:
2649         (WebCore::setStateScrollingNodeSnapOffsetsAsFloat):
2650         (WebCore::AsyncScrollingCoordinator::updateOverflowScrollingNode):
2651         (WebCore::AsyncScrollingCoordinator::updateScrollSnapPropertiesWithFrameView):
2652
2653         Make boilerplate changes to plumb lists of horizontal and vertical snap offset ranges alongside the lists of
2654         horizontal and vertical snap offsets.
2655
2656         * page/scrolling/AxisScrollSnapOffsets.cpp:
2657         (WebCore::snapOffsetRangesToString):
2658         (WebCore::indicesOfNearestSnapOffsetRanges):
2659         (WebCore::indicesOfNearestSnapOffsets):
2660         (WebCore::adjustAxisSnapOffsetsForScrollExtent):
2661         (WebCore::computeAxisProximitySnapOffsetRanges):
2662         (WebCore::updateSnapOffsetsForScrollableArea):
2663         (WebCore::closestSnapOffset):
2664
2665         Adjust the snap offset selection algorithm to take snap offset ranges into account. See above for more details.
2666         Additionally, augment snap offset update logic to emit snap offset ranges for proximity scroll snapping. To do
2667         this, we run the following steps on the final list of processed snap offsets:
2668         -   Compute the proximity distance, which (for now) is arbitrarily 0.3 * the length or width of the scroll snap
2669             port, depending on whether scroll snapping is taking place in the X or Y axis.
2670         -   For each pair of adjacent snap offsets, if they are more than 2 * proximity distance away from each other,
2671             emit a snap offset range starting from (lower snap offset + proximity distance) and ending on (upper snap
2672             offset + proximity distance).
2673
2674         * page/scrolling/AxisScrollSnapOffsets.h:
2675         (WebCore::closestSnapOffset): Deleted.
2676         * page/scrolling/ScrollSnapOffsetsInfo.h:
2677
2678         Introduce ScrollSnapOffsetsInfo, a struct which contains data relevant to scroll snapping. This includes
2679         vertical and horizontal snap offsets, as well as vertical and horizontal snap offset ranges. Snap offset ranges
2680         consist of a vector of ranges of scroll offsets.
2681
2682         * page/scrolling/ScrollingCoordinator.h:
2683         * page/scrolling/ScrollingMomentumCalculator.cpp:
2684         (WebCore::projectedInertialScrollDistance):
2685         (WebCore::ScrollingMomentumCalculator::ScrollingMomentumCalculator):
2686         (WebCore::ScrollingMomentumCalculator::setRetargetedScrollOffset):
2687         (WebCore::ScrollingMomentumCalculator::predictedDestinationOffset):
2688         (WebCore::ScrollingMomentumCalculator::create):
2689         (WebCore::ScrollingMomentumCalculator::setPlatformMomentumScrollingPredictionEnabled):
2690         (WebCore::BasicScrollingMomentumCalculator::BasicScrollingMomentumCalculator):
2691         (WebCore::BasicScrollingMomentumCalculator::linearlyInterpolatedOffsetAtProgress):
2692         (WebCore::BasicScrollingMomentumCalculator::initializeInterpolationCoefficientsIfNecessary):
2693         (WebCore::BasicScrollingMomentumCalculator::initializeSnapProgressCurve):
2694         * page/scrolling/ScrollingMomentumCalculator.h:
2695         (WebCore::ScrollingMomentumCalculator::retargetedScrollOffset):
2696         (WebCore::ScrollingMomentumCalculator::retargetedScrollOffsetDidChange):
2697
2698         Currently, the ScrollingMomentumCalculator is responsible for taking an initial position, initial velocity, and
2699         target position and animating the scroll offset from the initial to target position. Now, we refactor the
2700         ScrollingMomentumCalculator interface to no longer take a target offset upon initialization, and instead compute
2701         the predicted scroll destination given initial position and velocity; clients of the ScrollingMomentumCalculator
2702         then use this predicted scroll destination to compute a retargeted scroll offset and then call
2703         setRetargetedScrollOffset on the calculator, which sets up an animation curve to the new retargeted offset. This
2704         allows both the AppKit-based scrolling momentum calculator and platform-invariant momentum calculator to be used
2705         interchangeably, while still allowing them to compute a destination offset from initial parameters of the
2706         scroll.
2707
2708         * page/scrolling/ScrollingStateScrollingNode.cpp:
2709         (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
2710         (WebCore::ScrollingStateScrollingNode::setHorizontalSnapOffsets):
2711         (WebCore::ScrollingStateScrollingNode::setVerticalSnapOffsets):
2712         (WebCore::ScrollingStateScrollingNode::setHorizontalSnapOffsetRanges):
2713         (WebCore::ScrollingStateScrollingNode::setVerticalSnapOffsetRanges):
2714         * page/scrolling/ScrollingStateScrollingNode.h:
2715         (WebCore::ScrollingStateScrollingNode::horizontalSnapOffsets):
2716         (WebCore::ScrollingStateScrollingNode::verticalSnapOffsets):
2717         (WebCore::ScrollingStateScrollingNode::horizontalSnapOffsetRanges):
2718         (WebCore::ScrollingStateScrollingNode::verticalSnapOffsetRanges):
2719         * page/scrolling/ScrollingTreeScrollingNode.cpp:
2720         (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
2721         (WebCore::ScrollingTreeScrollingNode::dumpProperties):
2722         * page/scrolling/ScrollingTreeScrollingNode.h:
2723         (WebCore::ScrollingTreeScrollingNode::horizontalSnapOffsets):
2724         (WebCore::ScrollingTreeScrollingNode::verticalSnapOffsets):
2725         (WebCore::ScrollingTreeScrollingNode::horizontalSnapOffsetRanges):
2726         (WebCore::ScrollingTreeScrollingNode::verticalSnapOffsetRanges):
2727
2728         Add more boilerplate support for snap offset ranges.
2729
2730         * page/scrolling/mac/ScrollingMomentumCalculatorMac.h:
2731         * page/scrolling/mac/ScrollingMomentumCalculatorMac.mm:
2732         (WebCore::ScrollingMomentumCalculator::create):
2733         (WebCore::ScrollingMomentumCalculator::setPlatformMomentumScrollingPredictionEnabled):
2734         (WebCore::ScrollingMomentumCalculatorMac::ScrollingMomentumCalculatorMac):
2735         (WebCore::ScrollingMomentumCalculatorMac::scrollOffsetAfterElapsedTime):
2736         (WebCore::ScrollingMomentumCalculatorMac::predictedDestinationOffset):
2737         (WebCore::ScrollingMomentumCalculatorMac::retargetedScrollOffsetDidChange):
2738         (WebCore::ScrollingMomentumCalculatorMac::animationDuration):
2739         (WebCore::ScrollingMomentumCalculatorMac::requiresMomentumScrolling):
2740         (WebCore::ScrollingMomentumCalculatorMac::ensurePlatformMomentumCalculator):
2741
2742         Hook into AppKit momentum scroll offset prediction.
2743
2744         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
2745         (WebCore::convertToLayoutUnits):
2746         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
2747         * platform/ScrollableArea.cpp:
2748         (WebCore::ScrollableArea::ensureSnapOffsetsInfo):
2749         (WebCore::ScrollableArea::horizontalSnapOffsets):
2750         (WebCore::ScrollableArea::horizontalSnapOffsetRanges):
2751         (WebCore::ScrollableArea::verticalSnapOffsetRanges):
2752         (WebCore::ScrollableArea::verticalSnapOffsets):
2753         (WebCore::ScrollableArea::setHorizontalSnapOffsets):
2754         (WebCore::ScrollableArea::setVerticalSnapOffsets):
2755         (WebCore::ScrollableArea::setHorizontalSnapOffsetRanges):
2756         (WebCore::ScrollableArea::setVerticalSnapOffsetRanges):
2757         (WebCore::ScrollableArea::clearHorizontalSnapOffsets):
2758         (WebCore::ScrollableArea::clearVerticalSnapOffsets):
2759         * platform/ScrollableArea.h:
2760         (WebCore::ScrollableArea::horizontalSnapOffsets): Deleted.
2761         (WebCore::ScrollableArea::verticalSnapOffsets): Deleted.
2762         * platform/cocoa/ScrollController.h:
2763         * platform/cocoa/ScrollController.mm:
2764         (WebCore::ScrollController::processWheelEventForScrollSnap):
2765
2766         Fix an issue where initial scrolling velocity would be set to zero at the end of a drag gesture.
2767
2768         (WebCore::ScrollController::updateScrollSnapState):
2769         (WebCore::ScrollController::updateScrollSnapPoints):
2770         (WebCore::ScrollController::setNearestScrollSnapIndexForAxisAndOffset):
2771         * platform/cocoa/ScrollSnapAnimatorState.h:
2772         (WebCore::ScrollSnapAnimatorState::snapOffsetsForAxis):
2773         (WebCore::ScrollSnapAnimatorState::snapOffsetRangesForAxis):
2774         (WebCore::ScrollSnapAnimatorState::setSnapOffsetsAndPositionRangesForAxis):
2775         (WebCore::ScrollSnapAnimatorState::setSnapOffsetsForAxis): Deleted.
2776         * platform/cocoa/ScrollSnapAnimatorState.mm:
2777         (WebCore::ScrollSnapAnimatorState::setupAnimationForState):
2778         (WebCore::ScrollSnapAnimatorState::targetOffsetForStartOffset):
2779         (WebCore::projectedInertialScrollDistance): Deleted.
2780         * rendering/RenderLayerCompositor.cpp:
2781         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
2782         * testing/Internals.cpp:
2783         (WebCore::Internals::setPlatformMomentumScrollingPredictionEnabled):
2784
2785         Add a new hook for layout tests to force scrolling momentum calculators to use the platform-invariant momentum
2786         scrolling prediction heuristic instead of the platform-dependent one.
2787
2788         (WebCore::Internals::scrollSnapOffsets):
2789         * testing/Internals.h:
2790         * testing/Internals.idl:
2791
2792 2017-01-10  Chris Dumez  <cdumez@apple.com>
2793
2794         Make Event.initEvent()'s first parameter mandatory
2795         https://bugs.webkit.org/show_bug.cgi?id=166894
2796
2797         Reviewed by Alex Christensen.
2798
2799         Make Event.initEvent()'s first parameter mandatory. As per the
2800         specification, all parameters should be mandatory and we are
2801         currently dicussing the possibility of making them optional in
2802         the specification. However, having the first parameter optional
2803         makes little sense as it would set the event's type to the string
2804         "undefined".
2805
2806         Test: fast/events/initEvent-parameters.html
2807
2808         * dom/Event.idl:
2809
2810 2017-01-10  Commit Queue  <commit-queue@webkit.org>
2811
2812         Unreviewed, rolling out r210537.
2813         https://bugs.webkit.org/show_bug.cgi?id=166903
2814
2815         This change introduced JSC test failures (Requested by
2816         ryanhaddad on #webkit).
2817
2818         Reverted changeset:
2819
2820         "Implement JSSourceCode to propagate SourceCode in module
2821         pipeline"
2822         https://bugs.webkit.org/show_bug.cgi?id=166861
2823         http://trac.webkit.org/changeset/210537
2824
2825 2017-01-10  Chris Dumez  <cdumez@apple.com>
2826
2827         REGRESSION(r189555): ImageDocument title no longer includes the size of the image
2828         https://bugs.webkit.org/show_bug.cgi?id=166876
2829         <rdar://problem/29939970>
2830
2831         Reviewed by Ryosuke Niwa.
2832
2833         Add a code comment to clarify fix that was made in r210536.
2834
2835         * html/ImageDocument.cpp:
2836         (WebCore::ImageDocument::createDocumentStructure):
2837
2838 2017-01-10  Jer Noble  <jer.noble@apple.com>
2839
2840         Add support for MediaKeys.generateRequest().
2841         https://bugs.webkit.org/show_bug.cgi?id=166880
2842
2843         Reviewed by Xabier Rodriguez-Calvar.
2844
2845         Test: media/encrypted-media/mock-MediaKeySession-generateRequest.html
2846
2847         Implement MediaKeySession::generateRequest(). This requires some additions
2848         to CDM, CDMPrivate, and CDMInstance to support platform adoption and to
2849         implement mock support for testing. Additionally, add an InitDataRegistry
2850         object which can sanitize and extract key data from various initData types.
2851         (At the moment, only the "keyids" initData type is implemented.)
2852
2853         Drive-by fixes: Change all instances of initDataType from String -> AtomicString.
2854         Add "const" flags to all CDMPrivate methods that might be called from a const
2855         reference.
2856
2857         * CMakeLists.txt:
2858         * Modules/encryptedmedia/CDM.cpp:
2859         (WebCore::CDM::supportsInitDataType):
2860         (WebCore::CDM::sanitizeInitData):
2861         (WebCore::CDM::supportsInitData):
2862         * Modules/encryptedmedia/CDM.h:
2863         * Modules/encryptedmedia/CDMInstance.h:
2864         * Modules/encryptedmedia/CDMPrivate.h:
2865         * Modules/encryptedmedia/InitDataRegistry.cpp: Added.
2866         (WebCore::extractKeyIDsKeyids):
2867         (WebCore::sanitizeKeyids):
2868         (WebCore::sanitizeCenc):
2869         (WebCore::extractKeyIDsCenc):
2870         (WebCore::sanitizeWebM):
2871         (WebCore::extractKeyIDsWebM):
2872         (WebCore::InitDataRegistry::shared):
2873         (WebCore::InitDataRegistry::InitDataRegistry):
2874         (WebCore::InitDataRegistry::sanitizeInitData):
2875         (WebCore::InitDataRegistry::extractKeyIDs):
2876         (WebCore::InitDataRegistry::registerInitDataType):
2877         * Modules/encryptedmedia/InitDataRegistry.h:
2878         * Modules/encryptedmedia/MediaKeySession.cpp:
2879         (WebCore::messageEventName):
2880         (WebCore::MediaKeySession::MediaKeySession):
2881         (WebCore::MediaKeySession::generateRequest):
2882         (WebCore::MediaKeySession::enqueueMessage):
2883         * Modules/encryptedmedia/MediaKeySession.h:
2884         * Modules/encryptedmedia/MediaKeys.cpp:
2885         (WebCore::MediaKeys::setServerCertificate):
2886         * WebCore.xcodeproj/project.pbxproj:
2887         * testing/MockCDMFactory.cpp:
2888         (WebCore::MockCDMFactory::addKeysToSessionWithID):
2889         (WebCore::MockCDMFactory::setSupportedDataTypes):
2890         (WebCore::MockCDM::supportsInitDataType):
2891         (WebCore::MockCDM::supportsConfiguration):
2892         (WebCore::MockCDM::supportsConfigurationWithRestrictions):
2893         (WebCore::MockCDM::supportsSessionTypeWithConfiguration):
2894         (WebCore::MockCDM::supportsRobustness):
2895         (WebCore::MockCDM::distinctiveIdentifiersRequirement):
2896         (WebCore::MockCDM::persistentStateRequirement):
2897         (WebCore::MockCDM::distinctiveIdentifiersAreUniquePerOriginAndClearable):
2898         (WebCore::MockCDM::supportsInitData):
2899         (WebCore::MockCDMInstance::setServerCertificate):
2900         (WebCore::MockCDMInstance::requestLicense):
2901         * testing/MockCDMFactory.h:
2902         (WebCore::MockCDMFactory::supportedDataTypes):
2903         (WebCore::MockCDMFactory::hasSessionWithID):
2904         (WebCore::MockCDMFactory::removeSessionWithID):
2905         (WebCore::MockCDMFactory::setSupportedDataTypes): Deleted.
2906
2907 2017-01-10  Jer Noble  <jer.noble@apple.com>
2908
2909         Add support for MediaKeys.createSession().
2910         https://bugs.webkit.org/show_bug.cgi?id=166796
2911
2912         Reviewed by Eric Carlson.
2913
2914         Test: media/encrypted-media/mock-MediaKeys-createSession.html
2915
2916         Implement MediaKeys::createSession(). This requires some additions to
2917         CDM, CDMPrivate, and CDMInstance to support platform adoption and to
2918         implement mock support for testing. Because the CDMInstance will now
2919         be shared between MediaKeys and MediaKeySession, it cannot be a unique_ptr.
2920         Make CDMInterface ref-counted and store it as a Ref.
2921
2922         * Modules/encryptedmedia/CDM.cpp:
2923         (WebCore::CDM::createInstance):
2924         (WebCore::CDM::supportsSessions):
2925         * Modules/encryptedmedia/CDM.h:
2926         * Modules/encryptedmedia/CDMInstance.h:
2927         * Modules/encryptedmedia/CDMPrivate.h:
2928         * Modules/encryptedmedia/MediaKeySession.cpp:
2929         (WebCore::MediaKeySession::create):
2930         (WebCore::MediaKeySession::MediaKeySession):
2931         (WebCore::MediaKeySession::sessionId):
2932         (WebCore::MediaKeySession::expiration):
2933         (WebCore::MediaKeySession::keyStatuses):
2934         * Modules/encryptedmedia/MediaKeySession.h:
2935         * Modules/encryptedmedia/MediaKeySessionType.idl:
2936         * Modules/encryptedmedia/MediaKeySystemAccess.cpp:
2937         (WebCore::MediaKeySystemAccess::createMediaKeys):
2938         * Modules/encryptedmedia/MediaKeys.cpp:
2939         (WebCore::MediaKeys::MediaKeys):
2940         (WebCore::MediaKeys::createSession):
2941         * Modules/encryptedmedia/MediaKeys.h:
2942         (WebCore::MediaKeys::create):
2943         * Modules/encryptedmedia/MediaKeys.idl:
2944
2945 2017-01-10  Jer Noble  <jer.noble@apple.com>
2946
2947         Add support for MediaKeys.setServerCertificate()
2948         https://bugs.webkit.org/show_bug.cgi?id=166772
2949
2950         Reviewed by Darin Adler.
2951
2952         Test: media/encrypted-media/mock-MediaKeys-setServerCertificate.html
2953
2954         Implement MediaKeys::setServerCertificate(). This requires some additions
2955         to CDM, CDMPrivate, and CDMInstance to support platform adoption and to
2956         implement mock support for testing.
2957
2958         * Modules/encryptedmedia/CDM.cpp:
2959         (WebCore::CDM::supportsServerCertificates):
2960         * Modules/encryptedmedia/CDM.h:
2961         * Modules/encryptedmedia/CDMInstance.h:
2962         * Modules/encryptedmedia/CDMPrivate.h:
2963         * Modules/encryptedmedia/MediaKeys.cpp:
2964         (WebCore::MediaKeys::setServerCertificate):
2965         * Modules/encryptedmedia/MediaKeys.h:
2966         * testing/MockCDMFactory.cpp:
2967         (WebCore::MockCDM::supportsServerCertificates):
2968         (WebCore::MockCDMInstance::setServerCertificate):
2969         * testing/MockCDMFactory.h:
2970         (WebCore::MockCDMFactory::supportsServerCertificates):
2971         (WebCore::MockCDMFactory::setSupportsServerCertificates):
2972         * testing/MockCDMFactory.idl:
2973
2974 2017-01-10  Youenn Fablet  <youenn@apple.com>
2975
2976         CachedScript cloning does not clone encodedSize
2977         https://bugs.webkit.org/show_bug.cgi?id=166865
2978
2979         Reviewed by Darin Adler.
2980
2981         Covered by updated test.
2982
2983         * loader/cache/CachedResource.cpp:
2984         (WebCore::CachedResource::setBodyDataFrom): set encoded size based on being cloned resource.
2985         * loader/cache/CachedScript.cpp:
2986         (WebCore::CachedScript::script):
2987         (WebCore::CachedScript::setBodyDataFrom): Making use of CachedResource::setBodyDataFrom for complete cloning.
2988
2989 2017-01-10  Zan Dobersek  <zdobersek@igalia.com>
2990
2991         Unreviewed. Remove the unused gReadyStateTimerInterval global from
2992         the MediaPlayerPrivateGStreamerMSE implementation file as it's only
2993         springing up a compiler warning.
2994
2995         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
2996
2997 2017-01-10  Zan Dobersek  <zdobersek@igalia.com>
2998
2999         [CoordinatedGraphics] TextureMapperPlatformLayerProxy is constantly getting activated
3000         https://bugs.webkit.org/show_bug.cgi?id=166856
3001
3002         Reviewed by Michael Catanzaro.
3003
3004         When CoordinatedGraphicsLayer::setContentsNeedsDisplay() is called, currently with
3005         the threaded CoordinatedGraphics mode the platform layer is marked for synchronizing.
3006         This means that at flush-time this layer swaps the buffer of the wrapped platform
3007         layer and updates the layer state to indicate that the underlying
3008         TextureMapperPlatformLayerProxy object has to be activated on the composition thread.
3009
3010         This current logic results in the TextureMapperPlatformLayerProxy object being
3011         reactivated for every display request that arrives via setContentsNeedsDisplay().
3012         This is pretty wasteful since this activation heap-allocates a RunLoop::Timer object
3013         which internally also locks up the GLib main context to attach a new source, and
3014         that's only after the source on the previous RunLoop::Timer was detached before
3015         that RunLoop::Timer was destroyed.
3016
3017         To avoid this, CoordinatedGraphicsLayer::setContentsNeedsDisplay() sets a new flag,
3018         m_shouldUpdatePlatformLayer. During flush, this flag is checked in
3019         CoordinatedGraphicsLayer::updatePlatformLayer(), with the buffer swap performed in
3020         case it's set. CoordinatedGraphicsLayer::syncPlatformLayer() now only sets the
3021         platform layer proxy object for that layer's state.
3022
3023         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3024         (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
3025         (WebCore::CoordinatedGraphicsLayer::setContentsNeedsDisplay):
3026         (WebCore::CoordinatedGraphicsLayer::syncPlatformLayer):
3027         (WebCore::CoordinatedGraphicsLayer::updatePlatformLayer):
3028         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
3029         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
3030
3031 2017-01-10  Zan Dobersek  <zdobersek@igalia.com>
3032
3033         [TexMap] Use WTF::Function in TextureMapperPlatformLayerProxy
3034         https://bugs.webkit.org/show_bug.cgi?id=166853
3035
3036         Reviewed by Michael Catanzaro.
3037
3038         Use WTF::Function in the TextureMapperPlatformLayerProxy, instead of
3039         the std::function bloat.
3040
3041         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
3042         (WebCore::TextureMapperPlatformLayerProxy::scheduleUpdateOnCompositorThread):
3043         (WebCore::TextureMapperPlatformLayerProxy::compositorThreadUpdateTimerFired):
3044         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
3045
3046 2017-01-10  Zan Dobersek  <zdobersek@igalia.com>
3047
3048         [TextureMapper] TextureMapperPlatformLayerProxy::swapBuffers() should hold the lock throughout invocation
3049         https://bugs.webkit.org/show_bug.cgi?id=166852
3050
3051         Reviewed by Michael Catanzaro.
3052
3053         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
3054         (WebCore::TextureMapperPlatformLayerProxy::swapBuffer): Append to previous buffer
3055         to the m_usedBuffers Vector while the object's lock is held. Everywhere else the
3056         m_usedBuffers Vector is used under the lock, no reason to not do the same here.
3057
3058 2017-01-09  Yusuke Suzuki  <utatane.tea@gmail.com>
3059
3060         Implement JSSourceCode to propagate SourceCode in module pipeline
3061         https://bugs.webkit.org/show_bug.cgi?id=166861
3062
3063         Reviewed by Saam Barati.
3064
3065         Now SourceOrigin is correctly propagated through the module pipeline.
3066         So the error reported by http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.html
3067         is updated.
3068
3069         * ForwardingHeaders/runtime/JSSourceCode.h: Added.
3070         * bindings/js/JSDOMPromise.h:
3071         (WebCore::DeferredPromise::resolveWithCallback):
3072         * bindings/js/ScriptModuleLoader.cpp:
3073         (WebCore::ScriptModuleLoader::notifyFinished):
3074
3075 2017-01-09  Chris Dumez  <cdumez@apple.com>
3076
3077         REGRESSION(r189555): ImageDocument title no longer includes the size of the image
3078         https://bugs.webkit.org/show_bug.cgi?id=166876
3079         <rdar://problem/29939970>
3080
3081         Reviewed by Tim Horton.
3082
3083         ImageDocument title no longer included the size of the image after r189555.
3084         This is because Document::setTitle() is a no-op if the document does not
3085         have a <head> element. To address the issue, we now include a <head>
3086         element in ImageDocuments so that their title element properly gets added
3087         to it.
3088
3089         Test: fast/images/imageDocument-title.html
3090
3091         * html/ImageDocument.cpp:
3092         (WebCore::ImageDocument::createDocumentStructure):
3093
3094 2017-01-09  Zalan Bujtas  <zalan@apple.com>
3095
3096         ASSERTION FAILED: newLogicalTop >= logicalTop in WebCore::RenderBlockFlow::getClearDelta
3097         https://bugs.webkit.org/show_bug.cgi?id=151202
3098         <rdar://problem/27711822>
3099
3100         Reviewed by Myles C. Maxfield.
3101
3102         FindNextFloatLogicalBottomAdapter uses LayoutUnit::max() to flag m_nextLogicalBottom uninitialized.        
3103         However LayoutUnit::max() can also be a valid value for m_nextLogicalBottom.
3104         FindNextFloatLogicalBottomAdapter::nextLogicalBottom() returns 0 instead of the actual value when
3105         it sees m_nextLogicalBottom uninitialized. In certain cases, it confuses the caller and we end up
3106         with a runaway loop.
3107
3108         Test: fast/block/float/assert-when-line-has-not-enough-space-left.html
3109
3110         * rendering/FloatingObjects.cpp:
3111         (WebCore::FindNextFloatLogicalBottomAdapter::FindNextFloatLogicalBottomAdapter):
3112         (WebCore::FindNextFloatLogicalBottomAdapter::highValue):
3113         (WebCore::FindNextFloatLogicalBottomAdapter::nextLogicalBottom):
3114         (WebCore::FindNextFloatLogicalBottomAdapter::nextShapeLogicalBottom):
3115         (WebCore::FindNextFloatLogicalBottomAdapter::collectIfNeeded):
3116
3117 2017-01-09  Ryan Haddad  <ryanhaddad@apple.com>
3118
3119         Unreviewed, rolling out r210531.
3120
3121         This change broke the 32-bit macOS build and caused LayoutTest
3122         failures.
3123
3124         Reverted changeset:
3125
3126         "File scheme should not allow access of a resource on a
3127         different volume."
3128         https://bugs.webkit.org/show_bug.cgi?id=158552
3129         http://trac.webkit.org/changeset/210531
3130
3131 2017-01-09  Chris Dumez  <cdumez@apple.com>
3132
3133         [iOS] Drop VNodeTracker
3134         https://bugs.webkit.org/show_bug.cgi?id=166868
3135         <rdar://problem/29937587>
3136
3137         Reviewed by Andreas Kling.
3138
3139         Drop VNodeTracker on iOS. This was introduced a while back to try and
3140         address vnode exhaustion issues in long running page load tests.
3141         However, there was no evidence that the VNodeTracker functionality
3142         helped so there is little point in keeping the extra code complexity.
3143
3144         * WebCore.xcodeproj/project.pbxproj:
3145         * platform/SharedBuffer.h:
3146         * platform/VNodeTracker.cpp: Removed.
3147         * platform/VNodeTracker.h: Removed.
3148         * platform/cf/SharedBufferCF.cpp:
3149         (WebCore::SharedBuffer::SharedBuffer):
3150         * platform/cocoa/VNodeTrackerCocoa.cpp: Removed.
3151
3152 2017-01-09  Brent Fulgham  <bfulgham@apple.com>
3153
3154         File scheme should not allow access of a resource on a different volume.
3155         https://bugs.webkit.org/show_bug.cgi?id=158552
3156         <rdar://problem/15307582>
3157
3158         Reviewed by Alex Christensen.
3159
3160         Revise SecurityOrigin to prevent files from one storage device (volume) from accessing content
3161         on a different storage device (volume) unless universal access is enabled.
3162
3163         Pass the current file device as part of the NSURLRequest so that CFNetwork can reject loads
3164         where the device changes in the midst of a load.
3165
3166         Also properly reflect that SecurityOrigin is never null by passing as a reference,
3167         rather than as a pointer.
3168
3169         Tests: Tools/TestWebKitAPI/Tests/mac/CrossPartitionFileSchemeAccess.mm
3170
3171         * page/SecurityOrigin.cpp:
3172         (WebCore::SecurityOrigin::canAccess): Pass argument as reference.
3173         (WebCore::SecurityOrigin::passesFileCheck): Add check that file URLs refer to files in
3174         the same storage volume.
3175         (WebCore::SecurityOrigin::canDisplay): Add check that files share the same volume.
3176         (WebCore::SecurityOrigin::isSameSchemeHostPort): Pass argument as reference.
3177         * page/SecurityOrigin.h:
3178         * platform/FileSystem.cpp:
3179         (WebCore::filesHaveSameVolume): Added.
3180         * platform/FileSystem.h:
3181         * platform/network/cocoa/ResourceRequestCocoa.mm:
3182         (WebCore::ResourceRequest::doUpdatePlatformRequest): If loading a file URL, tell CFNetwork
3183         the storage device at the time of the start of the load so we can trigger a failure if this
3184         changes during the load operation.
3185         * platform/posix/FileSystemPOSIX.cpp:
3186         (WebCore::getFileDeviceId): Added.
3187         * platform/win/FileSystemWin.cpp:
3188         (WebCore::getFileDeviceId): Added.
3189
3190 2017-01-09  Tim Horton  <timothy_horton@apple.com>
3191
3192         Unindenting text inside a blockquote can result in the text being reordered
3193         https://bugs.webkit.org/show_bug.cgi?id=166813
3194
3195         Reviewed by Darin Adler and Ryosuke Niwa.
3196
3197         Test: editing/execCommand/unindent-nested-blockquote-with-inner-div.html
3198
3199         * editing/IndentOutdentCommand.cpp:
3200         (WebCore::IndentOutdentCommand::outdentParagraph):
3201         Start splitting the tree at the beginning of the content being unindented,
3202         not at the containing block flow element, which could e.g. contain other
3203         elements (or even other blockquotes).
3204
3205 2017-01-09  Yusuke Suzuki  <utatane.tea@gmail.com>
3206
3207         [JSC] Prototype dynamic-import
3208         https://bugs.webkit.org/show_bug.cgi?id=165724
3209
3210         Reviewed by Saam Barati.
3211
3212         We do not set a handler for import for now.
3213         So dynamic import feature is only enabled in the JSC shell right now.
3214
3215         * bindings/js/JSDOMWindowBase.cpp:
3216         * bindings/js/JSWorkerGlobalScopeBase.cpp:
3217
3218 2017-01-09  Youenn Fablet  <youennf@gmail.com>
3219
3220         Merging ThreadableLoader redundant options on filtering responses
3221
3222         Merge OpaqueResponseBodyPolicy and ResponseFilteringPolicy ThreadableLoader options
3223         https://bugs.webkit.org/show_bug.cgi?id=166843
3224
3225         Reviewed by Darin Adler.
3226
3227         Covered by existing tests.
3228
3229         Removing OpaqueResponseBodyPolicy option.
3230         When ResponseFilteringPolicy is set to Enable, the body is filtered out in DocumentThreadableLoader.
3231
3232         * Modules/fetch/FetchLoader.cpp:
3233         (WebCore::FetchLoader::start):
3234         * loader/DocumentThreadableLoader.cpp:
3235         (WebCore::DocumentThreadableLoader::didReceiveResponse): Implementing body filtering based on ResponseFilteringPolicy option.
3236         * loader/ThreadableLoader.cpp:
3237         (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions):
3238         * loader/ThreadableLoader.h:
3239         * loader/WorkerThreadableLoader.cpp:
3240         (WebCore::LoaderTaskOptions::LoaderTaskOptions):
3241         * workers/WorkerScriptLoader.cpp:
3242         (WebCore::WorkerScriptLoader::loadSynchronously):
3243         (WebCore::WorkerScriptLoader::loadAsynchronously):
3244         * xml/XMLHttpRequest.cpp:
3245         (WebCore::XMLHttpRequest::createRequest):
3246
3247 2017-01-09  Daniel Bates  <dabates@apple.com>
3248
3249         Evaluating window named element may return wrong result
3250         https://bugs.webkit.org/show_bug.cgi?id=166792
3251         <rdar://problem/29801059>
3252
3253         Reviewed by Chris Dumez.
3254
3255         * bindings/js/JSDOMWindowProperties.cpp:
3256         (WebCore::jsDOMWindowPropertiesGetOwnPropertySlotNamedItemGetter):
3257
3258 2017-01-09  Chris Dumez  <cdumez@apple.com>
3259
3260         REGRESSION(r178955): Touching Settings.in doesn't cause JSInternalSettingsGenerated.cpp to be updated on first build
3261         https://bugs.webkit.org/show_bug.cgi?id=166814
3262
3263         Reviewed by Darin Adler.
3264
3265         Stop using .INTERMEDIATE in DerivedSources.make was it seems to break dependency
3266         chains for some reason. We started using .INTERMEDIATE for scripts that generate
3267         several targets when run a single time. It avoided running the script several
3268         times (once per target) unnecessarily, and fixed issues with parallel builds.
3269
3270         To address the same issue without using .INTERMEDIATE, we now use pattern rules
3271         (i.e. rules that have '%'). As per the documentation [1]:
3272         "Pattern rules may have more than one target. Unlike normal rules, this does not
3273          act as many different rules with the same prerequisites and recipe. If a pattern
3274          rule has multiple targets, make knows that the rule’s recipe is responsible for
3275          making all of the targets. The recipe is executed only once to make all the
3276          targets".
3277
3278          We are therefore solving the same problem as with .INTERMEDIATE. However, I have
3279          confirmed that using pattern rules does not break dependency chains. For example,
3280          modifying Settings.in re-generates both InternalSettingsGenerated.idl *and*
3281          JSInternalSettingsGenerated.cpp.
3282
3283          [1] https://www.gnu.org/software/make/manual/html_node/Pattern-Intro.html#Pattern-Intro
3284
3285         * DerivedSources.make:
3286
3287 2017-01-09  Commit Queue  <commit-queue@webkit.org>
3288
3289         Unreviewed, rolling out r210493 and r210495.
3290         https://bugs.webkit.org/show_bug.cgi?id=166842
3291
3292         Causes makeprops.pl to run on every build (Requested by smfr
3293         on #webkit).
3294
3295         Reverted changesets:
3296
3297         "Avoid triggering rebuilds for minor changes of
3298         CSSProperties.json"
3299         https://bugs.webkit.org/show_bug.cgi?id=166810
3300         http://trac.webkit.org/changeset/210493
3301
3302         "Avoid triggering rebuilds for minor changes of
3303         CSSProperties.json"
3304         https://bugs.webkit.org/show_bug.cgi?id=166810
3305         http://trac.webkit.org/changeset/210495
3306
3307 2017-01-06  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
3308
3309         [GTK] Should support key and code properties on keyboard events
3310         https://bugs.webkit.org/show_bug.cgi?id=166759
3311
3312         Reviewed by Carlos Garcia Campos.
3313
3314         This change fixes a bunch of tests which are currently failing, such as:
3315         - fast/events/arrow-keys-on-body.html
3316         - fast/events/constructors/keyboard-event-constructor.html
3317         - fast/events/key-events-in-input-button.html
3318         - fast/events/key-events-in-input-text.html
3319         - fast/events/keyboardevent-code.html
3320         - fast/events/keyboardevent-key.html
3321
3322         * platform/PlatformKeyboardEvent.h:
3323         * platform/gtk/PlatformKeyboardEventGtk.cpp:
3324         (WebCore::PlatformKeyboardEvent::keyValueForGdkKeyCode): match web key value
3325         to GDK key symbol.
3326         (WebCore::PlatformKeyboardEvent::keyCodeForHardwareKeyCode): match web key code
3327         to hardware code as reported by GDK.
3328         (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent): add web key value and
3329         code to the keyboard event upon creation.
3330
3331 2017-01-09  Carlos Garcia Campos  <cgarcia@igalia.com>
3332
3333         [GTK] WebProcess from WebKitGtk+ 2.15.2 SIGSEGVs in std::unique_ptr<SoupBuffer, WTF::GPtrDeleter<SoupBuffer> >::get() const () at /usr/include/c++/6/bits/unique_ptr.h:305
3334         https://bugs.webkit.org/show_bug.cgi?id=165848
3335
3336         Reviewed by Michael Catanzaro.
3337
3338         In r208881 several locks were added to ImageDecoder to prevent frameBufferAtIndex() from being called by multiple
3339         threads at the same time, but I forgot isSizeAvailable() also calls frameBufferAtIndex(). However, what we
3340         really need to protect is the GIFImageDecoder, to never allow decoding from more than one thread at the same
3341         time. This patch reverts r208881 and adds a lock to GIFImageDecoder::decode() instead.
3342
3343         * platform/image-decoders/ImageDecoder.cpp:
3344         (WebCore::ImageDecoder::frameIsCompleteAtIndex):
3345         (WebCore::ImageDecoder::frameDurationAtIndex):
3346         (WebCore::ImageDecoder::createFrameImageAtIndex):
3347         * platform/image-decoders/ImageDecoder.h:
3348         * platform/image-decoders/gif/GIFImageDecoder.cpp:
3349         (WebCore::GIFImageDecoder::decode):
3350         * platform/image-decoders/gif/GIFImageDecoder.h:
3351
3352 2017-01-09  Alejandro G. Castro  <alex@igalia.com>
3353
3354         [OWR] Unskip fast/mediastream/MediaStream-video-element-track-stop.html
3355         https://bugs.webkit.org/show_bug.cgi?id=165316
3356
3357         Reviewed by Philippe Normand.
3358
3359         Fixed the ended support of the video element in the OWR player and
3360         fixed the videoTracks support. Now the OW player properly adds and
3361         removes the audio and video tracks. Added the getSettings support
3362         to the mediastream interface. Solved also the size handling in
3363         some of the enable/muted situations.
3364
3365         Unskipping fast/mediastream/MediaStream-video-element-track-stop.html.
3366
3367         * platform/GStreamer.cmake: Added the new
3368         RealtimeMediaSourceOwr.cpp with the new code handling the
3369         settings.
3370         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
3371         (WebCore::MediaPlayerPrivateGStreamerOwr::~MediaPlayerPrivateGStreamerOwr):
3372         Release the new video and audio maps that creates a relationship
3373         of the mediastream tracks with the mediatracks of the video element.
3374         (WebCore::MediaPlayerPrivateGStreamerOwr::play): Set ended to
3375         false when we start playing.
3376         (WebCore::MediaPlayerPrivateGStreamerOwr::load): Create the media
3377         tracks to the player so that the videoTracks API returns it, and
3378         add an entry in the map to be able to restore it using the
3379         mediastream track.
3380         (WebCore::MediaPlayerPrivateGStreamerOwr::disableMediaTracks):
3381         Move some part of the stop function to this one in order to use it
3382         in pause method and avoid changing the video selection in that
3383         case.
3384         (WebCore::MediaPlayerPrivateGStreamerOwr::stop): Now we call the
3385         function disableMediaTracks and we also change teh selected
3386         videoTrack.
3387         (WebCore::MediaPlayerPrivateGStreamerOwr::trackEnded): For
3388         videoTrack reset the size and the selected element. In case there
3389         is no media playing we Make sure we set the ended variable to true
3390         and call the timeChange to modify the state of the player.
3391         (WebCore::MediaPlayerPrivateGStreamerOwr::trackEnabledChanged):
3392         Handle properly the situation when the user changed the