ASSERTION FAILED: numberOfChannels == 2 in WebCore::RealtimeIncomingAudioSource:...
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-03-06  Youenn Fablet  <youenn@apple.com>
2
3         ASSERTION FAILED: numberOfChannels == 2 in WebCore::RealtimeIncomingAudioSource::OnData
4         https://bugs.webkit.org/show_bug.cgi?id=169224
5         <rdar://problem/30856811>
6
7         Reviewed by Alex Christensen.
8
9         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
10         (WebCore::RealtimeIncomingAudioSource::OnData): Updated assertion to allow 1 channel since we can handle it as well.
11
12 2017-03-06  Chris Dumez  <cdumez@apple.com>
13
14         [iOS] Throttle CSS animations to 30fps in low power mode
15         https://bugs.webkit.org/show_bug.cgi?id=169138
16         <rdar://problem/30837805>
17
18         Reviewed by Said Abou-Hallawa.
19
20         Throttle software CSS animations to 30fps in low power mode on iOS
21         to save battery.
22
23         Test: fast/animation/css-animation-throttling-lowPowerMode.html
24
25         * page/Page.cpp:
26         (WebCore::Page::handleLowModePowerChange):
27         * page/animation/CSSAnimationController.cpp:
28         (WebCore::CSSAnimationControllerPrivate::CSSAnimationControllerPrivate):
29         (WebCore::CSSAnimationControllerPrivate::updateAnimationTimer):
30         (WebCore::CSSAnimationControllerPrivate::updateThrottlingState):
31         (WebCore::CSSAnimationControllerPrivate::animationInterval):
32         (WebCore::CSSAnimationControllerPrivate::beginAnimationUpdateTime):
33         (WebCore::CSSAnimationControllerPrivate::beginAnimationUpdate):
34         (WebCore::CSSAnimationController::updateThrottlingState):
35         (WebCore::CSSAnimationController::animationInterval):
36         * page/animation/CSSAnimationController.h:
37         * page/animation/CSSAnimationControllerPrivate.h:
38         * testing/Internals.cpp:
39         (WebCore::Internals::animationsInterval):
40         * testing/Internals.h:
41         * testing/Internals.idl:
42
43 2017-03-03  Matt Rajca  <mrajca@apple.com>
44
45         Media: notify clients when the user never plays a media element that was prevented from auto-playing
46         https://bugs.webkit.org/show_bug.cgi?id=169150
47
48         Reviewed by Alex Christensen.
49
50         Added API tests.
51
52         * html/HTMLMediaElement.cpp:
53         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
54         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer):
55         * page/AutoplayEvent.h:
56
57 2017-03-06  Alex Christensen  <achristensen@webkit.org>
58
59         Refactor ContentExtensionParser
60         https://bugs.webkit.org/show_bug.cgi?id=169214
61
62         Reviewed by Brady Eidson.
63
64         No change in behavior, as verified by existing API tests.
65         This will make it easier to use getStringList for other things in coming patches.
66
67         * contentextensions/ContentExtensionParser.cpp:
68         (WebCore::ContentExtensions::getStringList):
69         (WebCore::ContentExtensions::getDomainList):
70
71 2017-03-06  Alex Christensen  <achristensen@webkit.org>
72
73         Fix URLs relative to file URLs with paths beginning with Windows drive letters
74         https://bugs.webkit.org/show_bug.cgi?id=169178
75
76         Reviewed by Tim Horton.
77
78         Windows drives in file URLs can begin with windows drive letters, such as file:///C:/
79         which should not be removed when making other URLs relative to them.
80         See https://url.spec.whatwg.org/#file-slash-state
81
82         Covered by new API tests and newly passing web-platform-tests.
83
84         * platform/URLParser.cpp:
85         (WebCore::URLParser::copyBaseWindowsDriveLetter):
86         (WebCore::URLParser::copyASCIIStringUntil):
87         (WebCore::URLParser::parse):
88         * platform/URLParser.h:
89
90 2017-03-06  Simon Fraser  <simon.fraser@apple.com>
91
92         Only use layer backing store which supports subpixel antialiased text if we know subpixel antialiased will be painted into it
93         https://bugs.webkit.org/show_bug.cgi?id=169191
94
95         Reviewed by Zalan Bujtas.
96
97         Instead of unconditionally calling setSupportsSubpixelAntialiasedText() on GraphicsLayers created
98         by RenderLayerBacking, only do so when we know (or suspect) that a layer contains smoothed text.
99         
100         This is done by enhancing RenderLayer::isVisuallyNonEmpty() and RenderLayer::hasNonEmptyChildRenderers()
101         to take a PaintedContentRequest parameter, which allows the caller to specify what qualities of
102         the layer contents it is interested in. Most of the time, this is just any painted content, but on
103         platforms where GraphicsLayer::supportsSubpixelAntialiasedLayerText() returns true, the query also
104         asks about whether the layer will contain subpixel-antialiased text. In this case, it can't early
105         return as soon as painted content is found; it must keep iterating renderers while all the query 
106         requests are unsatisfied, or until it hits depth or sibling limits. If a limit is hit, we take the
107         same path of assuming there is subpixel-antialiased text (via the "Undetermined" state).
108
109         RenderLayerBacking also makes use of PaintedContentRequest during its non-composited child layer walk.
110
111         To offset the additional cost of this tree walking, RenderLayerBacking now caches information about its
112         painted content for the duration of a single update via PaintedContentsInfo, so we no longer call
113         isDirectlyCompositedImage() and isSimpleContainerCompositingLayer() multiple times per backing per update.
114         The traversal code here too now has to continue until all necessary states in the request have been computed.
115         
116         Add some functions to RenderImage so that we know if it's showing the alt text or has a non-bitmap image
117         (which may contain text).
118         
119         Subpixel-antialiased ("smoothed") text is disabled by DRT and WTR by default, so we need Internals API to enable it.
120         
121         Platforms now express their support for subpixel-antialiased text via GraphicsLayer::supportsSubpixelAntialiasedLayerText()
122         which only returns true on Mac.
123
124         Tests: compositing/contents-format/subpixel-antialiased-text-configs-antialiasing-style.html
125                compositing/contents-format/subpixel-antialiased-text-configs.html
126                compositing/contents-format/subpixel-antialiased-text-images.html
127                compositing/contents-format/subpixel-antialiased-text-visibility.html
128
129         * platform/graphics/GraphicsLayer.cpp:
130         (WebCore::GraphicsLayer::supportsSubpixelAntialiasedLayerText):
131         * platform/graphics/GraphicsLayer.h:
132         * platform/graphics/ca/GraphicsLayerCA.cpp:
133         (WebCore::GraphicsLayer::supportsSubpixelAntialiasedLayerText):
134         (WebCore::GraphicsLayerCA::changeLayerTypeTo):
135         * rendering/RenderImage.cpp:
136         (WebCore::RenderImage::isShowingMissingOrImageError):
137         (WebCore::RenderImage::isShowingAltText):
138         (WebCore::RenderImage::hasNonBitmapImage):
139         * rendering/RenderImage.h:
140         * rendering/RenderLayer.cpp:
141         (WebCore::RenderLayer::calculateClipRects):
142         * rendering/RenderLayer.h:
143         * rendering/RenderLayerBacking.cpp:
144         (WebCore::PaintedContentsInfo::PaintedContentsInfo):
145         (WebCore::PaintedContentsInfo::setWantsSubpixelAntialiasedTextState):
146         (WebCore::PaintedContentsInfo::paintsBoxDecorations):
147         (WebCore::PaintedContentsInfo::paintsContent):
148         (WebCore::PaintedContentsInfo::paintsSubpixelAntialiasedText):
149         (WebCore::PaintedContentsInfo::isSimpleContainer):
150         (WebCore::PaintedContentsInfo::isDirectlyCompositedImage):
151         (WebCore::PaintedContentsInfo::paintsBoxDecorationsDetermination):
152         (WebCore::PaintedContentsInfo::paintsContentDetermination):
153         (WebCore::PaintedContentsInfo::paintsSubpixelAntialiasedTextDetermination):
154         (WebCore::PaintedContentsInfo::contentsTypeDetermination):
155         (WebCore::RenderLayerBacking::createGraphicsLayer):
156         (WebCore::RenderLayerBacking::updateConfiguration):
157         (WebCore::RenderLayerBacking::computeParentGraphicsLayerRect):
158         (WebCore::RenderLayerBacking::updateAfterDescendants):
159         (WebCore::RenderLayerBacking::updateDirectlyCompositedBoxDecorations):
160         (WebCore::RenderLayerBacking::updateDrawsContent):
161         (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundColor):
162         (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundImage):
163         (WebCore::RenderLayerBacking::paintsContent):
164         (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
165         (WebCore::RenderLayerBacking::isPaintDestinationForDescendantLayers):
166         (WebCore::RenderLayerBacking::hasVisibleNonCompositedDescendants):
167         (WebCore::RenderLayerBacking::containsPaintedContent):
168         (WebCore::RenderLayerBacking::contentChanged):
169         (WebCore::RenderLayerBacking::updateImageContents):
170         (WebCore::RenderLayerBacking::paintsChildRenderers): Deleted.
171         * rendering/RenderLayerBacking.h:
172         * rendering/RenderLayerCompositor.cpp:
173         (WebCore::RenderLayerCompositor::logLayerInfo):
174         * testing/Internals.cpp:
175         (WebCore::Internals::setFontSmoothingEnabled):
176         * testing/Internals.h:
177         * testing/Internals.idl:
178
179 2017-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
180
181         Expand font-weight and font-stretch to take any number
182         https://bugs.webkit.org/show_bug.cgi?id=168889
183
184         Reviewed by Simon Fraser.
185
186         This patch expands parsing support for font-weight and font-stretch so that they can accept
187         numbers in addition to the keyword values they accepted previously. Eventually, these numbers
188         will be used as inputs to select variation fonts; however, in this patch, the values are just
189         parsed and held in our internal data model. This means that this patch doesn't actually change
190         the general behavior of WebKit; instead, it parses new values, outputs them (via
191         getComputedStyle() and similar functions), and provides them as input to our preexisting font
192         selection algorithm. 
193
194         This patch doesn't actually modify anything algorithmically, and therefore, it doesn't include
195         any additional tests for the font selection algorithm. Instead, it tests the parsing of the
196         newly accepted values (both input and output).
197
198         Because our internal data model needs to hold numbers now, this patch also completely eliminates
199         the FontWidth, FontItalic, and FontTraitsMask enum values in favor of FontSelectionValues (which
200         can hold numbers instead of individual enum values). Therefore, every place which we were using
201         these enum values is migrated in this patch to using FontSelectionValues instead.
202
203         Tests: fast/text/font-selection-font-face-parse.html
204                fast/text/font-selection-font-loading-api-parse.html
205                fast/text/font-style-parse.html
206                fast/text/font-weight-parse.html
207
208         * accessibility/AccessibilityRenderObject.cpp: Migrate off of old enum types.
209         (WebCore::AccessibilityRenderObject::hasBoldFont):
210         (WebCore::AccessibilityRenderObject::hasItalicFont):
211         (WebCore::AccessibilityRenderObject::hasPlainText):
212         * accessibility/atk/WebKitAccessibleInterfaceText.cpp: Ditto.
213         (getAttributeSetForAccessibilityObject):
214         * css/CSSComputedStyleDeclaration.cpp: Output newly parsed values.
215         (WebCore::fontWeightFromStyle):
216         (WebCore::fontStretchFromStyle):
217         (WebCore::fontStyleFromStyle):
218         (WebCore::fontShorthandValueForSelectionProperties):
219         (WebCore::ComputedStyleExtractor::propertyValue):
220         * css/CSSFontFace.cpp: Migrate off old enum types.
221         (WebCore::calculateWeightRange):
222         (WebCore::CSSFontFace::setWeight):
223         (WebCore::calculateStretchRange):
224         (WebCore::CSSFontFace::setStretch):
225         (WebCore::calculateStyleRange):
226         (WebCore::CSSFontFace::setStyle):
227         (WebCore::CSSFontFace::calculateStyleMask): Deleted.
228         (WebCore::CSSFontFace::calculateWeightMask): Deleted.
229         (WebCore::CSSFontFace::calculateStretch): Deleted.
230         * css/CSSFontFace.h:
231         * css/CSSFontFaceSet.cpp: Migrate off old enum types.
232         (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
233         (WebCore::calculateWeightValue):
234         (WebCore::calculateStretchValue):
235         (WebCore::calculateStyleValue):
236         (WebCore::computeFontSelectionRequest):
237         (WebCore::CSSFontFaceSet::matchingFaces):
238         (WebCore::CSSFontFaceSet::fontFace):
239         (WebCore::computeFontTraitsMask): Deleted.
240         (WebCore::computeFontStretch): Deleted.
241         * css/CSSFontFaceSet.h:
242         * css/CSSFontSelector.cpp: Migrate off old enum types.
243         (WebCore::CSSFontSelector::fontRangesForFamily):
244         * css/CSSPrimitiveValueMappings.h: font-weight and font-style are no longer
245         keyword properties.
246         (WebCore::CSSPrimitiveValue::operator FontWeight): Deleted.
247         (WebCore::CSSPrimitiveValue::operator FontItalic): Deleted.
248         * css/CSSProperties.json: Use the same infrastructure for all three of the
249         font selection properties.
250         * css/CSSSegmentedFontFace.cpp: Migrate off old enum types.
251         (WebCore::CSSSegmentedFontFace::fontRanges):
252         * css/CSSValueKeywords.in: The 100-based font-weight values are now represented
253         as real numbers.
254         * css/FontFace.cpp: Update the string output functions for the new values.
255         (WebCore::rangeIsSingleValue):
256         (WebCore::FontFace::style):
257         (WebCore::FontFace::weight):
258         (WebCore::FontFace::stretch):
259         * css/StyleBuilderConverter.h: Use CSSValue conversion functions to convert
260         to our new data model.
261         (WebCore::StyleBuilderConverter::convertFontWeight):
262         (WebCore::StyleBuilderConverter::convertFontStretch):
263         (WebCore::StyleBuilderConverter::convertFontStyle):
264         * css/StyleBuilderCustom.h: font-weight is no longer a completely custom
265         property.
266         (WebCore::StyleBuilderCustom::applyInitialFontWeight): Deleted.
267         (WebCore::StyleBuilderCustom::applyInheritFontWeight): Deleted.
268         (WebCore::StyleBuilderCustom::applyValueFontWeight): Deleted.
269         * css/parser/CSSParserFastPaths.cpp: font-style is no longer a keyword property.
270         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
271         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
272         * css/parser/CSSPropertyParser.cpp: Parse the new values in the font selection
273         properties.
274         (WebCore::consumeFontWeightKeywordValue):
275         (WebCore::consumeFontWeightCSS21):
276         (WebCore::consumeFontWeight):
277         (WebCore::consumeFontStyleKeywordValue):
278         (WebCore::consumeFontStyle):
279         (WebCore::CSSPropertyParser::parseSingleValue):
280         (WebCore::CSSPropertyParser::parseFontFaceDescriptor):
281         (WebCore::CSSPropertyParser::consumeSystemFont):
282         (WebCore::CSSPropertyParser::consumeFont):
283         * editing/EditingStyle.cpp: Migrate off old enum types.
284         (WebCore::fontWeightIsBold):
285         * editing/mac/EditorMac.mm: Ditto.
286         (WebCore::Editor::applyFontStyles):
287         * platform/graphics/FontCache.h: Unify our font selection values into
288         their enclosing struct, FontSelectionCapabilities. Also, clean up utility
289         functions.
290         * platform/graphics/FontCascade.cpp: Migrate off old enum types.
291         (WebCore::FontCascade::FontCascade):
292         * platform/graphics/FontCascade.h: Ditto.
293         (WebCore::FontCascade::italic):
294         (WebCore::FontCascade::weight):
295         * platform/graphics/FontDescription.cpp: Ditto.
296         (WebCore::FontDescription::FontDescription):
297         (WebCore::FontCascadeDescription::lighterWeight):
298         (WebCore::FontCascadeDescription::bolderWeight):
299         (WebCore::FontDescription::traitsMask): Deleted.
300         * platform/graphics/FontDescription.h: Migrate off old enum types.
301         (WebCore::FontDescription::italic):
302         (WebCore::FontDescription::stretch):
303         (WebCore::FontDescription::weight):
304         (WebCore::FontDescription::fontSelectionRequest):
305         (WebCore::FontDescription::computedPixelSize):
306         (WebCore::FontDescription::setItalic):
307         (WebCore::FontDescription::setStretch):
308         (WebCore::FontDescription::setIsItalic):
309         (WebCore::FontDescription::setWeight):
310         (WebCore::FontDescription::operator==):
311         (WebCore::FontCascadeDescription::lighterWeight):
312         (WebCore::FontCascadeDescription::bolderWeight):
313         (WebCore::FontCascadeDescription::initialItalic):
314         (WebCore::FontCascadeDescription::initialWeight):
315         (WebCore::FontCascadeDescription::initialStretch):
316         * platform/graphics/FontSelectionAlgorithm.cpp: Delete code which was only
317         present to convert from the old enum types to the new FontSelectionRequest
318         type.
319         (WebCore::fontSelectionRequestForTraitsMask): Deleted.
320         (WebCore::initialFontSelectionCapabilitiesForTraitsMask): Deleted.
321         (WebCore::fontSelectionCapabilitiesForTraitsMask): Deleted.
322         * platform/graphics/FontSelectionAlgorithm.h: Migrate to new named functions
323         for special values.
324         (WebCore::isItalic):
325         (WebCore::boldWeightValue):
326         (WebCore::normalWeightValue):
327         (WebCore::isFontWeightBold):
328         (WebCore::normalStretchValue):
329         (WebCore::FontSelectionRequest::FontSelectionRequest):
330         * platform/graphics/cocoa/FontCacheCoreText.cpp: Migrate all platforms which
331         compile this file to know about FontDatabase. This simplifies the interaction
332         between @font-face fonts and installed fonts. Also, migrate off old enum types.
333         (WebCore::stretchFromCoreTextTraits):
334         (WebCore::fontWeightFromCoreText):
335         (WebCore::capabilitiesForFontDescriptor):
336         (WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
337         (WebCore::platformFontLookupWithFamily):
338         (WebCore::invalidateFontCache):
339         (WebCore::fontWithFamily):
340         (WebCore::FontCache::createFontPlatformData):
341         (WebCore::lookupFallbackFont):
342         (WebCore::toTraitsMask): Deleted.
343         (WebCore::isFontWeightBold): Deleted.
344         (WebCore::toCoreTextFontWeight): Deleted.
345         (): Deleted.
346         (WebCore::FontDatabase::capabilitiesForFontDescriptor): Deleted.
347         (WebCore::calculateFontSelectionRequest): Deleted.
348         * platform/graphics/freetype/FontCacheFreeType.cpp: Migrate off old enum types.
349         (WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
350         (WebCore::fontWeightToFontconfigWeight):
351         (): Deleted.
352         * platform/graphics/freetype/FontPlatformDataFreeType.cpp: Ditto.
353         (WebCore::FontPlatformData::FontPlatformData):
354         * platform/graphics/ios/FontCacheIOS.mm: Ditto.
355         (WebCore::baseSystemFontDescriptor):
356         (WebCore::systemFontModificationAttributes):
357         (WebCore::systemFontDescriptor):
358         (WebCore::platformFontWithFamilySpecialCase):
359         (WebCore::FontCache::weightOfCTFont): Deleted.
360         * platform/graphics/mac/FontCacheMac.mm: Ditto.
361         (WebCore::toNSFontWeight):
362         (WebCore::platformFontWithFamilySpecialCase):
363         * platform/graphics/win/FontCacheWin.cpp: Ditto.
364         (WebCore::toGDIFontWeight):
365         (WebCore::traitsInFamilyEnumProc):
366         (WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
367         (): Deleted.
368         * platform/mock/MockRealtimeVideoSource.cpp: Ditto.
369         (WebCore::MockRealtimeVideoSource::applySize):
370         * platform/text/TextFlags.h: Delete old enum types.
371         * platform/win/DragImageWin.cpp: Migrate off old enum types.
372         (WebCore::dragLabelFont):
373         * rendering/RenderEmbeddedObject.cpp: Ditto.
374         (WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
375         * rendering/RenderThemeGtk.cpp: Ditto.
376         (WebCore::RenderThemeGtk::updateCachedSystemFontDescription):
377         * rendering/RenderThemeIOS.mm: Ditto.
378         (WebCore::RenderThemeIOS::updateCachedSystemFontDescription):
379         * rendering/RenderThemeMac.mm: Ditto.
380         (WebCore::toFontWeight):
381         * rendering/RenderThemeWin.cpp: Ditto.
382         (WebCore::fillFontDescription):
383
384 2017-03-06  Chris Dumez  <cdumez@apple.com>
385
386         [iOS] Disable autoplay of silent videos in low power mode
387         https://bugs.webkit.org/show_bug.cgi?id=168985
388         <rdar://problem/30739051>
389
390         Reviewed by Jer Noble.
391
392         Disable autoplay of silent videos in low power mode on iOS to save battery.
393         We force the display of the start button when denying autoplay in low power
394         mode to allow the user to start playback.
395
396         Test: media/modern-media-controls/start-support/start-support-lowPowerMode.html
397
398         * Modules/mediacontrols/MediaControlsHost.cpp:
399         (WebCore::MediaControlsHost::shouldForceControlsDisplay):
400         * Modules/mediacontrols/MediaControlsHost.h:
401         * Modules/mediacontrols/MediaControlsHost.idl:
402         Add shouldForceControlsDisplay property on MediaControlsHost. This property
403         is set to true when we want to force the display for media controls. Currently,
404         this only returns true for autoplay videos, while in low power mode.
405
406         * Modules/modern-media-controls/media/controls-visibility-support.js:
407         (ControlsVisibilitySupport.prototype._updateControls):
408         Take into consideration MediaControlsHost.shouldForceControlsDisplay when
409         initializing shouldShowControls variable.
410
411         * Modules/modern-media-controls/media/start-support.js:
412         (StartSupport.prototype._shouldShowStartButton):
413         Show the start button when MediaControlsHost.shouldForceControlsDisplay
414         returns true.
415
416         * html/HTMLMediaElement.cpp:
417         (WebCore::HTMLMediaElement::HTMLMediaElement):
418         Add MediaElementSession::RequireUserGestureForVideoDueToLowPowerMode restriction
419         to the session when low power mode is enabled so we know we need to force a
420         gesture to start playback of autoplay videos.
421
422         (WebCore::HTMLMediaElement::shouldForceControlsDisplay):
423         Add convenience function to decide if we should force display of media controls.
424         This returns true if the media element is a video with autoplay attribute and
425         its session has the MediaElementSession::RequireUserGestureForVideoDueToLowPowerMode
426         restriction (i.e. we are in low power mode).
427
428         (WebCore::HTMLMediaElement::configureMediaControls):
429         Force requireControls variable to true if shouldForceControlsDisplay() returns
430         true. We do this here instead of inside HTMLMediaElement::controls() because
431         we do not want to change the value of media.controls exposed to JavaScript.
432
433         (WebCore::HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture):
434         Add MediaElementSession::RequireUserGestureForVideoDueToLowPowerMode to the list
435         of restrictions that get removed on user gesture.
436
437         * html/MediaElementSession.cpp:
438         (WebCore::MediaElementSession::playbackPermitted):
439         Deny playback for videos that have the RequireUserGestureForVideoDueToLowPowerMode
440         restriction unless there is a user gesture.
441
442         * html/MediaElementSession.h:
443         Add new MediaElementSession::RequireUserGestureForVideoDueToLowPowerMode
444         restriction.
445
446 2017-03-06  Chris Dumez  <cdumez@apple.com>
447
448         LayoutTest fast/dom/timer-throttling-hidden-page.html is a flaky failure
449         https://bugs.webkit.org/show_bug.cgi?id=168927
450
451         Reviewed by Simon Fraser.
452
453         Update internals.isTimerThrottled() to return true for any kind of throttling.
454         It used to only account only for specific timers that do not cause changes
455         inside the viewport. It now accounts for all kind of throttling, such as
456         timer alignment due to the page being hidden.
457
458         * page/DOMTimer.h:
459         * testing/Internals.cpp:
460         (WebCore::Internals::isTimerThrottled):
461
462 2017-03-06  Dave Hyatt  <hyatt@apple.com>
463
464         Enable fieldsets to be flexboxes, grids and multicolumn.
465         https://bugs.webkit.org/show_bug.cgi?id=169082
466
467         Reviewed by Simon Fraser .
468
469         Added new tests in fast/forms/fieldset.
470
471         This patch eliminates RenderFieldset and moves the functionality into RenderBlock so that
472         derived classes can also be fieldsets.
473
474         * CMakeLists.txt:
475         * WebCore.xcodeproj/project.pbxproj:
476         Remove RenderFieldset from the project.
477
478         * accessibility/AccessibilityRenderObject.cpp:
479         (WebCore::AccessibilityRenderObject::titleUIElement):
480         Call in to RenderBlock now instead of RenderFieldset.
481
482         * html/HTMLFieldSetElement.cpp:
483         (WebCore::HTMLFieldSetElement::createElementRenderer):
484         * html/HTMLFieldSetElement.h:
485         The fieldset DOM element now uses RenderElement::createFor to make renderers so that multiple display types
486         can be supported. A special flag has been added that indicates only to make flexbox and block-related
487         renderers (not table display types).
488
489         * rendering/OrderIterator.cpp:
490         (WebCore::OrderIterator::shouldSkipChild):
491         (WebCore::OrderIteratorPopulator::collectChild):
492         * rendering/OrderIterator.h:
493         Streamline child collection for flexboxes and grids to indicate whether the child should be skipped as a return
494         value from collectChild. Add a shouldSkipChild method that skips both out of flow positioned objects and
495         excluded children like the legends of fieldsets.
496
497         * rendering/RenderBlock.cpp:
498         (WebCore::RenderBlockRareData::RenderBlockRareData):
499         When the legend is taller than the fieldset's borderBefore(), intrinsic border is added to the CSS border width.
500         This intrinsic border being factored in ensures that the padding and content boxes of fieldsets are correct
501         across any layout system, since the legend is now just treated as part of the border.
502
503         (WebCore::RenderBlock::computePreferredLogicalWidths):
504         (WebCore::RenderBlock::computeBlockPreferredLogicalWidths):
505         Call the new computePreferredWidthsForExcludedChildren to ensure that excluded children contribute to
506         preferred width in their own way and not as part of a specific layout system.
507
508         (WebCore::RenderBlock::renderName):
509         Hacked to still return RenderFieldSet for RenderBlockFlow-backed fieldsets for layout test compatibility.
510
511         (WebCore::RenderBlock::layoutExcludedChildren):
512         Renamed from layoutSpecialExcludedChild to more accurately reflect the fact that multiple excluded children
513         can be included here (e.g., both a multicolumn flow thread and a legend). The RenderBlock base class handles
514         the layout of legends by both placing them and setting the correct intrinsic border before amount on the
515         block.
516
517         (WebCore::RenderBlock::findFieldsetLegend):
518         Moved from RenderFieldset.
519
520         (WebCore::RenderBlock::adjustBorderBoxRectForPainting):
521         (WebCore::RenderBlock::paintRectToClipOutFromBorder):
522         These methods are used when painting to shrink the border box as needed to account for the legend and to
523         provide the portion of the border that needs to be clipped out. These methods have been enhanced to
524         properly support all writing modes.
525
526         (WebCore::RenderBlock::intrinsicBorderForFieldset):
527         (WebCore::RenderBlock::setIntrinsicBorderForFieldset):
528         (WebCore::RenderBlock::borderTop):
529         (WebCore::RenderBlock::borderLeft):
530         (WebCore::RenderBlock::borderBottom):
531         (WebCore::RenderBlock::borderRight):
532         (WebCore::RenderBlock::borderBefore):
533         These methods are overridden for border to ensure that the intrinsic border added by a tall legend is
534         properly factored in.
535
536         (WebCore::RenderBlock::computePreferredWidthsForExcludedChildren):
537         * rendering/RenderBlock.h:
538         This method computes the preferred widths for legend children in order to ensure that the legend properly
539         grows the width of the fieldset when it is the widest item.
540
541         (WebCore::RenderBlock::adjustBorderBoxLogicalHeightForBoxSizing):
542         (WebCore::RenderBlock::adjustContentBoxLogicalHeightForBoxSizing):
543         Preserve the behavior of fieldsets in that the available content size includes the space lost accounting
544         for the legend. I don't think this makes much sense, but it matches the behavior of other browsers
545         (and our old behavior).
546
547         (WebCore::RenderBlock::paintExcludedChildrenInBorder):
548         Method for painting the excluded children that might be present in our border. We only do this if the
549         paint phase is a box decoration painting phase and if the legend isn't self-painting.
550
551         * rendering/RenderBlockFlow.cpp:
552         (WebCore::RenderBlockFlow::willCreateColumns):
553         Allow fieldsets to create columns now.
554
555         (WebCore::RenderBlockFlow::layoutBlockChildren):
556         (WebCore::RenderBlockFlow::layoutExcludedChildren):
557         Renamed this method and change it to call the base class to ensure that legends in multicolumn fieldsets
558         get handled properly.
559
560         (WebCore::RenderBlockFlow::addChild):
561         Patched to make sure legends don't get put into the multicolumn flow thread, as they need to
562         remain outside of it.
563
564         (WebCore::RenderBlockFlow::layoutSpecialExcludedChild): Deleted.
565         Renamed to layoutExcludedChildren.
566
567         * rendering/RenderBlockFlow.h:
568         * rendering/RenderBox.cpp:
569         (WebCore::RenderBox::paintBoxDecorations):
570         (WebCore::RenderBox::paintMask):
571         Patched to call the new adjustBorderBoxRectForPainting and paintRectToClipOutFromBorder methods in
572         order to properly shrink the border box rect for painting and to clip out the portion of the border
573         covered by the legend.
574
575         (WebCore::RenderBox::avoidsFloats):
576         Add fieldsets as avoiding floats. RenderFieldset used to subclass this method to return true, but with
577         its removal, we need to put this in the base class along with legends.
578
579         * rendering/RenderBox.h:
580         (WebCore::RenderBox::isGridItem):
581         (WebCore::RenderBox::isFlexItem):
582         Patched to exclude legends so that they don't try to size like they are really in the grid or flexbox.
583
584         (WebCore::RenderBox::adjustBorderBoxRectForPainting):
585         This method is overridden by RenderBLock to handle adjusting fieldset border rects for painting.
586
587         * rendering/RenderBoxModelObject.cpp:
588         (WebCore::RenderBoxModelObject::paintBorder):
589         * rendering/RenderBoxModelObject.h:
590         (WebCore::RenderBoxModelObject::paintRectToClipOutFromBorder):
591         Patched to properly paint fieldsets using the new helpers.
592
593         * rendering/RenderDeprecatedFlexibleBox.cpp:
594         (WebCore::FlexBoxIterator::next):
595         (WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
596         (WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox):
597         Make sure deprecated flexible boxes lay out their legends properly by calling layoutExcludedChildren.
598
599         * rendering/RenderElement.cpp:
600         (WebCore::RenderElement::createFor):
601         * rendering/RenderElement.h:
602         Patched to take a flag that limits what renderers can be created so that fieldsets don't make table
603         display types.
604
605         * rendering/RenderFieldset.cpp: Removed.
606         * rendering/RenderFieldset.h: Removed.
607         Remove RenderFieldset files from the tree.
608
609         * rendering/RenderFlexibleBox.cpp:
610         (WebCore::RenderFlexibleBox::computeIntrinsicLogicalWidths):
611         (WebCore::RenderFlexibleBox::firstLineBaseline):
612         (WebCore::RenderFlexibleBox::layoutBlock):
613         (WebCore::RenderFlexibleBox::layoutFlexItems):
614         (WebCore::RenderFlexibleBox::prepareOrderIteratorAndMargins):
615         Make sure flexible boxes lay out their legends properly by calling layoutExcludedChildren.
616         Patch methods to use the OrderIterator's new shouldSkipChild method to ensure legends aren't
617         part of the flexible box layout.
618
619         * rendering/RenderGrid.cpp:
620         (WebCore::RenderGrid::layoutBlock):
621         (WebCore::RenderGrid::computeIntrinsicLogicalWidths):
622         (WebCore::RenderGrid::placeItemsOnGrid):
623         (WebCore::RenderGrid::populateExplicitGridAndOrderIterator):
624         (WebCore::RenderGrid::layoutGridItems):
625         Make sure grids lay out their legends properly by calling layoutExcludedChildren.
626         Patch methods to use the OrderIterator's new shouldSkipChild method to ensure legends aren't
627         part of the grid's layout.
628
629         * rendering/RenderMultiColumnFlowThread.cpp:
630         (WebCore::RenderMultiColumnFlowThread::populate):
631         Pull legends back up into the block and don't let them be part of the flow thread.
632
633         * rendering/RenderMultiColumnSet.cpp:
634         (WebCore::RenderMultiColumnSet::requiresBalancing):
635         Fix an assert to allow legends to exist as siblings of multicolumn sets.
636
637         * rendering/RenderObject.cpp:
638         (WebCore::RenderObject::isFieldset):
639         Changed to examine the HTML element rather than RenderFieldset.
640
641         * rendering/RenderObject.h:
642         (WebCore::RenderObject::isExcludedFromNormalLayout):
643         (WebCore::RenderObject::setIsExcludedFromNormalLayout):
644         (WebCore::RenderObject::RenderObjectBitfields::RenderObjectBitfields):
645         RenderObjects now have a new bit that is set for excluded objects like legends, flow threads,
646         placeholders, and ruby text. This bit lets code easily detect that an object is excluded from
647         the layout system and can be skipped.
648
649         (WebCore::RenderObject::isExcludedAndPlacedInBorder):
650         Helper method for asking if an object is painting inside the border. Used to know we
651         need to factor it into preferred width calculations outside of any one layout system
652         and also to know that we need to paint it when we paint the fieldset's border instead of
653         later (after we might have scrolled or clipped the child painting area).
654
655         * rendering/RenderRubyRun.cpp:
656         (WebCore::RenderRubyRun::layoutExcludedChildren):
657         (WebCore::RenderRubyRun::layoutSpecialExcludedChild): Deleted.
658         * rendering/RenderRubyRun.h:
659         Rename layoutSpecialExcludedChild to layoutExcludedChildren.
660
661         * rendering/RenderTable.cpp:
662         (WebCore::RenderTable::adjustBorderBoxRectForPainting):
663         (WebCore::RenderTable::paintBoxDecorations):
664         (WebCore::RenderTable::paintMask):
665         (WebCore::RenderTable::subtractCaptionRect): Deleted.
666         * rendering/RenderTable.h:
667         Patched tables to share the same border box rect adjustment used by fieldsets when subtracting
668         out captions. This is prep work to allow tables to be fieldsets, but for now I didn't go all the
669         way.
670
671         * rendering/RenderTableCell.cpp:
672         (WebCore::RenderTableCell::paintBoxDecorations):
673         (WebCore::RenderTableCell::paintMask):
674         Make sure table cells adjust their border box rects for painting. Again this is prep work for
675         cells potentially being fieldsets, but not supported yet.
676
677         * rendering/RenderTextControl.cpp:
678         (WebCore::RenderTextControl::layoutExcludedChildren):
679         (WebCore::RenderTextControl::layoutSpecialExcludedChild): Deleted.
680         * rendering/RenderTextControl.h:
681         * rendering/RenderTextControlMultiLine.cpp:
682         (WebCore::RenderTextControlMultiLine::layoutExcludedChildren):
683         (WebCore::RenderTextControlMultiLine::layoutSpecialExcludedChild): Deleted.
684         * rendering/RenderTextControlMultiLine.h:
685         Renamed the methods for doing the excluded child layout.
686
687         * rendering/RenderTreeAsText.cpp:
688         (WebCore::RenderTreeAsText::writeRenderObject):
689         Make sure to dump the original fieldset border and not the border with the extra legend stuff in it.
690
691 2017-03-06  Antoine Quint  <graouts@apple.com>
692
693         [Modern Media Controls] Tracks panel should clip and scroll content when numerous tracks are available
694         https://bugs.webkit.org/show_bug.cgi?id=169201
695         <rdar://problem/30867979>
696
697         Reviewed by Eric Carlson.
698
699         We now position and size the tracks panel dynamically and ensure a max-height is applied
700         to the panel so that it allows a margin of 10px above it within the media controls. We also
701         apply that same max-height to a new intermediary scrollable container for the track lists,
702         so that it scrolls independently of the container and the background tint.
703
704         Test: media/modern-media-controls/tracks-panel/tracks-panel-position-and-size.html
705
706         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
707         (MacOSFullscreenMediaControls.prototype.showTracksPanel): Deleted.
708         * Modules/modern-media-controls/controls/macos-inline-media-controls.css:
709         (.media-controls.mac.inline .volume.slider):
710         (.media-controls.mac.inline .tracks-panel): Deleted.
711         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
712         (MacOSInlineMediaControls.prototype.showTracksPanel): Deleted.
713         * Modules/modern-media-controls/controls/macos-media-controls.js:
714         (MacOSMediaControls.prototype.showTracksPanel):
715         * Modules/modern-media-controls/controls/tracks-panel.css:
716         (.tracks-panel > .background-tint > div,):
717         (.tracks-panel > .scrollable-container):
718         (.tracks-panel section):
719         (.tracks-panel section:first-of-type):
720         (.tracks-panel section > h3):
721         (.tracks-panel section > ul):
722         (.tracks-panel section > ul > li):
723         (.tracks-panel section > ul > li:focus):
724         (.tracks-panel section > ul > li.selected:before):
725         (.tracks-panel section > ul > li.animated):
726         (.tracks-panel > .background-tint > div): Deleted.
727         (.tracks-panel > section): Deleted.
728         (.tracks-panel > section:first-of-type): Deleted.
729         (.tracks-panel > section > h3): Deleted.
730         (.tracks-panel > section > ul): Deleted.
731         (.tracks-panel > section > ul > li): Deleted.
732         (.tracks-panel > section > ul > li:focus): Deleted.
733         (.tracks-panel > section > ul > li.selected:before): Deleted.
734         (.tracks-panel > section > ul > li.animated): Deleted.
735         * Modules/modern-media-controls/controls/tracks-panel.js:
736         (TracksPanel.prototype.presentInParent):
737         (TracksPanel.prototype.get maxHeight):
738         (TracksPanel.prototype.set maxHeight):
739         (TracksPanel.prototype.commitProperty):
740         (TracksPanel.prototype._childrenFromDataSource):
741
742 2017-03-06  Manuel Rego Casasnovas  <rego@igalia.com>
743
744         [css-grid] Stretch should grow and shrink items to fit its grid area
745         https://bugs.webkit.org/show_bug.cgi?id=163200
746
747         Reviewed by Darin Adler.
748
749         After some discussions the CSS WG agreed that stretch should not only
750         grow items, but also shrink them to fit its grid area.
751         That way the "min-width|height: auto" is somehow ignored for grid items.
752         More info at: https://github.com/w3c/csswg-drafts/issues/283
753
754         The good part is that this allows us to remove some ugly code we've
755         in RenderBox that was only used by Grid Layout.
756
757         For images, we'll be stretching on both axis right now, so the aspect
758         ratio won't be preserved. The default behavior might change in those
759         cases, but that should be implemented in a different patch.
760
761         * rendering/RenderBox.cpp:
762         (WebCore::RenderBox::computeLogicalWidthInRegion):
763         (WebCore::RenderBox::computeLogicalHeight):
764
765 2017-03-06  Miguel Gomez  <magomez@igalia.com>
766
767         [GTK] WebProcess from WebKitGtk+ 2.15.x SIGSEVs in GIFLZWContext::doLZW(unsigned char const*, unsigned long) at Source/WebCore/platform/image-decoders/gif/GIFImageReader.cpp:303
768         https://bugs.webkit.org/show_bug.cgi?id=167304
769
770         Reviewed by Carlos Garcia Campos.
771
772         Add a lock to ensure that the GIFImageReader that we are using for decoding is not deleted while
773         the decoding thread is using it.
774
775         No new tests.
776
777         * platform/image-decoders/gif/GIFImageDecoder.cpp:
778         (WebCore::GIFImageDecoder::clearFrameBufferCache):
779
780 2017-03-06  Antti Koivisto  <antti@apple.com>
781
782         Allow render tree building before loading stylesheet elements
783         https://bugs.webkit.org/show_bug.cgi?id=169079
784         <rdar://problem/30865709>
785
786         Reviewed by Andreas Kling.
787
788         Currently we don't resolve style or construct renderers if there are any pending
789         stylesheet loads. This patch enables style and renderer constuction up to the
790         first encountered loading style element.
791
792         This is a step toward allowing incremental rendering for in-body stylesheets.
793
794         * dom/Document.cpp:
795         (WebCore::Document::needsStyleRecalc):
796
797             Ensure scrolling to anchor eventually happens.
798
799         * dom/Document.h:
800         (WebCore::Document::isIgnoringPendingStylesheets):
801         * dom/InlineStyleSheetOwner.cpp:
802         (WebCore::InlineStyleSheetOwner::createSheet):
803         (WebCore::InlineStyleSheetOwner::sheetLoaded):
804         (WebCore::InlineStyleSheetOwner::startLoadingDynamicSheet):
805         * dom/ProcessingInstruction.cpp:
806         (WebCore::ProcessingInstruction::checkStyleSheet):
807         (WebCore::ProcessingInstruction::sheetLoaded):
808         (WebCore::ProcessingInstruction::removedFrom):
809         * html/HTMLLinkElement.cpp:
810         (WebCore::HTMLLinkElement::addPendingSheet):
811         (WebCore::HTMLLinkElement::removePendingSheet):
812         * style/StyleScope.cpp:
813         (WebCore::Style::Scope::addPendingSheet):
814         (WebCore::Style::Scope::removePendingSheet):
815
816             Track pending sheet nodes in a map so we can test if a given node has a pending sheet.
817             This is also more robust in general.
818
819         (WebCore::Style::Scope::hasProcessingInstructionWithPendingSheet):
820         (WebCore::Style::Scope::updateActiveStyleSheets):
821         * style/StyleScope.h:
822         (WebCore::Style::Scope::hasPendingSheet):
823         (WebCore::Style::Scope::hasPendingSheets):
824         (WebCore::Style::Scope::addPendingSheet): Deleted.
825         * style/StyleTreeResolver.cpp:
826         (WebCore::Style::TreeResolver::styleForElement):
827
828             Instead of global test for placeholder construction check the status of the pending sheet flag.
829
830         (WebCore::Style::hasLoadingStylesheet):
831         (WebCore::Style::TreeResolver::resolveComposedTree):
832
833             Set a flag when encountering a pending top level sheet during DOM traversal.
834
835         (WebCore::Style::TreeResolver::resolve):
836         * style/StyleTreeResolver.h:
837         * svg/graphics/SVGImage.cpp:
838         (WebCore::SVGImage::dataChanged):
839
840             Ensure SVG images have layout before getting the size.
841
842 2017-03-06  Vanessa Chipirrás Navalón  <vchipirras@igalia.com>
843
844         [GStreamer] Adopt nullptr
845         https://bugs.webkit.org/show_bug.cgi?id=123438
846
847         Reviewed by Xabier Rodriguez-Calvar.
848
849         To adapt the code to the C++11 standard, all NULL or 0 pointers have been changed to nullptr.
850
851         * platform/audio/gstreamer/AudioDestinationGStreamer.cpp:
852         (WebCore::AudioDestinationGStreamer::AudioDestinationGStreamer):
853         * platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
854         (WebCore::AudioFileReader::handleNewDeinterleavePad):
855         (WebCore::AudioFileReader::plugDeinterleave):
856         (WebCore::AudioFileReader::decodeAudioForBusCreation):
857         * platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
858         (WebCore::AudioSourceProviderGStreamer::AudioSourceProviderGStreamer):
859         (WebCore::AudioSourceProviderGStreamer::configureAudioBin):
860         (WebCore::AudioSourceProviderGStreamer::setClient):
861         (WebCore::AudioSourceProviderGStreamer::handleNewDeinterleavePad):
862         * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
863         (webkit_web_audio_src_init):
864         (webKitWebAudioSrcLoop):
865         (webKitWebAudioSrcChangeState):
866         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
867         (WebCore::AudioTrackPrivateGStreamer::setEnabled):
868         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
869         (WebCore::initializeGStreamer):
870         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
871         (WebCore::MediaPlayerPrivateGStreamer::setAudioStreamProperties):
872         (WebCore::MediaPlayerPrivateGStreamer::registerMediaEngine):
873         (WebCore::initializeGStreamerAndRegisterWebKitElements):
874         (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
875         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
876         (WebCore::MediaPlayerPrivateGStreamer::newTextSample):
877         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
878         (WebCore::MediaPlayerPrivateGStreamer::processTableOfContents):
879         Removed the unused second argument on processTableOfContentsEntry function.
880         (WebCore::MediaPlayerPrivateGStreamer::processTableOfContentsEntry):
881         Removed the unused second argument on this function.
882         (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired):
883         (WebCore::MediaPlayerPrivateGStreamer::loadNextLocation):
884         (WebCore::MediaPlayerPrivateGStreamer::createAudioSink):
885         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
886         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
887         Removed the unused second argument on processTableOfContentsEntry function.
888         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
889         (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
890         (WebCore::MediaPlayerPrivateGStreamerBase::setMuted):
891         (WebCore::MediaPlayerPrivateGStreamerBase::muted):
892         (WebCore::MediaPlayerPrivateGStreamerBase::notifyPlayerOfMute):
893         (WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement):
894         (WebCore::MediaPlayerPrivateGStreamerBase::decodedFrameCount):
895         (WebCore::MediaPlayerPrivateGStreamerBase::droppedFrameCount):
896         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
897         (WebCore::MediaPlayerPrivateGStreamerOwr::registerMediaEngine):
898         * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
899         (webkit_text_combiner_init):
900         (webkitTextCombinerPadEvent):
901         (webkitTextCombinerRequestNewPad):
902         (webkitTextCombinerNew):
903         * platform/graphics/gstreamer/TextSinkGStreamer.cpp:
904         (webkitTextSinkNew):
905         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
906         (WebCore::TrackPrivateBaseGStreamer::tagsChanged):
907         (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfActiveChanged):
908         * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
909         (webkit_video_sink_init):
910         (webkitVideoSinkProposeAllocation):
911         (webkitVideoSinkNew):
912         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
913         (WebCore::VideoTrackPrivateGStreamer::setSelected):
914         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
915         (webkit_web_src_init):
916         (webKitWebSrcDispose):
917         (webKitWebSrcSetProperty):
918         (webKitWebSrcStop):
919         (webKitWebSrcChangeState):
920         (webKitWebSrcQueryWithParent):
921         (webKitWebSrcGetProtocols):
922         (StreamingClient::handleResponseReceived):
923         (StreamingClient::handleDataReceived):
924         (ResourceHandleStreamingClient::didFail):
925         (ResourceHandleStreamingClient::wasBlocked):
926         (ResourceHandleStreamingClient::cannotShowURL):
927         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
928         (webKitMediaSrcGetProtocols):
929
930 2017-03-06  Andreas Kling  <akling@apple.com>
931
932         [iOS] Report domains crashing under memory pressure via enhanced privacy logging.
933         <https://webkit.org/b/169133>
934         <rdar://problem/29964017>
935
936         Reviewed by Antti Koivisto.
937
938         * page/DiagnosticLoggingKeys.h:
939
940 2017-03-05  Simon Fraser  <simon.fraser@apple.com>
941
942         Avoid backing store for layers with empty text nodes in a few more cases
943         https://bugs.webkit.org/show_bug.cgi?id=169185
944
945         Reviewed by Dan Bernstein.
946
947         In hasPaintingNonLayerDescendants() we can check whether the RenderText's linesBoundingBox()
948         is empty to avoid backing store in a few more cases. Also use containsOnlyWhitespace() rather
949         than isAllCollapsibleWhitespace(), because there's no need for backing store for non-selectable
950         whitespace text.
951
952         Covered by existing tests.
953
954         * rendering/RenderLayer.cpp:
955         (WebCore::RenderLayer::calculateClipRects):
956
957 2017-03-05  Chris Dumez  <cdumez@apple.com>
958
959         Drop unnecessary backslash in ResourceResponse::sanitizeSuggestedFilename()
960         https://bugs.webkit.org/show_bug.cgi?id=169066
961
962         Reviewed by Sam Weinig.
963
964         Drop unnecessary backslash in ResourceResponse::sanitizeSuggestedFilename().
965
966         * platform/network/ResourceResponseBase.cpp:
967         (WebCore::ResourceResponseBase::sanitizeSuggestedFilename):
968
969 2017-03-05  Chris Dumez  <cdumez@apple.com>
970
971         Using <form> in <template> causes following <form> to get swallowed
972         https://bugs.webkit.org/show_bug.cgi?id=163552
973
974         Reviewed by Sam Weinig.
975
976         As per the HTML specification [1], when finding a "form" tag in the "in body"
977         insertion mode, we should insert an HTML element for the token, and, if there
978         is no template element on the stack of open elements, set the form element
979         pointer to point to the element created.
980
981         We were missing the "if there is no template element on the stack of open
982         elements" check and setting the form element pointer unconditionally.
983         This patch fixes the issue.
984
985         [1] https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody:form-element-pointer-2
986
987         Test: fast/parser/form-after-template.html
988
989         * html/parser/HTMLConstructionSite.cpp:
990         (WebCore::HTMLConstructionSite::insertHTMLFormElement):
991
992 2017-03-04  Myles C. Maxfield  <mmaxfield@apple.com>
993
994         Update CSSFontSelector's matching algorithm to understand ranges
995         https://bugs.webkit.org/show_bug.cgi?id=168892
996
997         Reviewed by Jon Lee.
998
999         This patch migrates the font selection algorithm out of FontCacheCoreText and into its own file which can be shared
1000         among all ports. It then migrates our web font selection algorithm to use it.
1001
1002         This patch doesn't actually change the parsing rules; it just changes the internal machinery for how fonts get
1003         selected. Therefore, this patch simply makes zero-length ranges from the discrete values the parser emits, and passes
1004         those zero-length ranges to the range-based font selection routine. This means that this patch doesn't actually
1005         change the results of the font selection algorithm.
1006
1007         One of the inputs to the new font selection algorithm is font-stretch, which previously was not parsed inside
1008         @font-face blocks or the CSS Font Loading API. This patch therefore adds parsing support and modifies the existing
1009         tests for these pieces to expect parsing to work. Because the font selection algorithm itself is shared between
1010         installed fonts and webfonts, this patch doesn't add any additional tests for it (because it is already covered under
1011         existing tests).
1012
1013         No new tests because there is no behavior change.
1014
1015         * CMakeLists.txt:
1016         * WebCore.xcodeproj/project.pbxproj: Add new file for the font selection algorithm.
1017         * css/CSSFontFace.cpp:
1018         (WebCore::CSSFontFace::calculateStretch): Used on @font-face blocks and the CSS Font Loading API.
1019         (WebCore::CSSFontFace::setStretch): Fill out the previously stubbed function.
1020         * css/CSSFontFace.h: Add the range member variable to CSSFontFaces.
1021         * css/CSSFontFaceSet.cpp:
1022         (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered): Now that we care about font-stretch, we need to
1023         look it up for local fonts too. This current approach of an extra FontSelectionValue hanging around with a
1024         FontTraitsMask is very ugly and will be removed soon (https://bugs.webkit.org/show_bug.cgi?id=168889 and
1025         https://bugs.webkit.org/show_bug.cgi?id=168890).
1026         (WebCore::computeFontStretch): Used on @font-face blocks and the CSS Font Loading API.
1027         (WebCore::CSSFontFaceSet::matchingFaces): Educate about font-stretch.
1028         (WebCore::CSSFontFaceSet::fontFace): Migrate to the new font-selection algorithm.
1029         (WebCore::fontFaceComparator): Deleted.
1030         * css/CSSFontFaceSet.h:
1031         * css/CSSFontSelector.cpp:
1032         (WebCore::CSSFontSelector::addFontFaceRule): Educate about font-stretch.
1033         (WebCore::CSSFontSelector::fontRangesForFamily): Ditto.
1034         * css/FontFace.cpp:
1035         (WebCore::FontFace::setStretch): Ditto.
1036         (WebCore::FontFace::stretch): Ditto.
1037         * css/parser/CSSPropertyParser.cpp:
1038         (WebCore::CSSPropertyParser::parseFontFaceDescriptor): Ditto.
1039         * platform/graphics/FontCache.h: Ditto.
1040         * platform/graphics/FontDescription.h:
1041         * platform/graphics/FontSelectionAlgorithm.cpp: Added.
1042         (WebCore::FontSelectionAlgorithm::filterCapability):
1043         (WebCore::FontSelectionAlgorithm::indexOfBestCapabilities):
1044         (WebCore::fontSelectionRequestForTraitsMask):
1045         (WebCore::initialFontSelectionCapabilitiesForTraitsMask):
1046         (WebCore::fontSelectionCapabilitiesForTraitsMask):
1047         * platform/graphics/FontSelectionAlgorithm.h: Added. Taken from FontCacheCoreText.cpp.
1048         (WebCore::FontSelectionValue::FontSelectionValue):
1049         (WebCore::FontSelectionValue::operator float):
1050         (WebCore::FontSelectionValue::rawValue):
1051         (WebCore::FontSelectionValue::maximumValue):
1052         (WebCore::FontSelectionValue::minimumValue):
1053         (WebCore::FontSelectionValue::operator+):
1054         (WebCore::FontSelectionValue::operator-):
1055         (WebCore::FontSelectionValue::operator*):
1056         (WebCore::FontSelectionValue::operator/):
1057         (WebCore::FontSelectionValue::operator==):
1058         (WebCore::FontSelectionValue::operator!=):
1059         (WebCore::FontSelectionValue::operator<):
1060         (WebCore::FontSelectionValue::operator<=):
1061         (WebCore::FontSelectionValue::operator>):
1062         (WebCore::FontSelectionValue::operator>=):
1063         (WebCore::FontSelectionRange::isValid):
1064         (WebCore::FontSelectionRange::expand):
1065         (WebCore::FontSelectionRange::includes):
1066         (WebCore::FontSelectionRequest::operator==):
1067         (WebCore::FontSelectionRequest::operator!=):
1068         (WebCore::FontSelectionRequestKey::FontSelectionRequestKey):
1069         (WebCore::FontSelectionRequestKey::isHashTableDeletedValue):
1070         (WebCore::FontSelectionRequestKey::operator==):
1071         (WebCore::FontSelectionRequestKeyHash::hash):
1072         (WebCore::FontSelectionRequestKeyHash::equal):
1073         (WebCore::FontSelectionCapabilities::expand):
1074         (WebCore::FontSelectionAlgorithm::FontSelectionAlgorithm):
1075         (WebCore::FontSelectionAlgorithm::iterateActiveCapabilitiesWithReturn):
1076         (WebCore::FontSelectionAlgorithm::iterateActiveCapabilities):
1077         * platform/graphics/cocoa/FontCacheCoreText.cpp: Moved to FontSelectionAlgorithm.
1078         (WebCore::stretchFromCoreTextTraits):
1079         (WebCore::FontDatabase::capabilitiesForFontDescriptor):
1080         (WebCore::findClosestFont):
1081         (WebCore::calculateFontSelectionRequest):
1082         (WebCore::platformFontLookupWithFamily):
1083         (WebCore::FontCache::getTraitsInFamily): Deleted.
1084         (WebCore::iterateActiveFontsWithReturn): Deleted.
1085         (WebCore::iterateActiveFonts): Deleted.
1086         (WebCore::findClosestStretch): Deleted.
1087         (WebCore::filterStretch): Deleted.
1088         (WebCore::findClosestStyle): Deleted.
1089         (WebCore::filterStyle): Deleted.
1090         (WebCore::findClosestWeight): Deleted.
1091         (WebCore::filterWeight): Deleted.
1092         (WebCore::computeTargetWeight): Deleted.
1093         * platform/text/TextFlags.h: Moved to FontSelectionAlgorithm.
1094         (WebCore::FontSelectionValue::FontSelectionValue): Deleted.
1095         (WebCore::FontSelectionValue::operator float): Deleted.
1096         (WebCore::FontSelectionValue::operator+): Deleted.
1097         (WebCore::FontSelectionValue::operator-): Deleted.
1098         (WebCore::FontSelectionValue::operator*): Deleted.
1099         (WebCore::FontSelectionValue::operator/): Deleted.
1100         (WebCore::FontSelectionValue::operator==): Deleted.
1101         (WebCore::FontSelectionValue::operator!=): Deleted.
1102         (WebCore::FontSelectionValue::operator<): Deleted.
1103         (WebCore::FontSelectionValue::operator<=): Deleted.
1104         (WebCore::FontSelectionValue::operator>): Deleted.
1105         (WebCore::FontSelectionValue::operator>=): Deleted.
1106         (WebCore::FontSelectionValue::rawValue): Deleted.
1107         (WebCore::FontSelectionValue::maximumValue): Deleted.
1108         (WebCore::FontSelectionValue::minimumValue): Deleted.
1109         (WebCore::FontSelectionRange::isValid): Deleted.
1110         (WebCore::FontSelectionRange::expand): Deleted.
1111         (WebCore::FontSelectionRange::includes): Deleted.
1112         (WebCore::FontSelectionCapabilities::expand): Deleted.
1113
1114 2017-03-05  Simon Fraser  <simon.fraser@apple.com>
1115
1116         Make some RenderLayer tree traversal in RenderLayerBacking more generic
1117         https://bugs.webkit.org/show_bug.cgi?id=169177
1118
1119         Reviewed by Zalan Bujtas.
1120
1121         The real goal of this patch is reduce the number of callers of
1122         RenderLayerBacking::isPaintDestinationForDescendantLayers() to one. To achieve that,
1123         have the setContentsVisible() logic (which is really just about the CSS 'visibility' property)
1124         do its own tree traversal which just consults layer.hasVisibleContent(). So
1125         make descendantLayerPaintsIntoAncestor() a generic traversal function which walks
1126         descendant layers which may paint into the target layer. The "Visible" in the name
1127         reflects the fact that it can bypass a subtree for a layer with !hasVisibleDescendant().
1128
1129         * rendering/RenderLayerBacking.cpp:
1130         (WebCore::RenderLayerBacking::updateAfterDescendants):
1131         (WebCore::traverseVisibleNonCompositedDescendantLayers):
1132         (WebCore::RenderLayerBacking::isPaintDestinationForDescendantLayers):
1133         (WebCore::RenderLayerBacking::hasVisibleNonCompositedDescendants):
1134         (WebCore::descendantLayerPaintsIntoAncestor): Deleted.
1135         * rendering/RenderLayerBacking.h:
1136
1137 2017-03-04  Simon Fraser  <simon.fraser@apple.com>
1138
1139         Clarify some terminology in RenderLayerBacking
1140         https://bugs.webkit.org/show_bug.cgi?id=169174
1141
1142         Reviewed by Zalan Bujtas.
1143
1144         Rename some functions related to directly-composited background images and
1145         box decorations for clarify.
1146
1147         Only behavior change is for canDirectlyCompositeBackgroundBackgroundImage() to check
1148         GraphicsLayer::supportsContentsTiling(), which means that RenderLayerBacking::contentChanged()
1149         will no longer trigger a updateGeometry() when it gets BackgroundImageChanged on non-
1150         CoordinateGraphics platforms.
1151
1152         * rendering/RenderLayerBacking.cpp:
1153         (WebCore::RenderLayerBacking::updateConfiguration):
1154         (WebCore::RenderLayerBacking::updateAfterDescendants):
1155         (WebCore::RenderLayerBacking::updateDirectlyCompositedBoxDecorations):
1156         (WebCore::canDirectlyCompositeBackgroundBackgroundImage):
1157         (WebCore::hasPaintedBoxDecorationsOrBackgroundImage):
1158         (WebCore::supportsDirectlyCompositedBoxDecorations):
1159         (WebCore::RenderLayerBacking::paintsBoxDecorations):
1160         (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
1161         (WebCore::RenderLayerBacking::contentChanged):
1162         (WebCore::RenderLayerBacking::updateDirectlyCompositedContents): Deleted.
1163         (WebCore::canCreateTiledImage): Deleted.
1164         (WebCore::hasVisibleBoxDecorationsOrBackgroundImage): Deleted.
1165         (WebCore::supportsDirectBoxDecorationsComposition): Deleted.
1166         * rendering/RenderLayerBacking.h:
1167
1168 2017-03-04  Alex Christensen  <achristensen@webkit.org>
1169
1170         Cleanup after r213418
1171         https://bugs.webkit.org/show_bug.cgi?id=169165
1172
1173         Reviewed by Youenn Fablet.
1174
1175         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
1176         (WebCore::RealtimeIncomingAudioSource::OnData):
1177         Restore the assertion I removed.
1178
1179 2017-03-04  Commit Queue  <commit-queue@webkit.org>
1180
1181         Unreviewed, rolling out r213379.
1182         https://bugs.webkit.org/show_bug.cgi?id=169169
1183
1184         broke GTK+ and Windows builds (Requested by mcatanzaro on
1185         #webkit).
1186
1187         Reverted changeset:
1188
1189         "Enable fieldsets to be flexboxes, grids and multicolumn."
1190         https://bugs.webkit.org/show_bug.cgi?id=169082
1191         http://trac.webkit.org/changeset/213379
1192
1193 2017-03-03  Youenn Fablet  <youenn@apple.com>
1194
1195         [WebRTC] Update libwebrtc source code
1196         https://bugs.webkit.org/show_bug.cgi?id=168599
1197
1198         Reviewed by Alex Christensen.
1199
1200         * Modules/mediastream/RTCStatsReport.h:
1201         * Modules/mediastream/RTCStatsReport.idl:
1202         Update to match the latest spec, which matches the new structures in libwebrtc.
1203         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1204         (WebCore::fillRTCRTPStreamStats):
1205         (WebCore::fillOutboundRTPStreamStats):
1206         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
1207         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
1208         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
1209         (WebCore::RealtimeIncomingAudioSource::OnData):
1210         Comment out an assertion that was failing.  We should revisit this.
1211         * testing/MockLibWebRTCPeerConnection.h:
1212
1213 2017-03-03  Commit Queue  <commit-queue@webkit.org>
1214
1215         Unreviewed, rolling out r213400.
1216         https://bugs.webkit.org/show_bug.cgi?id=169163
1217
1218         Caused frequent assertion failures (Requested by ap on
1219         #webkit).
1220
1221         Reverted changeset:
1222
1223         "[Modern Media Controls] Improve media documents across macOS,
1224         iPhone and iPad"
1225         https://bugs.webkit.org/show_bug.cgi?id=169145
1226         http://trac.webkit.org/changeset/213400
1227
1228 2017-03-03  Andy Estes  <aestes@apple.com>
1229
1230         Add support for canvas.toBlob
1231         https://bugs.webkit.org/show_bug.cgi?id=148878
1232
1233         Reviewed by Tim Horton.
1234
1235         Address additional review feedback received after r213412 landed.
1236
1237         * html/HTMLCanvasElement.cpp:
1238         (WebCore::HTMLCanvasElement::toBlob): Passed null to the blob callback if blob conversion
1239         fails for any reason.
1240         * platform/graphics/cg/ImageBufferCG.cpp:
1241         (WebCore::cgImage): Removed an unnecessary local variable.
1242
1243 2017-03-03  Andy Estes  <aestes@apple.com>
1244
1245         Add support for canvas.toBlob
1246         https://bugs.webkit.org/show_bug.cgi?id=148878
1247         <rdar://problem/22590406>
1248
1249         Reviewed by Tim Horton.
1250
1251         These tests now pass:
1252         imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob.jpeg.html
1253         imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob.png.html
1254
1255         * CMakeLists.txt:
1256         * DerivedSources.make:
1257         * WebCore.xcodeproj/project.pbxproj:
1258         * fileapi/BlobCallback.cpp: Added.
1259         (WebCore::BlobCallback::scheduleCallback):
1260         * fileapi/BlobCallback.h: Added.
1261         (WebCore::BlobCallback::~BlobCallback):
1262         * fileapi/BlobCallback.idl: Added.
1263         * html/HTMLCanvasElement.cpp:
1264         (WebCore::HTMLCanvasElement::toBlob):
1265         * html/HTMLCanvasElement.h:
1266         * html/HTMLCanvasElement.idl:
1267         * platform/graphics/ImageBuffer.h:
1268         * platform/graphics/cairo/ImageBufferCairo.cpp:
1269         (WebCore::writeFunction):
1270         (WebCore::encodeImage):
1271         (WebCore::ImageBuffer::toDataURL):
1272         (WebCore::ImageBuffer::toData):
1273         * platform/graphics/cg/ImageBufferCG.cpp:
1274         (WebCore::data):
1275         (WebCore::ImageBuffer::toDataURL):
1276         (WebCore::ImageBuffer::toData):
1277         (WebCore::ImageBuffer::toCGImage):
1278         (WebCore::cgImage):
1279         (WebCore::dataURL):
1280         * platform/graphics/gtk/ImageBufferGtk.cpp:
1281         (WebCore::ImageBuffer::toDataURL):
1282         (WebCore::ImageBuffer::toData):
1283         * platform/graphics/win/ImageBufferDirect2D.cpp:
1284         (WebCore::ImageBuffer::toData):
1285
1286 2017-03-03  Dean Jackson  <dino@apple.com>
1287
1288         Add WebGPU compile flag and experimental feature flag
1289         https://bugs.webkit.org/show_bug.cgi?id=169161
1290         <rdar://problem/30846689>
1291
1292         Reviewed by Tim Horton.
1293
1294         Add ENABLE_WEBGPU, an experimental feature flag, a RuntimeEnabledFeature,
1295         and an InternalSetting.
1296
1297         * Configurations/FeatureDefines.xcconfig:
1298         * page/RuntimeEnabledFeatures.h:
1299         (WebCore::RuntimeEnabledFeatures::setWebGPUEnabled):
1300         (WebCore::RuntimeEnabledFeatures::webGPUEnabled):
1301         * testing/InternalSettings.cpp:
1302         (WebCore::InternalSettings::Backup::Backup):
1303         (WebCore::InternalSettings::Backup::restoreTo):
1304         (WebCore::InternalSettings::setWebGPUEnabled):
1305         * testing/InternalSettings.h:
1306         * testing/InternalSettings.idl:
1307
1308 2017-03-03  Simon Fraser  <simon.fraser@apple.com>
1309
1310         Clean up some RenderLayerBacking code
1311         https://bugs.webkit.org/show_bug.cgi?id=169160
1312
1313         Reviewed by Dean Jackson.
1314
1315         Modern loops in descendantLayerPaintsIntoAncestor().
1316
1317         Rename RenderLayerBacking::paintsChildren() to RenderLayerBacking::paintsChildRenderers() to clarify that
1318         it refers to renderers, not RenderLayers.
1319
1320         Rename RenderLayerBacking::paintsNonDirectCompositedBoxDecoration() to RenderLayerBacking::paintsBoxDecorations().
1321         "Paints" already implies non-composited.
1322
1323         No behavior change.
1324
1325         * rendering/RenderLayerBacking.cpp:
1326         (WebCore::RenderLayerBacking::updateDrawsContent):
1327         (WebCore::RenderLayerBacking::paintsBoxDecorations):
1328         (WebCore::RenderLayerBacking::paintsChildRenderers):
1329         (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
1330         (WebCore::descendantLayerPaintsIntoAncestor):
1331         (WebCore::RenderLayerBacking::paintsNonDirectCompositedBoxDecoration): Deleted.
1332         (WebCore::RenderLayerBacking::paintsChildren): Deleted.
1333         * rendering/RenderLayerBacking.h:
1334
1335 2017-03-03  Simon Fraser  <simon.fraser@apple.com>
1336
1337         Clean up RenderImage and a RenderImageResource function
1338         https://bugs.webkit.org/show_bug.cgi?id=169153
1339
1340         Reviewed by Zalan Bujtas.
1341         
1342         Change all calls to imageResource().cachedImage() in RenderImage to use the inline
1343         cachedImage() function.
1344
1345         In RenderImage::paintReplaced(), early return after the broken image block (and no need
1346         to test imageResource().hasImage() again in the second condition). Convert height/width to size,
1347         which also forces us to be explicit about using flooredIntSize() when fetching the image
1348         (perhaps this should be a roundedIntSize, but I didn't want to change behavior).
1349
1350         Change RenderImageResource::image() to take an IntSize, rather than int height and width.
1351
1352         No behavior change.
1353
1354         * rendering/RenderImage.cpp:
1355         (WebCore::RenderImage::styleDidChange):
1356         (WebCore::RenderImage::imageChanged):
1357         (WebCore::RenderImage::notifyFinished):
1358         (WebCore::RenderImage::paintReplaced):
1359         (WebCore::RenderImage::paintIntoRect):
1360         (WebCore::RenderImage::foregroundIsKnownToBeOpaqueInRect):
1361         (WebCore::RenderImage::embeddedContentBox):
1362         * rendering/RenderImageResource.cpp:
1363         (WebCore::RenderImageResource::image):
1364         * rendering/RenderImageResource.h:
1365         (WebCore::RenderImageResource::image):
1366         * rendering/RenderImageResourceStyleImage.cpp:
1367         (WebCore::RenderImageResourceStyleImage::image):
1368         * rendering/RenderImageResourceStyleImage.h:
1369
1370 2017-03-03  Antoine Quint  <graouts@apple.com>
1371
1372         [Modern Media Controls] Improve media documents across macOS, iPhone and iPad
1373         https://bugs.webkit.org/show_bug.cgi?id=169145
1374         <rdar://problem/17048858>
1375
1376         Reviewed by Dean Jackson.
1377
1378         There were a variety of issues with media documents, some longstanding, and some specifically
1379         about modern media controls.
1380
1381         One issue was that fullscreen and picture-in-picture buttons would show for audio media documents,
1382         due to using a <video> element to load the audio file. We now have additional logic in MediaController
1383         to identify if the loaded media is really an audio file, and using this information to hide the
1384         fullscreen and picture-in-picture buttons.
1385
1386         Another issue was that we would inject style in MediaDocument.cpp that was specific to modern media
1387         controls when we could have the modern-media-controls module injected CSS handle this styling. We now
1388         use the injected style in the shadow root to size media documents based on the device characteristics
1389         and ensuring that page styles are overridden.
1390
1391         We also simplify how MediaDocument.cpp sets the source of the media element to simply use the "src"
1392         attribute and not a <source> element.
1393
1394         Finally, we introduce a MediaDocumentController class that is instantiated when we're dealing with
1395         a media document to hide the controls while we determine the type of media we're loading (audio vs.
1396         video) in order to apply the appropriate styling without flashes.
1397
1398         As a result of the new styles applied by the modern-media-controls module, media documents have a
1399         similar behavior on macOS and iPad, where we only enforce a min-width for video allowing them
1400         to play at their natural size otherwise, and enforcing a fixed width for audio. On iPhone however,
1401         we want to always play the media at full width, with some padding in the case of audio.
1402
1403         Tests: media/modern-media-controls/fullscreen-support/fullscreen-support-disabled-video-with-audio-tracks-only.html
1404                media/modern-media-controls/media-documents/ipad/media-document-audio-ios-sizing.html
1405                media/modern-media-controls/media-documents/ipad/media-document-video-ios-sizing.html
1406                media/modern-media-controls/media-documents/media-document-audio-ios-sizing.html
1407                media/modern-media-controls/media-documents/media-document-audio-mac-sizing.html
1408                media/modern-media-controls/media-documents/media-document-video-ios-sizing.html
1409                media/modern-media-controls/media-documents/media-document-video-mac-sizing.html
1410                media/modern-media-controls/pip-support/pip-support-disabled-video-with-audio-tracks-only.html
1411
1412         * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
1413         (:host(audio) .media-controls.ios.inline > .controls-bar:before,):
1414         (:host(audio) .media-controls.ios.inline > .controls-bar:before): Deleted.
1415         * Modules/modern-media-controls/controls/macos-media-controls.css:
1416         (:host(audio) .media-controls.mac.inline > .controls-bar,):
1417         (:host(audio) .media-controls.mac.inline > .controls-bar > .background-tint,):
1418         (:host(audio) .media-controls.mac.inline > .controls-bar): Deleted.
1419         (:host(audio) .media-controls.mac.inline > .controls-bar > .background-tint): Deleted.
1420         * Modules/modern-media-controls/controls/media-document.css: Added.
1421         (:host(.media-document)):
1422         (:host(.media-document.ready)):
1423         (:host(.media-document.audio.mac)):
1424         (:host(.media-document.audio.ipad)):
1425         (:host(.media-document.audio.iphone)):
1426         (:host(.media-document.video.mac)):
1427         (:host(.media-document.video.ipad)):
1428         (:host(.media-document.video.iphone)):
1429         * Modules/modern-media-controls/js-files:
1430         * Modules/modern-media-controls/media/fullscreen-support.js:
1431         (FullscreenSupport.prototype.syncControl):
1432         (FullscreenSupport):
1433         * Modules/modern-media-controls/media/media-controller.js:
1434         (MediaController):
1435         (MediaController.prototype.get isAudio):
1436         * Modules/modern-media-controls/media/media-document-controller.js: Added.
1437         (MediaDocumentController):
1438         (MediaDocumentController.prototype.handleEvent):
1439         (MediaDocumentController.prototype._mediaDocumentHasMetadata):
1440         (MediaDocumentController.prototype._mediaDocumentHasSize):
1441         * Modules/modern-media-controls/media/pip-support.js:
1442         (PiPSupport.prototype.syncControl):
1443         (PiPSupport):
1444         * html/MediaDocument.cpp:
1445         (WebCore::MediaDocumentParser::createDocumentStructure):
1446
1447 2017-03-03  Chris Dumez  <cdumez@apple.com>
1448
1449         [iOS] Throttle SVG SMIL animations to 30fps in low power mode
1450         https://bugs.webkit.org/show_bug.cgi?id=169137
1451         <rdar://problem/30833754>
1452
1453         Reviewed by Simon Fraser.
1454
1455         Throttle SVG SMIL animations to 30fps in low power mode on iOS to save
1456         battery.
1457
1458         Test: svg/animations/animations-lowPowerMode-throttling.html
1459
1460         * svg/SVGSVGElement.cpp:
1461         (WebCore::SVGSVGElement::SVGSVGElement):
1462         * svg/SVGSVGElement.idl:
1463         * svg/animation/SMILTime.h:
1464         (WebCore::SMILTime::SMILTime):
1465         * svg/animation/SMILTimeContainer.cpp:
1466         (WebCore::SMILTimeContainer::SMILTimeContainer):
1467         (WebCore::SMILTimeContainer::animationFrameDelay):
1468         (WebCore::SMILTimeContainer::updateDocumentOrderIndexes):
1469         (WebCore::SMILTimeContainer::updateAnimations):
1470         * svg/animation/SMILTimeContainer.h:
1471         * svg/animation/SVGSMILElement.cpp:
1472         (WebCore::SVGSMILElement::calculateNextProgressTime):
1473         * testing/Internals.cpp:
1474         (WebCore::Internals::svgAnimationsInterval):
1475         * testing/Internals.h:
1476         * testing/Internals.idl:
1477
1478 2017-03-03  Joseph Pecoraro  <pecoraro@apple.com>
1479
1480         [Mac] WebCore.framework is missing a symlink from Frameworks to Versions/Current/Frameworks when the latter exists
1481         https://bugs.webkit.org/show_bug.cgi?id=169067
1482
1483         Reviewed by Dan Bernstein.
1484
1485         * WebCore.xcodeproj/project.pbxproj:
1486
1487 2017-03-03  Sam Weinig  <sam@webkit.org>
1488
1489         REGRESSION (r209760): Apple Pay doesn't work on casper.com, shopspring.com, maybe other sites
1490         <rdar://problem/30313445>
1491         https://bugs.webkit.org/show_bug.cgi?id=169149
1492
1493         Reviewed by Simon Fraser.
1494
1495         Relax restriction that the ApplePayShippingMethod sequence must not be empty. This
1496         was incorrect.
1497
1498         * Modules/applepay/ApplePaySession.cpp:
1499         (WebCore::convertAndValidate):
1500
1501 2017-03-03  Alex Christensen  <achristensen@webkit.org>
1502
1503         [URLParser] Fix file: as a relative file URL
1504         https://bugs.webkit.org/show_bug.cgi?id=169122
1505
1506         Reviewed by Tim Horton.
1507
1508         This is clearly defined in https://url.spec.whatwg.org/#file-state with the EOF code point.
1509         I got it wrong and didn't test it.  It's been added to the web platform tests since we last updated.
1510
1511         * platform/URLParser.cpp:
1512         (WebCore::URLParser::parse):
1513
1514 2017-03-03  Dave Hyatt  <hyatt@apple.com>
1515
1516         Enable fieldsets to be flexboxes, grids and multicolumn.
1517         https://bugs.webkit.org/show_bug.cgi?id=169082
1518
1519         Reviewed by Simon Fraser.
1520
1521         Added new tests in fast/forms/fieldset.
1522
1523         This patch eliminates RenderFieldset and moves the functionality into RenderBlock so that
1524         derived classes can also be fieldsets.
1525
1526         * CMakeLists.txt:
1527         * WebCore.xcodeproj/project.pbxproj:
1528         Remove RenderFieldset from the project.
1529
1530         * accessibility/AccessibilityRenderObject.cpp:
1531         (WebCore::AccessibilityRenderObject::titleUIElement):
1532         Call in to RenderBlock now instead of RenderFieldset.
1533
1534         * html/HTMLFieldSetElement.cpp:
1535         (WebCore::HTMLFieldSetElement::createElementRenderer):
1536         * html/HTMLFieldSetElement.h:
1537         The fieldset DOM element now uses RenderElement::createFor to make renderers so that multiple display types
1538         can be supported. A special flag has been added that indicates only to make flexbox and block-related
1539         renderers (not table display types).
1540
1541         * rendering/OrderIterator.cpp:
1542         (WebCore::OrderIterator::shouldSkipChild):
1543         (WebCore::OrderIteratorPopulator::collectChild):
1544         * rendering/OrderIterator.h:
1545         Streamline child collection for flexboxes and grids to indicate whether the child should be skipped as a return
1546         value from collectChild. Add a shouldSkipChild method that skips both out of flow positioned objects and
1547         excluded children like the legends of fieldsets.
1548
1549         * rendering/RenderBlock.cpp:
1550         (WebCore::RenderBlockRareData::RenderBlockRareData):
1551         When the legend is taller than the fieldset's borderBefore(), intrinsic border is added to the CSS border width.
1552         This intrinsic border being factored in ensures that the padding and content boxes of fieldsets are correct
1553         across any layout system, since the legend is now just treated as part of the border.
1554
1555         (WebCore::RenderBlock::computeBlockPreferredLogicalWidths):
1556         Call the new computePreferredWidthsForExcludedChildren to ensure that excluded children contribute to
1557         preferred width in their own way and not as part of a specific layout system.
1558
1559         (WebCore::RenderBlock::renderName):
1560         Hacked to still return RenderFieldSet for RenderBlockFlow-backed fieldsets for layout test compatibility.
1561
1562         (WebCore::RenderBlock::layoutExcludedChildren):
1563         Renamed from layoutSpecialExcludedChild to more accurately reflect the fact that multiple excluded children
1564         can be included here (e.g., both a multicolumn flow thread and a legend). The RenderBlock base class handles
1565         the layout of legends by both placing them and setting the correct intrinsic border before amount on the
1566         block.
1567
1568         (WebCore::RenderBlock::findFieldsetLegend):
1569         Moved from RenderFieldset.
1570
1571         (WebCore::RenderBlock::adjustBorderBoxRectForPainting):
1572         (WebCore::RenderBlock::paintRectToClipOutFromBorder):
1573         These methods are used when painting to shrink the border box as needed to account for the legend and to
1574         provide the portion of the border that needs to be clipped out. These methods have been enhanced to
1575         properly support all writing modes.
1576
1577         (WebCore::RenderBlock::intrinsicBorderForFieldset):
1578         (WebCore::RenderBlock::setIntrinsicBorderForFieldset):
1579         (WebCore::RenderBlock::borderTop):
1580         (WebCore::RenderBlock::borderLeft):
1581         (WebCore::RenderBlock::borderBottom):
1582         (WebCore::RenderBlock::borderRight):
1583         (WebCore::RenderBlock::borderBefore):
1584         These methods are overridden for border to ensure that the intrinsic border added by a tall legend is
1585         properly factored in.
1586
1587         (WebCore::RenderBlock::computePreferredWidthsForExcludedChildren):
1588         * rendering/RenderBlock.h:
1589         This method computes the preferred widths for legend children in order to ensure that the legend properly
1590         grows the width of the fieldset when it is the widest item.
1591
1592         (WebCore::RenderBlock::adjustBorderBoxLogicalHeightForBoxSizing):
1593         (WebCore::RenderBlock::adjustContentBoxLogicalHeightForBoxSizing):
1594         Preserve the behavior of fieldsets in that the available content size includes the space lost accounting
1595         for the legend. I don't think this makes much sense, but it matches the behavior of other browsers
1596         (and our old behavior).
1597
1598         (WebCore::RenderBlock::paintExcludedChildrenInBorder):
1599         Method for painting the excluded children that might be present in our border. We only do this if the
1600         paint phase is a box decoration painting phase and if the legend isn't self-painting.
1601
1602         * rendering/RenderBlockFlow.cpp:
1603         (WebCore::RenderBlockFlow::willCreateColumns):
1604         Allow fieldsets to create columns now.
1605
1606         (WebCore::RenderBlockFlow::layoutBlockChildren):
1607         (WebCore::RenderBlockFlow::layoutExcludedChildren):
1608         Renamed this method and change it to call the base class to ensure that legends in multicolumn fieldsets
1609         get handled properly.
1610
1611         (WebCore::RenderBlockFlow::addChild):
1612         Patched to make sure legends don't get put into the multicolumn flow thread, as they need to
1613         remain outside of it.
1614
1615         (WebCore::RenderBlockFlow::layoutSpecialExcludedChild): Deleted.
1616         Renamed to layoutExcludedChildren.
1617
1618         * rendering/RenderBlockFlow.h:
1619         * rendering/RenderBox.cpp:
1620         (WebCore::RenderBox::paintBoxDecorations):
1621         (WebCore::RenderBox::paintMask):
1622         Patched to call the new adjustBorderBoxRectForPainting and paintRectToClipOutFromBorder methods in
1623         order to properly shrink the border box rect for painting and to clip out the portion of the border
1624         covered by the legend.
1625
1626         (WebCore::RenderBox::avoidsFloats):
1627         Add fieldsets as avoiding floats. RenderFieldset used to subclass this method to return true, but with
1628         its removal, we need to put this in the base class along with legends.
1629
1630         * rendering/RenderBox.h:
1631         (WebCore::RenderBox::isGridItem):
1632         (WebCore::RenderBox::isFlexItem):
1633         Patched to exclude legends so that they don't try to size like they are really in the grid or flexbox.
1634
1635         (WebCore::RenderBox::adjustBorderBoxRectForPainting):
1636         This method is overridden by RenderBLock to handle adjusting fieldset border rects for painting.
1637
1638         * rendering/RenderBoxModelObject.cpp:
1639         (WebCore::RenderBoxModelObject::paintBorder):
1640         * rendering/RenderBoxModelObject.h:
1641         (WebCore::RenderBoxModelObject::paintRectToClipOutFromBorder):
1642         Patched to properly paint fieldsets using the new helpers.
1643
1644         * rendering/RenderDeprecatedFlexibleBox.cpp:
1645         (WebCore::FlexBoxIterator::next):
1646         (WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
1647         (WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox):
1648         Make sure deprecated flexible boxes lay out their legends properly by calling layoutExcludedChildren.
1649
1650         * rendering/RenderElement.cpp:
1651         (WebCore::RenderElement::createFor):
1652         * rendering/RenderElement.h:
1653         Patched to take a flag that limits what renderers can be created so that fieldsets don't make table
1654         display types.
1655
1656         * rendering/RenderFieldset.cpp: Removed.
1657         * rendering/RenderFieldset.h: Removed.
1658         Remove RenderFieldset files from the tree.
1659
1660         * rendering/RenderFlexibleBox.cpp:
1661         (WebCore::RenderFlexibleBox::computeIntrinsicLogicalWidths):
1662         (WebCore::RenderFlexibleBox::firstLineBaseline):
1663         (WebCore::RenderFlexibleBox::layoutBlock):
1664         (WebCore::RenderFlexibleBox::layoutFlexItems):
1665         (WebCore::RenderFlexibleBox::prepareOrderIteratorAndMargins):
1666         Make sure flexible boxes lay out their legends properly by calling layoutExcludedChildren.
1667         Patch methods to use the OrderIterator's new shouldSkipChild method to ensure legends aren't
1668         part of the flexible box layout.
1669
1670         * rendering/RenderGrid.cpp:
1671         (WebCore::RenderGrid::layoutBlock):
1672         (WebCore::RenderGrid::computeIntrinsicLogicalWidths):
1673         (WebCore::RenderGrid::placeItemsOnGrid):
1674         (WebCore::RenderGrid::populateExplicitGridAndOrderIterator):
1675         (WebCore::RenderGrid::layoutGridItems):
1676         Make sure grids lay out their legends properly by calling layoutExcludedChildren.
1677         Patch methods to use the OrderIterator's new shouldSkipChild method to ensure legends aren't
1678         part of the grid's layout.
1679
1680         * rendering/RenderMultiColumnFlowThread.cpp:
1681         (WebCore::RenderMultiColumnFlowThread::populate):
1682         Pull legends back up into the block and don't let them be part of the flow thread.
1683
1684         * rendering/RenderMultiColumnSet.cpp:
1685         (WebCore::RenderMultiColumnSet::requiresBalancing):
1686         Fix an assert to allow legends to exist as siblings of multicolumn sets.
1687
1688         * rendering/RenderObject.cpp:
1689         (WebCore::RenderObject::isFieldset):
1690         Changed to examine the HTML element rather than RenderFieldset.
1691
1692         * rendering/RenderObject.h:
1693         (WebCore::RenderObject::isExcludedFromNormalLayout):
1694         (WebCore::RenderObject::setIsExcludedFromNormalLayout):
1695         (WebCore::RenderObject::RenderObjectBitfields::RenderObjectBitfields):
1696         RenderObjects now have a new bit that is set for excluded objects like legends, flow threads,
1697         placeholders, and ruby text. This bit lets code easily detect that an object is excluded from
1698         the layout system and can be skipped.
1699
1700         (WebCore::RenderObject::isExcludedAndPlacedInBorder):
1701         Helper method for asking if an object is painting inside the border. Used to know we
1702         need to factor it into preferred width calculations outside of any one layout system
1703         and also to know that we need to paint it when we paint the fieldset's border instead of
1704         later (after we might have scrolled or clipped the child painting area).
1705
1706         * rendering/RenderRubyRun.cpp:
1707         (WebCore::RenderRubyRun::layoutExcludedChildren):
1708         (WebCore::RenderRubyRun::layoutSpecialExcludedChild): Deleted.
1709         * rendering/RenderRubyRun.h:
1710         Rename layoutSpecialExcludedChild to layoutExcludedChildren.
1711
1712         * rendering/RenderTable.cpp:
1713         (WebCore::RenderTable::adjustBorderBoxRectForPainting):
1714         (WebCore::RenderTable::paintBoxDecorations):
1715         (WebCore::RenderTable::paintMask):
1716         (WebCore::RenderTable::subtractCaptionRect): Deleted.
1717         * rendering/RenderTable.h:
1718         Patched tables to share the same border box rect adjustment used by fieldsets when subtracting
1719         out captions. This is prep work to allow tables to be fieldsets, but for now I didn't go all the
1720         way.
1721
1722         * rendering/RenderTableCell.cpp:
1723         (WebCore::RenderTableCell::paintBoxDecorations):
1724         (WebCore::RenderTableCell::paintMask):
1725         Make sure table cells adjust their border box rects for painting. Again this is prep work for
1726         cells potentially being fieldsets, but not supported yet.
1727
1728         * rendering/RenderTextControl.cpp:
1729         (WebCore::RenderTextControl::layoutExcludedChildren):
1730         (WebCore::RenderTextControl::layoutSpecialExcludedChild): Deleted.
1731         * rendering/RenderTextControl.h:
1732         * rendering/RenderTextControlMultiLine.cpp:
1733         (WebCore::RenderTextControlMultiLine::layoutExcludedChildren):
1734         (WebCore::RenderTextControlMultiLine::layoutSpecialExcludedChild): Deleted.
1735         * rendering/RenderTextControlMultiLine.h:
1736         Renamed the methods for doing the excluded child layout.
1737
1738         * rendering/RenderTreeAsText.cpp:
1739         (WebCore::RenderTreeAsText::writeRenderObject):
1740         Make sure to dump the original fieldset border and not the border with the extra legend stuff in it.
1741
1742 2017-03-03  Ryan Haddad  <ryanhaddad@apple.com>
1743
1744         Unreviewed, rolling out r213344.
1745
1746         This changed caused LayoutTest crashes under GuardMalloc.
1747
1748         Reverted changeset:
1749
1750         "Add support for canvas.toBlob"
1751         https://bugs.webkit.org/show_bug.cgi?id=148878
1752         http://trac.webkit.org/changeset/213344
1753
1754 2017-03-03  Konstantin Tokarev  <annulen@yandex.ru>
1755
1756         Unreviewed typo fix
1757
1758         * features.json:
1759
1760 2017-03-03  Eric Carlson  <eric.carlson@apple.com>
1761
1762         [MediaStream] Remove #if USE(VIDEOTOOLBOX) from AVVideoCaptureSource
1763         https://bugs.webkit.org/show_bug.cgi?id=169131
1764
1765         Reviewed by Youenn Fablet.
1766
1767         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1768         (WebCore::AVVideoCaptureSource::currentFrameCGImage):
1769
1770 2017-03-03  Chris Dumez  <cdumez@apple.com>
1771
1772         Add assertion in Frame::setView() to make sure associated document has no living render tree
1773         https://bugs.webkit.org/show_bug.cgi?id=169134
1774
1775         Reviewed by Brent Fulgham.
1776
1777         Add assertion in Frame::setView() to make sure associated document has no living render tree.
1778         This is not supposed to happen and r213311 fixed one case where this could happen. We need
1779         to find out if it can still happen.
1780
1781         * page/Frame.cpp:
1782         (WebCore::Frame::setView):
1783
1784 2017-03-02  Sam Weinig  <sam@webkit.org>
1785
1786         Rename htmlediting.h/cpp to Editing.h/cpp
1787         https://bugs.webkit.org/show_bug.cgi?id=169103
1788
1789         Reviewed by Alex Christensen.
1790
1791         * CMakeLists.txt:
1792         * WebCore.xcodeproj/project.pbxproj:
1793         * accessibility/AXObjectCache.cpp:
1794         * accessibility/AccessibilityNodeObject.cpp:
1795         * accessibility/AccessibilityObject.cpp:
1796         * accessibility/AccessibilityRenderObject.cpp:
1797         * accessibility/atk/WebKitAccessibleHyperlink.cpp:
1798         * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
1799         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
1800         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
1801         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1802         * dom/Document.cpp:
1803         * dom/Element.cpp:
1804         * dom/Node.h:
1805         * dom/Position.cpp:
1806         * dom/PositionIterator.cpp:
1807         * dom/Range.cpp:
1808         * editing/AlternativeTextController.cpp:
1809         * editing/AppendNodeCommand.cpp:
1810         * editing/ApplyBlockElementCommand.cpp:
1811         * editing/ApplyStyleCommand.cpp:
1812         * editing/BreakBlockquoteCommand.cpp:
1813         * editing/CompositeEditCommand.cpp:
1814         * editing/CreateLinkCommand.cpp:
1815         (WebCore::CreateLinkCommand::CreateLinkCommand):
1816         * editing/DeleteFromTextNodeCommand.cpp:
1817         * editing/DeleteSelectionCommand.cpp:
1818         * editing/EditCommand.cpp:
1819         * editing/Editing.cpp: Copied from Source/WebCore/editing/htmlediting.cpp.
1820         * editing/Editing.h: Copied from Source/WebCore/editing/htmlediting.h.
1821         * editing/EditingAllInOne.cpp:
1822         * editing/EditingStyle.cpp:
1823         * editing/Editor.cpp:
1824         * editing/EditorCommand.cpp:
1825         * editing/FormatBlockCommand.cpp:
1826         * editing/FrameSelection.cpp:
1827         * editing/HTMLInterchange.cpp:
1828         * editing/IndentOutdentCommand.cpp:
1829         * editing/InsertLineBreakCommand.cpp:
1830         * editing/InsertListCommand.cpp:
1831         * editing/InsertNodeBeforeCommand.cpp:
1832         * editing/InsertParagraphSeparatorCommand.cpp:
1833         * editing/InsertTextCommand.cpp:
1834         * editing/ModifySelectionListLevel.cpp:
1835         * editing/RemoveNodeCommand.cpp:
1836         * editing/ReplaceNodeWithSpanCommand.cpp:
1837         * editing/ReplaceSelectionCommand.cpp:
1838         * editing/SpellChecker.cpp:
1839         * editing/TextIterator.cpp:
1840         * editing/TypingCommand.cpp:
1841         * editing/VisiblePosition.cpp:
1842         * editing/VisibleSelection.cpp:
1843         * editing/VisibleUnits.cpp:
1844         * editing/cocoa/DataDetection.mm:
1845         * editing/cocoa/EditorCocoa.mm:
1846         * editing/htmlediting.cpp: Removed.
1847         * editing/htmlediting.h: Removed.
1848         * editing/ios/EditorIOS.mm:
1849         * editing/mac/DictionaryLookup.mm:
1850         * editing/mac/EditorMac.mm:
1851         * editing/markup.cpp:
1852         * html/HTMLTextFormControlElement.cpp:
1853         * inspector/InspectorDOMAgent.cpp:
1854         * page/DOMSelection.cpp:
1855         * page/DragController.cpp:
1856         * page/EventHandler.cpp:
1857         * page/FocusController.cpp:
1858         * page/Frame.cpp:
1859         * platform/ios/PasteboardIOS.mm:
1860         * platform/mac/PasteboardMac.mm:
1861         * rendering/RenderBox.cpp:
1862         * rendering/RenderObject.cpp:
1863
1864 2017-03-02  Matt Baker  <mattbaker@apple.com>
1865
1866         Web Inspector: Should be able to push nodes in an iframe subtree to the frontend
1867         https://bugs.webkit.org/show_bug.cgi?id=169086
1868
1869         Reviewed by Joseph Pecoraro.
1870
1871         Test: inspector/dom/push-node-by-path-to-frontend.html
1872
1873         * inspector/InspectorDOMAgent.cpp:
1874         (WebCore::InspectorDOMAgent::nodeForPath):
1875         During top-down document traversal, descend into content document nodes
1876         when visiting an HTMLFrameOwnerElement.
1877
1878 2017-03-02  Ryan Haddad  <ryanhaddad@apple.com>
1879
1880         Unreviewed, rolling out r213274.
1881
1882         This change caused flakiness with LayoutTest memory/memory-
1883         pressure-simulation.html
1884
1885         Reverted changeset:
1886
1887         "Don't keep dead resources in MemoryCache while under memory
1888         pressure."
1889         https://bugs.webkit.org/show_bug.cgi?id=169070
1890         http://trac.webkit.org/changeset/213274
1891
1892 2017-03-02  Jiewen Tan  <jiewen_tan@apple.com>
1893
1894         WebCrypto API support for AES-GCM
1895         https://bugs.webkit.org/show_bug.cgi?id=157175
1896         <rdar://problem/27311691>
1897
1898         Reviewed by Brent Fulgham.
1899
1900         This patch adds support for AES-GCM. Operations of AES-GCM include: encrypt, decrypt, generateKey,
1901         importKey, exportKey, wrapKey, and unwrapKey. https://www.w3.org/TR/WebCryptoAPI/#aes-gcm
1902
1903         Tests: crypto/subtle/aes-gcm-decrypt-malformed-parameters.html
1904                crypto/subtle/aes-gcm-encrypt-malformed-parameters.html
1905                crypto/subtle/aes-gcm-generate-export-key-jwk-length-128.html
1906                crypto/subtle/aes-gcm-generate-export-key-jwk-length-192.html
1907                crypto/subtle/aes-gcm-generate-export-key-jwk-length-256.html
1908                crypto/subtle/aes-gcm-generate-export-raw-key.html
1909                crypto/subtle/aes-gcm-generate-key-encrypt-decrypt.html
1910                crypto/subtle/aes-gcm-generate-key.html
1911                crypto/subtle/aes-gcm-import-jwk-key-length-128.html
1912                crypto/subtle/aes-gcm-import-jwk-key-length-192.html
1913                crypto/subtle/aes-gcm-import-jwk-key-length-256.html
1914                crypto/subtle/aes-gcm-import-key-decrypt-additional-data-tag-length-32.html
1915                crypto/subtle/aes-gcm-import-key-decrypt-additional-data.html
1916                crypto/subtle/aes-gcm-import-key-decrypt-tagLengths.html
1917                crypto/subtle/aes-gcm-import-key-decrypt.html
1918                crypto/subtle/aes-gcm-import-key-encrypt-additional-data-tag-length-32.html
1919                crypto/subtle/aes-gcm-import-key-encrypt-additional-data.html
1920                crypto/subtle/aes-gcm-import-key-encrypt-tagLengths.html
1921                crypto/subtle/aes-gcm-import-key-encrypt.html
1922                crypto/subtle/aes-gcm-import-key-unwrap-jwk-key.html
1923                crypto/subtle/aes-gcm-import-key-unwrap-raw-key.html
1924                crypto/subtle/aes-gcm-import-key-wrap-jwk-key.html
1925                crypto/subtle/aes-gcm-import-key-wrap-raw-key.html
1926                crypto/subtle/aes-gcm-import-raw-key.html
1927                crypto/workers/subtle/aes-gcm-import-key-decrypt.html
1928                crypto/workers/subtle/aes-gcm-import-key-encrypt.html
1929                crypto/workers/subtle/aes-gcm-import-key-unwrap-key.html
1930                crypto/workers/subtle/aes-gcm-import-key-wrap-key.html
1931
1932         * CMakeLists.txt:
1933         * DerivedSources.make:
1934         * PlatformGTK.cmake:
1935         * PlatformMac.cmake:
1936         Add CryptoAlgorithmAES_CFBMac.cpp as well.
1937         * WebCore.xcodeproj/project.pbxproj:
1938         * bindings/js/JSSubtleCryptoCustom.cpp:
1939         (WebCore::normalizeCryptoAlgorithmParameters):
1940         Add support for AES-GCM.
1941         * crypto/CommonCryptoUtilities.h:
1942         Include SPI header for AES-GCM support. We have a mismatch SPI between different OS version.
1943         Therefore, a guardian is placed.
1944         * crypto/CryptoAlgorithmParameters.h:
1945         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp: Added.
1946         (WebCore::usagesAreInvalidForCryptoAlgorithmAES_GCM):
1947         (WebCore::tagLengthIsValid):
1948         (WebCore::CryptoAlgorithmAES_GCM::create):
1949         (WebCore::CryptoAlgorithmAES_GCM::identifier):
1950         (WebCore::CryptoAlgorithmAES_GCM::encrypt):
1951         (WebCore::CryptoAlgorithmAES_GCM::decrypt):
1952         (WebCore::CryptoAlgorithmAES_GCM::generateKey):
1953         (WebCore::CryptoAlgorithmAES_GCM::importKey):
1954         (WebCore::CryptoAlgorithmAES_GCM::exportKey):
1955         * crypto/algorithms/CryptoAlgorithmAES_GCM.h: Added.
1956         * crypto/gnutls/CryptoAlgorithmAES_GCMGnuTLS.cpp: Added.
1957         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
1958         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
1959         * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp: Added.
1960         (WebCore::encryptAES_GCM):
1961         (WebCore::decyptAES_GCM):
1962         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
1963         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
1964         * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
1965         (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
1966         * crypto/parameters/AesGcmParams.idl: Added.
1967         * crypto/parameters/CryptoAlgorithmAesGcmParams.h: Added.
1968
1969 2017-03-02  Andy Estes  <aestes@apple.com>
1970
1971         Add support for canvas.toBlob
1972         https://bugs.webkit.org/show_bug.cgi?id=148878
1973         <rdar://problem/22590406>
1974
1975         Reviewed by Tim Horton.
1976
1977         These tests now pass:
1978         imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob.jpeg.html
1979         imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob.png.html
1980
1981         * CMakeLists.txt:
1982         * DerivedSources.make:
1983         * WebCore.xcodeproj/project.pbxproj:
1984         * fileapi/BlobCallback.cpp: Added.
1985         (WebCore::BlobCallback::scheduleCallback):
1986         * fileapi/BlobCallback.h: Added.
1987         (WebCore::BlobCallback::~BlobCallback):
1988         * fileapi/BlobCallback.idl: Added.
1989         * html/HTMLCanvasElement.cpp:
1990         (WebCore::HTMLCanvasElement::toBlob):
1991         * html/HTMLCanvasElement.h:
1992         * html/HTMLCanvasElement.idl:
1993         * platform/graphics/ImageBuffer.h:
1994         * platform/graphics/cairo/ImageBufferCairo.cpp:
1995         (WebCore::writeFunction):
1996         (WebCore::encodeImage):
1997         (WebCore::ImageBuffer::toDataURL):
1998         (WebCore::ImageBuffer::toData):
1999         * platform/graphics/cg/ImageBufferCG.cpp:
2000         (WebCore::data):
2001         (WebCore::ImageBuffer::toDataURL):
2002         (WebCore::ImageBuffer::toData):
2003         (WebCore::ImageBuffer::toCGImage):
2004         (WebCore::cgImage):
2005         (WebCore::dataURL):
2006         * platform/graphics/gtk/ImageBufferGtk.cpp:
2007         (WebCore::ImageBuffer::toDataURL):
2008         (WebCore::ImageBuffer::toData):
2009         * platform/graphics/win/ImageBufferDirect2D.cpp:
2010         (WebCore::ImageBuffer::toData):
2011
2012 2017-03-02  Myles C. Maxfield  <mmaxfield@apple.com>
2013
2014         Migrate font-stretch to use fixed-point values
2015         https://bugs.webkit.org/show_bug.cgi?id=169107
2016
2017         Reviewed by Dean Jackson.
2018
2019         There are a few benefits of using fixed-point values:
2020         - Not all of the entropy of a float is necessary for font selection. In particular, values are
2021         expected to stay between around -1000 to 1000, and only need to have a few fractional bits.
2022         Therefore, the values can be represented by 16-bit fixed point numbers, which includes one sign
2023         bit and two fractional bits. This is smaller than the 32-bit floating point numbers we were
2024         using, which means FontDescription can be slimmed down. This becomes even more important when
2025         the rest of the variation font properties are implemented, since those will use these fixed-
2026         point values too.
2027         - Fixed point values have a larger distance between adjacent representable values, which means
2028         there are more collisions, which means our cache hit rates are higher.
2029
2030         No new tests because there is no behavior change.
2031
2032         * css/CSSComputedStyleDeclaration.cpp:
2033         (WebCore::fontStretchFromStyle):
2034         * css/StyleBuilderConverter.h:
2035         (WebCore::StyleBuilderConverter::convertFontStretch):
2036         * platform/graphics/FontCache.h:
2037         (WebCore::FontDescriptionKey::FontDescriptionKey):
2038         * platform/graphics/FontDescription.h:
2039         (WebCore::FontDescription::stretch):
2040         (WebCore::FontDescription::setStretch):
2041         (WebCore::FontCascadeDescription::initialStretch):
2042         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2043         (WebCore::defaultFontSelectionValues):
2044         (WebCore::preparePlatformFont):
2045         (WebCore::FontDatabase::InstalledFont::InstalledFont):
2046         (WebCore::FontDatabase::InstalledFontFamily::expand):
2047         (WebCore::FontDatabase::capabilitiesForFontDescriptor):
2048         (WebCore::FontDatabase::stretchThreshold):
2049         (WebCore::FontDatabase::italicThreshold):
2050         (WebCore::FontDatabase::weightThreshold):
2051         (WebCore::findClosestStretch):
2052         (WebCore::filterStretch):
2053         (WebCore::findClosestStyle):
2054         (WebCore::filterStyle):
2055         (WebCore::findClosestWeight):
2056         (WebCore::filterWeight):
2057         (WebCore::computeTargetWeight):
2058         (WebCore::findClosestFont):
2059         (WebCore::platformFontLookupWithFamily):
2060         (WebCore::fontWithFamily):
2061         (WebCore::defaultVariationValues): Deleted.
2062         (WebCore::FontDatabase::Range::Range): Deleted.
2063         (WebCore::FontDatabase::Range::isValid): Deleted.
2064         (WebCore::FontDatabase::Range::expand): Deleted.
2065         (WebCore::FontDatabase::Range::includes): Deleted.
2066         (): Deleted.
2067         * platform/text/TextFlags.h:
2068         (WebCore::FontSelectionValue::FontSelectionValue):
2069         (WebCore::FontSelectionValue::operator float):
2070         (WebCore::FontSelectionValue::operator+):
2071         (WebCore::FontSelectionValue::operator-):
2072         (WebCore::FontSelectionValue::operator*):
2073         (WebCore::FontSelectionValue::operator/):
2074         (WebCore::FontSelectionValue::operator==):
2075         (WebCore::FontSelectionValue::operator!=):
2076         (WebCore::FontSelectionValue::operator<):
2077         (WebCore::FontSelectionValue::operator<=):
2078         (WebCore::FontSelectionValue::operator>):
2079         (WebCore::FontSelectionValue::operator>=):
2080         (WebCore::FontSelectionValue::rawValue):
2081         (WebCore::FontSelectionRange::isValid):
2082         (WebCore::FontSelectionRange::expand):
2083         (WebCore::FontSelectionRange::includes):
2084         (WebCore::FontSelectionCapabilities::expand):
2085
2086 2017-03-02  Alex Christensen  <achristensen@webkit.org>
2087
2088         Modernize ContentExtensionParser
2089         https://bugs.webkit.org/show_bug.cgi?id=169106
2090
2091         Reviewed by Andy Estes.
2092
2093         We were returning std::error_code and passing the return value as a parameter reference.
2094         because we wrote this code before we had WTF::Expected.
2095
2096         No change in behavior, verified by many API tests.
2097
2098         * contentextensions/ContentExtensionCompiler.cpp:
2099         (WebCore::ContentExtensions::compileRuleList):
2100         * contentextensions/ContentExtensionParser.cpp:
2101         (WebCore::ContentExtensions::getDomainList):
2102         (WebCore::ContentExtensions::loadTrigger):
2103         (WebCore::ContentExtensions::loadAction):
2104         (WebCore::ContentExtensions::loadRule):
2105         (WebCore::ContentExtensions::loadEncodedRules):
2106         (WebCore::ContentExtensions::parseRuleList):
2107         * contentextensions/ContentExtensionParser.h:
2108         * contentextensions/ContentExtensionRule.cpp:
2109         (WebCore::ContentExtensions::ContentExtensionRule::ContentExtensionRule):
2110         * contentextensions/ContentExtensionRule.h:
2111
2112 2017-03-02  Ryan Haddad  <ryanhaddad@apple.com>
2113
2114         Unreviewed, rolling out r213301.
2115
2116         This change broke internal builds.
2117
2118         Reverted changeset:
2119
2120         "WebCrypto API support for AES-GCM"
2121         https://bugs.webkit.org/show_bug.cgi?id=157175
2122         http://trac.webkit.org/changeset/213301
2123
2124 2017-03-02  Aakash Jain  <aakash_jain@apple.com>
2125
2126         Move stringMatchesWildcardString from WebKit2 to WebCore
2127         https://bugs.webkit.org/show_bug.cgi?id=169065
2128
2129         Reviewed by Alexey Proskuryakov.
2130
2131         * WebCore.xcodeproj/project.pbxproj: Added StringUtilities.h and StringUtilities.mm
2132         * PlatformMac.cmake: Added StringUtilities.mm
2133         * platform/mac/StringUtilities.h: Added.
2134         * platform/mac/StringUtilities.mm: Added.
2135         (WebCore::wildcardRegexPatternString): Added.
2136         (WebCore::stringMatchesWildcardString): Added.
2137
2138 2017-02-28  Matt Rajca  <mrajca@apple.com>
2139
2140         Media: send "did interfere with playback" events when the user pauses an autoplaying element
2141         https://bugs.webkit.org/show_bug.cgi?id=169006
2142
2143         Reviewed by Alex Christensen.
2144
2145         Added API tests.
2146
2147         * html/HTMLMediaElement.cpp:
2148         (WebCore::HTMLMediaElement::pauseInternal):
2149
2150 2017-03-02  Chris Dumez  <cdumez@apple.com>
2151
2152         We should prevent load of subframes inserted during FrameTree deconstruction
2153         https://bugs.webkit.org/show_bug.cgi?id=169095
2154
2155         Reviewed by Brent Fulgham.
2156
2157         When deconstructing the FrameTree, we fire the unload event in each subframe.
2158         Such unload event handler may insert a new frame, we would previously load
2159         such new frame which was unsafe as we would end up with an attached subframe
2160         on a detached tree. To address the issue, we prevent new subframes from loading
2161         while deconstructing the FrameTree and firing the unload events. This new
2162         behavior is consistent with Chrome and should therefore be safe from a
2163         compatibility standpoint.
2164
2165         Test: fast/frames/insert-frame-unload-handler.html
2166
2167         * dom/ContainerNodeAlgorithms.cpp:
2168         (WebCore::disconnectSubframes):
2169         Update SubframeLoadingDisabler call site now that the constructor takes in
2170         a pointer instead of a reference.
2171
2172         * html/HTMLFrameOwnerElement.h:
2173         (WebCore::SubframeLoadingDisabler::SubframeLoadingDisabler):
2174         (WebCore::SubframeLoadingDisabler::~SubframeLoadingDisabler):
2175         Update SubframeLoadingDisabler constructor to take in a pointer instead
2176         of a reference, for convenience.
2177
2178         * loader/FrameLoader.cpp:
2179         (WebCore::FrameLoader::detachChildren):
2180         Prevent loads in subframes while detaching the subframes. It would be unsafe
2181         as we copy the list of frames before iterating to fire the unload events.
2182         Therefore, newly inserted frames would not get unloaded.
2183
2184 2017-03-02  Dave Hyatt  <hyatt@apple.com>
2185
2186         flex-basis should be 0% (not 0px) when omitted
2187         https://bugs.webkit.org/show_bug.cgi?id=169100
2188         rdar://problem/30429154
2189
2190         Reviewed by Dean Jackson.
2191
2192         Covered by existing tests.
2193
2194         * css/parser/CSSPropertyParser.cpp:
2195         (WebCore::CSSPropertyParser::consumeFlex):
2196
2197 2017-02-22  Jiewen Tan  <jiewen_tan@apple.com>
2198
2199         WebCrypto API support for AES-GCM
2200         https://bugs.webkit.org/show_bug.cgi?id=157175
2201         <rdar://problem/27311691>
2202
2203         Reviewed by Brent Fulgham.
2204
2205         This patch adds support for AES-GCM. Operations of AES-GCM include: encrypt, decrypt, generateKey,
2206         importKey, exportKey, wrapKey, and unwrapKey. https://www.w3.org/TR/WebCryptoAPI/#aes-gcm
2207
2208         Tests: crypto/subtle/aes-gcm-decrypt-malformed-parameters.html
2209                crypto/subtle/aes-gcm-encrypt-malformed-parameters.html
2210                crypto/subtle/aes-gcm-generate-export-key-jwk-length-128.html
2211                crypto/subtle/aes-gcm-generate-export-key-jwk-length-192.html
2212                crypto/subtle/aes-gcm-generate-export-key-jwk-length-256.html
2213                crypto/subtle/aes-gcm-generate-export-raw-key.html
2214                crypto/subtle/aes-gcm-generate-key-encrypt-decrypt.html
2215                crypto/subtle/aes-gcm-generate-key.html
2216                crypto/subtle/aes-gcm-import-jwk-key-length-128.html
2217                crypto/subtle/aes-gcm-import-jwk-key-length-192.html
2218                crypto/subtle/aes-gcm-import-jwk-key-length-256.html
2219                crypto/subtle/aes-gcm-import-key-decrypt-additional-data-tag-length-32.html
2220                crypto/subtle/aes-gcm-import-key-decrypt-additional-data.html
2221                crypto/subtle/aes-gcm-import-key-decrypt-tagLengths.html
2222                crypto/subtle/aes-gcm-import-key-decrypt.html
2223                crypto/subtle/aes-gcm-import-key-encrypt-additional-data-tag-length-32.html
2224                crypto/subtle/aes-gcm-import-key-encrypt-additional-data.html
2225                crypto/subtle/aes-gcm-import-key-encrypt-tagLengths.html
2226                crypto/subtle/aes-gcm-import-key-encrypt.html
2227                crypto/subtle/aes-gcm-import-key-unwrap-jwk-key.html
2228                crypto/subtle/aes-gcm-import-key-unwrap-raw-key.html
2229                crypto/subtle/aes-gcm-import-key-wrap-jwk-key.html
2230                crypto/subtle/aes-gcm-import-key-wrap-raw-key.html
2231                crypto/subtle/aes-gcm-import-raw-key.html
2232                crypto/workers/subtle/aes-gcm-import-key-decrypt.html
2233                crypto/workers/subtle/aes-gcm-import-key-encrypt.html
2234                crypto/workers/subtle/aes-gcm-import-key-unwrap-key.html
2235                crypto/workers/subtle/aes-gcm-import-key-wrap-key.html
2236
2237         * CMakeLists.txt:
2238         * DerivedSources.make:
2239         * PlatformGTK.cmake:
2240         * PlatformMac.cmake:
2241         Add CryptoAlgorithmAES_CFBMac.cpp as well.
2242         * WebCore.xcodeproj/project.pbxproj:
2243         * bindings/js/JSSubtleCryptoCustom.cpp:
2244         (WebCore::normalizeCryptoAlgorithmParameters):
2245         Add support for AES-GCM.
2246         * crypto/CommonCryptoUtilities.h:
2247         Include SPI header for AES-GCM support.
2248         * crypto/CryptoAlgorithmParameters.h:
2249         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp: Added.
2250         (WebCore::usagesAreInvalidForCryptoAlgorithmAES_GCM):
2251         (WebCore::tagLengthIsValid):
2252         (WebCore::CryptoAlgorithmAES_GCM::create):
2253         (WebCore::CryptoAlgorithmAES_GCM::identifier):
2254         (WebCore::CryptoAlgorithmAES_GCM::encrypt):
2255         (WebCore::CryptoAlgorithmAES_GCM::decrypt):
2256         (WebCore::CryptoAlgorithmAES_GCM::generateKey):
2257         (WebCore::CryptoAlgorithmAES_GCM::importKey):
2258         (WebCore::CryptoAlgorithmAES_GCM::exportKey):
2259         * crypto/algorithms/CryptoAlgorithmAES_GCM.h: Added.
2260         * crypto/gnutls/CryptoAlgorithmAES_GCMGnuTLS.cpp: Added.
2261         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
2262         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
2263         * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp: Added.
2264         (WebCore::encryptAES_GCM):
2265         (WebCore::decyptAES_GCM):
2266         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
2267         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
2268         * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
2269         (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
2270         * crypto/parameters/AesGcmParams.idl: Added.
2271         * crypto/parameters/CryptoAlgorithmAesGcmParams.h: Added.
2272
2273 2017-03-02  Alex Christensen  <achristensen@webkit.org>
2274
2275         Continue enabling WebRTC
2276         https://bugs.webkit.org/show_bug.cgi?id=169056
2277
2278         Reviewed by Jon Lee.
2279
2280         * Configurations/FeatureDefines.xcconfig:
2281
2282 2017-03-02  Ryan Haddad  <ryanhaddad@apple.com>
2283
2284         Unreviewed, rolling out r213281.
2285
2286         This change caused API test WebKit2.UserMediaBasic to time
2287         out.
2288
2289         Reverted changeset:
2290
2291         "[MediaStream] UIClient may not be notified of capture state
2292         change when leaving a page"
2293         https://bugs.webkit.org/show_bug.cgi?id=169014
2294         http://trac.webkit.org/changeset/213281
2295
2296 2017-03-02  Jon Lee  <jonlee@apple.com>
2297
2298         Improve consistency of captions rendering on Mac
2299         https://bugs.webkit.org/show_bug.cgi?id=169071
2300
2301         Reviewed by Eric Carlson.
2302
2303         * page/CaptionUserPreferencesMediaAF.h:
2304         (WebCore::CaptionUserPreferencesMediaAF::captionsEdgeColorForTextColor): Deleted.
2305         (WebCore::CaptionUserPreferencesMediaAF::cssPropertyWithTextEdgeColor): Deleted.
2306
2307         * page/CaptionUserPreferencesMediaAF.cpp:
2308         (WebCore::appendCSS): Helper function to add a CSS rule with a provided StringBuilder.
2309         (WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS): Refactor to use
2310         appendCSS.
2311         (WebCore::CaptionUserPreferencesMediaAF::colorPropertyCSS): Ditto.
2312         (WebCore::CaptionUserPreferencesMediaAF::captionsTextEdgeCSS): Update text edge styles.
2313         - Add a blur to the shadow
2314         - Drop shadow style includes 1px text border
2315         - Always use black for the text edge color
2316         Also convert the stroke rules to using the CSS property and values instead of straight strings.
2317         (WebCore::CaptionUserPreferencesMediaAF::captionsStyleSheetOverride): Fly-by fix of a typo.
2318
2319 2017-03-02  Chris Dumez  <cdumez@apple.com>
2320
2321         Download attribute set to "*\" save file with name "example.com"
2322         https://bugs.webkit.org/show_bug.cgi?id=169066
2323         <rdar://problem/30740875>
2324
2325         Reviewed by Alex Christensen.
2326
2327         The issue is that a backslash in recognized as an escaping character in
2328         a quoted string as per RFC2616:
2329         "
2330         The backslash character ("\") MAY be used as a single-character
2331         quoting mechanism only within quoted-string and comment constructs.
2332         "
2333
2334         We therefore need to escape the backslashes in the filename before
2335         using it in the Content-Disposition header, inside the quoted string.
2336
2337         Test: fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-backslash.html
2338
2339         * platform/network/ResourceResponseBase.cpp:
2340         (WebCore::ResourceResponseBase::sanitizeSuggestedFilename):
2341
2342 2017-03-02  Youenn Fablet  <youenn@apple.com>
2343
2344         [WebRTC] Activate ICE candidate privacy policy
2345         https://bugs.webkit.org/show_bug.cgi?id=168975
2346
2347         Reviewed by Alex Christensen.
2348
2349         Test: webrtc/datachannel/filter-ice-candidate.html
2350
2351         * testing/Internals.cpp:
2352         (WebCore::Internals::Internals): Disabling ICE candidate filtering by default for rwt.
2353         (WebCore::Internals::setICECandidateFiltering):
2354         * testing/Internals.h:
2355         * testing/Internals.idl:
2356
2357 2017-03-02  Eric Carlson  <eric.carlson@apple.com>
2358
2359         [MediaStream] UIClient may not be notified of capture state change when leaving a page
2360         https://bugs.webkit.org/show_bug.cgi?id=169014
2361         <rdar://problem/30632267>
2362
2363         Reviewed by Youenn Fablet.
2364
2365         Enable and update the WebKit API test WebKit2.UserMedia.
2366
2367         * dom/Document.cpp:
2368         (WebCore::Document::prepareForDestruction): Always call page.updateIsPlayingMedia() if there
2369         is active media in the document because it won't be possible when the state changes later
2370         because the frame will have been cleared.
2371
2372 2017-03-02  Tomas Popela  <tpopela@redhat.com>
2373
2374         [WK2] Keyboard menu key should show context menu
2375         https://bugs.webkit.org/show_bug.cgi?id=72099
2376
2377         Reviewed by Carlos Garcia Campos.
2378
2379         Show the context menu when the GtkWidget::popup-menu signal is
2380         emitted. This signal is triggered by pressing a key (usually
2381         the Menu key or the Shift + F10 shortcut) or it could be emitted on
2382         WebKitWebView.
2383
2384         Test: fast/events/context-activated-by-key-event.html
2385
2386         Also could be tested by:
2387
2388         ManualTests/keyboard-menukey-event.html
2389         ManualTests/win/contextmenu-key.html
2390         ManualTests/win/contextmenu-key2.html
2391
2392         * page/EventHandler.cpp:
2393         (WebCore::EventHandler::sendContextMenuEventForKey):
2394         Correctly send the mouse event that used for showing the context menu.
2395         Previously the event was immediately dispatched as it is, but this was
2396         only the right way if some element was focused on the page. If there
2397         was no focused element or non-empty text range then the event lacked
2398         the right node, where it was supposed to be shown. The correct node
2399         is determined and added to the event in the sendContextMenuEvent() so
2400         we have to use this function to send the event.
2401
2402         Also use absoluteBoundingBoxRect() instead of
2403         pixelSnappedAbsoluteClippedOverflowRect() when determining
2404         a coordinate where to show the context menu for the currently focus
2405         element. The latter is not returning a right box (it is bigger) which
2406         could lead to the situation that no menu will be displayed at all,
2407         because the HitTest won't contain the right element as the
2408         determined coordinates could be outside of the element.
2409         * page/EventHandler.h:
2410
2411 2017-03-02  Carlos Garcia Campos  <cgarcia@igalia.com>
2412
2413         [GTK] Crash in WebCore::CoordinatedGraphicsLayer::notifyFlushRequired
2414         https://bugs.webkit.org/show_bug.cgi?id=166420
2415
2416         Reviewed by Žan Doberšek.
2417
2418         This is happening when closing a page that is being inspected. When CoordinatedGraphicsLayer::removeFromParent()
2419         is called, the coordinator has already been invalidated, so all its layers were set a nullptr coordinator. I
2420         think it's safe to simply handle m_coordinator being nullptr in notifyFlushRequired().
2421
2422         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2423         (WebCore::CoordinatedGraphicsLayer::notifyFlushRequired): Return early if the coordinator is nullptr.
2424
2425 2017-03-02  Andreas Kling  <akling@apple.com>
2426
2427         Don't keep dead resources in MemoryCache while under memory pressure.
2428         <https://webkit.org/b/169070>
2429
2430         Reviewed by Antti Koivisto.
2431
2432         Have CachedResource::deleteIfPossible() remove the resource from the MemoryCache
2433         if we're under memory pressure and that was the only thing keeping it alive.
2434
2435         This is consistent with the policy where dead resources are evicted from the cache
2436         as we come under pressure.
2437
2438         * loader/cache/CachedResource.cpp:
2439         (WebCore::CachedResource::deleteIfPossible):
2440
2441 2017-03-01  Carlos Garcia Campos  <cgarcia@igalia.com>
2442
2443         REGRESSION(r213062): [SOUP] UTF-8 filename in Content-Disposition header incorrectly handled since r213062
2444         https://bugs.webkit.org/show_bug.cgi?id=169024
2445
2446         Reviewed by Youenn Fablet.
2447
2448         This made test http/tests/download/literal-utf-8.html to start failing. The problem is that I removed the
2449         conversion made by String::fromUTF8WithLatin1Fallback that was added in r176930. I removed it because that made
2450         fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html to timeout. This patch brings back
2451         the String::fromUTF8WithLatin1Fallback call but only when the header string is 8 bit one.
2452
2453         Fixes: http/tests/download/literal-utf-8.html
2454
2455         * platform/network/soup/ResourceResponseSoup.cpp:
2456         (WebCore::ResourceResponse::platformSuggestedFilename):
2457
2458 2017-03-01  Alex Christensen  <achristensen@webkit.org>
2459
2460         Actually fix Windows build.
2461
2462         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
2463         Win32Handle is now in WTF namespace.
2464
2465 2017-03-01  Alex Christensen  <achristensen@webkit.org>
2466
2467         Fix WinCairo build after r213214
2468         https://bugs.webkit.org/show_bug.cgi?id=168908
2469
2470         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
2471
2472 2017-03-01  Myles C. Maxfield  <mmaxfield@apple.com>
2473
2474         Implement font-stretch for installed fonts
2475         https://bugs.webkit.org/show_bug.cgi?id=168888
2476
2477         Reviewed by Darin Adler and Dave Hyatt.
2478
2479         This patch implements the font-stretch property. Both parsing and the implementation is
2480         implemented. Contrary to the name, this property doesn't actually stretch fonts; instead,
2481         it provides one more input to the font selection routine.
2482
2483         The mapping from Core Text's [-1, 1] width values to font-stretch's percentage-based
2484         values is not perfect. For now, I've implemented a piecewise linear curve mapping the
2485         two. However, I expect to be able to improve this transfer function soon.
2486
2487         This patch does not implement the font-stretch descriptor in @font-face, and therefore
2488         does not work with web fonts. I will add this support in
2489         https://bugs.webkit.org/show_bug.cgi?id=168892. The reason it isn't done in this patch is
2490         it requires some architectural changes to our CSSFontFace classes which are large enough
2491         they should be separated into their own patch.
2492
2493         This patch lays the groundwork for implementing the 'wdth' variation axis. It does this
2494         by adding a floating-point value to RenderStyle instead of just an enum. The font-stretch
2495         keywords get converted to these floating-point numbers in accordance with the Fonts spec.
2496         This patch doesn't actually implement the variations piece of font-stretch, because that
2497         piece also requires some architectural changes. This patch just implements the installed
2498         font selection piece.
2499
2500         This patch also fixes the regression introduced in r213163 with Helvetica Neue. Now that
2501         our font selection algorithm has a concept of font stretch, weights 800 and 900 of
2502         Helvetica Neue are rendered as expected. (And this patch updates the tests to make sure.)
2503
2504         Tests: fast/text/font-stretch-parse.html
2505                fast/text/font-stretch-shorthand.html
2506                FontCacheTest.FontLookupFromFamilyName
2507
2508         * css/CSSComputedStyleDeclaration.cpp:
2509         (WebCore::fontStretchFromStyle): Map style values to CSS keywords.
2510         (WebCore::ComputedStyleExtractor::propertyValue): Call the above function.
2511         * css/CSSFontValue.cpp:
2512         (WebCore::CSSFontValue::customCSSText): Used in getComputedStyle() for the "font"
2513         shorthand.
2514         (WebCore::CSSFontValue::equals):
2515         * css/CSSFontValue.h:
2516         * css/CSSProperties.json:
2517         * css/StyleBuilderConverter.h:
2518         (WebCore::StyleBuilderConverter::convertFontStretch): Map CSS keywords to style values.
2519         * css/StyleProperties.cpp:
2520         (WebCore::StyleProperties::appendFontLonghandValueIfExplicit): Used for
2521         Element.style.font.
2522         (WebCore::StyleProperties::fontValue):
2523         * css/parser/CSSParserFastPaths.cpp:
2524         (WebCore::CSSParserFastPaths::isKeywordPropertyID): Now that variation fonts are being
2525         implemented, font-stretch is no longer a keyword property. Instead, it can also take a
2526         number or percentage.
2527         * css/parser/CSSPropertyParser.cpp:
2528         (WebCore::consumeFontStretch): Parse the value.
2529         (WebCore::CSSPropertyParser::parseSingleValue): Call the above function.
2530         (WebCore::CSSPropertyParser::consumeFont): Ditto.
2531         * platform/graphics/FontCache.h:
2532         (WebCore::FontDescriptionKey::FontDescriptionKey): Caches should be sensitive to this
2533         new value.
2534         (WebCore::FontDescriptionKey::operator==):
2535         (WebCore::FontDescriptionKey::computeHash):
2536         * platform/graphics/FontDescription.h:
2537         (WebCore::FontDescription::stretch): The parsed style value.
2538         (WebCore::FontDescription::setStretch):
2539         (WebCore::FontDescription::operator==):
2540         (WebCore::FontCascadeDescription::initialStretch):
2541         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2542         (WebCore::FontDatabase::InstalledFont::InstalledFont): Update the installed font selection
2543         algorithm to understand font-stretch.
2544         (WebCore::findClosestStretch):
2545         (WebCore::filterStretch):
2546         (WebCore::findClosestFont):
2547         (WebCore::platformFontLookupWithFamily):
2548         (WebCore::fontWithFamily):
2549         (WebCore::FontCache::createFontPlatformData):
2550
2551 2017-03-01  Antti Koivisto  <antti@apple.com>
2552
2553         Rename recalcStyle to resolveStyle and clean up the signature
2554         https://bugs.webkit.org/show_bug.cgi?id=169049
2555
2556         Reviewed by Sam Weinig.
2557
2558         Move to modern naming.
2559
2560         * dom/Document.cpp:
2561         (WebCore::Document::resolveStyle):
2562
2563             Only two of the possible values are used so pass in a two-value enum.
2564
2565         (WebCore::Document::updateStyleIfNeeded):
2566         (WebCore::Document::updateLayoutIgnorePendingStylesheets):
2567         (WebCore::Document::createRenderTree):
2568         (WebCore::Document::finishedParsing):
2569         (WebCore::Document::webkitWillEnterFullScreenForElement):
2570         (WebCore::Document::recalcStyle): Deleted.
2571         * dom/Document.h:
2572         * inspector/InspectorOverlay.cpp:
2573         (WebCore::InspectorOverlay::update):
2574         * loader/DocumentWriter.cpp:
2575         (WebCore::DocumentWriter::reportDataReceived):
2576         * page/Frame.cpp:
2577         (WebCore::Frame::setPageAndTextZoomFactors):
2578         * page/Page.cpp:
2579         (WebCore::Page::setPageScaleFactor):
2580         * style/StyleTreeResolver.cpp:
2581         (WebCore::Style::TreeResolver::Parent::Parent):
2582         (WebCore::Style::TreeResolver::resolve):
2583
2584             Remove the argument, Document invalidates the document element if everything needs to be re-resolved.
2585
2586         * style/StyleTreeResolver.h:
2587
2588 2017-03-01  Alex Christensen  <achristensen@webkit.org>
2589
2590         Unreviewed, rolling out r213259.
2591
2592         Broke an internal build
2593
2594         Reverted changeset:
2595
2596         "Continue enabling WebRTC"
2597         https://bugs.webkit.org/show_bug.cgi?id=169056
2598         http://trac.webkit.org/changeset/213259
2599
2600 2017-03-01  Alex Christensen  <achristensen@webkit.org>
2601
2602         Continue enabling WebRTC
2603         https://bugs.webkit.org/show_bug.cgi?id=169056
2604
2605         Reviewed by Jon Lee.
2606
2607         * Configurations/FeatureDefines.xcconfig:
2608
2609 2017-03-01  Chris Dumez  <cdumez@apple.com>
2610
2611         [WK2][!NETWORK_SESSION] Failure to download when using a download attribute with no value on an anchor
2612         https://bugs.webkit.org/show_bug.cgi?id=169060
2613         <rdar://problem/30773140>
2614
2615         Reviewed by Darin Adler.
2616
2617         Make sure we never set the suggested filename to the empty string when
2618         the download attribute is present but has no value.
2619
2620         Test: http/tests/download/anchor-download-no-value.html
2621
2622         * loader/PolicyChecker.cpp:
2623         (WebCore::PolicyChecker::checkNavigationPolicy):
2624
2625 2017-03-01  Antoine Quint  <graouts@apple.com>
2626
2627         [ios-simulator] Unskip media/modern-media-controls/audio/audio-controls-metrics.html
2628         https://bugs.webkit.org/show_bug.cgi?id=167258
2629         <rdar://problem/30282740>
2630
2631         We weren't enforcing the min-width to be 200px as well as the default width, and the
2632         UA stylesheet would override it. Setting a default min-width that trumps the UA
2633         stylesheet makes the test work correctly on iOS and we can safely unskip this test.
2634
2635         Reviewed by Jon Lee.
2636
2637         * Modules/modern-media-controls/controls/media-controls.css:
2638         (:host(audio)):
2639
2640 2017-03-01  Javier Fernandez  <jfernandez@igalia.com>
2641
2642         Missing 'specification' section in the place-content shorthand
2643         https://bugs.webkit.org/show_bug.cgi?id=169052
2644
2645         Reviewed by Darin Adler.
2646
2647         Added 'specification' section in the place-content shorthand.
2648
2649         No new tests, no new functionality.
2650
2651         * css/CSSProperties.json:
2652
2653 2017-02-28  Matt Rajca  <mrajca@apple.com>
2654
2655         Media: notify clients when autoplayed media is muted
2656         https://bugs.webkit.org/show_bug.cgi?id=168987
2657
2658         Reviewed by Alex Christensen.
2659
2660         Added API tests.
2661
2662         * html/HTMLMediaElement.cpp:
2663         (WebCore::HTMLMediaElement::setMuted):
2664         (WebCore::HTMLMediaElement::pageMutedStateDidChange):
2665         * page/AutoplayEvent.h:
2666
2667 2017-03-01  Commit Queue  <commit-queue@webkit.org>
2668
2669         Unreviewed, rolling out r213226.
2670         https://bugs.webkit.org/show_bug.cgi?id=169051
2671
2672         Speculative rollout, might be causing several failures and
2673         crashes in WebKitGTK+ (Requested by lajava on #webkit).
2674
2675         Reverted changeset:
2676
2677         "REGRESSION(r213062): [SOUP] UTF-8 filename in Content-
2678         Disposition header incorrectly handled since r213062"
2679         https://bugs.webkit.org/show_bug.cgi?id=169024
2680         http://trac.webkit.org/changeset/213226
2681
2682 2017-03-01  James Craig  <jcraig@apple.com>
2683
2684         AX: add role aliases for ARIA DPUB module
2685         https://bugs.webkit.org/show_bug.cgi?id=168978
2686         <rdar://problem/30762724>
2687
2688         Reviewed by Chris Fleizach.
2689
2690         Added role aliases for ARIA DPUB module, and updated existing tests.
2691
2692         Test: accessibility/roles-exposed.html
2693         Test: inspector/dom/getAccessibilityPropertiesForNode.html
2694
2695         * accessibility/AccessibilityObject.cpp:
2696         (WebCore::initializeRoleMap): 
2697
2698 2017-03-01  Alex Christensen  <achristensen@webkit.org>
2699
2700         Don't call libwebrtc functions if libwebrtc.dylib doesn't exist while testing
2701         https://bugs.webkit.org/show_bug.cgi?id=169045
2702         <rdar://problem/30735413>
2703
2704         Reviewed by Youenn Fablet.
2705
2706         WebRTC tests fail instead of crashing now if libwebrtc.dylib is missing.
2707         All other tests pass instead of crashing immediately when creating an Internals object.
2708
2709         * Modules/mediastream/RTCController.cpp:
2710         (WebCore::RTCController::disableICECandidateFiltering):
2711         (WebCore::RTCController::enableICECandidateFiltering):
2712         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
2713         (WebCore::createLibWebRTCPeerConnectionBackend):
2714         * testing/Internals.cpp:
2715         (WebCore::Internals::enableMockMediaEndpoint):
2716         (WebCore::Internals::emulateRTCPeerConnectionPlatformEvent):
2717         (WebCore::Internals::useMockRTCPeerConnectionFactory):
2718         * testing/Internals.h:
2719
2720 2017-03-01  Javier Fernandez  <jfernandez@igalia.com>
2721
2722         [css-align] Implement the place-content shorthand
2723         https://bugs.webkit.org/show_bug.cgi?id=168771
2724
2725         Reviewed by Manuel Rego Casasnovas.
2726
2727         The CSS Box Alignment specification defines a new shorthand to set the
2728         Content Alignment properties (align-content and justify-content) at the
2729         same time.
2730
2731         This patch provides the implementation of the CSS parsing logic and the
2732         required regression tests.
2733
2734         Test: css3/parse-place-content.html
2735
2736         * css/CSSComputedStyleDeclaration.cpp:
2737         (WebCore::ComputedStyleExtractor::propertyValue):
2738         * css/CSSProperties.json:
2739         * css/StyleProperties.cpp:
2740         (WebCore::StyleProperties::getPropertyValue):
2741         * css/parser/CSSPropertyParser.cpp:
2742         (WebCore::consumeSimplifiedContentPosition):
2743         (WebCore::CSSPropertyParser::consumePlaceContentShorthand):
2744         (WebCore::CSSPropertyParser::parseShorthand):
2745         * css/parser/CSSPropertyParser.h:
2746
2747 2017-03-01  Simon Fraser  <simon.fraser@apple.com>
2748
2749         Try to fix Windows build after r213191.
2750
2751         * platform/spi/win/CoreTextSPIWin.h:
2752
2753 2017-03-01  Carlos Garcia Campos  <cgarcia@igalia.com>
2754
2755         REGRESSION(r213062): [SOUP] UTF-8 filename in Content-Disposition header incorrectly handled since r213062
2756         https://bugs.webkit.org/show_bug.cgi?id=169024
2757
2758         Reviewed by Youenn Fablet.
2759
2760         This made test http/tests/download/literal-utf-8.html to start failing. The problem is that I removed the
2761         conversion made by String::fromUTF8WithLatin1Fallback that was added in r176930. I removed it because that made
2762         fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html to timeout. This patch brings back
2763         the String::fromUTF8WithLatin1Fallback call but only when the header string is 8 bit one.
2764
2765         Fixes: http/tests/download/literal-utf-8.html
2766
2767         * platform/network/soup/ResourceResponseSoup.cpp:
2768         (WebCore::ResourceResponse::platformSuggestedFilename):
2769
2770 2017-03-01  Carlos Garcia Campos  <cgarcia@igalia.com>
2771
2772         [GTK] fast/canvas/canvas-createPattern-video-loading.html makes its subsequent test timeout
2773         https://bugs.webkit.org/show_bug.cgi?id=169019
2774
2775         Reviewed by Xabier Rodriguez-Calvar.
2776
2777         The timeout happens normally when the media player is deleted and the pipeline state is set to NULL. The call to
2778         gst_element_set_state() never returns because of different deadlocks with the video sink. Sometimes the deadlock
2779         happens with the sample mutex used by VideoRenderRequestScheduler. VideoRenderRequestScheduler::requestRender()
2780         calls webkitVideoSinkRepaintRequested() with the lock held, that ends up calling
2781         MediaPlayerPrivateGStreamerBase::triggerRepaint(). When rendering can't be accelerated the draw timer is
2782         scheduled and triggerRepaint blocks until the timer is fired. If the media player is destroyed before the timer
2783         is fired, when setting the pipeline state to NULL, other VideoRenderRequestScheduler methods can be called, like
2784         stop() that tries to get the sample mutex that is still held by requestRender(). So, first we need to make
2785         sure that requestRender() releases the lock before calling webkitVideoSinkRepaintRequested(). But that's not
2786         enough, we also need to ensure that the pipeline is set to NULL state after everyting has been properly
2787         stopped. This is currently done in ~MediaPlayerPrivateGStreamer that happens before
2788         ~MediaPlayerPrivateGStreamerBase, so gst_element_set_state() is hanging before allowing the
2789         MediaPlayerPrivateGStreamerBase to be cleaned up. We should move the call to the end of
2790         ~MediaPlayerPrivateGStreamerBase and ensure the draw timer and mutex are properly cleaned up before.
2791
2792         Fixes: fast/canvas/canvas-createPattern-video-loading.html
2793
2794         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2795         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): Do not reset pipeline here.
2796         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2797         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase): Stop the draw mutex and notify the
2798         lock to ensure we unblock. Do the pipeline reset at the end.
2799         * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
2800         (VideoRenderRequestScheduler::requestRender): Release the mutex lock before calling webkitVideoSinkRepaintRequested().
2801
2802 2017-03-01  Tomas Popela  <tpopela@redhat.com>
2803
2804         Unreviewed compiler warning fix after r213218
2805
2806         * platform/gtk/PlatformKeyboardEventGtk.cpp:
2807         (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
2808
2809 2017-03-01  Tomas Popela  <tpopela@redhat.com>
2810
2811         [Cairo] Incorrectly determining height in GraphicsContext::roundToDevicePixels()
2812         https://bugs.webkit.org/show_bug.cgi?id=169031
2813
2814         Reviewed by Carlos Garcia Campos.
2815
2816         We should compare if height is between -1 and 0 and not mixing height
2817         and width together.
2818
2819         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2820         (WebCore::GraphicsContext::roundToDevicePixels):
2821
2822 2017-03-01  Tomas Popela  <tpopela@redhat.com>
2823
2824         [GTK] Fix problems found by Coverity scan in platform's keyboard and mouse events
2825         https://bugs.webkit.org/show_bug.cgi?id=169028
2826
2827         Reviewed by Carlos Garcia Campos.
2828
2829         * platform/gtk/PlatformKeyboardEventGtk.cpp:
2830         (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent): Initialize
2831         the m_handledByInputMethod member.
2832         * platform/gtk/PlatformMouseEventGtk.cpp:
2833         (WebCore::PlatformMouseEvent::PlatformMouseEvent): Initialize the
2834         m_modifierFlags member.
2835
2836 2017-03-01  Andreas Kling  <akling@apple.com>
2837
2838         Move MemoryPressureHandler to WTF
2839         <https://webkit.org/b/168908>
2840
2841         Reviewed by Sam Weinig.
2842
2843         * CMakeLists.txt:
2844         * PlatformMac.cmake:
2845         * PlatformWin.cmake:
2846         * WebCore.xcodeproj/project.pbxproj:
2847         * bindings/js/ScriptController.cpp:
2848         * history/PageCache.cpp:
2849         * html/HTMLMediaElement.cpp:
2850         * inspector/InspectorInstrumentation.h:
2851         * inspector/InspectorMemoryAgent.h:
2852         * page/FrameView.cpp:
2853         * page/MemoryRelease.h:
2854         * page/linux/ResourceUsageThreadLinux.cpp:
2855         * platform/Linux.cmake:
2856         * platform/graphics/FontCache.cpp:
2857         * platform/graphics/WidthCache.h:
2858         * platform/graphics/ca/TileController.cpp:
2859         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
2860         * platform/ios/LegacyTileCache.mm:
2861         * platform/ios/LegacyTileGrid.mm:
2862         * platform/ios/LegacyTileLayerPool.mm:
2863         * platform/ios/TileControllerMemoryHandlerIOS.cpp:
2864         * testing/Internals.cpp:
2865
2866 2017-03-01  Per Arne Vollan  <pvollan@apple.com>
2867
2868         [Win] Popup menus are too small in HiDPI mode.
2869         https://bugs.webkit.org/show_bug.cgi?id=168965
2870
2871         Reviewed by Brent Fulgham.
2872
2873         Scale font with device scale factor.
2874
2875         * platform/win/PopupMenuWin.cpp:
2876         (WebCore::PopupMenuWin::show):
2877         (WebCore::PopupMenuWin::calculatePositionAndSize):
2878         (WebCore::PopupMenuWin::paint):
2879         * platform/win/PopupMenuWin.h:
2880
2881 2017-03-01  Joseph Pecoraro  <pecoraro@apple.com>
2882
2883         [WebRTC] Install libwebrtc.dylib inside of WebCore.framework
2884         https://bugs.webkit.org/show_bug.cgi?id=168859
2885
2886         Reviewed by Dan Bernstein.
2887
2888         * Configurations/WebCore.xcconfig:
2889         Set library search path to find the libwebrtc.dylib inside of WebCore's Frameworks
2890         or in the WK_OVERRIDE_FRAMEWORKS_DIR.
2891
2892 2017-02-28  Myles C. Maxfield  <mmaxfield@apple.com>
2893
2894         Addressing post-review comments on r213163
2895         https://bugs.webkit.org/show_bug.cgi?id=168678
2896
2897         Unreviewed.
2898
2899         No new tests because there is no behavior change.
2900
2901         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2902         (WebCore::platformFontLookupWithFamily):
2903
2904 2017-02-28  Simon Fraser  <simon.fraser@apple.com>
2905
2906         Don't use the LinearGlyphMask format if accelerated drawing is disabled
2907         https://bugs.webkit.org/show_bug.cgi?id=168997
2908
2909         Reviewed by Tim Horton.
2910
2911         Non-accelerated drawing doesn't work into LinearGlyphMask-format backing store,
2912         so don't use that backing store format when accelerated drawing is disabled.
2913
2914         * platform/graphics/ca/PlatformCALayer.cpp:
2915         (WebCore::PlatformCALayer::drawRepaintIndicator):
2916         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
2917         (layerContentsFormat):
2918         (PlatformCALayerCocoa::updateContentsFormat):
2919
2920 2017-02-28  Simon Fraser  <simon.fraser@apple.com>
2921
2922         Make the repaint indicators show subpixel antialiased text indication a bit more clearly
2923         https://bugs.webkit.org/show_bug.cgi?id=168988
2924
2925         Reviewed by Tim Horton.
2926
2927         Put a more obvious stroke around the repaint count when subpixel-antialiased layer text is enabled.
2928
2929         * platform/graphics/ca/PlatformCALayer.cpp:
2930         (WebCore::PlatformCALayer::drawRepaintIndicator):
2931         (WebCore::PlatformCALayer::drawTextAtPoint):
2932         * platform/graphics/ca/PlatformCALayer.h:
2933         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
2934         (PlatformCALayerWin::drawTextAtPoint):
2935         * platform/graphics/ca/win/PlatformCALayerWin.h:
2936
2937 2017-02-28  Alex Christensen  <achristensen@webkit.org>
2938
2939         LibWebRTCProvider should check existence of libwebrtc.dylib
2940         https://bugs.webkit.org/show_bug.cgi?id=168986
2941         <rdar://problem/30735413>
2942
2943         Reviewed by Youenn Fablet.
2944
2945         Some configurations of the webrtc tests overwrite the availability of WebRTC in order to test it
2946         with MockLibWebRTCPeerConnection.  If the dylib can not be found, we can't use it, so we want to
2947         fail these tests rather than crashing calling rtc::LogMessage::LogToDebug.
2948
2949         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2950         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
2951         (WebCore::LibWebRTCMediaEndpoint::doCreateAnswer):
2952         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
2953         (WebCore::LibWebRTCProvider::factory):
2954         (WebCore::LibWebRTCProvider::webRTCAvailable):
2955         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
2956         * testing/MockLibWebRTCPeerConnection.cpp:
2957         (WebCore::useMockRTCPeerConnectionFactory):
2958         (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection):
2959
2960 2017-02-28  Tim Horton  <timothy_horton@apple.com>
2961
2962         Apply a review comment that was missing in r213182
2963
2964         * loader/ios/QuickLook.mm:
2965         (WebCore::isQuickLookPreviewURL):
2966
2967 2017-02-28  Tim Horton  <timothy_horton@apple.com>
2968
2969         [iOS] Getting QLPreviewProtocol slows down first navigation in Web process
2970         https://bugs.webkit.org/show_bug.cgi?id=168940
2971         <rdar://problem/29468999>
2972
2973         Reviewed by Simon Fraser.
2974
2975         No new tests, just a performance improvement.
2976
2977         * loader/DocumentLoader.cpp:
2978         (WebCore::isRemoteWebArchive):
2979         * loader/PolicyChecker.cpp:
2980         (WebCore::PolicyChecker::checkNavigationPolicy):
2981         * loader/ResourceLoadNotifier.cpp:
2982         (WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
2983         Make use of isQuickLookPreviewURL.
2984
2985         * loader/ios/QuickLook.h:
2986         * loader/ios/QuickLook.mm:
2987         (WebCore::isQuickLookPreviewURL):
2988         Add isQuickLookPreviewURL, which first early-returns if the protocol
2989         of the URL is a well-known protocol, and then falls back to loading QuickLook.
2990
2991         In a microbenchmark this is a 30-40% improvement in total time spent
2992         loading an empty HTML document (wall-clock time between loadHTMLString
2993         and didFinishNavigation).
2994
2995 2017-02-28  Simon Fraser  <simon.fraser@apple.com>
2996
2997         Add Geolocation and DeviceOrientation to features.json 
2998
2999         * features.json:
3000
3001 2017-02-28  Wenson Hsieh  <wenson_hsieh@apple.com>
3002
3003         Data interaction should support attachment elements
3004         https://bugs.webkit.org/show_bug.cgi?id=168916
3005         <rdar://problem/30664519>
3006
3007         Reviewed by Ryosuke Niwa.
3008
3009         Teaches DragController to recognize and initiate dragging on attachment elements, and also adds a new
3010         convenience method to the WebItemProviderPasteboard for block enumeration of available UIItemProviders. Covered
3011         by a new API test: DataInteractionTests.AttachmentElementItemProviders.
3012
3013         * page/DragController.cpp:
3014         (WebCore::DragController::draggableElement):
3015         (WebCore::DragController::startDrag):
3016         * platform/ios/WebItemProviderPasteboard.h:
3017         * platform/ios/WebItemProviderPasteboard.mm:
3018         (-[WebItemProviderPasteboard enumerateItemProvidersWithBlock:]):
3019
3020 2017-02-28  Mark Lam  <mark.lam@apple.com>
3021
3022         Remove setExclusiveThread() and peers from the JSLock.
3023         https://bugs.webkit.org/show_bug.cgi?id=168977
3024
3025         Reviewed by Filip Pizlo.
3026
3027         No new tests because this should already be covered by existing tests.
3028
3029         * bindings/js/CommonVM.cpp:
3030         (WebCore::commonVMSlow):
3031
3032 2017-02-28  Dave Hyatt  <hyatt@apple.com>
3033
3034         Centering text inside a button set to display flex and justify-content: center is impossible
3035         https://bugs.webkit.org/show_bug.cgi?id=148872
3036         <rdar://problem/22590086>
3037
3038         Reviewed by Simon Fraser.
3039
3040         Added new test in fast/forms.
3041
3042         * rendering/RenderButton.cpp:
3043         (WebCore::RenderButton::addChild):
3044         (WebCore::RenderButton::updateAnonymousChildStyle):
3045         (WebCore::RenderButton::styleDidChange):
3046         (WebCore::RenderButton::styleWillChange): Deleted.
3047         (WebCore::RenderButton::setupInnerStyle): Deleted.
3048         * rendering/RenderButton.h:
3049         * rendering/RenderElement.cpp:
3050         (WebCore::RenderElement::propagateStyleToAnonymousChildren):
3051         * rendering/RenderElement.h:
3052         (WebCore::RenderElement::updateAnonymousChildStyle):
3053
3054 2017-02-28  Antoine Quint  <graouts@apple.com>
3055
3056         [Modern Media Controls] Add missing compact mode assets for macOS
3057         https://bugs.webkit.org/show_bug.cgi?id=168980
3058         <rdar://problem/30763269>
3059
3060         Reviewed by Jon Lee.
3061
3062         Adding missing compact mode assets for the AirPlay, tracks, PiP and volume buttons.
3063
3064         * Modules/modern-media-controls/controls/icon-service.js:
3065         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css:
3066         (.media-controls.mac.inline.compact button.airplay):
3067         (.media-controls.mac.inline.compact button.pip):
3068         (.media-controls.mac.inline.compact button.tracks):
3069         * Modules/modern-media-controls/images/macOS/airplay-compact@1x.png: Added.
3070         * Modules/modern-media-controls/images/macOS/airplay-compact@2x.png: Added.
3071         * Modules/modern-media-controls/images/macOS/media-selection-compact@1x.png: Added.
3072         * Modules/modern-media-controls/images/macOS/media-selection-compact@2x.png: Added.
3073         * Modules/modern-media-controls/images/macOS/pip-in-compact@1x.png: Added.
3074         * Modules/modern-media-controls/images/macOS/pip-in-compact@2x.png: Added.
3075         * Modules/modern-media-controls/images/macOS/volume-compact@1x.png:
3076         * Modules/modern-media-controls/images/macOS/volume-compact@2x.png:
3077         * Modules/modern-media-controls/images/macOS/volume-mute-compact@1x.png: Added.
3078         * Modules/modern-media-controls/images/macOS/volume-mute-compact@2x.png: Added.
3079
3080 2017-02-28  Chris Dumez  <cdumez@apple.com>
3081
3082         [iOS] Throttle requestAnimationFrame to 30fps in low power mode
3083         https://bugs.webkit.org/show_bug.cgi?id=168837
3084         <rdar://problem/30700929>
3085
3086         Reviewed by Simon Fraser.
3087
3088         Throttle requestAnimationFrame to 30fps in low power mode on iOS to save battery.
3089
3090         ScriptedAnimationController now maintains an OptionSet of throttling reasons.
3091         Throttling reasons for now are: OutsideViewport, VisuallyIdle, and LowPowerMode.
3092         The requestAnimationFrame interval is then determined based on those throttling
3093         reasons:
3094         - OutsideViewport or VisuallyIdle: 10 seconds (very aggressive throttling)
3095         - LowPowerMode: 30fps
3096         - No reasons: 60fps
3097
3098         The Page now keeps track of low power mode state using a LowPowerModeNotifier.
3099         Whenever low power mode changes, it updates the throttling reasons in all the
3100         documents' ScriptedAnimationControllers in the frame tree.
3101
3102         Tests: fast/animation/request-animation-frame-throttling-detached-iframe.html
3103                fast/animation/request-animation-frame-throttling-lowPowerMode.html
3104
3105         * dom/Document.cpp:
3106         (WebCore::Document::requestAnimationFrame):
3107         * dom/Document.h:
3108         * dom/ScriptedAnimationController.cpp:
3109         (WebCore::ScriptedAnimationController::ScriptedAnimationController):
3110         (WebCore::throttlingReasonToString):
3111         (WebCore::throttlingReasonsToString):
3112         (WebCore::ScriptedAnimationController::addThrottlingReason):
3113         (WebCore::ScriptedAnimationController::removeThrottlingReason):
3114         (WebCore::ScriptedAnimationController::isThrottled):
3115         (WebCore::ScriptedAnimationController::interval):
3116         (WebCore::ScriptedAnimationController::page):
3117         (WebCore::ScriptedAnimationController::scheduleAnimation):
3118         * dom/ScriptedAnimationController.h:
3119         (WebCore::ScriptedAnimationController::create):
3120         * page/FrameView.cpp:
3121         (WebCore::FrameView::updateScriptedAnimationsAndTimersThrottlingState):
3122         * page/Page.cpp:
3123         (WebCore::Page::Page):
3124         (WebCore::Page::isLowPowerModeEnabled):
3125         (WebCore::Page::setLowPowerModeEnabledOverrideForTesting):
3126         (WebCore::updateScriptedAnimationsThrottlingReason):
3127         (WebCore::Page::setIsVisuallyIdleInternal):
3128         (WebCore::Page::handleLowModePowerChange):
3129         * page/Page.h:
3130         * testing/Internals.cpp:
3131         (WebCore::Internals::resetToConsistentState):
3132         (WebCore::Internals::requestAnimationFrameInterval):
3133         (WebCore::Internals::setLowPowerModeEnabled):
3134         * testing/Internals.h:
3135         * testing/Internals.idl:
3136
3137 2017-02-28  Youenn Fablet  <youenn@apple.com>
3138
3139         [WebRTC] Limit libwebrtc logging in Debug build
3140         https://bugs.webkit.org/show_bug.cgi?id=168974
3141
3142         Reviewed by Alex Christensen.
3143
3144         Covered by manual testing..
3145
3146         * platform/Logging.h:
3147         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
3148         (WebCore::LibWebRTCProvider::callOnWebRTCSignalingThread):
3149
3150 2017-02-28  Myles C. Maxfield  <mmaxfield@apple.com>
3151
3152         [macOS] Migrate off of CTFontCreateForCSS
3153         https://bugs.webkit.org/show_bug.cgi?id=168678
3154
3155         Reviewed by David Hyatt.
3156
3157         This patch implements the Font Matching Algorithm detailed in
3158         https://drafts.csswg.org/css-fonts-4/#font-matching-algorithm
3159         Previously, this was implemented inside Core Text (via
3160         CTFontCreateForCSS()), but that implementation does not understand
3161         variation fonts. Therefore it should move to WebKit (along with
3162         the general fact that CSS algorithms should be implemented in a
3163         CSS engine, not the platform's text engine).
3164
3165         This implementation is not completely divorced from the platform,
3166         however - Core Text exposes font weights on a [-1, 1] range, but
3167         CSS operates on a [1, 999] range. In order to provide the mapping
3168         to CSS weights, Core Text infrastructure is necessary. Therefore,
3169         this new implementation of the matching algorithm is only used
3170         on certain operating systems.
3171
3172         The new implementation of the algorithm is not bug-compatible with
3173         the existing implementation; this patch does represent a behavior
3174         change. However, I have reviewed the differences manually and
3175         believe this algorithm to be a progression over the previous one
3176         (except for one case with Helvetica Neue - see
3177         LayoutTests/ChangeLog for more information about that).
3178
3179         This patch also represents a 27% performance progression on our
3180         standard page load test (just measuring the performance of the font
3181         matching algorithm, and nothing else). (Because font matching is
3182         only a small part of the entire test, the overall progression is
3183         much smaller.)
3184
3185         Tests: FontCacheTest.FontLookupFromFamilyName
3186                FontCacheTest.FontLookupFromPostScriptName
3187
3188         * platform/graphics/FontCache.h:
3189         (WebCore::FontCache::createFontPlatformDataForTesting): Allow for
3190         unit testing.
3191         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3192         (WebCore::isSystemFont): Inlined.
3193         (WebCore::FontDatabase::singleton): Cache results of Core Text
3194         lookups.
3195         (WebCore::FontDatabase::Range::Range): Because of variation fonts,
3196         fonts' weights, widths, and slopes need to be represented as a range
3197         instead of an individual value.
3198         (WebCore::FontDatabase::Range::isValid):
3199         (WebCore::FontDatabase::Range::expand):
3200         (WebCore::FontDatabase::Range::includes):
3201         (WebCore::FontDatabase::InstalledFont::InstalledFont): Represents a
3202         Font Descriptor as well as some lookup information about it.
3203         (WebCore::FontDatabase::InstalledFontCollection::InstalledFontCollection):
3204         A collection of installed fonts.
3205         (WebCore::FontDatabase::InstalledFontCollection::insertInstalledFont):
3206         Cache minima and maxima.
3207         (WebCore::FontDatabase::InstalledFontCollection::isEmpty):
3208         (WebCore::FontDatabase::InstalledFontCollection::size):
3209         (WebCore::FontDatabase::lookupFamilyName): Get all the fonts in
3210         the family.
3211         (WebCore::FontDatabase::lookupPostScriptName): Get the font with
3212         the given PostScript name.
3213         (WebCore::FontDatabase::clear):
3214         (WebCore::FontDatabase::FontDatabase): Cache.
3215         (WebCore::iterateActiveFontsWithReturn): The Font Matching Algorithm
3216         works by starting with every font in the family, and the eliminating
3217         items from the set iteratively. Instead of actually removing items
3218         from a vector or linked list, we instead want to treat the collection
3219         as immutable and keep a parallel side-table of which items have been
3220         eliminated (in order to reduce copies and allocations). This makes
3221         sense because most families only have a handful of fonts in them.
3222         This function consults with the side-table to iterate only over the
3223         fonts which have not been eliminated.
3224         (WebCore::iterateActiveFonts): Ditto.
3225         (WebCore::findClosestStretch):
3226         (WebCore::filterStretch): Eliminate fonts based on their stretch
3227         value.
3228         (WebCore::findClosestStyle):
3229         (WebCore::filterStyle): Eliminate fonts based on their style value.
3230         (WebCore::findClosestWeight):
3231         (WebCore::filterWeight): Eliminate fonts based on their weight value.
3232         (WebCore::computeTargetWeight):
3233         (WebCore::findClosestFont): If we have a set of fonts in a family,
3234         select the font in the set which best matches the criteria.
3235         (WebCore::platformFontLookupWithFamily): While findClosestFont()
3236         function satisfies the spec's notion of the font matching algorithm,
3237         WebKit actually claims to be able to look up fonts by their PostScript
3238         name. Therefore, this function has a higher-level of logic to rectify
3239         the confusion that results when the PostScript name doesn't agree with
3240         the other CSS properties (like if you say "Helvetica-Bold" but also say
3241         font-weight: 100).
3242         * platform/spi/cocoa/CoreTextSPI.h: Add signature for system CSS
3243         font weight support.
3244
3245 2017-02-24  Matt Rajca  <mrajca@apple.com>
3246
3247         Media: notify clients when autoplayed media ends without being paused
3248         https://bugs.webkit.org/show_bug.cgi?id=168852
3249
3250         Reviewed by Alex Christensen.
3251
3252         Added API tests.
3253
3254         * html/HTMLMediaElement.cpp:
3255         (WebCore::HTMLMediaElement::setReadyState):
3256          Set state accordingly if we autoplayed or if playback was prevented.
3257         (WebCore::HTMLMediaElement::play):
3258          Update state if playback was prevented.
3259         (WebCore::HTMLMediaElement::playInternal):
3260          Update state if playback began without user interaction.
3261         (WebCore::HTMLMediaElement::pauseInternal):
3262          Update state.
3263         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
3264          If playback ends and it began without user interaction, send a DidPlayMediaWithoutInterference event.
3265         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer): Ditto.
3266         * html/HTMLMediaElement.h:
3267         * page/AutoplayEvent.h:
3268
3269 2017-02-27  Dave Hyatt  <hyatt@apple.com>
3270
3271         Update flexbox to Blink's tip of tree
3272         https://bugs.webkit.org/show_bug.cgi?id=168657
3273
3274         Reviewed by Zalan Bujtas.
3275
3276         Added new tests in css3/flexbox.
3277
3278         * CMakeLists.txt:
3279         * WebCore.xcodeproj/project.pbxproj:
3280         * css/CSSComputedStyleDeclaration.cpp:
3281         (WebCore::ComputedStyleExtractor::propertyValue):
3282         * rendering/FlexibleBoxAlgorithm.cpp: Added.
3283         (WebCore::FlexItem::FlexItem):
3284         (WebCore::FlexLayoutAlgorithm::FlexLayoutAlgorithm):
3285         (WebCore::FlexLayoutAlgorithm::computeNextFlexLine):
3286         * rendering/FlexibleBoxAlgorithm.h: Added.
3287         (WebCore::FlexItem::hypotheticalMainAxisMarginBoxSize):
3288         (WebCore::FlexItem::flexBaseMarginBoxSize):
3289         (WebCore::FlexItem::flexedMarginBoxSize):
3290         (WebCore::FlexLayoutAlgorithm::isMultiline):
3291         * rendering/GridTrackSizingAlgorithm.cpp:
3292         (WebCore::GridTrackSizingAlgorithm::computeTrackBasedSize):
3293         (WebCore::GridTrackSizingAlgorithm::increaseSizesToAccommodateSpanningItems):
3294         (WebCore::GridTrackSizingAlgorithm::assumedRowsSizeForOrthogonalChild):
3295         (WebCore::GridTrackSizingAlgorithm::gridAreaBreadthForChild):
3296         (WebCore::IndefiniteSizeStrategy::recomputeUsedFlexFractionIfNeeded):
3297         * rendering/GridTrackSizingAlgorithm.h:
3298         * rendering/OrderIterator.cpp:
3299         (WebCore::OrderIterator::next):
3300         (WebCore::OrderIterator::reset):
3301         (WebCore::OrderIteratorPopulator::~OrderIteratorPopulator):
3302         (WebCore::OrderIteratorPopulator::collectChild):
3303         (WebCore::OrderIteratorPopulator::OrderIteratorPopulator): Deleted.
3304         (WebCore::OrderIteratorPopulator::removeDuplicatedOrderValues): Deleted.
3305         * rendering/OrderIterator.h:
3306         (WebCore::OrderIteratorPopulator::OrderIteratorPopulator):
3307         * rendering/RenderBlock.cpp:
3308         (WebCore::RenderBlock::updateBlockChildDirtyBitsBeforeLayout):
3309         (WebCore::RenderBlock::layoutPositionedObject):
3310         (WebCore::RenderBlock::computeBlockPreferredLogicalWidths):
3311         (WebCore::RenderBlock::computeChildPreferredLogicalWidths):
3312         (WebCore::RenderBlock::hasDefiniteLogicalHeight):
3313         (WebCore::RenderBlock::availableLogicalHeightForPercentageComputation):
3314         * rendering/RenderBlock.h:
3315         (WebCore::RenderBlock::hasPercentHeightDescendants):
3316         * rendering/RenderBlockFlow.cpp:
3317         (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths):
3318         * rendering/RenderBox.cpp:
3319         (WebCore::RenderBox::columnFlexItemHasStretchAlignment):
3320         (WebCore::RenderBox::isStretchingColumnFlexItem):
3321         (WebCore::RenderBox::hasStretchedLogicalWidth):
3322         (WebCore::RenderBox::sizesLogicalWidthToFitContent):
3323         (WebCore::RenderBox::computeInlineDirectionMargins):
3324         (WebCore::RenderBox::cacheIntrinsicContentLogicalHeightForFlexItem):
3325         (WebCore::RenderBox::updateLogicalHeight):
3326         (WebCore::RenderBox::computeLogicalHeightWithoutLayout):
3327         (WebCore::RenderBox::skipContainingBlockForPercentHeightCalculation):
3328         (WebCore::RenderBox::shouldTreatChildAsReplacedInTableCells):
3329         (WebCore::tableCellShouldHaveZeroInitialSize):
3330         (WebCore::RenderBox::computePercentageLogicalHeight):
3331         (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
3332         (WebCore::RenderBox::availableLogicalHeightUsing):
3333         (WebCore::RenderBox::percentageLogicalHeightIsResolvable):
3334         (WebCore::RenderBox::hasUnsplittableScrollingOverflow):
3335         (WebCore::flexItemHasStretchAlignment): Deleted.
3336         (WebCore::isStretchingColumnFlexItem): Deleted.
3337         (WebCore::logicalWidthIsResolvable): Deleted.
3338         (WebCore::RenderBox::hasDefiniteLogicalWidth): Deleted.
3339         (WebCore::percentageLogicalHeightIsResolvable): Deleted.
3340         (WebCore::RenderBox::percentageLogicalHeightIsResolvableFromBlock): Deleted.
3341         (WebCore::RenderBox::hasDefiniteLogicalHeight): Deleted.
3342         * rendering/RenderBox.h:
3343         (WebCore::RenderBox::isGridItem):
3344         (WebCore::RenderBox::isFlexItem):
3345         (WebCore::RenderBox::selfAlignmentNormalBehavior):
3346         * rendering/RenderBoxModelObject.cpp:
3347         (WebCore::isOutOfFlowPositionedWithImplicitHeight):
3348         (WebCore::RenderBoxModelObject::containingBlockForAutoHeightDetection):
3349         (WebCore::RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight):
3350         * rendering/RenderBoxModelObject.h:
3351         * rendering/RenderElement.cpp:
3352         (WebCore::RenderElement::removeChildInternal):
3353         * rendering/RenderFlexibleBox.cpp:
3354         (WebCore::RenderFlexibleBox::LineContext::LineContext):
3355         (WebCore::RenderFlexibleBox::RenderFlexibleBox):
3356         (WebCore::RenderFlexibleBox::computeIntrinsicLogicalWidths):
3357         (WebCore::contentAlignmentNormalBehavior):
3358         (WebCore::RenderFlexibleBox::styleDidChange):
3359         (WebCore::RenderFlexibleBox::layoutBlock):
3360         (WebCore::RenderFlexibleBox::repositionLogicalHeightDependentFlexItems):
3361         (WebCore::RenderFlexibleBox::clientLogicalBottomAfterRepositioning):
3362         (WebCore::RenderFlexibleBox::hasOrthogonalFlow):
3363         (WebCore::RenderFlexibleBox::flexBasisForChild):
3364         (WebCore::RenderFlexibleBox::crossAxisExtentForChild):
3365         (WebCore::RenderFlexibleBox::cachedChildIntrinsicContentLogicalHeight):
3366         (WebCore::RenderFlexibleBox::setCachedChildIntrinsicContentLogicalHeight):
3367         (WebCore::RenderFlexibleBox::clearCachedChildIntrinsicContentLogicalHeight):
3368         (WebCore::RenderFlexibleBox::childIntrinsicLogicalHeight):
3369         (WebCore::RenderFlexibleBox::childIntrinsicLogicalWidth):
3370         (WebCore::RenderFlexibleBox::crossAxisIntrinsicExtentForChild):
3371         (WebCore::RenderFlexibleBox::mainAxisExtentForChild):
3372         (WebCore::RenderFlexibleBox::mainAxisContentExtentForChildIncludingScrollbar):
3373         (WebCore::RenderFlexibleBox::crossAxisExtent):
3374         (WebCore::RenderFlexibleBox::mainAxisExtent):
3375         (WebCore::RenderFlexibleBox::mainAxisContentExtent):
3376         (WebCore::RenderFlexibleBox::computeMainAxisExtentForChild):
3377         (WebCore::RenderFlexibleBox::transformedWritingMode):
3378         (WebCore::RenderFlexibleBox::flowAwareMarginStartForChild):
3379         (WebCore::RenderFlexibleBox::flowAwareMarginEndForChild):
3380         (WebCore::RenderFlexibleBox::flowAwareMarginBeforeForChild):
3381         (WebCore::RenderFlexibleBox::crossAxisMarginExtentForChild):
3382         (WebCore::RenderFlexibleBox::flowAwareLocationForChild):
3383         (WebCore::RenderFlexibleBox::useChildAspectRatio):
3384         (WebCore::RenderFlexibleBox::computeMainSizeFromAspectRatioUsing):
3385         (WebCore::RenderFlexibleBox::setFlowAwareLocationForChild):
3386         (WebCore::RenderFlexibleBox::mainAxisLengthIsDefinite):
3387         (WebCore::RenderFlexibleBox::crossAxisLengthIsDefinite):
3388         (WebCore::RenderFlexibleBox::cacheChildMainSize):
3389         (WebCore::RenderFlexibleBox::clearCachedMainSizeForChild):
3390         (WebCore::RenderFlexibleBox::computeInnerFlexBaseSizeForChild):
3391         (WebCore::RenderFlexibleBox::layoutFlexItems):
3392         (WebCore::RenderFlexibleBox::autoMarginOffsetInMainAxis):
3393         (WebCore::RenderFlexibleBox::updateAutoMarginsInMainAxis):
3394         (WebCore::RenderFlexibleBox::hasAutoMarginsInCrossAxis):
3395         (WebCore::RenderFlexibleBox::availableAlignmentSpaceForChild):
3396         (WebCore::RenderFlexibleBox::updateAutoMarginsInCrossAxis):
3397         (WebCore::RenderFlexibleBox::marginBoxAscentForChild):
3398         (WebCore::RenderFlexibleBox::computeChildMarginValue):
3399         (WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax):
3400         (WebCore::RenderFlexibleBox::crossSizeForPercentageResolution):
3401         (WebCore::RenderFlexibleBox::mainSizeForPercentageResolution):
3402         (WebCore::RenderFlexibleBox::childLogicalHeightForPercentageResolution):
3403         (WebCore::RenderFlexibleBox::adjustChildSizeForAspectRatioCrossAxisMinAndMax):
3404         (WebCore::RenderFlexibleBox::constructFlexItem):
3405         (WebCore::RenderFlexibleBox::freezeViolations):
3406         (WebCore::RenderFlexibleBox::freezeInflexibleItems):
3407         (WebCore::RenderFlexibleBox::resolveFlexibleLengths):
3408         (WebCore::alignmentOffset):
3409         (WebCore::RenderFlexibleBox::setOverrideMainAxisContentSizeForChild):
3410         (WebCore::RenderFlexibleBox::staticMainAxisPositionForPositionedChild):
3411         (WebCore::RenderFlexibleBox::staticCrossAxisPositionForPositionedChild):
3412         (WebCore::RenderFlexibleBox::staticInlinePositionForPositionedChild):
3413         (WebCore::RenderFlexibleBox::staticBlockPositionForPositionedChild):
3414         (WebCore::RenderFlexibleBox::setStaticPositionForPositionedLayout):
3415         (WebCore::RenderFlexibleBox::prepareChildForPositionedLayout):
3416         (WebCore::RenderFlexibleBox::alignmentForChild):
3417         (WebCore::RenderFlexibleBox::resetAutoMarginsAndLogicalTopInCrossAxis):
3418         (WebCore::RenderFlexibleBox::needToStretchChildLogicalHeight):
3419         (WebCore::RenderFlexibleBox::childHasIntrinsicMainAxisSize):
3420         (WebCore::RenderFlexibleBox::crossAxisOverflowForChild):
3421         (WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
3422         (WebCore::RenderFlexibleBox::layoutColumnReverse):
3423         (WebCore::initialAlignContentOffset):
3424         (WebCore::alignContentSpaceBetweenChildren):
3425         (WebCore::RenderFlexibleBox::alignFlexLines):
3426         (WebCore::RenderFlexibleBox::adjustAlignmentForChild):
3427         (WebCore::RenderFlexibleBox::alignChildren):
3428         (WebCore::RenderFlexibleBox::applyStretchAlignmentToChild):
3429         (WebCore::RenderFlexibleBox::flipForRightToLeftColumn):
3430         (WebCore::RenderFlexibleBox::flipForWrapReverse):
3431         (WebCore::RenderFlexibleBox::Violation::Violation): Deleted.
3432         (WebCore::RenderFlexibleBox::setCrossAxisExtent): Deleted.
3433         (WebCore::RenderFlexibleBox::flowAwareMarginAfterForChild): Deleted.
3434         (WebCore::RenderFlexibleBox::mainAxisBorderAndPaddingExtentForChild): Deleted.
3435         (WebCore::RenderFlexibleBox::mainAxisScrollbarExtentForChild): Deleted.
3436         (WebCore::RenderFlexibleBox::preferredMainAxisContentExtentForChild): Deleted.
3437         (WebCore::RenderFlexibleBox::computeNextFlexLine): Deleted.
3438         (WebCore::RenderFlexibleBox::setLogicalOverrideSize): Deleted.
3439         (WebCore::RenderFlexibleBox::numberOfInFlowPositionedChildren): Deleted.
3440         (WebCore::RenderFlexibleBox::needToStretchChild): Deleted.
3441         (WebCore::contentAlignmentNormalBehaviorFlexibleBox): Deleted.
3442         * rendering/RenderFlexibleBox.h:
3443         (WebCore::RenderFlexibleBox::orderIterator):
3444         (WebCore::RenderFlexibleBox::isFlexibleBoxImpl):
3445         * rendering/RenderFullScreen.h:
3446         * rendering/RenderGrid.cpp:
3447         (WebCore::selfAlignmentChangedToStretchInRowAxis):
3448         (WebCore::selfAlignmentChangedFromStretchInRowAxis):
3449         (WebCore::selfAlignmentChangedFromStretchInColumnAxis):
3450         (WebCore::RenderGrid::styleDidChange):
3451         (WebCore::RenderGrid::computeTrackBasedLogicalHeight):
3452         (WebCore::RenderGrid::computeTrackSizesForDefiniteSize):
3453         (WebCore::RenderGrid::gridGapForDirection):
3454         (WebCore::RenderGrid::guttersSize):
3455         (WebCore::RenderGrid::computeTrackSizesForIndefiniteSize):
3456         (WebCore::RenderGrid::computeAutoRepeatTracksCount):
3457         (WebCore::RenderGrid::trackSizesForComputedStyle):
3458         (WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
3459         (WebCore::RenderGrid::populateGridPositionsForDirection):
3460         (WebCore::RenderGrid::alignSelfForChild):
3461         (WebCore::RenderGrid::justifySelfForChild):
3462         (WebCore::RenderGrid::columnAxisPositionForChild):
3463         (WebCore::RenderGrid::rowAxisPositionForChild):
3464         (WebCore::RenderGrid::columnAxisOffsetForChild):
3465         (WebCore::RenderGrid::rowAxisOffsetForChild):
3466         (WebCore::RenderGrid::needToStretchChildLogicalHeight): Deleted.
3467         * rendering/RenderGrid.h:
3468         * rendering/RenderLayer.cpp:
3469         (WebCore::RenderLayer::updateScrollbarsAfterLayout):
3470         * rendering/RenderListBox.cpp:
3471         (WebCore::RenderListBox::computeLogicalHeight):
3472         * rendering/RenderTable.cpp:
3473         (WebCore::RenderTable::layout):
3474         * rendering/RenderTableCell.cpp:
3475         (WebCore::RenderTableCell::layout):
3476         * rendering/RenderTableSection.cpp:
3477         (WebCore::shouldFlexCellChild):
3478         (WebCore::RenderTableSection::relayoutCellIfFlexed):
3479         (WebCore::RenderTableSection::layoutRows):
3480         * rendering/RenderTableSection.h:
3481         * rendering/RenderTextControl.cpp:
3482         (WebCore::RenderTextControl::computeLogicalHeight):
3483         * rendering/style/RenderStyle.cpp:
3484         (WebCore::resolvedSelfAlignment):
3485         (WebCore::RenderStyle::resolvedAlignSelf):
3486         (WebCore::RenderStyle::resolvedJustifySelf):
3487         * rendering/style/RenderStyle.h:
3488         * style/RenderTreeUpdater.cpp:
3489         (WebCore::textRendererIsNeeded):
3490
3491 2017-02-28  Alex Christensen  <achristensen@webkit.org>
3492
3493         Main resource requests need cachePartition
3494         https://bugs.webkit.org/show_bug.cgi?id=168806
3495         <rdar://30639764>
3496
3497         Reviewed by Brady Eidson.
3498
3499         Test: http/tests/security/credentials-main-resource.html
3500
3501         r211751 caused an unintended regression on pages whose main resource is protected
3502         by basic authentication.  We were not setting the cache partition for main resource
3503         requests, and we use the cache partition now for credentials, so the credentials for
3504         the main resource were not being put into a partition in the CredentialStorage that
3505         would not be used for subresources of the page, whose requests had the correct partition
3506         for the domain of the page.  This caused users to have to enter their credentials twice,
3507         once for the main resource and once for any subresources.  This is fixed by using the
3508         domain from the main resource request as the cache partition.  Elsewhere the Document is
3509         used to get the cache partition, but there is no Document yet when requesting the main resource.
3510
3511         * loader/DocumentLoader.cpp:
3512         (WebCore::DocumentLoader::startLoadingMainResource):
3513         Set the cache partition for the main resource loads based on the SecurityOrigin of the
3514         initial request if we are loading the main resource for a new top document.  If the main resource
3515         request is redirected, then we will still use the partition of the initial request because that is
3516         what the user requested and that is where the user entered the credentials.
3517         * loader/cache/CachedResourceLoader.h:
3518         * loader/cache/CachedResourceRequest.cpp:
3519         (WebCore::CachedResourceRequest::setDomainForCachePartition):
3520         * loader/cache/CachedResourceRequest.h:
3521
3522 2017-02-28  Alex Christensen  <achristensen@webkit.org>
3523
3524         REGRESSION: LayoutTest http/tests/security/credentials-iframes.html is failing on ios-simulator
3525         https://bugs.webkit.org/show_bug.cgi?id=167967
3526
3527         Reviewed by Brady Eidson.
3528
3529         XHR credentials have a persistence of CredentialPersistenceNone because we keep
3530         them in the WebCore::CredentialStorage.  We were storing them to CFNetwork's NSURLCredentialStorage
3531         on iOS and then they were being given as the proposedCredential in
3532         NetworkDataTaskCocoa::tryPasswordBasedAuthentication even though we set CredentialPersistenceNone.
3533
3534         This fixes http/tests/security/credentials-iframes.html
3535
3536         * platform/network/CredentialStorage.cpp:
3537         (WebCore::CredentialStorage::set):
3538         * platform/network/CredentialStorage.h:
3539         * platform/network/cf/CredentialStorageCFNet.cpp:
3540         (WebCore::CredentialStorage::saveToPersistentStorage): Deleted.
3541         * platform/network/mac/CredentialStorageMac.mm:
3542         (WebCore::CredentialStorage::saveToPersistentStorage): Deleted.
3543
3544 2017-02-27  Alex Christensen  <achristensen@webkit.org>
3545
3546         Fix WinCairo build.
3547
3548         * PlatformWinCairo.cmake:
3549
3550 2017-02-27  Alex Christensen  <achristensen@webkit.org>
3551
3552         Begin enabling WebRTC on 64-bit
3553         https://bugs.webkit.org/show_bug.cgi?id=168915
3554
3555         Reviewed by Eric Carlson.
3556
3557         * Configurations/FeatureDefines.xcconfig:
3558
3559 2017-02-27  Antoine Quint  <graouts@apple.com>
3560
3561         [Modern Media Controls] Use compact mode by default on macOS
3562         https://bugs.webkit.org/show_bug.cgi?id=168958
3563         <rdar://problem/30748638>
3564
3565         Reviewed by Jon Lee.
3566
3567         We now use the compact layout mode by default on macOS.
3568
3569         * Modules/modern-media-controls/controls/layout-item.js: Remove the ReducedPadding trait.
3570         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css: 
3571         (.media-controls.mac.inline.compact .time-label,): Vertically align the time label with
3572         the scrubber in compact mode.
3573         (.media-controls.mac.inline.compact .scrubber.slider): Correctly position the scrubber in
3574         compact mode so that it's vertically aligned.
3575         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
3576         (MacOSInlineMediaControls.prototype.layoutTraitsDidChange): Remove handling of tight and
3577         reduced padding traits since these do not apply to macOS anymore. We also notify the
3578         scrubber of a layout trait change so that it may adjust its height.
3579         * Modules/modern-media-controls/controls/scrubber.js:
3580         (Scrubber):
3581         (Scrubber.prototype.layoutTraitsDidChange): Adjust the height of the scrubber to match
3582         compact layout traits.
3583         * Modules/modern-media-controls/controls/time-control.js:
3584         (TimeControl.prototype.get isSufficientlyWide): Adjust the minimum scrubber width for
3585         TimeControl visibility to match compact layout traits.
3586         * Modules/modern-media-controls/media/media-controller.js:
3587         (MediaController.prototype.get layoutTraits): Use the compact layout trait by default
3588         on macOS and make the tight padding specific to iOS.
3589
3590 2017-02-27  Antoine Quint  <graouts@apple.com>
3591
3592         [Modern Media Controls] Adhere to tight padding on iOS
3593         https://bugs.webkit.org/show_bug.cgi?id=168949
3594         <rdar://problem/30746164>
3595
3596         Reviewed by Jon Lee.
3597
3598         We used to only support custom margins on macOS, to support this on iOS as
3599         well, we promote the notification when the layoutTraits property is set to
3600         MediaControls and expose a new protected method layoutTraitsDidChange() for
3601         subclasses to implement. IOSInlineMediaControls now implements that method
3602         and will use tighter margins for the TightPadding layout trait.
3603
3604         Test: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-tight-padding.html
3605
3606         * Modules/modern-media-controls/controls/ios-inline-media-controls.js:
3607         (IOSInlineMediaControls.prototype.layoutTraitsDidChange):
3608         (IOSInlineMediaControls):
3609         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
3610         (MacOSInlineMediaControls.prototype.get layoutTraits): Deleted.
3611         (MacOSInlineMediaControls.prototype.set layoutTraits): Deleted.
3612         (MacOSInlineMediaControls.prototype._matchLayoutTraits): Deleted.
3613         * Modules/modern-media-controls/controls/media-controls.js:
3614         (MediaControls.prototype.get layoutTraits):
3615         (MediaControls.prototype.set layoutTraits):
3616         (MediaControls.prototype.layoutTraitsDidChange):
3617
3618 2017-02-27  Youenn Fablet  <youenn@apple.com>
3619
3620         [WebRTC] Support modern RTCStatsReport
3621         https://bugs.webkit.org/show_bug.cgi?id=166916
3622         <rdar://problem/30293780>
3623
3624         Reviewed by Alex Christensen.
3625
3626         Updating binding generator and IDL parser to handle maplike.
3627         Covered by binding tests.
3628
3629         Added support for maplike binding from JS wrapper to DOM class.
3630         The principle is to have the JSXX wrapper having a @backingMap slot containing a Map.
3631         All maplike methods are forwarded to the corresponding Map methods.
3632         The XX object is responsible to add key/value pairs using a helper routine.
3633         The creation of the Map is done at creation of the JSXX wrapper.
3634
3635         DOM class is interacting with the map through DOMMapLike.
3636         Extracted DOMGuarded from DOM promise implementation.
3637         This allows reusing this code for DOMMapLike.
3638
3639         Covered by binding tests and manual tests.
3640
3641         * CMakeLists.txt:
3642         * DerivedSources.make:
3643         * Modules/mediastream/RTCStatsReport.h:
3644         (WebCore::RTCStatsReport::InboundRTPStreamStats::InboundRTPStreamStats):
3645         (WebCore::RTCStatsReport::OutboundRTPStreamStats::OutboundRTPStreamStats):
3646         (WebCore::RTCStatsReport::create):
3647         (WebCore::RTCStatsReport::synchronizeBackingMap):
3648         (WebCore::RTCStatsReport::backingMap):
3649         (WebCore::RTCStatsReport::addStats):
3650         * Modules/mediastream/RTCStatsReport.idl:
3651         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3652         (WebCore::fromStdString):
3653         (WebCore::fillRTCStats):
3654         (WebCore::fillRTCRTPStreamStats):
3655         (WebCore::fillInboundRTPStreamStats):
3656         (WebCore::fillOutboundRTPStreamStats):
3657         (WebCore::LibWebRTCMediaEndpoint::StatsCollector::OnStatsDelivered):
3658         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
3659         * WebCore.xcodeproj/project.pbxproj:
3660         * bindings/js/JSDOMBindingInternals.js: Added.
3661         (mapLikeForEach):
3662         * bindings/js/JSDOMGlobalObject.cpp:
3663         (WebCore::JSDOMGlobalObject::visitChildren):
3664         * bindings/js/JSDOMGlobalObject.h:
3665         * bindings/js/JSDOMGuardedObject.cpp: Added.
3666         (WebCore::DOMGuardedObject::DOMGuardedObject):
3667         (WebCore::DOMGuardedObject::~DOMGuardedObject):
3668         (WebCore::DOMGuardedObject::clear):
3669         (WebCore::DOMGuardedObject::contextDestroyed):
3670         * bindings/js/JSDOMGuardedObject.h: Added.
3671         (WebCore::DOMGuardedObject::isSuspended):
3672         (WebCore::DOMGuardedObject::visitAggregate):
3673         (WebCore::DOMGuardedObject::guardedObject):
3674         (WebCore::DOMGuardedObject::globalObject):
3675         (WebCore::DOMGuardedObject::isEmpty):
3676         (WebCore::DOMGuarded::DOMGuarded):
3677         (WebCore::DOMGuarded::guarded):
3678         * bindings/js/JSDOMMapLike.cpp: Added.
3679         (WebCore::getBackingMap):
3680         (WebCore::initializeBackingMap):
3681         (WebCore::createBackingMap):
3682         (WebCore::forwardAttributeGetterToBackingMap):
3683         (WebCore::forwardFunctionCallToBackingMap):
3684         (WebCore::forwardForEachCallToBackingMap):
3685         * bindings/js/JSDOMMapLike.h: Added.
3686         (WebCore::DOMMapLike::set):
3687         (WebCore::synchronizeBackingMap):
3688         (WebCore::forwardSizeToMapLike):
3689         (WebCore::forwardEntriesToMapLike):
3690         (WebCore::forwardKeysToMapLike):
3691         (WebCore::forwardValuesToMapLike):
3692         (WebCore::forwardClearToMapLike):
3693         (WebCore::forwardForEachToMapLike):
3694         (WebCore::forwardHasToMapLike):
3695         (WebCore::forwardAddToMapLike):
3696         (WebCore::forwardDeleteToMapLike):
3697         * bindings/js/JSDOMPromise.cpp:
3698         (WebCore::DeferredPromise::promise):
3699         (WebCore::DeferredPromise::reject):
3700         * bindings/js/JSDOMPromise.h:
3701         (WebCore::DeferredPromise::resolve):
3702         (WebCore::DeferredPromise::resolveWithNewlyCreated):
3703         (WebCore::DeferredPromise::reject):
3704         (WebCore::DeferredPromise::resolveWithCallback):
3705         (WebCore::DeferredPromise::rejectWithCallback):
3706         (WebCore::DeferredPromise::DeferredPromise):
3707         (WebCore::DeferredPromise::deferred):
3708         * bindings/js/WebCoreBuiltinNames.h:
3709         * bindings/scripts/CodeGeneratorJS.pm:
3710         (PrototypeFunctionCount):
3711         (GeneratePropertiesHashTable):
3712         (InterfaceNeedsIterator):
3713         (GenerateImplementation):
3714         (GenerateParametersCheck):
3715         * bindings/scripts/IDLParser.pm:
3716         (assert):
3717         (parseAttributeOrOperationOrIterator):
3718         (parseSerializer):
3719         (parseAttributeOrOperationRest):
3720         (parseAttribute):
3721         (parseAttributeRest):
3722         (parseOperationOrIterator):
3723         (parseOptionalIterableInterface):
3724         (parseMapLikeRest):
3725         (parseMapLikeProperties):
3726         (parseOperationRest):
3727         (applyMemberList):
3728         * bindings/scripts/test/JS/JSMapLike.cpp: Added.
3729         * bindings/scripts/test/JS/JSMapLike.h: Added.
3730         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: Added.
3731         * bindings/scripts/test/JS/JSReadOnlyMapLike.h: Added.
3732         * bindings/scripts/test/TestMapLike.idl: Added.
3733         * bindings/scripts/test/TestReadOnlyMapLike.idl: Added.
3734
3735 2017-02-27  Mark Lam  <mark.lam@apple.com>
3736
3737         Introduce a VM Traps mechanism and refactor Watchdog to use it.
3738         https://bugs.webkit.org/show_bug.cgi?id=168842
3739
3740         Reviewed by Filip Pizlo.
3741
3742         No new tests needed because this is a re-implementation of existing functionality.
3743
3744         * bindings/js/WorkerScriptController.cpp:
3745         (WebCore::WorkerScriptController::WorkerScriptController):
3746         (WebCore::WorkerScriptController::scheduleExecutionTermination):
3747
3748 2017-02-27  Andy Estes  <aestes@apple.com>
3749
3750         [Cocoa] Rename FileMac.mm to FileCocoa.mm
3751         https://bugs.webkit.org/show_bug.cgi?id=168947
3752
3753         Reviewed by Zalan Bujtas.
3754
3755         * PlatformMac.cmake:
3756         * WebCore.xcodeproj/project.pbxproj:
3757         * fileapi/FileCocoa.mm: Renamed from Source/WebCore/fileapi/FileMac.mm.
3758
3759 2017-02-27  Andy Estes  <aestes@apple.com>
3760
3761         [iOS] Enable file replacement
3762         https://bugs.webkit.org/show_bug.cgi?id=168907
3763         <rdar://problem/22258242>
3764
3765         Reviewed by David Kilzer.
3766
3767         Covered by existing tests.
3768
3769         * fileapi/FileMac.mm:
3770         (WebCore::File::shouldReplaceFile): Stop using Carbon and AppKit API for determining if a
3771         file path is a file package. Use NSURL and CoreServices instead, which exist on Mac and iOS.
3772
3773 2017-02-27  Antoine Quint  <graouts@apple.com>
3774
3775         [Modern Media Controls] Use a solid background for <audio> controls on macOS
3776         https://bugs.webkit.org/show_bug.cgi?id=168941
3777         <rdar://problem/30744316>
3778
3779         Reviewed by Dean Jackson.
3780
3781         Use a solid background for <audio> elements on macOS, the same way we do on iOS.
3782
3783         Test: media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-audio-background.html
3784
3785         * Modules/modern-media-controls/controls/macos-media-controls.css:
3786         (:host(audio) .media-controls.mac.inline > .controls-bar):
3787         (:host(audio) .media-controls.mac.inline > .controls-bar > .background-tint):
3788
3789 2017-02-27  Antoine Quint  <graouts@apple.com>
3790
3791         [Modern Media Controls] StatusLabel should use similar properties to TimeLabel
3792         https://bugs.webkit.org/show_bug.cgi?id=168938
3793         <rdar://problem/30743185>
3794
3795         Reviewed by Dean Jackson.
3796
3797         Ensure we use the same styling properties for StatusLabel and TimeLabel.
3798
3799         Tests: media/modern-media-controls/status-label/status-label-ios.html
3800                media/modern-media-controls/status-label/status-label-macos.html
3801
3802         * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
3803         (.media-controls.ios.inline .time-label,):
3804         (.media-controls.ios.inline .time-label): Deleted.
3805         * Modules/modern-media-controls/controls/macos-media-controls.css:
3806         (.media-controls.mac > .controls-bar .time-label,):
3807         (.media-controls.mac > .controls-bar .time-label): Deleted.
3808         * Modules/modern-media-controls/controls/status-label.css:
3809         (.status-label):
3810
3811 2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
3812
3813         Rename ICU cursor iterator to caret iterator
3814         https://bugs.webkit.org/show_bug.cgi?id=168206
3815
3816         Reviewed by Simon Fraser.
3817
3818         Mechanical find/replace.
3819
3820         No new tests because there is no behavior change.
3821
3822         * platform/graphics/ComplexTextController.cpp:
3823         (WebCore::ComplexTextController::offsetForPosition):
3824         * rendering/RenderText.cpp:
3825         (WebCore::RenderText::previousOffset):
3826         (WebCore::RenderText::nextOffset):
3827
3828 2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
3829
3830         Unprefix -webkit-line-break
3831         https://bugs.webkit.org/show_bug.cgi?id=168213
3832
3833         Reviewed by Darin Adler.
3834
3835         We support the property as specced.
3836
3837         Test: fast/text/line-break-unprefixed.html
3838
3839         * css/CSSComputedStyleDeclaration.cpp:
3840         (WebCore::ComputedStyleExtractor::propertyValue):
3841         * css/CSSProperties.json:
3842         * css/parser/CSSParserFastPaths.cpp:
3843         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
3844         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
3845         * editing/Editor.cpp:
3846         (WebCore::Editor::applyEditingStyleToElement):
3847         * html/HTMLElement.cpp:
3848         (WebCore::HTMLElement::collectStyleForPresentationAttribute):
3849
3850 2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
3851
3852         Use RAII for ICU breaking iterators
3853         https://bugs.webkit.org/show_bug.cgi?id=168203
3854
3855         Reviewed by Simon Fraser.
3856
3857         No new tests because there is no behavior change.
3858
3859         * platform/graphics/ComplexTextController.cpp:
3860         (WebCore::ComplexTextController::offsetForPosition):
3861         * rendering/RenderText.cpp:
3862         (WebCore::RenderText::previousOffset):
3863         (WebCore::RenderText::nextOffset):
3864
3865 2017-02-27  Basuke Suzuki  <Basuke.Suzuki@am.sony.com>
3866
3867         [WinCairo][MiniBrowser] Add ca-bundle to display secure pages
3868         https://bugs.webkit.org/show_bug.cgi?id=168486
3869
3870         Reviewed by Alex Christensen.
3871
3872         change the order of path location search to make it possible to 
3873         configure with environment variable because bundled ca-bundle is
3874         always available now.
3875
3876         * platform/network/curl/ResourceHandleManager.cpp:
3877         (WebCore::certificatePath):
3878
3879 2017-02-27  Antoine Quint  <graouts@apple.com>
3880
3881         [Modern Media Controls] Status text does not appear on iOS
3882         https://bugs.webkit.org/show_bug.cgi?id=168918
3883         <rdar://problem/30737644>
3884
3885         Reviewed by Dean Jackson.
3886
3887         We refactor the layout code out of MacOSInlineMediaControls and into a new
3888         InlineLayoutSupport class which IOSInlineMediaControls uses as well. Now
3889         both the macOS and iOS inline media controls run the same layout logic to
3890         control whether the status label or scrubber should be displayed, and which
3891         controls should be dropped due to space constraints.
3892
3893         Test: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-status-label.html
3894
3895         * Modules/modern-media-controls/controls/inline-layout-support.js: Added.
3896         (InlineLayoutSupport):
3897         (InlineLayoutSupport.prototype.childrenAfterPerformingLayout):
3898         * Modules/modern-media-controls/controls/ios-inline-media-controls.js:
3899         (IOSInlineMediaControls.prototype.layout):
3900         (IOSInlineMediaControls):
3901         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
3902         (MacOSInlineMediaControls.prototype.layout):
3903         * Modules/modern-media-controls/js-files:
3904
3905 2017-02-27  Simon Fraser  <simon.fraser@apple.com>
3906
3907         Add specification and status metadata to CSSProperties.json, and validate it
3908         https://bugs.webkit.org/show_bug.cgi?id=168901
3909
3910         Reviewed by Darin Adler.
3911
3912         Annotate CSS properties with data about the WebKit development status, and
3913         where they are specified. A property has a canonical specification reference,
3914         but individual values may have a reference to a more recent spec.
3915
3916         Add a list of specifications to the JSON that properties reference by key.
3917
3918         Enhance check-webkit-style to validate the status and spec data.
3919
3920         * css/CSSProperties.json:
3921
3922 2017-02-27  Jiewen Tan  <jiewen_tan@apple.com>
3923
3924         [CredentialManagement] Add IDL definitions for Credential, SiteBoundCredential, and PasswordCredential
3925         https://bugs.webkit.org/show_bug.cgi?id=168616
3926         <rdar://problem/30167149>
3927
3928         Reviewed by Daniel Bates.
3929
3930         This patch adds IDL definitions for:
3931         1. Credential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-credential),
3932         2. SiteBoundCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-siteboundcredential), and
3933         3. PasswordCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-passwordcredential).
3934
3935         Test: credentials/idlharness.html
3936
3937         * CMakeLists.txt:
3938         * DerivedSources.make:
3939         * Modules/credentials/BasicCredential.cpp: Added.
3940         (WebCore::BasicCredential::BasicCredential):
3941         (WebCore::BasicCredential::~BasicCredential):
3942         (WebCore::BasicCredential::type):
3943         * Modules/credentials/BasicCredential.h: Added.
3944         (WebCore::BasicCredential::id):
3945         * Modules/credentials/BasicCredential.idl: Added.
3946         * Modules/credentials/CredentialData.h: Added.