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