4756c9b8a8cbdaa1c06ea4ffaf36d515e6557c59
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-11-24  Antoine Quint  <graouts@apple.com>
2
3         [Web Animations] Allow getComputedStyle() to return animated values for accelerated animations
4         https://bugs.webkit.org/show_bug.cgi?id=179975
5         <rdar://problem/35676811>
6
7         Reviewed by Dean Jackson.
8
9         In case we're running an accelerated animation, we are not blending RenderStyles as the animation
10         progresses and thus we need to hook into computeRenderStyleForProperty() to query the DocumentTimeline
11         for the animated style of running accelerated animations where we blend styles manually for the
12         animation's current time.
13
14         Test: http/wpt/wk-web-animations/interfaces/keyframe-effect-getComputedStyle.html
15
16         * animation/DocumentTimeline.cpp:
17         (WebCore::DocumentTimeline::animatedStyleForRenderer): Iterate through all running accelerated animations
18         for the element to which the provided renderer is attached and ask for their animated styles.
19         * animation/DocumentTimeline.h:
20         * animation/KeyframeEffect.cpp:
21         (WebCore::KeyframeEffect::getAnimatedStyle): Manually blend all animated properties and populate the provided
22         RenderStyle with their values, creating the RenderStyle if needed.
23         * animation/KeyframeEffect.h:
24         * css/CSSComputedStyleDeclaration.cpp:
25         (WebCore::computeRenderStyleForProperty): Query the DocumentTimeline for accelerated animated properties in
26         case such animations are running, otherwise let the CSS animation controller report the animated values.
27
28 2017-11-24  Zan Dobersek  <zdobersek@igalia.com>
29
30         [CoordGraphics] CoordinatedGraphicsLayer::updateContentBuffers() should always assume a non-null CoordinatedBuffer
31         https://bugs.webkit.org/show_bug.cgi?id=179977
32
33         Reviewed by Carlos Garcia Campos.
34
35         CoordinatedGraphicsLayer::updateContentBuffers() retrieves a RefPtr<CoordinatedBuffer>
36         from the CompositingCoordinator. This pointer should never be null since if no
37         existing UpdateAtlas can provide the necessary memory area, a fresh UpdateAtlas is
38         created and its buffer returned. This can't fail in theory since the tiles that are
39         being updated are smaller than the UpdateAtlas area.
40
41         The CoordinatedGraphicsLayerClient::getCoordinatedBuffer() method is updated to
42         always return a Ref<CoordinatedBuffer> value. Code in updateContentBuffers() is
43         updated to remove a null-check on what is now the Ref<CoordinatedBuffer> value.
44
45         No new tests -- no change in functionality.
46
47         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
48         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
49         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
50
51 2017-11-23  Antoine Quint  <graouts@apple.com>
52
53         [Web Animations] Perform accelerated animations when possible
54         https://bugs.webkit.org/show_bug.cgi?id=179973
55         <rdar://problem/34953922>
56
57         Reviewed by Dean Jackson.
58
59         When we're entering and leaving the active duration of an animation effect, we now check
60         whether the animation can be accelerated, using the existing CSSPropertyAnimation::animationOfPropertyIsAccelerated()
61         utility, and start and stop animations using the startAnimation() and animationFinished() functions on RenderBoxModelObject.
62
63         This patch is only a first step towards full support for accelerated animations,
64         there are two known issues at the moment. Because we're not blending the styles to perform
65         the animation, getComputedStyle() will not return the animated value (webkit.org/b/179974).
66         Additionally, if other animations happen to run later during the active state of an animation
67         that can run accelerated, we will not fall back to software-only animation for this
68         element and these animations will appear not to run (webkit.org/b/179975). These will be
69         addressed in follow-up patches.
70
71         Tests: webanimations/left-and-opacity-animation-yields-no-compositing.html
72                webanimations/opacity-animation-no-longer-composited-upon-completion.html
73                webanimations/opacity-animation-yields-compositing.html
74                webanimations/width-and-opacity-separate-animation-yields-no-compositing.html
75
76         * animation/DocumentTimeline.cpp:
77         (WebCore::DocumentTimeline::updateAnimations): Check in the map of pending accelerated animations
78         to see if any animation requires toggling their active state after their styles have been invalidated.
79         (WebCore::DocumentTimeline::animationAcceleratedRunningStateDidChange): New function to
80         let animations indicate that they need to have their accelerated backing animation toggled after
81         style invalidation has been completed.
82         (WebCore::DocumentTimeline::runningAnimationsForElementAreAllAccelerated): This function is used
83         in RenderLayerCompositor::requiresCompositingForAnimation() to identify whether an element requires
84         hardware compositing due to running accelerated animations. We check all running animations for the
85         provided element to see if they can all be running accelerated and return true in this situation only.
86         * animation/DocumentTimeline.h:
87         * animation/KeyframeEffect.cpp:
88         (WebCore::KeyframeEffect::applyAtLocalTime): Identify if we're crossing into or out of the active state
89         for an animation and check if it will be or has been running accelerated such that we can notify the
90         DocumentTimeline, through the associated animation, that the accelerated backing animation will need to
91         be toggled after style invalidation has been completed.
92         (WebCore::KeyframeEffect::shouldRunAccelerated): Check that all properties for this animation
93         effect can be accelerated according to CSSPropertyAnimation::animationOfPropertyIsAccelerated().
94         (WebCore::KeyframeEffect::startOrStopAccelerated): Start or stop the associated accelerated
95         animation through the associated element's RenderBoxModelObject renderer.
96         * animation/KeyframeEffect.h:
97         * animation/WebAnimation.cpp:
98         (WebCore::WebAnimation::acceleratedRunningStateDidChange): Called from AnimationEffect::applyAtLocalTime(),
99         we forward to the DocumentTimeline the information that the animation will cross an active state boundary while
100         allowing to be backed by hardware compositing.
101         (WebCore::WebAnimation::startOrStopAccelerated): Forward to the associated KeyframeEffect that accelerated
102         animation backing should be toggled.
103         * animation/WebAnimation.h:
104         * rendering/RenderLayerCompositor.cpp:
105         (WebCore::RenderLayerCompositor::requiresCompositingForAnimation const): Check via the renderer's element's
106         DocumentTimeline that all running animations for this particular element are accelerated to ensure that
107         the element will be hardware-composited.
108
109 2017-11-23  Fujii Hironori  <Hironori.Fujii@sony.com>
110
111         [Win] PasteboardWin.cpp(653): error C2039: 'containsOnlyASCII': is not a member of 'WTF::String'
112         https://bugs.webkit.org/show_bug.cgi?id=179991
113
114         Unreviewed build fix.
115
116         No new tests (No behaviour change).
117
118         * platform/win/PasteboardWin.cpp:
119         (WebCore::Pasteboard::writeURLToDataObject): Renamed containsOnlyASCII() to isAllASCII().
120
121 2017-11-23  Carlos Alberto Lopez Perez  <clopez@igalia.com>
122
123         [GTK] [Debug] Fix build after r225117.
124         https://bugs.webkit.org/show_bug.cgi?id=179907
125
126         Unreviewed build fix.
127
128         r225117 renamed containsOnlyASCII() to isAllASCII().
129         And this reference was not updated for the GTK Debug build.
130
131         No new tests, its a build fix.
132
133         * loader/archive/mhtml/MHTMLArchive.cpp:
134         (WebCore::MHTMLArchive::generateMHTMLData):
135
136 2017-11-23  Simon Fraser  <simon.fraser@apple.com>
137
138         FELighting cleanup and optimization
139         https://bugs.webkit.org/show_bug.cgi?id=179933
140
141         Reviewed by Darin Adler.
142
143         Make FELighting about 25% faster by maintaining an "alpha" window of the alpha
144         values of the 9 pixels surrounding the current pixel, and sliding this window over
145         when moving to the next pixel. This avoids reading the same alpha values from the original
146         buffer multiple times.
147
148         Clean up LightSource and subclasses, adding SPECIALIZE_TYPE_TRAITS macros,
149         and turning updatePaintingData() into a function with no side effects that returns
150         the required data.
151
152         Remove explicit 'inline' keywords, allowing the compiler to make inlining decisions.
153
154         * platform/graphics/cpu/arm/filters/FELightingNEON.h:
155         (WebCore::FELighting::platformApplyNeon):
156         * platform/graphics/filters/DistantLightSource.cpp:
157         (WebCore::DistantLightSource::initPaintingData):
158         (WebCore::DistantLightSource::computePixelLightingData const):
159         (WebCore::DistantLightSource::updatePaintingData): Deleted.
160         * platform/graphics/filters/DistantLightSource.h:
161         * platform/graphics/filters/FELighting.cpp:
162         (WebCore::FELighting::LightingData::interiorNormal const):
163         (WebCore::FELighting::setPixel):
164         (WebCore::FELighting::setPixelInternal):
165         (WebCore::FELighting::platformApplyGenericPaint):
166         (WebCore::FELighting::platformApplyGeneric):
167         (WebCore::FELighting::platformApply):
168         (WebCore::FELighting::drawLighting):
169         (WebCore::FELighting::inlineSetPixel): Deleted.
170         * platform/graphics/filters/FELighting.h:
171         (WebCore::FELighting::AlphaWindow::topLeft const):
172         (WebCore::FELighting::AlphaWindow::left const):
173         (WebCore::FELighting::AlphaWindow::bottomLeft const):
174         (WebCore::FELighting::AlphaWindow::top const):
175         (WebCore::FELighting::AlphaWindow::center const):
176         (WebCore::FELighting::AlphaWindow::bottom const):
177         (WebCore::FELighting::AlphaWindow::setTop):
178         (WebCore::FELighting::AlphaWindow::setCenter):
179         (WebCore::FELighting::AlphaWindow::setBottom):
180         (WebCore::FELighting::AlphaWindow::setTopRight):
181         (WebCore::FELighting::AlphaWindow::setRight):
182         (WebCore::FELighting::AlphaWindow::setBottomRight):
183         (WebCore::FELighting::AlphaWindow::shiftRow):
184         (WebCore::FELighting::AlphaWindow::shift):
185         * platform/graphics/filters/LightSource.h:
186         * platform/graphics/filters/PointLightSource.cpp:
187         (WebCore::PointLightSource::computePixelLightingData const):
188         (WebCore::PointLightSource::updatePaintingData): Deleted.
189         * platform/graphics/filters/PointLightSource.h:
190         * platform/graphics/filters/SpotLightSource.cpp:
191         (WebCore::SpotLightSource::initPaintingData):
192         (WebCore::SpotLightSource::computePixelLightingData const):
193         (WebCore::SpotLightSource::updatePaintingData): Deleted.
194         * platform/graphics/filters/SpotLightSource.h:
195
196 2017-11-23  Simon Fraser  <simon.fraser@apple.com>
197
198         Add support for CanvasPattern.setTransform()
199         https://bugs.webkit.org/show_bug.cgi?id=179935
200
201         Reviewed by Sam Weinig.
202         
203         Add support for setTransform() on CanvasPattern, per
204         <https://html.spec.whatwg.org/multipage/canvas.html#dom-canvaspattern-settransform>
205         It uses [MayThrowException] since the "validate and fixup" steps for DOMMatrix can throw
206         an exception.
207         
208         Under the hood, the transform is just pushed onto Pattern as the patternSpaceTransform().
209         
210         Minor cleanup in Pattern.
211
212         Test: fast/canvas/canvas-pattern-with-transform.html
213
214         * html/canvas/CanvasPattern.cpp:
215         (WebCore::CanvasPattern::setTransform):
216         * html/canvas/CanvasPattern.h:
217         * html/canvas/CanvasPattern.idl:
218         * platform/graphics/Pattern.h:
219
220 2017-11-23  Sam Weinig  <sam@webkit.org>
221
222         Remove unneeded ScriptController::processingUserGesture() forwarding functions
223         https://bugs.webkit.org/show_bug.cgi?id=179954
224
225         Reviewed by Darin Adler.
226
227         Replace ScriptController::processingUserGesture() and ScriptController::processingUserGestureForMedia()
228         with direct calls to the corresponding UserGestureIndicator functions.
229
230         * Modules/applepay/ApplePaySession.cpp:
231         (WebCore::ApplePaySession::create):
232         (WebCore::ApplePaySession::openPaymentSetup):
233         * Modules/speech/SpeechSynthesis.cpp:
234         (WebCore::SpeechSynthesis::speak):
235         * bindings/js/ScriptController.cpp:
236         (WebCore::ScriptController::processingUserGesture): Deleted.
237         (WebCore::ScriptController::processingUserGestureForMedia): Deleted.
238         * bindings/js/ScriptController.h:
239         * dom/Document.cpp:
240         (WebCore::Document::processingUserGestureForMedia const):
241         * html/BaseChooserOnlyDateAndTimeInputType.cpp:
242         (WebCore::BaseChooserOnlyDateAndTimeInputType::handleDOMActivateEvent):
243         * html/ColorInputType.cpp:
244         (WebCore::ColorInputType::handleDOMActivateEvent):
245         * html/FileInputType.cpp:
246         (WebCore::FileInputType::handleDOMActivateEvent):
247         * html/HTMLFormElement.cpp:
248         (WebCore::HTMLFormElement::submitFromJavaScript):
249         * html/HTMLPlugInImageElement.cpp:
250         (WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement):
251         (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn):
252         * loader/FrameLoader.cpp:
253         (WebCore::FrameLoader::submitForm):
254         (WebCore::shouldOpenExternalURLsPolicyToApply):
255         * page/DOMWindow.cpp:
256         (WebCore::DOMWindow::allowPopUp):
257         (WebCore::DOMWindow::setLocation):
258         (WebCore::DOMWindow::createWindow):
259         (WebCore::DOMWindow::open):
260         * page/PointerLockController.cpp:
261         (WebCore::PointerLockController::requestPointerLock):
262
263 2017-11-22  Dean Jackson  <dino@apple.com>
264
265         Add a base class for HTMLCanvasElement and OffscreenCanvas
266         https://bugs.webkit.org/show_bug.cgi?id=179701
267         <rdar://problem/35545195>
268
269         Post-review updates from Darin Adler review.
270
271         * html/CanvasBase.cpp:
272         (WebCore::CanvasBase::asHTMLCanvasElement): Deleted. Replaced by having the call
273         sites get the reference and do the correct downcast<>.
274         * html/CanvasBase.h: Remove asHTMLCanvasElement. Add pure virtual ref/deref functions
275         so they can be overridden by subclasses. Unfortunately they can't be called ref/deref otherwise
276         they conflict with Node.
277         * html/HTMLCanvasElement.h: Add the type traits, so is<HTMLCanvasElement>(canvasBase) will
278         work.
279         * html/HTMLTagNames.in: Specify the <canvas> element as having custom type traits.
280         * html/OffscreenCanvas.h: Lots of overrides to finals.
281         * html/canvas/CanvasRenderingContext.cpp: Use canvasBase.de/refCanvasBase rather than
282         casting.
283         (WebCore::CanvasRenderingContext::ref):
284         (WebCore::CanvasRenderingContext::deref):
285         * html/canvas/CanvasRenderingContext.h: Lots of overrides to finals.
286         * html/canvas/CanvasRenderingContext2D.h:
287         * html/canvas/ImageBitmapRenderingContext.cpp:
288         (WebCore::ImageBitmapRenderingContext::canvas const):
289         * html/canvas/WebGLRenderingContextBase.cpp:
290         (WebCore::WebGLRenderingContextBase::create):
291         (WebCore::WebGLRenderingContextBase::canvas):
292         * html/canvas/WebGPURenderingContext.cpp:
293         (WebCore::WebGPURenderingContext::canvas const):
294         * inspector/InspectorInstrumentation.h:
295         (WebCore::InspectorInstrumentation::recordCanvasAction):
296         * inspector/agents/InspectorCanvasAgent.cpp:
297         (WebCore::InspectorCanvasAgent::recordCanvasAction):
298
299 2017-11-23  Darin Adler  <darin@apple.com>
300
301         Reduce WTF::String operations that do unnecessary Unicode operations instead of ASCII
302         https://bugs.webkit.org/show_bug.cgi?id=179907
303
304         Reviewed by Sam Weinig.
305
306         * Modules/plugins/YouTubePluginReplacement.cpp:
307         (WebCore::hasCaseInsensitivePrefix): Deleted.
308         (WebCore::processAndCreateYouTubeURL): Use startsWithLettersIgnoringASCIICase.
309
310         * Modules/websockets/WebSocketHandshake.cpp:
311         (WebCore::WebSocketHandshake::readHTTPHeaders): Use isAllASCII.
312
313         * accessibility/atk/AccessibilityObjectAtk.cpp:
314         (WebCore::AccessibilityObject::getLengthForTextRange const): Use text().length().
315
316         * accessibility/AXObjectCache.cpp:
317         (WebCore::AXObjectCache::traverseToOffsetInRange): Use isHTMLSpace instead of
318         isSpaceOrNewline since the code is trying to skip collapsible HTML spaces, not
319         arbitrary Unicode whitespace.
320         * accessibility/AccessibilityList.cpp:
321         (WebCore::AccessibilityList::childHasPseudoVisibleListItemMarkers): Use
322         isAllSpecialCharacters<isHTMLSpace> for the same reason as above.
323
324         * accessibility/AccessibilityNodeObject.cpp:
325         (WebCore::AccessibilityNodeObject::isSearchField const): Use containsIgnoringASCIICase.
326
327         * accessibility/AccessibilityObject.cpp:
328         (WebCore::AccessibilityObject::accessibilityObjectContainsText const): Use
329         new findPlainText function exported from TextIterator so this can share the
330         same search matching logic used to find text in webpages.
331         (WebCore::AccessibilityObject::selectText): Use capitalize and its return value
332         rather than makeCapitalize modifying a string in place.
333
334         * accessibility/AccessibilityRenderObject.cpp:
335         (WebCore::objectInclusionFromAltText): Use isAllSpecialCharacters<isHTMLSpace>
336         for the same reason as above.
337         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const): Ditto.
338
339         * bindings/js/JSDOMConvertStrings.cpp:
340         (WebCore::stringToByteString): Use isAllLatin1.
341
342         * contentextensions/ContentExtensionParser.cpp:
343         (WebCore::ContentExtensions::containsOnlyASCIIWithNoUppercase): Use
344         StringView::codeUnits instead of String::at.
345
346         * contentextensions/ContentExtensionsBackend.cpp:
347         (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad const):
348         Use isAllASCII.
349         * contentextensions/URLFilterParser.cpp:
350         (WebCore::ContentExtensions::URLFilterParser::addPattern): Ditto.
351
352         * css/CSSFontFaceSrcValue.cpp:
353         (WebCore::CSSFontFaceSrcValue::isSupportedFormat const): Use protocolIs and
354         endsWithIgnoringASCIICase.
355
356         * css/DOMCSSNamespace.cpp:
357         (WebCore::valueWithoutImportant): Use endsWithIgnoringASCIICase.
358
359         * css/parser/CSSPropertyParser.cpp:
360         (WebCore::parseGridTemplateAreasRow): Use isAllSpecialCharacters<isCSSSpace>,
361         for the preflight, which matches what the actual parsing code uses.
362
363         * dom/CharacterData.cpp:
364         (WebCore::CharacterData::containsOnlyWhitespace const): Deleted. Callers can
365         efficiently get at the data and do this kind of check on the data directly.
366         * dom/CharacterData.h: Updated for the above.
367
368         * dom/DataTransfer.cpp:
369         (WebCore::normalizeType): Use startsWith since the string is already converted
370         to ASCII lowercase.
371
372         * dom/Position.cpp:
373         (WebCore::Position::leadingWhitespacePosition const): Use isHTMLSpace since
374         since the code is trying to check for collapsible HTML spaces, not general
375         Unicode spaces. Other call sites of isSpaceOrNewline need to be checked for
376         this, but I did not fix them all at this time.
377         (WebCore::Position::trailingWhitespacePosition const): Ditto.
378
379         * editing/Editor.cpp:
380         (WebCore::Editor::editorUIUpdateTimerFired): Use noBreakSpace.
381
382         * editing/FrameSelection.cpp:
383         (WebCore::FrameSelection::debugRenderer const): Use text().length() instead
384         of textLength.
385         (WebCore::FrameSelection::selectionAtWordStart const): Use noBreakSpace.
386         (WebCore::FrameSelection::wordSelectionContainingCaretSelection): Ditto.
387         (WebCore::FrameSelection::actualSelectionAtSentenceStart const): Ditto.
388
389         * editing/TextIterator.cpp:
390         (WebCore::textNodeOffsetInFlow): Use text().length().
391         (WebCore::TextIterator::handleTextNode): Ditto.
392         (WebCore::collapsedSpaceLength): Updated since RenderText::text now returns
393         a reference rather than a pointer.
394         (WebCore::findPlainText): Added. Uses SearchBuffer to search for one string
395         within another. Exported so accessibility code can do this operation.
396         * editing/TextIterator.h: Updated for the above.
397
398         * editing/TypingCommand.cpp:
399         (WebCore::TypingCommand::markMisspellingsAfterTyping): Use noBreakSpace.
400
401         * editing/VisibleUnits.cpp:
402         (WebCore::findStartOfParagraph): Updated since RenderText::text now returns
403         a reference.
404         (WebCore::findEndOfParagraph): Ditto.
405
406         * editing/cocoa/HTMLConverter.mm:
407         (HTMLConverter::_processText): Use String::characterAt instead of String::at.
408         Use capitalize instead of makeCapitalized.
409
410         * editing/cocoa/WebContentReaderCocoa.mm:
411         (WebCore::stripMicrosoftPrefix): Use findIgnoringASCIICase.
412
413         * html/Autofill.cpp:
414         (WebCore::AutofillData::createFromHTMLFormControlElement): Use
415         startsWithLettersIgnoringASCIICase.
416
417         * html/BaseTextInputType.cpp:
418         (WebCore::BaseTextInputType::patternMismatch const): Removed explicit
419         TextCaseSensitive since it now is the default, and needed to touch this anyway
420         because the enumeration is now in a different namespace.
421
422         * html/EmailInputType.cpp:
423         (WebCore::isValidEmailAddress): Updated to use JSC::Yarr::TextCaseInsensitive.
424
425         * html/HTMLObjectElement.cpp:
426         (WebCore::HTMLObjectElement::hasFallbackContent const): Use
427         isAllSpecialCharacters<isHTMLSpace>.
428         (WebCore::HTMLObjectElement::shouldAllowQuickTimeClassIdQuirk): Use
429         startsWithLettersIgnoringASCIICase.
430         (WebCore::HTMLObjectElement::hasValidClassId): Use protocolIs.
431         (WebCore::preventsParentObjectFromExposure): Use isAllSpecialCharacters<isHTMLSpace>.
432
433         * html/parser/HTMLConstructionSite.cpp:
434         (WebCore::HTMLConstructionSite::setCompatibilityModeFromDoctype):
435         Use startsWithLettersIgnoringASCIICase.
436
437         * html/parser/HTMLMetaCharsetParser.cpp:
438         (WebCore::extractCharset): Use findIgnoringASCIICase.
439
440         * html/parser/XSSAuditor.cpp:
441         (WebCore::XSSAuditor::isContainedInRequest): Use containsIgnoringASCIICase.
442
443         * html/track/WebVTTParser.cpp:
444         (WebCore::WebVTTParser::hasRequiredFileIdentifier): Don't pass the length to
445         the String::startsWith function. There has never been a version of that function
446         that takes the length, there is no need to pass the length since the function
447         handles null-terminated strings like the one here, and in the past the length
448         has been getting converted to a boolean making the comparison be case sensitive.
449         Removing the argument entirely leaves it case sensitive.
450
451         * inspector/InspectorNodeFinder.cpp:
452         (WebCore::InspectorNodeFinder::matchesElement): Use startsWithIgnoringASCIICase
453         and endsWithIgnoringASCIICase.
454
455         * inspector/InspectorStyleSheet.cpp:
456         (WebCore::selectorsFromSource): Use JSC::Yarr::TextCaseSensitive.
457
458         * inspector/agents/InspectorDOMAgent.cpp:
459         (WebCore::containsOnlyHTMLWhitespace): Made this a non-member function
460         and reimplemented using isAllSpecialCharacters<isHTMLSpace>().
461         (WebCore::InspectorDOMAgent::innerFirstChild): Use containsOnlyHTMLWhitespace.
462         (WebCore::InspectorDOMAgent::innerNextSibling): Ditto.
463         (WebCore::InspectorDOMAgent::innerPreviousSibling): Ditto.
464         (WebCore::InspectorDOMAgent::innerChildNodeCount): Ditto.
465         (WebCore::InspectorDOMAgent::didInsertDOMNode): Ditto.
466         (WebCore::InspectorDOMAgent::didRemoveDOMNode): Ditto.
467         * inspector/agents/InspectorDOMAgent.h: Updated for above change.
468
469         * loader/appcache/ApplicationCacheStorage.cpp:
470         (WebCore::ApplicationCacheStorage::shouldStoreResourceAsFlatFile):
471         Use startsWithLettersIgnoringASCIICase.
472
473         * page/Base64Utilities.cpp:
474         (WebCore::Base64Utilities::btoa): Use isAllLatin1.
475
476         * page/Frame.cpp:
477         (WebCore::createRegExpForLabels): Removed TextCaseSensitive argument since
478         that is now the default and also used JSC::Yarr::TextCaseInsensitive.
479         (WebCore::matchLabelsAgainstString): More of the same.
480
481         * page/FrameView.cpp:
482         (WebCore::countRenderedCharactersInRenderObjectWithThreshold): Use
483         text().length().
484
485         * page/SecurityOrigin.cpp:
486         (WebCore::isFeedWithNestedProtocolInHTTPFamily): Use
487         startsWithLettersIgnoringASCIICase.
488
489         * page/UserContentURLPattern.cpp:
490         (WebCore::UserContentURLPattern::matchesHost const):
491         Use endsWithIgnoringASCIICase.
492         * page/csp/ContentSecurityPolicySource.cpp:
493         (WebCore::ContentSecurityPolicySource::hostMatches const): Ditto.
494
495         * page/csp/ContentSecurityPolicySourceList.cpp:
496         (WebCore::ContentSecurityPolicySourceList::parseNonceSource):
497         Use startsWithIgnoringASCIICase.
498
499         * page/ios/FrameIOS.mm:
500         (WebCore::Frame::wordsInCurrentParagraph const): Use noBreakSpace.
501
502         * platform/ContentType.cpp:
503         (WebCore::ContentType::parameter const): Use findIgnoringASCIICase.
504
505         * platform/MIMETypeRegistry.cpp:
506         (WebCore::MIMETypeRegistry::isSupportedFontMIMEType): Use
507         startsWithLettersIgnoringASCIICase.
508         (WebCore::MIMETypeRegistry::isSupportedJSONMIMEType): Use
509         mimeType.endsWithIgnoringASCIICase.
510         (WebCore::MIMETypeRegistry::isTextMIMEType): Use
511         startsWithLettersIgnoringASCIICase.
512         (WebCore::MIMETypeRegistry::isXMLMIMEType): Use endsWithIgnoringASCIICase.
513         (WebCore::MIMETypeRegistry::isJavaAppletMIMEType): Use
514         startsWithLettersIgnoringASCIICase.
515         (WebCore::MIMETypeRegistry::canShowMIMEType): Ditto.
516
517         * platform/URL.cpp:
518         (WebCore::isAllASCII): Renamed from containsOnlyASCII.
519         (WebCore::appendEncodedHostname): Use isAllASCII.
520
521         * platform/URLParser.cpp:
522         (WebCore::containsOnlyASCII): Deleted.
523         (WebCore::URLParser::domainToASCII): Use StringImpl::isAllASCII. Changed
524         to take StringImpl& to guarantee we won't keep doing null checks since
525         the caller already checks for null.
526         (WebCore::URLParser::parseHostAndPort): Pass StringImpl&.
527         * platform/URLParser.h: Updated for above.
528
529         * platform/graphics/MediaPlayer.cpp:
530         (WebCore::MediaPlayer::supportsType): Use endsWithIgnoringASCIICase
531         and startsWithLettersIgnoringASCIICase.
532
533         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
534         (WebCore::validKeySystemRE): Use JSC::Yarr::TextCaseInsensitive.
535
536         * platform/graphics/cocoa/FontCacheCoreText.cpp:
537         (WebCore::FontCache::similarFont): Use containsIgnoringASCIICase for
538         the Geeza font special cases.
539
540         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
541         (WebCore::shouldRejectMIMEType): Use startsWithLettersIgnoringASCIICase.
542
543         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
544         (WebCore::GraphicsContext3D::getUnmangledInfoLog): Removed
545         TextCaseSensitive since it now is the default.
546
547         * platform/mac/PublicSuffixMac.mm:
548         (WebCore::topPrivatelyControlledDomain): Use isAllASCII.
549
550         * platform/mac/SSLKeyGeneratorMac.mm:
551         (WebCore::signedPublicKeyAndChallengeString): Use isAllASCII.
552
553         * platform/mac/StringUtilities.mm:
554         (WebCore::stringMatchesWildcardString): Use JSC::Yarr::TextCaseInsensitive.
555
556         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
557         (WebCore::addStringToSHA1): Use isAllASCII.
558
559         * platform/network/CacheValidation.cpp:
560         (WebCore::parseCacheControlDirectives): Use containsIgnoringASCIICase.
561
562         * platform/network/HTTPParsers.cpp:
563         (WebCore::parseHTTPRefresh): Use findIgnoringASCIICase.
564         (WebCore::findCharsetInMediaType): Ditto.
565         (WebCore::parseRange): Use startsWithLettersIgnoringASCIICase.
566
567         * platform/network/curl/AuthenticationChallengeCurl.cpp:
568         (WebCore::AuthenticationChallenge::protectionSpaceFromHandle):
569         Use findIgnoringASCIICase.
570         * platform/network/curl/MultipartHandle.cpp:
571         (WebCore::MultipartHandle::extractBoundary): Ditto.
572         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
573         (WebCore::ResourceHandleCurlDelegate::handleDataURL): Use
574         endsWithIgnoringASCIICase.
575         * platform/network/curl/ResourceResponseCurl.cpp:
576         (WebCore::ResourceResponse::isAppendableHeader): Use
577         startsWithLettersIgnoringASCIICase.
578         (WebCore::ResourceResponse::appendHTTPHeaderField): Ditto.
579
580         * platform/win/ClipboardUtilitiesWin.cpp:
581         (WebCore::extractMarkupFromCFHTML): Use findIgnoringASCIICase.
582         (WebCore::fragmentFromCFHTML): Ditto.
583
584         * rendering/BidiRun.cpp:
585         (WebCore::BidiRun::BidiRun): Use text().length().
586         * rendering/HitTestResult.cpp:
587         (WebCore::HitTestResult::absolutePDFURL const): Use
588         endsWithIgnoringASCIICase.
589         * rendering/InlineFlowBox.cpp:
590         (WebCore::InlineFlowBox::placeBoxRangeInInlineDirection): Use text().length().
591         * rendering/InlineIterator.h:
592         (WebCore::InlineIterator::fastIncrementInTextNode): Ditto.
593         (WebCore::InlineIterator::increment): Dtto.
594         * rendering/InlineTextBox.cpp:
595         (WebCore::InlineTextBox::isLineBreak const): Updated since RenderText::text
596         now returns a StringImpl&.
597         (WebCore::InlineTextBox::selectionStartEnd const): Use text().length().
598         (WebCore::InlineTextBox::text const): Updated since RenderText::text
599         now returns a StringImpl&.
600         * rendering/RenderBlock.cpp:
601         (WebCore::RenderBlock::constructTextRun): Use text().length().
602         * rendering/RenderBlockFlow.cpp:
603         (WebCore::isVisibleRenderText): Use isAllSpecialCharacters<isHTMLSpace>().
604         (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):
605         Use the new trimmedPreferredWidths that returns a structure instead of the
606         old one with lots of arguments. Also use text().length().
607         * rendering/RenderBlockLineLayout.cpp:
608         (WebCore::endsWithHTMLSpaces): Renamed and changed to use isHTMLSpace
609         instead of isASCIISpace.
610         (WebCore::reachedEndOfTextRenderer): Use endsWithHTMLSpaces.
611         (WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment):
612         Updated for hcanges to RenderText.
613         (WebCore::RenderBlockFlow::handleTrailingSpaces): Ditto.
614         (WebCore::RenderBlockFlow::determineStartPosition): Ditto.
615
616         * rendering/RenderCombineText.cpp:
617         (WebCore::RenderCombineText::combineTextIfNeeded): Use
618         isAllSpecialCharacters<isHTMLSpace>.
619         * rendering/RenderLayer.cpp:
620         (WebCore::RenderLayer::calculateClipRects const): Ditto.
621
622         * rendering/RenderListBox.cpp:
623         (WebCore::bolder): Added. Helper function.
624         (WebCore::RenderListBox::updateFromElement): Rewrote to
625         only compute the bolder font once rather than for every item.
626         (WebCore::RenderListBox::paintItemForeground): Updated for
627         change to applyTextTransform.
628
629         * rendering/RenderMenuList.cpp:
630         (WebCore::RenderMenuList::adjustInnerStyle): Updated for change
631         to RenderText::text.
632         (RenderMenuList::updateOptionsWidth): Updated for change to
633         applyTextTransform.
634         (RenderMenuList::itemText const): Ditto.
635
636         * rendering/RenderText.cpp:
637         (WebCore::capitalize): Renamed from makeCapitalized. Changed to
638         take and return a String instead of taking a String*.
639         (WebCore::RenderText::RenderText): Use isAllASCII. Also moved
640         initialization of most non-bitfield members to the class definition.
641         (WebCore::RenderText::positionForPoint): Use text().
642         (WebCore::RenderText::widthFromCache const): Ditto.
643         (WebCore::RenderText::hangablePunctuationStartWidth const): Ditto.
644         (WebCore::RenderText::hangablePunctuationEndWidth const): Ditto.
645         (WebCore::RenderText::isHangableStopOrComma): Ditto.
646         (WebCore::RenderText::firstCharacterIndexStrippingSpaces const): Ditto.
647         (WebCore::RenderText::lastCharacterIndexStrippingSpaces const): Ditto.
648         (WebCore::RenderText::trimmedPreferredWidths): Changed to return values
649         in a structure instead of taking lots of arguments.
650         (WebCore::RenderText::computePreferredLogicalWidths): Updated to use
651         the text() function.
652         (WebCore::isAllCollapsibleWhitespace): Added.
653         (WebCore::RenderText::isAllCollapsibleWhitespace const): Updated to
654         use a tighter loop.
655         (WebCore::isAllPossiblyCollapsibleWhitespace): Added.
656         (WebCore::RenderText::containsOnlyHTMLWhitespace const): Updated to
657         use a tighter loop. Renamed from containsOnlyWhitespace.
658         (WebCore::RenderText::setTextWithOffset): Updated to  use text().
659         (WebCore::isInlineFlowOrEmptyText): Rewrote to be easier to read.
660         (WebCore::RenderText::previousCharacter const): Got rid of unneeded
661         null check and simplified.
662         (WebCore::applyTextTransform): Changed to return a String rather
663         than modifying one that is passed in.
664         (WebCore::RenderText::setRenderedText): Updated use of applyTextTransform.
665         (WebCore::RenderText::secureText): More of the same.
666         (WebCore::RenderText::computeCanUseSimplifiedTextMeasuring const): Ditto.
667         (WebCore::RenderText::textWithoutConvertingBackslashToYenSymbol const): Ditto.
668         (WebCore::RenderText::width const): Ditto.
669         (WebCore::RenderText::collectSelectionRectsForLineBoxes): Ditto.
670         (WebCore::RenderText::previousOffset const): Ditto.
671         (WebCore::RenderText::previousOffsetForBackwardDeletion const): Ditto.
672         (WebCore::RenderText::nextOffset const): Ditto.
673         (WebCore::RenderText::computeCanUseSimpleFontCodePath const): Ditto.
674         (WebCore::RenderText::stringView const): Ditto.
675
676         * rendering/RenderText.h: Made some more members private and final.
677         Updated for above, including adding the Widths structure. Got rid of the
678         textLength function, which existed as a workaround before we could mark
679         a function like length final. Made the text function return a StringImpl&,
680         which is good since the m_text string is never null, and so callers end
681         up using StringImpl directly and saving null checks. Removed functions
682         that are not needed, including is8Bit, characters8, characters16,
683         uncheckedCharacterAt, operator[], and isAllASCII.
684
685         * rendering/RenderTextFragment.cpp:
686         (WebCore::RenderTextFragment::setText): Use text().length().
687         * rendering/RenderTextLineBoxes.cpp:
688         (WebCore::RenderTextLineBoxes::caretMaxOffset const): Ditto.
689         (WebCore::RenderTextLineBoxes::positionForPoint const): Ditto.
690         (WebCore::RenderTextLineBoxes::setSelectionState): Ditto.
691         (WebCore::RenderTextLineBoxes::absoluteQuads const): Ditto.
692         * rendering/SimpleLineLayout.cpp:
693         (WebCore::SimpleLineLayout::canUseForFontAndText): Ditto.
694         * rendering/SimpleLineLayoutCoverage.cpp:
695         (WebCore::SimpleLineLayout::textLengthForSubtree): Ditto.
696         (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlows): Ditto.
697         * rendering/SimpleLineLayoutFlowContents.cpp:
698         (WebCore::SimpleLineLayout::initializeSegments): Ditto.
699         * rendering/SimpleLineLayoutFunctions.cpp:
700         (WebCore::SimpleLineLayout::textOffsetForPoint): Ditto.
701         * rendering/SimpleLineLayoutFunctions.h:
702         (WebCore::SimpleLineLayout::findCaretMaximumOffset): Ditto.
703         * rendering/line/BreakingContext.h:
704         (WebCore::shouldAddBorderPaddingMargin): Ditto.
705         (WebCore::shouldSkipWhitespaceAfterStartObject): Ditto.
706         (WebCore::iteratorIsBeyondEndOfRenderCombineText): Ditto.
707         (WebCore::textWidth): Ditto.
708         (WebCore::BreakingContext::handleText): Ditto.
709         (WebCore::BreakingContext::optimalLineBreakLocationForTrailingWord): Ditto.
710         * rendering/line/TrailingObjects.cpp:
711         (WebCore::TrailingObjects::updateWhitespaceCollapsingTransitionsForTrailingBoxes): Ditto.
712
713         * rendering/mathml/RenderMathMLFenced.cpp:
714         (WebCore::RenderMathMLFenced::updateFromElement): Removed stray use of "unsigned int".
715
716         * rendering/svg/RenderSVGInlineText.cpp:
717         (WebCore::RenderSVGInlineText::characterStartsNewTextChunk const): Use text().length().
718         (WebCore::RenderSVGInlineText::positionForPoint): Ditto.
719         * rendering/svg/SVGTextLayoutAttributesBuilder.cpp:
720         (WebCore::processRenderSVGInlineText): Ditto.
721         * rendering/svg/SVGTextLayoutEngine.cpp:
722         (WebCore::SVGTextLayoutEngine::currentLogicalCharacterAttributes): Ditto.
723         * rendering/svg/SVGTextQuery.cpp:
724         (WebCore::SVGTextQuery::modifyStartEndPositionsRespectingLigatures const): Ditto.
725
726         * style/RenderTreeUpdater.cpp:
727         (WebCore::RenderTreeUpdater::updateRenderTree): Use isAllSpecialCharacters<isHTMLSpace>.
728         (WebCore::RenderTreeUpdater::textRendererIsNeeded): Ditto.
729
730         * svg/SVGTests.cpp:
731         (WebCore::SVGTests::hasFeatureForLegacyBindings): Use startsWithLettersIgnoringASCIICase.
732         * xml/parser/XMLDocumentParserLibxml2.cpp:
733         (WebCore::shouldAllowExternalLoad): Ditto.
734
735 2017-11-23  Zan Dobersek  <zdobersek@igalia.com>
736
737         [CoordGraphics] Simplify CoordinatedGraphicsLayer's content buffer updates
738         https://bugs.webkit.org/show_bug.cgi?id=179972
739
740         Reviewed by Carlos Garcia Campos.
741
742         During layer flushes, when a CoordinatedGraphicsLayer's tiled backing store
743         has dirty tiles that need to be updated, the following chain of calls would
744         be invoked to perform the painting, starting in
745         CoordinatedGraphicsLayer::updateContentBuffers():
746         |- CoordinatedGraphicsLayer::updateContentBuffers()
747          |- TiledBackingStore::updateTileBuffers()
748           |- Tile::updateBackBuffer()
749            |- CoordinatedGraphicsLayer::paintToSurface()
750             |- CompositingCoordinator::paintToSurface()
751              |- UpdateAtlas::paintOnAvailableBuffer()
752               |- ThreadSafeCoordinatedSurface::paintToSurface()
753                |- Tile::paintToSurfaceContext()
754                 |- CoordinatedGraphicsLayer::tiledBackingStorePaint()
755                  |- GraphicsLayer::paintGraphicsLayerContents()
756
757         That's a bit much.
758
759         In CoordinatedGraphicsLayer::updateContentBuffers(), we now first retrieve
760         all the dirty layers in our TiledBackingStore. We then iterate through them,
761         first establishing their ID and then retrieving an available CoordinatedBuffer
762         that we can use for painting. The CoordinatedBuffer is retrieved through
763         CompositingCoordinator, which is still caching these buffers via UpdateAtlas
764         objects.
765
766         With a CoordinatedBuffer available, we can then proceed with painting. The
767         painting context has to be properly set up to paint into the correct area of
768         the given buffer, and the alpha channel, if necessary, has to be addressed.
769         After properly positioning and scaling ourselves on the given context, we
770         can proceed with the GraphicsLayer::paintGraphicsLayerContents() call.
771
772         What's left is filling out the missing SurfaceUpdateInfo information which is
773         then passed to the updateTile() method that properly registers the tile
774         update we've just performed. The tile itself is marked clean. After the
775         iteration, we call the didUpdateTileBuffers() method in case any successful
776         tile update was indeed performed, incrementing the repaint counter.
777
778         That's it -- we clipped 8 calls from the call chain. We can now also remove
779         the CoordinatedBuffer::Client interface, as well as slim down the
780         TiledBackingStore interface. The Tile class is cleaned up a bit, with methods
781         shifted into a more sensible order.
782
783         No new tests -- no change in functionality.
784
785         * platform/graphics/texmap/coordinated/CoordinatedBuffer.cpp:
786         * platform/graphics/texmap/coordinated/CoordinatedBuffer.h:
787         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
788         (WebCore::CoordinatedGraphicsLayer::didUpdateTileBuffers):
789         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
790         (WebCore::CoordinatedGraphicsLayer::tiledBackingStorePaint): Deleted.
791         (WebCore::CoordinatedGraphicsLayer::paintToSurface): Deleted.
792         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
793         * platform/graphics/texmap/coordinated/Tile.cpp:
794         (WebCore::Tile::ensureTileID):
795         (WebCore::Tile::isDirty const):
796         (WebCore::Tile::invalidate):
797         (WebCore::Tile::markClean):
798         (WebCore::Tile::updateBackBuffer): Deleted.
799         (WebCore::Tile::paintToSurfaceContext): Deleted.
800         * platform/graphics/texmap/coordinated/Tile.h:
801         (WebCore::Tile::tileID const):
802         (WebCore::Tile::dirtyRect const):
803         * platform/graphics/texmap/coordinated/TiledBackingStore.cpp:
804         (WebCore::TiledBackingStore::dirtyTiles):
805         (WebCore::TiledBackingStore::updateTileBuffers): Deleted.
806         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
807         * platform/graphics/texmap/coordinated/TiledBackingStoreClient.h:
808
809 2017-11-23  Zan Dobersek  <zdobersek@igalia.com>
810
811         [CoordGraphics] Remove relay CoordinatedBuffer::Client implementations
812         https://bugs.webkit.org/show_bug.cgi?id=179970
813
814         Reviewed by Carlos Garcia Campos.
815
816         Drop CoordinatedBuffer::painToSurface() in favor of a simpler
817         GraphicsContext reference getter that returns a reference to the
818         GraphicsContext object of the internal ImageBuffer.
819
820         Remove the ImageBackingSurfaceClient class that only acted as a relay
821         that enabled a CoordinatedBuffer to draw an image through its context.
822         Instead, we use the GraphicsContext of the allocated CoordinatedBuffer
823         to draw the image directly. We still use a rectangle whose size
824         matches the size of the given Image as the clipping area and as the
825         source and destination rectangle for the image.
826
827         No new tests -- no change in behavior.
828
829         * platform/graphics/texmap/coordinated/CoordinatedBuffer.cpp:
830         (WebCore::CoordinatedBuffer::context):
831         (WebCore::CoordinatedBuffer::paintToSurface): Deleted.
832         * platform/graphics/texmap/coordinated/CoordinatedBuffer.h:
833         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
834         (WebCore::CoordinatedImageBacking::update):
835         (WebCore::ImageBackingSurfaceClient::ImageBackingSurfaceClient): Deleted.
836
837 2017-11-23  Zan Dobersek  <zdobersek@igalia.com>
838
839         [CoordGraphics] TiledBackingStore: use a reference to the client
840         https://bugs.webkit.org/show_bug.cgi?id=179969
841
842         Reviewed by Carlos Garcia Campos.
843
844         TiledBackingStore should keep a C++ reference to the TiledBackingStoreClient
845         object, and not a pointer. client() method is updated to reflect that, and
846         uses of this method and the member variable are updated accordingly.
847
848         No new tests -- no change in behavior.
849
850         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
851         (WebCore::CoordinatedGraphicsLayer::createBackingStore):
852         * platform/graphics/texmap/coordinated/Tile.cpp:
853         (WebCore::Tile::~Tile):
854         (WebCore::Tile::updateBackBuffer):
855         (WebCore::Tile::paintToSurfaceContext):
856         * platform/graphics/texmap/coordinated/TiledBackingStore.cpp:
857         (WebCore::TiledBackingStore::TiledBackingStore):
858         (WebCore::TiledBackingStore::updateTileBuffers):
859         (WebCore::TiledBackingStore::createTiles):
860         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
861         (WebCore::TiledBackingStore::client):
862
863 2017-11-23  Zan Dobersek  <zdobersek@igalia.com>
864
865         [CoordGraphics] Early tile buffer update in TiledBackingStore::createTiles() is unnecessary
866         https://bugs.webkit.org/show_bug.cgi?id=179968
867
868         Reviewed by Carlos Garcia Campos.
869
870         Under CoordinatedGraphicsLayer::updateContentBuffers(), the TiledBackingStore
871         object has the createTilesIfNeeded() method invoked, if necessary. This
872         invokes createTiles(), where the edge tiles are resized if necessary, and
873         the missing tiles are created. If any of those two cases is fulfilled, the
874         updateTileBuffers() method is invoked, updating any dirty tiles (i.e. the
875         ones that were resized or newly-created).
876
877         This specific invocation of updateTileBuffers() is not needed since it's the
878         very next method that's invoked on the TiledBackingStore object by
879         CoordinatedGraphicsLayer::updateContentBuffers(). It's therefore removed,
880         and the resizeEdgeTiles() method is changed to not return any value.
881
882         No new tests -- no change in behavior.
883
884         * platform/graphics/texmap/coordinated/TiledBackingStore.cpp:
885         (WebCore::TiledBackingStore::createTiles):
886         (WebCore::TiledBackingStore::resizeEdgeTiles):
887         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
888
889 2017-11-23  Antti Koivisto  <antti@apple.com>
890
891         RenderBlockFlow::layoutRunsAndFloatsInRange is O(n^2) for runs of inlines without any text
892         https://bugs.webkit.org/show_bug.cgi?id=179950
893
894         Reviewed by Simon Fraser.
895
896         It calls createBidiRunsForLine for each line. createBidiRunsForLine traverses past the end of the line until
897         it finds the end of the current bidi run. If there is no text in the flow, it never finds anything and traverses
898         the entire flow. This is O(n^2) for the number of renderers in the flow.
899
900         Tested by PerformanceTests/Layout/inline-layout-no-text.html
901
902         * platform/text/BidiResolver.h:
903         (WebCore::BidiResolverBase::needsContinuePastEnd const):
904         (WebCore::BidiResolverBase::needsContinuePastEndInternal const):
905         (WebCore::DerivedClass>::createBidiRunsForLine):
906
907             When past end of line call needsContinuePastEnd() to see if we need to continue searching for the end of the bidi run.
908
909         * rendering/InlineIterator.h:
910         (WebCore::InlineBidiResolver::needsContinuePastEndInternal const):
911
912             InlineBidiResolver only returns runs up to the last renderer on the line and can bail out.
913
914 2017-11-23  Zan Dobersek  <zdobersek@igalia.com>
915
916         [CoordGraphics] Replace CoordinatedSurface, ThreadSafeCoordinatedSurface with CoordinatedBuffer
917         https://bugs.webkit.org/show_bug.cgi?id=179967
918
919         Reviewed by Carlos Garcia Campos.
920
921         Roll the CoordinatedSurface and ThreadSafeCoordinatedSurface classes
922         into one CoordinatedBuffer class.
923
924         CoordinatedBuffer class mimics CoordinatedSurface in providing the
925         Client class that allows specifying how the client should paint using a
926         GraphicsContext object. supportsAlpha() and size() methods are also
927         present, as well as paintToSurface(). uploadImage() retrieves the
928         Image that's created from the contained ImageBuffer, allowing the user
929         to then manually upload the buffer data onto the GPU.
930
931         CoordinatedBuffer otherwise serves as a drop-in replacement for the
932         CoordinatedSurface class, and the remaining changes in the
933         CoordiantedGraphics code reflect that.
934
935         No new tests -- no change in behavior.
936
937         * platform/TextureMapper.cmake:
938         * platform/graphics/texmap/coordinated/CoordinatedBuffer.cpp: Added.
939         (WebCore::CoordinatedBuffer::create):
940         (WebCore::CoordinatedBuffer::CoordinatedBuffer):
941         (WebCore::CoordinatedBuffer::paintToSurface):
942         (WebCore::CoordinatedBuffer::uploadImage):
943         * platform/graphics/texmap/coordinated/CoordinatedBuffer.h: Added.
944         (WebCore::CoordinatedBuffer::supportsAlpha const):
945         (WebCore::CoordinatedBuffer::size const):
946         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
947         (WebCore::CoordinatedGraphicsLayer::paintToSurface):
948         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
949         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
950         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
951         (WebCore::CoordinatedImageBacking::update):
952         (WebCore::CoordinatedImageBacking::releaseSurfaceIfNeeded):
953         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.h:
954         * platform/graphics/texmap/coordinated/CoordinatedSurface.cpp: Removed.
955         * platform/graphics/texmap/coordinated/CoordinatedSurface.h: Removed.
956         * platform/graphics/texmap/coordinated/Tile.h:
957         * platform/graphics/texmap/coordinated/TiledBackingStoreClient.h:
958
959 2017-11-22  Simon Fraser  <simon.fraser@apple.com>
960
961         FEComponentTransfer cleanup and optimization
962         https://bugs.webkit.org/show_bug.cgi?id=179952
963
964         Reviewed by Darin Adler.
965
966         Change terminology for FEComponentTransfer to be more explicit about the fact
967         that it's creating and using lookup tables. Use std::array for the lookup tables.
968         
969         Use uint8_t instead of unsigned char.
970         
971         Avoid confusing arrays for channels in computeLookupTables; just setup the lut for
972         each channel manually.
973         
974         This is about 1.25x faster than before.
975
976         * platform/graphics/filters/FEComponentTransfer.cpp:
977         (WebCore::FEComponentTransfer::computeIdentityTable):
978         (WebCore::FEComponentTransfer::computeTabularTable):
979         (WebCore::FEComponentTransfer::computeDiscreteTable):
980         (WebCore::FEComponentTransfer::computeLinearTable):
981         (WebCore::FEComponentTransfer::computeGammaTable):
982         (WebCore::FEComponentTransfer::platformApplySoftware):
983         (WebCore::FEComponentTransfer::computeLookupTables):
984         (WebCore::operator<<):
985         (WebCore::identity): Deleted.
986         (WebCore::table): Deleted.
987         (WebCore::discrete): Deleted.
988         (WebCore::linear): Deleted.
989         (WebCore::gamma): Deleted.
990         (WebCore::FEComponentTransfer::getValues): Deleted.
991         * platform/graphics/filters/FEComponentTransfer.h:
992         (WebCore::ComponentTransferFunction::ComponentTransferFunction): Deleted.
993
994 2017-11-22  Javier Fernandez  <jfernandez@igalia.com>
995
996         [css-grid] Refactoring and new namespace with grid related utility functions
997         https://bugs.webkit.org/show_bug.cgi?id=179633
998
999         Reviewed by Darin Adler.
1000
1001         Added a new namespace with several utility functions to share logic
1002         between RenderGrid and GridTrackSizingAlgorithm.
1003
1004         No new tests, since no new functionality is added.
1005
1006         * Sources.txt:
1007         * WebCore.xcodeproj/project.pbxproj:
1008         * rendering/GridLayoutUtils.cpp: Added.
1009         (WebCore::GridLayoutUtils::computeMarginLogicalSizeForChild):
1010         (WebCore::GridLayoutUtils::marginLogicalSizeForChild):
1011         (WebCore::GridLayoutUtils::isOrthogonalChild):
1012         (WebCore::GridLayoutUtils::flowAwareDirectionForChild):
1013         * rendering/GridLayoutUtils.h: Added.
1014         * rendering/GridTrackSizingAlgorithm.cpp:
1015         (WebCore::GridTrackSizingAlgorithm::assumedRowsSizeForOrthogonalChild const):
1016         (WebCore::GridTrackSizingAlgorithmStrategy::logicalHeightForChild const):
1017         (WebCore::GridTrackSizingAlgorithmStrategy::minContentForChild const):
1018         (WebCore::GridTrackSizingAlgorithmStrategy::maxContentForChild const):
1019         (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild const):
1020         (WebCore::DefiniteSizeStrategy::minLogicalWidthForChild const):
1021         * rendering/RenderGrid.cpp:
1022         (WebCore::RenderGrid::layoutBlock):
1023         (WebCore::RenderGrid::placeItemsOnGrid const):
1024         (WebCore::RenderGrid::layoutPositionedObject):
1025         (WebCore::RenderGrid::availableAlignmentSpaceForChildBeforeStretching const):
1026         (WebCore::RenderGrid::applyStretchAlignmentToChildIfNeeded):
1027         (WebCore::RenderGrid::isInlineBaselineAlignedChild const):
1028         (WebCore::RenderGrid::firstLineBaseline const):
1029         (WebCore::RenderGrid::columnAxisPositionForChild const):
1030         (WebCore::RenderGrid::rowAxisPositionForChild const):
1031         (WebCore::RenderGrid::columnAxisOffsetForChild const):
1032         (WebCore::RenderGrid::rowAxisOffsetForChild const):
1033         (WebCore::RenderGrid::findChildLogicalPosition const):
1034
1035 2017-11-22  Ali Juma  <ajuma@chromium.org>
1036
1037         Implement VisualViewport API attributes
1038         https://bugs.webkit.org/show_bug.cgi?id=179385
1039
1040         Reviewed by Frédéric Wang.
1041
1042         Add a visualViewport attribute to Window, and implement the VisualViewport
1043         interface (https://wicg.github.io/visual-viewport/#the-visualviewport-interface).
1044
1045         This is behind a newly-added VisualViewportAPI experimental feature flag.
1046
1047         Tests: fast/visual-viewport/viewport-dimensions-exclude-custom-scrollbars.html
1048                fast/visual-viewport/viewport-dimensions-exclude-scrollbars.html
1049                fast/visual-viewport/viewport-dimensions-iframe.html
1050                fast/visual-viewport/viewport-dimensions-under-page-zoom.html
1051                fast/visual-viewport/viewport-dimensions.html
1052
1053         * CMakeLists.txt:
1054         * DerivedSources.cpp:
1055         * DerivedSources.make:
1056         * Sources.txt:
1057         * WebCore.xcodeproj/project.pbxproj:
1058         * bindings/js/WebCoreBuiltinNames.h:
1059         * dom/EventTargetFactory.in:
1060         * page/DOMWindow.cpp:
1061         (WebCore::DOMWindow::~DOMWindow):
1062         (WebCore::DOMWindow::resetDOMWindowProperties):
1063         (WebCore::DOMWindow::visualViewport const):
1064         * page/DOMWindow.h:
1065         * page/DOMWindow.idl:
1066         * page/Settings.yaml:
1067         * page/VisualViewport.cpp: Added.
1068         (WebCore::VisualViewport::VisualViewport):
1069         (WebCore::VisualViewport::eventTargetInterface const):
1070         (WebCore::VisualViewport::scriptExecutionContext const):
1071         (WebCore::getFrameViewAndLayoutIfNonNull):
1072         (WebCore::VisualViewport::offsetLeft const):
1073         (WebCore::VisualViewport::offsetTop const):
1074         (WebCore::VisualViewport::pageLeft const):
1075         (WebCore::VisualViewport::pageTop const):
1076         (WebCore::VisualViewport::width const):
1077         (WebCore::VisualViewport::height const):
1078         (WebCore::VisualViewport::scale const):
1079         * page/VisualViewport.h: Added.
1080         * page/VisualViewport.idl: Added.
1081
1082 2017-11-22  Manuel Rego Casasnovas  <rego@igalia.com>
1083
1084         Available height is wrong for positioned elements with "box-sizing: border-box"
1085         https://bugs.webkit.org/show_bug.cgi?id=178783
1086
1087         Reviewed by Darin Adler.
1088
1089         These methods were returning a wrong value for positioned items
1090         in combination with "box-sizing: border-box".
1091         The problem was that if the height of the element is given
1092         by its offset properties (top and bottom) we don't need to call
1093         adjustContentBoxLogicalHeightForBoxSizing().
1094
1095         Tests: fast/box-sizing/fill-available.html
1096                fast/box-sizing/replaced.html
1097
1098         * rendering/RenderBox.cpp:
1099         (WebCore::RenderBox::computeReplacedLogicalHeightUsing const):
1100         (WebCore::RenderBox::availableLogicalHeightUsing const):
1101
1102 2017-11-22  Christopher Reid  <chris.reid@sony.com>
1103
1104         WebCoreObjCExtras.h is being included in too many places
1105         https://bugs.webkit.org/show_bug.cgi?id=179931
1106
1107         Reviewed by Darin Adler.
1108
1109         No new tests no change in behavior.
1110
1111         Fixing cases where WebCoreObjCExtras.h is imported but not used.
1112
1113         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
1114         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1115         * platform/mac/WebCoreNSURLExtras.mm:
1116
1117 2017-11-22  Antoine Quint  <graouts@apple.com>
1118
1119         [Web Animations] Adopt KeyframeList in KeyframeEffect
1120         https://bugs.webkit.org/show_bug.cgi?id=179941
1121         <rdar://problem/35666924>
1122
1123         Reviewed by Darin Adler.
1124
1125         KeyframeEffect used to model its keyframes by creating a new Keyframe struct and storing them in a Vector<Keyframe>.
1126         However, there already is a way to model keyframes in WebCore using the KeyframeList class. We now adopt this class
1127         in KeyframeEffect, which makes it possible to run hardware-composited animations using RenderBoxModelObject::startAnimation()
1128         in a follow-up patch, since this function expects a KeyframeList.
1129
1130         No news tests, this is an internals change and does not yield any changes in Web content.
1131
1132         * animation/KeyframeEffect.cpp:
1133         (WebCore::KeyframeEffect::KeyframeEffect): Create a default m_keyframes at construction time.
1134         (WebCore::KeyframeEffect::processKeyframes): Create a temporary KeyframeList as we parse keyframes passed from the JS API
1135         and assign it to m_keyframes upon successful parsing. We also use cssPropertyId to refer to a CSSPropertyID to make the code
1136         clearer and ensure there is no confusion with JS properties that we manipulate in this function.
1137         (WebCore::KeyframeEffect::computeStackingContextImpact): Use the list of CSS properties exposed on KeyframeList directly rather
1138         than enumerating each keyframe and use cssPropertyId to refer to individual CSSPropertyID values for consistency.
1139         (WebCore::KeyframeEffect::applyAtLocalTime): Use the list of CSS properties exposed on KeyframeList directly rather than
1140         using the properties specified on the first keyframe only. We also remove a stale FIXME comment which was addressed in r224957.
1141         * animation/KeyframeEffect.h: Remove the Keyframe struct and change the type of m_keyframes from Vector<Keyframe> to KeyframeList.
1142         * rendering/style/KeyframeList.h:
1143         (WebCore::KeyframeList::KeyframeList): We remove the default insertions at KeyframeList construction time since it requires
1144         an immediate call to clear() when doing any meaningful work with a KeyframeList. We also add the default move assignment operator
1145         to allow KeyframeEffect::processKeyframes() to make a move assignment from the temporary keyframe list we build at parsing to the
1146         member variable.
1147
1148 2017-11-22  Commit Queue  <commit-queue@webkit.org>
1149
1150         Unreviewed, rolling out r225093.
1151         https://bugs.webkit.org/show_bug.cgi?id=179938
1152
1153         Compilation failed on WinCairo 64-bit Release (Requested by
1154         fredw on #webkit).
1155
1156         Reverted changeset:
1157
1158         "Implement VisualViewport API attributes"
1159         https://bugs.webkit.org/show_bug.cgi?id=179385
1160         https://trac.webkit.org/changeset/225093
1161
1162 2017-11-21  Ali Juma  <ajuma@chromium.org>
1163
1164         Implement VisualViewport API attributes
1165         https://bugs.webkit.org/show_bug.cgi?id=179385
1166
1167         Reviewed by Frédéric Wang.
1168
1169         Add a visualViewport attribute to Window, and implement the VisualViewport
1170         interface (https://wicg.github.io/visual-viewport/#the-visualviewport-interface).
1171
1172         This is behind a newly-added VisualViewportAPI experimental feature flag.
1173
1174         Tests: fast/visual-viewport/viewport-dimensions-exclude-custom-scrollbars.html
1175                fast/visual-viewport/viewport-dimensions-exclude-scrollbars.html
1176                fast/visual-viewport/viewport-dimensions-iframe.html
1177                fast/visual-viewport/viewport-dimensions-under-page-zoom.html
1178                fast/visual-viewport/viewport-dimensions.html
1179
1180         * CMakeLists.txt:
1181         * DerivedSources.cpp:
1182         * DerivedSources.make:
1183         * Sources.txt:
1184         * WebCore.xcodeproj/project.pbxproj:
1185         * bindings/js/WebCoreBuiltinNames.h:
1186         * dom/EventTargetFactory.in:
1187         * page/DOMWindow.cpp:
1188         (WebCore::DOMWindow::~DOMWindow):
1189         (WebCore::DOMWindow::resetDOMWindowProperties):
1190         (WebCore::DOMWindow::visualViewport const):
1191         * page/DOMWindow.h:
1192         * page/DOMWindow.idl:
1193         * page/Settings.yaml:
1194         * page/VisualViewport.cpp: Added.
1195         (WebCore::VisualViewport::VisualViewport):
1196         (WebCore::VisualViewport::eventTargetInterface const):
1197         (WebCore::VisualViewport::scriptExecutionContext const):
1198         (WebCore::getFrameViewAndLayoutIfNonNull):
1199         (WebCore::VisualViewport::offsetLeft const):
1200         (WebCore::VisualViewport::offsetTop const):
1201         (WebCore::VisualViewport::pageLeft const):
1202         (WebCore::VisualViewport::pageTop const):
1203         (WebCore::VisualViewport::width const):
1204         (WebCore::VisualViewport::height const):
1205         (WebCore::VisualViewport::scale const):
1206         * page/VisualViewport.h: Added.
1207         * page/VisualViewport.idl: Added.
1208
1209 2017-11-21  Frederic Wang  <fwang@igalia.com>
1210
1211         Async frame scrolling: handle fixed root backgrounds in frames
1212         https://bugs.webkit.org/show_bug.cgi?id=176261
1213
1214         Based on patch by Simon Fraser <simon.fraser@apple.com>
1215         Reviewed by Antonio Gomes.
1216
1217         For frames with tiled backing, we register a slow-repaint object because we hit
1218         RenderElement::styleWillChange() before we've made a backing for the iframe's RenderView so
1219         view().compositor().supportsFixedRootBackgroundCompositing() returns false. This patch
1220         ensures that this object is removed when setBackgroundLayerPaintsFixedRootBackground is
1221         called. It also removes the opaque background of non-main frames with tiled backing.
1222         This fixes a possible hit of ASSERT(!m_backgroundLayer) after r221615.
1223
1224         Test: compositing/tiling/tiled-drawing-async-frame-scrolling.html
1225
1226         * rendering/RenderLayerBacking.cpp:
1227         (WebCore::RenderLayerBacking::updateGeometry): Do not set opaque contents for frames with
1228         tiled backing. We keep !m_isMainFrameRenderViewLayer for backward compatibility with WK1.
1229         (WebCore::RenderLayerBacking::setBackgroundLayerPaintsFixedRootBackground): Add an early
1230         return when m_backgroundLayerPaintsFixedRootBackground is not changed. Remove the slow
1231         repaint object previously registered for this frame. Also add an ASSERT to ensure that a
1232         fixed root background is only set for frames with async scrolling.
1233         (WebCore::RenderLayerBacking::updateRootLayerConfiguration): Restrict some special handling
1234         of background and opaqueness to the main frame.
1235
1236 2017-11-21  Zan Dobersek  <zdobersek@igalia.com>
1237
1238         Drop ENABLE_IMAGE_DECODER_DOWN_SAMPLING code
1239         https://bugs.webkit.org/show_bug.cgi?id=179921
1240
1241         Reviewed by Carlos Garcia Campos.
1242
1243         Drop the ENABLE_IMAGE_DECODER_DOWN_SAMPLING code, along with the build
1244         guard definitions in WTF and CMake.
1245
1246         This was apparently in use in the Qt port, but since then no port
1247         enables this. It's not exposed in the Xcode build, and the CMake option
1248         is disabled by default, with no way to enable it through build-webkit.
1249
1250         While the code guarded with this build guard is removed, there's still
1251         code in the ScalableImageDecoder class that only operated when this
1252         feature was enabled. This should be addressed in the future, after
1253         evaluating the need for this scaling capability.
1254
1255         No new tests -- no change in behavior.
1256
1257         * platform/graphics/Image.cpp:
1258         (WebCore::Image::adjustSourceRectForDownSampling const): Deleted.
1259         * platform/graphics/Image.h:
1260         * platform/graphics/cairo/CairoOperations.cpp:
1261         (WebCore::Cairo::drawNativeImage):
1262         * platform/image-decoders/ScalableImageDecoder.h:
1263         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
1264         (WebCore::JPEGImageReader::decode):
1265         * platform/image-decoders/png/PNGImageDecoder.cpp:
1266         (WebCore::PNGImageDecoder::rowAvailable):
1267         (WebCore::PNGImageDecoder::frameComplete):
1268
1269 2017-11-21  Commit Queue  <commit-queue@webkit.org>
1270
1271         Unreviewed, rolling out r225089.
1272         https://bugs.webkit.org/show_bug.cgi?id=179937
1273
1274         This patch caused compilation failures (Requested by fredw on
1275         #webkit).
1276
1277         Reverted changeset:
1278
1279         "Async frame scrolling: handle fixed root backgrounds in
1280         frames"
1281         https://bugs.webkit.org/show_bug.cgi?id=176261
1282         https://trac.webkit.org/changeset/225089
1283
1284 2017-11-21  Frederic Wang  <fwang@igalia.com>
1285
1286         Async frame scrolling: handle fixed root backgrounds in frames
1287         https://bugs.webkit.org/show_bug.cgi?id=176261
1288
1289         Based on patch by Simon Fraser <simon.fraser@apple.com>
1290         Reviewed by Antonio Gomes.
1291
1292         For frames with tiled backing, we register a slow-repaint object because we hit
1293         RenderElement::styleWillChange() before we've made a backing for the iframe's RenderView so
1294         view().compositor().supportsFixedRootBackgroundCompositing() returns false. This patch
1295         ensures that this object is removed when setBackgroundLayerPaintsFixedRootBackground is
1296         called. It also removes the opaque background of non-main frames with tiled backing.
1297         This fixes a possible hit of ASSERT(!m_backgroundLayer) after r221615.
1298
1299         Test: compositing/tiling/tiled-drawing-async-frame-scrolling.html
1300
1301         * rendering/RenderLayerBacking.cpp:
1302         (WebCore::RenderLayerBacking::updateGeometry): Do not set opaque contents for frames with
1303         tiled backing. We keep !m_isMainFrameRenderViewLayer for backward compatibility with WK1.
1304         (WebCore::RenderLayerBacking::setBackgroundLayerPaintsFixedRootBackground): Add an early
1305         return when m_backgroundLayerPaintsFixedRootBackground is not changed. Remove the slow
1306         repaint object previously registered for this frame. Also add an ASSERT to ensure that a
1307         fixed root background is only set for frames with async scrolling.
1308         (WebCore::RenderLayerBacking::updateRootLayerConfiguration): Restrict some special handling
1309         of background and opaqueness to the main frame.
1310
1311 2017-11-21  Simon Fraser  <simon.fraser@apple.com>
1312
1313         Some FELighting cleanup
1314         https://bugs.webkit.org/show_bug.cgi?id=179924
1315
1316         Reviewed by Sam Weinig.
1317
1318         Make the normal-computation functions const and have them return an IntSize.
1319         Replace bit shifting with multiply by two (compilers know how to do this, folks).
1320
1321         * platform/graphics/filters/FELighting.cpp:
1322         (WebCore::FELighting::LightingData::topLeftNormal const):
1323         (WebCore::FELighting::LightingData::topRowNormal const):
1324         (WebCore::FELighting::LightingData::topRightNormal const):
1325         (WebCore::FELighting::LightingData::leftColumnNormal const):
1326         (WebCore::FELighting::LightingData::interiorNormal const):
1327         (WebCore::FELighting::LightingData::rightColumnNormal const):
1328         (WebCore::FELighting::LightingData::bottomLeftNormal const):
1329         (WebCore::FELighting::LightingData::bottomRowNormal const):
1330         (WebCore::FELighting::LightingData::bottomRightNormal const):
1331         (WebCore::FELighting::inlineSetPixel):
1332         (WebCore::FELighting::setPixel):
1333         (WebCore::FELighting::platformApplyGenericPaint):
1334         (WebCore::FELighting::drawLighting):
1335         (WebCore::FELighting::LightingData::topLeft): Deleted.
1336         (WebCore::FELighting::LightingData::topRow): Deleted.
1337         (WebCore::FELighting::LightingData::topRight): Deleted.
1338         (WebCore::FELighting::LightingData::leftColumn): Deleted.
1339         (WebCore::FELighting::LightingData::interior): Deleted.
1340         (WebCore::FELighting::LightingData::rightColumn): Deleted.
1341         (WebCore::FELighting::LightingData::bottomLeft): Deleted.
1342         (WebCore::FELighting::LightingData::bottomRow): Deleted.
1343         (WebCore::FELighting::LightingData::bottomRight): Deleted.
1344         * platform/graphics/filters/FELighting.h:
1345
1346 2017-11-21  Christopher Reid  <chris.reid@sony.com>
1347
1348         [PAL] Remove FileSystem's dependency on WebCoreNSStringExtras
1349         https://bugs.webkit.org/show_bug.cgi?id=179504
1350
1351         Reviewed by Darin Adler.
1352
1353         No new tests no change in behavior.
1354
1355         Removed WebCoreNSStringExtras.
1356         Replaced calls to string helpers in WebCoreNSStringExtras with calls to WTF::String.
1357         Moved filenameByFixingIllegalCharacters into LoaderNSURLExtras.
1358         Moved preferredBundleLocalizationName into WebKitLegacy.
1359
1360         * PlatformMac.cmake: Removed WebCoreNSStringExtras.mm
1361         * SourcesCocoa.txt: Removed WebCoreNSStringExtras.mm
1362         * WebCore.xcodeproj/project.pbxproj: Removed WebCoreNSStringExtras
1363         * loader/mac/LoaderNSURLExtras.h:
1364         * loader/mac/LoaderNSURLExtras.mm:
1365         * platform/graphics/mac/FontCacheMac.mm:
1366         * platform/mac/PasteboardMac.mm:
1367         * platform/mac/WebCoreNSURLExtras.mm:
1368
1369 2017-11-21  Simon Fraser  <simon.fraser@apple.com>
1370
1371         Use vImage to do alpha premultiplication/unpremultiplication in FilterEffect
1372         https://bugs.webkit.org/show_bug.cgi?id=179928
1373
1374         Reviewed by Tim Horton.
1375
1376         The vImage functions are about twice as fast as the existing code.
1377
1378         * platform/graphics/filters/FilterEffect.cpp:
1379         (WebCore::copyPremultiplyingAlpha):
1380         (WebCore::copyUnpremultiplyingAlpha):
1381         (WebCore::FilterEffect::copyUnmultipliedImage):
1382         (WebCore::FilterEffect::copyPremultipliedImage):
1383
1384 2017-11-21  Carlos Garcia Campos  <cgarcia@igalia.com>
1385
1386         [GLIB] Test FileMonitorTest.DetectChangeAndThenDelete sometimes crashes
1387         https://bugs.webkit.org/show_bug.cgi?id=179909
1388
1389         Reviewed by Michael Catanzaro.
1390
1391         The problem sems to be that the GFileMonitor is created in the main thread, but destroyed in the WorkQueue
1392         thread. We can create the monitor in the WorkQueue thread and do the monitoring there.
1393
1394         Fixes unit test FileMonitorTest.DetectChangeAndThenDelete.
1395
1396         * platform/glib/FileMonitorGLib.cpp:
1397         (WebCore::FileMonitor::FileMonitor): Create the GFileMonitor in the WorkQueue.
1398         (WebCore::FileMonitor::didChange): No need to dispatch the handler in the WorkQueue, since this is now called in
1399         the WorkQueue.
1400
1401 2017-11-21  Zan Dobersek  <zdobersek@igalia.com>
1402
1403         [Cairo] drawNativeImage(), drawPattern() in CairoOperations should operate directly with cairo_surface_t objects
1404         https://bugs.webkit.org/show_bug.cgi?id=179888
1405
1406         Reviewed by Carlos Garcia Campos.
1407
1408         Cairo::drawNativeImage() should receive a valid cairo_surface_t pointer
1409         and work with that, instead of using a NativeImagePtr. Callers are thus
1410         forced to pass the pointer into the drawNativeImage() call, and the
1411         CairoOperations implementation file drops the need to know about the
1412         NativeImagePtr type alias.
1413
1414         Cairo::drawPattern() now accepts pointer to the cairo_surface_t object,
1415         along with an IntSize object that descibes the surface's size. This way
1416         it's up to the caller to retrieve any valid native image for the current
1417         frame and pass that to the drawPattern() call. The need to use IntSize
1418         here is strange, but we should investigate this later.
1419
1420         No new tests -- no change in behavior.
1421
1422         * platform/graphics/cairo/CairoOperations.cpp:
1423         (WebCore::Cairo::drawNativeImage):
1424         (WebCore::Cairo::drawPattern):
1425         * platform/graphics/cairo/CairoOperations.h: Include the Cairo header.
1426         Also fix forward declaration of Cairo::drawGlyphs().
1427         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1428         (WebCore::GraphicsContext::drawNativeImage):
1429         (WebCore::GraphicsContext::drawPattern):
1430         * platform/graphics/cairo/NativeImageCairo.cpp:
1431         (WebCore::drawNativeImage): Execute operation through GraphicsContext,
1432         kicking into effect any recording that could be done this way.
1433
1434 2017-11-21  Zan Dobersek  <zdobersek@igalia.com>
1435
1436         [Cairo] Gradient::fill() should only operate on PlatformContextCairo
1437         https://bugs.webkit.org/show_bug.cgi?id=179887
1438
1439         Reviewed by Carlos Garcia Campos.
1440
1441         In Gradient::fill(), directly invoke Cairo::save() and Cairo::restore(),
1442         instead of doing so indirectly through GraphicsContext::save() and
1443         GraphicsContext::restore(). The latter pair stashes the internal state
1444         that's managed in GraphicsContext, but that doesn't get modified at all
1445         in this case.
1446
1447         No new tests -- no change in behavior.
1448
1449         * platform/graphics/cairo/GradientCairo.cpp:
1450         (WebCore::Gradient::fill):
1451
1452 2017-11-21  Frederic Wang  <fwang@igalia.com>
1453
1454         Remove unintentionally committed .orig file.
1455         https://bugs.webkit.org/show_bug.cgi?id=174131
1456
1457         Unreviewed, fix previous commit.
1458
1459         * rendering/mathml/RenderMathMLScripts.cpp.orig: Removed.
1460
1461 2017-11-21  Frederic Wang  <fwang@igalia.com>
1462
1463         ASSERTION FAILED: !needsLayout() in WebCore::RenderMathMLScripts::firstLineBaseline
1464         https://bugs.webkit.org/show_bug.cgi?id=174131
1465
1466         Reviewed by Alejandro G. Castro.
1467
1468         RenderMathMLScripts::firstLineBaseline() has an ASSERT at the beginning to ensure that the function
1469         is called after the element was laid out. However, this is not respected by HTML table layout as
1470         RenderBlock::firstLineBaseline() is called for elements in a table cell before they are laid out.
1471         This happens for example for RenderGrid::firstLineBaseline() and probably for other renderers.
1472         Additionally, RenderMathMLScripts::firstLineBaseline() only involves calling firstLineBaseline();
1473         logicalTop() or logicalHeight() on the first child box so it is safe to call it before layout, even
1474         if the return value might be wrong at that time. This patch removes this too restrictive ASSERT for
1475         RenderMathMLScripts, for consistency with other implementations of firstLineBaseline().
1476
1477         Test: mathml/cells-and-scripts-crash.html
1478
1479         * rendering/mathml/RenderMathMLScripts.cpp:
1480         (WebCore::RenderMathMLScripts::firstLineBaseline const): Remove the ASSERT.
1481
1482 2017-11-20  Mario Sanchez Prada  <mario@endlessm.com>
1483
1484         [GTK] New API to add, retrieve and delete cookies via WebKitCookieManager
1485         https://bugs.webkit.org/show_bug.cgi?id=177932
1486
1487         Reviewed by Carlos Garcia Campos.
1488
1489         Implemented setCookie(), getCookies() and deleteCookie() in the Soup
1490         backend, and refactored some utility functions and conversions out of
1491         NetworkStorageSessionSoup into a new CookieSoup.cpp file, so
1492         that we now can convert between SoupCookie* and WebCore::Cookie
1493         easily from anywhere (this is now needed from the UI Process).
1494
1495         * platform/Cookie.h: Add declarations for the new conversions.
1496         * platform/SourcesSoup.txt: Add CookieSoup.cpp.
1497         * platform/network/soup/CookieSoup.cpp: Added.
1498         (WebCore::Cookie::Cookie): New constructor, creates a WebCore::Cookie out of a SoupCookie*.
1499         (WebCore::msToSoupDate): Moved from NetworkStorageSessionSoup.cpp.
1500         (WebCore::Cookie::toSoupCookie): New, based on toSoupCookie() from NetworkStorageSessionSoup.cpp.
1501         * platform/network/soup/NetworkStorageSessionSoup.cpp:
1502         (WebCore::NetworkStorageSession::setCookies): Used the new implicit conversion.
1503         (WebCore::NetworkStorageSession::setCookie): Newly implemented.
1504         (WebCore::NetworkStorageSession::deleteCookie): Newly implemented.
1505         (WebCore::NetworkStorageSession::getCookies): Newly implemented.
1506
1507 2017-11-20  Zalan Bujtas  <zalan@apple.com>
1508
1509         Remove slow repaint object from FrameView when style changes.
1510         https://bugs.webkit.org/show_bug.cgi?id=179871
1511
1512         Reviewed by Antti Koivisto.
1513
1514         The "oldStyleSlowScroll" value does not need to be computed. We already know its value
1515         by checking the HashSet. This code is also unnecessarily complicated and error prone
1516         (could lead to UAF errors by leaving stale renderers in the slow paint list).
1517
1518         Test: fast/repaint/slow-repaint-object-crash.html
1519
1520         * rendering/RenderElement.cpp:
1521         (WebCore::RenderElement::styleWillChange):
1522
1523 2017-11-20  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1524
1525         [WPE] GLContextEGLWPE.cpp:44:96: error: invalid cast from type ‘GLNativeWindowType {aka long long unsigned int}’ to type ‘EGLNativeWindowType {aka unsigned int}
1526         https://bugs.webkit.org/show_bug.cgi?id=179511
1527
1528         Reviewed by Žan Doberšek.
1529
1530         r217208 changed the definition of GLNativeWindowType from EGLNativeWindowType to uint64_t for platform WPE.
1531         This built fine on a 64-bit platform since uint64_t matches the size of a pointer, but fails on 32-bits.
1532
1533         This switches back the definition to EGLNativeWindowType.
1534         And we need to include <EGL/eglplatform.h> first in order to get a definition for EGLNativeWindowType itself.
1535
1536         This commit pretty much reverts the changes r217208 did on platform/graphics/GLContext.h
1537
1538         No new tests, it is a build fix.
1539
1540         * platform/graphics/GLContext.h:
1541
1542 2017-11-20  Michael Catanzaro  <mcatanzaro@igalia.com>
1543
1544         Remove ENABLE_ALLINONE_BUILD option
1545         https://bugs.webkit.org/show_bug.cgi?id=179823
1546
1547         Reviewed by Darin Adler.
1548
1549         * CMakeLists.txt:
1550
1551 2017-11-20  Emilio Cobos Álvarez  <emilio@crisal.io>
1552
1553         Incorrect computed style in pseudo-elements with display: contents
1554         https://bugs.webkit.org/show_bug.cgi?id=179812
1555
1556         Reviewed by Antti Koivisto.
1557
1558         Bug 178513 gave them an anon renderer as the main renderer. Unfortunately, the
1559         style of that box is exposed via getComputedStyle, so that needs to be handled
1560         somehow to return the correct style.
1561
1562         Tests: imported/w3c/web-platform-tests/cssom/getComputedStyle-pseudo.html
1563
1564         * css/CSSComputedStyleDeclaration.cpp:
1565         (WebCore::ComputedStyleExtractor::styledRenderer const):
1566           Don't return a display: contents pseudo anon box.
1567         * dom/Element.cpp:
1568         (WebCore::Element::hasDisplayContents const):
1569           Just look at the rare data style.
1570         (WebCore::Element::existingComputedStyle const):
1571           Look at the rare data first. This also fixes an inefficiency in the
1572           sense that before then we'd compare the anon box style to the
1573           pseudo-element style during style update, that may be more changes
1574           than needed.
1575         * style/RenderTreeUpdaterGeneratedContent.cpp:
1576         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
1577         * style/StyleTreeResolver.cpp:
1578         (WebCore::Style::TreeResolver::resolvePseudoStyle):
1579           Move the anon box creation to render tree update instead of style
1580           resolution.
1581
1582 2017-11-19  Tim Horton  <timothy_horton@apple.com>
1583
1584         Remove unused TOUCH_ICON_LOADING feature flag
1585         https://bugs.webkit.org/show_bug.cgi?id=179873
1586
1587         Reviewed by Simon Fraser.
1588
1589         * Configurations/FeatureDefines.xcconfig:
1590
1591 2017-11-19  Tim Horton  <timothy_horton@apple.com>
1592
1593         Remove unused LEGACY_VENDOR_PREFIXES feature flag
1594         https://bugs.webkit.org/show_bug.cgi?id=179872
1595
1596         Reviewed by Darin Adler.
1597
1598         * Configurations/FeatureDefines.xcconfig:
1599
1600 2017-11-18  Darin Adler  <darin@apple.com>
1601
1602         Eliminate some cases of double hashing, other related refactoring
1603         https://bugs.webkit.org/show_bug.cgi?id=179867
1604
1605         Reviewed by Sam Weinig.
1606
1607         * Modules/indexeddb/IDBTransaction.cpp:
1608         (WebCore::IDBTransaction::objectStore): Use get instead of find.
1609
1610         * Modules/mediasource/MediaSourceRegistry.cpp:
1611         (WebCore::MediaSourceRegistry::unregisterURL): Use take instead of find/remove.
1612
1613         * accessibility/AXObjectCache.cpp:
1614         (WebCore::AXObjectCache::~AXObjectCache): Call setAXObjectID instead of
1615         using the removeAXID, which doesn't do anything else useful in the destructor.
1616         (WebCore::AXObjectCache::remove): Use take instead of get/remove. Also rearrange
1617         logic to eliminate the removeAXID function.
1618         (WebCore::AXObjectCache::removeAXID): Deleted. This only did two things,
1619         setAXObjectID(0) and remove from m_idsInUse, and was only called in one place
1620         besides the destructor. Clearer to not have this funtion.
1621         (WebCore::AXObjectCache::visiblePositionForTextMarkerData): Use m_idsInUse
1622         directly instead of using a function.
1623
1624         * accessibility/AXObjectCache.h: Deleted removeAXID and isIDinUse.
1625
1626         * dom/Document.cpp:
1627         (WebCore::Document::removedLastRef): Call UserActionElementSet::clear instead
1628         of UserActionElementSet::documentDidRemoveLastRef; new name fo the same function.
1629         (WebCore::Document::updateHoverActiveState): Use a reference when calling
1630         setInActiveChain.
1631
1632         * dom/Element.cpp:
1633         (WebCore::Element::isUserActionElementInActiveChain const): Pass reference
1634         instead of pointer.
1635         (WebCore::Element::isUserActionElementActive const): Ditto.
1636         (WebCore::Element::isUserActionElementFocused const): Ditto.
1637         (WebCore::Element::isUserActionElementHovered const): Ditto.
1638         (WebCore::Element::setActive): Ditto.
1639         (WebCore::Element::setFocus): Ditto.
1640         (WebCore::Element::setHovered): Ditto.
1641         (WebCore::Element::clearHoverAndActiveStatusBeforeDetachingRenderer): Ditto.
1642
1643         * dom/GenericEventQueue.cpp:
1644         (WebCore::GenericEventQueue::resume): Removed unneeded speical case for
1645         empty vector.
1646
1647         * dom/ProcessingInstruction.cpp:
1648         (WebCore::ProcessingInstruction::checkStyleSheet): Updated now that
1649         parseAttributes returns an optional instead of using a boolean "OK" out argument.
1650
1651         * dom/SelectorQuery.cpp:
1652         (WebCore::SelectorQueryCache::add): Use get instead of find.
1653
1654         * dom/UserActionElementSet.cpp:
1655         (WebCore::UserActionElementSet::didDetach): Deleted. Moved to class definition and
1656         named clearActiveAndHovered.
1657         (WebCore::UserActionElementSet::clear): Renamed documentDidRemoveLastRef to clear.
1658         (WebCore::UserActionElementSet::hasFlag const): Renamed from hasFlags and also
1659         take reference and enumeration instead of pointer and unsigned. Makes it clearer
1660         this does not allow null and that it works on a single flag, not a set of flags.
1661         (WebCore::UserActionElementSet::clearFlags): Changed argument types to reference
1662         and OptionSet to make it clear this works on a set of flags.
1663         (WebCore::UserActionElementSet::setFlags): Ditto.
1664
1665         * dom/UserActionElementSet.h: Updated for changes above. Also made some name
1666         changes, and used an enum class instead of an enum.
1667
1668         * html/BaseCheckableInputType.cpp:
1669         (WebCore::BaseCheckableInputType::saveFormControlState const): Updated since
1670         FormControlState is now just a vector, not a class.
1671         * html/FileInputType.cpp:
1672         (WebCore::FileInputType::filesFromFormControlState): Ditto.
1673         (WebCore::FileInputType::restoreFormControlState): Removed unneeded check that
1674         valueSize is a multiple of 2. Code will ignore any extra strings at the end, so
1675         there is no need for the validity check.
1676
1677         * html/FormController.cpp:
1678         (WebCore::serializeFormControlStateTo): Made a non-member function since
1679         FormControlState is now just a vector, not a class.
1680         (WebCore::deserializeFormControlState): Ditto. Also return optional instead
1681         of relying on a special failure state.
1682         (WebCore::SavedFormState::deserialize): Updated for above changes.
1683         (WebCore::SavedFormState::serializeTo const): Ditto.
1684         (WebCore::SavedFormState::appendControlState): Use add instead of both find and add
1685         to avoid double hashing.
1686         (WebCore::SavedFormState::takeControlState): Removed unneeded check for empty
1687         hash table and tweaked coding style.
1688         (WebCore::SavedFormState::referencedFilePaths const): Renamed to remove "get".
1689         (WebCore::FormKeyGenerator::formKey): Use ensure instead of find and add.
1690         (WebCore::FormController::formElementsCharacterCount const): Don't call
1691         saveFormControlState for non-text-form-controls since we ignored those values.
1692         (WebCore::FormController::willDeleteForm): Take a reference.
1693         (WebCore::FormController::restoreControlStateFor): Update since FormControlState
1694         is now a vector.
1695         (WebCore::FormController::restoreControlStateIn): Use is/downcast and update
1696         since FormControlState is now a vector.
1697         (WebCore::FormController::referencedFilePaths): Renamed to remove "get".
1698         (WebCore::FormController::registerFormElementWithState):Take a reference.
1699         (WebCore::FormController::unregisterFormElementWithState): Ditto.
1700
1701         * html/FormController.h: Removed FormControlState class since it was just a
1702         Vector<String> with various unneeded features, such as a "failure" state,
1703         and a never-looked-at type of "skip" or "restore". Updated for other changes
1704         above.
1705
1706         * html/HTMLFormControlElementWithState.cpp:
1707         (WebCore::HTMLFormControlElementWithState::insertedIntoAncestor): Pass reference.
1708         (WebCore::HTMLFormControlElementWithState::removedFromAncestor): Ditto.
1709         * html/HTMLFormControlElementWithState.h: Updated for the above. Also added
1710         support for using is/downcast on this.
1711
1712         * html/HTMLFormElement.cpp:
1713         (WebCore::HTMLFormElement::~HTMLFormElement): Pass reference.
1714
1715         * html/HTMLSelectElement.cpp:
1716         (WebCore::HTMLSelectElement::saveFormControlState const): Use reserveInitialCapacit
1717         and uncheckedAppend.
1718         (WebCore::HTMLSelectElement::restoreFormControlState): Updated since state is now
1719         a vector.
1720         * html/HTMLTextAreaElement.cpp:
1721         (WebCore::HTMLTextAreaElement::saveFormControlState const): Ditto.
1722         * html/HiddenInputType.cpp:
1723         (WebCore::HiddenInputType::saveFormControlState const): Ditto.
1724         * html/InputType.cpp:
1725         (WebCore::InputType::saveFormControlState const): Ditto.
1726
1727         * inspector/agents/InspectorCSSAgent.cpp:
1728         (WebCore::InspectorCSSAgent::forcePseudoState): Use get instead of find/end and got
1729         rid of uneeded special case. In another overload, ue add and remove instead of
1730         a find followed by a set or a remove.
1731         (WebCore::InspectorCSSAgent::asInspectorStyleSheet): Use ensure instead of find/set.
1732         (WebCore::InspectorCSSAgent::didRemoveDOMNode): Use take instead of find/remove.
1733         (WebCore::InspectorCSSAgent::didModifyDOMAttr): Use get instead of find.
1734         * inspector/agents/InspectorCSSAgent.h: Removed unneeded NodeToInspectorStyleSheet
1735         typedef and changed value type to Ref instead of RefPtr.
1736
1737         * inspector/agents/InspectorDOMAgent.cpp:
1738         (WebCore::InspectorDOMAgent::unbind): Use remove instead of contains/remove.
1739         (WebCore::InspectorDOMAgent::nodeForId): Use isValidKey instead of just checking for
1740         0 and use get instead of find.
1741         (WebCore::InspectorDOMAgent::setAttributesAsText): Take out bogus const.
1742         (WebCore::InspectorDOMAgent::moveTo): Ditto.
1743         (WebCore::InspectorDOMAgent::resolveNode): Ditto.
1744         (WebCore::InspectorDOMAgent::isWhitespace): Added FIXME. Use is<Text> instead of
1745         slower nodeType.
1746         * inspector/agents/InspectorDOMAgent.h: Removed bogus const.
1747
1748         * inspector/agents/InspectorLayerTreeAgent.cpp:
1749         (WebCore::InspectorLayerTreeAgent::bind): Use ensure instead of get/set.
1750         (WebCore::InspectorLayerTreeAgent::unbind): Use take instead of find/remove.
1751         (WebCore::InspectorLayerTreeAgent::bindPseudoElement): Use ensure instead of get/set.
1752         (WebCore::InspectorLayerTreeAgent::unbindPseudoElement): Use take instead of
1753         find/remove.
1754
1755         * inspector/agents/InspectorPageAgent.cpp:
1756         (WebCore::InspectorPageAgent::getCookies): Use add instead of contains/add.
1757         (WebCore::InspectorPageAgent::frameDetached): Use take instead of find/remove.
1758         (WebCore::InspectorPageAgent::frameId): Use ensure instead of get/set.
1759         (WebCore::InspectorPageAgent::loaderId): Use ensure instead of get/set.
1760         (WebCore::InspectorPageAgent::findFrameWithSecurityOrigin): Got rid of unneeded
1761         local variable.
1762
1763         * loader/cache/CachedResourceLoader.cpp:
1764         (WebCore::CachedResourceLoader::sessionID const): Tweaked coding style and added
1765         a null check for page.
1766         (WebCore::CachedResourceLoader::requestResource): Call page directly on the frame
1767         instead of first getting the main frame. Also use take instead of find/remove.
1768         (WebCore::CachedResourceLoader::removeCachedResource): Rewrite assertion.
1769
1770         * platform/graphics/FontGenericFamilies.cpp:
1771         (WebCore::setGenericFontFamilyForScript): Use remove instead of find/remove.
1772         Simplified the logic a bit in the add case.
1773
1774         * platform/graphics/ca/GraphicsLayerCA.cpp:
1775         (WebCore::GraphicsLayerCA::pauseAnimation): Use add instead of find/add.
1776         Removed code that said "if (action != Remove) action = Pause" since that is a
1777         no-op; there are only two actions, Remove and Pause.
1778
1779         * rendering/RenderThemeMac.mm:
1780         (WebCore::RenderThemeMac::mediaControlsScript): Use makeString instead of StringBuilder.
1781         (WebCore::RenderThemeMac::systemColor const): Rewrote to use ensure instead of add.
1782         Also crunched the code a little.
1783
1784         * testing/Internals.cpp:
1785         (WebCore::Internals::getReferencedFilePaths const): Updated function name.
1786
1787         * xml/parser/XMLDocumentParser.h: Updated for change below.
1788         * xml/parser/XMLDocumentParserLibxml2.cpp:
1789         (WebCore::attributesStartElementNsHandler): Updated to use std::optional instead of
1790         a separate boolean for AttributeParseState.
1791         (WebCore::parseAttributes): Ditto. Also changed the return value to work the same way.
1792
1793 2017-11-19  Sam Weinig  <sam@webkit.org>
1794
1795         Clean up gradient code in preparation for conic gradients
1796         https://bugs.webkit.org/show_bug.cgi?id=179595
1797
1798         Reviewed by Darin Adler.
1799
1800         - Switches Gradient to use a Varient with type specific data structs and makes the 
1801           points / radii immutable.
1802         - Replaces CSSGradientValue::addStops with template function CSSGradientValue::computeStops
1803           which dispatches to a helper adoptor struct which is passed in for gradient type specific
1804           values, rather than switching on type in the function itself. In addition, the function no
1805           longer mutates a Gradient, but rather mutates type specific the data struct (e.g. Linear or
1806           Radial for now).
1807
1808         * css/CSSGradientValue.cpp:
1809         (WebCore::LinearGradientAdaptor::LinearGradientAdaptor):
1810         (WebCore::RadialGradientAdaptor::RadialGradientAdaptor):
1811
1812             Add helper structs for the now templatized CSSGradientValue::computeStops that
1813             implement type specific functionality.
1814
1815         (WebCore::CSSGradientValue::computeStops):
1816         
1817             Renamed from addStops. Now takes a GradientAdaptor wrapper which abstracts out
1818             the gradient type specific functionlity.
1819         
1820         (WebCore::CSSLinearGradientValue::createGradient):
1821         (WebCore::CSSRadialGradientValue::createGradient):
1822         (WebCore::CSSConicGradientValue::createGradient):
1823         
1824             Update to call computeStops and use new Gradient create function. 
1825         
1826         * css/CSSGradientValue.h:
1827         
1828             Update for new signature for computeStops.
1829         
1830         * html/canvas/CanvasGradient.cpp:
1831         (WebCore::CanvasGradient::CanvasGradient):
1832         
1833             Update to use new Gradient create function.
1834         
1835         * inspector/InspectorCanvas.cpp:
1836         (WebCore::InspectorCanvas::buildArrayForCanvasGradient):
1837         
1838             Update to get gradient point / radii information from the data accessor.
1839
1840         * platform/graphics/Gradient.cpp:
1841         (WebCore::Gradient::Gradient):
1842         
1843             Update constructors to the new data structs.
1844         
1845         (WebCore::Gradient::type const):
1846         
1847             Add helper to get the type of the varient, need for inspector code.
1848         
1849         (WebCore::Gradient::adjustParametersForTiledDrawing):
1850         (WebCore::Gradient::isZeroSize const):
1851         (WebCore::Gradient::hash const):
1852         
1853             Update to switch on the underlying variant to get data values.
1854         
1855         (WebCore::Gradient::addColorStop):
1856         
1857             Simplify by having one addColorStop call the other.
1858             
1859         (WebCore::Gradient::setSortedColorStops):
1860         
1861             Added. Replaces setStopsSorted. Used now that CSSGradientValue computes and sorts
1862             its color stops before creating the gradient.
1863
1864         * platform/graphics/Gradient.h:
1865         (WebCore::Gradient::create):
1866         
1867             Replace create functions with ones that take data structs.
1868         
1869         (WebCore::Gradient::data const):
1870
1871             Add accessor for the underlying variant.
1872
1873         (WebCore::Gradient::isRadial const): Deleted.
1874         
1875             Replaced by type accessor.
1876         
1877         (WebCore::Gradient::p0 const): Deleted.
1878         (WebCore::Gradient::p1 const): Deleted.
1879         (WebCore::Gradient::setP0): Deleted.
1880         (WebCore::Gradient::setP1): Deleted.
1881         (WebCore::Gradient::startRadius const): Deleted.
1882         (WebCore::Gradient::endRadius const): Deleted.
1883         (WebCore::Gradient::setStartRadius): Deleted.
1884         (WebCore::Gradient::setEndRadius): Deleted.
1885         
1886             Point and radii are now immutable.
1887         
1888         (WebCore::Gradient::setStopsSorted): Deleted.
1889         
1890             Replaced by setSortedColorStops function.
1891         
1892         * platform/graphics/GraphicsContext.cpp:
1893         (WebCore::GraphicsContext::fillRect):
1894         
1895             Pass the GraphicsContext by reference.
1896         
1897         * platform/graphics/cairo/GradientCairo.cpp:
1898         (WebCore::Gradient::createPlatformGradient):
1899
1900             Update to switch on the underlying variant to get data values.
1901
1902         (WebCore::Gradient::fill):
1903         
1904             Pass the GraphicsContext by reference.
1905         
1906         * platform/graphics/cg/GradientCG.cpp:
1907         (WebCore::Gradient::platformDestroy):
1908         
1909             Use nullptr.
1910         
1911         (WebCore::Gradient::fill):
1912         
1913             Pass the GraphicsContext by reference.
1914         
1915         (WebCore::Gradient::paint):
1916
1917             Update to switch on the underlying variant to get data values.
1918
1919         * platform/graphics/cg/GraphicsContextCG.cpp:
1920         (WebCore::GraphicsContext::fillPath):
1921         (WebCore::GraphicsContext::strokePath):
1922         (WebCore::GraphicsContext::fillRect):
1923         (WebCore::GraphicsContext::strokeRect):
1924         
1925             Pass the GraphicsContext by reference.
1926         
1927         * platform/graphics/win/GradientDirect2D.cpp:
1928         (WebCore::Gradient::generateGradient):
1929
1930             Update to switch on the underlying variant to get data values.
1931         
1932         (WebCore::Gradient::fill):
1933     
1934             Pass the GraphicsContext by reference.
1935         
1936         * rendering/RenderThemeIOS.mm:
1937         (WebCore::RenderThemeIOS::paintProgressBar):
1938         * rendering/svg/RenderSVGResourceLinearGradient.cpp:
1939         (WebCore::RenderSVGResourceLinearGradient::buildGradient const):
1940         * rendering/svg/RenderSVGResourceRadialGradient.cpp:
1941         (WebCore::RenderSVGResourceRadialGradient::buildGradient const):
1942         
1943             Update for new Gradient create function signature.
1944
1945 2017-11-19  Simon Fraser  <simon.fraser@apple.com>
1946
1947         Use TypedArrayView's setRange() in FETurbulence
1948         https://bugs.webkit.org/show_bug.cgi?id=179878
1949
1950         Reviewed by Sam Weinig.
1951
1952         Writing the 4 component values at once makes the function about 10% faster.
1953
1954         * platform/graphics/filters/FETurbulence.cpp:
1955         (WebCore::FETurbulence::fillRegion const):
1956
1957 2017-11-18  Chris Dumez  <cdumez@apple.com>
1958
1959         ASSERTION FAILED: registration in WebCore::SWServerJobQueue::scriptContextStarted(ServiceWorkerIdentifier)
1960         https://bugs.webkit.org/show_bug.cgi?id=179846
1961
1962         Reviewed by Darin Adler.
1963
1964         We have seen crashes on the bots in SWServerJobQueue because methods such as scriptContextStarted()
1965         can get called after the jobQueue has been cleared. This is because when a jobQueue is cleared,
1966         an asynchronous operation may be pending (e.g. script fetch, service worker starting, install event).
1967
1968         To address the issue, we now pass the identifier of the job that started the asynchronous operation
1969         when calling the methods on SWServerJobQueue. If the identifier does not match the identifier of
1970         the current job in the JobQueue, we ignore it.
1971
1972         This patch also starts using a strongly typed identifier (ServiceWorkerJobIdentifier) for
1973         ServiceWorkerJob, instead of a uint64_t. It also introduces a ServiceWorkerJobDataIdentifier type
1974         which contains both a SWServerConnectionIdentifier and a ServiceWorkerJobIdentifier. This is useful
1975         because ServiceWorkerJobData is passed to the StorageProcess and it needs a globally unique identifier.
1976         ServiceWorkerJobIdentifier is only guaranteed to be unique within a single WebProcess. Augmenting it
1977         with the SWServerConnectionIdentifier of the WebProcess makes it globally unique.
1978
1979         No new tests, unskipped exiting test.
1980
1981         * WebCore.xcodeproj/project.pbxproj:
1982         * workers/service/ServiceWorkerContainer.cpp:
1983         (WebCore::ServiceWorkerContainer::scheduleJob):
1984         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
1985         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
1986         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
1987         (WebCore::ServiceWorkerContainer::jobDidFinish):
1988         * workers/service/ServiceWorkerContainer.h:
1989         * workers/service/ServiceWorkerContextData.cpp:
1990         (WebCore::ServiceWorkerContextData::isolatedCopy const):
1991         * workers/service/ServiceWorkerContextData.h:
1992         (WebCore::ServiceWorkerContextData::encode const):
1993         (WebCore::ServiceWorkerContextData::decode):
1994         * workers/service/ServiceWorkerFetchResult.h:
1995         (WebCore::ServiceWorkerFetchResult::encode const):
1996         (WebCore::ServiceWorkerFetchResult::decode):
1997         * workers/service/ServiceWorkerJob.h:
1998         (WebCore::ServiceWorkerJob::identifier const):
1999         * workers/service/ServiceWorkerJobData.cpp:
2000         (WebCore::ServiceWorkerJobData::ServiceWorkerJobData):
2001         (WebCore::ServiceWorkerJobData::isolatedCopy const):
2002         * workers/service/ServiceWorkerJobData.h:
2003         (WebCore::ServiceWorkerJobData::connectionIdentifier const):
2004         (WebCore::ServiceWorkerJobData::identifier const):
2005         (WebCore::ServiceWorkerJobData::encode const):
2006         (WebCore::ServiceWorkerJobData::decode):
2007         * workers/service/ServiceWorkerJobDataIdentifier.h: Copied from Source/WebCore/workers/service/ServiceWorkerFetchResult.h.
2008         (WebCore::ServiceWorkerJobDataIdentifier::operator== const):
2009         (WebCore::ServiceWorkerJobDataIdentifier::loggingString const):
2010         (WebCore::ServiceWorkerJobDataIdentifier::encode const):
2011         (WebCore::ServiceWorkerJobDataIdentifier::decode):
2012         * workers/service/ServiceWorkerTypes.h:
2013         * workers/service/context/SWContextManager.cpp:
2014         (WebCore::SWContextManager::registerServiceWorkerThreadForInstall):
2015         * workers/service/context/SWContextManager.h:
2016         * workers/service/context/ServiceWorkerThread.cpp:
2017         (WebCore::ServiceWorkerThread::fireInstallEvent):
2018         * workers/service/server/SWClientConnection.cpp:
2019         (WebCore::SWClientConnection::scheduleJob):
2020         (WebCore::SWClientConnection::finishedFetchingScript):
2021         (WebCore::SWClientConnection::failedFetchingScript):
2022         (WebCore::SWClientConnection::jobRejectedInServer):
2023         (WebCore::SWClientConnection::registrationJobResolvedInServer):
2024         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
2025         (WebCore::SWClientConnection::startScriptFetchForServer):
2026         * workers/service/server/SWClientConnection.h:
2027         * workers/service/server/SWServer.cpp:
2028         (WebCore::SWServer::Connection::scheduleJobInServer):
2029         (WebCore::SWServer::rejectJob):
2030         (WebCore::SWServer::resolveRegistrationJob):
2031         (WebCore::SWServer::startScriptFetch):
2032         (WebCore::SWServer::scriptFetchFinished):
2033         (WebCore::SWServer::scriptContextFailedToStart):
2034         (WebCore::SWServer::scriptContextStarted):
2035         (WebCore::SWServer::didFinishInstall):
2036         (WebCore::SWServer::updateWorker):
2037         * workers/service/server/SWServer.h:
2038         * workers/service/server/SWServerJobQueue.cpp:
2039         (WebCore::SWServerJobQueue::isCurrentlyProcessingJob const):
2040         (WebCore::SWServerJobQueue::scriptFetchFinished):
2041         (WebCore::SWServerJobQueue::scriptContextFailedToStart):
2042         (WebCore::SWServerJobQueue::scriptContextStarted):
2043         (WebCore::SWServerJobQueue::didFinishInstall):
2044         * workers/service/server/SWServerJobQueue.h:
2045         * workers/service/server/SWServerToContextConnection.cpp:
2046         (WebCore::SWServerToContextConnection::scriptContextFailedToStart):
2047         (WebCore::SWServerToContextConnection::scriptContextStarted):
2048         (WebCore::SWServerToContextConnection::didFinishInstall):
2049         * workers/service/server/SWServerToContextConnection.h:
2050         * workers/service/server/SWServerWorker.cpp:
2051         (WebCore::SWServerWorker::scriptContextFailedToStart):
2052         (WebCore::SWServerWorker::scriptContextStarted):
2053         (WebCore::SWServerWorker::didFinishInstall):
2054         * workers/service/server/SWServerWorker.h:
2055
2056 2017-11-18  Nan Wang  <n_wang@apple.com>
2057
2058         AX: AOM: Implement number type properties
2059         https://bugs.webkit.org/show_bug.cgi?id=179497
2060
2061         Reviewed by Chris Fleizach.
2062
2063         Accessibility Object Model
2064         Explainer: https://wicg.github.io/aom/explainer.html
2065         Spec: https://wicg.github.io/aom/spec/
2066
2067         Implemented the number type properties for Accessibility Object Modal.
2068
2069         Test: accessibility/mac/AOM-number-properties.html
2070
2071         * accessibility/AXObjectCache.cpp:
2072         (WebCore::isNodeAriaVisible):
2073         * accessibility/AccessibilityARIAGrid.cpp:
2074         (WebCore::AccessibilityARIAGrid::isMultiSelectable const):
2075         * accessibility/AccessibilityARIAGridCell.cpp:
2076         (WebCore::AccessibilityARIAGridCell::rowIndexRange const):
2077         (WebCore::AccessibilityARIAGridCell::axRowSpanWithRowIndex const):
2078         (WebCore::AccessibilityARIAGridCell::columnIndexRange const):
2079         (WebCore::AccessibilityARIAGridCell::ariaRowSpanWithRowIndex const): Deleted.
2080         * accessibility/AccessibilityARIAGridCell.h:
2081         * accessibility/AccessibilityNodeObject.cpp:
2082         (WebCore::AccessibilityNodeObject::isEnabled const):
2083         (WebCore::AccessibilityNodeObject::isMultiSelectable const):
2084         (WebCore::AccessibilityNodeObject::isRequired const):
2085         (WebCore::AccessibilityNodeObject::headingLevel const):
2086         (WebCore::AccessibilityNodeObject::valueForRange const):
2087         (WebCore::AccessibilityNodeObject::maxValueForRange const):
2088         (WebCore::AccessibilityNodeObject::minValueForRange const):
2089         (WebCore::AccessibilityNodeObject::hierarchicalLevel const):
2090         * accessibility/AccessibilityObject.cpp:
2091         (WebCore::AccessibilityObject::intValueForProperty const):
2092         (WebCore::AccessibilityObject::unsignedValueForProperty const):
2093         (WebCore::AccessibilityObject::doubleValueForProperty const):
2094         (WebCore::AccessibilityObject::supportsSetSize const):
2095         (WebCore::AccessibilityObject::supportsPosInSet const):
2096         (WebCore::AccessibilityObject::setSize const):
2097         (WebCore::AccessibilityObject::posInSet const):
2098         (WebCore::AccessibilityObject::supportsARIASetSize const): Deleted.
2099         (WebCore::AccessibilityObject::supportsARIAPosInSet const): Deleted.
2100         (WebCore::AccessibilityObject::ariaSetSize const): Deleted.
2101         (WebCore::AccessibilityObject::ariaPosInSet const): Deleted.
2102         * accessibility/AccessibilityObject.h:
2103         * accessibility/AccessibilityRenderObject.cpp:
2104         (WebCore::AccessibilityRenderObject::defaultObjectInclusion const):
2105         (WebCore::AccessibilityRenderObject::liveRegionAtomic const):
2106         * accessibility/AccessibilityTable.cpp:
2107         (WebCore::AccessibilityTable::isDataTable const):
2108         (WebCore::AccessibilityTable::axColumnCount const):
2109         (WebCore::AccessibilityTable::axRowCount const):
2110         (WebCore::AccessibilityTable::ariaColumnCount const): Deleted.
2111         (WebCore::AccessibilityTable::ariaRowCount const): Deleted.
2112         * accessibility/AccessibilityTable.h:
2113         * accessibility/AccessibilityTableCell.cpp:
2114         (WebCore::AccessibilityTableCell::AccessibilityTableCell):
2115         (WebCore::AccessibilityTableCell::rowIndexRange const):
2116         (WebCore::AccessibilityTableCell::columnIndexRange const):
2117         (WebCore::AccessibilityTableCell::axColumnIndex const):
2118         (WebCore::AccessibilityTableCell::axRowIndex const):
2119         (WebCore::AccessibilityTableCell::axColumnSpan const):
2120         (WebCore::AccessibilityTableCell::axRowSpan const):
2121         (WebCore::AccessibilityTableCell::ariaColumnIndex const): Deleted.
2122         (WebCore::AccessibilityTableCell::ariaRowIndex const): Deleted.
2123         (WebCore::AccessibilityTableCell::ariaColumnSpan const): Deleted.
2124         (WebCore::AccessibilityTableCell::ariaRowSpan const): Deleted.
2125         * accessibility/AccessibilityTableCell.h:
2126         (WebCore::AccessibilityTableCell::setAXColIndexFromRow):
2127         (WebCore::AccessibilityTableCell::setARIAColIndexFromRow): Deleted.
2128         * accessibility/AccessibilityTableRow.cpp:
2129         (WebCore::AccessibilityTableRow::addChildren):
2130         (WebCore::AccessibilityTableRow::axColumnIndex const):
2131         (WebCore::AccessibilityTableRow::axRowIndex const):
2132         (WebCore::AccessibilityTableRow::ariaColumnIndex const): Deleted.
2133         (WebCore::AccessibilityTableRow::ariaRowIndex const): Deleted.
2134         * accessibility/AccessibilityTableRow.h:
2135         * accessibility/AccessibleNode.cpp:
2136         (WebCore::ariaAttributeMap):
2137         (WebCore::isPropertyValueInt):
2138         (WebCore::isPropertyValueUnsigned):
2139         (WebCore::isPropertyValueFloat):
2140         (WebCore::AccessibleNode::setProperty):
2141         (WebCore::AccessibleNode::setOptionalProperty):
2142         (WebCore::AccessibleNode::setStringProperty):
2143         (WebCore::AccessibleNode::optionalValueForProperty):
2144         (WebCore::AccessibleNode::effectiveBoolValueForElement):
2145         (WebCore::AccessibleNode::effectiveIntValueForElement):
2146         (WebCore::AccessibleNode::effectiveUnsignedValueForElement):
2147         (WebCore::AccessibleNode::effectiveDoubleValueForElement):
2148         (WebCore::AccessibleNode::atomic const):
2149         (WebCore::AccessibleNode::setAtomic):
2150         (WebCore::AccessibleNode::setAutocomplete):
2151         (WebCore::AccessibleNode::busy const):
2152         (WebCore::AccessibleNode::setBusy):
2153         (WebCore::AccessibleNode::setChecked):
2154         (WebCore::AccessibleNode::colCount const):
2155         (WebCore::AccessibleNode::setColCount):
2156         (WebCore::AccessibleNode::colIndex const):
2157         (WebCore::AccessibleNode::setColIndex):
2158         (WebCore::AccessibleNode::colSpan const):
2159         (WebCore::AccessibleNode::setColSpan):
2160         (WebCore::AccessibleNode::setCurrent):
2161         (WebCore::AccessibleNode::disabled const):
2162         (WebCore::AccessibleNode::setDisabled):
2163         (WebCore::AccessibleNode::expanded const):
2164         (WebCore::AccessibleNode::setExpanded):
2165         (WebCore::AccessibleNode::setHasPopUp):
2166         (WebCore::AccessibleNode::hidden const):
2167         (WebCore::AccessibleNode::setHidden):
2168         (WebCore::AccessibleNode::setInvalid):
2169         (WebCore::AccessibleNode::setKeyShortcuts):
2170         (WebCore::AccessibleNode::label const):
2171         (WebCore::AccessibleNode::setLabel):
2172         (WebCore::AccessibleNode::level const):
2173         (WebCore::AccessibleNode::setLevel):
2174         (WebCore::AccessibleNode::live const):
2175         (WebCore::AccessibleNode::setLive):
2176         (WebCore::AccessibleNode::modal const):
2177         (WebCore::AccessibleNode::setModal):
2178         (WebCore::AccessibleNode::multiline const):
2179         (WebCore::AccessibleNode::setMultiline):
2180         (WebCore::AccessibleNode::multiselectable const):
2181         (WebCore::AccessibleNode::setMultiselectable):
2182         (WebCore::AccessibleNode::setOrientation):
2183         (WebCore::AccessibleNode::setPlaceholder):
2184         (WebCore::AccessibleNode::posInSet const):
2185         (WebCore::AccessibleNode::setPosInSet):
2186         (WebCore::AccessibleNode::setPressed):
2187         (WebCore::AccessibleNode::readOnly const):
2188         (WebCore::AccessibleNode::setReadOnly):
2189         (WebCore::AccessibleNode::setRelevant):
2190         (WebCore::AccessibleNode::required const):
2191         (WebCore::AccessibleNode::setRequired):
2192         (WebCore::AccessibleNode::setRole):
2193         (WebCore::AccessibleNode::setRoleDescription):
2194         (WebCore::AccessibleNode::rowCount const):
2195         (WebCore::AccessibleNode::setRowCount):
2196         (WebCore::AccessibleNode::rowIndex const):
2197         (WebCore::AccessibleNode::setRowIndex):
2198         (WebCore::AccessibleNode::rowSpan const):
2199         (WebCore::AccessibleNode::setRowSpan):
2200         (WebCore::AccessibleNode::selected const):
2201         (WebCore::AccessibleNode::setSelected):
2202         (WebCore::AccessibleNode::setSize const):
2203         (WebCore::AccessibleNode::setSetSize):
2204         (WebCore::AccessibleNode::setSort):
2205         (WebCore::AccessibleNode::valueMax const):
2206         (WebCore::AccessibleNode::setValueMax):
2207         (WebCore::AccessibleNode::valueMin const):
2208         (WebCore::AccessibleNode::setValueMin):
2209         (WebCore::AccessibleNode::valueNow const):
2210         (WebCore::AccessibleNode::setValueNow):
2211         (WebCore::AccessibleNode::setValueText):
2212         (WebCore::AccessibleNode::boolValueForProperty): Deleted.
2213         (WebCore::AccessibleNode::setBoolProperty): Deleted.
2214         * accessibility/AccessibleNode.h:
2215         * accessibility/AccessibleNode.idl:
2216         * accessibility/atk/WebKitAccessibleInterfaceTable.cpp:
2217         (webkitAccessibleTableGetNColumns):
2218         (webkitAccessibleTableGetNRows):
2219         * accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp:
2220         (webkitAccessibleTableCellGetPosition):
2221         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
2222         (webkitAccessibleGetAttributes):
2223         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2224         (-[WebAccessibilityObjectWrapper accessibilityARIARowCount]):
2225         (-[WebAccessibilityObjectWrapper accessibilityARIAColumnCount]):
2226         (-[WebAccessibilityObjectWrapper accessibilityARIARowIndex]):
2227         (-[WebAccessibilityObjectWrapper accessibilityARIAColumnIndex]):
2228         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2229         (-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
2230         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
2231
2232 2017-11-18  Tim Horton  <timothy_horton@apple.com>
2233
2234         Fix typos in closing ENABLE() comments
2235         https://bugs.webkit.org/show_bug.cgi?id=179869
2236
2237         Unreviewed.
2238
2239         * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h:
2240         * platform/mediastream/mac/CoreAudioCaptureDeviceManager.h:
2241
2242 2017-11-18  Maciej Stachowiak  <mjs@apple.com>
2243
2244         Remove TEC support and all TEC-only encodings except EUC-TW (which now uses ICU)
2245         https://bugs.webkit.org/show_bug.cgi?id=179582
2246
2247         Reviewed by Darin Adler.
2248
2249         Already covered by fast/encoding/legacy-tec-encodings.html
2250
2251         * platform/text/TextCodecICU.cpp: Add support for EUC-TW.
2252
2253         Remove all vestiges of TEC text codec and its related autogeneration scripts.
2254         
2255         * DerivedSources.make:
2256         * PlatformMac.cmake:
2257         * SourcesMac.txt:
2258         * WebCore.order:
2259         * WebCore.xcodeproj/project.pbxproj:
2260         * platform/ThreadGlobalData.cpp:
2261         (WebCore::ThreadGlobalData::ThreadGlobalData): No more cached TEC decoder.
2262         (WebCore::ThreadGlobalData::destroy): ditto
2263         * platform/ThreadGlobalData.h:
2264         (WebCore::ThreadGlobalData::ThreadGlobalData::cachedConverterTEC): Deleted.
2265         * platform/text/TextEncodingRegistry.cpp:
2266         (WebCore::extendTextCodecMaps): Don't add TEC decoders on MAc.
2267         * platform/text/mac/CharsetData.h: Removed.
2268         * platform/text/mac/TextCodecMac.cpp: Removed.
2269         * platform/text/mac/TextCodecMac.h: Removed.
2270         * platform/text/mac/character-sets.txt: Removed.
2271         * platform/text/mac/ios-encodings.txt: Removed.
2272         * platform/text/mac/mac-encodings.txt: Removed.
2273         * platform/text/mac/make-charset-table.pl: Removed.
2274
2275 2017-11-18  Simon Fraser  <simon.fraser@apple.com>
2276
2277         Mechanical cleanup of FE* files
2278         https://bugs.webkit.org/show_bug.cgi?id=179868
2279
2280         Reviewed by Wenson Hsieh.
2281
2282         Remove unused dump() functions.
2283         Make overridden member functions in derived classes private.
2284         Make simple getters inline.
2285         
2286         Move common FESpecularLighting and FEDiffuseLighting functions into the 
2287         FELighting base class.
2288
2289         * platform/graphics/filters/FEBlend.cpp:
2290         (WebCore::FEBlend::blendMode const): Deleted.
2291         (WebCore::FEBlend::dump): Deleted.
2292         * platform/graphics/filters/FEBlend.h:
2293         (WebCore::FEBlend::blendMode const):
2294         * platform/graphics/filters/FEColorMatrix.cpp:
2295         (WebCore::FEColorMatrix::type const): Deleted.
2296         (WebCore::FEColorMatrix::values const): Deleted.
2297         (WebCore::FEColorMatrix::dump): Deleted.
2298         * platform/graphics/filters/FEColorMatrix.h:
2299         (WebCore::FEColorMatrix::type const):
2300         (WebCore::FEColorMatrix::values const):
2301         * platform/graphics/filters/FEComponentTransfer.cpp:
2302         (WebCore::FEComponentTransfer::redFunction const): Deleted.
2303         (WebCore::FEComponentTransfer::greenFunction const): Deleted.
2304         (WebCore::FEComponentTransfer::blueFunction const): Deleted.
2305         (WebCore::FEComponentTransfer::alphaFunction const): Deleted.
2306         (WebCore::FEComponentTransfer::dump): Deleted.
2307         * platform/graphics/filters/FEComponentTransfer.h:
2308         (WebCore::FEComponentTransfer::redFunction const):
2309         (WebCore::FEComponentTransfer::greenFunction const):
2310         (WebCore::FEComponentTransfer::blueFunction const):
2311         (WebCore::FEComponentTransfer::alphaFunction const):
2312         * platform/graphics/filters/FEComposite.cpp:
2313         (WebCore::FEComposite::operation const): Deleted.
2314         (WebCore::FEComposite::k1 const): Deleted.
2315         (WebCore::FEComposite::k2 const): Deleted.
2316         (WebCore::FEComposite::k3 const): Deleted.
2317         (WebCore::FEComposite::k4 const): Deleted.
2318         (WebCore::FEComposite::dump): Deleted.
2319         * platform/graphics/filters/FEComposite.h:
2320         (WebCore::FEComposite::operation const):
2321         (WebCore::FEComposite::k1 const):
2322         (WebCore::FEComposite::k2 const):
2323         (WebCore::FEComposite::k3 const):
2324         (WebCore::FEComposite::k4 const):
2325         * platform/graphics/filters/FEConvolveMatrix.cpp:
2326         (WebCore::FEConvolveMatrix::kernelSize const): Deleted.
2327         (WebCore::FEConvolveMatrix::kernel const): Deleted.
2328         (WebCore::FEConvolveMatrix::divisor const): Deleted.
2329         (WebCore::FEConvolveMatrix::bias const): Deleted.
2330         (WebCore::FEConvolveMatrix::targetOffset const): Deleted.
2331         (WebCore::FEConvolveMatrix::edgeMode const): Deleted.
2332         (WebCore::FEConvolveMatrix::kernelUnitLength const): Deleted.
2333         (WebCore::FEConvolveMatrix::preserveAlpha const): Deleted.
2334         (WebCore::FEConvolveMatrix::dump): Deleted.
2335         * platform/graphics/filters/FEConvolveMatrix.h:
2336         (WebCore::FEConvolveMatrix::kernelSize const):
2337         (WebCore::FEConvolveMatrix::kernel const):
2338         (WebCore::FEConvolveMatrix::divisor const):
2339         (WebCore::FEConvolveMatrix::bias const):
2340         (WebCore::FEConvolveMatrix::targetOffset const):
2341         (WebCore::FEConvolveMatrix::edgeMode const):
2342         (WebCore::FEConvolveMatrix::kernelUnitLength const):
2343         (WebCore::FEConvolveMatrix::preserveAlpha const):
2344         * platform/graphics/filters/FEDiffuseLighting.cpp:
2345         (WebCore::FEDiffuseLighting::lightingColor const): Deleted.
2346         (WebCore::FEDiffuseLighting::setLightingColor): Deleted.
2347         (WebCore::FEDiffuseLighting::surfaceScale const): Deleted.
2348         (WebCore::FEDiffuseLighting::setSurfaceScale): Deleted.
2349         (WebCore::FEDiffuseLighting::diffuseConstant const): Deleted.
2350         (WebCore::FEDiffuseLighting::kernelUnitLengthX const): Deleted.
2351         (WebCore::FEDiffuseLighting::setKernelUnitLengthX): Deleted.
2352         (WebCore::FEDiffuseLighting::kernelUnitLengthY const): Deleted.
2353         (WebCore::FEDiffuseLighting::setKernelUnitLengthY): Deleted.
2354         (WebCore::FEDiffuseLighting::lightSource const): Deleted.
2355         (WebCore::FEDiffuseLighting::dump): Deleted.
2356         * platform/graphics/filters/FEDiffuseLighting.h:
2357         (WebCore::FEDiffuseLighting::diffuseConstant const):
2358         * platform/graphics/filters/FEDisplacementMap.cpp:
2359         (WebCore::FEDisplacementMap::xChannelSelector const): Deleted.
2360         (WebCore::FEDisplacementMap::yChannelSelector const): Deleted.
2361         (WebCore::FEDisplacementMap::scale const): Deleted.
2362         (WebCore::FEDisplacementMap::dump): Deleted.
2363         * platform/graphics/filters/FEDisplacementMap.h:
2364         (WebCore::FEDisplacementMap::xChannelSelector const):
2365         (WebCore::FEDisplacementMap::yChannelSelector const):
2366         (WebCore::FEDisplacementMap::scale const):
2367         * platform/graphics/filters/FEDropShadow.cpp:
2368         (WebCore::FEDropShadow::dump): Deleted.
2369         * platform/graphics/filters/FEDropShadow.h:
2370         * platform/graphics/filters/FEFlood.cpp:
2371         (WebCore::FEFlood::floodColor const): Deleted.
2372         (WebCore::FEFlood::floodOpacity const): Deleted.
2373         (WebCore::FEFlood::dump): Deleted.
2374         * platform/graphics/filters/FEFlood.h:
2375         (WebCore::FEFlood::floodColor const):
2376         (WebCore::FEFlood::floodOpacity const):
2377         * platform/graphics/filters/FEGaussianBlur.cpp:
2378         (WebCore::FEGaussianBlur::stdDeviationX const): Deleted.
2379         (WebCore::FEGaussianBlur::stdDeviationY const): Deleted.
2380         (WebCore::FEGaussianBlur::edgeMode const): Deleted.
2381         (WebCore::FEGaussianBlur::dump): Deleted.
2382         * platform/graphics/filters/FEGaussianBlur.h:
2383         (WebCore::FEGaussianBlur::stdDeviationX const):
2384         (WebCore::FEGaussianBlur::stdDeviationY const):
2385         (WebCore::FEGaussianBlur::edgeMode const):
2386         * platform/graphics/filters/FELighting.cpp:
2387         (WebCore::FELighting::setSurfaceScale):
2388         (WebCore::FELighting::setLightingColor):
2389         (WebCore::FELighting::setKernelUnitLengthX):
2390         (WebCore::FELighting::setKernelUnitLengthY):
2391         * platform/graphics/filters/FELighting.h:
2392         (WebCore::FELighting::surfaceScale const):
2393         (WebCore::FELighting::lightingColor const):
2394         (WebCore::FELighting::kernelUnitLengthX const):
2395         (WebCore::FELighting::kernelUnitLengthY const):
2396         (WebCore::FELighting::lightSource const):
2397         * platform/graphics/filters/FEMerge.cpp:
2398         (WebCore::FEMerge::dump): Deleted.
2399         * platform/graphics/filters/FEMerge.h:
2400         * platform/graphics/filters/FEMorphology.cpp:
2401         (WebCore::FEMorphology::dump): Deleted.
2402         * platform/graphics/filters/FEMorphology.h:
2403         * platform/graphics/filters/FEOffset.cpp:
2404         (WebCore::FEOffset::dx const): Deleted.
2405         (WebCore::FEOffset::dy const): Deleted.
2406         (WebCore::FEOffset::dump): Deleted.
2407         * platform/graphics/filters/FEOffset.h:
2408         (WebCore::FEOffset::dx const):
2409         (WebCore::FEOffset::dy const):
2410         * platform/graphics/filters/FESpecularLighting.cpp:
2411         (WebCore::FESpecularLighting::lightingColor const): Deleted.
2412         (WebCore::FESpecularLighting::setLightingColor): Deleted.
2413         (WebCore::FESpecularLighting::surfaceScale const): Deleted.
2414         (WebCore::FESpecularLighting::setSurfaceScale): Deleted.
2415         (WebCore::FESpecularLighting::specularConstant const): Deleted.
2416         (WebCore::FESpecularLighting::specularExponent const): Deleted.
2417         (WebCore::FESpecularLighting::kernelUnitLengthX const): Deleted.
2418         (WebCore::FESpecularLighting::setKernelUnitLengthX): Deleted.
2419         (WebCore::FESpecularLighting::kernelUnitLengthY const): Deleted.
2420         (WebCore::FESpecularLighting::setKernelUnitLengthY): Deleted.
2421         (WebCore::FESpecularLighting::lightSource const): Deleted.
2422         (WebCore::FESpecularLighting::dump): Deleted.
2423         * platform/graphics/filters/FESpecularLighting.h:
2424         (WebCore::FESpecularLighting::specularConstant const):
2425         (WebCore::FESpecularLighting::specularExponent const):
2426         * platform/graphics/filters/FETile.cpp:
2427         (WebCore::FETile::dump): Deleted.
2428         * platform/graphics/filters/FETile.h:
2429         * platform/graphics/filters/FETurbulence.cpp:
2430         (WebCore::FETurbulence::dump): Deleted.
2431         * platform/graphics/filters/FETurbulence.h:
2432         * platform/graphics/filters/FilterEffect.h:
2433         * platform/graphics/filters/SourceAlpha.cpp:
2434         (WebCore::SourceAlpha::dump): Deleted.
2435         * platform/graphics/filters/SourceAlpha.h:
2436         * platform/graphics/filters/SourceGraphic.cpp:
2437         (WebCore::SourceGraphic::dump): Deleted.
2438         * platform/graphics/filters/SourceGraphic.h:
2439         * svg/graphics/filters/SVGFEImage.cpp:
2440         (WebCore::FEImage::dump): Deleted.
2441         * svg/graphics/filters/SVGFEImage.h:
2442
2443 2017-11-18  Simon Fraser  <simon.fraser@apple.com>
2444
2445         Attempt to fix Windows build failures seen in EWS.
2446         
2447         Remove default constructor for ColorComponents, which was ambiguous with the
2448         one that takes 4 values.
2449
2450         * platform/graphics/ColorUtilities.h:
2451
2452 2017-11-18  Simon Fraser  <simon.fraser@apple.com>
2453
2454         Line of garbage pixels at the bottom of an feTurbulence sometimes
2455         https://bugs.webkit.org/show_bug.cgi?id=179866
2456
2457         Reviewed by Wenson Hsieh.
2458         
2459         The ParallelJobs logic was broken in that the sum of the computed job
2460         heights was one too short sometimes. Fix and clean up the logic.
2461
2462         Test: svg/filters/feTurbulence-parallel-jobs.html
2463
2464         * platform/graphics/filters/FETurbulence.cpp:
2465         (WebCore::FETurbulence::platformApplySoftware):
2466
2467 2017-11-18  Simon Fraser  <simon.fraser@apple.com>
2468
2469         Use #pragma once in FE* files.
2470         
2471         Rubber-stamped by Dan Bates.
2472
2473         * platform/graphics/filters/FEBlend.h:
2474         * platform/graphics/filters/FEColorMatrix.h:
2475         * platform/graphics/filters/FEComponentTransfer.h:
2476         * platform/graphics/filters/FEComposite.h:
2477         * platform/graphics/filters/FEConvolveMatrix.h:
2478         * platform/graphics/filters/FEDiffuseLighting.h:
2479         * platform/graphics/filters/FEDisplacementMap.h:
2480         * platform/graphics/filters/FEDropShadow.h:
2481         * platform/graphics/filters/FEFlood.h:
2482         * platform/graphics/filters/FEGaussianBlur.h:
2483         * platform/graphics/filters/FELighting.h:
2484         * platform/graphics/filters/FEMerge.h:
2485         * platform/graphics/filters/FEOffset.h:
2486         * platform/graphics/filters/FESpecularLighting.h:
2487         * platform/graphics/filters/FETile.h:
2488
2489 2017-11-18  Simon Fraser  <simon.fraser@apple.com>
2490
2491         Remove a TimingScope that I left in by mistake.
2492
2493         * platform/graphics/filters/FETurbulence.cpp:
2494         (WebCore::FETurbulence::platformApplySoftware):
2495
2496 2017-11-18  Simon Fraser  <simon.fraser@apple.com>
2497
2498         FETurbulence: round the result according to the spec
2499         https://bugs.webkit.org/show_bug.cgi?id=179865
2500
2501         Reviewed by Zalan Bujtas.
2502
2503         The spec explicitly says that the floating point results are multiplied by 255 then
2504         clamped between 0 and 255, so do this instead of using lroundf().
2505         
2506         This is also faster (about 10%).
2507
2508         * platform/graphics/ColorUtilities.h:
2509         (WebCore::ColorComponents::ColorComponents):
2510         * platform/graphics/filters/FETurbulence.cpp:
2511         (WebCore::toColorComponents):
2512         (WebCore::FETurbulence::calculateTurbulenceValueForPoint const):
2513
2514 2017-11-18  Simon Fraser  <simon.fraser@apple.com>
2515
2516         More FETurbulence cleanup
2517         https://bugs.webkit.org/show_bug.cgi?id=179863
2518
2519         Reviewed by Zalan Bujtas.
2520         
2521         Hoist computation of initial StitchData up to be done once per filter,
2522         not once per pixel. Passing initial StitchData by value to calculateTurbulenceValueForPoint()
2523         ensures that each pixel gets the initial state.
2524         
2525         Also, adjusted baseFrequencyX and baseFrequencyY can be computed just once at the start,
2526         and passed through via PaintingData.
2527         
2528         Change enum TurbulenceType to be an enum class (requiring casts in a couple of places)
2529         and undo the capitalization of the values.
2530
2531         Fix spelling of TURBULANCE -> TURBULENCE in test output.
2532
2533         * platform/graphics/filters/FETurbulence.cpp:
2534         (WebCore::FETurbulence::computeStitching const):
2535         (WebCore::FETurbulence::calculateTurbulenceValueForPoint const):
2536         (WebCore::FETurbulence::fillRegion const):
2537         (WebCore::FETurbulence::fillRegionWorker):
2538         (WebCore::FETurbulence::platformApplySoftware):
2539         (WebCore::operator<<):
2540         * platform/graphics/filters/FETurbulence.h:
2541         (WebCore::FETurbulence::PaintingData::PaintingData):
2542         (WebCore::FETurbulence::StitchData::StitchData): Deleted.
2543         * svg/SVGAnimatedEnumeration.cpp:
2544         (WebCore::enumerationValueForTargetAttribute):
2545         * svg/SVGFETurbulenceElement.cpp:
2546         (WebCore::SVGFETurbulenceElement::SVGFETurbulenceElement):
2547         (WebCore::SVGFETurbulenceElement::parseAttribute):
2548         * svg/SVGFETurbulenceElement.h:
2549         (WebCore::SVGPropertyTraits<TurbulenceType>::highestEnumValue):
2550         (WebCore::SVGPropertyTraits<TurbulenceType>::toString):
2551         (WebCore::SVGPropertyTraits<TurbulenceType>::fromString):
2552
2553 2017-11-18  Simon Fraser  <simon.fraser@apple.com>
2554
2555         feTurbulence with stitchTiles is broken
2556         https://bugs.webkit.org/show_bug.cgi?id=179862
2557
2558         Reviewed by Zalan Bujtas.
2559         
2560         The "stitchTiles" logic was broken, and not equivalent to the spec sample code,
2561         because it didn't compute and wrap the bx1 and by1 equivalents separately from
2562         bx0 and by0.
2563         
2564         Annotated the code with the equivalent sample code from the spec for ease of
2565         comparison.
2566         
2567         Also make some functions const.
2568
2569         Test: svg/filters/feTurbulence-stitchTiles.html
2570
2571         * platform/graphics/filters/FETurbulence.cpp:
2572         (WebCore::FETurbulence::noise2D const):
2573         (WebCore::FETurbulence::calculateTurbulenceValueForPoint const):
2574         (WebCore::FETurbulence::fillRegion const):
2575         (WebCore::checkNoise): Deleted.
2576         (WebCore::FETurbulence::noise2D): Deleted.
2577         (WebCore::FETurbulence::calculateTurbulenceValueForPoint): Deleted.
2578         (WebCore::FETurbulence::fillRegion): Deleted.
2579         * platform/graphics/filters/FETurbulence.h:
2580         * platform/graphics/filters/FilterEffect.h:
2581         (WebCore::FilterEffect::filter const):
2582
2583 2017-11-18  Antti Koivisto  <antti@apple.com>
2584
2585         REGRESSION (r220646): REGRESSION (r220646): RenderTreePosition::computeNextSibling hits assertion with certain first-letter mutations
2586         https://bugs.webkit.org/show_bug.cgi?id=179855
2587         <rdar://problem/35464071>
2588
2589         Reviewed by Zalan Bujtas.
2590
2591         Test: fast/css-generated-content/first-letter-update-crash.html
2592
2593         * style/RenderTreeUpdaterFirstLetter.cpp:
2594         (WebCore::styleForFirstLetter):
2595         (WebCore::updateFirstLetterStyle):
2596         (WebCore::createFirstLetterRenderer):
2597
2598             Tighten these to take RenderBlock.
2599
2600         (WebCore::supportsFirstLetter):
2601
2602             Test exact conditions where first letter renderer is allowed for fast rejection.
2603
2604         (WebCore::RenderTreeUpdater::FirstLetter::update):
2605
2606             If update was called on a block that doesn't support first letter, getFirstLetter could in
2607             some cases return an ancestor of the block and we would end up mutating a first letter renderer
2608             that wasn't current block's descendant. This violates assumptions of the RenderTreeUpdater
2609             and could cause cached render tree position to become invalid.
2610
2611             Fix by ensuring we are always updating first letter for the current block only.
2612
2613 2017-11-17  Chris Dumez  <cdumez@apple.com>
2614
2615         [Service Workers] Implement "Notify Controller Change" algorithm
2616         https://bugs.webkit.org/show_bug.cgi?id=179822
2617
2618         Reviewed by Youenn Fablet.
2619
2620         Implement "Notify Controller Change" algorithm:
2621         - https://w3c.github.io/ServiceWorker/#notify-controller-change
2622
2623         Use it to support step 7 of "Activate" algorithm:
2624         - https://w3c.github.io/ServiceWorker/#activate
2625
2626         Test: http/tests/workers/service/controller-change.html
2627
2628         * workers/service/ServiceWorkerContainer.cpp:
2629         (WebCore::ServiceWorkerContainer::scheduleTaskToFireControllerChangeEvent):
2630         * workers/service/ServiceWorkerContainer.h:
2631         * workers/service/server/SWClientConnection.cpp:
2632         (WebCore::SWClientConnection::notifyClientsOfControllerChange):
2633         * workers/service/server/SWClientConnection.h:
2634         * workers/service/server/SWServer.h:
2635         * workers/service/server/SWServerJobQueue.cpp:
2636         (WebCore::SWServerJobQueue::activate):
2637         * workers/service/server/SWServerRegistration.cpp:
2638         (WebCore::SWServerRegistration::notifyClientsOfControllerChange):
2639         * workers/service/server/SWServerRegistration.h:
2640
2641 2017-11-17  Chris Dumez  <cdumez@apple.com>
2642
2643         Unreviewed attempt to fix build after r225006.
2644
2645         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2646         (WebCore::NetworkStorageSession::setStorageAccessGranted):
2647
2648 2017-11-17  Simon Fraser  <simon.fraser@apple.com>
2649
2650         FETurbulence: compute all 4 channels at once
2651         https://bugs.webkit.org/show_bug.cgi?id=179833
2652
2653         Reviewed by Sam Weinig.
2654
2655         Introduce some new helper classes for storing float color components, and use
2656         them in calculateTurbulenceValueForPoint() and noise2D() for all the channels in one
2657         pass. This makes FETurbulence about twice as fast.
2658
2659         * Sources.txt:
2660         * WebCore.xcodeproj/project.pbxproj:
2661         * platform/graphics/ColorUtilities.cpp: Added.
2662         (WebCore::ColorComponents::ColorComponents):
2663         * platform/graphics/ColorUtilities.h: Added.
2664         (WebCore::FloatComponents::FloatComponents):
2665         (WebCore::FloatComponents::operator +=):
2666         (WebCore::FloatComponents::operator + const):
2667         (WebCore::FloatComponents::operator / const):
2668         (WebCore::FloatComponents::operator * const):
2669         (WebCore::FloatComponents::abs const):
2670         (WebCore::clampedColorComponent):
2671         * platform/graphics/filters/FETurbulence.cpp:
2672         (WebCore::FETurbulence::noise2D):
2673         (WebCore::FETurbulence::calculateTurbulenceValueForPoint):
2674         (WebCore::FETurbulence::fillRegion):
2675         (WebCore::FETurbulence::platformApplySoftware):
2676         * platform/graphics/filters/FETurbulence.h:
2677
2678 2017-11-17  Chris Dumez  <cdumez@apple.com>
2679
2680         Use a strongly typed identifier for SWServer::Connection
2681         https://bugs.webkit.org/show_bug.cgi?id=179848
2682
2683         Reviewed by Brady Eidson.
2684
2685         Use a strongly typed identifier for SWServer::Connection, for clarity.
2686
2687         * workers/service/ServiceWorker.cpp:
2688         (WebCore::ServiceWorker::postMessage):
2689         * workers/service/ServiceWorkerClient.cpp:
2690         (WebCore::ServiceWorkerClient::ServiceWorkerClient):
2691         (WebCore::ServiceWorkerClient::id const):
2692         (WebCore::ServiceWorkerClient::postMessage):
2693         * workers/service/ServiceWorkerClient.h:
2694         (WebCore::ServiceWorkerClient::create):
2695         (WebCore::ServiceWorkerClient::identifier const):
2696         * workers/service/ServiceWorkerClientData.cpp:
2697         (WebCore::ServiceWorkerClientData::isolatedCopy const):
2698         (WebCore::ServiceWorkerClientData::from):
2699         * workers/service/ServiceWorkerClientData.h:
2700         (WebCore::ServiceWorkerClientData::encode const):
2701         (WebCore::ServiceWorkerClientData::decode):
2702         * workers/service/ServiceWorkerClientIdentifier.h:
2703         (WebCore::ServiceWorkerClientIdentifier::toString const):
2704         (WebCore::ServiceWorkerClientIdentifier::decode):
2705         * workers/service/ServiceWorkerContainer.cpp:
2706         (WebCore::ServiceWorkerContainer::addRegistration):
2707         (WebCore::ServiceWorkerContainer::removeRegistration):
2708         (WebCore::ServiceWorkerContainer::updateRegistration):
2709         (WebCore::ServiceWorkerContainer::connectionIdentifier):
2710         * workers/service/ServiceWorkerContainer.h:
2711         * workers/service/ServiceWorkerFetchResult.h:
2712         (WebCore::ServiceWorkerFetchResult::decode):
2713         * workers/service/ServiceWorkerJobClient.h:
2714         * workers/service/ServiceWorkerJobData.cpp:
2715         (WebCore::ServiceWorkerJobData::ServiceWorkerJobData):
2716         * workers/service/ServiceWorkerJobData.h:
2717         (WebCore::ServiceWorkerJobData::connectionIdentifier const):
2718         (WebCore::ServiceWorkerJobData::decode):
2719         * workers/service/ServiceWorkerTypes.h:
2720         * workers/service/ServiceWorkerWindowClient.cpp:
2721         (WebCore::ServiceWorkerWindowClient::ServiceWorkerWindowClient):
2722         * workers/service/ServiceWorkerWindowClient.h:
2723         * workers/service/context/SWContextManager.cpp:
2724         (WebCore::SWContextManager::postMessageToServiceWorkerGlobalScope):
2725         * workers/service/context/SWContextManager.h:
2726         * workers/service/context/ServiceWorkerThread.cpp:
2727         (WebCore::ServiceWorkerThread::postMessageToServiceWorkerGlobalScope):
2728         * workers/service/context/ServiceWorkerThread.h:
2729         * workers/service/server/SWClientConnection.h:
2730         * workers/service/server/SWServer.cpp:
2731         (WebCore::SWServer::Connection::Connection):
2732         (WebCore::SWServer::Connection::scheduleJobInServer):
2733         (WebCore::SWServer::rejectJob):
2734         (WebCore::SWServer::resolveRegistrationJob):
2735         (WebCore::SWServer::startScriptFetch):
2736         (WebCore::SWServer::scriptFetchFinished):
2737         * workers/service/server/SWServer.h:
2738         (WebCore::SWServer::Connection::identifier const):
2739         (WebCore::SWServer::getConnection):
2740         * workers/service/server/SWServerRegistration.cpp:
2741         (WebCore::SWServerRegistration::forEachConnection):
2742         (WebCore::SWServerRegistration::addClientServiceWorkerRegistration):
2743         (WebCore::SWServerRegistration::removeClientServiceWorkerRegistration):
2744         (WebCore::SWServerRegistration::unregisterServerConnection):
2745         * workers/service/server/SWServerRegistration.h:
2746
2747 2017-11-17  John Wilander  <wilander@apple.com>
2748
2749         Storage Access API: UI process should update network process about granted access
2750         https://bugs.webkit.org/show_bug.cgi?id=176943
2751         <rdar://problem/34440612>
2752
2753         Reviewed by Alex Christensen.
2754
2755         Tests: http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction.html
2756                http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-recent-user-interaction.html
2757
2758         * platform/network/NetworkStorageSession.h:
2759         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2760         (WebCore::NetworkStorageSession::setStorageAccessAPIEnabled):
2761         (WebCore::NetworkStorageSession::cookieStoragePartition const):
2762             Now also checks if the resource has been granted storage access
2763             under this partition and if so, does not return a partition.
2764         (WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies):
2765             Now clears storage access when it is told to clear first.
2766         (WebCore::NetworkStorageSession::isStorageAccessGranted const):
2767         (WebCore::NetworkStorageSession::setStorageAccessGranted):
2768
2769 2017-11-17  Simon Fraser  <simon.fraser@apple.com>
2770
2771         Inadvertently swapped m_baseFrequencyX and m_baseFrequencyY in the previous commit.
2772
2773         * platform/graphics/filters/FETurbulence.h:
2774         (WebCore::FETurbulence::baseFrequencyY const):
2775         (WebCore::FETurbulence::baseFrequencyX const):
2776
2777 2017-11-17  Alex Christensen  <achristensen@webkit.org>
2778
2779         REGRESSION(224348): [mac-wk1] LayoutTest media/video-src-remove.html is a flaky timeout
2780         https://bugs.webkit.org/show_bug.cgi?id=179806
2781
2782         Reviewed by Jer Noble.
2783
2784         In r224348 I used callOnMainThread to fix UIWebView which uses the web thread, but Mac doesn't
2785         use the web thread. Something about the timing of operations in the media stack requires that
2786         dispatch_async be used instead of performSelectorOnMainThread.
2787         
2788         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
2789         (-[WebCoreResourceHandleAsOperationQueueDelegate callFunctionOnMainThread:]):
2790         Use callOnMainThread on iOS, dispatch_async on Mac.
2791
2792 2017-11-17  Per Arne Vollan  <pvollan@apple.com>
2793
2794         [Win] Compile error in InbandTextTrackPrivateAVCF::readNativeSampleBuffer.
2795         https://bugs.webkit.org/show_bug.cgi?id=179845
2796
2797         Reviewed by Jer Noble.
2798
2799         * platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp:
2800         (WebCore::InbandTextTrackPrivateAVCF::readNativeSampleBuffer):
2801
2802 2017-11-17  Chris Fleizach  <cfleizach@apple.com>
2803
2804         AX: VoiceOver in Safari does not read table header for first cell in first body row
2805         https://bugs.webkit.org/show_bug.cgi?id=179780
2806         <rdar://problem/35590551>
2807
2808         Reviewed by Joanmarie Diggs.
2809
2810         A table cell shouldn't be considered a row header if it's in a row of other headers.
2811
2812         Test: accessibility/table-header-calculation-for-header-rows.html
2813
2814         * accessibility/AccessibilityTableRow.cpp:
2815         (WebCore::AccessibilityTableRow::headerObject):
2816
2817 2017-11-17  Simon Fraser  <simon.fraser@apple.com>
2818
2819         Don't invert a matrix for every channel of every pixel of an FETurbulence filter
2820         https://bugs.webkit.org/show_bug.cgi?id=179829
2821
2822         Reviewed by Dean Jackson.
2823         
2824         FETurbulence::fillRegion() called filter().mapAbsolutePointToLocalPoint(point) for each
2825         of the 4 channels on a point, which is stupid.
2826         
2827         Fix to invert the matrix once, and then map the point once for each pixel. This reduces
2828         the time in fillRegion() function by about 30%.
2829
2830         * platform/graphics/filters/FETurbulence.cpp:
2831         (WebCore::FETurbulence::fillRegion):
2832         * platform/graphics/filters/Filter.h:
2833         (WebCore::Filter::absoluteTransform const):
2834         (WebCore::Filter::mapAbsolutePointToLocalPoint const): Deleted.
2835
2836 2017-11-17  Brent Fulgham  <bfulgham@apple.com>
2837
2838         REGRESSION(r224390): Revert unneeded Ref use.
2839         https://bugs.webkit.org/show_bug.cgi?id=179844
2840         <rdar://problem/35624718>
2841
2842         Reviewed by Chris Dumez.
2843
2844         A Ref was added to a simple code path used for type checking, which introduced a nullptr
2845         deref. The original change was not needed, so let's revert it.
2846
2847         * html/HTMLFrameOwnerElement.cpp:
2848         (WebCore::HTMLFrameOwnerElement::contentDocument const): Use 'nullptr' instead of 0.
2849         (WebCore::HTMLFrameOwnerElement::contentWindow const): Ditto.
2850         (WebCore::HTMLFrameOwnerElement::getSVGDocument const): Revert to original code here.
2851
2852 2017-11-17  Nan Wang  <n_wang@apple.com>
2853
2854         AX: AOM: Implement boolean type properties
2855         https://bugs.webkit.org/show_bug.cgi?id=179496
2856
2857         Reviewed by Chris Fleizach.
2858
2859         Accessibility Object Model
2860         Explainer: https://wicg.github.io/aom/explainer.html
2861         Spec: https://wicg.github.io/aom/spec/
2862
2863         Implemented the boolean type properties for Accessibility Object Modal.
2864
2865         Test: accessibility/mac/AOM-bool-properties.html
2866
2867         * accessibility/AXObjectCache.cpp:
2868         (WebCore::AXObjectCache::AXObjectCache):
2869         (WebCore::AXObjectCache::~AXObjectCache):
2870         (WebCore::AXObjectCache::findModalNodes):
2871         (WebCore::AXObjectCache::updateCurrentModalNode):
2872         (WebCore::AXObjectCache::modalNode):
2873         (WebCore::AXObjectCache::remove):
2874         (WebCore::AXObjectCache::handleMenuItemSelected):
2875         (WebCore::AXObjectCache::focusModalNode):
2876         (WebCore::AXObjectCache::focusModalNodeTimerFired):
2877         (WebCore::AXObjectCache::handleAttributeChanged):
2878         (WebCore::AXObjectCache::handleModalChange):
2879         (WebCore::isNodeAriaVisible):
2880         (WebCore::AXObjectCache::findAriaModalNodes): Deleted.
2881         (WebCore::AXObjectCache::updateCurrentAriaModalNode): Deleted.
2882         (WebCore::AXObjectCache::ariaModalNode): Deleted.
2883         (WebCore::AXObjectCache::focusAriaModalNode): Deleted.
2884         (WebCore::AXObjectCache::focusAriaModalNodeTimerFired): Deleted.
2885         (WebCore::AXObjectCache::handleAriaModalChange): Deleted.
2886         * accessibility/AXObjectCache.h:
2887         (WebCore::AXObjectCache::AXObjectCache):
2888         (WebCore::AXObjectCache::modalNode):
2889         (WebCore::AXObjectCache::focusModalNodeTimerFired):
2890         (WebCore::AXObjectCache::handleModalChange):
2891         (WebCore::AXObjectCache::ariaModalNode): Deleted.
2892         (WebCore::AXObjectCache::focusAriaModalNodeTimerFired): Deleted.
2893         (WebCore::AXObjectCache::handleAriaModalChange): Deleted.
2894         * accessibility/AccessibilityARIAGrid.cpp:
2895         (WebCore::AccessibilityARIAGrid::isMultiSelectable const):
2896         * accessibility/AccessibilityARIAGridCell.cpp:
2897         (WebCore::AccessibilityARIAGridCell::readOnlyValue const):
2898         (WebCore::AccessibilityARIAGridCell::ariaReadOnlyValue const): Deleted.
2899         * accessibility/AccessibilityARIAGridCell.h:
2900         * accessibility/AccessibilityListBoxOption.cpp:
2901         (WebCore::AccessibilityListBoxOption::isEnabled const):
2902         * accessibility/AccessibilityNodeObject.cpp:
2903         (WebCore::AccessibilityNodeObject::isEnabled const):
2904         (WebCore::AccessibilityNodeObject::isMultiSelectable const):
2905         (WebCore::AccessibilityNodeObject::isRequired const):
2906         (WebCore::shouldUseAccessibilityObjectInnerText):
2907         (WebCore::AccessibilityNodeObject::canSetValueAttribute const):
2908         * accessibility/AccessibilityObject.cpp:
2909         (WebCore::AccessibilityObject::supportsReadOnly const):
2910         (WebCore::AccessibilityObject::readOnlyValue const):
2911         (WebCore::AccessibilityObject::ariaIsMultiline const):
2912         (WebCore::AccessibilityObject::isModalDescendant const):
2913         (WebCore::AccessibilityObject::isModalNode const):
2914         (WebCore::AccessibilityObject::ignoredFromModalPresence const):
2915         (WebCore::AccessibilityObject::boolValueForProperty const):
2916         (WebCore::AccessibilityObject::supportsARIAAttributes const):
2917         (WebCore::AccessibilityObject::supportsExpanded const):
2918         (WebCore::AccessibilityObject::isExpanded const):
2919         (WebCore::AccessibilityObject::isAXHidden const):
2920         (WebCore::AccessibilityObject::defaultObjectInclusion const):
2921         (WebCore::AccessibilityObject::setIsIgnoredFromParentDataForChild):
2922         (WebCore::AccessibilityObject::supportsARIAReadOnly const): Deleted.
2923         (WebCore::AccessibilityObject::ariaReadOnlyValue const): Deleted.
2924         (WebCore::AccessibilityObject::isAriaModalDescendant const): Deleted.
2925         (WebCore::AccessibilityObject::isAriaModalNode const): Deleted.
2926         (WebCore::AccessibilityObject::ignoredFromARIAModalPresence const): Deleted.
2927         (WebCore::AccessibilityObject::isARIAHidden const): Deleted.
2928         * accessibility/AccessibilityObject.h:
2929         (WebCore::AccessibilityObject::isHidden const):
2930         * accessibility/AccessibilityRenderObject.cpp:
2931         (WebCore::AccessibilityRenderObject::defaultObjectInclusion const):
2932         (WebCore::AccessibilityRenderObject::isSelected const):
2933         (WebCore::AccessibilityRenderObject::canSetExpandedAttribute const):
2934         (WebCore::AccessibilityRenderObject::liveRegionAtomic const):
2935         (WebCore::AccessibilityRenderObject::isBusy const):
2936         * accessibility/AccessibleNode.cpp:
2937         (WebCore::ariaAttributeMap):
2938         (WebCore::isPropertyValueBoolean):
2939         (WebCore::AccessibleNode::effectiveBoolValueForElement):
2940         (WebCore::AccessibleNode::boolValueForProperty):
2941         (WebCore::AccessibleNode::setBoolProperty):
2942         (WebCore::AccessibleNode::atomic const):
2943         (WebCore::AccessibleNode::setAtomic):
2944         (WebCore::AccessibleNode::busy const):
2945         (WebCore::AccessibleNode::setBusy):
2946         (WebCore::AccessibleNode::disabled const):
2947         (WebCore::AccessibleNode::setDisabled):
2948         (WebCore::AccessibleNode::expanded const):
2949         (WebCore::AccessibleNode::setExpanded):
2950         (WebCore::AccessibleNode::hidden const):
2951         (WebCore::AccessibleNode::setHidden):
2952         (WebCore::AccessibleNode::modal const):
2953         (WebCore::AccessibleNode::setModal):
2954         (WebCore::AccessibleNode::multiline const):
2955         (WebCore::AccessibleNode::setMultiline):
2956         (WebCore::AccessibleNode::multiselectable const):
2957         (WebCore::AccessibleNode::setMultiselectable):
2958         (WebCore::AccessibleNode::readOnly const):
2959         (WebCore::AccessibleNode::setReadOnly):
2960         (WebCore::AccessibleNode::required const):
2961         (WebCore::AccessibleNode::setRequired):
2962         (WebCore::AccessibleNode::selected const):
2963         (WebCore::AccessibleNode::setSelected):
2964         * accessibility/AccessibleNode.h:
2965         * accessibility/AccessibleNode.idl:
2966         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
2967         (webkitAccessibleGetAttributes):
2968         (setAtkStateSetFromCoreObject):
2969         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2970         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
2971         * inspector/agents/InspectorDOMAgent.cpp:
2972         (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
2973
2974 2017-11-17  Alex Christensen  <achristensen@webkit.org>
2975
2976         Clean up URL.h
2977         https://bugs.webkit.org/show_bug.cgi?id=179710
2978
2979         Reviewed by Brady Eidson.
2980
2981         No change in behavior.
2982
2983         * Modules/fetch/FetchRequest.cpp:
2984         (WebCore::FetchRequest::urlString const):
2985         * Modules/fetch/FetchResponse.cpp:
2986         (WebCore::FetchResponse::url const):
2987         * platform/URL.cpp:
2988         (WebCore::URL::serialize const): Deleted.
2989         * platform/URL.h:
2990         * platform/mac/URLMac.mm:
2991         (WebCore::URL::createCFURL const):
2992
2993 2017-11-17  Alex Christensen  <achristensen@webkit.org>
2994
2995         Use RunLoop and Mode from NetworkingContext if they are given
2996         https://bugs.webkit.org/show_bug.cgi?id=179800
2997         <rdar://problem/35519421>
2998
2999         Reviewed by Brady Eidson.
3000
3001         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
3002         (callOnMainThreadOrSchedule):
3003         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
3004         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveAuthenticationChallenge:]):
3005         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
3006         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
3007         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveData:lengthReceived:]):
3008         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:]):
3009         (-[WebCoreResourceHandleAsOperationQueueDelegate connectionDidFinishLoading:]):
3010         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didFailWithError:]):
3011         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
3012
3013 2017-11-17  Simon Fraser  <simon.fraser@apple.com>
3014
3015         FETurbulence const and inline cleanup
3016         https://bugs.webkit.org/show_bug.cgi?id=179832
3017
3018         Reviewed by Dean Jackson.
3019
3020         Pass the PaintingData& around as const, and remove some 'inline', letting the compiler
3021         decide. Also declare a few variables closer to first use.
3022         
3023         Speeds up FETurbulence by about 1%.
3024
3025         * platform/graphics/filters/FETurbulence.cpp:
3026         (WebCore::FETurbulence::initPaint):
3027         (WebCore::FETurbulence::noise2D):
3028         (WebCore::FETurbulence::calculateTurbulenceValueForPoint):
3029         (WebCore::FETurbulence::fillRegion):
3030         * platform/graphics/filters/FETurbulence.h:
3031
3032 2017-11-17  Antti Koivisto  <antti@apple.com>
3033
3034         Move destroyLeftoverChildren call to RenderObject::destroy
3035         https://bugs.webkit.org/show_bug.cgi?id=179819
3036
3037         Reviewed by Zalan Bujtas.
3038
3039         This is currently called inconsistenly from various willBeDestroyed implementations.
3040         We should always call it before invoking willBeDestroyed.
3041
3042         * rendering/RenderBlockFlow.cpp:
3043         (WebCore::RenderBlockFlow::willBeDestroyed):
3044         * rendering/RenderElement.cpp:
3045         (WebCore::RenderElement::willBeDestroyed):
3046         * rendering/RenderElement.h:
3047         (WebCore::RenderElement::setLastChild):
3048         * rendering/RenderInline.cpp:
3049         (WebCore::RenderInline::willBeDestroyed):
3050         * rendering/RenderLayer.cpp:
3051         (WebCore::RenderLayer::~RenderLayer):
3052
3053             Add some release asserts verifying layer has been detached before destruction.
3054             This would reveal cases where destroyLeftoverChildren was called too late.
3055
3056         * rendering/RenderObject.cpp:
3057         (WebCore::RenderObject::destroy):
3058
3059             Call destroyLeftoverChildren.
3060
3061 2017-11-17  Said Abou-Hallawa  <sabouhallawa@apple.com>
3062
3063         SVG scrolling anchor should be reset if the fragmentIdentifier does not exist or is not provided
3064         https://bugs.webkit.org/show_bug.cgi?id=176577
3065
3066         Reviewed by Simon Fraser.
3067
3068         Because the SVGImage can be cached only once but used multiple times with
3069         different fragmentIdentifiers, SVGImage has to call FrameView::scrollToFragment()
3070         before the image is displayed. If the fragmentIdentifier is not provided
3071         in the URL or it does not exist in the SVGImage, FrameView::scrollToFragment()
3072         has to reset the scrolling anchor of the SVG as if it was not displayed before.
3073         We do not want the previous scrolling anchor to be used when the FrameView
3074         of SVGImage can't scroll to the current fragmentIdentifier for any reason.
3075
3076         Test: http/tests/svg/svg-fragment-url-special-cases.html
3077
3078         * page/FrameView.cpp:
3079         (WebCore::FrameView::scrollToFragment):
3080         (WebCore::FrameView::scrollToAnchor):
3081         (WebCore::FrameView::resetScrollAnchor):
3082         * page/FrameView.h:
3083         * platform/URL.cpp:
3084         (WebCore::URL::fragmentIdentifier const): Call hasFragmentIdentifier() 
3085         instead of repeating the same condition.
3086         (WebCore::decodeURLEscapeSequences):
3087         * svg/SVGSVGElement.cpp:
3088         (WebCore::SVGSVGElement::findViewAnchor const):
3089         (WebCore::SVGSVGElement::findRootAnchor const):
3090         (WebCore::SVGSVGElement::scrollToAnchor): We want to know whether the SVG 
3091         root element could scroll to the fragmentIdentifier or not. If it could not,
3092         FrameView::scrollToAnchor() can still try one last time to do the scrolling
3093         only if anchorElement is not nullptr.
3094         (WebCore::SVGSVGElement::resetScrollAnchor): Reset the FrameView scrolling
3095         state to its initial value.
3096         * svg/SVGSVGElement.h:
3097
3098 2017-11-17  Youenn Fablet  <youenn@apple.com>
3099
3100         ServiceWorker intercepted FetchRequest should have their referrer set appropriately.
3101         https://bugs.webkit.org/show_bug.cgi?id=179803
3102
3103         Reviewed by Chris Dumez.
3104
3105         Covered by updated tests.
3106
3107         * workers/service/context/ServiceWorkerFetch.cpp:
3108         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
3109
3110 2017-11-17  Joanmarie Diggs  <jdiggs@igalia.com>
3111
3112         AX: [GTK] Regression: accessibility/gtk/aria-keyshortcuts.html fails after r224953
3113         https://bugs.webkit.org/show_bug.cgi?id=179824
3114
3115         Reviewed by Chris Fleizach.
3116
3117         The failure was due to AXPropertyName::KeyShortcuts not being included in
3118         the group of properties whose value is a string. As a result, the new method
3119         to get string values, AccessibleNode::effectiveStringValueForElement(), was
3120         returning an empty String. This was not caught by the shared set of tests
3121         because at the present time, only WebKitGtk supports aria-keyshortcuts.
3122
3123         No new tests needed. The regression was caught by an existing test.
3124
3125         * accessibility/AccessibleNode.cpp:
3126         (WebCore::isPropertyValueString):
3127
3128 2017-11-17  Ryan Haddad  <ryanhaddad@apple.com>
3129
3130         Unreviewed, rolling out r224952.
3131
3132         This change introduced LayoutTest failures on WK1.
3133
3134         Reverted changeset:
3135
3136         "Use RunLoop and Mode from NetworkingContext if they are
3137         given"
3138         https://bugs.webkit.org/show_bug.cgi?id=179800
3139         https://trac.webkit.org/changeset/224952
3140
3141 2017-11-16  Antoine Quint  <graouts@apple.com>
3142
3143         [Web Animations] Force a stacking context during animations that animate properties that will force a stacking context
3144         https://bugs.webkit.org/show_bug.cgi?id=179811
3145
3146         Reviewed by Dean Jackson.
3147
3148         The Web Animations specification mandates in section 4.7 (w3c.github.io/web-animations/#side-effects-section) that
3149         "for every property targeted by at least one animation effect that is current or in effect, the user agent must act
3150         as if the will-change property ([css-will-change-1]) on the target element includes the property."
3151
3152         After parsing new keyframes, we check if any of the CSS properties that get animated would end up forcing a stacking
3153         context, and if so, enforce a stacking context during the entire active lifetime of the animation.
3154
3155         Test: webanimations/animation-opacity-animation-crash.html
3156
3157         * animation/KeyframeEffect.cpp:
3158         (WebCore::KeyframeEffect::processKeyframes):
3159         (WebCore::KeyframeEffect::computeStackingContextImpact):
3160         (WebCore::KeyframeEffect::applyAtLocalTime):
3161         * animation/KeyframeEffect.h:
3162
3163 2017-11-17  Ali Juma  <ajuma@chromium.org>
3164
3165         Update feature status for Visual Viewport API to "In Development"
3166         https://bugs.webkit.org/show_bug.cgi?id=179818
3167
3168         Reviewed by Frédéric Wang.
3169
3170         Work on this feature has started, tracked by bug 170982.
3171
3172         No new tests since there's no change in behavior.
3173
3174         * features.json:
3175
3176 2017-11-16  Yousuke Kimoto  <yousuke.kimoto@sony.com>
3177
3178         [WinCairo] Add network (curl) files for wincairo webkit
3179         https://bugs.webkit.org/show_bug.cgi?id=179474
3180
3181         Reviewed by Alex Christensen.
3182
3183         No new behvaior, no new tests.
3184
3185         * PlatformWinCairo.cmake:
3186         * platform/Curl.cmake:
3187         * platform/network/curl/CookieStorageCurl.cpp: Added.
3188         (WebCore::startObservingCookieChanges):
3189         (WebCore::stopObservingCookieChanges):
3190         * platform/network/curl/NetworkStorageSessionCurl.cpp: Added.
3191         (WebCore::NetworkStorageSession::~NetworkStorageSession):
3192         (WebCore::NetworkStorageSession::context const):
3193         (WebCore::defaultSession):
3194         (WebCore::NetworkStorageSession::ensureSession):
3195         (WebCore::NetworkStorageSession::switchToNewTestingSession):
3196         (WebCore::NetworkStorageSession::setCookies):
3197         (WebCore::NetworkStorageSession::setCookie):
3198         (WebCore::NetworkStorageSession::deleteCookie):
3199         (WebCore::NetworkStorageSession::getAllCookies):
3200         (WebCore::NetworkStorageSession::getCookies):
3201         (WebCore::NetworkStorageSession::flushCookieStore):
3202
3203 2017-11-16  Alex Christensen  <achristensen@webkit.org>
3204
3205         Fix occasional crash when adding and removing videos
3206         https://bugs.webkit.org/show_bug.cgi?id=179792
3207
3208         Reviewed by Geoffrey Garen.
3209
3210         In taskCompleted we null out session, and in resume we call _restart on the main thread.
3211         If _restart is called after taskCompleted, we want to do nothing.
3212         Right now we are calling a method on self.session.loader which is a PlatformMediaResourceLoader&
3213         but in ObjC if session is null it will call PlatformMediaResourceLoader::requestResource with a
3214         null this pointer, which crashes.  Let's not crash.
3215
3216         * platform/network/cocoa/WebCoreNSURLSession.mm:
3217         (-[WebCoreNSURLSessionDataTask _restart]):
3218         Early return if we don't have a session.
3219
3220 2017-11-16  Don Olmstead  <don.olmstead@sony.com>
3221
3222         [WinCairo] Update WinCairoRequirements
3223         https://bugs.webkit.org/show_bug.cgi?id=179790
3224
3225         Reviewed by Alex Christensen.
3226
3227         No new tests. No change in behavior.
3228
3229         * PlatformWin.cmake:
3230
3231 2017-11-16  Antoine Quint  <graouts@apple.com>
3232
3233         [Web Animations] Allow KeyframeEffect to support CSS property animation blending
3234         https://bugs.webkit.org/show_bug.cgi?id=179810
3235
3236         Reviewed by Tim Horton.
3237
3238         We used to pass nullptr instead of a valid AnimationBase when calling CSSPropertyAnimation::blendProperties()
3239         in KeyframeEffect::applyAtLocalTime() when blending CSS styles during a keyframe animation. Without this
3240         AnimationBase, some blending functions would crash as certain supporting calls couldn't be made.
3241
3242         We now add a new CSSPropertyBlendingClient virtual interface that both KeyframeEffect and AnimationBase
3243         implement and that CSSPropertyAnimation::blendProperties() take as a parameter in order to support
3244         blending code.
3245
3246         * WebCore.xcodeproj/project.pbxproj:
3247         * animation/CSSPropertyBlendingClient.h: Added.
3248         * animation/KeyframeEffect.cpp:
3249         (WebCore::KeyframeEffect::applyAtLocalTime):
3250         (WebCore::KeyframeEffect::renderer const):
3251         (WebCore::KeyframeEffect::currentStyle const):
3252         * animation/KeyframeEffect.h:
3253         * page/animation/AnimationBase.h:
3254         (WebCore::AnimationBase::isAccelerated const):
3255         (WebCore::AnimationBase::transformFunctionListsMatch const):
3256         (WebCore::AnimationBase::filterFunctionListsMatch const):
3257         (WebCore::AnimationBase::backdropFilterFunctionListsMatch const):
3258         * page/animation/CSSPropertyAnimation.cpp:
3259         (WebCore::blendFunc):
3260         (WebCore::blendFilterOperations):
3261         (WebCore::blendFilter):
3262         (WebCore::crossfadeBlend):
3263         (WebCore::PropertyWrapperAcceleratedBackdropFilter::blend const):
3264         (WebCore::PropertyWrapperShadow::blendSimpleOrMatchedShadowLists const):
3265         (WebCore::PropertyWrapperShadow::blendMismatchedShadowLists const):
3266         (WebCore::CSSPropertyAnimation::blendProperties):
3267         * page/animation/CSSPropertyAnimation.h:
3268
3269 2017-11-16  Youenn Fablet  <youenn@apple.com>
3270
3271         Service Worker should get the body of intercepted requests
3272         https://bugs.webkit.org/show_bug.cgi?id=179776
3273
3274         Reviewed by Alex Christensen.
3275
3276         Test: http/tests/workers/service/service-worker-request-with-body.https.html
3277
3278         Make use of FetchBodyConsumer to store raw data for FetchRequest.
3279         This is used when setting FetchRequest body from a FormData.
3280         If FormData is only bytes (no blob, no file), FetchBodyConsumer will store that data.
3281         This allows Service Worker to get access to simple request bodies.
3282
3283         * Modules/fetch/FetchBody.cpp:
3284         (WebCore::FetchBody::fromFormData):
3285         (WebCore::FetchBody::consume):
3286         (WebCore::FetchBody::bodyAsFormData const): Making sure body is set appropriately when used to make fetch load.
3287         * Modules/fetch/FetchBody.h: Making some methods private.
3288         * Modules/fetch/FetchBodyConsumer.h: Adding accessors.
3289         (WebCore::FetchBodyConsumer::hasData const):
3290         (WebCore::FetchBodyConsumer::data const):
3291         * Modules/fetch/FetchRequest.h:
3292         (WebCore::FetchRequest::FetchRequest):
3293         * platform/network/FormData.cpp:
3294         (WebCore::FormData::asSharedBuffer const):
3295         * platform/network/FormData.h:
3296         * workers/service/context/ServiceWorkerFetch.cpp:
3297         (WebCore::ServiceWorkerFetch::dispatchFetchEvent): Setting FetchRequest body based on given FormData.
3298
3299 2017-11-16  Chris Dumez  <cdumez@apple.com>
3300
3301         Make sure service workers get terminated between tests
3302         https://bugs.webkit.org/show_bug.cgi?id=179774
3303
3304         Reviewed by Alex Christensen.
3305
3306         Make sure service workers get terminated between tests. Previously, we
3307         would merely clear all registrations and job queues but it would not
3308         cause the registrations' service workers to get terminated.
3309
3310         * workers/service/context/ServiceWorkerThread.cpp:
3311         (WebCore::ServiceWorkerThread::updateExtendedEventsSet):
3312         * workers/service/server/SWServer.cpp:
3313         (WebCore::SWServer::clearAll):
3314         * workers/service/server/SWServerJobQueue.cpp:
3315         (WebCore::SWServerJobQueue::scriptFetchFinished):
3316         (WebCore::SWServerJobQueue::scriptContextFailedToStart):
3317         (WebCore::SWServerJobQueue::didFinishInstall):
3318         (WebCore::SWServerJobQueue::tryClearRegistration):
3319         (WebCore::SWServerJobQueue::clearRegistration):
3320         * workers/service/server/SWServerJobQueue.h:
3321
3322 2017-11-16  Youenn Fablet  <youenn@apple.com>
3323
3324         FetchLoader should unregister its blob URL
3325         https://bugs.webkit.org/show_bug.cgi?id=179768
3326
3327         Reviewed by Alex Christensen.
3328
3329         No observable change.
3330
3331         Keep the blob URL used for reading and unregister it in destructor.
3332
3333         * Modules/fetch/FetchLoader.cpp:
3334         (WebCore::FetchLoader::~FetchLoader):
3335         (WebCore::FetchLoader::start):
3336         * Modules/fetch/FetchLoader.h:
3337
3338 2017-11-16  Nan Wang  <n_wang@apple.com>
3339
3340         AX: AOM: Implement string type properties
3341         https://bugs.webkit.org/show_bug.cgi?id=179495
3342
3343         Reviewed by Chris Fleizach.
3344
3345         Implemented the rest of the string type properties for Accessibility
3346         Object Model.
3347
3348         Test: accessibility/mac/AOM-string-properties.html
3349
3350         * accessibility/AXObjectCache.cpp:
3351         (WebCore::AXObjectCache::handleLiveRegionCreated):
3352         * accessibility/AccessibilityNodeObject.cpp:
3353         (WebCore::AccessibilityNodeObject::childrenChanged):
3354         (WebCore::AccessibilityNodeObject::isPressed const):
3355         (WebCore::AccessibilityNodeObject::isChecked const):
3356         (WebCore::AccessibilityNodeObject::valueDescription const):
3357         * accessibility/AccessibilityObject.cpp:
3358         (WebCore::AccessibilityObject::isAccessibilityObjectSearchMatchAtIndex):
3359         (WebCore::AccessibilityObject::supportsAutoComplete const):
3360         (WebCore::AccessibilityObject::autoCompleteValue const):
3361         (WebCore::AccessibilityObject::invalidStatus const):
3362         (WebCore::AccessibilityObject::supportsCurrent const):
3363         (WebCore::AccessibilityObject::currentState const):
3364         (WebCore::AccessibilityObject::currentValue const):
3365         (WebCore::AccessibilityObject::roleDescription const):
3366         (WebCore::AccessibilityObject::keyShortcutsValue const):
3367         (WebCore::AccessibilityObject::placeholderValue const):
3368         (WebCore::AccessibilityObject::isInsideLiveRegion const):
3369         (WebCore::AccessibilityObject::liveRegionAncestor const):
3370         (WebCore::AccessibilityObject::supportsARIAAttributes const):
3371         (WebCore::AccessibilityObject::supportsLiveRegion const):
3372         (WebCore::AccessibilityObject::sortDirection const):
3373         (WebCore::AccessibilityObject::supportsHasPopup const):
3374         (WebCore::AccessibilityObject::hasPopupValue const):
3375         (WebCore::AccessibilityObject::supportsPressed const):
3376         (WebCore::AccessibilityObject::checkboxOrRadioValue const):
3377         (WebCore::AccessibilityObject::pressedIsPresent const):
3378         (WebCore::AccessibilityObject::buttonRoleType const):
3379         (WebCore::AccessibilityObject::supportsARIAAutoComplete const): Deleted.
3380         (WebCore::AccessibilityObject::ariaAutoCompleteValue const): Deleted.
3381         (WebCore::AccessibilityObject::supportsARIACurrent const): Deleted.
3382         (WebCore::AccessibilityObject::ariaCurrentState const): Deleted.
3383         (WebCore::AccessibilityObject::ariaCurrentValue const): Deleted.
3384         (WebCore::AccessibilityObject::ariaKeyShortcutsValue const): Deleted.
3385         (WebCore::AccessibilityObject::isInsideARIALiveRegion const): Deleted.
3386         (WebCore::AccessibilityObject::ariaLiveRegionAncestor const): Deleted.
3387         (WebCore::AccessibilityObject::supportsARIALiveRegion const): Deleted.
3388         (WebCore::AccessibilityObject::supportsARIAHasPopup const): Deleted.
3389         (WebCore::AccessibilityObject::ariaPopupValue const): Deleted.
3390         (WebCore::AccessibilityObject::supportsARIAPressed const): Deleted.
3391         (WebCore::AccessibilityObject::ariaPressedIsPresent const): Deleted.
3392         * accessibility/AccessibilityObject.h:
3393         (WebCore::AccessibilityObject::hasPopup const):
3394         (WebCore::AccessibilityObject::liveRegionStatus const):
3395         (WebCore::AccessibilityObject::liveRegionRelevant const):
3396         (WebCore::AccessibilityObject::liveRegionAtomic const):
3397         (WebCore::AccessibilityObject::ariaHasPopup const): Deleted.
3398         (WebCore::AccessibilityObject::ariaLiveRegionStatus const): Deleted.
3399         (WebCore::AccessibilityObject::ariaLiveRegionRelevant const): Deleted.
3400         (WebCore::AccessibilityObject::ariaLiveRegionAtomic const): Deleted.
3401         * accessibility/AccessibilityRenderObject.cpp:
3402         (WebCore::AccessibilityRenderObject::hasPopup const):
3403         (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
3404         (WebCore::AccessibilityRenderObject::orientation const):
3405         (WebCore::AccessibilityRenderObject::textChanged):
3406         (WebCore::AccessibilityRenderObject::liveRegionStatus const):
3407         (WebCore::AccessibilityRenderObject::liveRegionRelevant const):
3408         (WebCore::AccessibilityRenderObject::liveRegionAtomic const):
3409         (WebCore::AccessibilityRenderObject::ariaHasPopup const): Deleted.
3410         (WebCore::AccessibilityRenderObject::ariaLiveRegionStatus const): Deleted.
3411         (WebCore::AccessibilityRenderObject::ariaLiveRegionRelevant const): Deleted.
3412         (WebCore::AccessibilityRenderObject::ariaLiveRegionAtomic const): Deleted.
3413         * accessibility/AccessibilityRenderObject.h:
3414         * accessibility/AccessibleNode.cpp:
3415         (WebCore::ariaAttributeMap):
3416         (WebCore::isPropertyValueString):
3417         (WebCore::AccessibleNode::notifyAttributeChanged):
3418         (WebCore::AccessibleNode::autocomplete const):
3419         (WebCore::AccessibleNode::setAutocomplete):
3420         (WebCore::AccessibleNode::checked const):
3421         (WebCore::AccessibleNode::setChecked):
3422         (WebCore::AccessibleNode::current const):
3423         (WebCore::AccessibleNode::setCurrent):
3424         (WebCore::AccessibleNode::hasPopUp const):
3425         (WebCore::AccessibleNode::setHasPopUp):
3426         (WebCore::AccessibleNode::invalid const):
3427         (WebCore::AccessibleNode::setInvalid):
3428         (WebCore::AccessibleNode::keyShortcuts const):
3429         (WebCore::AccessibleNode::setKeyShortcuts):
3430         (WebCore::AccessibleNode::live const):
3431         (WebCore::AccessibleNode::setLive):
3432         (WebCore::AccessibleNode::setLabel):
3433         (WebCore::AccessibleNode::orientation const):
3434         (WebCore::AccessibleNode::setOrientation):
3435         (WebCore::AccessibleNode::placeholder const):
3436         (WebCore::AccessibleNode::setPlaceholder):
3437         (WebCore::AccessibleNode::pressed const):
3438         (WebCore::AccessibleNode::setPressed):
3439         (WebCore::AccessibleNode::relevant const):
3440         (WebCore::AccessibleNode::setRelevant):
3441         (WebCore::AccessibleNode::role const):
3442         (WebCore::AccessibleNode::setRole):
3443         (WebCore::AccessibleNode::roleDescription const):
3444         (WebCore::AccessibleNode::setRoleDescription):
3445         (WebCore::AccessibleNode::sort const):
3446         (WebCore::AccessibleNode::setSort):
3447         (WebCore::AccessibleNode::valueText const):
3448         (WebCore::AccessibleNode::setValueText):
3449         * accessibility/AccessibleNode.h:
3450         (WebCore::AXPropertyHashTraits::constructDeletedValue):
3451         (WebCore::AXPropertyHashTraits::isDeletedValue):
3452         * accessibility/AccessibleNode.idl:
3453         * accessibility/atk/AXObjectCacheAtk.cpp:
3454         (WebCore::AXObjectCache::postPlatformNotification):
3455         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
3456         (webkitAccessibleGetAttributes):
3457         (atkRole):
3458         (setAtkStateSetFromCoreObject):
3459         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
3460         (-[WebAccessibilityObjectWrapper accessibilityHasPopup]):
3461         (-[WebAccessibilityObjectWrapper accessibilityARIALiveRegionStatus]):
3462         (-[WebAccessibilityObjectWrapper accessibilityARIARelevantStatus]):
3463         (-[WebAccessibilityObjectWrapper accessibilityARIALiveRegionIsAtomic]):
3464         (-[WebAccessibilityObjectWrapper accessibilitySupportsARIAPressed]):
3465         (-[WebAccessibilityObjectWrapper accessibilityARIACurrentStatus]):
3466         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3467         (-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
3468         (-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):
3469         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
3470         * inspector/agents/InspectorDOMAgent.cpp:
3471         (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
3472
3473 2017-11-16  Alex Christensen  <achristensen@webkit.org>
3474
3475         Use RunLoop and Mode from NetworkingContext if they are given
3476         https://bugs.webkit.org/show_bug.cgi?id=179800
3477         <rdar://problem/35519421>
3478
3479         Reviewed by Brady Eidson.
3480
3481         We used to call [NSURLConnection scheduleInRunLoop:forMode:] before r224267.
3482         That change broke WebKitLegacy clients using custom run loop modes, which I partially fixed in r224687 and r224896,
3483         but that hangs if there are any non-scheduled calls to callOnMainThread and it ignores the CFRunLoop part of the SchedulePair.
3484         This is a more elegant solution that fixes all known bugs with custom run loop modes and makes the
3485         behavior as close to the pre-r224267 behavior as possible by using all parameters in a good way.
3486
3487         I verified the bug in the radar is fixed, the API test WebKitLegacy.ScheduleInRunLoop still passes,
3488         and UIWebView still works on iOS.
3489
3490         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
3491         (callOnMainThreadOrSchedule):
3492         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
3493         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveAuthenticationChallenge:]):
3494         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
3495         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
3496         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveData:lengthReceived:]):
3497         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:]):
3498         (-[WebCoreResourceHandleAsOperationQueueDelegate connectionDidFinishLoading:]):
3499         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didFailWithError:]):
3500         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
3501
3502 2017-11-16  Daniel Bates  <dabates@apple.com>
3503
3504         Add feature define for alternative presentation button element
3505         https://bugs.webkit.org/show_bug.cgi?id=179692
3506         Part of <rdar://problem/34917108>
3507
3508         Reviewed by Andy Estes.
3509
3510         Only enabled on Cocoa platforms by default.
3511
3512         * Configurations/FeatureDefines.xcconfig:
3513
3514 2017-11-16  Chris Dumez  <cdumez@apple.com>
3515
3516         [Service Worker] Implement "Try Clear Registration" algorithm
3517         https://bugs.webkit.org/show_bug.cgi?id=179791
3518
3519         Reviewed by Youenn Fablet.
3520
3521         Implement "Try Clear Registration" algorithm:
3522         - https://w3c.github.io/ServiceWorker/#try-clear-registration-algorithm
3523
3524         In particular, a SWServerRegistration now knows if it is "in use" by a given
3525         service worker client (i.e. The registration's active service worker is
3526         controlling the service worker client). See:
3527         - https://w3c.github.io/ServiceWorker/#selection (last paragraph)
3528
3529         No new tests, rebaselined existing tests.
3530
3531         * dom/ScriptExecutionContext.cpp:
3532         (WebCore::ScriptExecutionContext::setActiveServiceWorker):
3533         * workers/service/server/SWClientConnection.h:
3534         * workers/service/server/SWServer.cpp:
3535         (WebCore::SWServer::Connection::serviceWorkerStartedControllingClient):
3536         (WebCore::SWServer::Connection::serviceWorkerStoppedControllingClient):
3537         (WebCore::SWServer::serviceWorkerStartedControllingClient):
3538         (WebCore::SWServer::serviceWorkerStoppedControllingClient):
3539         * workers/service/server/SWServer.h:
3540         * workers/service/server/SWServerJobQueue.cpp:
3541         (WebCore::SWServerJobQueue::tryClearRegistration):
3542         * workers/service/server/SWServerRegistration.h:
3543         (WebCore::SWServerRegistration::hasClientsUsingRegistration const):
3544         (WebCore::SWServerRegistration::addClientUsingRegistration):
3545         (WebCore::SWServerRegistration::removeClientUsingRegistration):
3546
3547 2017-11-16  Michael Catanzaro  <mcatanzaro@igalia.com>
3548
3549         REGRESSION(r224179): layer flush now requires sync IPC to compute undo/redo availability in EditorState
3550         https://bugs.webkit.org/show_bug.cgi?id=179797
3551
3552         Reviewed by Simon Fraser.
3553
3554         Editor::canUndo and Editor::CanRedo no longer need to be exported.
3555
3556         * editing/Editor.h:
3557
3558 2017-11-16  Chris Dumez  <cdumez@apple.com>
3559
3560         Dispatching an event on a ServiceWorkerRegistration may fail or crash due to GC
3561         https://bugs.webkit.org/show_bug.cgi?id=179751
3562
3563         Reviewed by Geoffrey Garen.
3564
3565         Dispatching an event on a ServiceWorkerRegistration may fail or crash due to GC. We
3566         need to make sure that a ServiceWorkerRegistration's wrapper stays alive as long as
3567         we may dispatch events on it.
3568
3569         Keep the wrapper alive by making ServiceWorker an ActiveDOMObject and making sure the
3570         implementation object keeps a PendingActivity alive while it may dispatch JS events.
3571         The only event dispatched on ServiceWorkerRegistration objects is the "updatefound"
3572         one. We may dispatch updatefound events on a ServiceWorkerRegistration until the
3573         registration gets cleared on server side, in which case the ServiceWorkerRegistration
3574         object ends up with no service worker. We therefore take a PendingActivity when the
3575         ServiceWorkerRegistration is constructed and we release it once the registration has
3576         no more associated ServiceWorker or the ActiveDOMObject is stopped (to avoid leaks on
3577         navigation).
3578
3579         Test: http/tests/workers/service/service-worker-registration-gc-event.html
3580
3581         * workers/service/ServiceWorkerContainer.cpp:
3582         (WebCore::ServiceWorkerContainer::scheduleTaskToFireUpdateFoundEvent):
3583         * workers/service/ServiceWorkerRegistration.cpp:
3584         (WebCore::ServiceWorkerRegistration::getOrCreate):
3585         (WebCore::ServiceWorkerRegistration::updateStateFromServer):
3586         (WebCore::ServiceWorkerRegistration::scheduleTaskToFireUpdateFoundEvent):
3587         (WebCore::ServiceWorkerRegistration::stop):
3588         (WebCore::ServiceWorkerRegistration::updatePendingActivityForEventDispatch):
3589         * workers/service/ServiceWorkerRegistration.h:
3590         * workers/service/ServiceWorkerRegistration.idl:
3591
3592 2017-11-16  Chris Dumez  <cdumez@apple.com>
3593
3594         Crash in WebCore::SWServerJobQueue::scriptFetchFinished(WebCore::SWServer::Connection&, WebCore::ServiceWorkerFetchResult const&) + 77
3595         https://bugs.webkit.org/show_bug.cgi?id=179394
3596         <rdar://problem/35478190>
3597
3598         Reviewed by Youenn Fablet.
3599
3600         In SWServerJobQueue::scriptFetchFinished(), make sure the job queue is still processing the
3601         job that triggered the fetch. If it is not, ignore the callback.
3602
3603         This could happen when calling SWServer::clear() while a script fetch was pending.
3604
3605         No new tests, already covered by existing tests that sometimes crash on the bots.
3606
3607         * workers/service/server/SWServerJobQueue.cpp:
3608         (WebCore::SWServerJobQueue::isCurrentlyProcessingJob const):
3609         (WebCore::SWServerJobQueue::scriptFetchFinished):
3610         * workers/service/server/SWServerJobQueue.h:
3611
3612 2017-11-16  Brady Eidson  <beidson@apple.com>
3613
3614         Crash in worker tests handling the m_stoppedCallback.
3615         <rdar://problem/35590875> and https://bugs.webkit.org/show_bug.cgi?id=179798
3616
3617         Reviewed by Chris Dumez.
3618
3619         No new tests (Covered by existing tests).
3620
3621         Protect manipulation of m_stoppedCallback with m_threadCreationAndWorkerGlobalScopeMutex.
3622
3623         * workers/WorkerThread.cpp:
3624         (WebCore::WorkerThread::workerThread):
3625         (WebCore::WorkerThread::stop):
3626
3627 2017-11-16  Antoine Quint  <graouts@apple.com>
3628
3629         [Web Animations] Express time in milliseconds through the API
3630         https://bugs.webkit.org/show_bug.cgi?id=179799
3631
3632         Reviewed by Simon Fraser.
3633
3634         While internally we use seconds to specify times and durations, the Web Animations API
3635         uses milliseconds, so we have to convert times and durations from and to milliseconds.
3636
3637         * animation/AnimationEffectTiming.h:
3638         * animation/AnimationTimeline.cpp:
3639         (WebCore::AnimationTimeline::bindingsCurrentTime):
3640         * animation/WebAnimation.cpp:
3641         (WebCore::WebAnimation::bindingsStartTime const):
3642         (WebCore::WebAnimation::setBindingsStartTime):
3643         (WebCore::WebAnimation::bindingsCurrentTime const):
3644         (WebCore::WebAnimation::setBindingsCurrentTime):
3645         * testing/Internals.cpp:
3646         (WebCore::Internals::setTimelineCurrentTime):
3647
3648 2017-11-16  Michael Catanzaro  <mcatanzaro@igalia.com>
3649
3650         REGRESSION(r224887): GCC 5 build broken
3651         https://bugs.webkit.org/show_bug.cgi?id=179750
3652
3653         Reviewed by Jer Noble.
3654
3655         Add a legacy FourCC constructor that will be used only when building with GCC 5. This is
3656         bad, but it seems acceptable for use with a fallback codepath.
3657
3658         Unfortunately, this requires adjusting some initializations to avoid ambiguity with the
3659         uint32_t constructor.
3660
3661         * platform/graphics/FourCC.h:
3662         (WebCore::FourCC::FourCC):
3663         * platform/graphics/iso/ISOBox.cpp:
3664         (WebCore::ISOBox::peekBox):
3665         * platform/graphics/iso/ISOBox.h:
3666         * platform/graphics/iso/ISOOriginalFormatBox.h:
3667         * platform/graphics/iso/ISOSchemeTypeBox.h:
3668
3669 2017-11-16  Andy Estes  <aestes@apple.com>
3670
3671         [Payment Request] Update feature status to "Supported In Preview"
3672         https://bugs.webkit.org/show_bug.cgi?id=179793
3673
3674         Reviewed by Tim Horton.
3675
3676         * features.json:
3677
3678 2017-11-16  Antoine Quint  <graouts@apple.com>
3679
3680         Clean up KeyframeEffect
3681         https://bugs.webkit.org/show_bug.cgi?id=179777
3682
3683         Reviewed by Daniel Bates.
3684
3685         A few review comments came in after https://bugs.webkit.org/show_bug.cgi?id=179707 landed,
3686         addressing them with this follow-up patch.
3687
3688         * animation/KeyframeEffect.cpp:
3689         (WebCore::KeyframeEffect::create): Use "keyframeEffect" instead of "result" for clarity.
3690         (WebCore::KeyframeEffect::processKeyframes): Use consistent index and length types while iterating
3691         over properties in PropertyNameArray and explicitly size the properties array since we already
3692         know its final size.
3693         * dom/Element.cpp:
3694         (WebCore::Element::getAnimations):
3695
3696 2017-11-16  Zalan Bujtas  <zalan@apple.com>
3697
3698         Always invoke RenderObject::insertedIntoTree/willBeRemovedFromTree
3699         https://bugs.webkit.org/show_bug.cgi?id=178007
3700
3701         Reviewed by Antti Koivisto.
3702
3703         Based on Antti Koivisto's patch:
3704         These call are currently skipped in some cases making them bug prone and difficult to reason about.
3705         This is done as an optimization that doesn't appear to be valuable anymore.
3706
3707         Covered by existing tests.
3708
3709         * rendering/RenderBlock.cpp:
3710         (WebCore::RenderBlock::makeChildrenNonInline):
3711         (WebCore::RenderBlock::dropAnonymousBoxChild):
3712         (WebCore::RenderBlock::takeChild):
3713         * rendering/RenderBlock.h:
3714         (WebCore::RenderBlock::moveAllChildrenIncludingFloatsTo):
3715         * rendering/RenderBlockFlow.cpp:
3716         (WebCore::RenderBlockFlow::styleDidChange):
3717         (WebCore::RenderBlockFlow::moveAllChildrenIncludingFloatsTo):
3718         * rendering/RenderBlockFlow.h:
3719         * rendering/RenderBox.cpp:
3720         (WebCore::RenderBox::splitAnonymousBoxesAroundChild):
3721         * rendering/RenderBoxModelObject.cpp:
3722         (WebCore::RenderBoxModelObject::moveChildTo):
3723         (WebCore::RenderBoxModelObject::moveChildrenTo):
3724         * rendering/RenderBoxModelObject.h:
3725         (WebCore::RenderBoxModelObject::moveChildTo):
3726         (WebCore::RenderBoxModelObject::moveAllChildrenTo):
3727         (WebCore::RenderBoxModelObject::moveChildrenTo):
3728         * rendering/RenderElement.cpp:
3729         (WebCore::RenderElement::addChild):
3730         (WebCore::RenderElement::takeChild):
3731         (WebCore::RenderElement::insertChildInternal):
3732         (WebCore::RenderElement::takeChildInternal):
3733         (WebCore::RenderElement::handleDynamicFloatPositionChange):
3734         * rendering/RenderElement.h:
3735         * rendering/RenderInline.cpp:
3736         (WebCore::RenderInline::splitInlines):
3737         (WebCore::RenderInline::splitFlow):
3738         (WebCore::RenderInline::childBecameNonInline):
3739         * rendering/RenderMultiColumnFlow.cpp:
3740         (WebCore::RenderMultiColumnFlow::fragmentedFlowDescendantInserted):
3741         * rendering/RenderRubyBase.cpp:
3742         (WebCore::RenderRubyBase::moveInlineChildren):
3743         (WebCore::RenderRubyBase::moveBlockChildren):
3744         * rendering/RenderRubyRun.cpp:
3745         (WebCore::RenderRubyRun::takeChild):
3746         * rendering/RenderTableRow.cpp:
3747         (WebCore::RenderTableRow::collapseAndDestroyAnonymousSiblingRows):
3748         * style/RenderTreeUpdaterMultiColumn.cpp:
3749         (WebCore::RenderTreeUpdater::MultiColumn::createFragmentedFlow):
3750         (WebCore::RenderTreeUpdater::MultiColumn::destroyFragmentedFlow):
3751
3752 2017-11-14  Dean Jackson  <dino@apple.com>
3753
3754         Add a base class for HTMLCanvasElement and OffscreenCanvas
3755         https://bugs.webkit.org/show_bug.cgi?id=179701
3756         <rdar://problem/35545195>
3757
3758         Reviewed by Sam Weinig.
3759
3760         In order for OffscreenCanvas to be able to create a WebGLRenderingContext,
3761         there needs to be a shared base class with HTMLCanvasElement. Add such a
3762         class called CanvasBase.
3763
3764         There is a lot of potential for functionality to move into the base class, but
3765         unfortunately HTMLCanvasElement is a bit messy. It implements a lot of the 2d
3766         rendering context functionality, and also many const functions that actually
3767         cause changes. Thus, things like the canvas size have to remain in the subclasses
3768         for now.
3769
3770         The existence of the new base class meant the canvas() accessor in CanvasRenderingContext
3771         had to move out into the subclasses, and do the correct casting. Eventually, at least
3772         for WebGLRenderingContext, this will have a change in behaviour, but for now we only
3773         ever use HTMLCanvasElements, so most of these changes are just for the sake of
3774         compilation.
3775
3776         No behaviour change - covered by existing tests.
3777
3778         * Sources.txt:
3779         * WebCore.xcodeproj/project.pbxproj:
3780         * html/CanvasBase.cpp: Copied from Source/WebCore/html/canvas/GPUBasedCanvasRenderingContext.h.
3781         (WebCore::CanvasBase::CanvasBase): New base class.
3782         (WebCore::CanvasBase::asHTMLCanvasElement): Casts to an HTMLCanvasElement*, which many of the
3783         rendering context code uses.
3784         * html/CanvasBase.h: Copied from Source/WebCore/html/canvas/GPUBasedCanvasRenderingContext.h.
3785         (WebCore::CanvasBase::isHTMLCanvasElement const):
3786         (WebCore::CanvasBase::isOffscreenCanvas const):
3787         (WebCore::CanvasBase::setOriginClean):
3788         (WebCore::CanvasBase::setOriginTainted):
3789         (WebCore::CanvasBase::originClean const):
3790         (WebCore::CanvasBase::securityOrigin const):
3791         (WebCore::CanvasBase::scriptExecutionContext const):
3792
3793         * html/HTMLCanvasElement.cpp: Use the base class methods where possible.
3794         (WebCore::HTMLCanvasElement::HTMLCanvasElement):
3795         (WebCore::HTMLCanvasElement::toDataURL):
3796         (WebCore::HTMLCanvasElement::toBlob):
3797         (WebCore::HTMLCanvasElement::createImageBuffer const): Be explict as to
3798         which of the derived classes scriptExecutionContext() method we are calling.
3799
3800         * html/HTMLCanvasElement.h: Use the base class, mark a few things as virtual,
3801         and remove the parts that are now in CanvasBase.
3802
3803         * html/OffscreenCanvas.cpp: Use the base class.
3804         (WebCore::OffscreenCanvas::OffscreenCanvas):
3805         (WebCore::OffscreenCanvas::size const):
3806         (WebCore::OffscreenCanvas::setSize):
3807         * html/OffscreenCanvas.h:
3808
3809         * html/canvas/CanvasRenderingContext.cpp:
3810         (WebCore::CanvasRenderingContext::CanvasRenderingContext):
3811         (WebCore::CanvasRenderingContext::ref): Call the correct ref/deref functions, depending
3812         on the base class type.
3813         (WebCore::CanvasRenderingContext::deref):
3814         (WebCore::CanvasRenderingContext::wouldTaintOrigin): We no longer have a canvas() method.
3815         (WebCore::CanvasRenderingContext::checkOrigin):
3816
3817         * html/canvas/CanvasRenderingContext.h:
3818         (WebCore::CanvasRenderingContext::canvasBase const): Add this accessor to the base canvas object
3819         to replace the canvas() call.
3820         (WebCore::CanvasRenderingContext::checkOrigin):
3821         (WebCore::CanvasRenderingContext::ref): Deleted.
3822         (WebCore::CanvasRenderingContext::deref): Deleted.
3823         (WebCore::CanvasRenderingContext::canvas const): Deleted.
3824
3825         * html/canvas/CanvasRenderingContext2D.cpp: Use the base class.
3826         (WebCore::CanvasRenderingContext2D::CanvasRenderingContext2D):
3827         * html/canvas/CanvasRenderingContext2D.h:
3828         * html/canvas/GPUBasedCanvasRenderingContext.h:
3829         (WebCore::GPUBasedCanvasRenderingContext::GPUBasedCanvasRenderingContext):
3830         * html/canvas/ImageBitmapRenderingContext.cpp:
3831         (WebCore::ImageBitmapRenderingContext::ImageBitmapRenderingContext):
3832         (WebCore::ImageBitmapRenderingContext::canvas const):
3833         (WebCore::ImageBitmapRenderingContext::setOutputBitmap):
3834         * html/canvas/ImageBitmapRenderingContext.h:
3835         * html/canvas/PlaceholderRenderingContext.cpp:
3836         (WebCore::PlaceholderRenderingContext::PlaceholderRenderingContext):
3837         * html/canvas/PlaceholderRenderingContext.h:
3838         * html/canvas/WebGL2RenderingContext.cpp:
3839         (WebCore::WebGL2RenderingContext::WebGL2RenderingContext):
3840         * html/canvas/WebGL2RenderingContext.h:
3841         * html/canvas/WebGLRenderingContext.cpp:
3842         (WebCore::WebGLRenderingContext::WebGLRenderingContext):
3843
3844         * html/canvas/WebGLRenderingContext.h:
3845         * html/canvas/WebGLRenderingContextBase.cpp:
3846         (WebCore::WebGLRenderingContextBase::create): Assume that we're still getting an HTMLCanvasElement,
3847         but protect some of the logic just in case we don't.
3848         (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
3849         (WebCore::WebGLRenderingContextBase::canvas):
3850         (WebCore::WebGLRenderingContextBase::checkForContextLossHandling):
3851         (WebCore::WebGLRenderingContextBase::registerWithWebGLStateTracker):
3852         (WebCore::WebGLRenderingContextBase::setupFlags):
3853         (WebCore::WebGLRenderingContextBase::addActivityStateChangeObserverIfNecessary):
3854         (WebCore::WebGLRenderingContextBase::removeActivityStateChangeObserver):
3855         (WebCore::WebGLRenderingContextBase::markContextChanged):
3856         (WebCore::WebGLRenderingContextBase::markContextChangedAndNotifyCanvasObserver):
3857         (WebCore::WebGLRenderingContextBase::paintRenderingResultsToCanvas):
3858         (WebCore::WebGLRenderingContextBase::reshape):
3859         (WebCore::WebGLRenderingContextBase::compileShader):
3860         (WebCore::WebGLRenderingContextBase::isContextLostOrPending):
3861         (WebCore::WebGLRenderingContextBase::readPixels):
3862         (WebCore::WebGLRenderingContextBase::loseContextImpl):
3863         (WebCore::WebGLRenderingContextBase::printToConsole):
3864         (WebCore::WebGLRenderingContextBase::dispatchContextLostEvent):
3865         (WebCore::WebGLRenderingContextBase::maybeRestoreContext):
3866         (WebCore::WebGLRenderingContextBase::dispatchContextChangedEvent):
3867         (WebCore::WebGLRenderingContextBase::clampedCanvasSize):
3868         * html/canvas/WebGLRenderingContextBase.h:
3869         * html/canvas/WebGLRenderingContextBase.idl:
3870         * html/canvas/WebGPURenderingContext.cpp:
3871         (WebCore::WebGPURenderingContext::create):
3872         (WebCore::WebGPURenderingContext::WebGPURenderingContext):
3873         (WebCore::WebGPURenderingContext::canvas const):
3874         (WebCore::WebGPURenderingContext::clampedCanvasSize const):
3875         * html/canvas/WebGPURenderingContext.h:
3876         * inspector/InspectorInstrumentation.h:
3877         (WebCore::InspectorInstrumentation::recordCanvasAction):
3878         (WebCore::InspectorInstrumentation::didEnableExtension):
3879         (WebCore::InspectorInstrumentation::didCreateProgram):
3880         (WebCore::InspectorInstrumentation::willDeleteProgram):
3881         (WebCore::InspectorInstrumentation::isShaderProgramDisabled):
3882         * inspector/agents/InspectorCanvasAgent.cpp:
3883         (WebCore::InspectorCanvasAgent::recordCanvasAction):
3884         (WebCore::InspectorCanvasAgent::didEnableExtension):
3885         (WebCore::InspectorCanvasAgent::didCreateProgram):
3886
3887 2017-11-16  Colin Bendell  <colin@bendell.ca>
3888
3889         Added mime type check to the picture source preloader to avoid downloading incompatible resources.
3890         https://bugs.webkit.org/show_bug.cgi?id=179231
3891
3892         Reviewed by Alex Christensen.
3893
3894         Test: http/tests/loading/preload-picture-type.html
3895
3896         * html/parser/HTMLPreloadScanner.cpp:
3897         (WebCore::TokenPreloadScanner::StartTagScanner::processAttributes): include type match state when selecting candidate imgs
3898         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): added type attribute evaluation and matching
3899
3900 2017-11-16  Chris Dumez  <cdumez@apple.com>
3901
3902         Dispatching an event on a ServiceWorker may fail or crash due to GC
3903         https://bugs.webkit.org/show_bug.cgi?id=179745
3904
3905         Reviewed by Geoffrey Garen.
3906
3907         Dispatching an event on a ServiceWorker may fail or crash due to GC. We need to make sure
3908         that a ServiceWorker's wrapper stays alive as long as we may dispatch events on it.
3909
3910         Keep the wrapper alive by making ServiceWorker an ActiveDOMObject and making sure the
3911         implementation object keeps a PendingActivity alive while it may dispatch JS events.
3912         The only event dispatched on ServiceWorker objects is the "statechange" one. We may
3913         dispatch statechange events on a ServiceWorker until its state becomes "redundant".
3914         We therefore take a PendingActivity when the ServiceWorker's state is or becomes
3915         non-redundant (becoming non redundant can only happen when switching initially from
3916         redundant to installing, at which point the ServiceWorker object is not exposed to
3917         the JS yet). We release the PendingActivity when the ServiceWorker's state becomes
3918         redundant or the ActiveDOMObject is stopped (to avoid leaks on navigation).
3919
3920         Test: http/tests/workers/service/service-worker-gc-event.html
3921
3922         * workers/service/ServiceWorker.cpp:
3923         (WebCore::mutableAllWorkers):
3924         (WebCore::ServiceWorker::removeFromAllWorkers):
3925         (WebCore::ServiceWorker::getOrCreate):
3926         (WebCore::ServiceWorker::ServiceWorker):
3927         (WebCore::ServiceWorker::~ServiceWorker):
3928         (WebCore::ServiceWorker::scheduleTaskToUpdateState):
3929         (WebCore::ServiceWorker::activeDOMObjectName const):
3930         (WebCore::ServiceWorker::canSuspendForDocumentSuspension const):
3931         (WebCore::ServiceWorker::stop):
3932         (WebCore::ServiceWorker::updatePendingActivityForEventDispatch):
3933         * workers/service/ServiceWorker.h:
3934         * workers/service/ServiceWorker.idl:
3935
3936 2017-11-16  Frederic Wang  <fwang@igalia.com>
3937