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