readableStreamDefaultControllerError should return early if stream is not readable
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-05-14  Youenn Fablet  <youenn@apple.com>
2
3         readableStreamDefaultControllerError should return early if stream is not readable
4         https://bugs.webkit.org/show_bug.cgi?id=185602
5
6         Reviewed by Chris Dumez.
7
8         Return early if stream is not readable in @readableStreamDefaultControllerError.
9         Update call sites to no longer check for ReadableStream state.
10         Covered by unflaked and rebased tests.
11
12         * Modules/streams/ReadableStreamDefaultController.js:
13         (error):
14         * Modules/streams/ReadableStreamInternals.js:
15         (readableStreamDefaultControllerError):
16         (readableStreamDefaultControllerCallPullIfNeeded):
17
18 2018-05-14  Zalan Bujtas  <zalan@apple.com>
19
20         [LFC] Implement width computation for non-replaced block level inflow elements.
21         https://bugs.webkit.org/show_bug.cgi?id=185641
22
23         Reviewed by Sam Weinig.
24
25         Block level inflow elements participate in block formatting context.
26
27         * layout/FormattingContext.cpp:
28         (WebCore::Layout::FormattingContext::computeWidth const):
29         * layout/FormattingContext.h:
30         * layout/blockformatting/BlockFormattingContext.cpp:
31         (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const):
32         * layout/blockformatting/BlockFormattingContext.h:
33         * layout/inlineformatting/InlineFormattingContext.cpp:
34         (WebCore::Layout::InlineFormattingContext::computeInFlowWidth const):
35         * layout/inlineformatting/InlineFormattingContext.h:
36
37 2018-05-14  Wenson Hsieh  <wenson_hsieh@apple.com>
38
39         Unreviewed, fix the iOS build after r231779
40
41         Also address a minor in-person review comment by returning "extrazoom" instead of the empty string.
42
43         * page/DisabledAdaptations.cpp:
44         (WebCore::extraZoomModeAdaptationName):
45
46 2018-05-14  Zalan Bujtas  <zalan@apple.com>
47
48         [LFC] FormattingContext:computeOutOfFlowNonReplacedHeight/Width should use the computed margins/paddings/borders
49         https://bugs.webkit.org/show_bug.cgi?id=185633
50
51         Reviewed by Sam Weinig.
52
53         By the time we start computing height and width, DisplayBox should already have the computed values for margin/padding/border.
54
55         * layout/FormattingContext.cpp:
56         (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedHeight const):
57         (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedWidth const):
58         * layout/displaytree/DisplayBox.h:
59         (WebCore::Display::Box::paddingTop const):
60         (WebCore::Display::Box::paddingLeft const):
61         (WebCore::Display::Box::paddingBottom const):
62         (WebCore::Display::Box::paddingRight const):
63         (WebCore::Display::Box::borderTop const):
64         (WebCore::Display::Box::borderLeft const):
65         (WebCore::Display::Box::borderBottom const):
66         (WebCore::Display::Box::borderRight const):
67
68 2018-05-14  Wenson Hsieh  <wenson_hsieh@apple.com>
69
70         [Extra zoom mode] Google search results are excessively zoomed in
71         https://bugs.webkit.org/show_bug.cgi?id=185347
72         <rdar://problem/39999778>
73
74         Reviewed by Tim Horton.
75
76         It turns out that basing minimum layout size and shrink-to-fit behaviors off of the `shrink-to-fit` viewport
77         argument poses compatibility risks with web pages that already specify `shrink-to-fit` to opt out of default
78         viewport shrinking behaviors in 1/3 multitasking mode on iPad.
79
80         One way to resolve this is to introduce a new viewport meta content attribute to disable viewport heuristics in
81         extra zoom mode. However, combined shrink-to-fit and minimum device width behaviors are difficult to describe
82         using a single backwards-compatible viewport meta content attribute, and the need to suppress the default
83         behavior of `shrink-to-fit=no` if such an attribute is not disabled further muddles our viewport story.
84
85         After some internal deliberation, we’ve decided to experiment with a new meta tag named "disabled-adaptations".
86         The content of this meta tag is a comma-separated list of adaptation names; if an adaptation name matches a
87         known adaptation type (for instance, extra zoom mode), we disable the class of behaviors used to adapt web
88         content. The first and only known adaptation type is extra zoom mode, which affects `shrink-to-fit` and layout
89         size adjustments.
90
91         See per-method changes below for more details.
92
93         Test: fast/viewport/extrazoom/viewport-disable-extra-zoom-adaptations.html
94
95         * Sources.txt:
96         * WebCore.xcodeproj/project.pbxproj:
97         * dom/Document.cpp:
98         (WebCore::Document::processDisabledAdaptations):
99         * dom/Document.h:
100         (WebCore::Document::disabledAdaptations const):
101
102         Add disabled adaptations to Document. Changes to disabled adaptations are not propagated if the parsed disabled
103         adaptation types don't change; upon changing adaptation types, notify the client to adjust for the new disabled
104         adaptations (currently, this only affects the viewport configuration).
105
106         * dom/ViewportArguments.h:
107         * html/HTMLMetaElement.cpp:
108         (WebCore::HTMLMetaElement::process):
109         * html/parser/HTMLPreloadScanner.cpp:
110         (WebCore::TokenPreloadScanner::StartTagScanner::StartTagScanner):
111         (WebCore::TokenPreloadScanner::StartTagScanner::processAttributes):
112         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
113         * loader/FrameLoader.cpp:
114         (WebCore::FrameLoader::commitProvisionalLoad):
115
116         Restore the set of disabled adaptations when restoring a page from the cache.
117
118         * page/Chrome.cpp:
119         (WebCore::Chrome::dispatchDisabledAdaptationsDidChange const):
120         * page/Chrome.h:
121         * page/ChromeClient.h:
122
123         Add plumbing for changes to the set of disabled adaptations.
124
125         * page/DisabledAdaptations.cpp: Added.
126         (WebCore::extraZoomModeAdaptationName):
127         * page/DisabledAdaptations.h: Added.
128
129         Introduce a header containing a new enum for the extra zoom mode adaptation, as well as a helper function to
130         return the extra zoom mode adaptation name.
131
132         * page/Page.cpp:
133         (WebCore::Page::disabledAdaptations const):
134
135         Returns the mainframe's set of adaptations to disable.
136
137         * page/Page.h:
138         * page/RemoteFrame.h:
139         * page/RuntimeEnabledFeatures.h:
140         (WebCore::RuntimeEnabledFeatures::setDisabledAdaptationsMetaTagEnabled):
141         (WebCore::RuntimeEnabledFeatures::disabledAdaptationsMetaTagEnabled const):
142
143         Add a new runtime feature to gate handling the "disabled-adaptations" meta tag.
144
145         * page/ViewportConfiguration.cpp:
146         (WebCore::shouldOverrideShrinkToFitArgument):
147         (WebCore::needsUpdateAfterChangingDisabledAdaptations):
148         (WebCore::ViewportConfiguration::setDisabledAdaptations):
149         (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthAndShrinkToFit const):
150
151         Consult whether or not extra zoom mode adaptations are disabled, instead of the shrink-to-fit attribute value.
152
153         (WebCore::ViewportConfiguration::updateConfiguration):
154         * page/ViewportConfiguration.h:
155
156         Add an OptionSet of disabled adaptation types to ViewportConfiguration. Updates to the adaptation type are
157         propagated to the ViewportConfiguration from Document, through the ChromeClient and the client layer (refer to
158         changes in WebKit). Once the OptionSet is changed, we recompute the viewport configuration only if needed by the
159         platform.
160
161         (WebCore::ViewportConfiguration::viewLayoutSize const):
162         (WebCore::ViewportConfiguration::disabledAdaptations const):
163         * page/WindowFeatures.cpp:
164         (WebCore::parseDisabledAdaptations):
165         * page/WindowFeatures.h:
166
167         Add a new helper to parse the meta content of a "disabled-adaptations" tag as an OptionSet of disabled
168         adaptation types. The string is parsed by first splitting on the comma character, and then iterating over lower
169         case, whitespace-stripped tokens to look for known adaptation names. So far, only extra zoom mode is supported.
170
171         * testing/Internals.cpp:
172         (WebCore::Internals::extraZoomModeAdaptationName const):
173         * testing/Internals.h:
174         * testing/Internals.idl:
175
176         Expose the extra zoom mode adaptation name to the DOM, only when running layout tests.
177
178 2018-05-14  Joanmarie Diggs  <jdiggs@igalia.com>
179
180         AX: Listbox and Combobox roles embedded in labels should participate in name calculation
181         https://bugs.webkit.org/show_bug.cgi?id=185521
182
183         Reviewed by Chris Fleizach.
184
185         Take selected children into account when computing the name in accessibleNameForNode.
186         Add ListBox to the roles for which accessibleNameDerivesFromContent returns false so
187         that native select elements with size > 1 are treated the same way as ARIA listbox.
188         Also add ListBox to the roles which are treated as controls when used in ARIA. Finally,
189         prevent labels which contain unrelated controls from being used as an AXTitleUIElement.
190         This causes us to build a string from the label and its descendants, ensuring the latter
191         participate in the name calculation.
192
193         Test: accessibility/text-alternative-calculation-from-listbox.html
194
195         * accessibility/AccessibilityLabel.cpp:
196         (WebCore::childrenContainUnrelatedControls):
197         (WebCore::AccessibilityLabel::containsUnrelatedControls const):
198         * accessibility/AccessibilityLabel.h:
199         * accessibility/AccessibilityNodeObject.cpp:
200         (WebCore::accessibleNameForNode):
201         * accessibility/AccessibilityObject.cpp:
202         (WebCore::AccessibilityObject::accessibleNameDerivesFromContent const):
203         (WebCore::AccessibilityObject::isARIAControl):
204         * accessibility/AccessibilityRenderObject.cpp:
205         (WebCore::AccessibilityRenderObject::exposesTitleUIElement const):
206         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const):
207
208 2018-05-14  Antoine Quint  <graouts@apple.com>
209
210         [Web Animations] Tests using the new animation engine may crash under WebCore::FrameView::didDestroyRenderTree when using internals methods
211         https://bugs.webkit.org/show_bug.cgi?id=185612
212         <rdar://problem/39579344>
213
214         Reviewed by Dean Jackson.
215
216         Add a new internals.pseudoElement() method to obtain a pseudo element matching a given pseudo-id. This is necessary to be able to move off
217         internals.pauseTransitionAtTimeOnPseudoElement() and internals.pauseAnimationAtTimeOnPseudoElement() for Web Animations testing.
218
219         * testing/Internals.cpp:
220         (WebCore::Internals::pseudoElement):
221         * testing/Internals.h:
222         * testing/Internals.idl:
223
224 2018-05-14  Antoine Quint  <graouts@apple.com>
225
226         REGRESSION (r230574): Interrupted hardware transitions don't behave correctly
227         https://bugs.webkit.org/show_bug.cgi?id=185299
228         <rdar://problem/39630230>
229
230         Reviewed by Simon Fraser.
231
232         In r230574, the fix for webkit.org/b/184518, we changed the processing order in GraphicsLayerCA::updateAnimations() to first
233         process m_uncomittedAnimations and then m_animationsToProcess, so we are guaranteed animations exist before we attempt to pause
234         or seek them. This broke interrupting and resuming hardware animations (such as an interrupted CSS Transition or an animation
235         running in a non-visible tab) since a pause operation recorded _before_ an animation was added would be paused anyway since
236         the animation was now first added, and then paused. The fix is simply to clear any pending AnimationProcessingAction for a
237         newly-uncommitted animation.
238
239         Test: transitions/interrupted-transition-hardware.html
240
241         * platform/graphics/ca/GraphicsLayerCA.cpp:
242         (WebCore::GraphicsLayerCA::createAnimationFromKeyframes):
243         (WebCore::GraphicsLayerCA::appendToUncommittedAnimations):
244         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
245         * platform/graphics/ca/GraphicsLayerCA.h:
246         (WebCore::GraphicsLayerCA::LayerPropertyAnimation::LayerPropertyAnimation):
247
248 2018-05-14  Thibault Saunier  <tsaunier@igalia.com>
249
250         [GStreamer] Fix style issue in MediaPlayerPrivateGStreamerBase
251         https://bugs.webkit.org/show_bug.cgi?id=185510
252
253         Reviewed by Philippe Normand.
254
255         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:629:  More than one command on the same line  [whitespace/newline] [4]
256         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:684:  More than one command on the same line  [whitespace/newline] [4]
257         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:807:  More than one command on the same line  [whitespace/newline] [4]
258
259         Indentation and style issue fixed only.
260
261         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
262         (WebCore::MediaPlayerPrivateGStreamerBase::volumeChangedCallback):
263         (WebCore::MediaPlayerPrivateGStreamerBase::muteChangedCallback):
264         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
265
266 2018-05-14  Zalan Bujtas  <zalan@apple.com>
267
268         [LFC] Implement height computation for non-replaced out of flow elements.
269         https://bugs.webkit.org/show_bug.cgi?id=185585
270
271         Reviewed by Antti Koivisto.
272
273         * layout/FormattingContext.cpp:
274         (WebCore::Layout::FormattingContext::computeHeight const):
275         (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const):
276         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
277         (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedHeight const):
278         (WebCore::Layout::FormattingContext::computeHeightForBlockFormattingContextRootWithAutoHeight const):
279         * layout/FormattingContext.h:
280         * layout/blockformatting/BlockFormattingContext.h:
281         * layout/displaytree/DisplayBox.h:
282
283 2018-05-14  Manuel Rego Casasnovas  <rego@igalia.com>
284
285         Renaming of overrides in LayoutBox
286         https://bugs.webkit.org/show_bug.cgi?id=185609
287
288         Reviewed by Javier Fernandez.
289
290         The names of the methods for the overrides were not consistent,
291         this patch fixes it by using the same structure in all the cases.
292
293         No new tests, no change of behavior.
294
295         * rendering/GridLayoutFunctions.cpp:
296         (WebCore::GridLayoutFunctions::hasOverrideContainingBlockContentSizeForChild):
297         * rendering/GridTrackSizingAlgorithm.cpp:
298         (WebCore::GridTrackSizingAlgorithmStrategy::logicalHeightForChild const):
299         * rendering/RenderBlock.cpp:
300         (WebCore::RenderBlock::computeChildPreferredLogicalWidths const):
301         (WebCore::RenderBlock::availableLogicalHeightForPercentageComputation const):
302         * rendering/RenderBlockFlow.cpp:
303         (WebCore::RenderBlockFlow::fitBorderToLinesIfNeeded):
304         * rendering/RenderBlockLineLayout.cpp:
305         (WebCore::RenderBlockFlow::updateRubyForJustifiedText):
306         * rendering/RenderBox.cpp:
307         (WebCore::RenderBox::willBeDestroyed):
308         (WebCore::RenderBox::hasOverrideContentLogicalHeight const):
309         (WebCore::RenderBox::hasOverrideContentLogicalWidth const):
310         (WebCore::RenderBox::setOverrideContentLogicalHeight):
311         (WebCore::RenderBox::setOverrideContentLogicalWidth):
312         (WebCore::RenderBox::clearOverrideContentLogicalHeight):
313         (WebCore::RenderBox::clearOverrideContentLogicalWidth):
314         (WebCore::RenderBox::clearOverrideContentSize):
315         (WebCore::RenderBox::overrideContentLogicalWidth const):
316         (WebCore::RenderBox::overrideContentLogicalHeight const):
317         (WebCore::RenderBox::overrideContainingBlockContentLogicalWidth const):
318         (WebCore::RenderBox::overrideContainingBlockContentLogicalHeight const):
319         (WebCore::RenderBox::hasOverrideContainingBlockContentLogicalWidth const):
320         (WebCore::RenderBox::hasOverrideContainingBlockContentLogicalHeight const):
321         (WebCore::RenderBox::setOverrideContainingBlockContentLogicalWidth):
322         (WebCore::RenderBox::setOverrideContainingBlockContentLogicalHeight):
323         (WebCore::RenderBox::clearOverrideContainingBlockContentSize):
324         (WebCore::RenderBox::clearOverrideContainingBlockContentLogicalHeight):
325         (WebCore::RenderBox::containingBlockLogicalWidthForContent const):
326         (WebCore::RenderBox::containingBlockLogicalHeightForContent const):
327         (WebCore::RenderBox::perpendicularContainingBlockLogicalHeight const):
328         (WebCore::RenderBox::computeLogicalWidthInFragment const):
329         (WebCore::RenderBox::computeLogicalHeight const):
330         (WebCore::RenderBox::computePercentageLogicalHeight const):
331         (WebCore::RenderBox::computeReplacedLogicalHeightUsing const):
332         (WebCore::RenderBox::availableLogicalHeightUsing const):
333         (WebCore::RenderBox::containingBlockLogicalWidthForPositioned const):
334         (WebCore::RenderBox::containingBlockLogicalHeightForPositioned const):
335         * rendering/RenderBox.h:
336         * rendering/RenderBoxModelObject.cpp:
337         (WebCore::RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight const):
338         * rendering/RenderDeprecatedFlexibleBox.cpp:
339         (WebCore::contentWidthForChild):
340         (WebCore::contentHeightForChild):
341         (WebCore::gatherFlexChildrenInfo):
342         (WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox):
343         (WebCore::RenderDeprecatedFlexibleBox::layoutVerticalBox):
344         (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
345         (WebCore::RenderDeprecatedFlexibleBox::clearLineClamp):
346         * rendering/RenderFlexibleBox.cpp:
347         (WebCore::RenderFlexibleBox::computeInnerFlexBaseSizeForChild):
348         (WebCore::RenderFlexibleBox::crossSizeForPercentageResolution):
349         (WebCore::RenderFlexibleBox::mainSizeForPercentageResolution):
350         (WebCore::RenderFlexibleBox::constructFlexItem):
351         (WebCore::RenderFlexibleBox::setOverrideMainAxisContentSizeForChild):
352         (WebCore::RenderFlexibleBox::applyStretchAlignmentToChild):
353         * rendering/RenderFullScreen.cpp:
354         (WebCore::RenderFullScreen::unwrapRenderer):
355         * rendering/RenderGrid.cpp:
356         (WebCore::RenderGrid::layoutBlock):
357         (WebCore::RenderGrid::layoutGridItems):
358         (WebCore::RenderGrid::applyStretchAlignmentToChildIfNeeded):
359         * rendering/RenderRubyBase.cpp:
360         (WebCore::RenderRubyBase::adjustInlineDirectionLineBounds const):
361         * rendering/RenderTableCell.cpp:
362         (WebCore::RenderTableCell::setOverrideContentLogicalHeightFromRowHeight):
363         * rendering/RenderTableCell.h:
364         * rendering/RenderTableSection.cpp:
365         (WebCore::RenderTableSection::calcRowLogicalHeight):
366         (WebCore::RenderTableSection::relayoutCellIfFlexed):
367
368 2018-05-14  Zalan Bujtas  <zalan@apple.com>
369
370         [LFC] Implement width computation for non-replaced out of flow elements.
371         https://bugs.webkit.org/show_bug.cgi?id=185598
372
373         Reviewed by Antti Koivisto.
374
375         * layout/FormattingContext.cpp:
376         (WebCore::Layout::FormattingContext::computeWidth const):
377         (WebCore::Layout::FormattingContext::computeOutOfFlowWidth const):
378         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
379         (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedWidth const):
380         (WebCore::Layout::FormattingContext::shrinkToFitWidth const):
381         * layout/FormattingContext.h:
382         * layout/blockformatting/BlockFormattingContext.cpp:
383         (WebCore::Layout::BlockFormattingContext::layout const):
384         * layout/displaytree/DisplayBox.h:
385
386 2018-05-14  Zan Dobersek  <zdobersek@igalia.com>
387
388         Drop the m_compositorTexture member variable in TextureMapperGC3DPlatformLayer.
389         It's not used at all inside the class or outside it.
390
391         Rubber-stamped by Michael Catanzaro.
392
393         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h:
394
395 2018-05-14  Zan Dobersek  <zdobersek@igalia.com>
396
397         [GTK] REGRESSION(r231170) Build broken with Clang 5.0
398         https://bugs.webkit.org/show_bug.cgi?id=185198
399
400         Reviewed by Michael Catanzaro.
401
402         Avoid gperf files using the register keyword which has been made
403         reserved and as such unusable in C++17.
404
405         * css/makeSelectorPseudoClassAndCompatibilityElementMap.py:
406         * css/makeSelectorPseudoElementsMap.py:
407         * css/makeprop.pl:
408         * css/makevalues.pl:
409         * platform/ColorData.gperf:
410         * platform/ReferrerPolicy.h: With std::optional forward declaration
411         gone, explicitly include the WTF Optional.h header.
412         * platform/Theme.h: Ditto.
413         * platform/network/create-http-header-name-table:
414
415 2018-05-14  Commit Queue  <commit-queue@webkit.org>
416
417         Unreviewed, rolling out r219515.
418         https://bugs.webkit.org/show_bug.cgi?id=185603
419
420         It sometimes makes AudioUnitInitialize call to fail in
421         CoreAudioCaptureSource (Requested by youenn on #webkit).
422
423         Reverted changeset:
424
425         "Remove CoreAudioCaptureSource speaker configuration"
426         https://bugs.webkit.org/show_bug.cgi?id=174512
427         https://trac.webkit.org/changeset/219515
428
429 2018-05-13  Dirk Schulze  <krit@webkit.org>
430
431         Implement SVGGeometryElement's isPointInFill and isPointInStroke
432         https://bugs.webkit.org/show_bug.cgi?id=185580
433
434         Reviewed by Antti Koivisto.
435
436         Implement isPointInFill and isPointInStroke methods for
437         SVGGeometryElement interface from SVG2.
438
439         https://svgwg.org/svg2-draft/types.html#InterfaceSVGGeometryElement
440
441         Tests: svg/dom/SVGGeometry-isPointInFill.xhtml
442                svg/dom/SVGGeometry-isPointInStroke.xhtml
443
444         * rendering/svg/RenderSVGEllipse.cpp:
445         (WebCore::RenderSVGEllipse::shapeDependentStrokeContains): Flag
446                 to switch between local and "global" coordinate space for hit testing.
447         * rendering/svg/RenderSVGEllipse.h:
448         * rendering/svg/RenderSVGPath.cpp:
449         (WebCore::RenderSVGPath::shapeDependentStrokeContains): Flag
450                 to switch between local and "global" coordinate space for hit testing.
451         * rendering/svg/RenderSVGPath.h:
452         * rendering/svg/RenderSVGRect.cpp:
453         (WebCore::RenderSVGRect::shapeDependentStrokeContains): Flag
454                 to switch between local and "global" coordinate space for hit testing.
455         * rendering/svg/RenderSVGRect.h:
456         * rendering/svg/RenderSVGShape.cpp:
457         (WebCore::RenderSVGShape::shapeDependentStrokeContains): Flag
458                 to switch between local and "global" coordinate space for hit testing.
459         (WebCore::RenderSVGShape::isPointInFill): Take the winding rule given by
460                 `fill-rule` to test if a given point is in the fill area of a path.
461         (WebCore::RenderSVGShape::isPointInStroke): Take stroke properties into
462                 account to check if a point is on top of the stroke area.
463         * rendering/svg/RenderSVGShape.h:
464         * svg/SVGGeometryElement.cpp:
465         (WebCore::SVGGeometryElement::isPointInFill):
466         (WebCore::SVGGeometryElement::isPointInStroke):
467         (WebCore::SVGGeometryElement::createElementRenderer): Deleted. This is getting implemented
468                 by inheriting classes. No need to create RenderSVGPath here.
469         * svg/SVGGeometryElement.h:
470         * svg/SVGGeometryElement.idl:
471
472 2018-05-12  Zalan Bujtas  <zalan@apple.com>
473
474         Use WeakPtr for m_enclosingPaginationLayer in RenderLayer
475         https://bugs.webkit.org/show_bug.cgi?id=185566
476         <rdar://problem/36486052>
477
478         Reviewed by Simon Fraser.
479
480         Since RenderLayer does not own the enclosing pagination layout, it should
481         construct a weak pointer instead of holding on to a raw pointer.
482
483         Unable to create a reliably reproducible test case.
484
485         * page/mac/EventHandlerMac.mm:
486         (WebCore::scrollableAreaForEventTarget):
487         (WebCore::scrollableAreaForContainerNode):
488         (WebCore::EventHandler::platformPrepareForWheelEvents):
489         * platform/ScrollableArea.h:
490         (WebCore::ScrollableArea::weakPtrFactory const):
491         (WebCore::ScrollableArea::createWeakPtr): Deleted.
492         * rendering/RenderLayer.cpp:
493         (WebCore::RenderLayer::RenderLayer):
494         (WebCore::RenderLayer::updatePagination):
495         * rendering/RenderLayer.h:
496
497 2018-05-11  Daniel Bates  <dabates@apple.com>
498
499         X-Frame-Options: SAMEORIGIN needs to check all ancestor frames
500         https://bugs.webkit.org/show_bug.cgi?id=185567
501         <rdar://problem/40175008>
502
503         Reviewed by Brent Fulgham.
504
505         Change the behavior of "X-Frame-Options: SAMEORIGIN" to ensure that all ancestors frames
506         are same-origin with the document that delivered this header. This prevents an intermediary
507         malicious frame from clickjacking a child frame whose document is same-origin with the top-
508         level frame. It also makes the behavior of X-Frame-Options in WebKit more closely match
509         the behavior of X-Frame-Options in other browsers, including Chrome and Firefox.
510         
511         Currently a document delivered with "X-Frame-Options: SAMEORIGIN" must only be same-origin
512         with the top-level frame's document in order to be displayed. This prevents clickjacking by
513         a malicious page that embeds a page delivered with "X-Frame-Options: SAMEORIGIN". However,
514         it does not protect against clickjacking of the "X-Frame-Options: SAMEORIGIN" page (victim)
515         if embedded by an intermediate malicious iframe, say a "rogue ad", that was embedded in a
516         document same origin with the victim page. We should protect against such attacks. 
517
518         Tests: http/tests/security/XFrameOptions/x-frame-options-ancestors-same-origin-allow.html
519                http/tests/security/XFrameOptions/x-frame-options-ancestors-same-origin-deny.html
520
521         * loader/FrameLoader.cpp:
522         (WebCore::FrameLoader::shouldInterruptLoadForXFrameOptions):
523
524 2018-05-11  Daniel Bates  <dabates@apple.com>
525
526         [iOS] Text decoration of dragged content does not paint with opacity
527         https://bugs.webkit.org/show_bug.cgi?id=185551
528         <rdar://problem/40166867>
529
530         Reviewed by Wenson Hsieh.
531
532         Respect alpha when painting the text decoration for dragged content.
533
534         * rendering/InlineTextBox.cpp:
535         (WebCore::InlineTextBox::MarkedTextStyle::areDecorationMarkedTextStylesEqual): Consider alpha when
536         comparing decoration styles for equality so that we do not coalesce styles with differing alpha.
537         (WebCore::InlineTextBox::paintMarkedTextDecoration): Respect alpha when painting dragged content.
538
539 2018-05-11  Nan Wang  <n_wang@apple.com>
540
541         AX: In role=dialog elements with aria-modal=true VoiceOver iOS/macOS can't manually focus or read dialog paragraph description text inside the modal.
542         https://bugs.webkit.org/show_bug.cgi?id=185219
543         <rdar://problem/39920009>
544
545         Reviewed by Chris Fleizach.
546
547         The text node descendants of a modal dialog are ignored. Fixed it by using AccessibilityObject's 
548         node() to determine if it's the descendant of the modal dialog node.
549
550         Test: accessibility/aria-modal-text-descendants.html
551
552         * accessibility/AccessibilityObject.cpp:
553         (WebCore::AccessibilityObject::isModalDescendant const):
554
555 2018-05-11  Ryosuke Niwa  <rniwa@webkit.org>
556
557         Tapping after CSS-based table casues an infinite loop in wordRangeFromPosition
558         https://bugs.webkit.org/show_bug.cgi?id=185465
559         <rdar://problem/35263057>
560
561         Reviewed by Antti Koivisto.
562
563         The bug was caused by TextIterator not emitting a line break when exiting a CSS-based table when an element
564         with `display: table-row` has an invisible text node. Specifically, TextIterator::exitNode is never called on
565         an element with `table-cell: row` when m_node is a text node with whitespaces which appears after an element
566         with `display: table-cell`.
567
568         For example, for a tree structure like:
569         table-row (R)
570           table-cell (C)
571             "text" (1)
572           " " (2)
573         Getting out of (C) would result in moving onto (2) without generating a line break for (R).
574
575         When this happens in nextBoundary as it tries to find the end of the last word in the table cell, we end up
576         finding the end of the document as the end of the word. As a result, nextWordBoundaryInDirection, the caller
577         of nextBoundary, ends up infinite looping between the positon at the end of the document and the position
578         immediately before the last word in the last table cell when it traverses words backwards.
579
580         This patch fixes the hang by addressing this root cause in TextIterator. Namely, TextIterator now generates
581         a line break when exiting a block while walking up ancestors in TextIterator::advance().
582
583         Tests: editing/selection/tapping-in-table-at-end-of-document.html
584                editing/text-iterator/table-at-end-of-document.html
585
586         * editing/TextIterator.cpp:
587         (WebCore::TextIterator::advance): Fixed the bug.
588         (WebCore::shouldEmitNewlineAfterNode): Do generate a new line at the end of a document when we're trying to
589         generate every visible poitions even there are no renderers beyond this point. e.g. a position inside the
590         last cell of a table at the end of a document hits this condition.
591         (WebCore::shouldEmitExtraNewlineForNode): Don't emit a line break when the render box's height is 0px
592         to avoid generating many empty lines for empty paragraph and header elements (this function is used to generate
593         a blank line between p's and h1/h2/...'s).
594         (WebCore::TextIterator::exitNode):
595
596 2018-05-11  Dean Jackson  <dino@apple.com>
597
598         System preview badge doesn't show on <picture> elements
599         https://bugs.webkit.org/show_bug.cgi?id=185559
600         <rdar://problem/40150066>
601
602         Reviewed by Tim Horton.
603
604         We should also identify <img>s that are the child of a <picture>
605         contained inside the appropriate <a> element.
606
607         Tested internally, since the badge is platform specific.
608
609         * html/HTMLImageElement.cpp:
610         (WebCore::HTMLImageElement::isSystemPreviewImage const): Add logic
611         to look for <picture> parents.
612
613 2018-05-11  Chris Dumez  <cdumez@apple.com>
614
615         REGRESSION (async policy delegate): Revoking an object URL immediately after triggering download breaks file download
616         https://bugs.webkit.org/show_bug.cgi?id=185531
617         <rdar://problem/39909589>
618
619         Reviewed by Geoffrey Garen.
620
621         Whenever we start an asynchronous navigation policy decision for a blob URL, create a temporary
622         blob URL pointing to the same data, and update the request's URL. This way, if the page's JS revokes
623         the URL during the policy decision, the load will still succeed.
624
625         Test: fast/dom/HTMLAnchorElement/anchor-file-blob-download-then-revoke.html
626
627         * loader/DocumentLoader.cpp:
628         (WebCore::DocumentLoader::willSendRequest):
629         * loader/FrameLoader.cpp:
630         (WebCore::FrameLoader::loadURL):
631         (WebCore::FrameLoader::load):
632         (WebCore::FrameLoader::loadPostRequest):
633         * loader/PolicyChecker.cpp:
634         (WebCore::PolicyChecker::extendBlobURLLifetimeIfNecessary const):
635         (WebCore::PolicyChecker::checkNavigationPolicy):
636         (WebCore::PolicyChecker::checkNewWindowPolicy):
637         * loader/PolicyChecker.h:
638
639 2018-05-11  Antti Koivisto  <antti@apple.com>
640
641         LinkLoader fails to remove CachedResourceClient in some cases
642         https://bugs.webkit.org/show_bug.cgi?id=185553
643         <rdar://problem/36879656>
644
645         Reviewed by Geoffrey Garen.
646
647         Test: http/tests/preload/link-preload-client-remove.html
648
649         * loader/LinkLoader.cpp:
650         (WebCore::LinkLoader::loadLink):
651
652         If there is a link preload already in progress, we fail to clear the client for the ongoing load.
653         This may leave the CachedResource client map in a bad state.
654
655 2018-05-11  Charles Vazac  <cvazac@gmail.com>
656
657         Runtime feature flag for Server-Timing
658         https://bugs.webkit.org/show_bug.cgi?id=184758
659
660         Reviewed by Youenn Fablet.
661
662         * Source/WebCore/CMakeLists.txt: Added reference to PerformanceServerTiming.idl.
663         * Source/WebCore/DerivedSources.make: Added reference to PerformanceServerTiming.idl.
664         * Source/WebCore/Sources.txt: Added reference to PerformanceServerTiming.cpp and JSPerformanceServerTiming.cpp.
665         * Source/WebCore/WebCore.xcodeproj/project.pbxproj: Added references to PerformanceServerTiming.cpp, PerformanceServerTiming.h, and PerformanceServerTiming.idl.
666         * Source/WebCore/bindings/js/WebCoreBuiltinNames.h: Added PerformanceServerTiming.
667         * Source/WebCore/page/PerformanceResourceTiming.h: Added serverTiming member.
668         * Source/WebCore/page/PerformanceResourceTiming.idl: Added serverTiming attribute.
669         * Source/WebCore/page/PerformanceServerTiming.cpp: Added.
670         * Source/WebCore/page/PerformanceServerTiming.h: Added.
671         * Source/WebCore/page/PerformanceServerTiming.idl: Added.
672
673 2018-05-11  Brady Eidson  <beidson@apple.com>
674
675         Make sure history navigations reuse the existing process when necessary.
676         <rdar://problem/39746516> and https://bugs.webkit.org/show_bug.cgi?id=185532
677
678         Reviewed by Ryosuke Niwa.
679
680         Covered by new API tests.
681
682         In WebCore-land, make sure *all* NavigationActions to a back/forward item are tagged with
683         the item identifier.
684
685         * history/HistoryItem.cpp:
686         (WebCore::HistoryItem::HistoryItem):
687         (WebCore::HistoryItem::logString const):
688         * history/HistoryItem.h:
689
690         * loader/FrameLoader.cpp:
691         (WebCore::FrameLoader::loadDifferentDocumentItem):
692
693         * loader/NavigationAction.cpp:
694         (WebCore::NavigationAction::setTargetBackForwardItem):
695
696         * loader/NavigationAction.h:
697         (WebCore::NavigationAction::targetBackForwardItemIdentifier const):
698
699 2018-05-11  Yacine Bandou  <yacine.bandou_ext@softathome.com>
700
701         [EME][GStreamer] Handle the protection event in MediaPlayerPrivate
702         https://bugs.webkit.org/show_bug.cgi?id=185535
703
704         Reviewed by Xabier Rodriguez-Calvar.
705
706         This patch is based on this calvaris's commit
707         https://github.com/WebPlatformForEmbedded/WPEWebKit/commit/d966168b0d2b65f9ca9415426e26d3752c78b03e
708
709         It adds a handler for the protection event in MediaPalyerPrivateGStreamerBase, it extracts the InitData from the event
710         and sends the encrypted event to JS via HTMLMediaElement.
711         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
712         (WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered):
713         (WebCore::MediaPlayerPrivateGStreamerBase::handleProtectionEvent):
714         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
715         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h: Add a new type InitData.
716
717 2018-05-11  Basuke Suzuki  <Basuke.Suzuki@sony.com>
718
719         [Curl] Make the cipher suites, the signing algorithms and the curve lists configurable.
720         https://bugs.webkit.org/show_bug.cgi?id=185139
721
722         Add interface to configure the cipher suites, the signing algorithms and the curve lists 
723         used by OpenSSL and libcurl to exchange, to sign or to verify keys.
724
725         Reviewed by Youenn Fablet.
726
727         No new tests in public. Have tested internally.
728
729         * platform/network/curl/CurlContext.cpp:
730         (WebCore::CurlHandle::setSslCipherList):
731         * platform/network/curl/CurlContext.h:
732         * platform/network/curl/CurlRequest.cpp:
733         (WebCore::CurlRequest::setupTransfer):
734         (WebCore::CurlRequest::willSetupSslCtx):
735         * platform/network/curl/CurlSSLHandle.cpp:
736         (WebCore::CurlSSLHandle::getCACertPathEnv):
737         * platform/network/curl/CurlSSLHandle.h:
738         (WebCore::CurlSSLHandle::getCipherList const):
739         (WebCore::CurlSSLHandle::getSignatureAlgorithmsList const):
740         (WebCore::CurlSSLHandle::getCurvesList const):
741         (WebCore::CurlSSLHandle::setCipherList):
742         (WebCore::CurlSSLHandle::setSignatureAlgorithmsList):
743         (WebCore::CurlSSLHandle::setCurvesList):
744         (WebCore::CurlSSLHandle::getCACertPath const):
745         (WebCore::CurlSSLHandle::setCACertPath):
746         * platform/network/curl/CurlSSLVerifier.cpp:
747         (WebCore::CurlSSLVerifier::CurlSSLVerifier):
748
749 2018-05-10  Daniel Bates  <dabates@apple.com>
750
751         Use PlatformStrategies to switch between WebKit and WebKitLegacy checking of CSP frame-ancestors and X-Frame-Options
752         https://bugs.webkit.org/show_bug.cgi?id=185412
753
754         Reviewed by Ryosuke Niwa.
755
756         Consolidate the knowledge on how to determine whether security checks were performed on a ResourceResponse
757         into LoaderStrategy::havePerformedSecurityChecks() (default implementation returns false) and query it
758         to determine whether CSP frame-ancestors and X-Frame-Options need to be checked for a ResourceResponse.
759
760         Additionally, rename LoaderStrategy::isDoingLoadingSecurityChecks() to shouldPerformSecurityChecks()
761         for consistency with havePerformedSecurityChecks(). Querying shouldPerformSecurityChecks() answers the
762         question of whether the loader strategy is responsible for performing security checks when building up
763         a ResourceRequest to have the loader strategy load. And LoaderStrategy::havePerformedSecurityChecks()
764         is used to determine whether the loader strategy performed these security checks for a given ResourceResponse.
765
766         * inspector/agents/InspectorNetworkAgent.cpp:
767         (WebCore::InspectorNetworkAgent::didReceiveResponse):
768         (WebCore::InspectorNetworkAgent::didFinishLoading):
769         (WebCore::isResponseProbablyComingFromNetworkProcess): Deleted.
770         * loader/DocumentLoader.cpp:
771         (WebCore::DocumentLoader::responseReceived):
772         * loader/DocumentThreadableLoader.cpp:
773         (WebCore::shouldPerformSecurityChecks):
774         (WebCore::DocumentThreadableLoader::shouldSetHTTPHeadersToKeep const):
775         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
776         (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):
777         (WebCore::DocumentThreadableLoader::redirectReceived):
778         (WebCore::DocumentThreadableLoader::didFail):
779         (WebCore::DocumentThreadableLoader::loadRequest):
780         (WebCore::isDoingSecurityChecksInNetworkProcess): Deleted.
781         (WebCore::isResponseComingFromNetworkProcess): Deleted.
782         * loader/LoaderStrategy.cpp:
783         * loader/LoaderStrategy.h:
784         * page/Settings.yaml: Remove setting networkProcessCSPFrameAncestorsCheckingEnabled as we now make
785         use of the loader strategy to determine whether to perform CSP frame-ancestors and X-Frame-Options
786         checking in DocumentLoader.
787         * platform/network/ResourceResponseBase.h:
788         (WebCore::ResourceResponseBase::setSource): Added an ASSERT to catch the programming error of setting
789         source to ResourceResponse::Source::Unknown. This source type represents an uninitialized ResourceResponse.
790
791 2018-05-10  Tim Horton  <timothy_horton@apple.com>
792
793         Lookup sometimes shows a second yellow highlight on top of WebKit's TextIndicator
794         https://bugs.webkit.org/show_bug.cgi?id=185538
795         <rdar://problem/38817825>
796
797         Reviewed by Sam Weinig.
798
799         * editing/mac/DictionaryLookup.mm:
800         (WebCore::showPopupOrCreateAnimationController):
801         Options can be nil, in which case we can't mutableCopy it and add
802         LUTermOptionDisableSearchTermIndicator. Instead, create a new dictionary,
803         and add the items from options, if it's not nil.
804
805 2018-05-10  Matt Baker  <mattbaker@apple.com>
806
807         Web Inspector: ASSERT_NOT_REACHED in PageDebuggerAgent::didAddEventListener when page adds attribute event listener
808         https://bugs.webkit.org/show_bug.cgi?id=181580
809         <rdar://problem/36461309>
810
811         Reviewed by Brian Burg.
812
813         EventTarget should pass newly added EventListeners to InspectorInstrumentation,
814         instead of PageDebuggerAgent assuming the last item in the EventListenerVector
815         is the most recently added listener. This assumption does not hold when
816         the new listener replaces an existing listener.
817
818         * dom/EventTarget.cpp:
819         (WebCore::EventTarget::addEventListener):
820         (WebCore::EventTarget::setAttributeEventListener):
821
822         * inspector/InspectorInstrumentation.cpp:
823         (WebCore::InspectorInstrumentation::didAddEventListenerImpl):
824
825         * inspector/InspectorInstrumentation.h:
826         (WebCore::InspectorInstrumentation::didAddEventListener):
827
828         * inspector/agents/page/PageDebuggerAgent.cpp:
829         (WebCore::PageDebuggerAgent::didAddEventListener):
830         * inspector/agents/page/PageDebuggerAgent.h:
831
832 2018-05-10  Chris Dumez  <cdumez@apple.com>
833
834         'Cross-Origin-Options header implementation follow-up
835         https://bugs.webkit.org/show_bug.cgi?id=185520
836
837         Reviewed by Ryosuke Niwa.
838
839         * dom/Document.cpp:
840         * dom/Document.h:
841         * loader/FrameLoader.cpp:
842         (WebCore::FrameLoader::didBeginDocument):
843         Using isNull() check is sufficient here as the header parsing
844         function will do the right thing when passed the empty string.
845         Also set the options directly on the window instead of the
846         document. The window is guaranteed to have been constructed
847         by then because didBeginDocument() is called DocumentWriter::begin()
848         which calls Document::createDOMWindow() or Document::takeDOMWindowFrom().
849
850         * page/AbstractDOMWindow.cpp:
851         (WebCore::AbstractDOMWindow::AbstractDOMWindow):
852         * page/AbstractDOMWindow.h:
853         * page/DOMWindow.cpp:
854         (WebCore::DOMWindow::DOMWindow):
855         (WebCore::DOMWindow::didSecureTransitionTo):
856         * page/RemoteDOMWindow.cpp:
857         (WebCore::RemoteDOMWindow::RemoteDOMWindow):
858         * page/RemoteDOMWindow.h:
859         CrossOriginOptions are now stored only on the Window, not the Document.
860
861         * platform/network/HTTPParsers.cpp:
862         (WebCore::parseCrossOriginOptionsHeader):
863         Drop strippedHeader local variable as it is not strictly needed.
864
865 2018-05-10  Tim Horton  <timothy_horton@apple.com>
866
867         Fix the build after r231393
868         https://bugs.webkit.org/show_bug.cgi?id=185519
869         <rdar://problem/40131741>
870
871         Reviewed by Simon Fraser.
872
873         * Configurations/WebCore.xcconfig:
874
875 2018-05-10  Eric Carlson  <eric.carlson@apple.com>
876
877         Log missing cues correctly
878         https://bugs.webkit.org/show_bug.cgi?id=185499
879         <rdar://problem/40113821>
880
881         Reviewed by Daniel Bates.
882
883         No new tests, tested manually.
884
885         * html/track/InbandGenericTextTrack.cpp:
886         (WebCore::InbandGenericTextTrack::removeGenericCue): Log the cue we searched for, not
887         the NULL cue.
888
889 2018-05-10  Zalan Bujtas  <zalan@apple.com>
890
891         [LFC] Implement height computation for non-replaced inflow elements.
892         https://bugs.webkit.org/show_bug.cgi?id=185474
893
894         Reviewed by Antti Koivisto.
895
896         Initial implementation. Does not cover all the cases.
897
898         * layout/FormattingContext.cpp:
899         (WebCore::Layout::FormattingContext::computeHeight const):
900         * layout/FormattingContext.h:
901         * layout/blockformatting/BlockFormattingContext.cpp:
902         (WebCore::Layout::BlockFormattingContext::layout const):
903         (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const):
904         (WebCore::Layout::BlockFormattingContext::computeInFlowNonReplacedHeight const):
905         * layout/blockformatting/BlockFormattingContext.h:
906         * layout/blockformatting/BlockMarginCollapse.cpp:
907         (WebCore::Layout::collapsedMarginBottomFromLastChild):
908         (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithParent):
909         (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithParentMarginBottom):
910         (WebCore::Layout::isMarginBottomCollapsedWithParent): Deleted.
911         * layout/blockformatting/BlockMarginCollapse.h:
912         * layout/inlineformatting/InlineFormattingContext.cpp:
913         (WebCore::Layout::InlineFormattingContext::computeInFlowHeight const):
914         * layout/inlineformatting/InlineFormattingContext.h:
915         * layout/layouttree/LayoutBox.cpp:
916         (WebCore::Layout::Box::isReplaced const):
917         * layout/layouttree/LayoutBox.h:
918
919 2018-05-10  Thibault Saunier  <tsaunier@igalia.com>
920
921         [GTK] Implement ImageBuffer::toBGRAData
922         https://bugs.webkit.org/show_bug.cgi?id=185511
923
924         Reviewed by Michael Catanzaro.
925
926         This was never implemented but will be required for the MediaStream API
927         tests.
928
929         * platform/graphics/ImageBuffer.cpp:
930         (WebCore::ImageBuffer::toBGRAData const):
931         * platform/graphics/cg/ImageBufferCG.cpp:
932         (WebCore::ImageBuffer::toBGRAData const):
933         * platform/graphics/gtk/ImageBufferGtk.cpp:
934         (WebCore::ImageBuffer::toBGRAData const):
935
936 2018-05-10  Yacine Bandou  <yacine.bandou_ext@softathome.com>
937
938         [EME][GStreamer] Add a handler for GStreamer protection event
939         https://bugs.webkit.org/show_bug.cgi?id=185245
940
941         Reviewed by Xabier Rodriguez-Calvar.
942
943         Qtdemux sends the protection event when encountered a new PSSH box (encrypted content).
944
945         The Decryptor is moved from AppendPipeline to PlaybackPipeline (see https://bugs.webkit.org/show_bug.cgi?id=181855),
946         thus the protection event is no longer handled because the Decryptor is not in the same pipeline as qtdemux.
947
948         AppendPipeline: httpsrc-->qtdemux-->appsink
949         PlaybackPipeline: appsrc-->parser--> decryptor-->decoder-->sink
950
951         This patch attaches a probe to the sink pad of the appsink in the appendPipeline in order to
952         catch and manage the protection event.
953
954         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
955         (WebCore::AppendPipeline::AppendPipeline):
956         (WebCore::AppendPipeline::~AppendPipeline):
957         (WebCore::appendPipelineAppsinkPadEventProbe):
958         * platform/graphics/gstreamer/mse/AppendPipeline.h:
959         (WebCore::AppendPipeline::playerPrivate):
960
961 2018-05-10  Yacine Bandou  <yacine.bandou_ext@softathome.com>
962
963         [EME][GStreamer] Move the decryptor from AppendPipeline to PlaybackPipeline.
964         https://bugs.webkit.org/show_bug.cgi?id=181855
965
966         Reviewed by Xabier Rodriguez-Calvar.
967
968         The goal of this move is to handle the limitation of SVP (Secure Video Path) memory size.
969
970         When the decryptor is in the AppendPipeline and we use SVP, we buffer in MediaSource queue
971         the decrypted GstBuffers that are in SVP memory.
972         This behavior cause an out-of-memory error, because we are limited in SVP memory size.
973
974         By moving the decryptor in PlaybackPipeline, we avoid to buffer the decrypted GstBuffers
975         which use the SVP memory and we buffer the encrypted GstBuffers that are in system memory.
976
977         This new architecture also allows to start the buffering before obtaining the DRM license
978         and it makes easier to manage dynamic change of the license or Key.
979
980         The decryptor is auto plugged by GStreamer playbin in PlaybackPipeline.
981
982         SVP: Secure Video Path also named trusted or protected video path, it is a memory which is
983         protected by a hardware access control engine, it is not accessible to other unauthorised
984         software or hardware components.
985
986         Tests:
987             media/encrypted-media/clearKey/clearKey-cenc-audio-playback-mse.html
988             media/encrypted-media/clearKey/clearKey-cenc-video-playback-mse.html
989
990         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
991         (webkitMediaCommonEncryptionDecryptSinkEventHandler):
992         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
993         (WebCore::dumpAppendState):
994         (WebCore::AppendPipeline::AppendPipeline):
995         (WebCore::AppendPipeline::handleNeedContextSyncMessage):
996         (WebCore::AppendPipeline::handleAppsrcNeedDataReceived):
997         (WebCore::AppendPipeline::setAppendState):
998         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
999         (WebCore::AppendPipeline::appsinkNewSample):
1000         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
1001         (WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread):
1002         (WebCore::appendPipelineElementMessageCallback): Deleted.
1003         (WebCore::AppendPipeline::handleElementMessage): Deleted.
1004         (WebCore::AppendPipeline::dispatchPendingDecryptionStructure): Deleted.
1005         (WebCore::AppendPipeline::dispatchDecryptionStructure): Deleted.
1006         * platform/graphics/gstreamer/mse/AppendPipeline.h:
1007         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1008         (WebCore::MediaPlayerPrivateGStreamerMSE::attemptToDecryptWithInstance):
1009         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
1010
1011 2018-05-09  Nan Wang  <n_wang@apple.com>
1012
1013         AX: VoiceOver iframe scrolling focus jumping bug
1014         https://bugs.webkit.org/show_bug.cgi?id=176615
1015         <rdar://problem/34333067>
1016
1017         Reviewed by Chris Fleizach.
1018
1019         Scrolling to make elements visible is not working correctly for elements inside an
1020         offscreen iframe. Fixed it by using RenderLayer::scrollRectToVisible() to handle
1021         scrolling more properly.
1022
1023         Test: accessibility/scroll-to-make-visible-iframe-offscreen.html
1024
1025         * accessibility/AccessibilityObject.cpp:
1026         (WebCore::AccessibilityObject::scrollToMakeVisible const):
1027
1028 2018-05-09  Joanmarie Diggs  <jdiggs@igalia.com>
1029
1030         AX: accessibleNameForNode should simplify whitespace when using innerText
1031         https://bugs.webkit.org/show_bug.cgi?id=185498
1032
1033         Reviewed by Chris Fleizach.
1034
1035         Test: accessibility/text-alternative-calculation-from-unrendered-table.html
1036
1037         Call simplifyWhiteSpace() before returning the innerText value.
1038
1039         * accessibility/AccessibilityNodeObject.cpp:
1040         (WebCore::accessibleNameForNode):
1041
1042 2018-05-09  Chris Dumez  <cdumez@apple.com>
1043
1044         Add initial support for 'Cross-Origin-Options' HTTP response header
1045         https://bugs.webkit.org/show_bug.cgi?id=184996
1046         <rdar://problem/39664620>
1047
1048         Reviewed by Geoff Garen.
1049
1050         Add initial support for 'Cross-Origin-Options' HTTP response header behind an experimental
1051         feature flag, on by default. When the HTTP server services this HTTP response header for a
1052         main resource, we'll set these options on the corresponding Document. This will impact the
1053         behavior of the Document's associated Window API when cross-origin.
1054
1055         The HTTP header has 3 possible values:
1056         - allow: This is the default. Regular cross-origin Window API is available.
1057         - allow-postmessage: Only postMessage() is available on a cross-origin window, trying to
1058           access anything else will throw a SecurityError.
1059         - deny: Trying to do anything with a cross-origin window will throw a SecurityError.
1060
1061         The header has no effect when accessing same origin windows.
1062
1063         Note that on cross-origin access from Window A to Window B, we check the cross-origin
1064         options for both Window A and Window B and use the lowest common denominator as effective
1065         cross-origin options for the access. So if Window A has 'Cross-Origin-Options: deny' and
1066         tries to call postMessage() on Window B which has 'Cross-Origin-Options: allow-postmessage',
1067         we will throw a SecurityError. This is because Window A's more restrictive options (deny)
1068         apply.
1069
1070         Tests: http/wpt/cross-origin-options/allow-postmessage-from-deny.html
1071                http/wpt/cross-origin-options/allow-postmessage.html
1072                http/wpt/cross-origin-options/cross-origin-options-header.html
1073
1074         * bindings/js/JSDOMBindingSecurity.cpp:
1075         (WebCore::BindingSecurity::shouldAllowAccessToDOMWindowGivenMinimumCrossOriginOptions):
1076         * bindings/js/JSDOMBindingSecurity.h:
1077         * bindings/js/JSDOMWindowCustom.cpp:
1078         (WebCore::effectiveCrossOriginOptionsForAccess):
1079         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
1080         (WebCore::JSDOMWindow::getOwnPropertySlot):
1081         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
1082         (WebCore::addCrossOriginWindowPropertyNames):
1083         (WebCore::addScopedChildrenIndexes):
1084         (WebCore::addCrossOriginWindowOwnPropertyNames):
1085         (WebCore::JSDOMWindow::getOwnPropertyNames):
1086         * bindings/js/JSDOMWindowCustom.h:
1087         * bindings/js/JSRemoteDOMWindowCustom.cpp:
1088         (WebCore::JSRemoteDOMWindow::getOwnPropertySlot):
1089         (WebCore::JSRemoteDOMWindow::getOwnPropertySlotByIndex):
1090         (WebCore::JSRemoteDOMWindow::getOwnPropertyNames):
1091         * bindings/scripts/CodeGeneratorJS.pm:
1092         (GenerateAttributeGetterBodyDefinition):
1093         (GetCrossOriginsOptionsFromExtendedAttributeValue):
1094         (GenerateAttributeSetterBodyDefinition):
1095         (GenerateOperationBodyDefinition):
1096         * bindings/scripts/IDLAttributes.json:
1097         * dom/Document.cpp:
1098         (WebCore::Document::setCrossOriginOptions):
1099         * dom/Document.h:
1100         (WebCore::Document::crossOriginOptions const):
1101         * loader/FrameLoader.cpp:
1102         (WebCore::FrameLoader::didBeginDocument):
1103         * page/AbstractDOMWindow.cpp:
1104         (WebCore::AbstractDOMWindow::AbstractDOMWindow):
1105         * page/AbstractDOMWindow.h:
1106         (WebCore::AbstractDOMWindow::crossOriginOptions):
1107         (WebCore::AbstractDOMWindow::setCrossOriginOptions):
1108         * page/DOMWindow.cpp:
1109         (WebCore::DOMWindow::DOMWindow):
1110         (WebCore::DOMWindow::didSecureTransitionTo):
1111         * page/DOMWindow.idl:
1112         * page/Frame.h:
1113         * page/RemoteDOMWindow.cpp:
1114         (WebCore::RemoteDOMWindow::RemoteDOMWindow):
1115         * page/RemoteDOMWindow.h:
1116         * page/Settings.yaml:
1117         * platform/network/HTTPHeaderNames.in:
1118         * platform/network/HTTPParsers.cpp:
1119         (WebCore::parseCrossOriginOptionsHeader):
1120         * platform/network/HTTPParsers.h:
1121
1122 2018-05-09  Ryosuke Niwa  <rniwa@webkit.org>
1123
1124         Release assert in TreeScopeOrderedMap::remove via HTMLImageElement::removedFromAncestor
1125         https://bugs.webkit.org/show_bug.cgi?id=185493
1126
1127         Reviewed by Brent Fulgham.
1128
1129         Fixed the bug that HTMLImageElement::removedFromAncestor and HTMLMapElement::removedFromAncestor
1130         were calling removeImageElementByUsemap on the document instead of the shadow tree from which it was removed.
1131
1132         Test: fast/images/imagemap-in-shadow-tree-removed.html
1133
1134         * html/HTMLImageElement.cpp:
1135         (WebCore::HTMLImageElement::removedFromAncestor):
1136         * html/HTMLMapElement.cpp:
1137         (WebCore::HTMLMapElement::removedFromAncestor):
1138
1139 2018-05-09  Joanmarie Diggs  <jdiggs@igalia.com>
1140
1141         AX: Hidden nodes which are not directly referenced should not participate name/description from content
1142         https://bugs.webkit.org/show_bug.cgi?id=185478
1143
1144         Reviewed by Chris Fleizach.
1145
1146         Add a check to AccessibilityNodeObject::textUnderElement() and return early
1147         if the node is hidden, not referenced by aria-labelledby or aria-describedby,
1148         not an HTMLLabelElement, and not fallback content for an HTMLCanvasElement.
1149
1150         Test: accessibility/text-alternative-calculation-hidden-nodes.html
1151
1152         * accessibility/AccessibilityNodeObject.cpp:
1153         (WebCore::AccessibilityNodeObject::textUnderElement const):
1154
1155 2018-05-09  Eric Carlson  <eric.carlson@apple.com>
1156
1157         Update MediaSession to use release logging
1158         https://bugs.webkit.org/show_bug.cgi?id=185376
1159         <rdar://problem/40022203>
1160
1161         Reviewed by Youenn Fablet.
1162
1163         No new tests, tested manually.
1164
1165         * Modules/mediastream/MediaStream.h: hostingDocument() doesn't need to return a const Document.
1166         * Modules/webaudio/AudioContext.cpp:
1167         (WebCore::AudioContext::hostingDocument const): Ditto.
1168         * Modules/webaudio/AudioContext.h:
1169
1170         * html/HTMLMediaElement.h: Ditto.
1171
1172         * html/MediaElementSession.cpp:
1173         (WebCore::MediaElementSession::MediaElementSession):
1174         (WebCore::MediaElementSession::addBehaviorRestriction):
1175         (WebCore::MediaElementSession::removeBehaviorRestriction):
1176         (WebCore::MediaElementSession::dataLoadingPermitted const):
1177         (WebCore::MediaElementSession::fullscreenPermitted const):
1178         (WebCore::MediaElementSession::pageAllowsDataLoading const):
1179         (WebCore::MediaElementSession::pageAllowsPlaybackAfterResuming const):
1180         (WebCore::MediaElementSession::canShowControlsManager const):
1181         (WebCore::MediaElementSession::showPlaybackTargetPicker):
1182         (WebCore::MediaElementSession::hasWirelessPlaybackTargets const):
1183         (WebCore::MediaElementSession::wirelessVideoPlaybackDisabled const):
1184         (WebCore::MediaElementSession::setWirelessVideoPlaybackDisabled):
1185         (WebCore::MediaElementSession::setHasPlaybackTargetAvailabilityListeners):
1186         (WebCore::MediaElementSession::externalOutputDeviceAvailableDidChange):
1187         (WebCore::MediaElementSession::setShouldPlayToPlaybackTarget):
1188         (WebCore::MediaElementSession::mediaEngineUpdated):
1189         (WebCore::MediaElementSession::willLog const): Deleted.
1190         (WebCore::MediaElementSession::logger const): Deleted.
1191         (WebCore::MediaElementSession::logIdentifier const): Deleted.
1192         (WebCore::MediaElementSession::logChannel const): Deleted.
1193         * html/MediaElementSession.h:
1194
1195         * platform/audio/PlatformMediaSession.cpp:
1196         (WebCore::nextLogIdentifier):
1197         (WebCore::convertEnumerationToString):
1198         (WebCore::PlatformMediaSession::PlatformMediaSession):
1199         (WebCore::PlatformMediaSession::setState):
1200         (WebCore::PlatformMediaSession::beginInterruption):
1201         (WebCore::PlatformMediaSession::endInterruption):
1202         (WebCore::PlatformMediaSession::clientWillBeginAutoplaying):
1203         (WebCore::PlatformMediaSession::clientWillPausePlayback):
1204         (WebCore::PlatformMediaSession::pauseSession):
1205         (WebCore::PlatformMediaSession::stopSession):
1206         (WebCore::PlatformMediaSession::clientDataBufferingTimerFired):
1207         (WebCore::PlatformMediaSession::logChannel const):
1208         (WebCore::stateName): Deleted.
1209         (WebCore::interruptionName): Deleted.
1210         * platform/audio/PlatformMediaSession.h:
1211         (WTF::LogArgument<WebCore::PlatformMediaSession::State>::toString):
1212         (WTF::LogArgument<WebCore::PlatformMediaSession::InterruptionType>::toString):
1213
1214 2018-05-09  Thibault Saunier  <tsaunier@igalia.com>
1215
1216         [GStreamer] Never call updateTracks if running on legacy pipeline
1217         https://bugs.webkit.org/show_bug.cgi?id=184581
1218
1219         This makes sure failling code path is never reached in the conditions where it should not have been reached.
1220
1221         Reviewed by Philippe Normand.
1222
1223         Re enables all tests that were disabled after fixing.
1224
1225         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1226         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
1227
1228 2018-05-09  Daniel Bates  <dabates@apple.com>
1229
1230         REGRESSION (r231479): http/tests/appcache/x-frame-options-prevents-framing.php is timing out
1231         https://bugs.webkit.org/show_bug.cgi?id=185443
1232         <rdar://problem/40100660>
1233
1234         Reviewed by Andy Estes.
1235
1236         Following r231479 when using WebKit2 and Restricted HTTP Response Access is enabled (enabled in
1237         WebKitTestRunner) we only check the CSP frame-ancestors directive and X-Frame-Options in
1238         NetworkProcess. We need to check these security requirements in WebContent process whenever
1239         we are performing a substitute data load, such as for app cache, as these loads do not go
1240         through NetworkProcess.
1241
1242         * loader/DocumentLoader.cpp:
1243         (WebCore::DocumentLoader::responseReceived):
1244
1245 2018-05-09  Justin Fan  <justin_fan@apple.com>
1246
1247         Hooked up ASTC support in WebGL; requires OpenGL ES 3 context to work. 
1248         https://bugs.webkit.org/show_bug.cgi?id=185272
1249         <rdar://problem/15745737>
1250
1251         Reviewed by Dean Jackson.
1252
1253         Also added in Khronos' ASTC test from version 1.0.4 beta of their conformance test suite,
1254         although again, this requires OpenGL ES 3 context for WebKit to detect proper support.
1255
1256         Test: fast/canvas/webgl/webgl-compressed-texture-astc.html
1257
1258         * DerivedSources.make:
1259         * Sources.txt:
1260         * WebCore.xcodeproj/project.pbxproj:
1261         * bindings/js/JSDOMConvertWebGL.cpp:
1262         (WebCore::convertToJSValue):
1263         * html/canvas/WebGL2RenderingContext.cpp:
1264         (WebCore::WebGL2RenderingContext::getExtension):
1265         (WebCore::WebGL2RenderingContext::getSupportedExtensions):
1266         * html/canvas/WebGLCompressedTextureASTC.cpp: Added.
1267         (WebCore::WebGLCompressedTextureASTC::WebGLCompressedTextureASTC):
1268         (WebCore::WebGLCompressedTextureASTC::getName const):
1269         (WebCore::WebGLCompressedTextureASTC::supported):
1270         (WebCore::WebGLCompressedTextureASTC::getSupportedProfiles):
1271         * html/canvas/WebGLCompressedTextureASTC.h: Added.
1272         * html/canvas/WebGLCompressedTextureASTC.idl: Added.
1273         * html/canvas/WebGLExtension.h:
1274         * html/canvas/WebGLRenderingContext.cpp:
1275         (WebCore::WebGLRenderingContext::getExtension):
1276         (WebCore::WebGLRenderingContext::getSupportedExtensions):
1277         * html/canvas/WebGLRenderingContextBase.cpp:
1278         (WebCore::WebGLRenderingContextBase::validateCompressedTexFuncData):
1279         (WebCore::WebGLRenderingContextBase::validateCompressedTexDimensions):
1280         * html/canvas/WebGLRenderingContextBase.h:
1281         * platform/graphics/Extensions3D.h:
1282
1283 2018-05-09  Youenn Fablet  <youenn@apple.com>
1284
1285         Allow WebResourceLoader to cancel a load served from a service worker
1286         https://bugs.webkit.org/show_bug.cgi?id=185274
1287
1288         Reviewed by Chris Dumez.
1289
1290         Add support for cancelling a fetch from WebProcess to service worker process.
1291         Use FetchIdentifier instead of uint64_t.
1292
1293         * Modules/fetch/FetchIdentifier.h: Added.
1294         * WebCore.xcodeproj/project.pbxproj:
1295         * workers/service/context/ServiceWorkerFetch.h:
1296         * workers/service/context/ServiceWorkerThreadProxy.cpp:
1297         (WebCore::ServiceWorkerThreadProxy::startFetch):
1298         (WebCore::ServiceWorkerThreadProxy::cancelFetch):
1299         * workers/service/context/ServiceWorkerThreadProxy.h:
1300
1301 2018-05-09  Thibault Saunier  <tsaunier@igalia.com>
1302
1303         [GStreamer] Fix style issue in MediaPlayerPrivateGStreamer
1304         https://bugs.webkit.org/show_bug.cgi?id=185479
1305
1306         Reviewed by Philippe Normand.
1307
1308         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:114:  Multi line control clauses should use braces.  [whitespace/braces] [4]
1309         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:194:  Multi line control clauses should use braces.  [whitespace/braces] [4]
1310         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:398:  One line control clauses should not use braces.  [whitespace/braces] [4]
1311         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:440:  One line control clauses should not use braces.  [whitespace/braces] [4]
1312         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:806:  More than one command on the same line  [whitespace/newline] [4]
1313         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:869:  More than one command on the same line  [whitespace/newline] [4]
1314         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:880:  More than one command on the same line  [whitespace/newline] [4]
1315         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:940:  More than one command on the same line  [whitespace/newline] [4]
1316         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1102:  Multi line control clauses should use braces.  [whitespace/braces] [4]
1317         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1109:  Multi line control clauses should use braces.  [whitespace/braces] [4]
1318
1319         Indentation and style issue fixed only.
1320
1321         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1322         (WebCore::MediaPlayerPrivateGStreamer::registerMediaEngine):
1323         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
1324         (WebCore::MediaPlayerPrivateGStreamer::changePipelineState):
1325         (WebCore::MediaPlayerPrivateGStreamer::play):
1326         (WebCore::MediaPlayerPrivateGStreamer::videoChangedCallback):
1327         (WebCore::MediaPlayerPrivateGStreamer::videoSinkCapsChangedCallback):
1328         (WebCore::MediaPlayerPrivateGStreamer::audioChangedCallback):
1329         (WebCore::MediaPlayerPrivateGStreamer::textChangedCallback):
1330         (WebCore::MediaPlayerPrivateGStreamer::buffered const):
1331         (WebCore::MediaPlayerPrivateGStreamer::loadNextLocation):
1332
1333 2018-05-09  Daniel Bates  <dabates@apple.com>
1334
1335         REGRESSION (r231479): com.apple.WebCore crash in WebCore::DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied()
1336         https://bugs.webkit.org/show_bug.cgi?id=185475
1337         <rdar://problem/40093853>
1338
1339         Reviewed by Andy Estes.
1340
1341         DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() must extends its lifetime
1342         until completion as dispatching a DOM load event at the associated frame can cause JavaScript execution
1343         that can do anything, including destroying the loader that dispatched the event.
1344
1345         Following r231479 DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() is now
1346         invoked by both DocumentLoader::responseReceived() and WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied().
1347         The latter only can happen when using WebKit2 and the experimental feature Restricted HTTP Response Access
1348         is enabled (RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess()). Unlike DocumentLoader::responseReceived()
1349         WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() does not take out a ref
1350         on the DocumentLoader before invoking DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied().
1351         Therefore, DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() can cause its
1352         own destruction as a result of dispatching a DOM load event at the frame. We should take out a ref on
1353         the DocumentLoader when executing DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied().
1354
1355         * loader/DocumentLoader.cpp:
1356         (WebCore::DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied):
1357
1358 2018-05-09  Tim Horton  <timothy_horton@apple.com>
1359
1360         Fix the build by ignoring some deprecation warnings
1361
1362         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1363         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep):
1364
1365 2018-05-09  Michael Catanzaro  <mcatanzaro@igalia.com>
1366
1367         [WPE] Build cleanly with GCC 8 and ICU 60
1368         https://bugs.webkit.org/show_bug.cgi?id=185462
1369
1370         Reviewed by Carlos Alberto Lopez Perez.
1371
1372         * PlatformGTK.cmake: Include directories are in the wrong place.
1373         * accessibility/AXObjectCache.cpp: Silence -Wclass-memaccess problems and leave warnings.
1374         (WebCore::AXObjectCache::startOrEndTextMarkerDataForRange):
1375         (WebCore::AXObjectCache::textMarkerDataForCharacterOffset):
1376         (WebCore::AXObjectCache::textMarkerDataForVisiblePosition):
1377         (WebCore::AXObjectCache::textMarkerDataForFirstPositionInTextControl):
1378         * css/CSSFontFace.cpp: Silence -Wfallthrough
1379         (WebCore::CSSFontFace::fontLoadTiming const):
1380         * css/CSSSelectorList.cpp: Silence -Wclass-memaccess, this one is intentional.
1381         (WebCore::CSSSelectorList::adoptSelectorVector):
1382         * editing/TextIterator.cpp: Silence ICU deprecation warnings.
1383         * platform/Length.h:
1384         (WebCore::Length::operator=): More -Wclass-memaccess, looks benign.
1385         * platform/graphics/Gradient.cpp:
1386         (WebCore::Gradient::hash const): -Wclass-memaccess again. Leave a warning.
1387         * platform/graphics/SurrogatePairAwareTextIterator.cpp: Silence ICU deprecation warnings.
1388         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
1389         (WebCore::FontCascade::fontForCombiningCharacterSequence const): Silence ICU deprecation.
1390         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
1391         (WebCore::FontCustomPlatformData::FontCustomPlatformData): Silence -Wcast-function-type.
1392         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
1393         (WebCore::Font::canRenderCombiningCharacterSequence const): Silence ICU deprecation.
1394         * platform/graphics/gstreamer/GstAllocatorFastMalloc.cpp:
1395         (gstAllocatorFastMallocMemUnmap): Fix -Wcast-function-type.
1396         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1397         (WebCore::MediaPlayerPrivateGStreamer::updateTracks): Fix bad printf.
1398         (WebCore::MediaPlayerPrivateGStreamer::enableTrack): Another bad printf.
1399         (WebCore::findHLSQueue): Fix -Wcast-function-type.
1400         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
1401         (webKitMediaClearKeyDecryptorDecrypt): Fix another bad printf.
1402         * platform/network/soup/SocketStreamHandleImplSoup.cpp: Silence -Wcast-function-type.
1403         (WebCore::SocketStreamHandleImpl::beginWaitingForSocketWritability):
1404         * platform/text/TextEncoding.cpp: Silence ICU deprecration.
1405
1406 2018-05-08  Simon Fraser  <simon.fraser@apple.com>
1407
1408         SVG lighting colors need to be converted into linearSRGB
1409         https://bugs.webkit.org/show_bug.cgi?id=181196
1410
1411         Reviewed by Darin Adler.
1412
1413         Address post-commit comments. Don't make a Color that contains linearRGB components,
1414         but use FloatComponents instead. Since these FloatComponents are in the 0-1 range,
1415         FELighting::setPixelInternal() needs to multiply by 255 since the output pixels are
1416         8-bit 0-255.
1417         
1418         Change linearToSRGBColorComponent() and sRGBToLinearColorComponent() to do math in
1419         floats without promoting to doubles.
1420
1421         * platform/graphics/ColorUtilities.cpp:
1422         (WebCore::FloatComponents::FloatComponents):
1423         (WebCore::linearToSRGBColorComponent):
1424         (WebCore::sRGBToLinearColorComponent):
1425         (WebCore::sRGBColorToLinearComponents):
1426         (WebCore::linearToSRGBColor): Deleted.
1427         (WebCore::sRGBToLinearColor): Deleted.
1428         * platform/graphics/ColorUtilities.h:
1429         * platform/graphics/filters/FELighting.cpp:
1430         (WebCore::FELighting::setPixelInternal):
1431         (WebCore::FELighting::drawLighting):
1432
1433 2018-05-09  Timothy Hatcher  <timothy@apple.com>
1434
1435         Use StyleColor::Options in more places.
1436
1437         https://bugs.webkit.org/show_bug.cgi?id=185458
1438         rdar://problem/39853798
1439
1440         Add UseDefaultAppearance to StyleColor::Options, to avoid passing yet another
1441         boolean on some of these functions.
1442
1443         Reviewed by Tim Horton.
1444
1445         * css/MediaQueryEvaluator.cpp:
1446         * css/StyleColor.h:
1447         * dom/Document.cpp:
1448         (WebCore::Document::useDefaultAppearance const):
1449         (WebCore::Document::styleColorOptions const):
1450         * dom/Document.h:
1451         * platform/Theme.cpp:
1452         (WebCore::Theme::paint):
1453         * platform/Theme.h:
1454         * platform/mac/LocalDefaultSystemAppearance.h:
1455         * platform/mac/LocalDefaultSystemAppearance.mm:
1456         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
1457         (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance):
1458         * platform/mac/ThemeMac.h:
1459         * platform/mac/ThemeMac.mm:
1460         (WebCore::paintToggleButton):
1461         (WebCore::paintButton):
1462         (WebCore::ThemeMac::ensuredView):
1463         (WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext):
1464         (WebCore::ThemeMac::paint):
1465         (-[WebCoreThemeView initWithUseSystemAppearance:]): Deleted.
1466         * platform/wpe/ThemeWPE.cpp:
1467         (WebCore::ThemeWPE::paint):
1468         * platform/wpe/ThemeWPE.h:
1469         * rendering/RenderListBox.cpp:
1470         (WebCore::RenderListBox::paintItemBackground):
1471         * rendering/RenderTheme.cpp:
1472         (WebCore::RenderTheme::paint):
1473         (WebCore::RenderTheme::inactiveListBoxSelectionBackgroundColor const):
1474         (WebCore::RenderTheme::platformInactiveListBoxSelectionBackgroundColor const):
1475         * rendering/RenderTheme.h:
1476         * rendering/RenderThemeGtk.cpp:
1477         (WebCore::RenderThemeGtk::platformInactiveListBoxSelectionBackgroundColor const):
1478         * rendering/RenderThemeGtk.h:
1479         * rendering/RenderThemeMac.h:
1480         * rendering/RenderThemeMac.mm:
1481         (WebCore::RenderThemeMac::documentViewFor const):
1482         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const):
1483         (WebCore::RenderThemeMac::systemColor const):
1484         (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary):
1485         (WebCore::RenderThemeMac::paintSliderThumb):
1486
1487 2018-05-09  Yacine Bandou  <yacine.bandou_ext@softathome.com>
1488
1489         [EME][GStreamer] Crash when the mediaKeys are created before loading the media in debug conf
1490         https://bugs.webkit.org/show_bug.cgi?id=185244
1491
1492         Reviewed by Xabier Rodriguez-Calvar.
1493
1494         The function "MediaPlayerPrivateGStreamerBase::cdmInstanceAttached" is expected to be called once,
1495         so there is an ASSERT(!m_cdmInstance).
1496         But when the MediaKeys are created before loading the media, the cdminstance is created and attached
1497         to the MediaPlayerPrivate via "MediaPlayerPrivateGStreamerBase::cdmInstanceAttached" before loading
1498         the media, then when the media is loading, the function "MediaPlayerPrivateGStreamerBase::cdmInstanceAttached"
1499         will be called several times via the function "mediaEngineWasUpdated" wich is called for each change
1500         in the MediaElement state, thus the WebProcess crashes in the ASSERT(!m_cdmInstance).
1501
1502         This commit avoid the crash by replacing the assert with a simple check.
1503
1504         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1505         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceAttached):
1506         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceDetached):
1507
1508 2018-05-09  Antti Koivisto  <antti@apple.com>
1509
1510         Add OptionSet::operator& and operator bool
1511         https://bugs.webkit.org/show_bug.cgi?id=185306
1512
1513         Reviewed by Anders Carlsson.
1514
1515         Use it in a few places.
1516
1517         * loader/FrameLoader.cpp:
1518         (WebCore::FrameLoader::reload):
1519         * rendering/RenderLayerCompositor.cpp:
1520         (WebCore::RenderLayerCompositor::logReasonsForCompositing):
1521         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
1522
1523 2018-05-08  Dean Jackson  <dino@apple.com>
1524
1525         Disable system preview link fetching
1526         https://bugs.webkit.org/show_bug.cgi?id=185463
1527
1528         Reviewed by Jon Lee.
1529
1530         Temporarily disable system preview detection when a link
1531         is clicked.
1532
1533         * html/HTMLAnchorElement.cpp:
1534         (WebCore::HTMLAnchorElement::handleClick):
1535
1536 2018-05-08  Wenson Hsieh  <wenson_hsieh@apple.com>
1537
1538         Unreviewed, fix the internal iOS build
1539
1540         Add a missing import statement in an implementation file.
1541
1542         * editing/cocoa/WebContentReaderCocoa.mm:
1543
1544 2018-05-08  Ryan Haddad  <ryanhaddad@apple.com>
1545
1546         Unreviewed, rolling out r231486.
1547
1548         Caused service worker LayoutTest failures on macOS Debug WK2.
1549
1550         Reverted changeset:
1551
1552         "Allow WebResourceLoader to cancel a load served from a
1553         service worker"
1554         https://bugs.webkit.org/show_bug.cgi?id=185274
1555         https://trac.webkit.org/changeset/231486
1556
1557 2018-05-08  Wenson Hsieh  <wenson_hsieh@apple.com>
1558
1559         Consolidate WebContentReaderIOS and WebContentReaderMac into WebContentReaderCocoa
1560         https://bugs.webkit.org/show_bug.cgi?id=185340
1561
1562         Reviewed by Tim Horton.
1563
1564         WebContentReader::readURL is currently the only method implemented separately in iOS and macOS platform
1565         WebContentReader files. The implementation across macOS and iOS is nearly identical (with some exceptions with
1566         the way iOS handles file URLs and plain text editing), so we can merge these into a single method
1567         WebContentReaderCocoa and delete WebContentReaderIOS and WebContentReaderMac.
1568
1569         This also has the added bonus of fixing a latent bug in WebContentReaderMac, wherein URLs written to the
1570         pasteboard using -[NSPasteboard writeObjects:] are currently pasted as empty anchor elements. In this case, the
1571         link title isn't made explicit, so the `title` passed in to WebContentReader::readURL is empty. On iOS, we have
1572         code to fall back to pasting the absolute string of the URL if the title is empty, but on macOS, we'll just use
1573         this empty string as the title of the anchor.
1574
1575         Test: PasteMixedContent.PasteURLWrittenToPasteboardUsingWriteObjects
1576
1577         * SourcesCocoa.txt:
1578         * WebCore.xcodeproj/project.pbxproj:
1579         * editing/cocoa/WebContentReaderCocoa.mm:
1580         (WebCore::WebContentReader::readURL):
1581         * editing/ios/WebContentReaderIOS.mm: Removed.
1582         * editing/mac/WebContentReaderMac.mm: Removed.
1583
1584 2018-05-08  Zalan Bujtas  <zalan@apple.com>
1585
1586         [Simple line layout] Cache run resolver.
1587         https://bugs.webkit.org/show_bug.cgi?id=185411
1588
1589         Reviewed by Antti Koivisto.
1590
1591         This patch caches the run resolver on the [SimpleLine]Layout object. 
1592         In certain cases, when the block container has thousands of elements (foobar1<br>foobar2<br>.....foobar9999<br>),
1593         constructing the resolver (and its dependencies) in a repeating fashion could hang the WebProcess.
1594
1595         Covered by existing tests.
1596
1597         * rendering/SimpleLineLayout.cpp:
1598         (WebCore::SimpleLineLayout::create):
1599         (WebCore::SimpleLineLayout::Layout::create):
1600         (WebCore::SimpleLineLayout::Layout::Layout):
1601         * rendering/SimpleLineLayout.h:
1602         (WebCore::SimpleLineLayout::Layout::runResolver const):
1603         * rendering/SimpleLineLayoutFunctions.cpp:
1604         (WebCore::SimpleLineLayout::paintFlow):
1605         (WebCore::SimpleLineLayout::hitTestFlow):
1606         (WebCore::SimpleLineLayout::collectFlowOverflow):
1607         (WebCore::SimpleLineLayout::computeBoundingBox):
1608         (WebCore::SimpleLineLayout::computeFirstRunLocation):
1609         (WebCore::SimpleLineLayout::collectAbsoluteRects):
1610         (WebCore::SimpleLineLayout::collectAbsoluteQuads):
1611         (WebCore::SimpleLineLayout::textOffsetForPoint):
1612         (WebCore::SimpleLineLayout::collectAbsoluteQuadsForRange):
1613         (WebCore::SimpleLineLayout::generateLineBoxTree):
1614         * rendering/SimpleLineLayoutResolver.cpp:
1615         (WebCore::SimpleLineLayout::LineResolver::LineResolver):
1616         * rendering/SimpleLineLayoutResolver.h:
1617         (WebCore::SimpleLineLayout::lineResolver):
1618
1619 2018-05-08  Brent Fulgham  <bfulgham@apple.com>
1620
1621         Switch some RELEASE_ASSERTS to plain debug ASSERTS in PlatformScreenMac.mm
1622         https://bugs.webkit.org/show_bug.cgi?id=185451
1623         <rdar://problem/39620348>
1624
1625         Reviewed by Zalan Bujtas.
1626
1627         Change a set of RELEASE_ASSERTS used to prevent accessing NSScreen related functions in the
1628         PlatformScreenMac implementation to less expensive Debug ASSERTS.
1629
1630         No change in behavior.
1631
1632         * platform/mac/PlatformScreenMac.mm:
1633         (WebCore::screenHasInvertedColors):
1634         (WebCore::screenDepth):
1635         (WebCore::screenDepthPerComponent):
1636         (WebCore::screenRectForDisplay):
1637         (WebCore::screenRect):
1638         (WebCore::screenAvailableRect):
1639         (WebCore::screenColorSpace):
1640         (WebCore::screenSupportsExtendedColor):
1641
1642 2018-05-08  Daniel Bates  <dabates@apple.com>
1643
1644         Resign Strong Password appearance when text field value changes
1645         https://bugs.webkit.org/show_bug.cgi?id=185433
1646         <rdar://problem/39958508>
1647
1648         Reviewed by Ryosuke Niwa.
1649
1650         Remove the Strong Password decoration when the text field's value changes to avoid interfering
1651         with web sites that allow a person to clear the password field.
1652
1653         Tests: fast/forms/auto-fill-button/auto-fill-strong-password-button-when-maxlength-changes.html
1654                fast/forms/auto-fill-button/auto-fill-strong-password-button-when-minlength-changes.html
1655                fast/forms/auto-fill-button/hide-auto-fill-strong-password-button-when-value-changes.html
1656
1657         * html/HTMLInputElement.cpp:
1658         (WebCore::HTMLInputElement::resignStrongPasswordAppearance): Extracted from HTMLInputElement::updateType().
1659         (WebCore::HTMLInputElement::updateType): Extract out logic to resign the Strong Password appearance
1660         into a function that can be shared by this function and HTMLInputElement::setValue().
1661         (WebCore::HTMLInputElement::setValue): Resign the Strong Password appearance if this field was
1662         changed programmatically (i.e. no DOM change event was dispatched).
1663         * html/HTMLInputElement.h:
1664
1665 2018-05-08  Jer Noble  <jer.noble@apple.com>
1666
1667         Unreviewed build fix; add missing function definition.
1668
1669         * html/HTMLMediaElement.h:
1670         (WebCore::HTMLMediaElement::didPassCORSAccessCheck const):
1671
1672 2018-05-08  Jer Noble  <jer.noble@apple.com>
1673
1674         Mute MediaElementSourceNode when tainted.
1675         https://bugs.webkit.org/show_bug.cgi?id=184866
1676
1677         Reviewed by Eric Carlson.
1678
1679         Test: http/tests/security/webaudio-render-remote-audio-blocked-no-crossorigin.html
1680
1681         * Modules/webaudio/AudioContext.cpp:
1682         (WebCore::AudioContext::wouldTaintOrigin const):
1683         * Modules/webaudio/AudioContext.h:
1684         * Modules/webaudio/MediaElementAudioSourceNode.cpp:
1685         (WebCore::MediaElementAudioSourceNode::setFormat):
1686         (WebCore::MediaElementAudioSourceNode::wouldTaintOrigin):
1687         (WebCore::MediaElementAudioSourceNode::process):
1688         * Modules/webaudio/MediaElementAudioSourceNode.h:
1689
1690 2018-05-08  Eric Carlson  <eric.carlson@apple.com>
1691
1692         Log rtcstats as JSON
1693         https://bugs.webkit.org/show_bug.cgi?id=185437
1694         <rdar://problem/40065332>
1695
1696         Reviewed by Youenn Fablet.
1697
1698         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1699         (WebCore::RTCStatsLogger::RTCStatsLogger): Create a wrapper class so we don't have to add a
1700         toJSONString method to libwebrtc.
1701         (WebCore::RTCStatsLogger::toJSONString const): Log stats as JSON.
1702         (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered): Don't use the LOGIDENTIFIER macro because
1703         it doesn't work well inside of a lambda.
1704         (WTF::LogArgument<WebCore::RTCStatsLogger>::toString): Move into .cpp file because it is only
1705         used here.
1706         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
1707         (WTF::LogArgument<webrtc::RTCStats>::toString): Deleted. Move to .cpp file.
1708
1709 2018-05-08  Dean Jackson  <dino@apple.com>
1710
1711         System Preview links should trigger a download
1712         https://bugs.webkit.org/show_bug.cgi?id=185439
1713         <rdar://problem/40065545>
1714
1715         Reviewed by Jon Lee.
1716
1717         Add a new field to FrameLoadRequest, which then is copied
1718         into ResourceRequest, identifying if the link clicked
1719         is a system preview.
1720
1721         * html/HTMLAnchorElement.cpp:
1722         (WebCore::HTMLAnchorElement::handleClick): Look for isSystemPreviewLink().
1723         * loader/FrameLoadRequest.cpp:
1724         (WebCore::FrameLoadRequest::FrameLoadRequest):
1725         * loader/FrameLoadRequest.h: New property.
1726         (WebCore::FrameLoadRequest::FrameLoadRequest):
1727         (WebCore::FrameLoadRequest::isSystemPreview const):
1728         * loader/FrameLoader.cpp:
1729         (WebCore::FrameLoader::urlSelected):
1730         (WebCore::FrameLoader::loadURL):
1731         * loader/FrameLoader.h:
1732         * platform/network/ResourceRequestBase.cpp:
1733         (WebCore::ResourceRequestBase::isSystemPreview const):
1734         (WebCore::ResourceRequestBase::setSystemPreview):
1735         * platform/network/ResourceRequestBase.h:
1736
1737 2018-05-08  Commit Queue  <commit-queue@webkit.org>
1738
1739         Unreviewed, rolling out r231491.
1740         https://bugs.webkit.org/show_bug.cgi?id=185434
1741
1742         Setting the Created key on a cookie does not work yet, due a
1743         bug in CFNetwork (Requested by ggaren on #webkit).
1744
1745         Reverted changeset:
1746
1747         "[WKHTTPCookieStore getAllCookies] returns inconsistent
1748         creation time"
1749         https://bugs.webkit.org/show_bug.cgi?id=185041
1750         https://trac.webkit.org/changeset/231491
1751
1752 2018-05-08  Sihui Liu  <sihui_liu@apple.com>
1753
1754         [WKHTTPCookieStore getAllCookies] returns inconsistent creation time
1755         https://bugs.webkit.org/show_bug.cgi?id=185041
1756         <rdar://problem/34684214>
1757
1758         Reviewed by Geoffrey Garen.
1759
1760         Set creationtime property when creating Cookie object to keep consistency after conversion.
1761
1762         New API test: WebKit.WKHTTPCookieStoreCreationTime.
1763
1764         * platform/network/cocoa/CookieCocoa.mm:
1765         (WebCore::Cookie::operator NSHTTPCookie * const):
1766
1767 2018-05-08  Eric Carlson  <eric.carlson@apple.com>
1768
1769         Text track cue logging should include cue text
1770         https://bugs.webkit.org/show_bug.cgi?id=185353
1771         <rdar://problem/40003565>
1772
1773         Reviewed by Brent Fulgham.
1774
1775         No new tests, tested manually.
1776
1777         * html/track/VTTCue.cpp:
1778         (WebCore::VTTCue::toJSON const):
1779         * platform/graphics/InbandTextTrackPrivateClient.h:
1780         (WebCore::GenericCueData::toJSONString const):
1781         * platform/graphics/iso/ISOVTTCue.cpp:
1782         (WebCore::ISOWebVTTCue::toJSONString const):
1783
1784 2018-05-08  Sam Weinig  <sam@webkit.org>
1785
1786         More cleanup of XMLHttpRequestUpload
1787         https://bugs.webkit.org/show_bug.cgi?id=185409
1788
1789         Reviewed by Alex Christensen.
1790
1791         - Remove unneeded #includes
1792         - Rename m_xmlHttpRequest to m_request
1793         - Make some overloaded some methods private, and mark them as final rather
1794           than override.
1795
1796         * xml/XMLHttpRequestUpload.cpp:
1797         (WebCore::XMLHttpRequestUpload::XMLHttpRequestUpload):
1798         * xml/XMLHttpRequestUpload.h:
1799
1800 2018-05-08  Zalan Bujtas  <zalan@apple.com>
1801
1802         [LFC] Start using BlockMarginCollapse
1803         https://bugs.webkit.org/show_bug.cgi?id=185424
1804
1805         Reviewed by Antti Koivisto.
1806
1807         BlockMarginCollapse could be all static.
1808
1809         * layout/blockformatting/BlockFormattingContext.cpp:
1810         (WebCore::Layout::BlockFormattingContext::marginTop const):
1811         (WebCore::Layout::BlockFormattingContext::marginBottom const):
1812         * layout/blockformatting/BlockMarginCollapse.cpp:
1813         (WebCore::Layout::isMarginTopCollapsedWithSibling):
1814         (WebCore::Layout::isMarginBottomCollapsedWithSibling):
1815         (WebCore::Layout::isMarginTopCollapsedWithParent):
1816         (WebCore::Layout::isMarginBottomCollapsedWithParent):
1817         (WebCore::Layout::collapsedMarginTopFromFirstChild):
1818         (WebCore::Layout::collapsedMarginBottomFromLastChild):
1819         (WebCore::Layout::nonCollapsedMarginTop):
1820         (WebCore::Layout::nonCollapsedMarginBottom):
1821         (WebCore::Layout::BlockMarginCollapse::marginTop):
1822         (WebCore::Layout::BlockMarginCollapse::marginBottom):
1823         (WebCore::Layout::BlockMarginCollapse::BlockMarginCollapse): Deleted.
1824         (WebCore::Layout::BlockMarginCollapse::marginTop const): Deleted.
1825         (WebCore::Layout::BlockMarginCollapse::marginBottom const): Deleted.
1826         (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithSibling const): Deleted.
1827         (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithSibling const): Deleted.
1828         (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithParent const): Deleted.
1829         (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithParent const): Deleted.
1830         (WebCore::Layout::BlockMarginCollapse::nonCollapsedMarginTop const): Deleted.
1831         (WebCore::Layout::BlockMarginCollapse::nonCollapsedMarginBottom const): Deleted.
1832         (WebCore::Layout::BlockMarginCollapse::collapsedMarginTopFromFirstChild const): Deleted.
1833         (WebCore::Layout::BlockMarginCollapse::collapsedMarginBottomFromLastChild const): Deleted.
1834         (WebCore::Layout::BlockMarginCollapse::hasAdjoiningMarginTopAndBottom const): Deleted.
1835         * layout/blockformatting/BlockMarginCollapse.h:
1836
1837 2018-05-08  Youenn Fablet  <youenn@apple.com>
1838
1839         Allow WebResourceLoader to cancel a load served from a service worker
1840         https://bugs.webkit.org/show_bug.cgi?id=185274
1841
1842         Reviewed by Chris Dumez.
1843
1844         Add support for cancelling a fetch from WebProcess to service worker process.
1845         Use FetchIdentifier instead of uint64_t.
1846
1847         * Modules/fetch/FetchIdentifier.h: Added.
1848         * WebCore.xcodeproj/project.pbxproj:
1849         * workers/service/context/ServiceWorkerFetch.h:
1850         * workers/service/context/ServiceWorkerThreadProxy.cpp:
1851         (WebCore::ServiceWorkerThreadProxy::startFetch):
1852         (WebCore::ServiceWorkerThreadProxy::cancelFetch):
1853         * workers/service/context/ServiceWorkerThreadProxy.h:
1854
1855 2018-05-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
1856
1857         feTurbulence is not rendered correctly on Retina display
1858         https://bugs.webkit.org/show_bug.cgi?id=183798
1859
1860         Reviewed by Simon Fraser.
1861
1862         On 2x display the feTurbulence filter creates a scaled ImageBuffer but
1863         processes only the unscaled size. This is a remaining work of r168577 and
1864         is very similar to what was done for the feMorphology filter in r188271.
1865
1866         Test: fast/hidpi/filters-turbulence.html
1867
1868         * platform/graphics/filters/FETurbulence.cpp:
1869         (WebCore::FETurbulence::fillRegion const):
1870         (WebCore::FETurbulence::platformApplySoftware):
1871
1872 2018-05-07  Zalan Bujtas  <zalan@apple.com>
1873
1874         [LFC] Add FormattingContext::layoutOutOfFlowDescendants implementation
1875         https://bugs.webkit.org/show_bug.cgi?id=185377
1876
1877         Reviewed by Antti Koivisto.
1878
1879         Also, remove FormattingContext's m_layoutContext member and pass it in to ::layout() instead.
1880         In theory LayoutContext is needed only during ::layout() call. 
1881
1882         * layout/FormattingContext.cpp:
1883         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
1884         * layout/FormattingContext.h:
1885         (WebCore::Layout::FormattingContext::layoutContext const):
1886         * layout/LayoutContext.cpp:
1887         (WebCore::Layout::LayoutContext::updateLayout):
1888         * layout/blockformatting/BlockFormattingContext.cpp:
1889         (WebCore::Layout::BlockFormattingContext::layout const):
1890         * layout/blockformatting/BlockFormattingContext.h:
1891         * layout/inlineformatting/InlineFormattingContext.cpp:
1892         (WebCore::Layout::InlineFormattingContext::layout const):
1893         * layout/inlineformatting/InlineFormattingContext.h:
1894
1895 2018-05-07  Daniel Bates  <dabates@apple.com>
1896
1897         Check X-Frame-Options and CSP frame-ancestors in network process
1898         https://bugs.webkit.org/show_bug.cgi?id=185410
1899         <rdar://problem/37733934>
1900
1901         Reviewed by Ryosuke Niwa.
1902
1903         * WebCore.xcodeproj/project.pbxproj: Make PingLoader.h a private header so that we can include it in WebKit.
1904         * loader/DocumentLoader.cpp:
1905         (WebCore::DocumentLoader::responseReceived): Only check CSP frame-ancestors and X-Frame-Options here if
1906         we are not checking them in the NetworkProcess and HTTP response access is restricted. I code is otherwise kept
1907         unchanged. There may be opportunities to clean this code up more and share more of it. We should look into this
1908         in subsequent bugs.
1909         * loader/DocumentLoader.h: Change visibility of stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() from
1910         private to public and export it so that we can call it from the WebKit.
1911         * loader/PingLoader.h:
1912         * page/Settings.yaml: Add a new setting called networkProcessCSPFrameAncestorsCheckingEnabled (defaults: false)
1913         and is hardcoded in WebPage.cpp to be enabled. This setting is used to determine if we will be using the NetworkProcess.
1914         Ideally we wouldn't have this setting and just key off RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess().
1915         However RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess() is always enabled in WebKit Legacy
1916         at the time of writing (why?). And, strangely, RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess()
1917         is conditionally enabled in WebKit. For now, we add a new setting, networkProcessCSPFrameAncestorsCheckingEnabled,
1918         to determine if CSP checking should be performed in NetworkProcess. For checking to actually happen in NetworkProcess
1919         and not in DocumentLoader::responseReceived() RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess()
1920         will also need to be enabled.
1921         * page/csp/ContentSecurityPolicy.cpp:
1922         (WebCore::ContentSecurityPolicy::allowFrameAncestors const): Added a variant that takes a vector of ancestor origins.
1923         * page/csp/ContentSecurityPolicy.h:
1924         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
1925         (WebCore::checkFrameAncestors): Ditto.
1926         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForFrameAncestorOrigins const): Ditto.
1927         * page/csp/ContentSecurityPolicyDirectiveList.h: Export constructor so that we can invoke it from NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions().
1928         * page/csp/ContentSecurityPolicyResponseHeaders.h:
1929         * platform/network/HTTPParsers.h: Export XFrameOptionsDisposition() so that we can use in WebKit.
1930
1931 2018-05-07  Daniel Bates  <dabates@apple.com>
1932
1933         Abstract logic to log console messages and send CSP violation reports into a client
1934         https://bugs.webkit.org/show_bug.cgi?id=185393
1935         <rdar://problem/40036053>
1936
1937         Reviewed by Brent Fulgham.
1938
1939         First pass at adding infrastructure to supporting CSP reporting from NetworkProcess and workers.
1940         Replaces the existing ContentSecurityPolicy constructor that takes a Frame with one that
1941         takes a ContentSecurityPolicyClient to delegate to for logging and sending reports. We will look
1942         to remove ContentSecurityPolicy constructor that takes a ScriptExecutionContext in a follow up.
1943
1944         Standardize on instantiating a ContentSecurityPolicy with the full URL to resource that it protects
1945         instead of taking only the SecurityOrigin of this URL. By taking the full URL the ContentSecurityPolicy
1946         object is now capable of resolving a relative report URL without needing a Document/ScriptExecutionContext.
1947
1948         We are underutilizing the CSPInfo struct and ContentSecurityPolicyClient::willSendCSPViolationReport()
1949         delegate callback in this patch. We will make use of this functionality in a subsequent patch to
1950         support collecting script state (e.g. source line number) when reporting CSP violations in worker
1951         threads. We also no longer go through the unnecessary motions to try to collect script state for a
1952         frame-ancestors violation (since DocumentLoader extends ContentSecurityPolicyClient and does not
1953         implement ContentSecurityPolicyClient::willSendCSPViolationReport()). The frame-ancestors directive
1954         is checked before a document is parsed and executes script; => there will never be any script state
1955         to collect; => it is not necessary to try to collect it as we currently do.
1956
1957         * Sources.txt: Add file ContentSecurityPolicyClient.cpp. See the remarks for ContentSecurityPolicyClient.cpp
1958         below on why we have this file.
1959         * WebCore.xcodeproj/project.pbxproj: Add files ContentSecurityPolicyClient.{h, cpp}.
1960         * dom/Document.cpp:
1961         (WebCore::Document::initSecurityContext): Pass the URL of the protected document.
1962         * loader/DocumentLoader.cpp:
1963         (WebCore::DocumentLoader::responseReceived): Ditto.
1964         (WebCore::DocumentLoader::addConsoleMessage): Added.
1965         (WebCore::DocumentLoader::sendCSPViolationReport): Added.
1966         (WebCore::DocumentLoader::dispatchSecurityPolicyViolationEvent): Added.
1967         * loader/DocumentLoader.h:
1968         * loader/FrameLoaderClient.h: Fix typo in comment.
1969         * loader/WorkerThreadableLoader.cpp:
1970         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge): Pass the URL of the worker script.
1971         * page/csp/ContentSecurityPolicy.cpp:
1972         (WebCore::ContentSecurityPolicy::ContentSecurityPolicy): Added overload that takes a URL&& and an optional
1973         ContentSecurityPolicyClient*.
1974         (WebCore::ContentSecurityPolicy::deprecatedURLForReporting const): Extracted and simplified stripURLForUseInReport()
1975         into this member function.
1976         (WebCore::ContentSecurityPolicy::reportViolation const): Modified to make use of the client, if we have
1977         one and removed code for handling a ContentSecurityPolicy that was instantiated with a Frame.
1978         (WebCore::ContentSecurityPolicy::logToConsole const): Ditto.
1979         (WebCore::stripURLForUseInReport): Deleted; incorporated into ContentSecurityPolicy::deprecatedURLForReporting().
1980         * page/csp/ContentSecurityPolicy.h:
1981         * page/csp/ContentSecurityPolicyClient.cpp: Added. This file exists so that we can define the virtual
1982         destructor out-of-line and export this abstract class so as to avoid the need for the vtable to be
1983         defined in the translation unit of each derived class.
1984         * page/csp/ContentSecurityPolicyClient.h: Added.
1985         * page/csp/ContentSecurityPolicySource.cpp:
1986         (WebCore::ContentSecurityPolicySource::operator SecurityOriginData const): Added.
1987         * page/csp/ContentSecurityPolicySource.h:
1988         * workers/WorkerGlobalScope.cpp:
1989         (WebCore::WorkerGlobalScope::WorkerGlobalScope): Instantiate the ContentSecurityPolicy object with the
1990         URL of the worker script.
1991
1992 2018-05-07  Simon Fraser  <simon.fraser@apple.com>
1993
1994         CSS filters which reference SVG filters fail to respect the "color-interpolation-filters" of the filter
1995         https://bugs.webkit.org/show_bug.cgi?id=185343
1996
1997         Reviewed by Dean Jackson.
1998
1999         Test: css3/filters/color-interpolation-filters.html
2000         
2001         When applying CSS reference filters, apply the value of "color-interpolation-filters" for the
2002         referenced filter effect element, just as we do for SVG filters.
2003
2004         * rendering/FilterEffectRenderer.cpp:
2005         (WebCore::FilterEffectRenderer::buildReferenceFilter):
2006
2007 2018-05-07  Daniel Bates  <dabates@apple.com>
2008
2009         CSP status-code incorrect for document blocked due to violation of its frame-ancestors directive
2010         https://bugs.webkit.org/show_bug.cgi?id=185366
2011         <rdar://problem/40035116>
2012
2013         Reviewed by Brent Fulgham.
2014
2015         Fixes an issue where the status-code in the sent CSP report for an HTTP document blocked because
2016         its frame-ancestors directive was violated would be the status code of the previously loaded
2017         document in the frame. If the previously loaded document was about:blank then this would be 0.
2018
2019         Currently whenever we send a CSP report we ask the document's loader (Document::loader()) for the
2020         HTTP status code for the last response. Document::loader() returns the loader for the last committed
2021         document its frame. For a frame-ancestors violation, a CSP report is sent before the document
2022         that had the frame-ancestors directive has been committed and after it has been associate with a frame.
2023         As a result we are in are in a transient transition state for the frame and hence the last response
2024         for new document's loader (Document::loader()) is actually the last response of the previously loaded
2025         document in the frame. Instead we need to take care to tell CSP about the HTTP status code for the
2026         response associated with the document the CSP came from.
2027
2028         * dom/Document.cpp:
2029         (WebCore::Document::processHttpEquiv):
2030         (WebCore::Document::initSecurityContext):
2031         Pass the HTTP status code to CSP.
2032
2033         * page/csp/ContentSecurityPolicy.cpp:
2034         (WebCore::ContentSecurityPolicy::copyStateFrom):
2035         (WebCore::ContentSecurityPolicy::responseHeaders const):
2036         (WebCore::ContentSecurityPolicy::didReceiveHeaders):
2037         (WebCore::ContentSecurityPolicy::didReceiveHeader):
2038         (WebCore::ContentSecurityPolicy::reportViolation const):
2039         * page/csp/ContentSecurityPolicy.h:
2040         Modify existing functions to take the HTTP status code, store it in a instance variable,
2041         and reference this variable when reporting a violation.
2042
2043         * page/csp/ContentSecurityPolicyResponseHeaders.cpp:
2044         (WebCore::ContentSecurityPolicyResponseHeaders::ContentSecurityPolicyResponseHeaders):
2045         (WebCore::ContentSecurityPolicyResponseHeaders::isolatedCopy const):
2046         * page/csp/ContentSecurityPolicyResponseHeaders.h:
2047         (WebCore::ContentSecurityPolicyResponseHeaders::encode const):
2048         (WebCore::ContentSecurityPolicyResponseHeaders::decode):
2049         Store the HTTP status code along with the response headers.
2050
2051 2018-05-07  Daniel Bates  <dabates@apple.com>
2052
2053         CSP referrer incorrect for document blocked due to violation of its frame-ancestors directive
2054         https://bugs.webkit.org/show_bug.cgi?id=185380
2055
2056         Reviewed by Brent Fulgham.
2057
2058         Similar to <https://bugs.webkit.org/show_bug.cgi?id=185366>, fixes an issue where the referrer
2059         in the sent CSP report for an HTTP document blocked because its frame-ancestors directive was
2060         violated would be the referrer of the previously loaded document in the frame.
2061
2062         Currently whenever we send a CSP report we ask the document's loader (Document::loader()) for
2063         the referrer for the last request. Document::loader() returns the loader for the last committed
2064         document in its frame. For a frame-ancestors violation, a CSP report is sent before the document
2065         that had the frame-ancestors directive has been committed and after it has been associate with a
2066         frame. As a result we are in a transient transition state for the frame and hence the last request
2067         for the new document's loader (Document::loader()) is actually the last request of the previously
2068         loaded document in the frame. Instead we need to take care to tell CSP about the referrer for the
2069         request associated with the document the CSP came from.
2070
2071         * loader/DocumentLoader.cpp:
2072         (WebCore::DocumentLoader::responseReceived):
2073
2074 2018-05-07  Brent Fulgham  <bfulgham@apple.com>
2075
2076         Add experimental feature to prompt for Storage Access API use
2077         https://bugs.webkit.org/show_bug.cgi?id=185335
2078         <rdar://problem/39994649>
2079
2080         Reviewed by Alex Christensen and Youenn Fablet.
2081
2082         Create a new experimental feature that gates the ability of WebKit clients to prompt the user when
2083         Storage Access API is invoked.
2084
2085         Currently this feature doesn't have any user-visible impact.
2086
2087         * page/RuntimeEnabledFeatures.h:
2088         (WebCore::RuntimeEnabledFeatures::setStorageAccessPromptsEnabled):
2089         (WebCore::RuntimeEnabledFeatures::storageAccessPromptsEnabled const):
2090         * testing/InternalSettings.cpp:
2091         (WebCore::InternalSettings::Backup::Backup):
2092         (WebCore::InternalSettings::Backup::restoreTo):
2093         (WebCore::InternalSettings::setStorageAccessPromptsEnabled):
2094         * testing/InternalSettings.h:
2095         * testing/InternalSettings.idl:
2096
2097 2018-05-07  Chris Dumez  <cdumez@apple.com>
2098
2099         Stop using an iframe's id as fallback if its name attribute is not set
2100         https://bugs.webkit.org/show_bug.cgi?id=11388
2101
2102         Reviewed by Geoff Garen.
2103
2104         WebKit had logic to use an iframe's id as fallback name when its name
2105         content attribute is not set. This behavior was not standard and did not
2106         match other browsers:
2107         - https://html.spec.whatwg.org/#attr-iframe-name
2108
2109         Gecko / Trident never behaved this way. Blink was aligned with us until
2110         they started to match the specification in:
2111         - https://bugs.chromium.org/p/chromium/issues/detail?id=347169
2112
2113         This WebKit quirk was causing some Web-compatibility issues because it
2114         would affect the behavior of Window's name property getter when trying
2115         to look up an iframe by id. Because of Window's named property getter
2116         behavior [1], we would return the frame's contentWindow instead of the
2117         iframe element itself.
2118
2119         [1] https://html.spec.whatwg.org/multipage/window-object.html#named-access-on-the-window-object
2120
2121         Test: fast/dom/Window/named-getter-frame-id.html
2122
2123         * html/HTMLFrameElementBase.cpp:
2124         (WebCore::HTMLFrameElementBase::openURL):
2125         (WebCore::HTMLFrameElementBase::parseAttribute):
2126         (WebCore::HTMLFrameElementBase::didFinishInsertingNode):
2127         * html/HTMLFrameElementBase.h:
2128
2129 2018-05-07  Chris Dumez  <cdumez@apple.com>
2130
2131         ASSERT(!childItemWithTarget(child->target())) is hit in HistoryItem::addChildItem()
2132         https://bugs.webkit.org/show_bug.cgi?id=185322
2133
2134         Reviewed by Geoff Garen.
2135
2136         We generate unique names for Frame to be used in HistoryItem. Those names not only
2137         need to be unique, they also need to be repeatable to avoid layout tests flakiness
2138         and for things like restoring form state from a HistoryItem.
2139
2140         The previously generated frame names were relying on the Frame's index among a
2141         parent Frame's children. The issue was that we could end up with duplicate names
2142         because one could insert a Frame *before* an existing one. This is because the code
2143         would not take care of updating existing Frames' unique name on frame tree mutation.
2144
2145         Updating frame tree names on mutation would be inefficient and is also not necessary.
2146         The approach chosen in this patch is to stop using the Frame's index and instead rely
2147         on an increasing counter stored on the top-frame's FrameTree. To make the names
2148         repeatable, we reset the counter on page navigation.
2149
2150         * page/Frame.cpp:
2151         (WebCore::Frame::setDocument):
2152         * page/FrameTree.cpp:
2153         (WebCore::FrameTree::uniqueChildName const):
2154         (WebCore::FrameTree::generateUniqueName const):
2155         * page/FrameTree.h:
2156         (WebCore::FrameTree::resetFrameIdentifiers):
2157
2158 2018-05-07  Yacine Bandou  <yacine.bandou_ext@softathome.com>
2159
2160         [EME][GStreamer] Fix wrong subsample parsing on r227067
2161         https://bugs.webkit.org/show_bug.cgi?id=185382
2162
2163         Reviewed by Philippe Normand.
2164
2165         The initialization of sampleIndex should be moved outside of the loop.
2166         Without this patch we will have a bad log and the check of the subsample
2167         count will be useless.
2168
2169         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
2170         (webKitMediaClearKeyDecryptorDecrypt):
2171
2172 2018-05-07  Daniel Bates  <dabates@apple.com>
2173
2174         CSP should be passed the referrer
2175         https://bugs.webkit.org/show_bug.cgi?id=185367
2176
2177         Reviewed by Per Arne Vollan.
2178
2179         As a step towards formalizing a CSP delegate object and removing the dependencies
2180         on ScriptExecutionContext and Frame, we should pass the document's referrer directly
2181         instead of indirectly obtaining it from the ScriptExecutionContext or Frame used
2182         to instantiate the ContentSecurityPolicy object.
2183
2184         * dom/Document.cpp:
2185         (WebCore::Document::processHttpEquiv): Pass the document's referrer.
2186         (WebCore::Document::initSecurityContext): Ditto.
2187         (WebCore::Document::applyQuickLookSandbox): Ditto.
2188         * loader/DocumentLoader.cpp:
2189         (WebCore::DocumentLoader::responseReceived): Ditto.
2190         * loader/FrameLoader.cpp:
2191         (WebCore::FrameLoader::didBeginDocument): Ditto.
2192         * page/csp/ContentSecurityPolicy.cpp:
2193         (WebCore::ContentSecurityPolicy::copyStateFrom): We pass a null string for the referrer
2194         to didReceiveHeader() as a placeholder since it requires the referrer be given to it. We
2195         fix up the referrer (m_referrer) after copying all the policy headers.
2196         (WebCore::ContentSecurityPolicy::didReceiveHeaders): Ditto.
2197         (WebCore::ContentSecurityPolicy::didReceiveHeader): Modified to take a referrer and WTFMove()s
2198         it into an instance variable (m_referrer).
2199         (WebCore::ContentSecurityPolicy::reportViolation const): Modified to use the stored referrer.
2200         * page/csp/ContentSecurityPolicy.h:
2201         * workers/WorkerGlobalScope.cpp:
2202         (WebCore::WorkerGlobalScope::applyContentSecurityPolicyResponseHeaders): Pass a null string
2203         for the referrer as a worker does not have a referrer.
2204
2205 2018-05-07  Daniel Bates  <dabates@apple.com>
2206
2207         CSP should only notify Inspector to pause the debugger on the first policy to violate a directive
2208         https://bugs.webkit.org/show_bug.cgi?id=185364
2209
2210         Reviewed by Brent Fulgham.
2211
2212         Notify Web Inspector that a script was blocked on the first enforced CSP policy that it
2213         violates.
2214
2215         A page can have more than one enforced Content Security Policy. Currently for inline
2216         scripts, inline event handlers, JavaScript URLs, and eval() that are blocked by CSP
2217         we notify Web Inspector that it was blocked for each CSP policy that blocked it. When
2218         Web Inspector is notified it pauses script execution. It does not seem very meaningful
2219         to pause script execution on the same script for each CSP policy that blocked it.
2220         Therefore, only tell Web Inspector that a script was blocked for the first enforced CSP
2221         policy that blocked it.
2222
2223         * page/csp/ContentSecurityPolicy.cpp:
2224         (WebCore::ContentSecurityPolicy::allowJavaScriptURLs const):
2225         (WebCore::ContentSecurityPolicy::allowInlineEventHandlers const):
2226         (WebCore::ContentSecurityPolicy::allowInlineScript const):
2227         (WebCore::ContentSecurityPolicy::allowEval const):
2228
2229 2018-05-07  Daniel Bates  <dabates@apple.com>
2230
2231         Substitute CrossOriginPreflightResultCache::clear() for CrossOriginPreflightResultCache::empty()
2232         https://bugs.webkit.org/show_bug.cgi?id=185170
2233
2234         Reviewed by Per Arne Vollan.
2235
2236         Rename CrossOriginPreflightResultCache::empty() to CrossOriginPreflightResultCache::clear() make
2237         it consistent with the terminology we use in WebKit to signify a function that clears a collection.
2238         A member function named "empty" is expected to return an instance of a class in its "empty state".
2239         For example, StringImpl::empty() returns a StringImpl instance that represents the empty string.
2240         However CrossOriginPreflightResultCache::empty() clears out the cache in-place. We should rename
2241         this function to better describe its purpose.
2242
2243         * loader/CrossOriginPreflightResultCache.cpp:
2244         (WebCore::CrossOriginPreflightResultCache::clear):
2245         (WebCore::CrossOriginPreflightResultCache::empty): Deleted.
2246         * loader/CrossOriginPreflightResultCache.h:
2247
2248 2018-05-06  Dean Jackson  <dino@apple.com>
2249
2250         WebGL: Reset simulated values after validation fails
2251         https://bugs.webkit.org/show_bug.cgi?id=185363
2252         <rdar://problem/39733417>
2253
2254         Reviewed by Anders Carlsson.
2255
2256         While fixing a previous bug, I forgot to reset some values
2257         when validation fails. This caused a bug where a subsequent
2258         invalid call might use those values and escape detection.
2259
2260         Test: fast/canvas/webgl/index-validation-with-subsequent-draws.html
2261
2262         * html/canvas/WebGLRenderingContextBase.cpp:
2263         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): Reset the
2264         sizes when validation fails.
2265         * html/canvas/WebGLRenderingContextBase.h:
2266
2267 2018-05-07  Ms2ger  <Ms2ger@igalia.com>
2268
2269         Support negative sw/sh values in createImageBitmap().
2270         https://bugs.webkit.org/show_bug.cgi?id=184449
2271
2272         Reviewed by Dean Jackson.
2273
2274         Tests: LayoutTests/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage.html
2275                LayoutTests/http/wpt/2dcontext/imagebitmap/createImageBitmap.html
2276
2277         * html/ImageBitmap.cpp:
2278         (WebCore::ImageBitmap::createPromise): handle negative values per spec.
2279
2280 2018-05-07  Brian Burg  <bburg@apple.com>
2281
2282         Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected
2283         https://bugs.webkit.org/show_bug.cgi?id=184861
2284         <rdar://problem/39153768>
2285
2286         Reviewed by Timothy Hatcher.
2287
2288         Notify the client of the current connection count whenever a frontend connects or disconnects.
2289
2290         Covered by new API test.
2291
2292         * inspector/InspectorClient.h:
2293         (WebCore::InspectorClient::frontendCountChanged):
2294         * inspector/InspectorController.cpp:
2295         (WebCore::InspectorController::connectFrontend):
2296         (WebCore::InspectorController::disconnectFrontend):
2297         (WebCore::InspectorController::disconnectAllFrontends):
2298         * inspector/InspectorController.h:
2299
2300 2018-05-07  Eric Carlson  <eric.carlson@apple.com>
2301
2302         Text track cue logging should include cue text
2303         https://bugs.webkit.org/show_bug.cgi?id=185353
2304         <rdar://problem/40003565>
2305
2306         Reviewed by Youenn Fablet.
2307
2308         No new tests, tested manually.
2309
2310         * html/track/VTTCue.cpp:
2311         (WebCore::VTTCue::toJSONString const): Use toJSON.
2312         (WebCore::VTTCue::toJSON const): New.
2313         * html/track/VTTCue.h:
2314
2315         * platform/graphics/InbandTextTrackPrivateClient.h:
2316         (WebCore::GenericCueData::toJSONString const): Log m_content.
2317
2318         * platform/graphics/iso/ISOVTTCue.cpp:
2319         (WebCore::ISOWebVTTCue::toJSONString const): Log m_cueText.
2320
2321 2018-05-06  Zalan Bujtas  <zalan@apple.com>
2322
2323         [LFC] Add assertions for stale Display::Box geometry
2324         https://bugs.webkit.org/show_bug.cgi?id=185357
2325
2326         Reviewed by Antti Koivisto.
2327
2328         Ensure that we don't access stale geometry of other boxes during layout.
2329         For example, in order to layout a block child we need the containing block's content box top/left and width (but not the height)
2330
2331         * layout/displaytree/DisplayBox.h:
2332         (WebCore::Display::Box::invalidateTop):
2333         (WebCore::Display::Box::invalidateLeft):
2334         (WebCore::Display::Box::invalidateWidth):
2335         (WebCore::Display::Box::invalidateHeight):
2336         (WebCore::Display::Box::hasValidPosition const):
2337         (WebCore::Display::Box::hasValidSize const):
2338         (WebCore::Display::Box::hasValidGeometry const):
2339         (WebCore::Display::Box::invalidatePosition):
2340         (WebCore::Display::Box::invalidateSize):
2341         (WebCore::Display::Box::setHasValidPosition):
2342         (WebCore::Display::Box::setHasValidSize):
2343         (WebCore::Display::Box::setHasValidGeometry):
2344         (WebCore::Display::Box::rect const):
2345         (WebCore::Display::Box::top const):
2346         (WebCore::Display::Box::left const):
2347         (WebCore::Display::Box::bottom const):
2348         (WebCore::Display::Box::right const):
2349         (WebCore::Display::Box::topLeft const):
2350         (WebCore::Display::Box::bottomRight const):
2351         (WebCore::Display::Box::size const):
2352         (WebCore::Display::Box::width const):
2353         (WebCore::Display::Box::height const):
2354         (WebCore::Display::Box::setRect):
2355         (WebCore::Display::Box::setTopLeft):
2356         (WebCore::Display::Box::setTop):
2357         (WebCore::Display::Box::setLeft):
2358         (WebCore::Display::Box::setSize):
2359         (WebCore::Display::Box::setWidth):
2360         (WebCore::Display::Box::setHeight):
2361
2362 2018-05-06  Zalan Bujtas  <zalan@apple.com>
2363
2364         [LFC] Add BlockFormattingContext::computeStaticPosition
2365         https://bugs.webkit.org/show_bug.cgi?id=185352
2366
2367         Reviewed by Antti Koivisto.
2368
2369         This is the core logic for positioning inflow boxes in a block formatting context (very naive though).
2370
2371         * layout/blockformatting/BlockFormattingContext.cpp:
2372         (WebCore::Layout::BlockFormattingContext::computeStaticPosition const):
2373         * layout/displaytree/DisplayBox.h:
2374
2375 2018-05-05  Sam Weinig  <sam@webkit.org>
2376
2377         Cleanup XMLHttpRequestUpload a little
2378         https://bugs.webkit.org/show_bug.cgi?id=185344
2379
2380         Reviewed by Yusuke Suzuki.
2381
2382         * bindings/js/JSXMLHttpRequestCustom.cpp:
2383         (WebCore::JSXMLHttpRequest::visitAdditionalChildren):
2384         Use auto to reduce redundancy.
2385
2386         * xml/XMLHttpRequest.cpp:
2387         (WebCore::XMLHttpRequest::upload):
2388         * xml/XMLHttpRequest.h:
2389         Switch upload() to return a reference.
2390         
2391         * xml/XMLHttpRequestUpload.cpp:
2392         (WebCore::XMLHttpRequestUpload::XMLHttpRequestUpload):
2393         (WebCore::XMLHttpRequestUpload::dispatchProgressEvent):
2394         * xml/XMLHttpRequestUpload.h:
2395         Cleanup formatting, modernize and switch XMLHttpRequest member from a pointer
2396         to a reference.
2397
2398 2018-05-05  Dean Jackson  <dino@apple.com>
2399
2400         Draw a drop-shadow behind the system preview badge
2401         https://bugs.webkit.org/show_bug.cgi?id=185356
2402         <rdar://problem/40004936>
2403
2404         Reviewed by Wenson Hsieh.
2405
2406         Draw a very subtle drop-shadow under the system
2407         preview badge so that it is more visible on a pure
2408         white background.
2409
2410         I also moved some code around to make it more clear
2411         and improved comments.
2412
2413         * rendering/RenderThemeIOS.mm:
2414         (WebCore::RenderThemeIOS::paintSystemPreviewBadge):
2415
2416 2018-05-04  Wenson Hsieh  <wenson_hsieh@apple.com>
2417
2418         [iOS] Multiple links in Mail are dropped in a single line, and are difficult to tell apart
2419         https://bugs.webkit.org/show_bug.cgi?id=185289
2420         <rdar://problem/35756912>
2421
2422         Reviewed by Tim Horton and Darin Adler.
2423
2424         When inserting multiple URLs as individual items in a single drop, we currently separate each item with a space
2425         (see r217284). However, it still seems difficult to tell dropped links apart. This patch makes some slight
2426         tweaks to WebContentReader::readURL so that it inserts line breaks before dropped URLs, if the dropped URL isn't
2427         the first item to be inserted in the resulting document fragment.
2428
2429         Augments existing API tests in DataInteractionTests.
2430
2431         * editing/ios/WebContentReaderIOS.mm:
2432
2433         Additionally remove some extraneous header imports from this implementation file.
2434
2435         (WebCore::WebContentReader::readURL):
2436
2437 2018-05-02  Dean Jackson  <dino@apple.com>
2438
2439         Use IOSurfaces for CoreImage operations where possible
2440         https://bugs.webkit.org/show_bug.cgi?id=185230
2441         <rdar://problem/39926929>
2442
2443         Reviewed by Jon Lee.
2444
2445         On iOS hardware, we can use IOSurfaces as a rendering destination
2446         for CoreImage, which means we're keeping data on the GPU
2447         for rendering.
2448
2449         As a drive-by fix, I used a convenience method for Gaussian blurs.
2450
2451         * rendering/RenderThemeIOS.mm:
2452         (WebCore::RenderThemeIOS::paintSystemPreviewBadge):
2453
2454 2018-05-04  Tim Horton  <timothy_horton@apple.com>
2455
2456         Shift to a lower-level framework for simplifying URLs
2457         https://bugs.webkit.org/show_bug.cgi?id=185334
2458
2459         Reviewed by Dan Bernstein.
2460
2461         * Configurations/WebCore.xcconfig:
2462         * platform/mac/DragImageMac.mm:
2463         (WebCore::LinkImageLayout::LinkImageLayout):
2464
2465 2018-05-03  Ryosuke Niwa  <rniwa@webkit.org>
2466
2467         Release assert in ScriptController::canExecuteScripts via HTMLMediaElement::~HTMLMediaElement()
2468         https://bugs.webkit.org/show_bug.cgi?id=185288
2469
2470         Reviewed by Jer Noble.
2471
2472         The crash is caused by HTMLMediaElement::~HTMLMediaElement canceling the resource load via CachedResource
2473         which ends up calling FrameLoader::checkCompleted() and fire load event on the document synchronously.
2474         Speculatively fix the crash by scheduling the check instead.
2475
2476         In long term, ResourceLoader::cancel should never fire load event synchronously: webkit.org/b/185284.
2477
2478         Unfortunately, no new tests since I can't get MediaResource to get destructed at the right time.
2479
2480         * html/HTMLMediaElement.cpp:
2481         (WebCore::HTMLMediaElement::isRunningDestructor): Added to detect this specific case.
2482         (WebCore::HTMLMediaElementDestructorScope): Added.
2483         (WebCore::HTMLMediaElementDestructorScope::HTMLMediaElementDestructorScope): Added.
2484         (WebCore::HTMLMediaElementDestructorScope::~HTMLMediaElementDestructorScope): Added.
2485         (WebCore::HTMLMediaElement::~HTMLMediaElement): Instantiate HTMLMediaElement.
2486         * html/HTMLMediaElement.h:
2487         * loader/FrameLoader.cpp:
2488         (WebCore::FrameLoader::checkCompleted): Call scheduleCheckCompleted instead of synchronously calling
2489         checkCompleted if we're in the middle of destructing a HTMLMediaElement.
2490
2491 2018-05-04  Ryosuke Niwa  <rniwa@webkit.org>
2492
2493         Rename DocumentOrderedMap to TreeScopeOrderedMap
2494         https://bugs.webkit.org/show_bug.cgi?id=185290
2495
2496         Reviewed by Zalan Bujtas.
2497
2498         Renamed the class since it's almost always a mistake to use this class as a member variable of Document.
2499
2500         * Sources.txt:
2501         * WebCore.xcodeproj/project.pbxproj:
2502         * dom/MouseRelatedEvent.cpp: Include the forgotten DOMWindow.h. Unified build files bit us here.
2503         * dom/TreeScope.cpp:
2504         (WebCore::TreeScope::addElementById):
2505         (WebCore::TreeScope::addElementByName):
2506         (WebCore::TreeScope::addImageMap):
2507         (WebCore::TreeScope::addImageElementByUsemap):
2508         (WebCore::TreeScope::labelElementForId):
2509         * dom/TreeScope.h:
2510         * dom/TreeScopeOrderedMap.cpp: Renamed from DocumentOrderedMap.cpp
2511         * dom/TreeScopeOrderedMap.h: Renamed from DocumentOrderedMap.h
2512         * html/HTMLDocument.h:
2513
2514 2018-05-04  Don Olmstead  <don.olmstead@sony.com>
2515
2516         [Win][WebKit] Fix forwarding headers for Windows build
2517         https://bugs.webkit.org/show_bug.cgi?id=184412
2518
2519         Reviewed by Alex Christensen.
2520
2521         No new tests. No change in behavior.
2522
2523         * PlatformWin.cmake:
2524
2525 2018-05-04  Zalan Bujtas  <zalan@apple.com>
2526
2527         [Simple line layout] Add support for line layout box generation with multiple text renderers.
2528         https://bugs.webkit.org/show_bug.cgi?id=185276
2529
2530         Reviewed by Antti Koivisto.
2531
2532         Covered by existing tests.
2533
2534         * rendering/SimpleLineLayoutFunctions.cpp:
2535         (WebCore::SimpleLineLayout::canUseForLineBoxTree):
2536         (WebCore::SimpleLineLayout::generateLineBoxTree):
2537         * rendering/SimpleLineLayoutResolver.cpp:
2538         (WebCore::SimpleLineLayout::RunResolver::Run::renderer const):
2539         (WebCore::SimpleLineLayout::RunResolver::Run::localStart const):
2540         (WebCore::SimpleLineLayout::RunResolver::Run::localEnd const):
2541         * rendering/SimpleLineLayoutResolver.h:
2542
2543 2018-05-04  Timothy Hatcher  <timothy@apple.com>
2544
2545         Deprecate legacy WebView and friends
2546         https://bugs.webkit.org/show_bug.cgi?id=185279
2547         rdar://problem/33268700
2548
2549         Reviewed by Tim Horton.
2550
2551         * Configurations/WebCore.xcconfig:
2552         Added BUILDING_WEBKIT define to disable the deprecation macros.
2553         * bridge/objc/WebScriptObject.h:
2554         Added deprecation macros to WebScriptObject and WebUndefined.
2555         * platform/cocoa/WebKitAvailability.h:
2556         Added more macros and a way to disable deprecation warnings for
2557         WebKit build and in clients like Safari.
2558
2559 2018-05-04  Eric Carlson  <eric.carlson@apple.com>
2560
2561         Log media time range as JSON
2562         https://bugs.webkit.org/show_bug.cgi?id=185321
2563         <rdar://problem/39986746>
2564
2565         Reviewed by Youenn Fablet.
2566
2567         No new tests, tested manually.
2568
2569         * html/HTMLMediaElement.cpp:
2570         (WebCore::HTMLMediaElement::addPlayedRange): Log as time range.
2571         (WebCore::HTMLMediaElement::visibilityStateChanged): Cleanup.
2572
2573         * platform/graphics/MediaPlayer.h:
2574         (WTF::LogArgument<MediaTime>::toString):
2575         (WTF::LogArgument<MediaTimeRange>::toString):
2576
2577         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
2578         (WebCore::InbandTextTrackPrivateAVF::processAttributedStrings): Log error as time range.
2579
2580 2018-05-04  Zalan Bujtas  <zalan@apple.com>
2581
2582         Use the containing block to compute the pagination gap when the container is inline.
2583         https://bugs.webkit.org/show_bug.cgi?id=184724
2584         <rdar://problem/39521800>
2585
2586         Reviewed by Simon Fraser.
2587
2588         Test: fast/overflow/page-overflow-with-inline-body-crash.html
2589
2590         * page/FrameView.cpp:
2591         (WebCore::FrameView::applyPaginationToViewport):
2592
2593 2018-05-04  Tim Horton  <timothy_horton@apple.com>
2594
2595         Don't use GSFont* in minimal simulator mode
2596         https://bugs.webkit.org/show_bug.cgi?id=185320
2597         <rdar://problem/39734478>
2598
2599         Reviewed by Beth Dakin.
2600
2601         * page/cocoa/MemoryReleaseCocoa.mm:
2602         (WebCore::platformReleaseMemory):
2603
2604 2018-05-04  Chris Dumez  <cdumez@apple.com>
2605
2606         Unreviewed, rolling out r231331.
2607
2608         Caused a few tests to assert
2609
2610         Reverted changeset:
2611
2612         "Stop using an iframe's id as fallback if its name attribute
2613         is not set"
2614         https://bugs.webkit.org/show_bug.cgi?id=11388
2615         https://trac.webkit.org/changeset/231331
2616
2617 2018-05-04  Youenn Fablet  <youenn@apple.com>
2618
2619         Use more references in updateTracksOfType
2620         https://bugs.webkit.org/show_bug.cgi?id=185305
2621
2622         Reviewed by Eric Carlson.
2623
2624         No change of behavior.
2625
2626         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2627         (WebCore::updateTracksOfType):
2628         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks):
2629
2630 2018-05-04  Myles C. Maxfield  <mmaxfield@apple.com>
2631
2632         Text shaping in the simple path is flipped in the y direction
2633         https://bugs.webkit.org/show_bug.cgi?id=185062
2634         <rdar://problem/39778678>
2635
2636         Reviewed by Simon Fraser.
2637
2638         Shaping in our simple codepath occurs in an "increasing-y-goes-up" coordinate system, but our painting
2639         code uses an "increasing-y-goes-down" coordinate system. We weren't fixing up the coordinate systems
2640         because we never noticed. This is because the simple codepath is only designed for kerning and ligatures,
2641         neither of which move glyphs vertically in the common case.
2642
2643         Test: fast/text/vertical-displacement-simple-codepath.html
2644
2645         * platform/graphics/Font.cpp:
2646         (WebCore::Font::applyTransforms const):
2647         * platform/graphics/WidthIterator.cpp:
2648         (WebCore::WidthIterator::applyFontTransforms):
2649
2650 2018-05-04  Chris Nardi  <cnardi@chromium.org>
2651
2652         Serialize all URLs with double-quotes per CSSOM spec
2653         https://bugs.webkit.org/show_bug.cgi?id=184935
2654
2655         Reviewed by Antti Koivisto.
2656
2657         According to https://drafts.csswg.org/cssom/#serialize-a-url, all URLs should be serialized as strings,
2658         which means they should have double quotes around the text of the URL. Update our implementation to match
2659         this (and Firefox/Chrome). Also remove isCSSTokenizerURL() as this method is no longer needed.
2660
2661         Tests: Many LayoutTests updated to use double quotes.
2662
2663         * css/CSSMarkup.cpp:
2664         (WebCore::serializeString): Remove FIXME as this was already fixed in a previous patch.
2665         (WebCore::serializeURL): Remove FIXME and update implementation.
2666
2667 2018-05-04  Youenn Fablet  <youenn@apple.com>
2668
2669         LayoutTests/fast/mediastream/change-tracks-media-stream-being-played.html is crashing after r231304
2670         https://bugs.webkit.org/show_bug.cgi?id=185303
2671
2672         Reviewed by Eric Carlson.
2673
2674         We need to stop observing the audio track like we do for video track once we are no longer interested in it.
2675         Covered by test no longer crashing.
2676
2677         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2678         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks):
2679
2680 2018-05-04  Zalan Bujtas  <zalan@apple.com>
2681
2682         [LFC] Set the invalidation root as the result of style change.
2683         https://bugs.webkit.org/show_bug.cgi?id=185301
2684
2685         Reviewed by Antti Koivisto.
2686
2687         Compute/propagate the update type on the ancestor chain and return the invalidation root
2688         so that LayoutContext could use it as the entry point for the next layout frame.
2689
2690         * layout/LayoutContext.cpp:
2691         (WebCore::Layout::LayoutContext::updateLayout):
2692         (WebCore::Layout::LayoutContext::styleChanged):
2693         * layout/LayoutContext.h: order is not important.
2694         * layout/blockformatting/BlockInvalidation.cpp:
2695         (WebCore::Layout::invalidationStopsAtFormattingContextBoundary):
2696         (WebCore::Layout::computeUpdateType):
2697         (WebCore::Layout::computeUpdateTypeForAncestor):
2698         (WebCore::Layout::BlockInvalidation::invalidate):
2699         * layout/blockformatting/BlockInvalidation.h:
2700         * layout/inlineformatting/InlineInvalidation.cpp:
2701         (WebCore::Layout::InlineInvalidation::invalidate):
2702         * layout/inlineformatting/InlineInvalidation.h:
2703
2704 2018-05-04  Youenn Fablet  <youenn@apple.com>
2705
2706         PeerConnection should have its connectionState closed even if doing gathering
2707         https://bugs.webkit.org/show_bug.cgi?id=185267
2708
2709         Reviewed by Darin Adler.
2710
2711         Test: webrtc/addICECandidate-closed.html
2712
2713         In case m_iceConnectionState is closed, m_connectionState should also be set to closed
2714         and RTCPeerConnection should be closed so as to reject any other call.
2715
2716         * Modules/mediastream/RTCPeerConnection.cpp:
2717         (WebCore::RTCPeerConnection::close):
2718         (WebCore::RTCPeerConnection::updateConnectionState):
2719
2720 2018-05-04  Yacine Bandou  <yacine.bandou_ext@softathome.com>
2721
2722         [MSE][GStreamer] Delete properly the stream from the WebKitMediaSource
2723         https://bugs.webkit.org/show_bug.cgi?id=185242
2724
2725         Reviewed by Xabier Rodriguez-Calvar.
2726
2727         When the sourceBuffer is removed from mediasource, the appropriate stream is not
2728         properly deleted from WebKitMediaSource, because the appsrc and parser elements
2729         of the stream are not removed from the WebKitMediaSource bin.
2730
2731         This patch avoids the regression of r231089, see https://bugs.webkit.org/show_bug.cgi?id=185071
2732
2733         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
2734         (webKitMediaSrcFreeStream):
2735
2736 2018-05-04  Carlos Garcia Campos  <cgarcia@igalia.com>
2737
2738         [GTK] Epiphany (GNOME Web) says "Error downloading: Service Unavailable." when trying to download an image from discogs.com
2739         https://bugs.webkit.org/show_bug.cgi?id=174730
2740
2741         Reviewed by Michael Catanzaro.
2742
2743         Export ResourceRequestBase::hasHTTPHeaderField().
2744
2745         * platform/network/ResourceRequestBase.h:
2746
2747 2018-05-03  Yusuke Suzuki  <utatane.tea@gmail.com>
2748
2749         Use subprocess.call instead of os.system to handle path with spaces
2750         https://bugs.webkit.org/show_bug.cgi?id=185291
2751
2752         Reviewed by Darin Adler.
2753
2754         If gperf path includes spaces, these python scripts fail to execute gperf.
2755         We use subprocess module instead of os.system to invoke gperf.
2756
2757         * css/makeSelectorPseudoClassAndCompatibilityElementMap.py:
2758         * css/makeSelectorPseudoElementsMap.py:
2759         * platform/network/create-http-header-name-table:
2760
2761 2018-05-03  Yusuke Suzuki  <utatane.tea@gmail.com>
2762
2763         Unreviewed, attempt to fix WinCairo build failure
2764         https://bugs.webkit.org/show_bug.cgi?id=185218
2765
2766         * platform/text/win/LocaleWin.cpp:
2767         (WebCore::LocaleWin::getLocaleInfoString):
2768
2769 2018-05-03  Filip Pizlo  <fpizlo@apple.com>
2770
2771         Strings should not be allocated in a gigacage
2772         https://bugs.webkit.org/show_bug.cgi?id=185218
2773
2774         Reviewed by Saam Barati.
2775
2776         No new tests because no new behavior.
2777
2778         * Modules/indexeddb/server/IDBSerialization.cpp:
2779         (WebCore::decodeKey):
2780         * bindings/js/SerializedScriptValue.cpp:
2781         (WebCore::CloneDeserializer::readString):
2782         * html/canvas/CanvasRenderingContext2D.cpp:
2783         (WebCore::normalizeSpaces):
2784         * html/parser/HTMLTreeBuilder.cpp:
2785         (WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::takeRemainingWhitespace):
2786         * platform/URLParser.cpp:
2787         (WebCore::percentEncodeByte):
2788         (WebCore::serializeURLEncodedForm):
2789         (WebCore::URLParser::serialize):
2790         * platform/URLParser.h:
2791         * platform/graphics/FourCC.cpp:
2792         (WebCore::FourCC::toString const):
2793         * platform/graphics/ca/GraphicsLayerCA.cpp:
2794         (WebCore::GraphicsLayerCA::ReplicaState::cloneID const):
2795         * platform/text/LocaleICU.cpp:
2796         (WebCore::LocaleICU::decimalSymbol):
2797         (WebCore::LocaleICU::decimalTextAttribute):
2798         (WebCore::getDateFormatPattern):
2799         (WebCore::LocaleICU::createLabelVector):
2800         (WebCore::getFormatForSkeleton):
2801         * platform/win/FileSystemWin.cpp:
2802         (WebCore::FileSystem::getFinalPathName):
2803         (WebCore::FileSystem::pathByAppendingComponent):
2804         (WebCore::FileSystem::storageDirectory):
2805
2806 2018-05-02  Brent Fulgham  <bfulgham@apple.com>
2807
2808         Widgets should hold a WeakPtr to their parents
2809         https://bugs.webkit.org/show_bug.cgi?id=185239
2810         <rdar://problem/39741250>
2811
2812         Reviewed by Zalan Bujtas.
2813
2814         * platform/ScrollView.h:
2815         (WebCore::ScrollView::weakPtrFactory): Added.
2816         * platform/Widget.cpp:
2817         (WebCore::Widget::init): Don't perform an unnecessary assignment.
2818         (WebCore::Widget::setParent): Grab a WeakPtr to the parent ScrollView.
2819         * platform/Widget.h:
2820         (WebCore::Widget::parent const): Change type to a WeakPtr.
2821
2822 2018-05-03  Yusuke Suzuki  <utatane.tea@gmail.com>
2823
2824         Use pointer instead of std::optional<T&>
2825         https://bugs.webkit.org/show_bug.cgi?id=185186
2826
2827         Reviewed by Alex Christensen.
2828
2829         std::optional<T&> is not accepted in C++17 spec.
2830         In this patch, we replace it with T*, which is well-aligned to
2831         WebKit's convention.
2832
2833         * Modules/mediastream/RTCPeerConnection.cpp:
2834         (WebCore::iceServersFromConfiguration):
2835         (WebCore::RTCPeerConnection::initializeConfiguration):
2836         (WebCore::RTCPeerConnection::setConfiguration):
2837         * css/parser/CSSParser.cpp:
2838         (WebCore::CSSParser::parseSystemColor):
2839         * css/parser/CSSParser.h:
2840         * dom/DatasetDOMStringMap.cpp:
2841         (WebCore::DatasetDOMStringMap::item const):
2842         (WebCore::DatasetDOMStringMap::namedItem const):
2843         (WebCore:: const): Deleted.
2844         * dom/DatasetDOMStringMap.h:
2845         * dom/Element.cpp:
2846         (WebCore::Element::insertAdjacentHTML):
2847         * dom/Element.h:
2848         * html/canvas/CanvasStyle.cpp:
2849         (WebCore::parseColor):
2850         * inspector/DOMEditor.cpp:
2851         * platform/network/curl/CurlFormDataStream.cpp:
2852         (WebCore::CurlFormDataStream::getPostData):
2853         (): Deleted.
2854         * platform/network/curl/CurlFormDataStream.h:
2855         * platform/network/curl/CurlRequest.cpp:
2856         (WebCore::CurlRequest::setupPOST):
2857         * testing/MockCDMFactory.cpp:
2858         (WebCore::MockCDMFactory::keysForSessionWithID const):
2859         (WebCore::MockCDMInstance::updateLicense):
2860         (WebCore:: const): Deleted.
2861         * testing/MockCDMFactory.h:
2862
2863 2018-05-03  Chris Dumez  <cdumez@apple.com>
2864
2865         Stop using an iframe's id as fallback if its name attribute is not set
2866         https://bugs.webkit.org/show_bug.cgi?id=11388
2867
2868         Reviewed by Geoff Garen.
2869
2870         WebKit had logic to use an iframe's id as fallback name when its name
2871         content attribute is not set. This behavior was not standard and did not
2872         match other browsers:
2873         - https://html.spec.whatwg.org/#attr-iframe-name
2874
2875         Gecko / Trident never behaved this way. Blink was aligned with us until
2876         they started to match the specification in:
2877         - https://bugs.chromium.org/p/chromium/issues/detail?id=347169
2878
2879         This WebKit quirk was causing some Web-compatibility issues because it
2880         would affect the behavior of Window's name property getter when trying
2881         to look up an iframe by id. Because of Window's named property getter
2882         behavior [1], we would return the frame's contentWindow instead of the
2883         iframe element itself.
2884
2885         [1] https://html.spec.whatwg.org/multipage/window-object.html#named-access-on-the-window-object
2886
2887         Test: fast/dom/Window/named-getter-frame-id.html
2888
2889         * html/HTMLFrameElementBase.cpp:
2890         (WebCore::HTMLFrameElementBase::openURL):
2891         (WebCore::HTMLFrameElementBase::parseAttribute):
2892         (WebCore::HTMLFrameElementBase::didFinishInsertingNode):
2893         * html/HTMLFrameElementBase.h:
2894
2895 2018-05-03  Eric Carlson  <eric.carlson@apple.com>
2896
2897         [iOS] Internal text and audio tracks not in fullscreen menu
2898         https://bugs.webkit.org/show_bug.cgi?id=185268
2899         <rdar://problem/38673440>
2900
2901         Reviewed by Jer Noble.
2902
2903         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
2904         (WebCore::PlaybackSessionModelMediaElement::setMediaElement): 'addtrack' and 'removetrack'
2905         events are fired at the track lists, not the media element.
2906
2907 2018-05-03  Ryosuke Niwa  <rniwa@webkit.org>
2908
2909         Using image map inside a shadow tree results hits a release assert in DocumentOrderedMap::add
2910         https://bugs.webkit.org/show_bug.cgi?id=185238
2911
2912         Reviewed by Antti Koivisto.
2913
2914         The bug was caused by DocumentOrderedMap for the image elements with usemap being stored in Document
2915         even if those image elements were in a shadow tree. Fixed the bug by moving the map to TreeScope.
2916
2917         Test: fast/images/imagemap-in-nested-shadow-tree.html
2918               fast/images/imagemap-in-shadow-tree.html
2919
2920         * dom/Document.cpp:
2921         (WebCore::Document::addImageElementByUsemap): Moved to TreeScope.
2922         (WebCore::Document::removeImageElementByUsemap): Ditto.
2923         (WebCore::Document::imageElementByUsemap const): Ditto.
2924         * dom/Document.h:
2925         * dom/TreeScope.cpp:
2926         (WebCore::TreeScope::destroyTreeScopeData): Clear m_imagesByUsemap as well as m_elementsByName.
2927         (WebCore::TreeScope::getImageMap const): Removed the code to parse usemap. RenderImage::imageMap()
2928         which used to call this function with the raw value of the usemap content attribute now calls it
2929         via HTMLImageElement::associatedMapElement(), which uses the parsed usemap.
2930         (WebCore::TreeScope::addImageElementByUsemap): Moved from Document.
2931         (WebCore::TreeScope::removeImageElementByUsemap): Ditto.
2932         (WebCore::TreeScope::imageElementByUsemap const): Ditto.
2933         * dom/TreeScope.h:
2934         * html/HTMLImageElement.cpp:
2935         (WebCore::HTMLImageElement::parseAttribute):
2936         (WebCore::HTMLImageElement::insertedIntoAncestor): This image element can be associated with a map element
2937         if it's connected to a document.
2938         (WebCore::HTMLImageElement::removedFromAncestor):
2939         (WebCore::HTMLImageElement::associatedMapElement const):
2940         * html/HTMLImageElement.h:
2941         * html/HTMLMapElement.cpp:
2942         (WebCore::HTMLMapElement::imageElement):
2943         * rendering/RenderImage.cpp:
2944         (WebCore::RenderImage::imageMap const):
2945
2946 2018-05-03  Justin Fan  <justin_fan@apple.com>
2947
2948         [WebGL] Add runtime flag for enabling ASTC support in WebGL
2949         https://bugs.webkit.org/show_bug.cgi?id=184840
2950
2951         Reviewed by Myles C. Maxfield.
2952
2953         Added runtime flag for ASTC support in WebGL, to turn on/off when extension is implemented.
2954
2955         * page/RuntimeEnabledFeatures.h:
2956         (WebCore::RuntimeEnabledFeatures::setWebGLCompressedTextureASTCSupportEnabled):
2957         (WebCore::RuntimeEnabledFeatures::webGLCompressedTextureASTCSupportEnabled const):
2958
2959 2018-05-03  Chris Nardi  <cnardi@chromium.org>
2960
2961         Remove [NoInterfaceObject] from DOMRectList
2962         https://bugs.webkit.org/show_bug.cgi?id=185255
2963
2964         Reviewed by Chris Dumez.
2965
2966         In https://github.com/w3c/fxtf-drafts/issues/233, [NoInterfaceObject] was removed
2967         from DOMRectList. Remove it from our implementation to match the spec, as well as
2968         Chrome and Firefox.
2969
2970         Updated web platform tests IDL test for the Geometry spec.
2971
2972         * dom/DOMRectList.idl:
2973
2974 2018-05-03  Chris Dumez  <cdumez@apple.com>
2975
2976         REGRESSION(iOS 11.3): Crashes in TimerBase::~TimerBase() in Tencent x5gamehelper
2977         https://bugs.webkit.org/show_bug.cgi?id=185073
2978         <rdar://problem/39821223>
2979
2980         Reviewed by Alexey Proskuryakov.
2981
2982         The following changes were made:
2983         - Make sure SocketStream callbacks are always scheduled on the right runloop:
2984           WebThreadRunLoop() on WebKitLegacy iOS, loaderRunLoop() on Windows and
2985           main runloop otherwise.
2986         - When the SocketStream callbacks are called, unconditionally call callOnMainThreadAndWait()
2987           before calling methods on the SocketStream client. Previously, this code path
2988           was specific to Windows but there is no reason to have platform-specific code here.
2989           callOnMainThreadAndWait() calls the function right away if we're already on the main
2990           thread, which will be the case on other platform than Windows.
2991
2992         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
2993         (WebCore::callbacksRunLoop):
2994         (WebCore::callbacksRunLoopMode):
2995         (WebCore::SocketStreamHandleImpl::scheduleStreams):
2996         (WebCore::SocketStreamHandleImpl::pacExecutionCallback):
2997         (WebCore::SocketStreamHandleImpl::executePACFileURL):
2998         (WebCore::SocketStreamHandleImpl::removePACRunLoopSource):
2999         (WebCore::SocketStreamHandleImpl::readStreamCallback):
3000         (WebCore::SocketStreamHandleImpl::writeStreamCallback):
3001         (WebCore::SocketStreamHandleImpl::platformClose):
3002
3003 2018-05-03  Zalan Bujtas  <zalan@apple.com>
3004
3005         [LFC] Enable multiple layout roots for incremental layout.
3006         https://bugs.webkit.org/show_bug.cgi?id=185185
3007
3008         Reviewed by Antti Koivisto.
3009
3010         With certain type of style changes, we can stop the box invalidation at the formatting context boundary.
3011         When multiple boxes need updating in different formatting contexts, instead of marking the parent containing block chain all
3012         the way up to a common ancestor, we could just work with a list of layout entry points per layout frame.
3013
3014         * layout/FormattingState.h:
3015         * layout/LayoutContext.cpp:
3016         (WebCore::Layout::LayoutContext::updateLayout):
3017         (WebCore::Layout::LayoutContext::addLayoutEntryPoint):
3018         * layout/LayoutContext.h:
3019
3020 2018-05-03  Zalan Bujtas  <zalan@apple.com>
3021
3022         [LFC] Box invalidation logic should go to dedicated classes.
3023         https://bugs.webkit.org/show_bug.cgi?id=185249
3024
3025         Reviewed by Antti Koivisto.
3026
3027         Each formatting context can initiate a different type of invalidation when
3028         style attribute changes in a box.
3029
3030         * Sources.txt:
3031         * WebCore.xcodeproj/project.pbxproj:
3032         * layout/FormattingState.cpp:
3033         (WebCore::Layout::FormattingState::FormattingState):
3034         * layout/FormattingState.h:
3035         (WebCore::Layout::FormattingState::isBlockFormattingState const):
3036         (WebCore::Layout::FormattingState::isInlineFormattingState const):
3037         * layout/LayoutContext.cpp:
3038         (WebCore::Layout::LayoutContext::styleChanged):
3039         (WebCore::Layout::LayoutContext::markNeedsUpdate):
3040         * layout/LayoutContext.h:
3041         * layout/blockformatting/BlockFormattingState.cpp:
3042         (WebCore::Layout::BlockFormattingState::BlockFormattingState):
3043         * layout/blockformatting/BlockFormattingState.h:
3044         * layout/blockformatting/BlockInvalidation.cpp: Copied from Source/WebCore/layout/blockformatting/BlockFormattingState.cpp.
3045         (WebCore::Layout::BlockInvalidation::invalidate):
3046         * layout/blockformatting/BlockInvalidation.h: Copied from Source/WebCore/layout/inlineformatting/InlineFormattingState.h.
3047         * layout/inlineformatting/InlineFormattingState.cpp:
3048         (WebCore::Layout::InlineFormattingState::InlineFormattingState):
3049         * layout/inlineformatting/InlineFormattingState.h:
3050         * layout/inlineformatting/InlineInvalidation.cpp: Copied from Source/WebCore/layout/inlineformatting/InlineFormattingState.cpp.
3051         (WebCore::Layout::InlineInvalidation::invalidate):
3052         * layout/inlineformatting/InlineInvalidation.h: Copied from Source/WebCore/layout/blockformatting/BlockFormattingState.h.
3053
3054 2018-05-03  Michael Catanzaro  <mcatanzaro@igalia.com>
3055
3056         WebKit should send fake macOS user agent to docs.google.com
3057         https://bugs.webkit.org/show_bug.cgi?id=185165
3058
3059         Reviewed by Carlos Garcia Campos.
3060
3061         * platform/UserAgentQuirks.cpp:
3062         (WebCore::urlRequiresMacintoshPlatform):
3063         (WebCore::urlRequiresLinuxDesktopPlatform):
3064
3065 2018-05-03  Commit Queue  <commit-queue@webkit.org>
3066
3067         Unreviewed, rolling out r231223 and r231288.
3068         https://bugs.webkit.org/show_bug.cgi?id=185256
3069
3070         The change in r231223 breaks internal builds, and r231288 is a
3071         dependent change. (Requested by ryanhaddad on #webkit).
3072
3073         Reverted changesets:
3074
3075         "Use default std::optional if it is provided"
3076         https://bugs.webkit.org/show_bug.cgi?id=185159
3077         https://trac.webkit.org/changeset/231223
3078
3079         "Use pointer instead of
3080         std::optional<std::reference_wrapper<>>"
3081         https://bugs.webkit.org/show_bug.cgi?id=185186
3082         https://trac.webkit.org/changeset/231288
3083
3084 2018-05-03  Ryan Haddad  <ryanhaddad@apple.com>
3085
3086         Unreviewed, rolling out r231253.
3087
3088         The API test added with this change is crashing on the bots.
3089
3090         Reverted changeset:
3091
3092         "Web Inspector: opt out of process swap on navigation if a Web
3093         Inspector frontend is connected"
3094         https://bugs.webkit.org/show_bug.cgi?id=184861
3095         https://trac.webkit.org/changeset/231253
3096
3097 2018-05-03  Youenn Fablet  <youenn@apple.com>
3098
3099         A MediaStream being played should allow removing some of its tracks
3100         https://bugs.webkit.org/show_bug.cgi?id=185233
3101
3102         Reviewed by Eric Carlson.
3103
3104         Update the tracks out of the for loop.
3105         Test: fast/mediastream/change-tracks-media-stream-being-played.html
3106
3107         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3108         (WebCore::updateTracksOfType):
3109
3110 2018-05-03  Miguel Gomez  <magomez@igalia.com>
3111
3112         WebCore::TextureMapperLayer object used after freed
3113         https://bugs.webkit.org/show_bug.cgi?id=184729
3114
3115         Reviewed by Michael Catanzaro.
3116
3117         Replace the raw pointers with WeakPtr for effectTarget, maskLayer and replicaLayer
3118         inside TextureMapperLayer.
3119
3120         * platform/graphics/texmap/TextureMapperLayer.cpp:
3121         (WebCore::TextureMapperLayer::~TextureMapperLayer):
3122         (WebCore::TextureMapperLayer::setMaskLayer):
3123         (WebCore::TextureMapperLayer::setReplicaLayer):
3124         * platform/graphics/texmap/TextureMapperLayer.h:
3125
3126 2018-05-03  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3127
3128         [Curl] Add OpenSSL/LibreSSL multi-threading support
3129         https://bugs.webkit.org/show_bug.cgi?id=185138
3130
3131         The older OpenSSL manual says the locking_function and threadid_function should
3132         be set when use it in multi-threading environment. This applies to LibreSSL also.
3133         https://www.openssl.org/docs/man1.0.2/crypto/threads.html
3134
3135         For unix and other similar os, the default threadId_function implementation is
3136         good enough. We'll set custom callback only for Windows OS.
3137
3138         Note it's not required for OpenSSL 1.1.0 and after.
3139         https://www.openssl.org/blog/blog/2017/02/21/threads/
3140
3141         Reviewed by Per Arne Vollan.
3142
3143         * platform/network/curl/CurlSSLHandle.cpp:
3144         (WebCore::CurlSSLHandle::CurlSSLHandle):
3145         (WebCore::CurlSSLHandle::ThreadSupport::ThreadSupport):
3146         (WebCore::CurlSSLHandle::ThreadSupport::lockingCallback):
3147         (WebCore::CurlSSLHandle::ThreadSupport::threadIdCallback):
3148         * platform/network/curl/CurlSSLHandle.h:
3149         (WebCore::CurlSSLHandle::ThreadSupport::setup):
3150         (WebCore::CurlSSLHandle::ThreadSupport::singleton):
3151         (WebCore::CurlSSLHandle::ThreadSupport::lock):
3152         (WebCore::CurlSSLHandle::ThreadSupport::unlock):
3153
3154 2018-05-02  Ryosuke Niwa  <rniwa@webkit.org>
3155
3156         Remove superfluous check for a null attribute value check in Element::removeAttributeInternal
3157         https://bugs.webkit.org/show_bug.cgi?id=185227
3158
3159         Reviewed by Chris Dumez.
3160
3161         Removed the check. The attribute value string can never be null.
3162
3163         * dom/Element.cpp:
3164         (WebCore::Element::removeAttributeInternal):
3165
3166 2018-05-02  Zalan Bujtas  <zalan@apple.com>
3167
3168         [LFC] Implement LayoutContext::createDisplayBox
3169         https://bugs.webkit.org/show_bug.cgi?id=185158
3170
3171         Reviewed by Antti Koivisto.
3172
3173         Now compute*() functions take both the const layout and the corresponding non-const display boxes.
3174         Display boxes are owned by the LayoutContext and they don't form a tree structure (only implicitly through the layout tree).
3175         (This might need to change in the future if we decide to arrange them in some sort of painting order)
3176
3177         * layout/FloatingContext.cpp:
3178         (WebCore::Layout::FloatingContext::computePosition):
3179         * layout/FloatingContext.h:
3180         * layout/FormattingContext.cpp:
3181         (WebCore::Layout::FormattingContext::computeStaticPosition const):
3182         (WebCore::Layout::FormattingContext::computeInFlowPositionedPosition const):
3183         (WebCore::Layout::FormattingContext::computeOutOfFlowPosition const):
3184         (WebCore::Layout::FormattingContext::computeWidth const):
3185         (WebCore::Layout::FormattingContext::computeHeight const):
3186         (WebCore::Layout::FormattingContext::computeOutOfFlowWidth const):
3187         (WebCore::Layout::FormattingContext::computeFloatingWidth const):
3188         (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const):
3189         (WebCore::Layout::FormattingContext::computeFloatingHeight const):
3190         * layout/FormattingContext.h:
3191         * layout/LayoutContext.cpp:
3192         (WebCore::Layout::LayoutContext::createDisplayBox):
3193         * layout/LayoutContext.h:
3194         (WebCore::Layout::LayoutContext::displayBoxForLayoutBox const):
3195         * layout/blockformatting/BlockFormattingContext.cpp:
3196         (WebCore::Layout::BlockFormattingContext::layout const):
3197         (WebCore::Layout::BlockFormattingContext::computeStaticPosition const):
3198         (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const):
3199         (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const):
3200         * layout/blockformatting/BlockFormattingContext.h:
3201         * layout/displaytree/DisplayBox.h:
3202         (WebCore::Display::Box::parent const): Deleted.
3203         (WebCore::Display::Box::nextSibling const): Deleted.
3204         (WebCore::Display::Box::previousSibling const): Deleted.
3205         (WebCore::Display::Box::firstChild const): Deleted.
3206         (WebCore::Display::Box::lastChild const): Deleted.
3207         (WebCore::Display::Box::setParent): Deleted.
3208         (WebCore::Display::Box::setNextSibling): Deleted.
3209         (WebCore::Display::Box::setPreviousSibling): Deleted.
3210         (WebCore::Display::Box::setFirstChild): Deleted.
3211         (WebCore::Display::Box::setLastChild): Deleted.
3212         (): Deleted.
3213         * layout/inlineformatting/InlineFormattingContext.cpp:
3214         (WebCore::Layout::InlineFormattingContext::computeInFlowWidth const):
3215         (WebCore::Layout::InlineFormattingContext::computeInFlowHeight const):
3216         * layout/inlineformatting/InlineFormattingContext.h:
3217
3218 2018-05-02  Said Abou-Hallawa  <sabouhallawa@apple.com>
3219
3220         Hiding then showing an <object> of type image makes the underlaying image disappear
3221         https://bugs.webkit.org/show_bug.cgi?id=185216
3222         <rdar://problem/39055630>
3223
3224         Reviewed by Youenn Fablet.
3225
3226         Ensure the HTMLPlugInImageElement updates the RenderImageResource of its
3227         RenderImage with the CachedImage of its ImageLoader when the RenderImage
3228         is recreated.
3229
3230         Test: fast/images/object-image-hide-show.html
3231
3232         * html/HTMLPlugInImageElement.cpp:
3233         (WebCore::HTMLPlugInImageElement::didAttachRenderers):
3234         This is very similar to what we do in HTMLImageElement::didAttachRenderers().
3235
3236
3237 2018-05-02  Brent Fulgham  <bfulgham@apple.com>
3238
3239         Use RetainPtr for form input type
3240         https://bugs.webkit.org/show_bug.cgi?id=185210
3241         <rdar://problem/39734040>
3242
3243         Reviewed by Ryosuke Niwa.
3244
3245         Refactor our HTMLInputElement class to store its InputType member as a RefPtr.
3246
3247         Test: fast/forms/access-key-mutation-2.html.
3248
3249         * html/HTMLInputElement.cpp:
3250         (WebCore::HTMLInputElement::HTMLInputElement):
3251         (WebCore::HTMLInputElement::didAddUserAgentShadowRoot):
3252         (WebCore::HTMLInputElement::accessKeyAction):
3253         (WebCore::HTMLInputElement::parseAttribute):
3254         (WebCore::HTMLInputElement::appendFormData):
3255         * html/HTMLInputElement.h:
3256         * html/InputType.cpp:
3257         (WebCore::createInputType):
3258         (WebCore::InputType::create):
3259         (WebCore::InputType::createText):
3260         * html/InputType.h:
3261
3262 2018-05-01  Yusuke Suzuki  <utatane.tea@gmail.com>
3263
3264         Use pointer instead of std::optional<std::reference_wrapper<>>
3265         https://bugs.webkit.org/show_bug.cgi?id=185186
3266
3267         Reviewed by Alex Christensen.
3268
3269         std::optional<T&> is not accepted in C++17 spec. So we replaced it
3270         with std::optional<std::reference_wrapper<T>>.
3271
3272         In this patch, we replace it with T*, which is well-aligned to
3273         WebKit's convention.
3274
3275         * Modules/mediastream/RTCPeerConnection.cpp:
3276         (WebCore::iceServersFromConfiguration):
3277         (WebCore::RTCPeerConnection::initializeConfiguration):
3278         (WebCore::RTCPeerConnection::setConfiguration):
3279         * css/parser/CSSParser.cpp:
3280         (WebCore::CSSParser::parseSystemColor):
3281         * css/parser/CSSParser.h:
3282         * dom/DatasetDOMStringMap.cpp:
3283         (WebCore::DatasetDOMStringMap::item const):
3284         (WebCore::DatasetDOMStringMap::namedItem const):
3285         * dom/DatasetDOMStringMap.h:
3286         * dom/Element.cpp:
3287         (WebCore::Element::insertAdjacentHTML):
3288         * dom/Element.h:
3289         * html/canvas/CanvasStyle.cpp:
3290         (WebCore::parseColor):
3291         * inspector/DOMEditor.cpp:
3292         * platform/network/curl/CurlFormDataStream.cpp:
3293         (WebCore::CurlFormDataStream::getPostData):
3294         * platform/network/curl/CurlFormDataStream.h:
3295         * platform/network/curl/CurlRequest.cpp:
3296         (WebCore::CurlRequest::setupPOST):
3297         * testing/MockCDMFactory.cpp:
3298         (WebCore::MockCDMFactory::keysForSessionWithID const):
3299         (WebCore::MockCDMInstance::updateLicense):
3300         * testing/MockCDMFactory.h:
3301
3302 2018-05-02  Keith Rollin  <krollin@apple.com>
3303
3304         Add facility for tracking times and results of page and resource loading
3305         https://bugs.webkit.org/show_bug.cgi?id=184838
3306         <rdar://problem/36548974>
3307
3308         Reviewed by Brent Fulgham.
3309
3310         Update FrameProgressTracker to send the necessary page load start/stop
3311         signals so that we can track the entire page load at a network level.
3312         Add an empty override of the pure virtual
3313         LoaderStrategy::pageLoadCompleted method.
3314
3315         No new tests. There is no testable effect from these changes. On
3316         Cocoa, measurable changes take place in another (non-WebKit) process.
3317         On non-Cocoa systems, this facility is currently disabled.
3318
3319         * loader/FrameLoader.cpp:
3320         (WebCore::FrameLoader::FrameProgressTracker::progressCompleted):
3321         * loader/LoaderStrategy.h:
3322
3323 2018-05-02  Aditya Keerthi  <akeerthi@apple.com>
3324
3325         Can't copy and paste URLs that have no title into Mail (macOS)
3326         https://bugs.webkit.org/show_bug.cgi?id=185205
3327         <rdar://problem/36352406>
3328
3329         Reviewed by Tim Horton.
3330
3331         The pasteboardURL generated has an empty title for URLs without titles. Currently, the pasteboardURL.title is being saved to the pasteboard.
3332
3333         To fix the error, we check whether the title is empty and instead save the lastPathComponent to the pasteboard. This matches current behavior as the fallback title.
3334
3335         Augmented WebKitLegacy.ContextMenuCanCopyURL test
3336
3337         * platform/mac/PasteboardMac.mm:
3338         (WebCore::writeURLForTypes):
3339
3340 2018-05-01  Ryosuke Niwa  <rniwa@webkit.org>
3341
3342         REGRESSION(r225868): Release assert when removing an SVGUseElement from Document::m_svgUseElements
3343         https://bugs.webkit.org/show_bug.cgi?id=182188
3344         <rdar://problem/36689240>
3345
3346         Reviewed by Antti Koivisto.
3347
3348         Fixed the crash by removing up the release assert.
3349
3350         The crash is likely caused by re-entrancy to Document::resolveStyle during SVGUseElement::updateShadowTree.
3351         Because Document::resolveStyle invokes updateShadowTree on SVG use elements in Document::m_svgUseElements
3352         without clearing the map, the nested call to resolveStyle ends up calling updateShadowTree() for all elements
3353         in m_svgUseElements and removing them all from the map. When the stack frame eventually comes back to the outer
3354         invocation of Document::resolveStyle, updateShadowTree gets invoked for the second time on SVG use elements
3355         whose shadow tree had already been updated within the inner invocation to updateShadowTree, and release-asserts.
3356
3357         There is an alternative fix: avoid calling updateShadowTree on a svg element when shadowTreeNeedsUpdate returns
3358         true on the element in resolveStyle. However, removing the release assert is a sure way to fix the crash so
3359         this patch opts for that fix instead especially since we don't have any reproducible test case for this crash.
3360
3361         This release assertion was added in r225868 as a cautious measure to catch any use-after-frees of SVGUseElement's
3362         since m_svgUseElements stored raw pointes to SVG use elements but this crash is not an indicative of any UAF,
3363         and there is no evidence that r225868 has led to new UAFs even after five months.
3364
3365         No new tests. I couldn't find a way to trigger a nested style update inside SVGUseElement::updateShadowTree.
3366
3367         * dom/Document.cpp:
3368         (WebCore::Document::removeSVGUseElement):
3369
3370 2018-05-02  Dirk Schulze  <dschulze@chromium.org>
3371
3372         getCharNumAtPosition should take DOMPointInit as argument
3373         https://bugs.webkit.org/show_bug.cgi?id=184695
3374
3375         Reviewed by Antti Koivisto.
3376
3377         Extend existing tests for getCharNumAtPosition.
3378
3379         * svg/SVGTextContentElement.cpp:
3380         (WebCore::SVGTextContentElement::getCharNumAtPosition):
3381         * svg/SVGTextContentElement.h:
3382         * svg/SVGTextContentElement.idl: Use DOMPointInit argument.
3383
3384 2018-05-02  Youenn Fablet  <youenn@apple.com>
3385
3386         Use NetworkLoadChecker for navigation loads
3387         https://bugs.webkit.org/show_bug.cgi?id=184892
3388         <rdar://problem/39652686>
3389
3390         Reviewed by Chris Dumez.
3391
3392         Sanitize headers according response tainting.
3393         If tainting is basic, it means same origin load in which case we only filter Cookie related headers.
3394         If tainting is Opaque, we filter all uncommon headers.
3395         If tainting is CORS, we filter all uncommon headers except the one explicitely allowed by CORS headers.
3396         Covered by updated test.
3397
3398         * platform/network/ResourceResponseBase.cpp:
3399         (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFieldsAccordingToTainting):
3400         (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFields):
3401         * platform/network/ResourceResponseBase.h:
3402
3403 2018-05-02  Myles C. Maxfield  <mmaxfield@apple.com>
3404
3405         Collection fragment identifiers don't use PostScript names
3406         https://bugs.webkit.org/show_bug.cgi?id=184624
3407         <rdar://problem/39432089>
3408
3409         Reviewed by Simon Fraser.
3410
3411         In a previous version of the CSS Fonts spec, there was text saying that items in font collections
3412         should be 1-indexed (so the first item would be MyFonts.ttc#1). However, this is unfortunate because
3413         inserting an item into the middle of a collection would throw off all content that uses the file.
3414         Instead, the spec has since changed to use PostScript names (so the content instead would say
3415         MyFonts.ttc#MyFont-Regular).
3416
3417         Test: fast/text/font-collection.html
3418
3419         * css/CSSFontFaceSource.cpp:
3420         (WebCore::CSSFontFaceSource::load):
3421         * loader/cache/CachedFont.cpp:
3422         (WebCore::CachedFont::calculateItemInCollection const):
3423         (WebCore::CachedFont::ensureCustomFontData):
3424         (WebCore::CachedFont::createCustomFontData):
3425         (WebCore::CachedFont::calculateIndex const): Deleted.
3426         * loader/cache/CachedFont.h:
3427         * platform/graphics/mac/FontCustomPlatformData.cpp:
3428         (WebCore::createFontCustomPlatformData):
3429         * platform/graphics/mac/FontCustomPlatformData.h:
3430
3431 2018-05-02  Brian Burg  <bburg@apple.com>
3432
3433         Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected
3434         https://bugs.webkit.org/show_bug.cgi?id=184861
3435         <rdar://problem/39153768>
3436
3437         Reviewed by Ryosuke Niwa.
3438
3439         Notify the client of the current connection count whenever a frontend connects or disconnects.
3440
3441         Covered by new API test.
3442
3443         * inspector/InspectorClient.h:
3444         (WebCore::InspectorClient::frontendCountChanged):
3445         * inspector/InspectorController.cpp:
3446         (WebCore::InspectorController::connectFrontend):
3447         (WebCore::InspectorController::disconnectFrontend):
3448         (WebCore::InspectorController::disconnectAllFrontends):
3449         * inspector/InspectorController.h:
3450
3451 2018-05-02  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3452
3453         [GStreamer] Remove unneeded include of gstgldisplay_wayland.h after r228866 and r229022
3454         https://bugs.webkit.org/show_bug.cgi?id=185207
3455
3456         Reviewed by Michael Catanzaro.
3457
3458         Remove unneeded include of gstgldisplay_wayland.h
3459
3460         No new tests, no change in behaviour.
3461
3462         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3463
3464 2018-05-02  Chris Dumez  <cdumez@apple.com>
3465
3466         document.open() event listener removal is not immediate
3467         https://bugs.webkit.org/show_bug.cgi?id=185191
3468
3469         Reviewed by Darin Adler.
3470
3471         We need to make sure we set the 'wasremoved' flag on RegisteredEventListeners
3472         whenever they get removed from the EventListenerMap. We were doing so correctly
3473         in EventListenerMap:remove() but not EventListenerMap::clear(). This patch
3474         updates clear() accordingly.
3475
3476         The reason we need to set this flag is that RegisteredEventListeners is RefCounted
3477         and EventTarget::fireEventListeners() may be currently running and calling
3478         each listener one by one, holding a reference to all listener of a given event.
3479
3480         Test: fast/dom/Document/document-open-removes-all-listeners.html
3481
3482         * dom/EventListenerMap.cpp:
3483         (WebCore::EventListenerMap::clear):
3484
3485 2018-05-02  Zalan Bujtas <zalan@apple.com>
3486
3487         Use WeakPtr in GridCell
3488         https://bugs.webkit.org/show_bug.cgi?id=185180
3489         <rdar://problem/39432165>
3490
3491         Reviewed by Antti Koivisto.
3492
3493         Since GridCell does not own the renderers, it should
3494         construct weak pointers.
3495
3496         Unable to create a reliably reproducible test case.
3497
3498         * rendering/Grid.cpp:
3499         (WebCore::Grid::insert):
3500         (WebCore::GridIterator::nextGridItem):
3501         * rendering/Grid.h:
3502         * rendering/RenderGrid.cpp:
3503         (WebCore::RenderGrid::firstLineBaseline const):
3504
3505 2018-05-02  Eric Carlson  <eric.carlson@apple.com>
3506
3507         [iOS] Provide audio route information when invoking AirPlay picker
3508         https://bugs.webkit.org/show_bug.cgi?id=185199
3509         <rdar://problem/39853103>
3510
3511         Reviewed by Jer Noble.
3512
3513         No new tests, this requires a specific hardware setup.
3514
3515         * dom/Document.cpp:
3516         (WebCore::Document::showPlaybackTargetPicker): Pass route sharing policy and routing context UID.
3517         * dom/Document.h:
3518
3519         * html/MediaElementSession.cpp:
3520         (WebCore::MediaElementSession::showPlaybackTargetPicker): Ditto.
3521
3522         * loader/EmptyClients.h:
3523         * page/ChromeClient.h:
3524
3525         * page/Page.cpp:
3526         (WebCore::Page::showPlaybackTargetPicker): Ditto.
3527         * page/Page.h:
3528
3529         * platform/audio/AudioSession.cpp:
3530         (WebCore::AudioSession::routeSharingPolicy const): Empty implementation for non-iOS ports.
3531         (WebCore::routingContextUID const): Ditto.
3532         * platform/audio/AudioSession.h:
3533
3534         * platform/audio/ios/AudioSessionIOS.mm:
3535         (WebCore::AudioSession::routeSharingPolicy const): Return the route sharing policy.
3536         (WebCore::AudioSession::routingContextUID const): Return the route context UID.
3537
3538 2018-05-02  Dean Jackson  <dino@apple.com>
3539
3540         Draw SystemPreview badge to specification on iOS
3541         https://bugs.webkit.org/show_bug.cgi?id=185203
3542         <rdar://problem/39908855>
3543
3544         Reviewed by Tim Horton.
3545
3546         Use CoreImage to render a badge with a blurred background,
3547         at particular sizes.
3548
3549         This will be tested internally while we're getting artwork
3550         from WebKitAdditions.
3551
3552         * Configurations/WebCore.xcconfig: Link against CoreImage.
3553         * rendering/RenderThemeIOS.h:
3554         * rendering/RenderThemeIOS.mm:
3555         (WebCore::RenderThemeIOS::paintSystemPreviewBadge): New function
3556         in the iOS platform RenderTheme that draws the system preview.
3557
3558 2018-05-01  Brent Fulgham  <bfulgham@apple.com>
3559
3560         Prevent Debug ASSERT when changing forms
3561         https://bugs.webkit.org/show_bug.cgi?id=185173
3562         <rdar://problem/39738669>
3563
3564         Reviewed by Ryosuke Niwa.
3565
3566         Form submission could trigger a debug assertion during validation when
3567         a form is changed during an input submission. Fix this by cleaning up
3568         the event handling logic and make it more consistent with modern WebKit
3569         coding style.
3570
3571         Test: fast/forms/form-submission-crash-3.html
3572
3573         * html/HTMLButtonElement.cpp:
3574         (WebCore::HTMLButtonElement::defaultEventHandler): Make sure layout runs before
3575         attempting to perform event handling.
3576         * html/HTMLFormElement.cpp:
3577         (WebCore::HTMLFormElement::reportValidity): Ditto.
3578         (WebCore::HTMLFormElement::validateInteractively): Remove call to perform layout here,
3579         since we expect this to happen earlier in the layout pass. Add an assertion that the
3580         tree is not dirty.
3581         * html/ImageInputType.cpp:
3582         (WebCore::ImageInputType::handleDOMActivateEvent): Make sure layout runs before
3583         attempting to perform event handling.
3584         * html/SubmitInputType.cpp:
3585         (WebCore::SubmitInputType::handleDOMActivateEvent): Ditto.
3586
3587 2018-05-02  Jer Noble  <jer.noble@apple.com>
3588
3589         Unreviewed; address review comments made before landing r231231.
3590
3591         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
3592         (VideoFullscreenControllerContext::volume const):
3593
3594 2018-05-02  Jer Noble  <jer.noble@apple.com>
3595
3596         Pipe volume through PlaybackSessionManager/Proxy.
3597         https://bugs.webkit.org/show_bug.cgi?id=185182
3598
3599         Reviewed by Eric Carlson.
3600
3601         Add support for the volume property to PlaybackSessionModel, and all its clients.
3602
3603         * platform/cocoa/PlaybackSessionModel.h:
3604         (WebCore::PlaybackSessionModelClient::volumeChanged):
3605         * platform/cocoa/PlaybackSessionModelMediaElement.h:
3606         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
3607         (WebCore::PlaybackSessionModelMediaElement::updateForEventName):
3608         (WebCore::PlaybackSessionModelMediaElement::setVolume):
3609         (WebCore::PlaybackSessionModelMediaElement::volume const):
3610         * platform/ios/PlaybackSessionInterfaceAVKit.h:
3611         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
3612         (WebCore::PlaybackSessionInterfaceAVKit::volumeChanged):
3613         * platform/ios/WebAVPlayerController.h:
3614         * platform/ios/WebAVPlayerController.mm:
3615         (-[WebAVPlayerController volume]):
3616         (-[WebAVPlayerController setVolume:]):
3617         (-[WebAVPlayerController volumeChanged:]):
3618         (-[WebAVPlayerController resetMediaState]):
3619         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
3620         (VideoFullscreenControllerContext::volumeChanged):
3621         (VideoFullscreenControllerContext::volume const):
3622         (VideoFullscreenControllerContext::setVolume):
3623
3624 2018-05-01  Yusuke Suzuki  <utatane.tea@gmail.com>
3625
3626         Unreviewed, fix build in WinCairo
3627         https://bugs.webkit.org/show_bug.cgi?id=185169
3628
3629         * bindings/js/JSDOMWindowBase.cpp:
3630         (WebCore::JSDOMWindowBase::instantiateStreaming):
3631         * bindings/js/JSDOMWindowBase.h:
3632
3633 2018-05-01  Yusuke Suzuki  <utatane.tea@gmail.com>
3634
3635         Use default std::optional if it is provided
3636         https://bugs.webkit.org/show_bug.cgi?id=185159
3637
3638         Reviewed by JF Bastien.
3639
3640         * Modules/mediastream/RTCPeerConnection.cpp:
3641         (WebCore::iceServersFromConfiguration):
3642         (WebCore::RTCPeerConnection::setConfiguration):
3643         * css/parser/CSSParser.cpp:
3644         (WebCore::CSSParser::parseSystemColor):
3645         * css/parser/CSSParser.h:
3646         * dom/DatasetDOMStringMap.cpp:
3647         (WebCore::DatasetDOMStringMap::item const):
3648         (WebCore::DatasetDOMStringMap::namedItem const):
3649         (WebCore:: const): Deleted.
3650         * dom/DatasetDOMStringMap.h:
3651         * dom/Element.cpp:
3652         (WebCore::Element::insertAdjacentHTML):
3653         * dom/Element.h:
3654         * inspector/DOMEditor.cpp:
3655         * platform/network/curl/CurlFormDataStream.cpp:
3656         (WebCore::CurlFormDataStream::getPostData):
3657         (): Deleted.
3658         * platform/network/curl/CurlFormDataStream.h:
3659         * testing/MockCDMFactory.cpp:
3660         (WebCore::MockCDMFactory::keysForSessionWithID const):
3661         (WebCore::MockCDMInstance::updateLicense):
3662         (WebCore:: const): Deleted.
3663         * testing/MockCDMFactory.h:
3664
3665 2018-05-01  Chris Dumez  <cdumez@apple.com>
3666
3667         Add release assertions in CFNetwork's SocketStreamHandleImpl to help debug a threading issue
3668         https://bugs.webkit.org/show_bug.cgi?id=185181
3669
3670         Reviewed by Geoffrey Garen.
3671
3672         Add release assertions in CFNetwork's SocketStreamHandleImpl to help debug a threading issue
3673         on iOS WebKitLegacy (Bug 185073). It appears readStreamCallback() can get called on the UIThread,
3674         which should not be possible if scheduleStreams() was called on the WebThread, as it is supposed
3675         to. The new release assertion in scheduleStreams() should tell us if somebody is calling it from
3676         the UIthread instead of the WebThread on iOS WebKitLegacy.
3677
3678         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
3679         (WebCore::SocketStreamHandleImpl::scheduleStreams):
3680         (WebCore::SocketStreamHandleImpl::readStreamCallback):
3681
3682 2018-05-01  Wenson Hsieh  <wenson_hsieh@apple.com>
3683
3684         Unreviewed, remove an unused variable in RuntimeEnabledFeatures.h
3685
3686         * page/RuntimeEnabledFeatures.h:
3687
3688 2018-05-01  Oleksandr Skachkov  <gskachkov@gmail.com>
3689
3690         Fix build error after r231194
3691         https://bugs.webkit.org/show_bug.cgi?id=185169
3692
3693         Reviewed by JF Bastien.
3694
3695         Prevent compile error in iOS Simulator debug build
3696         by tagging function
3697
3698         * bindings/js/JSDOMWindowBase.cpp:
3699         (WebCore::JSDOMWindowBase::compileStreaming):
3700         (WebCore::JSDOMWindowBase::instantiateStreaming):
3701
3702 2018-05-01  Oleksandr Skachkov  <gskachkov@gmail.com>
3703
3704         WebAssembly: add support for stream APIs - JavaScript API
3705         https://bugs.webkit.org/show_bug.cgi?id=183442
3706
3707         Reviewed by Yusuke Suzuki and JF Bastien.
3708
3709         Add WebAssembly streaming API to WebCore.
3710
3711         * Configurations/FeatureDefines.xcconfig:
3712         * bindings/js/JSDOMWindowBase.cpp:
3713         (WebCore::tryAllocate):
3714         (WebCore::isResponseCorrect):
3715         (WebCore::handleResponseOnStreamingAction):
3716         (WebCore::JSDOMWindowBase::compileStreaming):
3717         (WebCore::JSDOMWindowBase::instantiateStreaming):
3718         * bindings/js/JSDOMWindowBase.h:
3719         * bindings/js/JSRemoteDOMWindowBase.cpp:
3720         * bindings/js/JSWorkerGlobalScopeBase.cpp:
3721
3722 2018-04-30  Myles C. Maxfield  <mmaxfield@apple.com>
3723
3724         Improve the performance of FontCascadeDescription's effectiveFamilies
3725         https://bugs.webkit.org/show_bug.cgi?id=184720
3726         <rdar://problem/38970927>
3727
3728         Reviewed by Simon Fraser.
3729
3730         The page that had the performance problem renders many different Chinese characters in system-ui
3731         with only a small number of individual fonts. It turns out we were calling into the system-ui
3732         machinery for each character in order to opportunistically start loading data URLs (see also:
3733         https://bugs.webkit.org/show_bug.cgi?id=175845). These data URLS will never represent the system
3734         font, so we don't need to invoke the system-ui machinery at all.
3735
3736         This patch makes a 92x performance improvement on the associated performance test. This test is
3737         designed to test Chinese text rendered with system-ui.
3738
3739         Performance test: Layout/system-ui.html
3740
3741         * platform/graphics/FontCascadeFonts.cpp:
3742         (WebCore::opportunisticallyStartFontDataURLLoading):
3743
3744 2018-04-30  Jer Noble  <jer.noble@apple.com>
3745
3746         <img src=mp4> does not display on ios despite Accept: video/* advertisement
3747         https://bugs.webkit.org/show_bug.cgi?id=185029
3748         <rdar://problem/39771989>
3749
3750         Reviewed by Eric Carlson.
3751
3752         Returning "NO" from resourceLoader:shouldWaitForLoadingOfResource: signals that the load failed,
3753         even if the resource request is successfully fulfilled prior to the return. Always return YES in
3754         the case that loading succeeded.
3755
3756         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
3757         (-[WebCoreSharedBufferResourceLoaderDelegate resourceLoader:shouldWaitForLoadingOfRequestedResource:]):
3758
3759 2018-04-30  Zalan Bujtas  <zalan@apple.com>
3760
3761         REGRESSION(r230914) Selecting text on this apple.com page makes it vanish
3762         https://bugs.webkit.org/show_bug.cgi?id=185142
3763         <rdar://problem/39821446>
3764
3765         Reviewed by Simon Fraser.
3766
3767         Set the overflow rect on the inline textbox when needed.
3768
3769         Test: fast/text/simple-line-layout-selection-with-overflow.html
3770
3771         * rendering/SimpleLineLayoutFunctions.cpp:
3772         (WebCore::SimpleLineLayout::initializeInlineTextBox):
3773         (WebCore::SimpleLineLayout::generateLineBoxTree):
3774         (WebCore::SimpleLineLayout::initializeInlineBox): Deleted.
3775
3776 2018-04-30  JF Bastien  <jfbastien@apple.com>
3777
3778         Use some C++17 features
3779         https://bugs.webkit.org/show_bug.cgi?id=185135
3780
3781         Reviewed by Alex Christensen.
3782
3783         As discussed here [0] let's move WebKit to a subset of C++17. We
3784         now require GCC 6 [1] which means that, according to [2] we can
3785         use the following C++17 language features (I removed some
3786         uninteresting ones):
3787
3788          - New auto rules for direct-list-initialization
3789          - static_assert with no message
3790          - typename in a template template parameter
3791          - Nested namespace definition
3792          - Attributes for namespaces and enumerators
3793          - u8 character literals
3794          - Allow constant evaluation for all non-type template arguments
3795          - Fold Expressions
3796          - Unary fold expressions and empty parameter packs
3797          - __has_include in preprocessor conditional
3798          - Differing begin and end types in range-based for
3799          - Improving std::pair and std::tuple
3800
3801         Consult the Tony Tables [3] to see before / after examples.
3802
3803         Of course we can use any library feature if we're willing to
3804         import them to WTF (and they don't require language support).
3805
3806
3807           [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html
3808           [1]: https://trac.webkit.org/changeset/231152/webkit
3809           [2]: https://en.cppreference.com/w/cpp/compiler_support
3810           [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md
3811
3812         * DerivedSources.make:
3813         * platform/URLParser.cpp: work around an odd GCC 6 bug with class
3814           static value as a template parameter.
3815         (WebCore::URLParser::percentDecode):
3816         (WebCore::URLParser::domainToASCII):
3817         (WebCore::URLParser::hasForbiddenHostCodePoint):
3818         (WebCore::URLParser::parseHostAndPort):
3819         * platform/URLParser.h:
3820
3821 2018-04-30  Wenson Hsieh  <wenson_hsieh@apple.com>
3822
3823         [Extra zoom mode] Respect the existing shrink-to-fit attribute instead of using min-device-width
3824         https://bugs.webkit.org/show_bug.cgi?id=185132
3825         <rdar://problem/39834562>
3826
3827         Reviewed by Tim Horton.
3828
3829         Removes the `min-device-width` attribute added in r231095. Instead, we key this behavior off of the
3830         `shrink-to-fit` attribute introduced for multitasking on iPad, such that `shrink-to-fit=no` achieves the same
3831         behavior as `min-device-width=0` in extra zoom mode. See comments below for more detail.
3832
3833         Adjusted an existing layout test: fast/viewport/extrazoom/viewport-change-min-device-width.html.
3834
3835         * dom/ViewportArguments.cpp:
3836         (WebCore::setViewportFeature):
3837         (WebCore::operator<<):
3838         * dom/ViewportArguments.h:
3839
3840         Removes the `minDeviceWidth` viewport argument.
3841
3842         * page/RuntimeEnabledFeatures.h:
3843         (WebCore::RuntimeEnabledFeatures::setMinDeviceWidthEnabled): Deleted.
3844         (WebCore::RuntimeEnabledFeatures::minDeviceWidthEnabled const): Deleted.
3845
3846         Removes the runtime switch for `min-device-width`.
3847
3848         * page/ViewportConfiguration.cpp:
3849         (WebCore::platformDeviceWidthOverride):
3850
3851         Hard-code the override device width in extra zoom mode.
3852
3853         (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthAndShrinkToFit const):
3854
3855         In extra zoom mode, override the device width only if shrink-to-fit has not been expliticly disabled, and the
3856         device width is less than the override device width.
3857
3858         (WebCore::ViewportConfiguration::shouldIgnoreHorizontalScalingConstraints const):
3859         (WebCore::ViewportConfiguration::shouldIgnoreScalingConstraintsRegardlessOfContentSize const):
3860         (WebCore::ViewportConfiguration::updateConfiguration):
3861         (WebCore::ViewportConfiguration::updateMinimumLayoutSize):
3862
3863         Do not override the minimum layout size if `shrink-to-fit` has been explicitly explicitly disabled, or if the
3864         device width is greater than the override device width.
3865
3866         (WebCore::computedMinDeviceWidth): Deleted.
3867         (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthWithMinDeviceWidth const): Deleted.
3868         * page/ViewportConfiguration.h:
3869
3870 2018-04-30  Chris Nardi  <cnardi@chromium.org>
3871
3872         Serialize font-variation-settings with double-quotes per spec
3873         https://bugs.webkit.org/show_bug.cgi?id=182542
3874
3875         Reviewed by Myles C. Maxfield.
3876
3877         According to the CSSOM spec [1], all strings should be serialized with double-quotes.
3878         The axis name in font-variation-settings was previously serialized with single-quotes;
3879         change this to double-quotes to match the spec and non-WebKit browsers.
3880
3881         [1]: https://drafts.csswg.org/cssom/#common-serializing-idioms
3882
3883         Updated fast/text/variations/getComputedStyle.html to test the change.
3884
3885         * css/CSSFontVariationValue.cpp:
3886         (WebCore::CSSFontVariationValue::customCSSText const):
3887
3888 2018-04-30  Chris Dumez  <cdumez@apple.com>
3889
3890         Fix bad use of RunLoop::main().dispatch() in MessagePort::dispatchMessages()
3891         https://bugs.webkit.org/show_bug.cgi?id=185134
3892
3893         Reviewed by Geoffrey Garen.
3894
3895         Fix bad use of RunLoop::main().dispatch() in MessagePort::dispatchMessages(). This code runs on iOS WebKitLegacy
3896         and it is therefore unsafe to use RunLoop::main() here. We want to use callOnMainThread() instead to run code on
3897         the WebThread.
3898
3899         * dom/MessagePort.cpp:
3900         (WebCore::MessagePort::dispatchMessages):
3901
3902 2018-04-30  Simon Fraser  <simon.fraser@apple.com>
3903
3904         Make color-filter affect caret-color
3905         https://bugs.webkit.org/show_bug.cgi?id=185129
3906         rdar://problem/39829066
3907
3908         Reviewed by Tim Horton.
3909         
3910         Transform the colors used to compare the caret color with the background through
3911         color-filter (since we want contrasting colors after filters are applied), and
3912         transform caret-color itself.
3913
3914         Test: css3/color-filters/color-filter-caret-color.html
3915
3916         * editing/FrameSelection.cpp:
3917         (WebCore::CaretBase::paintCaret const):
3918
3919 2018-04-30  Michael Catanzaro  <mcatanzaro@igalia.com>
3920
3921         [GTK] Webkit should spoof as Safari on a Mac when on Chase.com
3922         https://bugs.webkit.org/show_bug.cgi?id=185103
3923
3924         Reviewed by Carlos Garcia Campos.
3925
3926         Send a fake user agent to chase.com to make it work.
3927
3928         * platform/UserAgentQuirks.cpp:
3929         (WebCore::urlRequiresMacintoshPlatform):
3930         (WebCore::UserAgentQuirks::stringForQuirk): Also, remove this stale comment.
3931
3932 2018-04-29  Simon Fraser  <simon.fraser@apple.com>
3933
3934         Make color-filter affect <attachment>
3935         https://bugs.webkit.org/show_bug.cgi?id=185122
3936         rdar://problem/39818763
3937
3938         Reviewed by Tim Horton.
3939         
3940         Convert the colors used to render <attachment> through color-filter, except
3941         for those parts that render over the icon (like the progress bar).
3942
3943         Not easily testable.
3944
3945         * rendering/RenderThemeMac.mm:
3946         (WebCore::titleTextColorForAttachment):
3947         (WebCore::AttachmentLayout::layOutTitle):
3948         (WebCore::AttachmentLayout::layOutSubtitle):
3949         (WebCore::paintAttachmentIconBackground):
3950         (WebCore::paintAttachmentTitleBackground):
3951         (WebCore::paintAttachmentPlaceholderBorder):
3952
3953 2018-04-28  Simon Fraser  <simon.fraser@apple.com>
3954
3955         Fix color-filter to apply to SVG colors
3956         https://bugs.webkit.org/show_bug.cgi?id=185113
3957         rdar://problem/39665082
3958
3959         Reviewed by Dean Jackson.
3960         
3961         Convert SVG colors through color-filter operations for the places in SVG
3962         that use color, namely fill and stroke, gradients, lighting colors and
3963         drop-shadow.
3964
3965         Test: css3/color-filters/svg/color-filter-inline-svg.html
3966
3967         * rendering/svg/RenderSVGResourceGradient.cpp:
3968         (WebCore::RenderSVGResourceGradient::applyResource):
3969         * rendering/svg/RenderSVGResourceGradient.h:
3970         * rendering/svg/RenderSVGResourceLinearGradient.cpp:
3971         (WebCore::RenderSVGResourceLinearGradient::buildGradient const):
3972         * rendering/svg/RenderSVGResourceLinearGradient.h:
3973         * rendering/svg/RenderSVGResourceRadialGradient.cpp:
3974         (WebCore::RenderSVGResourceRadialGradient::buildGradient const):
3975         * rendering/svg/RenderSVGResourceRadialGradient.h:
3976         * rendering/svg/RenderSVGResourceSolidColor.cpp:
3977         (WebCore::RenderSVGResourceSolidColor::applyResource):
3978         * svg/SVGFEDiffuseLightingElement.cpp:
3979         (WebCore::SVGFEDiffuseLightingElement::setFilterEffectAttribute):
3980         (WebCore::SVGFEDiffuseLightingElement::build):
3981         * svg/SVGFEDropShadowElement.cpp:
3982         (WebCore::SVGFEDropShadowElement::build):
3983         * svg/SVGFEFloodElement.cpp:
3984         (WebCore::SVGFEFloodElement::build):
3985         * svg/SVGFESpecularLightingElement.cpp:
3986         (WebCore::SVGFESpecularLightingElement::setFilterEffectAttribute):
3987         (WebCore::SVGFESpecularLightingElement::build):
3988
3989 2018-04-29  Michael Catanzaro  <mcatanzaro@igalia.com>
3990
3991<