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