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