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