655d0a1e662ed86a3f1f7f41ed5b64a6c62b7ff5
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-04-27  Chris Dumez  <cdumez@apple.com>
2
3         Use WindowProxy instead of DOMWindow in our IDL
4         https://bugs.webkit.org/show_bug.cgi?id=185022
5
6         Reviewed by Sam Weinig.
7
8         Stop using DOMWindow in all of our IDL files and use WindowProxy as
9         per their respective specifications. As a result, the implementation
10         as also updated to use WindowProxy type instead of DOMWindow.
11
12         * WebCore.xcodeproj/project.pbxproj:
13         * bindings/js/JSDOMConvertWindowProxy.h: Removed.
14         * bindings/js/JSWindowProxy.cpp:
15         (WebCore::JSWindowProxy::windowProxy const):
16         (WebCore::JSWindowProxy::toWrapped):
17         * bindings/js/JSWindowProxy.h:
18         (WebCore::window):
19         Use static_cast<>() instead of jsCast<>() because jsCast<>()
20         relies on classInfo() which is not allowed to be called during
21         JS sweep due to an assertion inside classInfo(). The JSWindowProxy
22         objects are held strongly by the WindowProxy so we know the JSWindowProxy
23         object is not getting destroyed here.
24
25         (WebCore::toJS):
26         * bindings/js/WindowProxy.cpp:
27         (WebCore::WindowProxy::globalObject):
28         * bindings/js/WindowProxy.h:
29         (WebCore::WindowProxy::frame const):
30         * bindings/scripts/CodeGenerator.pm:
31         (IsBuiltinType):
32         (ComputeIsCallbackInterface):
33         (ComputeIsCallbackFunction):
34         * bindings/scripts/CodeGeneratorJS.pm:
35         (AddToIncludesForIDLType):
36         (GetBaseIDLType):
37         (NativeToJSValueDOMConvertNeedsState):
38         * bindings/scripts/test/JS/JSTestObj.cpp:
39         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod9Body):
40         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodOverloadDispatcher):
41         * bindings/scripts/test/TestObj.idl:
42         * dom/CompositionEvent.cpp:
43         (WebCore::CompositionEvent::CompositionEvent):
44         (WebCore::CompositionEvent::initCompositionEvent):
45         * dom/CompositionEvent.h:
46         * dom/CompositionEvent.idl:
47         * dom/Document.cpp:
48         (WebCore::Document::defaultView const):
49         * dom/Document.h:
50         * dom/Document.idl:
51         * dom/DocumentTouch.cpp:
52         (WebCore::DocumentTouch::createTouch):
53         * dom/DocumentTouch.h:
54         * dom/DocumentTouch.idl:
55         * dom/FocusEvent.cpp:
56         (WebCore::FocusEvent::FocusEvent):
57         * dom/FocusEvent.h:
58         * dom/InputEvent.cpp:
59         (WebCore::InputEvent::create):
60         (WebCore::InputEvent::InputEvent):
61         * dom/InputEvent.h:
62         * dom/KeyboardEvent.cpp:
63         (WebCore::KeyboardEvent::KeyboardEvent):
64         (WebCore::KeyboardEvent::create):
65         (WebCore::KeyboardEvent::initKeyboardEvent):
66         (WebCore::KeyboardEvent::charCode const):
67         * dom/KeyboardEvent.h:
68         * dom/KeyboardEvent.idl:
69         * dom/MessageEvent.h:
70         * dom/MessageEvent.idl:
71         * dom/MouseEvent.cpp:
72         (WebCore::MouseEvent::create):
73         (WebCore::MouseEvent::MouseEvent):
74         (WebCore::MouseEvent::initMouseEvent):
75         (WebCore::MouseEvent::initMouseEventQuirk):
76         * dom/MouseEvent.h:
77         * dom/MouseEvent.idl:
78         * dom/MouseRelatedEvent.cpp:
79         (WebCore::MouseRelatedEvent::MouseRelatedEvent):
80         (WebCore::MouseRelatedEvent::init):
81         (WebCore::MouseRelatedEvent::frameViewFromWindowProxy):
82         (WebCore::MouseRelatedEvent::initCoordinates):
83         (WebCore::MouseRelatedEvent::documentToAbsoluteScaleFactor const):
84         (WebCore::MouseRelatedEvent::computePageLocation):
85         (WebCore::MouseRelatedEvent::locationInRootViewCoordinates const):
86         * dom/MouseRelatedEvent.h:
87         * dom/Node.cpp:
88         * dom/SimulatedClick.cpp:
89         * dom/TextEvent.cpp:
90         (WebCore::TextEvent::create):
91         (WebCore::TextEvent::createForPlainTextPaste):
92         (WebCore::TextEvent::createForFragmentPaste):
93         (WebCore::TextEvent::createForDrop):
94         (WebCore::TextEvent::createForDictation):
95         (WebCore::TextEvent::TextEvent):
96         (WebCore::TextEvent::initTextEvent):
97         * dom/TextEvent.h:
98         * dom/TextEvent.idl:
99         * dom/TouchEvent.idl:
100         * dom/UIEvent.cpp:
101         (WebCore::UIEvent::UIEvent):
102         (WebCore::UIEvent::initUIEvent):
103         * dom/UIEvent.h:
104         (WebCore::UIEvent::create):
105         (WebCore::UIEvent::view const):
106         * dom/UIEvent.idl:
107         * dom/UIEventInit.h:
108         * dom/UIEventInit.idl:
109         * dom/UIEventWithKeyState.h:
110         (WebCore::UIEventWithKeyState::UIEventWithKeyState):
111         * dom/WheelEvent.cpp:
112         (WebCore::WheelEvent::WheelEvent):
113         (WebCore::WheelEvent::create):
114         (WebCore::WheelEvent::initWebKitWheelEvent):
115         * dom/WheelEvent.h:
116         * dom/WheelEvent.idl:
117         * editing/AlternativeTextController.cpp:
118         (WebCore::AlternativeTextController::insertDictatedText):
119         * editing/Editor.cpp:
120         (WebCore::Editor::pasteAsPlainText):
121         (WebCore::Editor::pasteAsFragment):
122         (WebCore::Editor::setComposition):
123         * html/HTMLDocument.cpp:
124         (WebCore::HTMLDocument::namedItem):
125         * html/HTMLDocument.h:
126         * html/HTMLDocument.idl:
127         * html/HTMLFrameElement.idl:
128         * html/HTMLFrameOwnerElement.cpp:
129         (WebCore::HTMLFrameOwnerElement::contentWindow const):
130         * html/HTMLFrameOwnerElement.h:
131         * html/HTMLFrameSetElement.cpp:
132         (WebCore::HTMLFrameSetElement::namedItem):
133         * html/HTMLFrameSetElement.h:
134         * html/HTMLFrameSetElement.idl:
135         * html/HTMLIFrameElement.idl:
136         * html/ImageDocument.cpp:
137         * page/DOMWindow.cpp:
138         (WebCore::PostMessageTimer::PostMessageTimer):
139         (WebCore::PostMessageTimer::event):
140         (WebCore::DOMWindow::postMessage):
141         * page/DragController.cpp:
142         (WebCore::DragController::dispatchTextInputEventFor):
143         * page/EventHandler.cpp:
144         (WebCore::EventHandler::handleTextInputEvent):
145
146 2018-04-27  Nan Wang  <n_wang@apple.com>
147
148         AX: Accessibility needs to know which part of the content view is visible on iOS
149         https://bugs.webkit.org/show_bug.cgi?id=185085
150         <rdar://problem/39801363>
151
152         Reviewed by Chris Fleizach.
153
154         Exposed unobscuredContentRect() to iOS accessibility object wrapper.
155
156         Test: accessibility/ios-simulator/unobscured-content-rect.html
157
158         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
159         (-[WebAccessibilityObjectWrapper accessibilityVisibleContentRect]):
160
161 2018-04-27  Simon Fraser  <simon.fraser@apple.com>
162
163         Refactor filter list checking code
164         https://bugs.webkit.org/show_bug.cgi?id=185087
165
166         Reviewed by Alan Bujtas.
167
168         Deduplicate code between filter and backdrop-filter for checking whether function lists
169         match, by making a shared function that takes a std::function.
170         
171         The call sites have to declare the return type (-> const FilterOperations&) to avoid std::function
172         converting the return type into a value.
173
174         * animation/KeyframeEffectReadOnly.cpp:
175         (WebCore::KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists const):
176         (WebCore::KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists):
177         (WebCore::KeyframeEffectReadOnly::checkForMatchingBackdropFilterFunctionLists):
178         * animation/KeyframeEffectReadOnly.h:
179         * page/animation/KeyframeAnimation.cpp:
180         (WebCore::KeyframeAnimation::checkForMatchingFilterFunctionLists const):
181         (WebCore::KeyframeAnimation::checkForMatchingFilterFunctionLists):
182         (WebCore::KeyframeAnimation::checkForMatchingBackdropFilterFunctionLists):
183         * page/animation/KeyframeAnimation.h:
184
185 2018-04-27  Chris Dumez  <cdumez@apple.com>
186
187         Regression(r222392?): Events can have a negative timestamp which causes app breakage
188         https://bugs.webkit.org/show_bug.cgi?id=185040
189         <rdar://problem/39638051>
190
191         Reviewed by Wenson Hsieh.
192
193         The real fix is in UIKit when generating the touch timestamps. However, this patch
194         does some hardening to make sure that Event.timestamp can never return a negative
195         value even if something goes wrong.
196
197         * dom/Event.cpp:
198         (WebCore::Event::timeStampForBindings const):
199
200 2018-04-27  Christopher Reid  <chris.reid@sony.com>
201
202         URL::appendEncodedHostName is using the deprecated uidna_IDNToASCII function
203         https://bugs.webkit.org/show_bug.cgi?id=184836
204
205         Reviewed by Alex Christensen.
206
207         Update URL::appendEncodedHostName to use uidna_nameToASCII as done in r208902.
208
209         Test: LayoutTests\fast\url\url-hostname-encoding.html
210
211         * platform/URL.cpp:
212
213 2018-04-27  Youenn Fablet  <youenn@apple.com>
214
215         CachedRawResource is not handling incremental data computation correctly
216         https://bugs.webkit.org/show_bug.cgi?id=184936
217         <rdar://problem/38798141>
218
219         Reviewed by Darin Adler.
220
221         * loader/cache/CachedRawResource.cpp:
222         (WebCore::CachedRawResource::updateBuffer): Fixing style.
223
224 2018-04-27  Zalan Bujtas  <zalan@apple.com>
225
226         [LFC] Implement BlockFormattingContext::layout logic and its dependencies
227         https://bugs.webkit.org/show_bug.cgi?id=185024
228
229         Reviewed by Antti Koivisto.
230
231         This patch implements the logic for block formatting context according to
232         https://www.w3.org/TR/CSS22/visuren.html#block-formatting
233
234         1. Traverse the tree iteratively (in post-order fashion) and compute the width/static position for the containers as
235         we visit the descendant nodes until we hit a leaf node.
236         2. Compute the position/geometry of the leaf node and move over to its sibling(s).
237         3. Finalize the container's height/final position as we climb back on the tree.
238         4. Run layout on the out-of-flow descendants.  
239
240         Note that subtrees with a formatting context root need to be laid out completely before moving on to the next box.
241         The formatting root box is laid out in the formatting context it lives in, however its descendants get laid out
242         in a separate formatting context (excluding out-of-flow boxes that don't belong to the root). 
243
244         * layout/FloatingContext.cpp:
245         (WebCore::Layout::FloatingContext::FloatingContext):
246         (WebCore::Layout::FloatingContext::computePosition):
247         * layout/FormattingContext.cpp:
248         (WebCore::Layout::FormattingContext::placeInFlowPositionedChildren const):
249         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
250         * layout/FormattingContext.h:
251         * layout/LayoutContext.cpp:
252         (WebCore::Layout::LayoutContext::updateLayout):
253         (WebCore::Layout::LayoutContext::establishedFormattingState):
254         * layout/LayoutContext.h:
255         * layout/blockformatting/BlockFormattingContext.cpp:
256         (WebCore::Layout::BlockFormattingContext::layout const):
257         (WebCore::Layout::BlockFormattingContext::layout): Deleted.
258         * layout/blockformatting/BlockFormattingContext.h:
259         * layout/inlineformatting/InlineFormattingContext.cpp:
260         (WebCore::Layout::InlineFormattingContext::layout const):
261         (WebCore::Layout::InlineFormattingContext::layout): Deleted.
262         * layout/inlineformatting/InlineFormattingContext.h:
263
264 2018-04-27  Youenn Fablet  <youenn@apple.com>
265
266         Use NetworkLoadChecker for XHR/fetch loads
267         https://bugs.webkit.org/show_bug.cgi?id=184741
268
269         Reviewed by Chris Dumez.
270
271         Covered by existing tests.
272
273         * loader/DocumentThreadableLoader.cpp:
274         (WebCore::DocumentThreadableLoader::shouldSetHTTPHeadersToKeep const):
275         We need to set this option for CORS done in NetworkProcess.
276         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
277         Set httpHeadersTokeep when needed (service worker or CORS loads).
278         Remove the synchronous disabling of preflight since this is now also done for asynchronous loads.
279         (WebCore::DocumentThreadableLoader::checkURLSchemeAsCORSEnabled):
280         Helper routine to make the same check for both simple and preflight case.
281         This allows more consistent error logging between WK1 and WK2.
282         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
283         Skip preflight in case this is done in NetworkProcess.
284         (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):
285         (WebCore::isResponseComingFromNetworkProcess):
286         (WebCore::DocumentThreadableLoader::redirectReceived):
287         Bypass security checks when they are already done in NetworkProcess.
288         (WebCore::DocumentThreadableLoader::didFail):
289         In case of AccessControl error, it might be due to a CSP check done in NetworkProcess.
290         Check it again to enable specific CSP console logging and error reporting.
291         (WebCore::DocumentThreadableLoader::loadRequest):
292         Recreating the error in case of synchronous loads to be able to log it adequately.
293         (WebCore::DocumentThreadableLoader::isDoingSecurityChecksInNetworkProcess const):
294         * loader/DocumentThreadableLoader.h:
295         * loader/SubresourceLoader.cpp:
296         (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl):
297         Specific handling of SameOrigin credential mode for which cross-origin load will not use any credential.
298         (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl):
299         We keep the application headers so that DocumentThreadableLoader does not have to restart a brand new load.
300         * loader/cache/CachedResourceLoader.cpp:
301         (WebCore::CachedResourceLoader::requestResource):
302         DocumentThreadableLoader is setting referrer and origin directly. Until we fix that, we remove them from the original requests
303         as applications are not supposed to set these headers.
304
305 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
306
307         Add an experimental feature flag for viewport "min-device-width"
308         https://bugs.webkit.org/show_bug.cgi?id=185050
309         <rdar://problem/39624038>
310
311         Reviewed by Tim Horton.
312
313         Add MinDeviceWidthEnabled as a new runtime-enabled feature.
314
315         * dom/ViewportArguments.cpp:
316         (WebCore::setViewportFeature):
317
318         Gate the parsing of "min-device-width" on the runtime-enabled feature being flipped on.
319
320         * page/RuntimeEnabledFeatures.h:
321         (WebCore::RuntimeEnabledFeatures::setMinDeviceWidthEnabled):
322         (WebCore::RuntimeEnabledFeatures::minDeviceWidthEnabled const):
323
324 2018-04-27  Simon Fraser  <simon.fraser@apple.com>
325
326         Make color-filter transform gradient colors
327         https://bugs.webkit.org/show_bug.cgi?id=185080
328
329         Reviewed by Zalan Bujtas.
330         
331         In CSSGradientValue::computeStops(), transform the color of each gradient color
332         stop through the color filter. Having a color filter makes the gradient uncacheable.
333         
334         Color filters can add alpha, so we also have to fix up CSSGradientValue::knownToBeOpaque()
335         to take a RenderStyle and convert the colors before testing opaqueness. Clean up some related
336         functions to take const RenderStyle&.
337
338         Test: css3/color-filters/color-filter-gradients.html
339
340         * css/CSSCrossfadeValue.cpp:
341         (WebCore::subimageKnownToBeOpaque):
342         * css/CSSFilterImageValue.cpp:
343         (WebCore::CSSFilterImageValue::knownToBeOpaque const):
344         * css/CSSFilterImageValue.h:
345         * css/CSSGradientValue.cpp:
346         (WebCore::CSSGradientValue::image):
347         (WebCore::CSSGradientValue::computeStops):
348         (WebCore::CSSGradientValue::knownToBeOpaque const):
349         (WebCore::CSSLinearGradientValue::createGradient):
350         (WebCore::CSSRadialGradientValue::createGradient):
351         * css/CSSGradientValue.h:
352         * css/CSSImageGeneratorValue.cpp:
353         (WebCore::CSSImageGeneratorValue::knownToBeOpaque const):
354         * css/CSSImageValue.cpp:
355         (WebCore::CSSImageValue::knownToBeOpaque const):
356         * css/CSSImageValue.h:
357
358 2018-04-26  Simon Fraser  <simon.fraser@apple.com>
359
360         Fix color-filter to apply to text decorations
361         https://bugs.webkit.org/show_bug.cgi?id=185068
362         <rdar://problem/39782136>
363
364         Reviewed by Alan Bujtas.
365         
366         Transform the colors of text shadows, and the shadows of text-decorations through
367         the color-filter.
368         
369         Rather than clone the ShadowData stored on TextPainter and TextDecorationPainter
370         (which would have awkward ownership implications) we pass the color filters through
371         and just map the color through it before painting.
372         
373         Re-order the members of TextPainter a little to optimize padding.
374         
375         Also fix a bug where FilterOperations::transformColor() could transform an invalid
376         color to a valid one; we never want this.
377
378         Tests: css3/color-filters/color-filter-text-decoration-shadow.html
379                css3/color-filters/color-filter-text-shadow.html
380
381         * platform/graphics/filters/FilterOperations.cpp:
382         (WebCore::FilterOperations::transformColor const):
383         * rendering/InlineTextBox.cpp:
384         (WebCore::InlineTextBox::paintMarkedTextForeground):
385         (WebCore::InlineTextBox::paintMarkedTextDecoration):
386         * rendering/TextDecorationPainter.cpp:
387         (WebCore::TextDecorationPainter::paintTextDecoration):
388         * rendering/TextDecorationPainter.h:
389         (WebCore::TextDecorationPainter::setTextShadow):
390         (WebCore::TextDecorationPainter::setShadowColorFilter):
391         (WebCore::TextDecorationPainter::addTextShadow): Deleted.
392         * rendering/TextPainter.cpp:
393         (WebCore::ShadowApplier::ShadowApplier):
394         (WebCore::TextPainter::paintTextWithShadows):
395         (WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded): Simplify the logic that only paints the shadow
396         on the first iteration.
397         (WebCore::TextPainter::paintRange):
398         * rendering/TextPainter.h:
399         (WebCore::TextPainter::setShadowColorFilter):
400         * rendering/svg/SVGInlineTextBox.cpp:
401         (WebCore::SVGInlineTextBox::paintTextWithShadows):
402
403 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
404
405         Rename minimumLayoutSize to viewLayoutSize
406         https://bugs.webkit.org/show_bug.cgi?id=185050
407         <rdar://problem/39624038>
408
409         Reviewed by Tim Horton.
410
411         See WebKit/ChangeLog for more information. No change in behavior.
412
413         * page/ViewportConfiguration.cpp:
414         (WebCore::ViewportConfiguration::ViewportConfiguration):
415         (WebCore::ViewportConfiguration::setViewLayoutSize):
416
417         Remove a FIXME comment that is addressed by this refactoring.
418
419         (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthWithMinDeviceWidth const):
420         (WebCore::ViewportConfiguration::initialScaleFromSize const):
421         (WebCore::ViewportConfiguration::minimumScale const):
422         (WebCore::ViewportConfiguration::updateMinimumLayoutSize):
423         (WebCore::ViewportConfiguration::setMinimumLayoutSize): Deleted.
424         * page/ViewportConfiguration.h:
425         (WebCore::ViewportConfiguration::viewLayoutSize const):
426         (WebCore::ViewportConfiguration::viewSize const): Deleted.
427
428 2018-04-27  Zalan Bujtas  <zalan@apple.com>
429
430         [LFC] Formatting contexts should create floating states.
431         https://bugs.webkit.org/show_bug.cgi?id=185032
432
433         Reviewed by Antti Koivisto.
434
435         This patch implements the logic for sharing floating states across multiple formatting contexts.
436         At this point this is mostly about inline formatting contexts. They either create a new floating state
437         or inherit it from the parent formatting context.
438
439         * layout/FloatingState.cpp:
440         (WebCore::Layout::FloatingState::FloatingState):
441         * layout/FloatingState.h:
442         (WebCore::Layout::FloatingState::create):
443         * layout/FormattingContext.cpp:
444         (WebCore::Layout::FormattingContext::FormattingContext):
445         * layout/FormattingContext.h:
446         (WebCore::Layout::FormattingContext::layoutContext const):
447         * layout/FormattingState.cpp:
448         (WebCore::Layout::FormattingState::FormattingState):
449         * layout/FormattingState.h:
450         (WebCore::Layout::FormattingState::floatingState const):
451         * layout/LayoutContext.cpp:
452         (WebCore::Layout::LayoutContext::updateLayout):
453         (WebCore::Layout::LayoutContext::formattingStateForBox const):
454         (WebCore::Layout::LayoutContext::establishedFormattingState):
455         (WebCore::Layout::LayoutContext::formattingContext):
456         (WebCore::Layout::LayoutContext::formattingState): Deleted.
457         * layout/LayoutContext.h:
458         * layout/blockformatting/BlockFormattingContext.cpp:
459         (WebCore::Layout::BlockFormattingContext::BlockFormattingContext):
460         (WebCore::Layout::BlockFormattingContext::createFormattingState const):
461         (WebCore::Layout::BlockFormattingContext::createOrFindFloatingState const):
462         (WebCore::Layout::BlockFormattingContext::formattingState const): Deleted.
463         * layout/blockformatting/BlockFormattingContext.h:
464         * layout/blockformatting/BlockFormattingState.cpp:
465         (WebCore::Layout::BlockFormattingState::BlockFormattingState):
466         * layout/blockformatting/BlockFormattingState.h:
467         * layout/inlineformatting/InlineFormattingContext.cpp:
468         (WebCore::Layout::InlineFormattingContext::InlineFormattingContext):
469         (WebCore::Layout::InlineFormattingContext::createFormattingState const):
470         (WebCore::Layout::InlineFormattingContext::createOrFindFloatingState const):
471         (WebCore::Layout::InlineFormattingContext::formattingState const): Deleted.
472         * layout/inlineformatting/InlineFormattingContext.h:
473         * layout/inlineformatting/InlineFormattingState.cpp:
474         (WebCore::Layout::InlineFormattingState::InlineFormattingState):
475         * layout/inlineformatting/InlineFormattingState.h:
476         * layout/layouttree/LayoutBox.cpp:
477         (WebCore::Layout::Box::formattingContextRoot const):
478         * layout/layouttree/LayoutBox.h:
479
480 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
481
482         [Extra zoom mode] Add a mechanism to override default viewport behaviors in extra zoom mode
483         https://bugs.webkit.org/show_bug.cgi?id=185050
484         <rdar://problem/39624038>
485
486         Reviewed by Tim Horton.
487
488         Currently, in extra zoom mode, there's no way for web pages to opt out of the default viewport behaviors
489         (namely, laying out at a larger width and shrinking to fit) when the web view is very tall and narrow. This
490         patch adds a new experimental viewport attribute, "min-device-width", that can be used to prevent WebKit from
491         automatically clamping the web view width to a greater value for the device width in this scenario.
492
493         Note that after this patch, logic that plumbs a minimumLayoutSize from WKWebView to the viewport configuration
494         will need to be renamed to reflect that this size is no longer the minimum layout size, but rather, the view
495         size that is used for viewport device dimensions by default. This refactoring will be done in a followup part.
496
497         See per-method comments below for more detail.
498
499         Test: fast/viewport/extrazoom/viewport-change-min-device-width.html
500
501         * dom/ViewportArguments.cpp:
502         (WebCore::setViewportFeature):
503         (WebCore::operator<<):
504         * dom/ViewportArguments.h:
505
506         Removes `m_forceHorizontalShrinkToFit` (more detail below).
507
508         * page/ViewportConfiguration.cpp:
509         (WebCore::computedMinDeviceWidth):
510         (WebCore::ViewportConfiguration::ViewportConfiguration):
511         (WebCore::ViewportConfiguration::setMinimumLayoutSize):
512
513         Instead of directly setting the minimum layout size, setMinimumLayoutSize now first sets the view size (i.e. the
514         size we use for `device-width` in the viewport meta tag), and then updates the minimum layout size.
515
516         (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthWithMinDeviceWidth const):
517
518         Replaces `m_forceHorizontalShrinkToFit`. Whether or not we shrink to fit is now determined by whether the
519         min-device-width attribute is actively clamping the width of the view.
520
521         (WebCore::ViewportConfiguration::shouldIgnoreHorizontalScalingConstraints const):
522         (WebCore::ViewportConfiguration::shouldIgnoreScalingConstraintsRegardlessOfContentSize const):
523         (WebCore::ViewportConfiguration::updateMinimumLayoutSize):
524
525         Computes and sets the minimum layout size using the view size, taking the minimum device width into account if
526         needed.
527
528         (WebCore::ViewportConfiguration::description const):
529         (WebCore::ViewportConfiguration::setForceHorizontalShrinkToFit): Deleted.
530         * page/ViewportConfiguration.h:
531
532 2018-04-27  Zalan Bujtas  <zalan@apple.com>
533
534         [LFC] Formatting contexts should take const Box&
535         https://bugs.webkit.org/show_bug.cgi?id=185031
536
537         Reviewed by Sam Weinig.
538
539         The formatting root boxes are supposed to be all const. The only reason why
540         they are not is because WeakPtr<> does not support const objects yet.
541         Use const_cast instead (remove it when WeakPtr<> gains const support).
542
543         * layout/FormattingContext.cpp:
544         (WebCore::Layout::FormattingContext::FormattingContext):
545         * layout/FormattingContext.h:
546         * layout/LayoutContext.cpp:
547         (WebCore::Layout::LayoutContext::LayoutContext):
548         (WebCore::Layout::LayoutContext::formattingContext):
549         * layout/LayoutContext.h:
550         * layout/blockformatting/BlockFormattingContext.cpp:
551         (WebCore::Layout::BlockFormattingContext::BlockFormattingContext):
552         * layout/blockformatting/BlockFormattingContext.h:
553         * layout/inlineformatting/InlineFormattingContext.cpp:
554         (WebCore::Layout::InlineFormattingContext::InlineFormattingContext):
555         * layout/inlineformatting/InlineFormattingContext.h:
556
557 2018-04-27  Zalan Bujtas  <zalan@apple.com>
558
559         [LFC] Add layout tree iterators.
560         https://bugs.webkit.org/show_bug.cgi?id=185058
561
562         Reviewed by Antti Koivisto.
563
564         They work exactly like the renderer tree iterators.
565
566         * WebCore.xcodeproj/project.pbxproj:
567         * layout/layouttree/LayoutAncestorIterator.h: Added.
568         (WebCore::Layout::LayoutAncestorIterator<T>::LayoutAncestorIterator):
569         (WebCore::Layout::LayoutAncestorIterator<T>::operator):
570         (WebCore::Layout::LayoutAncestorIteratorAdapter<T>::LayoutAncestorIteratorAdapter):
571         (WebCore::Layout::LayoutAncestorIteratorAdapter<T>::begin const):
572         (WebCore::Layout::LayoutAncestorIteratorAdapter<T>::end const):
573         (WebCore::Layout::LayoutAncestorIteratorAdapter<T>::first const):
574         (WebCore::Layout::ancestorsOfType):
575         (WebCore::Layout::lineageOfType):
576         * layout/layouttree/LayoutBox.cpp:
577         * layout/layouttree/LayoutChildIterator.h: Added.
578         (WebCore::Layout::LayoutChildtIterator<T>::LayoutChildtIterator):
579         (WebCore::Layout::LayoutChildtIterator<T>::operator):
580         (WebCore::Layout::LayoutChildtIteratorAdapter<T>::LayoutChildtIteratorAdapter):
581         (WebCore::Layout::LayoutChildtIteratorAdapter<T>::begin const):
582         (WebCore::Layout::LayoutChildtIteratorAdapter<T>::end const):
583         (WebCore::Layout::LayoutChildtIteratorAdapter<T>::first const):
584         (WebCore::Layout::LayoutChildtIteratorAdapter<T>::last const):
585         (WebCore::Layout::childrenOfType):
586         * layout/layouttree/LayoutIterator.h: Added.
587         (WebCore::Layout::isLayoutBoxOfType):
588         (WebCore::Layout::Traversal::firstChild):
589         (WebCore::Layout::Traversal::lastChild):
590         (WebCore::Layout::Traversal::nextSibling):
591         (WebCore::Layout::Traversal::previousSibling):
592         (WebCore::Layout::Traversal::findAncestorOfType):
593         (WebCore::Layout::Traversal::nextAncestorSibling):
594         (WebCore::Layout::Traversal::nextWithin):
595         (WebCore::Layout::Traversal::firstWithin):
596         (WebCore::Layout::Traversal::next):
597         (WebCore::Layout::LayoutIterator<T>::LayoutIterator):
598         (WebCore::Layout::LayoutIterator<T>::traverseNextSibling):
599         (WebCore::Layout::LayoutIterator<T>::traverseNext):
600         (WebCore::Layout::LayoutIterator<T>::traversePreviousSibling):
601         (WebCore::Layout::LayoutIterator<T>::traverseAncestor):
602         (WebCore::Layout::LayoutIterator<T>::operator const):
603         (WebCore::Layout:: const):
604         (WebCore::Layout::= const):
605
606 2018-04-27  Commit Queue  <commit-queue@webkit.org>
607
608         Unreviewed, rolling out r231089.
609         https://bugs.webkit.org/show_bug.cgi?id=185071
610
611         Broke and made crash some WPE EME tests (Requested by calvaris
612         on #webkit).
613
614         Reverted changeset:
615
616         "[EME][GStreamer] Move the decryptor from AppendPipeline to
617         PlaybackPipeline."
618         https://bugs.webkit.org/show_bug.cgi?id=181855
619         https://trac.webkit.org/changeset/231089
620
621 2018-04-27  Yacine Bandou  <yacine.bandou_ext@softathome.com>
622
623         [EME][GStreamer] Move the decryptor from AppendPipeline to PlaybackPipeline.
624         https://bugs.webkit.org/show_bug.cgi?id=181855
625
626         Reviewed by Xabier Rodriguez-Calvar.
627
628         The goal of this move is to handle the limitation of SVP (Secure Video Path) memory size.
629
630         When the decryptor is in the AppendPipeline and we use SVP, we buffer in MediaSource queue
631         the decrypted GstBuffers that are in SVP memory.
632         This behavior cause an out-of-memory error, because we are limited in SVP memory size.
633
634         By moving the decryptor in PlaybackPipeline, we avoid to buffer the decrypted GstBuffers
635         which use the SVP memory and we buffer the encrypted GstBuffers that are in system memory.
636
637         This new architecture also allows to start the buffering before obtaining the DRM license
638         and it makes easier to manage dynamic change of the license or Key.
639
640         The decryptor is auto plugged by GStreamer playbin in PlaybackPipeline.
641
642         SVP: Secure Video Path also named trusted or protected video path, it is a memory which is
643         protected by a hardware access control engine, it is not accessible to other unauthorised
644         software or hardware components.
645
646         Tests:
647             media/encrypted-media/clearKey/clearKey-cenc-audio-playback-mse.html
648             media/encrypted-media/clearKey/clearKey-cenc-video-playback-mse.html
649
650         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
651         (webkitMediaCommonEncryptionDecryptSinkEventHandler):
652         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
653         (WebCore::dumpAppendState):
654         (WebCore::AppendPipeline::AppendPipeline):
655         (WebCore::AppendPipeline::handleNeedContextSyncMessage):
656         (WebCore::AppendPipeline::handleAppsrcNeedDataReceived):
657         (WebCore::AppendPipeline::setAppendState):
658         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
659         (WebCore::AppendPipeline::appsinkNewSample):
660         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
661         (WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread):
662         (WebCore::appendPipelineElementMessageCallback): Deleted.
663         (WebCore::AppendPipeline::handleElementMessage): Deleted.
664         (WebCore::AppendPipeline::dispatchPendingDecryptionStructure): Deleted.
665         (WebCore::AppendPipeline::dispatchDecryptionStructure): Deleted.
666         * platform/graphics/gstreamer/mse/AppendPipeline.h:
667         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
668         (WebCore::MediaPlayerPrivateGStreamerMSE::attemptToDecryptWithInstance):
669         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
670
671 2018-04-27  Yacine Bandou  <yacine.bandou_ext@softathome.com>
672
673         [EME][GStreamer] Add a new message "decrypt-key-needed" send from the decryptor to the application.
674         https://bugs.webkit.org/show_bug.cgi?id=181858
675
676         Reviewed by Xabier Rodriguez-Calvar.
677
678         Add a new message "decrypt-key-needed" that the decryptor can send when it doesn't have an available key.
679         This message should be handled by the application in order to dispatch or send the key to the decryptor.
680         This patch is a preparation for the patch 181855.
681         With the patch 181855, the decryptor will be in the PlaybackPipeline instead of AppendPipeline, thus we can
682         get the DRM license or key before to instantiate or load the decryptor plugin in PlaybackPipeline.
683         When the decryptor plugin is instantiated or loaded, it should able to ask the application to resend
684         the DRM license or key by using this new message "decrypt-key-needed".
685
686
687         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
688         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
689         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
690         (WebCore::MediaPlayerPrivateGStreamerBase::dispatchCDMInstance):
691         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
692         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
693         (webkitMediaCommonEncryptionDecryptTransformInPlace):
694
695 2018-04-26  Justin Fan  <justin_fan@apple.com>
696
697         tex[Sub]Image2D slow when passing in a <canvas>, faster with ImageData.
698         https://bugs.webkit.org/show_bug.cgi?id=184843
699         <rdar://problem/34898868>
700
701         Reviewed by Simon Fraser.
702
703         On certain test pages passing 2d canvas objects to gl.texSubImage2D, we spend significant time doing an alpha unpremultiplication in FormatConverter::convert on a single thread. 
704         For now, I am introducing use of the Accelerate framework to do canvas alpha unpremultiplication, specifically for RGBA8 > RGBA8.
705         This improves this rendering path by a factor of ~4. The rest of FormatConverter could use similar improvements; filed https://bugs.webkit.org/show_bug.cgi?id=185064 for these. 
706
707         * platform/graphics/FormatConverter.cpp:
708         (WebCore::FormatConverter::convert):
709
710 2018-04-26  Simon Fraser  <simon.fraser@apple.com>
711
712         Implement rendering support for the color-filter CSS property
713         https://bugs.webkit.org/show_bug.cgi?id=185047
714         rdar://problem/39664967
715
716         Reviewed by Tim Horton.
717         
718         The color-filter property transforms CSS colors just before painting. To support this,
719         add to RenderStyle colorByApplyingColorFilter() and visitedDependentColorWithColorFilter().
720         At most calls sites that transform colors for rendering, replace calls to
721         visitedDependentColor() with visitedDependentColorWithColorFilter(). The few locations
722         that don't use visitedDependentColor() (e.g. for shadows) call colorByApplyingColorFilter().
723         
724         Color transformation is implemented via a new virtual function on FilterOperation;
725         BasicColorMatrixFilterOperation overrides this to use a new ColorMatrix class to
726         do color math, and BasicComponentTransferFilterOperation to do the equivalent of component
727         transfer operations. The math in both cases matches that for SVG filters, with the exception
728         that color components are stored as floats through multiple filters and then mapped to
729         normal 0-255 color components at the end.
730
731         Tests: css3/color-filters/color-filter-backgrounds-borders.html
732                css3/color-filters/color-filter-box-shadow.html
733                css3/color-filters/color-filter-brightness.html
734                css3/color-filters/color-filter-color-property-list-item.html
735                css3/color-filters/color-filter-color-property.html
736                css3/color-filters/color-filter-color-text-decorations.html
737                css3/color-filters/color-filter-column-rule.html
738                css3/color-filters/color-filter-contrast.html
739                css3/color-filters/color-filter-current-color.html
740                css3/color-filters/color-filter-filter-list.html
741                css3/color-filters/color-filter-grayscale.html
742                css3/color-filters/color-filter-hue-rotate.html
743                css3/color-filters/color-filter-inherits.html
744                css3/color-filters/color-filter-invert.html
745                css3/color-filters/color-filter-opacity.html
746                css3/color-filters/color-filter-outline.html
747                css3/color-filters/color-filter-saturate.html
748                css3/color-filters/color-filter-sepia.html
749                css3/color-filters/color-filter-text-emphasis.html
750
751         * html/HTMLTextFormControlElement.cpp:
752         (WebCore::HTMLTextFormControlElement::adjustInnerTextStyle const):
753         * page/FrameView.cpp:
754         (WebCore::FrameView::documentBackgroundColor const):
755         * platform/graphics/ColorUtilities.cpp:
756         (WebCore::ColorMatrix::ColorMatrix):
757         (WebCore::ColorMatrix::makeIdentity):
758         (WebCore::ColorMatrix::grayscaleMatrix):
759         (WebCore::ColorMatrix::saturationMatrix):
760         (WebCore::ColorMatrix::hueRotateMatrix):
761         (WebCore::ColorMatrix::sepiaMatrix):
762         (WebCore::ColorMatrix::transformColorComponents const):
763         * platform/graphics/ColorUtilities.h:
764         * platform/graphics/filters/FilterOperation.cpp:
765         (WebCore::BasicColorMatrixFilterOperation::transformColor const):
766         (WebCore::BasicComponentTransferFilterOperation::transformColor const):
767         * platform/graphics/filters/FilterOperation.h:
768         (WebCore::FilterOperation::transformColor const):
769         * platform/graphics/filters/FilterOperations.cpp:
770         (WebCore::FilterOperations::transformColor const):
771         * platform/graphics/filters/FilterOperations.h:
772         * rendering/BorderEdge.cpp:
773         (WebCore::BorderEdge::getBorderEdgeInfo):
774         * rendering/EllipsisBox.cpp:
775         (WebCore::EllipsisBox::paint):
776         (WebCore::EllipsisBox::paintSelection):
777         * rendering/InlineFlowBox.cpp:
778         (WebCore::InlineFlowBox::paintBoxDecorations):
779         * rendering/InlineTextBox.cpp:
780         (WebCore::InlineTextBox::paintMarkedTextForeground):
781         (WebCore::InlineTextBox::paintMarkedTextDecoration):
782         (WebCore::InlineTextBox::paintCompositionUnderline const):
783         * rendering/RenderBox.cpp:
784         (WebCore::RenderBox::paintRootBoxFillLayers):
785         (WebCore::RenderBox::paintBackground):
786         (WebCore::RenderBox::getBackgroundPaintedExtent const):
787         (WebCore::RenderBox::backgroundIsKnownToBeOpaqueInRect const):
788         (WebCore::RenderBox::backgroundHasOpaqueTopLayer const):
789         * rendering/RenderBoxModelObject.cpp:
790         (WebCore::applyBoxShadowForBackground):
791         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
792         (WebCore::RenderBoxModelObject::boxShadowShouldBeAppliedToBackground const):
793         (WebCore::RenderBoxModelObject::paintBoxShadow):
794         * rendering/RenderDetailsMarker.cpp:
795         (WebCore::RenderDetailsMarker::paint):
796         * rendering/RenderElement.cpp:
797         (WebCore::RenderElement::selectionColor const):
798         (WebCore::RenderElement::selectionBackgroundColor const):
799         (WebCore::RenderElement::paintFocusRing):
800         (WebCore::RenderElement::paintOutline):
801         * rendering/RenderFileUploadControl.cpp:
802         (WebCore::RenderFileUploadControl::paintObject):
803         * rendering/RenderFrameSet.cpp:
804         (WebCore::RenderFrameSet::paintColumnBorder):
805         (WebCore::RenderFrameSet::paintRowBorder):
806         * rendering/RenderImage.cpp:
807         (WebCore::RenderImage::paintReplaced):
808         (WebCore::RenderImage::paintAreaElementFocusRing):
809         * rendering/RenderInline.cpp:
810         (WebCore::RenderInline::paintOutline):
811         * rendering/RenderLayerBacking.cpp:
812         (WebCore::canDirectlyCompositeBackgroundBackgroundImage):
813         (WebCore::RenderLayerBacking::rendererBackgroundColor const):
814         * rendering/RenderLayerCompositor.cpp:
815         (WebCore::RenderLayerCompositor::rootOrBodyStyleChanged):
816         * rendering/RenderListBox.cpp:
817         (WebCore::RenderListBox::paintItemForeground):
818         (WebCore::RenderListBox::paintItemBackground):
819         * rendering/RenderListMarker.cpp:
820         (WebCore::RenderListMarker::paint):
821         * rendering/RenderMenuList.cpp:
822         (RenderMenuList::itemStyle const):
823         (RenderMenuList::getItemBackgroundColor const):
824         (RenderMenuList::menuStyle const):
825         * rendering/RenderMultiColumnSet.cpp:
826         (WebCore::RenderMultiColumnSet::paintColumnRules):
827         * rendering/RenderSearchField.cpp:
828         (WebCore::RenderSearchField::menuStyle const):
829         * rendering/RenderTable.h:
830         (WebCore::RenderTable::bgColor const):
831         * rendering/RenderTableCell.cpp:
832         (WebCore::RenderTableCell::computeCollapsedStartBorder const):
833         (WebCore::RenderTableCell::computeCollapsedEndBorder const):
834         (WebCore::RenderTableCell::computeCollapsedBeforeBorder const):
835         (WebCore::RenderTableCell::computeCollapsedAfterBorder const):
836         (WebCore::RenderTableCell::paintBackgroundsBehindCell):
837         * rendering/RenderTableSection.cpp:
838         (WebCore::RenderTableSection::paintRowGroupBorder):
839         * rendering/RenderTheme.cpp:
840         (WebCore::RenderTheme::paintSliderTicks):
841         * rendering/TextDecorationPainter.cpp:
842         (WebCore::decorationColor):
843         * rendering/TextPaintStyle.cpp:
844         (WebCore::computeTextPaintStyle):
845         * rendering/mathml/MathOperator.cpp:
846         (WebCore::MathOperator::paint):
847         * rendering/mathml/RenderMathMLFraction.cpp:
848         (WebCore::RenderMathMLFraction::paint):
849         * rendering/mathml/RenderMathMLMenclose.cpp:
850         (WebCore::RenderMathMLMenclose::paint):
851         * rendering/mathml/RenderMathMLRoot.cpp:
852         (WebCore::RenderMathMLRoot::paint):
853         * rendering/mathml/RenderMathMLToken.cpp:
854         (WebCore::RenderMathMLToken::paint):
855         * rendering/style/RenderStyle.cpp:
856         (WebCore::RenderStyle::visitedDependentColorWithColorFilter const):
857         (WebCore::RenderStyle::colorByApplyingColorFilter const):
858         * rendering/style/RenderStyle.h:
859
860 2018-04-26  Mark Lam  <mark.lam@apple.com>
861
862         Gardening: Speculative build fix for Windows.
863         https://bugs.webkit.org/show_bug.cgi?id=184976
864         <rdar://problem/39723901>
865
866         Not reviewed.
867
868         * cssjit/CSSPtrTag.h:
869
870 2018-04-26  Brent Fulgham  <bfulgham@apple.com>
871
872         Show punycode if URL contains Latin small letter o with dot below character
873         https://bugs.webkit.org/show_bug.cgi?id=185051
874         <rdar://problem/39459297>
875
876         Reviewed by David Kilzer.
877
878         Revise our "lookalike character" logic to include the small Latin o
879         with dot below character.
880
881         Test: fast/url/host.html
882
883         * platform/mac/WebCoreNSURLExtras.mm:
884         (WebCore::isLookalikeCharacter):
885
886 2018-04-26  Daniel Bates  <dabates@apple.com>
887
888         Fix the build following r231068
889         (https://bugs.webkit.org/show_bug.cgi?id=185002)
890
891         Substitute mainResourceRequest.resourceRequest().url() for mainResourceRequest.url() as the
892         latter does not exist.
893
894         * loader/DocumentLoader.cpp:
895         (WebCore::DocumentLoader::loadMainResource):
896
897 2018-04-26  Daniel Bates  <dabates@apple.com>
898
899         DocumentLoader::loadMainResource() should WTFMove() the passed ResourceRequest
900         https://bugs.webkit.org/show_bug.cgi?id=185002
901
902         Reviewed by Youenn Fablet and Alex Christensen.
903
904         In r224852 we extracted logic from DocumentLoader::startLoadingMainResource() into a new
905         function DocumentLoader::loadMainResource() that could be shared by both DocumentLoader::startLoadingMainResource()
906         and the service worker code. As part of this extraction, DocumentLoader::loadMainResource()
907         takes a ResourceRequest by rvalue reference, but it never actually takes ownership of this
908         ResourceRequest and subsequently makes a copy of it when instantiating a CachedResourceRequest.
909         Instead we should WTFMove() the passed request into the CachedResourceRequest.
910
911         * loader/DocumentLoader.cpp:
912         (WebCore::DocumentLoader::loadMainResource):
913
914 2018-04-26  Sihui Liu  <sihui_liu@apple.com>
915
916         -[WKHTTPCookieStore deleteCookie:completionHandler:] doesn't delete cookies
917         https://bugs.webkit.org/show_bug.cgi?id=184938
918         <rdar://problem/34737395>
919
920         Reviewed by Geoffrey Garen.
921
922         When a Cookie object was converted to NSHTTPCookie object, the HTTPOnly property information
923         was lost so the delete function cannot find the proper cookie to delete.
924         This patch implements a workaround that compares Cookie object instead of NSHTTPCookie 
925         object. We might want to add the ability to set HTTPOnly header during conversion if there
926         is an easy way to do it later.
927         
928         New API test: WebKit.WKHTTPCookieStoreHttpOnly
929
930         * platform/network/cocoa/CookieCocoa.mm:
931         (WebCore::Cookie::operator== const):
932         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
933         (WebCore::NetworkStorageSession::deleteCookie):
934
935 2018-04-26  Commit Queue  <commit-queue@webkit.org>
936
937         Unreviewed, rolling out r231052.
938         https://bugs.webkit.org/show_bug.cgi?id=185044
939
940         Broke test http/tests/security/credentials-main-resource.html
941         (Requested by dydz on #webkit).
942
943         Reverted changeset:
944
945         "DocumentLoader::loadMainResource() should WTFMove() the
946         passed ResourceRequest"
947         https://bugs.webkit.org/show_bug.cgi?id=185002
948         https://trac.webkit.org/changeset/231052
949
950 2018-04-26  Jer Noble  <jer.noble@apple.com>
951
952         WK_COCOA_TOUCH all the things.
953         https://bugs.webkit.org/show_bug.cgi?id=185006
954
955         Reviewed by Tim Horton.
956
957         * Configurations/WebCore.xcconfig:
958
959 2018-04-26  David Kilzer  <ddkilzer@apple.com>
960
961         Make WAKScrollView delegate a weak property
962         <https://webkit.org/b/184799>
963         <rdar://problem/39469669>
964
965         Reviewed by Simon Fraser.
966
967         * platform/ios/wak/WAKScrollView.h:
968         - Remove `delegate` instance variable declaration.
969         - Declare `delegate` property as weak.
970         (-[WAKScrollView setDelegate:]): Delete declaration.
971         (-[WAKScrollView delegate]): Ditto.
972         * platform/ios/wak/WAKScrollView.mm:
973         - Synthesize getter/setter methods for `delegate` property.
974         (-[WAKScrollView setDelegate:]): Delete implementation.
975         (-[WAKScrollView delegate]): Ditto.
976
977 2018-04-26  Youenn Fablet  <youenn@apple.com>
978
979         CORS preflight checker should add a console message when preflight load is blocked
980         https://bugs.webkit.org/show_bug.cgi?id=185021
981
982         Reviewed by Chris Dumez.
983
984         No change of behavior, adding a JS console message when preflight load is blocked.
985         This mirrors what is being done in preflighting done from NetworkProcess.
986         Covered by existing tests.
987
988         * loader/CrossOriginPreflightChecker.cpp:
989         (WebCore::CrossOriginPreflightChecker::notifyFinished):
990         (WebCore::CrossOriginPreflightChecker::doPreflight):
991
992 2018-04-26  Daniel Bates  <dabates@apple.com>
993
994         DocumentLoader::loadMainResource() should WTFMove() the passed ResourceRequest
995         https://bugs.webkit.org/show_bug.cgi?id=185002
996
997         Reviewed by Youenn Fablet and Alex Christensen.
998
999         In r224852 we extracted logic from DocumentLoader::startLoadingMainResource() into a new
1000         function DocumentLoader::loadMainResource() that could be shared by both DocumentLoader::startLoadingMainResource()
1001         and the service worker code. As part of this extraction, DocumentLoader::loadMainResource()
1002         takes a ResourceRequest by rvalue reference, but it never actually takes ownership of this
1003         ResourceRequest and subsequently makes a copy of it when instantiating a CachedResourceRequest.
1004         Instead we should WTFMove() the passed request into the CachedResourceRequest.
1005
1006         * loader/DocumentLoader.cpp:
1007         (WebCore::DocumentLoader::loadMainResource):
1008
1009 2018-04-26  Per Arne Vollan  <pvollan@apple.com>
1010
1011         Disable content filtering in minimal simulator mode
1012         https://bugs.webkit.org/show_bug.cgi?id=185027
1013         <rdar://problem/39736091>
1014
1015         Reviewed by Jer Noble.
1016
1017         * Configurations/FeatureDefines.xcconfig:
1018
1019 2018-04-25  Brent Fulgham  <bfulgham@apple.com>
1020
1021         Add port 548 (afpovertcp) to port blacklist
1022         https://bugs.webkit.org/show_bug.cgi?id=185000
1023         <rdar://problem/39540481>
1024
1025         Reviewed by David Kilzer.
1026
1027         Tested by security/block-test.html.
1028
1029         * platform/URL.cpp:
1030         (WebCore::portAllowed):Also block port 548.
1031
1032 2018-04-26  Andy VanWagoner  <thetalecrafter@gmail.com>
1033
1034         [INTL] Implement Intl.PluralRules
1035         https://bugs.webkit.org/show_bug.cgi?id=184312
1036
1037         Reviewed by JF Bastien.
1038
1039         Added Intl.PluralRules feature flag.
1040
1041         Test: js/intl-pluralrules.html
1042
1043         * Configurations/FeatureDefines.xcconfig:
1044
1045 2018-04-15  Darin Adler  <darin@apple.com>
1046
1047         [Cocoa] Adopt CCRSAGetCRTComponents and stop using CCBigNum
1048         https://bugs.webkit.org/show_bug.cgi?id=184637
1049
1050         Reviewed by Alexey Proskuryakov.
1051
1052         * crypto/CommonCryptoUtilities.cpp: Compile out WebCore::CCBigNum class if
1053         HAVE(CCRSAGetCRTComponents) is true.
1054
1055         * crypto/CommonCryptoUtilities.h: Define HAVE(CCRSAGetCRTComponents) on new
1056         enough versions of iOS and macOS that have it and add declarations of the
1057         function for the non-Apple-internal-SDK case. Also don't define the
1058         WebCore::CCBigNum class if HAVE(CCRSAGetCRTComponents) is true.
1059
1060         * crypto/mac/CryptoKeyRSAMac.cpp:
1061         (WebCore::getPrivateKeyComponents): Use CCRSAGetCRTComponents if present.
1062
1063 2018-04-26  Per Arne Vollan  <pvollan@apple.com>
1064
1065         Add lazy initialization of caption display mode for videos.
1066         https://bugs.webkit.org/show_bug.cgi?id=184993
1067
1068         The call to MACaptionAppearanceGetDisplayType in CaptionUserPreferencesMediaAF::captionDisplayMode()
1069         is showing up in samples when called from HTMLMediaElement::finishInitialization().
1070
1071         Reviewed by Eric Carlson.
1072
1073         No new tests, covered by existing tests.
1074
1075         * html/HTMLMediaElement.cpp:
1076         (WebCore::HTMLMediaElement::finishInitialization):
1077         (WebCore::HTMLMediaElement::setSelectedTextTrack):
1078         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
1079         (WebCore::HTMLMediaElement::captionPreferencesChanged):
1080         (WebCore::HTMLMediaElement::captionDisplayMode):
1081         * html/HTMLMediaElement.h:
1082
1083 2018-04-26  Zan Dobersek  <zdobersek@igalia.com>
1084
1085         [GTK][WPE] Initial ASYNC_SCROLLING support
1086         https://bugs.webkit.org/show_bug.cgi?id=184961
1087
1088         Reviewed by Carlos Garcia Campos.
1089
1090         Add CoordinatedGraphics-specific code that will be required for async
1091         scrolling support. The ScrollingCoordinatorCoordinatedGraphics and
1092         ScrollingTreeCoordinatedGraphics classes are mostly complete already,
1093         but the new ScrollingTreeNode-inheriting classes will need further
1094         work that will have to be done in parallel with other improvements
1095         planned for the CoordinatedGraphics subsystem.
1096
1097         While the build-time flag is enabled, the feature is still not enabled
1098         at runtime due to being marked as unsupported by the DrawingArea
1099         implementation in the WebKit layer. It would also not work yet if it
1100         were enabled due to the before-mentioned pending changes.
1101
1102         Various build fixes that address non-Cocoa usage of ASYNC_SCROLLING
1103         code are included.
1104
1105         * Sources.txt: Add AsyncScrollingCoordinator.cpp to build.
1106         * SourcesCocoa.txt:
1107         * SourcesGTK.txt: Add new files to build.
1108         * SourcesWPE.txt: Ditto.
1109         * page/scrolling/AsyncScrollingCoordinator.cpp:
1110         Guard setStateScrollingNodeSnapOffsetsAsFloat() with CSS_SCROLL_SNAP.
1111         * page/scrolling/ScrollingTree.h:
1112         * page/scrolling/ThreadedScrollingTree.cpp:
1113         * page/scrolling/ThreadedScrollingTree.h:
1114         currentSnapPointIndicesDidChange() method is only invoked in
1115         Cocoa-specific code, and its implementation calls Cocoa-specific method
1116         on the AsyncScrollingCoordinator class.
1117         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp:
1118         (WebCore::ScrollingCoordinator::create):
1119         (WebCore::ScrollingCoordinatorCoordinatedGraphics::ScrollingCoordinatorCoordinatedGraphics):
1120         (WebCore::ScrollingCoordinatorCoordinatedGraphics::~ScrollingCoordinatorCoordinatedGraphics):
1121         (WebCore::ScrollingCoordinatorCoordinatedGraphics::pageDestroyed):
1122         (WebCore::ScrollingCoordinatorCoordinatedGraphics::commitTreeStateIfNeeded):
1123         (WebCore::ScrollingCoordinatorCoordinatedGraphics::handleWheelEvent):
1124         (WebCore::ScrollingCoordinatorCoordinatedGraphics::scheduleTreeStateCommit):
1125         (WebCore::ScrollingCoordinatorCoordinatedGraphics::commitTreeState):
1126         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.h: Added.
1127         * page/scrolling/coordinatedgraphics/ScrollingTreeCoordinatedGraphics.cpp: Added.
1128         (WebCore::ScrollingTreeCoordinatedGraphics::create):
1129         (WebCore::ScrollingTreeCoordinatedGraphics::ScrollingTreeCoordinatedGraphics):
1130         (WebCore::ScrollingTreeCoordinatedGraphics::createScrollingTreeNode):
1131         * page/scrolling/coordinatedgraphics/ScrollingTreeCoordinatedGraphics.h: Added.
1132         * page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.cpp: Added.
1133         (WebCore::ScrollingTreeFixedNode::create):
1134         (WebCore::ScrollingTreeFixedNode::ScrollingTreeFixedNode):
1135         (WebCore::ScrollingTreeFixedNode::~ScrollingTreeFixedNode):
1136         (WebCore::ScrollingTreeFixedNode::commitStateBeforeChildren):
1137         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange):
1138         * page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.h: Added.
1139         * page/scrolling/coordinatedgraphics/ScrollingTreeFrameScrollingNodeCoordinatedGraphics.cpp: Added.
1140         (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::create):
1141         (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::ScrollingTreeFrameScrollingNodeCoordinatedGraphics):
1142         (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::handleWheelEvent):
1143         (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::scrollPosition const):
1144         (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::setScrollPosition):
1145         (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::setScrollPositionWithoutContentEdgeConstraints):
1146         (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::setScrollLayerPosition):
1147         (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::updateLayersAfterViewportChange):
1148         * page/scrolling/coordinatedgraphics/ScrollingTreeFrameScrollingNodeCoordinatedGraphics.h: Added.
1149         * page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.cpp: Added.
1150         (WebCore::ScrollingTreeStickyNode::create):
1151         (WebCore::ScrollingTreeStickyNode::ScrollingTreeStickyNode):
1152         (WebCore::ScrollingTreeStickyNode::~ScrollingTreeStickyNode):
1153         (WebCore::ScrollingTreeStickyNode::commitStateBeforeChildren):
1154         (WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange):
1155         * page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.h: Added.
1156         * platform/PlatformWheelEvent.h: Enable PlatformWheelEventPhase code
1157         for WPE. Guard latching-specific methods under ASYNC_SCROLLING.
1158         * platform/TextureMapper.cmake: Two build targets have been moved to
1159         SourcesGTK.txt and SourcesWPE.txt.
1160
1161 2018-04-25  Michael Catanzaro  <mcatanzaro@igalia.com>
1162
1163         [WPE] Build and link against latest WPEBackend and WPEBackend-fdo
1164         https://bugs.webkit.org/show_bug.cgi?id=184643
1165
1166         Reviewed by Žan Doberšek.
1167
1168         Adapt to single-header WPE includes.
1169
1170         * platform/graphics/egl/GLContextEGLWPE.cpp:
1171         * platform/graphics/wpe/PlatformDisplayWPE.cpp:
1172         * platform/wpe/PlatformPasteboardWPE.cpp:
1173
1174 2018-04-25  Youenn Fablet  <youenn@apple.com>
1175
1176         Use NetworkLoadChecker for all subresource loads except fetch/XHR
1177         https://bugs.webkit.org/show_bug.cgi?id=184870
1178         <rdar://problem/39370034>
1179
1180         Reviewed by Chris Dumez.
1181
1182         No change of behavior.
1183         Update CachedResourceLoader error messages to match NetworkProcess error messages.
1184
1185         * loader/cache/CachedResourceLoader.cpp:
1186         (WebCore::CachedResourceLoader::printAccessDeniedMessage const):
1187
1188 2018-04-25  Zalan Bujtas  <zalan@apple.com>
1189
1190         [LFC] Add support for is<> and downcast<>
1191         https://bugs.webkit.org/show_bug.cgi?id=185016
1192
1193         Reviewed by Antti Koivisto.
1194
1195         * layout/layouttree/LayoutBlockContainer.cpp:
1196         (WebCore::Layout::BlockContainer::BlockContainer):
1197         * layout/layouttree/LayoutBlockContainer.h:
1198         * layout/layouttree/LayoutBox.cpp:
1199         (WebCore::Layout::Box::Box):
1200         * layout/layouttree/LayoutBox.h:
1201         (WebCore::Layout::Box::isContainer const):
1202         (WebCore::Layout::Box::isBlockContainer const):
1203         (WebCore::Layout::Box::isInlineBox const):
1204         (WebCore::Layout::Box::isInlineContainer const):
1205         * layout/layouttree/LayoutContainer.cpp:
1206         (WebCore::Layout::Container::Container):
1207         * layout/layouttree/LayoutContainer.h:
1208         * layout/layouttree/LayoutInlineBox.cpp:
1209         (WebCore::Layout::InlineBox::InlineBox):
1210         * layout/layouttree/LayoutInlineBox.h:
1211         * layout/layouttree/LayoutInlineContainer.cpp:
1212         (WebCore::Layout::InlineContainer::InlineContainer):
1213         * layout/layouttree/LayoutInlineContainer.h:
1214
1215 2018-04-25  Chris Dumez  <cdumez@apple.com>
1216
1217         window.postMessage() / focus() / blur() throw a TypeError when called on a RemoteDOMWindow
1218         https://bugs.webkit.org/show_bug.cgi?id=184981
1219
1220         Reviewed by Sam Weinig.
1221
1222         window.postMessage() / focus() / blur() was throwing a TypeError when called on a RemoteDOMWindow,
1223         complaining that |this| is not a Window. This was caused by a copy & paste mistake in
1224         JSDOMWindowCustom where we were calling the JSDOMWindow methods instead of the JSRemoteDOMWindow
1225         ones.
1226
1227         No new tests, updated existing tests.
1228
1229         * bindings/js/JSDOMWindowCustom.cpp:
1230         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
1231         * page/RemoteDOMWindow.cpp:
1232         (WebCore::RemoteDOMWindow::postMessage):
1233         * page/RemoteDOMWindow.h:
1234         * page/RemoteDOMWindow.idl:
1235
1236 2018-04-25  Simon Fraser  <simon.fraser@apple.com>
1237
1238         brightness() filter should default to 1, and not allow negative values
1239         https://bugs.webkit.org/show_bug.cgi?id=184937
1240
1241         Reviewed by Dean Jackson.
1242
1243         Remove the special-casing for brightness() in consumeFilterFunction(), so it now
1244         follows the same logic as the other color-related filters in not allowing negative
1245         values.
1246
1247         Removed the special-casing for brightness() in createFilterOperations() so its default
1248         value is now 1.
1249
1250         Modified existing tests.
1251
1252         * css/StyleResolver.cpp:
1253         (WebCore::StyleResolver::createFilterOperations):
1254         * css/parser/CSSPropertyParserHelpers.cpp:
1255         (WebCore::CSSPropertyParserHelpers::allowsValuesGreaterThanOne):
1256         (WebCore::CSSPropertyParserHelpers::consumeFilterFunction):
1257
1258 2018-04-25  Wenson Hsieh  <wenson_hsieh@apple.com>
1259
1260         Missing closing parenthesis when determining INSTALL_PATH build setting in WebCore.xcconfig
1261         https://bugs.webkit.org/show_bug.cgi?id=184999
1262
1263         Reviewed by Tim Horton.
1264
1265         Tweaks a line in WebCore.xcconfig that computes INSTALL_PATH, so that it doesn't use WK_NOT or WK_EMPTY.
1266
1267         * Configurations/WebCore.xcconfig:
1268
1269 2018-04-25  Zalan Bujtas  <zalan@apple.com>
1270
1271         [LFC] Implement LayoutContexet::layout() and its dependencies.
1272         https://bugs.webkit.org/show_bug.cgi?id=184951
1273
1274         Reviewed by Antti Koivisto.
1275
1276         * layout/FormattingContext.cpp:
1277         (WebCore::Layout::FormattingContext::FormattingContext):
1278         (WebCore::Layout::FormattingContext::~FormattingContext):
1279         (WebCore::Layout::FormattingContext::computeStaticPosition):
1280         (WebCore::Layout::FormattingContext::computeInFlowPositionedPosition):
1281         (WebCore::Layout::FormattingContext::computeOutOfFlowPosition):
1282         (WebCore::Layout::FormattingContext::computeWidth):
1283         (WebCore::Layout::FormattingContext::computeHeight):
1284         (WebCore::Layout::FormattingContext::marginTop):
1285         (WebCore::Layout::FormattingContext::marginLeft):
1286         (WebCore::Layout::FormattingContext::marginBottom):
1287         (WebCore::Layout::FormattingContext::marginRight):
1288         * layout/FormattingContext.h:
1289         * layout/FormattingState.cpp:
1290         (WebCore::Layout::FormattingState::FormattingState):
1291         * layout/FormattingState.h:
1292         * layout/LayoutContext.cpp:
1293         (WebCore::Layout::LayoutContext::LayoutContext):
1294         (WebCore::Layout::LayoutContext::updateLayout):
1295         (WebCore::Layout::LayoutContext::formattingState):
1296         (WebCore::Layout::LayoutContext::formattingContext):
1297         * layout/LayoutContext.h:
1298         * layout/blockformatting/BlockFormattingContext.cpp:
1299         (WebCore::Layout::BlockFormattingContext::BlockFormattingContext):
1300         (WebCore::Layout::BlockFormattingContext::layout):
1301         (WebCore::Layout::BlockFormattingContext::formattingState const):
1302         (WebCore::Layout::BlockFormattingContext::computeStaticPosition):
1303         (WebCore::Layout::BlockFormattingContext::computeWidth):
1304         (WebCore::Layout::BlockFormattingContext::computeHeight):
1305         (WebCore::Layout::BlockFormattingContext::marginTop):
1306         (WebCore::Layout::BlockFormattingContext::marginBottom):
1307         * layout/blockformatting/BlockFormattingContext.h:
1308         * layout/blockformatting/BlockFormattingState.cpp:
1309         (WebCore::Layout::BlockFormattingState::BlockFormattingState):
1310         * layout/blockformatting/BlockFormattingState.h:
1311         * layout/inlineformatting/InlineFormattingContext.cpp:
1312         (WebCore::Layout::InlineFormattingContext::InlineFormattingContext):
1313         (WebCore::Layout::InlineFormattingContext::layout):
1314         (WebCore::Layout::InlineFormattingContext::formattingState const):
1315         * layout/inlineformatting/InlineFormattingContext.h:
1316         * layout/inlineformatting/InlineFormattingState.cpp:
1317         (WebCore::Layout::InlineFormattingState::InlineFormattingState):
1318         * layout/inlineformatting/InlineFormattingState.h:
1319
1320 2018-04-25  Mark Lam  <mark.lam@apple.com>
1321
1322         Push the definition of PtrTag down to the WTF layer.
1323         https://bugs.webkit.org/show_bug.cgi?id=184976
1324         <rdar://problem/39723901>
1325
1326         Reviewed by Saam Barati.
1327
1328         No new tests needed.  This is covered by existing tests.
1329
1330         * cssjit/CSSPtrTag.h:
1331         * cssjit/SelectorCompiler.h:
1332         (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction):
1333         (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction):
1334         (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext):
1335         (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext):
1336
1337 2018-04-25  Eric Carlson  <eric.carlson@apple.com>
1338
1339         [iOS] remove media element parameter from MediaElementSession methods
1340         https://bugs.webkit.org/show_bug.cgi?id=184992
1341         <rdar://problem/39731624>
1342
1343         Reviewed by Jon Lee.
1344
1345         No new tests, no behavior change.
1346
1347         * Modules/mediacontrols/MediaControlsHost.cpp:
1348         (WebCore::MediaControlsHost::allowsInlineMediaPlayback const):
1349         (WebCore::MediaControlsHost::userGestureRequired const):
1350         * accessibility/AccessibilityMediaObject.cpp:
1351         (WebCore::AccessibilityMediaObject::isPlayingInline const):
1352         * html/HTMLMediaElement.cpp:
1353         (WebCore::HTMLMediaElement::~HTMLMediaElement):
1354         (WebCore::HTMLMediaElement::parseAttribute):
1355         (WebCore::HTMLMediaElement::prepareForLoad):
1356         (WebCore::HTMLMediaElement::selectMediaResource):
1357         (WebCore::HTMLMediaElement::loadResource):
1358         (WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay const):
1359         (WebCore::HTMLMediaElement::setReadyState):
1360         (WebCore::HTMLMediaElement::play):
1361         (WebCore::HTMLMediaElement::pause):
1362         (WebCore::HTMLMediaElement::pauseInternal):
1363         (WebCore::HTMLMediaElement::setVolume):
1364         (WebCore::HTMLMediaElement::mediaPlayerDidAddAudioTrack):
1365         (WebCore::HTMLMediaElement::sourceWasAdded):
1366         (WebCore::HTMLMediaElement::mediaEngineWasUpdated):
1367         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
1368         (WebCore::HTMLMediaElement::updatePlayState):
1369         (WebCore::HTMLMediaElement::clearMediaPlayer):
1370         (WebCore::HTMLMediaElement::resume):
1371         (WebCore::HTMLMediaElement::webkitShowPlaybackTargetPicker):
1372         (WebCore::HTMLMediaElement::addEventListener):
1373         (WebCore::HTMLMediaElement::removeEventListener):
1374         (WebCore::HTMLMediaElement::enqueuePlaybackTargetAvailabilityChangedEvent):
1375         (WebCore::HTMLMediaElement::exitFullscreen):
1376         (WebCore::HTMLMediaElement::configureMediaControls):
1377         (WebCore::HTMLMediaElement::createMediaPlayer):
1378         (WebCore::HTMLMediaElement::mediaPlayerIsFullscreenPermitted const):
1379         (WebCore::HTMLMediaElement::updateMediaState):
1380         (WebCore::HTMLMediaElement::mediaState const):
1381         (WebCore::HTMLMediaElement::allowsMediaDocumentInlinePlaybackChanged):
1382         (WebCore::HTMLMediaElement::updateShouldPlay):
1383         * html/HTMLVideoElement.cpp:
1384         (WebCore::HTMLVideoElement::parseAttribute):
1385         (WebCore::HTMLVideoElement::supportsFullscreen const):
1386         (WebCore::HTMLVideoElement::webkitEnterFullscreen):
1387         (WebCore::HTMLVideoElement::webkitWirelessVideoPlaybackDisabled const):
1388         (WebCore::HTMLVideoElement::webkitSupportsPresentationMode const):
1389         (WebCore::HTMLVideoElement::setFullscreenMode):
1390         * html/MediaElementSession.cpp:
1391         (WebCore::MediaElementSession::playbackPermitted const):
1392         (WebCore::MediaElementSession::dataLoadingPermitted const):
1393         (WebCore::MediaElementSession::fullscreenPermitted const):
1394         (WebCore::MediaElementSession::pageAllowsDataLoading const):
1395         (WebCore::MediaElementSession::pageAllowsPlaybackAfterResuming const):
1396         (WebCore::MediaElementSession::canShowControlsManager const):
1397         (WebCore::MediaElementSession::showPlaybackTargetPicker):
1398         (WebCore::MediaElementSession::hasWirelessPlaybackTargets const):
1399         (WebCore::MediaElementSession::wirelessVideoPlaybackDisabled const):
1400         (WebCore::MediaElementSession::setWirelessVideoPlaybackDisabled):
1401         (WebCore::MediaElementSession::setHasPlaybackTargetAvailabilityListeners):
1402         (WebCore::MediaElementSession::mediaStateDidChange):
1403         (WebCore::MediaElementSession::effectivePreloadForElement const):
1404         (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback const):
1405         (WebCore::MediaElementSession::allowsAutomaticMediaDataLoading const):
1406         (WebCore::MediaElementSession::mediaEngineUpdated):
1407         (WebCore::MediaElementSession::allowsPictureInPicture const):
1408         * html/MediaElementSession.h:
1409         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
1410         (WebCore::PlaybackSessionModelMediaElement::wirelessVideoPlaybackDisabled const):
1411
1412 2018-04-25  Jiewen Tan  <jiewen_tan@apple.com>
1413
1414         Remove access to keychain from the WebContent process
1415         https://bugs.webkit.org/show_bug.cgi?id=184428
1416         <rdar://problem/13150903>
1417
1418         Reviewed by Brent Fulgham.
1419
1420         Part 2.
1421
1422         This patch move the operation of HTMLKeygenElement from WebContent Process to UI Process.
1423         Function signedPublicKeyAndChallengeString is therefore marked as WEBCORE_EXPORT. Also, a
1424         localized string is marked WEBCORE_EXPORT as well to support the API test.
1425
1426         Covered by existing tests and api tests.
1427
1428         * WebCore.xcodeproj/project.pbxproj:
1429         * dom/Document.cpp:
1430         (WebCore::Document::signedPublicKeyAndChallengeString):
1431         * dom/Document.h:
1432         * html/HTMLKeygenElement.cpp:
1433         (WebCore::HTMLKeygenElement::appendFormData):
1434         * page/ChromeClient.h:
1435         * platform/LocalizedStrings.h:
1436         * platform/SSLKeyGenerator.h:
1437
1438 2018-04-25  Ryosuke Niwa  <rniwa@webkit.org>
1439
1440         PSON: Don't create a new process when navigating to a blob URL, data URL, and about:blank
1441         https://bugs.webkit.org/show_bug.cgi?id=184962
1442
1443         Reviewed by Youenn Fablet.
1444
1445         Added NavigationAction::treatAsSameOriginNavigation, which signifies WebKit code to avoid creating
1446         a new WebContent process when navigating to a blob URL, data URL, and about:blank.
1447
1448         Tests: ProcessSwap.SameOriginBlobNavigation
1449                ProcessSwap.CrossOriginBlobNavigation
1450                ProcessSwap.NavigateToAboutBlank
1451                ProcessSwap.NavigateToDataURL
1452
1453         * loader/NavigationAction.cpp:
1454         (WebCore::treatAsSameOriginNavigation):
1455         * loader/NavigationAction.h:
1456         (WebCore::NavigationAction::treatAsSameOriginNavigation const):
1457
1458 2018-04-25  Zalan Bujtas  <zalan@apple.com>
1459
1460         [LFC] Implement Layout::BlockContainer functions.
1461         https://bugs.webkit.org/show_bug.cgi?id=184994
1462
1463         Reviewed by Antti Koivisto.
1464
1465         * layout/layouttree/LayoutBlockContainer.cpp:
1466         (WebCore::Layout::BlockContainer::BlockContainer):
1467         (WebCore::Layout::BlockContainer::establishesInlineFormattingContext const):
1468
1469 2018-04-25  Zalan Bujtas  <zalan@apple.com>
1470
1471         [LFC] Implement Layout::Container functions.
1472         https://bugs.webkit.org/show_bug.cgi?id=184988
1473
1474         Reviewed by Antti Koivisto.
1475
1476         * layout/layouttree/LayoutContainer.cpp:
1477         (WebCore::Layout::Container::Container):
1478         (WebCore::Layout::Container::firstInFlowChild const):
1479         (WebCore::Layout::Container::firstInFlowOrFloatingChild const):
1480         (WebCore::Layout::Container::lastInFlowChild const):
1481         (WebCore::Layout::Container::lastInFlowOrFloatingChild const):
1482         (WebCore::Layout::Container::setFirstChild):
1483         (WebCore::Layout::Container::setLastChild):
1484         (WebCore::Layout::Container::setOutOfFlowDescendants):
1485         * layout/layouttree/LayoutContainer.h:
1486         (WebCore::Layout::Container::firstChild const):
1487         (WebCore::Layout::Container::lastChild const):
1488         (WebCore::Layout::Container::hasChild const):
1489         (WebCore::Layout::Container::hasInFlowChild const):
1490         (WebCore::Layout::Container::hasInFlowOrFloatingChild const):
1491         (WebCore::Layout::Container::outOfFlowDescendants):
1492
1493 2018-04-25  Brent Fulgham  <bfulgham@apple.com>
1494
1495         Don't Block First Party Cookies on Redirects
1496         https://bugs.webkit.org/show_bug.cgi?id=184948
1497         <rdar://problem/39534099>
1498
1499         Reviewed by Youenn Fablet.
1500
1501         The Navigation scheduler looses the 'requester' value when performing a ScheduledRedirect.
1502
1503         Test: http/tests/resourceLoadStatistics/do-not-block-top-level-navigation-redirect.html
1504
1505         * loader/NavigationScheduler.cpp:
1506
1507 2018-04-25  Youenn Fablet  <youenn@apple.com>
1508
1509         CachedRawResource is not handling incremental data computation correctly
1510         https://bugs.webkit.org/show_bug.cgi?id=184936
1511
1512         Reviewed by Chris Dumez.
1513
1514         Covered by updated test.
1515
1516         The previous logic was handling the case of only one additional segment being added to the SharedBuffer.
1517         In service worker case, a SharedBuffer may contain more than one segment.
1518         This is fixed by iterating until all new data is sent to clients.
1519
1520         * loader/cache/CachedRawResource.cpp:
1521         (WebCore::CachedRawResource::updateBuffer):
1522
1523 2018-04-25  Andy Estes  <aestes@apple.com>
1524
1525         [Mac] Number of drop items is always 0 when performing a DHTML drag
1526         https://bugs.webkit.org/show_bug.cgi?id=184943
1527
1528         Reviewed by Ryosuke Niwa.
1529
1530         New API test: DragAndDropPasteboardTests.NumberOfValidItemsForDrop
1531
1532         DragController tracks the number of items to be accepted by a file input element, taking
1533         into account whether the control is disabled or accepts multiple files. When this number
1534         changes, WebKit informs the NSDraggingInfo-conforming object passed to -draggingUpdated by
1535         calling -setNumberOfValidItemsForDrop:. This number is presented to the user in a badge
1536         rendered next to the dragging item thumbnails.
1537
1538         When performing a DHTML drag, we don't know how many items the page will accept, so prior
1539         to this patch we would render a "0" in the badge. This is misleading, because the page is
1540         more likely to accept all the items (or at least one of them) rather than none of them.
1541
1542         Let's do the straightforward thing and set numberOfValidItemsForDrop to equal the number of
1543         files in the drag operation when performing a DHTML file drag.
1544
1545         * page/DragController.cpp:
1546         (WebCore::DragController::tryDocumentDrag):
1547
1548 2018-04-25  Eric Carlson  <eric.carlson@apple.com>
1549
1550         [iOS] Set route sharing policy when setting audio session category
1551         https://bugs.webkit.org/show_bug.cgi?id=184979
1552         <rdar://problem/39709577>
1553
1554         Reviewed by Jer Noble.
1555
1556         * platform/audio/ios/AudioSessionIOS.mm:
1557         (WebCore::AudioSession::setCategory):
1558
1559 2018-04-25  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1560
1561         [Curl] Fix wrong schema checking on r230973
1562         https://bugs.webkit.org/show_bug.cgi?id=184977
1563
1564         Did write a wrong condition when making a string.
1565
1566         Reviewed by Alex Christensen.
1567
1568         No new tests because test interface is not ready.
1569
1570         * platform/network/curl/CurlProxySettings.cpp:
1571         (WebCore::createProxyUrl):
1572
1573 2018-04-25  Youenn Fablet  <youenn@apple.com>
1574
1575         Make DocumentThreadableLoader error logging more consistent
1576         https://bugs.webkit.org/show_bug.cgi?id=184853
1577
1578         Reviewed by Chris Dumez.
1579
1580         Covered by rebased tests.
1581         Make EventSource, XHR and Fetch log error messages consistently.
1582         This patch also prepares consistent error logging between WK1 and WK2 as WK2 NetworkProcess
1583         will issue more and more errors in places different from WK1.
1584         This is the reason for SubresourceLoader changes in this patch and DTL/didFail/preflightFailure changes.
1585
1586         Update ImageLoader error message to be more general than CORS.
1587
1588         * loader/CrossOriginPreflightChecker.cpp:
1589         (WebCore::CrossOriginPreflightChecker::doPreflight): Add some more logging for consistency between WK1 and WK2.
1590         (WebCore::CrossOriginPreflightChecker::validatePreflightResponse): Ditto.
1591         * loader/DocumentThreadableLoader.cpp:
1592         (WebCore::DocumentThreadableLoader::didFail):
1593         (WebCore::DocumentThreadableLoader::preflightFailure):
1594         (WebCore::DocumentThreadableLoader::logErrorAndFail):
1595         * loader/ImageLoader.cpp:
1596         (WebCore::ImageLoader::notifyFinished):
1597         * loader/SubresourceLoader.cpp:
1598         (WebCore::SubresourceLoader::didFail):
1599         * loader/ThreadableLoader.cpp:
1600         (WebCore::ThreadableLoader::logError):
1601         * loader/cache/CachedResource.cpp:
1602         (WebCore::CachedResource::load):
1603         * loader/cache/CachedResourceRequestInitiators.cpp:
1604         (WebCore::CachedResourceRequestInitiators::CachedResourceRequestInitiators):
1605         * loader/cache/CachedResourceRequestInitiators.h:
1606         * page/EventSource.cpp:
1607         (WebCore::EventSource::connect):
1608         (WebCore::EventSource::didFail):
1609         * xml/XMLHttpRequest.cpp:
1610         (WebCore::XMLHttpRequest::didFail):
1611
1612 2018-04-25  Zalan Bujtas  <zalan@apple.com>
1613
1614         [LFC] Implement Layout::Box functions.
1615         https://bugs.webkit.org/show_bug.cgi?id=184974
1616
1617         Reviewed by Antti Koivisto.
1618
1619         * layout/layouttree/LayoutBlockContainer.h:
1620         * layout/layouttree/LayoutBox.cpp:
1621         (WebCore::Layout::Box::Box):
1622         (WebCore::Layout::Box::~Box):
1623         (WebCore::Layout::Box::establishesFormattingContext const):
1624         (WebCore::Layout::Box::establishesBlockFormattingContext const):
1625         (WebCore::Layout::Box::isRelativelyPositioned const):
1626         (WebCore::Layout::Box::isStickyPositioned const):
1627         (WebCore::Layout::Box::isAbsolutelyPositioned const):
1628         (WebCore::Layout::Box::isFixedPositioned const):
1629         (WebCore::Layout::Box::isFloatingPositioned const):
1630         (WebCore::Layout::Box::containingBlock const):
1631         (WebCore::Layout::Box::isDescendantOf const):
1632         (WebCore::Layout::Box::isAnonymous const):
1633         (WebCore::Layout::Box::isInlineBlockBox const):
1634         (WebCore::Layout::Box::isBlockLevelBox const):
1635         (WebCore::Layout::Box::isInlineLevelBox const):
1636         (WebCore::Layout::Box::isBlockContainerBox const):
1637         (WebCore::Layout::Box::isInitialContainingBlock const):
1638         (WebCore::Layout::Box::nextInFlowSibling const):
1639         (WebCore::Layout::Box::nextInFlowOrFloatingSibling const):
1640         (WebCore::Layout::Box::previousInFlowSibling const):
1641         (WebCore::Layout::Box::previousInFlowOrFloatingSibling const):
1642         (WebCore::Layout::Box::setParent):
1643         (WebCore::Layout::Box::setNextSibling):
1644         (WebCore::Layout::Box::setPreviousSibling):
1645         (WebCore::Layout::Box::isOverflowVisible const):
1646         * layout/layouttree/LayoutBox.h:
1647         (WebCore::Layout::Box::establishesInlineFormattingContext const):
1648         (WebCore::Layout::Box::isInFlow const):
1649         (WebCore::Layout::Box::isPositioned const):
1650         (WebCore::Layout::Box::isInFlowPositioned const):
1651         (WebCore::Layout::Box::isOutOfFlowPositioned const):
1652         (WebCore::Layout::Box::isFloatingOrOutOfFlowPositioned const):
1653         (WebCore::Layout::Box::parent const):
1654         (WebCore::Layout::Box::nextSibling const):
1655         (WebCore::Layout::Box::previousSibling const):
1656         (WebCore::Layout::Box::weakPtrFactory const):
1657         * layout/layouttree/LayoutContainer.h:
1658         * layout/layouttree/LayoutInlineBox.h:
1659         * layout/layouttree/LayoutInlineContainer.h:
1660
1661 2018-04-25  Per Arne Vollan  <pvollan@apple.com>
1662
1663         [Win] Crash under WebCore::SimpleLineLayout::generateLineBoxTree
1664         https://bugs.webkit.org/show_bug.cgi?id=184953
1665
1666         This is possibly a MSVC compiler bug, since a simple rearrangement of the code fixes the crash.
1667         The crash is only happening in release builds, which also is an indication of this being a
1668         compiler issue.
1669
1670         Reviewed by Zalan Bujtas.
1671
1672         No new tests, covered by existing tests.
1673
1674         * rendering/SimpleLineLayoutFunctions.cpp:
1675         (WebCore::SimpleLineLayout::generateLineBoxTree):
1676
1677 2018-04-25  Dean Jackson  <dino@apple.com>
1678
1679         Make a better flag for system preview, and disable it where necessary
1680         https://bugs.webkit.org/show_bug.cgi?id=184968
1681         <rdar://problem/39686506>
1682
1683         Reviewed by Eric Carlson.
1684
1685         Use USE(SYSTEM_PREVIEW).
1686
1687         * html/HTMLAnchorElement.cpp:
1688         (WebCore::HTMLAnchorElement::isSystemPreviewLink const):
1689         * html/HTMLAnchorElement.h:
1690         * html/HTMLImageElement.cpp:
1691         * html/HTMLImageElement.h:
1692         * html/HTMLPictureElement.cpp:
1693         * html/HTMLPictureElement.h:
1694         * rendering/RenderImage.cpp:
1695         (WebCore::RenderImage::paintIntoRect):
1696         * rendering/RenderTheme.cpp:
1697         * rendering/RenderTheme.h:
1698         * testing/Internals.cpp:
1699         (WebCore::Internals::systemPreviewRelType):
1700         (WebCore::Internals::isSystemPreviewLink const):
1701         (WebCore::Internals::isSystemPreviewImage const):
1702
1703 2018-04-25  Zalan Bujtas  <zalan@apple.com>
1704
1705         Fix project file after r230931.
1706
1707         * WebCore.xcodeproj/project.pbxproj:
1708
1709 2018-04-25  Miguel Gomez  <magomez@igalia.com>
1710
1711         [GTK] fast/repaint/fixed-scale.html failing since r230479 "[TexMap] TextureMapperLayer unnecessarily duplicates state in GraphicsLayerTransform"
1712         https://bugs.webkit.org/show_bug.cgi?id=184780
1713
1714         Reviewed by Žan Doberšek.
1715
1716         Initialize the anchorPoint to (0.5, 0.5, 0) in TextureMapperLayer::State.
1717
1718         Covered by existent tests.
1719
1720         * platform/graphics/texmap/TextureMapperLayer.h:
1721
1722 2018-04-25  Carlos Garcia Campos  <cgarcia@igalia.com>
1723
1724         [GTK] Implement MouseEvent.buttons
1725         https://bugs.webkit.org/show_bug.cgi?id=184913
1726
1727         Reviewed by Žan Doberšek.
1728
1729         Add helper function to get the state modifier of a GDK button.
1730
1731         * platform/gtk/GtkUtilities.cpp:
1732         (WebCore::stateModifierForGdkButton):
1733         * platform/gtk/GtkUtilities.h:
1734
1735 2018-04-24  Ryosuke Niwa  <rniwa@webkit.org>
1736
1737         Release assert in ScriptController::canExecuteScripts via CachedSVGFont::ensureCustomFontData during
1738         Document::updateStyleIfNeeded
1739         https://bugs.webkit.org/show_bug.cgi?id=184950
1740
1741         Reviewed by Zalan Bujtas.
1742
1743         Convert an existing ScriptDisallowedScope::EventAllowedScope which only disables the debug assertions
1744         by ScriptDisallowedScope::DisableAssertionsInScope which also disables the release assertion.
1745
1746         Because SVG font is loaded in a document isolated from the rest of the page (m_externalSVGDocument),
1747         there is no security implication to execute scripts in this isolated document.
1748
1749         Unfortunately, no new tests. I could never make CachedSVGFont::ensureCustomFontData to get called inside
1750         style resolution with m_externalSVGDocument set to nullptr after many attempts. Even EventAllowedScope
1751         I added 13 months ago in r211965, which this patch replaces by DisableAssertionsInScope, is not utilized
1752         by the existing layout tests since removing the assertion doesn't cause any layout test to hit an assertion.
1753
1754         * dom/ScriptDisallowedScope.h: Updated the comment.
1755         * loader/cache/CachedSVGFont.cpp:
1756         (WebCore::CachedSVGFont::ensureCustomFontData): Replaced the asssertion.
1757
1758 2018-04-24  Simon Fraser  <simon.fraser@apple.com>
1759
1760         visitedDependentColor() should take a CSSPropertyID
1761         https://bugs.webkit.org/show_bug.cgi?id=184949
1762
1763         Reviewed by Sam Weinig.
1764         
1765         Change RenderStyle::colorIncludingFallback(), RenderStyle::visitedDependentColor()
1766         and RenderElement::selectionColor() to take CSSPropertyID rather than int.
1767
1768         No behavior change.
1769
1770         * rendering/RenderElement.cpp:
1771         (WebCore::RenderElement::selectionColor const):
1772         * rendering/RenderElement.h:
1773         * rendering/RenderTableCell.cpp:
1774         (WebCore::RenderTableCell::computeCollapsedStartBorder const):
1775         (WebCore::RenderTableCell::computeCollapsedEndBorder const):
1776         (WebCore::RenderTableCell::computeCollapsedBeforeBorder const):
1777         (WebCore::RenderTableCell::computeCollapsedAfterBorder const):
1778         * rendering/style/RenderStyle.cpp:
1779         (WebCore::RenderStyle::colorIncludingFallback const):
1780         (WebCore::RenderStyle::visitedDependentColor const):
1781         * rendering/style/RenderStyle.h:
1782
1783 2018-04-24  Simon Fraser  <simon.fraser@apple.com>
1784
1785         Add a new "color-filter" CSS property as an experimental feature
1786         https://bugs.webkit.org/show_bug.cgi?id=184940
1787         rdar://problem/39664904
1788
1789         Reviewed by Jon Lee.
1790         
1791         Add a new CSS property called "color-filter" as an experimental feature (off by default).
1792         
1793         This property specifies a list of filter functions (as specified in https://drafts.fxtf.org/filter-effects/#supported-filter-functions)
1794         to CSS colors, allowing authors to modify the provided page colors, for example to improve accessibility.
1795         Filters that move pixels (i.e. blur() and drop-shadow()) are invalid in this property.
1796         
1797         Colors will be mapped through the filter functions just before paint time, and gradient stop colors will also be mapped.
1798         
1799         This patch adds support for parsing color-filter.
1800
1801         Test: css3/color-filters/color-filter-parsing.html
1802
1803         * css/CSSComputedStyleDeclaration.cpp:
1804         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
1805         * css/CSSProperties.json:
1806         * css/parser/CSSParser.cpp:
1807         (WebCore::CSSParserContext::CSSParserContext):
1808         (WebCore::operator==):
1809         * css/parser/CSSParserMode.h:
1810         * css/parser/CSSPropertyParser.cpp:
1811         (WebCore::CSSPropertyParser::parseSingleValue):
1812         * css/parser/CSSPropertyParserHelpers.cpp:
1813         (WebCore::CSSPropertyParserHelpers::isColorFilterFunction):
1814         (WebCore::CSSPropertyParserHelpers::consumeFilterFunction):
1815         (WebCore::CSSPropertyParserHelpers::consumeFilter):
1816         * css/parser/CSSPropertyParserHelpers.h:
1817         * page/Settings.yaml:
1818         * rendering/style/RenderStyle.cpp:
1819         (WebCore::RenderStyle::changeRequiresRepaint const):
1820         * rendering/style/RenderStyle.h:
1821         (WebCore::RenderStyle::mutableColorFilter):
1822         (WebCore::RenderStyle::colorFilter const):
1823         (WebCore::RenderStyle::hasColorFilter const):
1824         (WebCore::RenderStyle::setColorFilter):
1825         (WebCore::RenderStyle::initialColorFilter):
1826         * rendering/style/StyleRareInheritedData.cpp:
1827         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
1828         (WebCore::StyleRareInheritedData::operator== const):
1829         (WebCore::StyleRareInheritedData::hasColorFilters const):
1830         * rendering/style/StyleRareInheritedData.h:
1831
1832 2018-04-24  Simon Fraser  <simon.fraser@apple.com>
1833
1834         shape-outside and filter styles occur twice in the result of getComputedStyle
1835         https://bugs.webkit.org/show_bug.cgi?id=184931
1836
1837         Reviewed by Antti Koivisto.
1838
1839         CSSPropertyShapeOutside and CSSPropertyFilter were duplicated in the list of computedProperties[]
1840         used by getComputedStyle. Remove the duplication.
1841         
1842         Tested by existing tests.
1843
1844         * css/CSSComputedStyleDeclaration.cpp:
1845
1846 2018-04-24  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1847
1848         [Curl] Extract proxy settings into a separate class to hold advanced information.
1849         https://bugs.webkit.org/show_bug.cgi?id=184714
1850
1851         It was simplely structure to hold proxy setting. To support advanced feature of proxy
1852         such as authentication, more inteligent object is required to store intermediate state
1853         or errors. That's why we've introduced new class for that purpose.
1854
1855         Reviewed by Youenn Fablet.
1856
1857         No new tests because there's no new behavior.
1858
1859         * platform/Curl.cmake:
1860         * platform/network/curl/CurlContext.cpp:
1861         (WebCore::CurlHandle::enableProxyIfExists):
1862         (WebCore::CurlContext::ProxyInfo::url const): Deleted.
1863         (WebCore::CurlContext::setProxyInfo): Deleted.
1864         * platform/network/curl/CurlContext.h:
1865         (WebCore::CurlContext::proxySettings const):
1866         (WebCore::CurlContext::setProxySettings):
1867         (WebCore::CurlContext::setProxyUserPass):
1868         (WebCore::CurlContext::proxyInfo const): Deleted.
1869         (WebCore::CurlContext::setProxyInfo): Deleted.
1870         * platform/network/curl/CurlProxySettings.cpp: Added.
1871         (WebCore::CurlProxySettings::CurlProxySettings):
1872         (WebCore::CurlProxySettings::rebuildUrl):
1873         (WebCore::CurlProxySettings::setUserPass):
1874         (WebCore::protocolIsInSocksFamily):
1875         (WebCore::getProxyPort):
1876         (WebCore::createProxyUrl):
1877         * platform/network/curl/CurlProxySettings.h: Added.
1878         (WebCore::CurlProxySettings::CurlProxySettings):
1879         (WebCore::CurlProxySettings::isEmpty const):
1880         (WebCore::CurlProxySettings::mode const):
1881         (WebCore::CurlProxySettings::url const):
1882         (WebCore::CurlProxySettings::ignoreHosts const):
1883         (WebCore::CurlProxySettings::user const):
1884         (WebCore::CurlProxySettings::password const):
1885         * platform/network/curl/CurlRequest.cpp:
1886         (WebCore::CurlRequest::didReceiveHeader):
1887         * platform/network/curl/CurlResponse.h:
1888         (WebCore::CurlResponse::isolatedCopy const):
1889         * platform/network/curl/ResourceResponseCurl.cpp:
1890         (WebCore::ResourceResponse::ResourceResponse):
1891
1892 2018-04-24  Youenn Fablet  <youenn@apple.com>
1893
1894         Throw in case of PeerConnection created for detached documents
1895         https://bugs.webkit.org/show_bug.cgi?id=184921
1896         <rdar://problem/39629216>
1897
1898         Reviewed by Eric Carlson.
1899
1900         Add a check to ensure that page is not null when creating a peer connection backend.
1901         In that case, the peer connection constructor will later on throw.
1902         The same for setConfiguration is done.
1903         Behavior is consistent with Chrome.
1904
1905         Test: webrtc/pc-detached-document.html
1906
1907         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1908         (WebCore::createLibWebRTCPeerConnectionBackend):
1909         (WebCore::LibWebRTCPeerConnectionBackend::LibWebRTCPeerConnectionBackend):
1910         (WebCore::LibWebRTCPeerConnectionBackend::setConfiguration):
1911         (WebCore::libWebRTCProvider): Deleted.
1912         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
1913
1914 2018-04-24  John Wilander  <wilander@apple.com>
1915
1916         From-Origin: Support for 'same' and 'same-site' response header, nested frame origin check
1917         https://bugs.webkit.org/show_bug.cgi?id=184560
1918         <rdar://problem/38901344>
1919
1920         Reviewed by Youenn Fablet and Daniel Bates.
1921
1922         Tests: http/tests/from-origin/document-from-origin-same-accepted.html
1923                http/tests/from-origin/document-from-origin-same-blocked.html
1924                http/tests/from-origin/document-from-origin-same-site-accepted.html
1925                http/tests/from-origin/document-from-origin-same-site-blocked.html
1926                http/tests/from-origin/document-nested-from-origin-same-accepted.html
1927                http/tests/from-origin/document-nested-from-origin-same-blocked.html
1928                http/tests/from-origin/fetch-data-iframe-from-origin-same-blocked.html
1929                http/tests/from-origin/fetch-from-origin-same-accepted.html
1930                http/tests/from-origin/fetch-from-origin-same-blocked.html
1931                http/tests/from-origin/fetch-from-origin-same-site-accepted.html
1932                http/tests/from-origin/fetch-from-origin-same-site-blocked.html
1933                http/tests/from-origin/fetch-iframe-from-origin-same-accepted.html
1934                http/tests/from-origin/fetch-iframe-from-origin-same-blocked.html
1935                http/tests/from-origin/image-about-blank-from-origin-same-blocked.html
1936                http/tests/from-origin/image-from-origin-same-accepted.html
1937                http/tests/from-origin/image-from-origin-same-blocked.html
1938                http/tests/from-origin/image-from-origin-same-site-accepted.html
1939                http/tests/from-origin/image-from-origin-same-site-blocked.html
1940                http/tests/from-origin/redirect-document-from-origin-same-blocked.html
1941                http/tests/from-origin/redirect-fetch-from-origin-same-blocked.html
1942                http/tests/from-origin/redirect-image-from-origin-same-blocked.html
1943                http/tests/from-origin/redirect-script-from-origin-same-blocked.html
1944                http/tests/from-origin/redirect-xhr-from-origin-same-blocked.html
1945                http/tests/from-origin/sandboxed-sub-frame-from-origin-same-blocked.html
1946                http/tests/from-origin/sandboxed-sub-frame-nested-cross-origin-from-origin-same-blocked.html
1947                http/tests/from-origin/sandboxed-sub-frame-nested-same-origin-from-origin-same-blocked.html
1948                http/tests/from-origin/script-from-origin-same-accepted.html
1949                http/tests/from-origin/script-from-origin-same-blocked.html
1950                http/tests/from-origin/script-from-origin-same-site-accepted.html
1951                http/tests/from-origin/script-from-origin-same-site-blocked.html
1952                http/tests/from-origin/top-frame-document-from-origin-same-accepted.php
1953                http/tests/from-origin/xhr-from-origin-same-accepted.html
1954                http/tests/from-origin/xhr-from-origin-same-blocked.html
1955                http/tests/from-origin/xhr-from-origin-same-site-accepted.html
1956                http/tests/from-origin/xhr-from-origin-same-site-blocked.html
1957
1958         * loader/SubresourceLoader.cpp:
1959         (WebCore::SubresourceLoader::didFail):
1960             Outputs the error's localized description in a console message except when the destination
1961             is FetchOptions::Destination::Serviceworker or FetchOptions::Destination::EmptyString.
1962         * page/RuntimeEnabledFeatures.h:
1963         (WebCore::RuntimeEnabledFeatures::setFromOriginResponseHeaderEnabled):
1964         (WebCore::RuntimeEnabledFeatures::fromOriginResponseHeaderEnabled const):
1965             Added From-Origin support as an experimental feature.
1966         * platform/network/HTTPHeaderNames.in:
1967             Added From-Origin.
1968         * platform/network/HTTPParsers.cpp:
1969         (WebCore::parseFromOriginHeader):
1970             Parses the From-Origin header, currently supporting 'Same' and 'Same-Site.'
1971         * platform/network/HTTPParsers.h:
1972
1973 2018-04-24  Antti Koivisto  <antti@apple.com>
1974
1975         Rename LayoutCtx.h/cpp to LayoutContext.h/cpp
1976         https://bugs.webkit.org/show_bug.cgi?id=184922
1977
1978         Reviewed by Zalan Bujtas.
1979
1980         To achieve this the existing LayoutContext class is renamed to FrameViewLayoutContext.
1981
1982         * Sources.txt:
1983         * WebCore.xcodeproj/project.pbxproj:
1984         * layout/LayoutContext.cpp: Copied from Source/WebCore/layout/LayoutCtx.cpp.
1985         * layout/LayoutContext.h: Copied from Source/WebCore/layout/LayoutCtx.h.
1986         * layout/LayoutCtx.cpp: Removed.
1987         * layout/LayoutCtx.h: Removed.
1988         * page/FrameView.cpp:
1989         (WebCore::FrameView::shouldDeferScrollUpdateAfterContentSizeChange):
1990         (WebCore::FrameView::updateLayoutViewport):
1991         (WebCore::FrameView::updateLayerPositionsAfterScrolling):
1992         (WebCore::FrameView::updateCompositingLayersAfterScrolling):
1993         (WebCore::FrameView::availableContentSizeChanged):
1994         * page/FrameView.h:
1995         * page/FrameViewLayoutContext.cpp: Copied from Source/WebCore/page/LayoutContext.cpp.
1996         (WebCore::LayoutScope::LayoutScope):
1997         (WebCore::FrameViewLayoutContext::FrameViewLayoutContext):
1998         (WebCore::FrameViewLayoutContext::~FrameViewLayoutContext):
1999         (WebCore::FrameViewLayoutContext::layout):
2000         (WebCore::FrameViewLayoutContext::runOrScheduleAsynchronousTasks):
2001         (WebCore::FrameViewLayoutContext::runAsynchronousTasks):
2002         (WebCore::FrameViewLayoutContext::flushAsynchronousTasks):
2003         (WebCore::FrameViewLayoutContext::reset):
2004         (WebCore::FrameViewLayoutContext::needsLayout const):
2005         (WebCore::FrameViewLayoutContext::setNeedsLayout):
2006         (WebCore::FrameViewLayoutContext::enableSetNeedsLayout):
2007         (WebCore::FrameViewLayoutContext::disableSetNeedsLayout):
2008         (WebCore::FrameViewLayoutContext::scheduleLayout):
2009         (WebCore::FrameViewLayoutContext::unscheduleLayout):
2010         (WebCore::FrameViewLayoutContext::scheduleSubtreeLayout):
2011         (WebCore::FrameViewLayoutContext::layoutTimerFired):
2012         (WebCore::FrameViewLayoutContext::convertSubtreeLayoutToFullLayout):
2013         (WebCore::FrameViewLayoutContext::setSubtreeLayoutRoot):
2014         (WebCore::FrameViewLayoutContext::canPerformLayout const):
2015         (WebCore::FrameViewLayoutContext::applyTextSizingIfNeeded):
2016         (WebCore::FrameViewLayoutContext::updateStyleForLayout):
2017         (WebCore::FrameViewLayoutContext::handleLayoutWithFrameFlatteningIfNeeded):
2018         (WebCore::FrameViewLayoutContext::startLayoutAtMainFrameViewIfNeeded):
2019         (WebCore::FrameViewLayoutContext::layoutDelta const):
2020         (WebCore::FrameViewLayoutContext::addLayoutDelta):
2021         (WebCore::FrameViewLayoutContext::layoutDeltaMatches):
2022         (WebCore::FrameViewLayoutContext::layoutState const):
2023         (WebCore::FrameViewLayoutContext::pushLayoutState):
2024         (WebCore::FrameViewLayoutContext::pushLayoutStateForPaginationIfNeeded):
2025         (WebCore::FrameViewLayoutContext::popLayoutState):
2026         (WebCore::FrameViewLayoutContext::checkLayoutState):
2027         (WebCore::FrameViewLayoutContext::frame const):
2028         (WebCore::FrameViewLayoutContext::view const):
2029         (WebCore::FrameViewLayoutContext::renderView const):
2030         (WebCore::FrameViewLayoutContext::document const):
2031         (WebCore::LayoutContext::LayoutContext): Deleted.
2032         (WebCore::LayoutContext::~LayoutContext): Deleted.
2033         (WebCore::LayoutContext::layout): Deleted.
2034         (WebCore::LayoutContext::runOrScheduleAsynchronousTasks): Deleted.
2035         (WebCore::LayoutContext::runAsynchronousTasks): Deleted.
2036         (WebCore::LayoutContext::flushAsynchronousTasks): Deleted.
2037         (WebCore::LayoutContext::reset): Deleted.
2038         (WebCore::LayoutContext::needsLayout const): Deleted.
2039         (WebCore::LayoutContext::setNeedsLayout): Deleted.
2040         (WebCore::LayoutContext::enableSetNeedsLayout): Deleted.
2041         (WebCore::LayoutContext::disableSetNeedsLayout): Deleted.
2042         (WebCore::LayoutContext::scheduleLayout): Deleted.
2043         (WebCore::LayoutContext::unscheduleLayout): Deleted.
2044         (WebCore::LayoutContext::scheduleSubtreeLayout): Deleted.
2045         (WebCore::LayoutContext::layoutTimerFired): Deleted.
2046         (WebCore::LayoutContext::convertSubtreeLayoutToFullLayout): Deleted.
2047         (WebCore::LayoutContext::setSubtreeLayoutRoot): Deleted.
2048         (WebCore::LayoutContext::canPerformLayout const): Deleted.
2049         (WebCore::LayoutContext::applyTextSizingIfNeeded): Deleted.
2050         (WebCore::LayoutContext::updateStyleForLayout): Deleted.
2051         (WebCore::LayoutContext::handleLayoutWithFrameFlatteningIfNeeded): Deleted.
2052         (WebCore::LayoutContext::startLayoutAtMainFrameViewIfNeeded): Deleted.
2053         (WebCore::LayoutContext::layoutDelta const): Deleted.
2054         (WebCore::LayoutContext::addLayoutDelta): Deleted.
2055         (WebCore::LayoutContext::layoutDeltaMatches): Deleted.
2056         (WebCore::LayoutContext::layoutState const): Deleted.
2057         (WebCore::LayoutContext::pushLayoutState): Deleted.
2058         (WebCore::LayoutContext::pushLayoutStateForPaginationIfNeeded): Deleted.
2059         (WebCore::LayoutContext::popLayoutState): Deleted.
2060         (WebCore::LayoutContext::checkLayoutState): Deleted.
2061         (WebCore::LayoutContext::frame const): Deleted.
2062         (WebCore::LayoutContext::view const): Deleted.
2063         (WebCore::LayoutContext::renderView const): Deleted.
2064         (WebCore::LayoutContext::document const): Deleted.
2065         * page/FrameViewLayoutContext.h: Copied from Source/WebCore/page/LayoutContext.h.
2066         (WebCore::LayoutContext::startDisallowingLayout): Deleted.
2067         (WebCore::LayoutContext::endDisallowingLayout): Deleted.
2068         (WebCore::LayoutContext::layoutPhase const): Deleted.
2069         (WebCore::LayoutContext::isLayoutNested const): Deleted.
2070         (WebCore::LayoutContext::isLayoutPending const): Deleted.
2071         (WebCore::LayoutContext::isInLayout const): Deleted.
2072         (WebCore::LayoutContext::isInRenderTreeLayout const): Deleted.
2073         (WebCore::LayoutContext::inPaintableState const): Deleted.
2074         (WebCore::LayoutContext::layoutCount const): Deleted.
2075         (WebCore::LayoutContext::subtreeLayoutRoot const): Deleted.
2076         (WebCore::LayoutContext::clearSubtreeLayoutRoot): Deleted.
2077         (WebCore::LayoutContext::resetFirstLayoutFlag): Deleted.
2078         (WebCore::LayoutContext::didFirstLayout const): Deleted.
2079         (WebCore::LayoutContext::setNeedsFullRepaint): Deleted.
2080         (WebCore::LayoutContext::needsFullRepaint const): Deleted.
2081         (WebCore::LayoutContext::isPaintOffsetCacheEnabled const): Deleted.
2082         (WebCore::LayoutContext::layoutDisallowed const): Deleted.
2083         (WebCore::LayoutContext::isLayoutSchedulingEnabled const): Deleted.
2084         (WebCore::LayoutContext::inAsynchronousTasks const): Deleted.
2085         (WebCore::LayoutContext::disablePaintOffsetCache): Deleted.
2086         (WebCore::LayoutContext::enablePaintOffsetCache): Deleted.
2087         * page/LayoutContext.cpp: Removed.
2088         * page/LayoutContext.h: Removed.
2089         * rendering/LayoutState.cpp:
2090         (WebCore::LayoutState::LayoutState):
2091         (WebCore::LayoutState::computePaginationInformation):
2092         (WebCore::LayoutState::establishLineGrid):
2093         (WebCore::LayoutStateDisabler::LayoutStateDisabler):
2094         * rendering/LayoutState.h:
2095
2096 2018-04-24  Mark Lam  <mark.lam@apple.com>
2097
2098         Need to acquire the VM lock before calling toNumber on a JSValue.
2099         https://bugs.webkit.org/show_bug.cgi?id=184924
2100         <rdar://problem/39690679>
2101
2102         Reviewed by Saam Barati.
2103
2104         * bridge/objc/objc_utility.mm:
2105         (JSC::Bindings::convertValueToObjcValue):
2106
2107 2018-04-24  Tadeu Zagallo  <tzagallo@apple.com>
2108
2109         REGRESSION(r221839): Fix requests with FormData containing empty files
2110         https://bugs.webkit.org/show_bug.cgi?id=184490
2111         <rdar://problem/39385169>
2112
2113         Reviewed by Geoffrey Garen.
2114
2115         We should not append the blob to the FormData when it is a file but has no path. It broke
2116         the submission since the request was failing to read the file in FormDataStreamCFNet.h:156
2117
2118         Test: http/tests/local/formdata/send-form-data-with-empty-file.html
2119
2120         * platform/network/FormData.cpp:
2121         (WebCore::FormData::appendMultiPartFileValue):
2122
2123 2018-04-24  Zalan Bujtas  <zalan@apple.com>
2124
2125         Fix project file after r230931.
2126
2127         * WebCore.xcodeproj/project.pbxproj:
2128
2129 2018-04-24  Jer Noble  <jer.noble@apple.com>
2130
2131         Don't add system framework paths to FRAMEWORK_SEARCH_PATHS
2132         https://bugs.webkit.org/show_bug.cgi?id=184786
2133
2134         Reviewed by Tim Horton.
2135
2136         * Configurations/WebCore.xcconfig:
2137         * DerivedSources.make:
2138         * WebCore.xcodeproj/project.pbxproj:
2139
2140 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
2141
2142         [CoordGraphics] Remove dead fixed layer code
2143         https://bugs.webkit.org/show_bug.cgi?id=184912
2144
2145         Reviewed by Michael Catanzaro.
2146
2147         Remove CoordinatedGraphicsLayer::setFixedToViewport() and the
2148         corresponding attribute on the CoordinatedGraphicsLayerState struct.
2149         The method is not called anywhere since r230952.
2150
2151         CoordinatedGraphicsState struct also loses the scrollPosition attribute
2152         that also isn't used anymore.
2153
2154         Changes to GraphicsLayerTextureMapper class mirror those made to
2155         CoordinatedGraphicsLayer, removing support for the fixed-to-viewport
2156         attribute. This too was not called from anywhere.
2157
2158         All that enables us removing fixed-to-viewport handling in the
2159         TextureMapperLayer class. Along with related changes in the
2160         CoordinatedGraphicsScene class, we're able to remove a bunch of methods
2161         and member variables that are not used or needed anymore.
2162
2163         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
2164         (WebCore::GraphicsLayerTextureMapper::GraphicsLayerTextureMapper):
2165         (WebCore::GraphicsLayerTextureMapper::commitLayerChanges):
2166         (WebCore::GraphicsLayerTextureMapper::setFixedToViewport): Deleted.
2167         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
2168         * platform/graphics/texmap/TextureMapperLayer.cpp:
2169         (WebCore::TextureMapperLayer::computeTransformsRecursive):
2170         (WebCore::TextureMapperLayer::setFixedToViewport): Deleted.
2171         (WebCore::TextureMapperLayer::isAncestorFixedToViewport const): Deleted.
2172         (WebCore::TextureMapperLayer::setScrollPositionDeltaIfNeeded): Deleted.
2173         * platform/graphics/texmap/TextureMapperLayer.h:
2174         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2175         (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
2176         (WebCore::CoordinatedGraphicsLayer::syncLayerState):
2177         (WebCore::CoordinatedGraphicsLayer::setFixedToViewport): Deleted.
2178         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2179         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
2180         (WebCore::CoordinatedGraphicsLayerState::CoordinatedGraphicsLayerState):
2181
2182 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
2183
2184         [CoordGraphics] Remove unused fixed layout functionality
2185         https://bugs.webkit.org/show_bug.cgi?id=184908
2186
2187         Reviewed by Carlos Garcia Campos.
2188
2189         Ports using the CoordinatedGraphics subsystem don't expose fixed layout
2190         support. As such, we're able to remove a lot of unused code and
2191         unnecessary USE(COORDINATED_GRAPHICS) special cases in generic sections
2192         in both WebCore and WebKit.
2193
2194         With fixed layout not available for use to users of the GTK+ and WPE
2195         ports, we can remove the ScrollingCoordinatorCoordinatedGraphics
2196         implementation, making room for an implementation that inherits from
2197         AsyncScrollingCoordinator in the future. For that purpose the
2198         ScrollingCoordinator::create() function is moved into the
2199         ScrollingCoordinatorCoordinatedGraphics.cpp file already.
2200
2201         This also enables removing delegatedScrollRequested() method from
2202         HostWindow and the inheriting ChromeClient interface.
2203
2204         * loader/EmptyClients.h:
2205         * page/Chrome.cpp:
2206         (WebCore::Chrome::delegatedScrollRequested): Deleted.
2207         * page/Chrome.h:
2208         * page/ChromeClient.h:
2209         * page/scrolling/ScrollingCoordinator.cpp:
2210         (WebCore::ScrollingCoordinator::create):
2211         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp:
2212         (WebCore::ScrollingCoordinator::create):
2213         (WebCore::ScrollingCoordinatorCoordinatedGraphics::ScrollingCoordinatorCoordinatedGraphics): Deleted.
2214         (WebCore::ScrollingCoordinatorCoordinatedGraphics::attachToStateTree): Deleted.
2215         (WebCore::ScrollingCoordinatorCoordinatedGraphics::detachFromStateTree): Deleted.
2216         (WebCore::ScrollingCoordinatorCoordinatedGraphics::clearStateTree): Deleted.
2217         (WebCore::ScrollingCoordinatorCoordinatedGraphics::updateNodeLayer): Deleted.
2218         (WebCore::ScrollingCoordinatorCoordinatedGraphics::updateNodeViewportConstraints): Deleted.
2219         (WebCore::ScrollingCoordinatorCoordinatedGraphics::requestScrollPositionUpdate): Deleted.
2220         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.h: Removed.
2221         * platform/HostWindow.h:
2222
2223 2018-04-24  Daniel Bates  <dabates@apple.com>
2224
2225         Attempt to fix the Apple Internal build following r230922
2226         (https://bugs.webkit.org/show_bug.cgi?id=184737)
2227
2228         Cast the return value of std::map::size() to a size_t before logging it with format specifier
2229         "%zu". std::map::size() returns a size_type. According to <http://en.cppreference.com/w/cpp/container/map>
2230         size_type is "usually a size_t", but it may not be. An Apple Internal debug builder reports
2231         that size_type = unsigned int != unsigned long = size_t.
2232
2233         * Modules/mediasource/SourceBuffer.cpp:
2234         (WebCore::SourceBuffer::provideMediaData):
2235
2236 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
2237
2238         [CoordGraphics] Avoid painting backing stores for zero-opacity layers
2239         https://bugs.webkit.org/show_bug.cgi?id=184143
2240
2241         Reviewed by Carlos Garcia Campos.
2242
2243         Skip generating backing stores for layers that have zero opacity and do
2244         not animate the opacity value. In the current CoordinatedGraphics system
2245         this can end up saving loads of memory on Web content that deploys a
2246         large number of such elements.
2247
2248         * platform/graphics/texmap/TextureMapperLayer.h:
2249         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2250         (WebCore::CoordinatedGraphicsLayer::shouldHaveBackingStore const):
2251
2252 2018-04-24  Daniel Bates  <dabates@apple.com>
2253
2254         Attempt to fix the Apple Internal build following r230944
2255         (https://bugs.webkit.org/show_bug.cgi?id=159464)
2256
2257         * platform/network/mac/CookieJarMac.mm:
2258
2259 2018-04-24  Daniel Bates  <dabates@apple.com>
2260
2261         Another attempt to fix the Mac and iOS build following r230944
2262         (https://bugs.webkit.org/show_bug.cgi?id=159464)
2263
2264         * platform/network/mac/CookieJarMac.mm:
2265         (WebCore::policyProperties):
2266
2267 2018-04-24  Daniel Bates  <dabates@apple.com>
2268
2269         Attempt to fix the Mac and iOS build following r230944
2270         (https://bugs.webkit.org/show_bug.cgi?id=159464)
2271
2272         * platform/network/mac/CookieJarMac.mm:
2273         (WebCore::policyProperties):
2274
2275 2018-04-23  Daniel Bates  <dabates@apple.com>
2276
2277         Implement Same-Site cookies
2278         https://bugs.webkit.org/show_bug.cgi?id=159464
2279         <rdar://problem/27196358>
2280
2281         Reviewed by Brent Fulgham.
2282
2283         Implements support for Same-Site cookies as per <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00>.
2284         The implementation is materially consistent with the spec. though implements the computation
2285         for a document's "site for cookies" indirectly as part of loading its frame. This is done to
2286         avoid traversing the frame tree on each subresource request initiated by the document or one
2287         of its workers. We take advantage of the fact that Web Workers and Service Workers use their
2288         host document's loader to load resources on their behalf to use the correct "site for cookies"
2289         for requests (e.g. fetch()) initiating by them without the need to duplicate and store the
2290         host document's "site for cookies" in the worker's script execution context.
2291
2292         The implementation differs from the spec. in the handling of about: URLs and the empty URL
2293         and makes the implementation in WebKit match the behavior of Chrome and Firefox as well as
2294         consistent with origin inheritance as described in <https://html.spec.whatwg.org/multipage/browsers.html#origin>
2295         (16 April 2018). Specifically, requests to about:blank, about:srcdoc and the empty URL ("")
2296         are treated as same-site because these URLs inherit their origin from their owner.
2297
2298         Tests: http/tests/cookies/same-site/fetch-after-navigating-iframe-in-cross-origin-page.html
2299                http/tests/cookies/same-site/fetch-after-top-level-navigation-from-cross-origin-page.html
2300                http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.html
2301                http/tests/cookies/same-site/fetch-cookies-set-in-about-blank-iframe.html
2302                http/tests/cookies/same-site/fetch-in-about-blank-page.html
2303                http/tests/cookies/same-site/fetch-in-cross-origin-iframe.html
2304                http/tests/cookies/same-site/fetch-in-cross-origin-page.html
2305                http/tests/cookies/same-site/fetch-in-cross-origin-service-worker.html
2306                http/tests/cookies/same-site/fetch-in-cross-origin-worker.html
2307                http/tests/cookies/same-site/fetch-in-same-origin-page.html
2308                http/tests/cookies/same-site/fetch-in-same-origin-service-worker.html
2309                http/tests/cookies/same-site/fetch-in-same-origin-srcdoc-iframe.html
2310                http/tests/cookies/same-site/fetch-in-same-origin-worker.html
2311                http/tests/cookies/same-site/popup-cross-site-post.html
2312                http/tests/cookies/same-site/popup-cross-site.html
2313                http/tests/cookies/same-site/popup-same-site-post.html
2314                http/tests/cookies/same-site/popup-same-site-via-cross-site-redirect.html
2315                http/tests/cookies/same-site/popup-same-site-via-same-site-redirect.html
2316                http/tests/cookies/same-site/popup-same-site.html
2317
2318         * Sources.txt: Add source file SameSiteInfo.cpp.
2319         * WebCore.xcodeproj/project.pbxproj: Add source files SameSiteInfo.{cpp, h}.
2320         * dom/Document.cpp:
2321         (WebCore::Document::initSecurityContext): Modified to call SecurityPolicy::shouldInheritSecurityOriginFromOwner().
2322         (WebCore::Document::shouldInheritContentSecurityPolicyFromOwner const): Ditto.
2323         (WebCore::shouldInheritSecurityOriginFromOwner): Deleted; moved to SecurityPolicy.
2324         * dom/Document.h:
2325         (WebCore::Document::firstPartyForSameSiteCookies const): Added.
2326         (WebCore::Document::setFirstPartyForSameSiteCookies): Added.
2327         * loader/CookieJar.cpp:
2328         (WebCore::sameSiteInfo): Returns the same-site info for the request used to load the specified document.
2329         (WebCore::cookies): Pass the same-site info down to the platform.
2330         (WebCore::cookieRequestHeaderFieldProxy): Ditto.
2331         (WebCore::setCookies): Ditto.
2332         (WebCore::cookieRequestHeaderFieldValue): Ditto.
2333         (WebCore::getRawCookies): Ditto.
2334         * loader/DocumentLoader.cpp:
2335         (WebCore::DocumentLoader::willSendRequest): Add same-site info to the request.
2336         (WebCore::DocumentLoader::startLoadingMainResource): Update a FIXME comment to explain that
2337         we can simplify ResourceRequestBase if we can remove the call to addExtraFieldsToMainResourceRequest()
2338         here. Specifically, we would not need to differentiate between a request with an unspecified
2339         same-site state (default state of a new request) from a request whose same-site state has
2340         been explicitly set if we can assume that the same-site state of a request is set exactly
2341         once. In absence of this guarantee we need an "unspecified" state to avoid overriding existing
2342         same-site information computed with a null initiating document (the case of a new address bar
2343         initiated load) from a load initiated by the document associated with this loader.
2344         * loader/FrameLoader.cpp:
2345         (WebCore::FrameLoader::setFirstPartyForCookies): Modified to also update the first party for
2346         same-site cookies ("site for cookies").
2347         (WebCore::FrameLoader::load): Add same-site info to the request.
2348         (WebCore::FrameLoader::reload): Ditto.
2349         (WebCore::FrameLoader::setOriginalURLForDownloadRequest): Ditto.
2350         (WebCore::FrameLoader::addExtraFieldsToRequest): If the request does not already have
2351         same-site info then compute it and add it to the request. Mark main frame main resource
2352         requests as a "top-site".
2353         (WebCore::FrameLoader::addSameSiteInfoToRequestIfNeeded): Implements the "'Same-site' and 'cross-site'
2354         Requests" algorithm from <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-2.1>.
2355         (WebCore::createWindow): Add same-site info to the request.
2356         * loader/FrameLoader.h:
2357         * loader/ResourceLoader.cpp:
2358         (WebCore::ResourceLoader::init): Ditto.
2359         * page/DOMWindow.cpp:
2360         (WebCore::DOMWindow::createWindow): Ditto.
2361         * page/SecurityPolicy.cpp:
2362         (WebCore::SecurityPolicy::shouldInheritSecurityOriginFromOwner): Moved from Document.cpp.
2363         * page/SecurityPolicy.h:
2364         * platform/CookiesStrategy.h:
2365         * platform/network/CacheValidation.cpp:
2366         (WebCore::headerValueForVary): Pass the same-site info down to the platform.
2367         * platform/network/CookieRequestHeaderFieldProxy.h:
2368         (WebCore::CookieRequestHeaderFieldProxy::encode const): Encode same-site bits.
2369         (WebCore::CookieRequestHeaderFieldProxy::decode): Decode same-site bits.
2370         * platform/network/PlatformCookieJar.h:
2371         * platform/network/ResourceRequestBase.cpp:
2372         (WebCore::ResourceRequestBase::setAsIsolatedCopy): Added.
2373         (WebCore::ResourceRequestBase::isSameSite const): Added.
2374         (WebCore::ResourceRequestBase::setIsSameSite): Added.
2375         (WebCore::ResourceRequestBase::isTopSite const): Added.
2376         (WebCore::ResourceRequestBase::setIsTopSite): Added.
2377         (WebCore::equalIgnoringHeaderFields):
2378         * platform/network/ResourceRequestBase.h:
2379         (WebCore::ResourceRequestBase::isSameSiteUnspecified const): Added. See comment for DocumentLoader::startLoadingMainResource()
2380         for more details.
2381         (WebCore::registrableDomainsAreEqual): Added.
2382         (WebCore::ResourceRequestBase::encodeBase const): Encode same-site bits.
2383         (WebCore::ResourceRequestBase::decodeBase): Decode same-site bits.
2384         * platform/network/SameSiteInfo.cpp: Added.
2385         (WebCore::SameSiteInfo::create):
2386         * platform/network/SameSiteInfo.h: Added.
2387         (WebCore::SameSiteInfo::encode const):
2388         (WebCore::SameSiteInfo::decode):
2389         * platform/network/cf/CookieJarCFNet.cpp:
2390         (WebCore::setCookiesFromDOM): Pass Same-Site info down.
2391         (WebCore::cookiesForDOM): Ditto.
2392         (WebCore::cookieRequestHeaderFieldValue): Ditto.
2393         (WebCore::getRawCookies): Ditto.
2394         * platform/network/cf/ResourceRequestCFNet.cpp:
2395         (WebCore::siteForCookies): Added.
2396         (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info.
2397         (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto.
2398         * platform/network/cocoa/ResourceRequestCocoa.mm:
2399         (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto.
2400         (WebCore::siteForCookies): Added.
2401         (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info.
2402         * platform/network/curl/CookieJarCurl.cpp:
2403         (WebCore::cookiesForDOM): Pass Same-Site info down.
2404         (WebCore::setCookiesFromDOM): Ditto.
2405         (WebCore::cookieRequestHeaderFieldValue): Ditto.
2406         (WebCore::getRawCookies): Ditto.
2407         * platform/network/curl/CookieJarCurl.h:
2408         * platform/network/curl/CookieJarCurlDatabase.cpp:
2409         (WebCore::CookieJarCurlDatabase::setCookiesFromDOM const): Ditto.
2410         (WebCore::CookieJarCurlDatabase::cookiesForDOM const): Ditto.
2411         (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const): Ditto.
2412         (WebCore::CookieJarCurlDatabase::getRawCookies const): Ditto.
2413         * platform/network/curl/CookieJarCurlDatabase.h:
2414         * platform/network/curl/ResourceHandleCurl.cpp:
2415         (WebCore::ResourceHandle::createCurlRequest): Ditto.
2416         * platform/network/mac/CookieJarMac.mm:
2417         (WebCore::cookiesForURL): Added; shared function to return the cookies based on the specified criterion. 
2418         (WebCore::setHTTPCookiesForURL): Moved from the bottom of the file to top to be closer to the other
2419         CFNetwork helper functions. Modified to support fetching same-site cookies.
2420         (WebCore::httpCookiesForURL): Moved to be under setHTTPCookiesForURL(). Modified to call cookiesForURL().
2421         Note the SPI used in cookiesForURL() apply the same criterion for whether to fetch secure cookies as we
2422         were computing here. That is, the CFNetwork SPI only returns secure cookies if the specified URL's scheme
2423         case-insensitively matches "https".
2424         (WebCore::cookiesInPartitionForURL): Wrote in terms of cookiesForURL().
2425         (WebCore::cookiesForSession): Pass the Same-Site info.
2426         (WebCore::cookiesForDOM): Ditto.
2427         (WebCore::cookieRequestHeaderFieldValue): Ditto.
2428         (WebCore::setCookiesFromDOM): Ditto.
2429         (WebCore::getRawCookies): Ditto.
2430         (WebCore::deleteCookie): Pass std::nullopt for the Same-Site info so that we do not consider the SameSite
2431         attribute when fetching cookies to delete.
2432         * platform/network/soup/CookieJarSoup.cpp:
2433         (WebCore::setCookiesFromDOM): Pass the Same-Site info.
2434         (WebCore::cookiesForDOM): Ditto.
2435         (WebCore::cookieRequestHeaderFieldValue): Ditto.
2436         (WebCore::getRawCookies): Ditto.
2437         * workers/service/context/ServiceWorkerThreadProxy.cpp:
2438         (WebCore::createPageForServiceWorker): Set the first party for same site cookies ("site for cookies") to
2439         the script URL.
2440         * xml/XSLTProcessor.cpp:
2441         (WebCore::XSLTProcessor::createDocumentFromSource): Copy the first party for same-site cookies to the
2442         new document.
2443
2444 2018-04-23  Youenn Fablet  <youenn@apple.com>
2445
2446         Make WebLoaderStrategy send to NetworkResourceLoader necessary parameters to handle full loads in NetworkProcess
2447         https://bugs.webkit.org/show_bug.cgi?id=184763
2448
2449         Reviewed by Chris Dumez.
2450
2451         No change of behavior yet since we do not use these parameters in NetworkProcess yet.
2452
2453         Add PreflightPolicy and CSP response headers as ResourceLoaderOptions.
2454         This allows passing them from DocumentThreadableLoader to WebLoaderStrategy.
2455
2456         Allow getting the original headers from a SubresourceLoader.
2457         This allows passing them from DocumentThreadableLoader down to WebLoaderStrategy.
2458
2459         * Modules/fetch/FetchLoader.cpp:
2460         (WebCore::FetchLoader::startLoadingBlobURL):
2461         (WebCore::FetchLoader::start):
2462         * loader/DocumentThreadableLoader.cpp:
2463         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
2464         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
2465         (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):
2466         * loader/ResourceLoaderOptions.h:
2467         * loader/SubresourceLoader.cpp:
2468         (WebCore::SubresourceLoader::originalHeaders const):
2469         * loader/SubresourceLoader.h:
2470         * loader/ThreadableLoader.cpp:
2471         (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions):
2472         (WebCore::ThreadableLoaderOptions::isolatedCopy const):
2473         * loader/ThreadableLoader.h:
2474         * page/EventSource.cpp:
2475         (WebCore::EventSource::connect):
2476         * xml/XMLHttpRequest.cpp:
2477         (WebCore::XMLHttpRequest::createRequest):
2478
2479 2018-04-23  Michael Catanzaro  <mcatanzaro@igalia.com>
2480
2481         [WPE][GTK] Remove WlUniquePtr<wl_display> footgun
2482         https://bugs.webkit.org/show_bug.cgi?id=184405
2483
2484         Reviewed by Carlos Garcia Campos.
2485
2486         WlUniquePtr<wl_display> is a pretty big footgun because there are two different destruction
2487         functions -- wl_display_disconnect() and wl_display_destroy() -- and which one you need to
2488         use depends on how the wl_display() was created, and WebKit uses both in different places.
2489         So WlUniquePtr<wl_display> is pretty unsafe. See bug #176490 for an example of fun caused
2490         by using it incorrectly.
2491
2492         Let's use std::unique_ptr with custom deleter functors instead.
2493
2494         * platform/graphics/wayland/WlUniquePtr.h:
2495
2496 2018-04-23  Antti Koivisto  <antti@apple.com>
2497
2498         REGRESSION (r220112): reCAPTCHA images render off screen on Twitch.tv app Log In or Sign Up
2499         https://bugs.webkit.org/show_bug.cgi?id=182859
2500         <rdar://problem/37595065>
2501
2502         Reviewed by Zalan Bujtas.
2503
2504         Roll out this change from the trunk as the issue it fixed no longer occurs.
2505
2506         * css/MediaQueryEvaluator.cpp:
2507         (WebCore::orientationEvaluate):
2508         (WebCore::aspectRatioEvaluate):
2509         (WebCore::heightEvaluate):
2510         (WebCore::widthEvaluate):
2511         * page/FrameView.cpp:
2512         (WebCore::FrameView::layoutSizeForMediaQuery const): Deleted.
2513         * page/FrameView.h:
2514         * page/LayoutContext.cpp:
2515         (WebCore::LayoutContext::handleLayoutWithFrameFlatteningIfNeeded):
2516
2517 2018-04-23  Daniel Bates  <dabates@apple.com>
2518
2519         Another attempt to fix the Windows build following r230921
2520         (https://bugs.webkit.org/show_bug.cgi?id=159464)
2521
2522         Pass dictionary key name using a string instead of a constant and pass CFURL* to
2523         siteForCookies().
2524
2525         * platform/network/cf/ResourceRequestCFNet.cpp:
2526         (WebCore::ResourceRequest::doUpdatePlatformRequest):
2527         (WebCore::ResourceRequest::doUpdateResourceRequest):
2528
2529 2018-04-23  Zalan Bujtas  <zalan@apple.com>
2530
2531         [LayoutFormattingContext] Initial commit.
2532         https://bugs.webkit.org/show_bug.cgi?id=184896
2533
2534         Reviewed by Antti Koivisto.
2535
2536         This is the initial commit of the new layout component -class definitions only (and mostly public functions).
2537         See the header files (and Tools/LayoutReloaded project) for more information.
2538
2539         // Top level layout.
2540         rootContainer = TreeBuilder::createLayoutTree(document);
2541         rootDisplayBox = new Display::Box();
2542         rootDisplayBox->setSize(viewportSize);
2543         layoutContext = new LayoutContext(rootContainer, rootDisplayBox);
2544         layoutContext->layout(rootContainer);
2545
2546         Driven by build time flag (currently off). Not testable yet.
2547
2548         * Configurations/FeatureDefines.xcconfig:
2549         * Sources.txt:
2550         * WebCore.xcodeproj/project.pbxproj:
2551         * layout/BlockFormatting/BlockFormattingContext.cpp: Added.
2552         * layout/BlockFormatting/BlockFormattingContext.h: Added.
2553         * layout/BlockFormatting/BlockFormattingState.cpp: Added.
2554         * layout/BlockFormatting/BlockFormattingState.h: Added.
2555         * layout/BlockFormatting/BlockMarginCollapse.cpp: Added.
2556         * layout/BlockFormatting/BlockMarginCollapse.h: Added.
2557         * layout/DisplayTree/DisplayBox.cpp: Added.
2558         * layout/DisplayTree/DisplayBox.h: Added.
2559         * layout/FloatingContext.cpp: Added.
2560         * layout/FloatingContext.h: Added.
2561         * layout/FloatingState.cpp: Added.
2562         * layout/FloatingState.h: Added.
2563         * layout/FormattingContext.cpp: Added.
2564         * layout/FormattingContext.h: Added.
2565         * layout/FormattingState.cpp: Added.
2566         * layout/FormattingState.h: Added.
2567         * layout/InlineFormatting/InlineFormattingContext.cpp: Added.
2568         * layout/InlineFormatting/InlineFormattingContext.h: Added.
2569         * layout/InlineFormatting/InlineFormattingState.cpp: Added.
2570         * layout/InlineFormatting/InlineFormattingState.h: Added.
2571         * layout/LayoutCtx.cpp: Added.
2572         * layout/LayoutCtx.h: Added.
2573         * layout/LayoutTree/LayoutBlockContainer.cpp: Added.
2574         * layout/LayoutTree/LayoutBlockContainer.h: Added.
2575         * layout/LayoutTree/LayoutBox.cpp: Added.
2576         * layout/LayoutTree/LayoutBox.h: Added.
2577         * layout/LayoutTree/LayoutContainer.cpp: Added.
2578         * layout/LayoutTree/LayoutContainer.h: Added.
2579         * layout/LayoutTree/LayoutCtx.h: Added.
2580         * layout/LayoutTree/LayoutInlineBox.cpp: Added.
2581         * layout/LayoutTree/LayoutInlineBox.h: Added.
2582         * layout/LayoutTree/LayoutInlineContainer.cpp: Added.
2583         * layout/LayoutTree/LayoutInlineContainer.h: Added.
2584
2585 2018-04-23  Daniel Bates  <dabates@apple.com>
2586
2587         Attempt to fix the Mac and iOS build after r230921
2588         (https://bugs.webkit.org/show_bug.cgi?id=159464)
2589
2590         Pass strings for the dictionary key names instead of using an extern constant as the
2591         latter may not be available on all systems.
2592
2593         * platform/network/mac/CookieJarMac.mm:
2594         (WebCore::setHTTPCookiesForURL):
2595
2596 2018-04-23  Daniel Bates  <dabates@apple.com>
2597
2598         Attempt to fix the build after r230921
2599         (https://bugs.webkit.org/show_bug.cgi?id=159464)
2600
2601         Pass Same-Site info through.
2602
2603         * platform/network/cf/CookieJarCFNet.cpp:
2604         (WebCore::cookieRequestHeaderFieldValue):
2605         * platform/network/curl/CookieJarCurl.cpp:
2606         (WebCore::cookieRequestHeaderFieldValue):
2607         * platform/network/curl/CookieJarCurlDatabase.cpp:
2608         (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const):
2609         * platform/network/soup/CookieJarSoup.cpp:
2610         (WebCore::cookieRequestHeaderFieldValue):
2611
2612 2018-04-23  Ryan Haddad  <ryanhaddad@apple.com>
2613
2614         Unreviewed, speculative macOS build fix attempt.
2615
2616         * Modules/mediasource/SourceBuffer.cpp:
2617         (WebCore::SourceBuffer::provideMediaData):
2618
2619 2018-04-23  Daniel Bates  <dabates@apple.com>
2620
2621         Implement Same-Site cookies
2622         https://bugs.webkit.org/show_bug.cgi?id=159464
2623         <rdar://problem/27196358>
2624
2625         Reviewed by Brent Fulgham.
2626
2627         Implements support for Same-Site cookies as per <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00>.
2628         The implementation is materially consistent with the spec. though implements the computation
2629         for a document's "site for cookies" indirectly as part of loading its frame. This is done to
2630         avoid traversing the frame tree on each subresource request initiated by the document or one
2631         of its workers. We take advantage of the fact that Web Workers and Service Workers use their
2632         host document's loader to load resources on their behalf to use the correct "site for cookies"
2633         for requests (e.g. fetch()) initiating by them without the need to duplicate and store the
2634         host document's "site for cookies" in the worker's script execution context.
2635
2636         The implementation differs from the spec. in the handling of about: URLs and the empty URL
2637         and makes the implementation in WebKit match the behavior of Chrome and Firefox as well as
2638         consistent with origin inheritance as described in <https://html.spec.whatwg.org/multipage/browsers.html#origin>
2639         (16 April 2018). Specifically, requests to about:blank, about:srcdoc and the empty URL ("")
2640         are treated as same-site because these URLs inherit their origin from their owner.
2641
2642         Tests: http/tests/cookies/same-site/fetch-after-navigating-iframe-in-cross-origin-page.html
2643                http/tests/cookies/same-site/fetch-after-top-level-navigation-from-cross-origin-page.html
2644                http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.html
2645                http/tests/cookies/same-site/fetch-cookies-set-in-about-blank-iframe.html
2646                http/tests/cookies/same-site/fetch-in-about-blank-page.html
2647                http/tests/cookies/same-site/fetch-in-cross-origin-iframe.html
2648                http/tests/cookies/same-site/fetch-in-cross-origin-page.html
2649                http/tests/cookies/same-site/fetch-in-cross-origin-service-worker.html
2650                http/tests/cookies/same-site/fetch-in-cross-origin-worker.html
2651                http/tests/cookies/same-site/fetch-in-same-origin-page.html
2652                http/tests/cookies/same-site/fetch-in-same-origin-service-worker.html
2653                http/tests/cookies/same-site/fetch-in-same-origin-srcdoc-iframe.html
2654                http/tests/cookies/same-site/fetch-in-same-origin-worker.html
2655                http/tests/cookies/same-site/popup-cross-site-post.html
2656                http/tests/cookies/same-site/popup-cross-site.html
2657                http/tests/cookies/same-site/popup-same-site-post.html
2658                http/tests/cookies/same-site/popup-same-site-via-cross-site-redirect.html
2659                http/tests/cookies/same-site/popup-same-site-via-same-site-redirect.html
2660                http/tests/cookies/same-site/popup-same-site.html
2661
2662         * Sources.txt: Add source file SameSiteInfo.cpp.
2663         * WebCore.xcodeproj/project.pbxproj: Add source files SameSiteInfo.{cpp, h}.
2664         * dom/Document.cpp:
2665         (WebCore::Document::initSecurityContext): Modified to call SecurityPolicy::shouldInheritSecurityOriginFromOwner().
2666         (WebCore::Document::shouldInheritContentSecurityPolicyFromOwner const): Ditto.
2667         (WebCore::shouldInheritSecurityOriginFromOwner): Deleted; moved to SecurityPolicy.
2668         * dom/Document.h:
2669         (WebCore::Document::firstPartyForSameSiteCookies const): Added.
2670         (WebCore::Document::setFirstPartyForSameSiteCookies): Added.
2671         * loader/CookieJar.cpp:
2672         (WebCore::sameSiteInfo): Returns the same-site info for the request used to load the specified document.
2673         (WebCore::cookies): Pass the same-site info down to the platform.
2674         (WebCore::cookieRequestHeaderFieldProxy): Ditto.
2675         (WebCore::setCookies): Ditto.
2676         (WebCore::cookieRequestHeaderFieldValue): Ditto.
2677         (WebCore::getRawCookies): Ditto.
2678         * loader/DocumentLoader.cpp:
2679         (WebCore::DocumentLoader::willSendRequest): Add same-site info to the request.
2680         (WebCore::DocumentLoader::startLoadingMainResource): Update a FIXME comment to explain that
2681         we can simplify ResourceRequestBase if we can remove the call to addExtraFieldsToMainResourceRequest()
2682         here. Specifically, we would not need to differentiate between a request with an unspecified
2683         same-site state (default state of a new request) from a request whose same-site state has
2684         been explicitly set if we can assume that the same-site state of a request is set exactly
2685         once. In absence of this guarantee we need an "unspecified" state to avoid overriding existing
2686         same-site information computed with a null initiating document (the case of a new address bar
2687         initiated load) from a load initiated by the document associated with this loader.
2688         * loader/FrameLoader.cpp:
2689         (WebCore::FrameLoader::setFirstPartyForCookies): Modified to also update the first party for
2690         same-site cookies ("site for cookies").
2691         (WebCore::FrameLoader::load): Add same-site info to the request.
2692         (WebCore::FrameLoader::reload): Ditto.
2693         (WebCore::FrameLoader::setOriginalURLForDownloadRequest): Ditto.
2694         (WebCore::FrameLoader::addExtraFieldsToRequest): If the request does not already have
2695         same-site info then compute it and add it to the request. Mark main frame main resource
2696         requests as a "top-site".
2697         (WebCore::FrameLoader::addSameSiteInfoToRequestIfNeeded): Implements the "'Same-site' and 'cross-site'
2698         Requests" algorithm from <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-2.1>.
2699         (WebCore::createWindow): Add same-site info to the request.
2700         * loader/FrameLoader.h:
2701         * loader/ResourceLoader.cpp:
2702         (WebCore::ResourceLoader::init): Ditto.
2703         * page/DOMWindow.cpp:
2704         (WebCore::DOMWindow::createWindow): Ditto.
2705         * page/SecurityPolicy.cpp:
2706         (WebCore::SecurityPolicy::shouldInheritSecurityOriginFromOwner): Moved from Document.cpp.
2707         * page/SecurityPolicy.h:
2708         * platform/CookiesStrategy.h:
2709         * platform/network/CacheValidation.cpp:
2710         (WebCore::headerValueForVary): Pass the same-site info down to the platform.
2711         * platform/network/CookieRequestHeaderFieldProxy.h:
2712         (WebCore::CookieRequestHeaderFieldProxy::encode const): Encode same-site bits.
2713         (WebCore::CookieRequestHeaderFieldProxy::decode): Decode same-site bits.
2714         * platform/network/PlatformCookieJar.h:
2715         * platform/network/ResourceRequestBase.cpp:
2716         (WebCore::ResourceRequestBase::setAsIsolatedCopy): Added.
2717         (WebCore::ResourceRequestBase::isSameSite const): Added.
2718         (WebCore::ResourceRequestBase::setIsSameSite): Added.
2719         (WebCore::ResourceRequestBase::isTopSite const): Added.
2720         (WebCore::ResourceRequestBase::setIsTopSite): Added.
2721         (WebCore::equalIgnoringHeaderFields):
2722         * platform/network/ResourceRequestBase.h:
2723         (WebCore::ResourceRequestBase::isSameSiteUnspecified const): Added. See comment for DocumentLoader::startLoadingMainResource()
2724         for more details.
2725         (WebCore::registrableDomainsAreEqual): Added.
2726         (WebCore::ResourceRequestBase::encodeBase const): Encode same-site bits.
2727         (WebCore::ResourceRequestBase::decodeBase): Decode same-site bits.
2728         * platform/network/SameSiteInfo.cpp: Added.
2729         (WebCore::SameSiteInfo::create):
2730         * platform/network/SameSiteInfo.h: Added.
2731         (WebCore::SameSiteInfo::encode const):
2732         (WebCore::SameSiteInfo::decode):
2733         * platform/network/cf/CookieJarCFNet.cpp:
2734         (WebCore::setCookiesFromDOM): Pass Same-Site info down.
2735         (WebCore::cookiesForDOM): Ditto.
2736         (WebCore::cookieRequestHeaderFieldValue): Ditto.
2737         (WebCore::getRawCookies): Ditto.
2738         * platform/network/cf/ResourceRequestCFNet.cpp:
2739         (WebCore::siteForCookies): Added.
2740         (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info.
2741         (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto.
2742         * platform/network/cocoa/ResourceRequestCocoa.mm:
2743         (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto.
2744         (WebCore::siteForCookies): Added.
2745         (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info.
2746         * platform/network/curl/CookieJarCurl.cpp:
2747         (WebCore::cookiesForDOM): Pass Same-Site info down.
2748         (WebCore::setCookiesFromDOM): Ditto.
2749         (WebCore::cookieRequestHeaderFieldValue): Ditto.
2750         (WebCore::getRawCookies): Ditto.
2751         * platform/network/curl/CookieJarCurl.h:
2752         * platform/network/curl/CookieJarCurlDatabase.cpp:
2753         (WebCore::CookieJarCurlDatabase::setCookiesFromDOM const): Ditto.
2754         (WebCore::CookieJarCurlDatabase::cookiesForDOM const): Ditto.
2755         (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const): Ditto.
2756         (WebCore::CookieJarCurlDatabase::getRawCookies const): Ditto.
2757         * platform/network/curl/CookieJarCurlDatabase.h:
2758         * platform/network/curl/ResourceHandleCurl.cpp:
2759         (WebCore::ResourceHandle::createCurlRequest): Ditto.
2760         * platform/network/mac/CookieJarMac.mm:
2761         (WebCore::cookiesForURL): Added; shared function to return the cookies based on the specified criterion.
2762         (WebCore::setHTTPCookiesForURL): Moved from the bottom of the file to top to be closer to the other
2763         CFNetwork helper functions. Modified to support fetching same-site cookies.
2764         (WebCore::httpCookiesForURL): Moved to be under setHTTPCookiesForURL(). Modified to call cookiesForURL().
2765         Note the SPI used in cookiesForURL() apply the same criterion for whether to fetch secure cookies as we
2766         were computing here. That is, the CFNetwork SPI only returns secure cookies if the specified URL's scheme
2767         case-insensitively matches "https".
2768         (WebCore::cookiesInPartitionForURL): Wrote in terms of cookiesForURL().
2769         (WebCore::cookiesForSession): Pass the Same-Site info.
2770         (WebCore::cookiesForDOM): Ditto.
2771         (WebCore::cookieRequestHeaderFieldValue): Ditto.
2772         (WebCore::setCookiesFromDOM): Ditto.
2773         (WebCore::getRawCookies): Ditto.
2774         (WebCore::deleteCookie): Pass std::nullopt for the Same-Site info so that we do not consider the SameSite
2775         attribute when fetching cookies to delete.
2776         * platform/network/soup/CookieJarSoup.cpp:
2777         (WebCore::setCookiesFromDOM): Pass the Same-Site info.
2778         (WebCore::cookiesForDOM): Ditto.
2779         (WebCore::cookieRequestHeaderFieldValue): Ditto.
2780         (WebCore::getRawCookies): Ditto.
2781         * workers/service/context/ServiceWorkerThreadProxy.cpp:
2782         (WebCore::createPageForServiceWorker): Set the first party for same site cookies ("site for cookies") to
2783         the script URL.
2784         * xml/XSLTProcessor.cpp:
2785         (WebCore::XSLTProcessor::createDocumentFromSource): Copy the first party for same-site cookies to the
2786         new document.
2787
2788 2018-04-23  Chris Dumez  <cdumez@apple.com>
2789
2790         HTML String load cannot be prevented by responding 'Cancel' asynchronously in decidePolicyForNavigationAction
2791         https://bugs.webkit.org/show_bug.cgi?id=184848
2792         <rdar://problem/39145306>
2793
2794         Reviewed by Brady Eidson.
2795
2796         When calling loadHTMLString on a WebView, we end up doing a load for 'about:blank'
2797         with substitute data. In such case, we want to do a regular asynchronous policy
2798         delegate check, there is no reason we need it to be synchronous. Update our check
2799         to make sure we only do a synchronous policy check for initial 'about:blank' loads
2800         that do not have substitute data.
2801
2802         * loader/PolicyChecker.cpp:
2803         (WebCore::PolicyChecker::checkNavigationPolicy):
2804
2805 2018-04-23  Wenson Hsieh  <wenson_hsieh@apple.com>
2806
2807         [Extra zoom mode] 100vw is roughly half of the viewport width in extra zoom mode
2808         https://bugs.webkit.org/show_bug.cgi?id=184871
2809         <rdar://problem/39477595>
2810
2811         Reviewed by Andy Estes.
2812
2813         Currently, when computing CSS viewport units, we use ViewportConfiguration::initialScaleIgnoringContentSize().
2814         This method computes an initial scale from the layout width and height without relying on any information
2815         derived from the current content size. This is done to ensure that the content size and viewport dimensions for
2816         CSS viewport units should not be simultaneously dependent on each other.
2817
2818         Since shrink-to-fit heuristics depend on content size, we currently assume that shrink-to-fit is disabled when
2819         computing initialScaleIgnoringContentSize, by always passing in `false` for `shouldIgnoreScalingConstraints`.
2820         However, in extra zoom mode, the opposite is true: since we force both `m_canIgnoreScalingConstraints` and
2821         `m_forceHorizontalShrinkToFit` to be `true` in this mode, we will always try to shrink-to-fit regardless of
2822         content size.
2823
2824         Because of this shrink-to-fit disparity between `initialScale` and `initialScaleIgnoringContentSize`, viewport
2825         units in extra zoom mode are currently computed assuming an initial scale set by the page, whereas the real
2826         viewport is scaled to fit, which causes any lengths computed in terms of vw and vh to be incorrect. To fix this,
2827         we introduce a version of shouldIgnoreScalingConstraints() that returns `true` iff scaling constraints are
2828         always ignored, regardless of content size. We then use this in initialScaleIgnoringContentSize, instead of
2829         always passing in `false` for `shouldIgnoreScalingConstraints`.
2830
2831         Test: fast/css/extrazoom/viewport-units-shrink-to-fit.html
2832
2833         * page/ViewportConfiguration.cpp:
2834         (WebCore::ViewportConfiguration::shouldIgnoreScalingConstraintsRegardlessOfContentSize const):
2835         (WebCore::ViewportConfiguration::initialScaleIgnoringContentSize const):
2836         * page/ViewportConfiguration.h:
2837
2838 2018-04-23  Zalan Bujtas  <zalan@apple.com>
2839
2840         [Simple line layout] Generate inline boxtree using simple line layout runs.
2841         https://bugs.webkit.org/show_bug.cgi?id=184833
2842
2843         Reviewed by Antti Koivisto.
2844
2845         RenderBlockFlow::ensureLineBoxes triggers line layout on the block content to replace
2846         the simple line layout runs with an inline boxtree. The runs generated by the fast path
2847         should always match the inline tree boxes.
2848         In this patch instead of triggering layout, we just convert the simple line runs to
2849         inline boxes.
2850         Currently, it works with only one, non-paginated text renderer, but we should be
2851         able to extend it to all the simple line layout content.   
2852
2853         Covered by existing tests.
2854
2855         * rendering/InlineBox.h:
2856         (WebCore::InlineBox::setHasHyphen):
2857         (WebCore::InlineBox::setCanHaveLeadingExpansion):
2858         (WebCore::InlineBox::setCanHaveTrailingExpansion):
2859         (WebCore::InlineBox::setForceTrailingExpansion):
2860         (WebCore::InlineBox::setForceLeadingExpansion):
2861         (WebCore::InlineBox::hasHyphen const):
2862         (WebCore::InlineBox::canHaveLeadingExpansion const):
2863         (WebCore::InlineBox::canHaveTrailingExpansion const):
2864         (WebCore::InlineBox::forceTrailingExpansion const):
2865         * rendering/RenderBlockFlow.cpp:
2866         (WebCore::RenderBlockFlow::ensureLineBoxes):
2867         * rendering/RenderBlockFlow.h:
2868         * rendering/SimpleLineLayoutFlowContents.h:
2869         (WebCore::SimpleLineLayout::FlowContents::segmentForRun const):
2870         * rendering/SimpleLineLayoutFunctions.cpp:
2871         (WebCore::SimpleLineLayout::canUseForLineBoxTree):
2872         (WebCore::SimpleLineLayout::initializeInlineBox):
2873         (WebCore::SimpleLineLayout::generateLineBoxTree):
2874         * rendering/SimpleLineLayoutFunctions.h:
2875         * rendering/SimpleLineLayoutResolver.cpp:
2876         (WebCore::SimpleLineLayout::RunResolver::rangeForLine const):
2877         * rendering/SimpleLineLayoutResolver.h:
2878
2879 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
2880
2881         [CoordGraphics] Remove unused trajectory cruft in CoordinatedLayerTreeHost, CoordinatedGraphicsLayer
2882         https://bugs.webkit.org/show_bug.cgi?id=184881
2883
2884         Reviewed by Michael Catanzaro.
2885
2886         Remove the redundant findFirstDescendantWithContentsRecursively() and
2887         setVisibleContentRectTrajectoryVector() methods on the
2888         CoordinatedGraphicsLayer class.
2889
2890         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2891         (WebCore::CoordinatedGraphicsLayer::findFirstDescendantWithContentsRecursively): Deleted.
2892         (WebCore::CoordinatedGraphicsLayer::setVisibleContentRectTrajectoryVector): Deleted.
2893         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2894
2895 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
2896
2897         [CoordGraphics] TiledBackingStore unnecessarily tracks alpha support value
2898         https://bugs.webkit.org/show_bug.cgi?id=184880
2899
2900         Reviewed by Michael Catanzaro.
2901
2902         Drop the m_supportsAlpha member from the TiledBackingStore class. The
2903         member value was unused. TiledBackingStore::setSupportsAlpha() method
2904         is removed.
2905
2906         TiledBackingStore::setSupportsAlpha() invalidated the backing store,
2907         so CoordinatedGraphicsLayer::setContentsOpaque() now enforces the same
2908         behavior by manually updating the m_needsDisplay struct. This means
2909         that during the following layer flush the backing store is repainted
2910         in its entirety.
2911
2912         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2913         (WebCore::CoordinatedGraphicsLayer::setContentsOpaque):
2914         (WebCore::CoordinatedGraphicsLayer::createBackingStore):
2915         * platform/graphics/texmap/coordinated/TiledBackingStore.cpp:
2916         (WebCore::TiledBackingStore::TiledBackingStore):
2917         (WebCore::TiledBackingStore::setSupportsAlpha): Deleted.
2918         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
2919
2920 2018-04-23  Thibault Saunier  <tsaunier@igalia.com>
2921
2922         [GStreamer] Start implementing Audio/VideoTrackPrivateGSTreamer::kind method
2923         https://bugs.webkit.org/show_bug.cgi?id=184650
2924
2925         Reviewed by Philippe Normand.
2926
2927         In the playbin3 case we can assume that if the GstStream is selected by default,
2928         it is the Main track of that kind.
2929
2930         No new tests are added as:
2931             * It relies on playbin3 case which support might be compiled out
2932             * we already have a few test that are currently disabled in the mediastream
2933               testsuite. This patch is part of the work to enable them.
2934
2935         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
2936         (WebCore::AudioTrackPrivateGStreamer::kind const):
2937         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
2938         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
2939         (WebCore::VideoTrackPrivateGStreamer::kind const):
2940         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
2941
2942 2018-04-23  Alicia Boya García  <aboya@igalia.com>
2943
2944         [MSE] Add allSamplesInTrackEnqueued event
2945         https://bugs.webkit.org/show_bug.cgi?id=184737
2946
2947         MediaSource has a .endOfStream() method to signal when there are no more frames
2948         after the ones currently buffered.
2949
2950         This bit of data is important for some multimedia frameworks. For instance, in
2951         GStreamer a stream of frames being decoded should be terminated by a
2952         'end-of-stream' (EOS) event that has a similar meaning. Some GStreamer elements
2953         will expect this event in order to work properly under some circumstances.
2954
2955         Unfortunately currently WebKit provides no mechanism for this: an event of
2956         sorts should be emitted after no more frames are going to be enqueued to signal
2957         the end of the stream. The closest mechanism WebKit has for this is
2958         `markEndOfStream()`, but it's not exactly the same: markEndOfStream() informs
2959         that -- as far as network buffering is concerned -- we are done; but at that
2960         point there may still be (and often are) many frames waiting in the
2961         decodeQueue, so it would be wrong to signal the decoder that there are no more
2962         frames.
2963
2964         This patch introduces a new optional method in SourceBufferPrivate,
2965         `allSamplesInTrackEnqueued(const AtomicString& trackID)` that is called
2966         whenever the MediaSource is in "ended" state (the user has called
2967         `MediaSource.endOfStream()`) and the decodeQueue is empty. Media framework
2968         implementations can use this method to send a EOS event to a decoder that needs
2969         it.
2970
2971         Reviewed by Xabier Rodriguez-Calvar.
2972
2973         * Modules/mediasource/MediaSource.cpp:
2974         (WebCore::MediaSource::streamEndedWithError):
2975         * Modules/mediasource/SourceBuffer.cpp:
2976         (WebCore::SourceBuffer::provideMediaData):
2977         (WebCore::SourceBuffer::trySignalAllSamplesInTrackEnqueued):
2978         (WebCore::SourceBuffer::trySignalAllSamplesEnqueued):
2979         * Modules/mediasource/SourceBuffer.h:
2980         * platform/graphics/SourceBufferPrivate.h:
2981         (WebCore::SourceBufferPrivate::allSamplesInTrackEnqueued):
2982         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
2983         (WebCore::MediaSourceClientGStreamerMSE::allSamplesInTrackEnqueued):
2984         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:
2985         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
2986         (WebCore::PlaybackPipeline::allSamplesInTrackEnqueued):
2987         * platform/graphics/gstreamer/mse/PlaybackPipeline.h:
2988         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
2989         (WebCore::SourceBufferPrivateGStreamer::allSamplesInTrackEnqueued):
2990         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h:
2991
2992 2018-04-23  Ms2ger  <Ms2ger@igalia.com>
2993
2994         Avoid uninitialized memory read.
2995         https://bugs.webkit.org/show_bug.cgi?id=184505
2996         <rdar://problem/39348325>
2997
2998         Reviewed by Dean Jackson.
2999
3000         Test: imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-bounds.html
3001
3002         * html/ImageBitmap.cpp:
3003         (WebCore::croppedSourceRectangleWithFormatting):
3004
3005 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
3006
3007         [TexMap] Drop RefCounted inheritance off of TextureMapperBackingStore
3008         https://bugs.webkit.org/show_bug.cgi?id=184810
3009
3010         Reviewed by Carlos Garcia Campos.
3011
3012         Turn TextureMapperBackingStore into a simple interface that doesn't
3013         inherit from RefCounted<>. Instead, push that inheritance off to the
3014         classes that implement the TextureMapperBackingStore interface. This
3015         narrows down the purpose of TextureMapperBackingStore towards a simple
3016         interface that TextureMapper algorithms can work with.
3017
3018         TextureMapperLayer has its m_backingStore member variable turn into
3019         a simple pointer instead of a RefPtr<>. Setter method and call sites of
3020         that method are updated to reflect that.
3021
3022         TextureMapperTiledBackingStore now inherits from RefCounted<> directly,
3023         instead of through TextureMapperBackingStore.
3024
3025         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
3026         (WebCore::GraphicsLayerTextureMapper::commitLayerChanges):
3027         (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIfNeeded):
3028         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
3029         * platform/graphics/texmap/TextureMapperBackingStore.h:
3030         * platform/graphics/texmap/TextureMapperLayer.cpp:
3031         (WebCore::TextureMapperLayer::setBackingStore):
3032         * platform/graphics/texmap/TextureMapperLayer.h:
3033         * platform/graphics/texmap/TextureMapperTiledBackingStore.h:
3034
3035 2018-04-22  Zan Dobersek  <zdobersek@igalia.com>
3036
3037         [AsyncScrolling] Add generic ScrollingThread implementation
3038         https://bugs.webkit.org/show_bug.cgi?id=184809
3039
3040         Reviewed by Yusuke Suzuki.
3041
3042         Add a generic ScrollingThread implementation that internally uses
3043         RunLoop facilities to run the scrolling thread and dispatch
3044         callbacks on that thread.
3045
3046         ScrollingThread::initializeRunLoop() retrieves address of the
3047         thread-specific RunLoop and signals the Condition object.
3048         ScrollingThread::wakeUpRunLoop() uses RunLoop::dispatch() to schedule
3049         callback dispatches on the scrolling thread.
3050
3051         ScrollingThread::createThreadIfNeeded() mimics Cocoa implementation and
3052         waits for the RunLoop address to be retrieved before continuing.
3053
3054         * SourcesGTK.txt: Add to build.
3055         * SourcesWPE.txt: Ditto.
3056         * page/scrolling/ScrollingThread.cpp:
3057         (WebCore::ScrollingThread::createThreadIfNeeded):
3058         * page/scrolling/ScrollingThread.h:
3059         * page/scrolling/generic/ScrollingThreadGeneric.cpp: Added.
3060         (WebCore::ScrollingThread::initializeRunLoop):
3061         (WebCore::ScrollingThread::wakeUpRunLoop):
3062
3063 2018-04-22  Zan Dobersek  <zdobersek@igalia.com>
3064
3065         [CoordinatedGraphics] Unused contentsSize, coveredRect attributes in CoordinatedGraphicsState
3066         https://bugs.webkit.org/show_bug.cgi?id=184811
3067
3068         Reviewed by Carlos Garcia Campos.
3069
3070         Remove the unused contentsSize and coveredRect attributes on the
3071         CoordinatedGraphicsState struct. CoordinatedGraphicsLayer::coverRect()
3072         method is now unused and can also be removed.
3073
3074         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
3075         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
3076
3077 2018-04-21  Daniel Bates  <dabates@apple.com>
3078
3079         Cleanup CookieRequestHeaderFieldProxy
3080         https://bugs.webkit.org/show_bug.cgi?id=184868
3081
3082         Remove extraneous whitespace that I inadvertently added.
3083
3084         * platform/network/CookieRequestHeaderFieldProxy.h:
3085         (WebCore::CookieRequestHeaderFieldProxy::decode):
3086
3087 2018-04-21  Daniel Bates  <dabates@apple.com>
3088
3089         Cleanup CookieRequestHeaderFieldProxy
3090         https://bugs.webkit.org/show_bug.cgi?id=184868
3091
3092         Reviewed by Youenn Fablet.
3093
3094         Simplify the struct CookieRequestHeaderFieldProxy and make it consistent with other structs.
3095         Among other changes, remove constructors for CookieRequestHeaderFieldProxy as they are
3096         unnecessary as all supported compilers support non-static data member initializers (NSDMI)
3097         for aggregates, remove prefix "m_" from the name of fields as this is struct exists for
3098         convenience and offers no encapsulation and simplify decoding logic of this struct.
3099
3100         No functionality changed. So, no new tests.
3101
3102         * loader/CookieJar.cpp:
3103         (WebCore::cookieRequestHeaderFieldProxy):
3104         * platform/network/CookieRequestHeaderFieldProxy.h:
3105         (WebCore::CookieRequestHeaderFieldProxy::encode const):
3106         (WebCore::CookieRequestHeaderFieldProxy::decode):
3107         (WebCore::CookieRequestHeaderFieldProxy::CookieRequestHeaderFieldProxy): Deleted.
3108         * platform/network/SocketStreamHandleImpl.cpp:
3109         (WebCore::cookieDataForHandshake):
3110         * platform/network/cf/CookieJarCFNet.cpp:
3111         (WebCore::cookieRequestHeaderFieldValue):
3112         * platform/network/curl/CookieJarCurl.cpp:
3113         (WebCore::cookieRequestHeaderFieldValue):
3114         * platform/network/curl/CookieJarCurlDatabase.cpp:
3115         (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const):
3116         * platform/network/mac/CookieJarMac.mm:
3117         (WebCore::cookieRequestHeaderFieldValue):
3118         * platform/network/soup/CookieJarSoup.cpp:
3119         (WebCore::cookieRequestHeaderFieldValue):
3120
3121 2018-04-21  Antoine Quint  <graouts@apple.com>
3122
3123         [Modern Media Controls] Show a loading indicator after pressing the play button in compact mode
3124         https://bugs.webkit.org/show_bug.cgi?id=184863
3125         <rdar://problem/38939468>
3126
3127         Reviewed by Dean Jackson.
3128
3129         We now display a loading indicator after pressing the play button when in compact mode. We also update the
3130         behavior to use assets provided through WebKitAdditions (see webkit.org/b/184862) for the play button and
3131         the invalid icon. Additionally, we always show a 20% opaque black overlay in the background while any piece
3132         of user interface is up.
3133
3134         * Modules/modern-media-controls/controls/compact-activity-indicator.css: Added.
3135         (button.compact-activity-indicator > picture): The loading indicator asset is a sprite made of 23 frames, so
3136         we specify the mask size (since all buttons are rendered via a mask) to be 23 * 100% the rendered size. The
3137         display of the loading indicator is performed with a first intro animation which runs once through the first
3138         8 frames and then a continuously looping animation going through the remaining frames. We use a frames()
3139         timing function to achieve the frame-by-frame effect while using only from/to keyframe animations. When we
3140         fade out, we use a simply opacity fade, which is combined with the spinning animation. We use CSS variables
3141         to encode both animations so they can be used combined or one at a time without redefining the whole animation
3142         property.
3143         (button.compact-activity-indicator.spins > picture): Use the "spins" animation variable when spinning.
3144         (button.compact-activity-indicator.spins.fades-out > picture): Combine the "spins" and "fades-out" animation
3145         variables when fading out.
3146         (@keyframes compact-activity-indicator-intro): Animation going through the first 8 frames of the loading indicator.
3147         (@keyframes compact-activity-indicator-loop): Animation going through the remaining frames of the loading indicator.
3148         (@keyframes compact-activity-indicator-fades-out): Animation fading opacity from 1 to 0.
3149         * Modules/modern-media-controls/controls/compact-activity-indicator.js: Added.
3150         (CompactActivityIndicator):
3151         (CompactActivityIndicator.prototype.show): Add the "spins" CSS class to show the control spinning with the intro animation.
3152         (CompactActivityIndicator.prototype.hide): Add the "fades-out" CSS class to hide the control, removing both this class and
3153         the "spins" class when the fade-out animation completes.
3154         * Modules/modern-media-controls/controls/compact-media-controls.css: Added.
3155         (.media-controls.compact:before): Add a 20% black overlay over the video frame to provide contrast for controls.
3156         (.media-controls.compact button): Ensure buttons are sized to use the entire video frame so that their hit region
3157         comprises the whole video frame.
3158         (.media-controls.compact button > picture): Override default blending styles for a simple solid white mask.
3159         (.media-controls.compact button:active > picture): Turn off the scale down effect when pressing a button.
3160         * Modules/modern-media-controls/controls/compact-media-controls.js: Expose a "state" property for the compact media controls,
3161         which can be exlusively one of three: "paused", "pending" and "invalid".
3162         (CompactMediaControls.):
3163         (CompactMediaControls.prototype.get state):
3164         (CompactMediaControls.prototype.set state):
3165         (CompactMediaControls.prototype.layout): In the "paused" state, show the play button. In the "pending" state show
3166         the loading indicator. In the "invalid" state show the invalid button.
3167         (CompactMediaControls.prototype.get placard): Deleted.
3168         (CompactMediaControls.prototype.set placard): Deleted.
3169         * Modules/modern-media-controls/js-files:
3170         * Modules/modern-media-controls/media/compact-media-controls-support.js: Added.
3171         (CompactMediaControlsSupport.prototype.get mediaEvents):
3172         (CompactMediaControlsSupport.prototype.handleEvent): Make the controls enter the "paused" state when receiving a "pause"
3173         event. Make the controls enter the "invalid" state when receiving an "error" event. 
3174         (CompactMediaControlsSupport.prototype.enable):
3175         (CompactMediaControlsSupport.prototype.disable):
3176         (CompactMediaControlsSupport.prototype.buttonWasPressed): Play the media when pressing the play button and make the controls
3177         enter the "pending" state. When pressing the loading indicator, pause the media and make the controls enter the "paused" state.
3178         (CompactMediaControlsSupport.prototype._buttons):
3179         (CompactMediaControlsSupport):
3180         * Modules/modern-media-controls/media/media-controller.js:
3181         (MediaController.prototype._supportingObjectClasses): Only use CompactMediaControlsSupport as a media controller supporting object
3182         in the compact mode.
3183         * Modules/modern-media-controls/media/placard-support.js:
3184         (PlacardSupport.prototype.get mediaEvents): This media controller support object no longer needs to deal with compact mode.
3185         * Modules/modern-media-controls/media/playback-support.js:
3186         (PlaybackSupport.prototype.syncControl): This media controller support object no longer needs to deal with compact mode.
3187         (PlaybackSupport):
3188
3189 2018-04-21  Antoine Quint  <graouts@apple.com>
3190
3191         [Modern Media Controls] Obtain compact mode icons through WebKitAdditions
3192         https://bugs.webkit.org/show_bug.cgi?id=184862
3193         <rdar://problem/39621645>
3194
3195         Reviewed by Jon Lee.
3196
3197         * Modules/modern-media-controls/controls/button.js:
3198         (Button.prototype._updateImageMetrics): Handle PDF assets where the image source's intrinsic size needs
3199         to be adjusted for the device pixel density.
3200         (Button):
3201         * Modules/modern-media-controls/controls/icon-service.js: Expect three additional icons provided through
3202         WebKitAdditions, including two in the PDF format, so we add support for this format.
3203         * WebCore.xcodeproj/project.pbxproj: Copy additional assets from the WebKitAdditions build directory should
3204         any be present.
3205
3206 2018-04-21  Dean Jackson  <dino@apple.com>
3207
3208         Expose whether you've build with the Apple Internal SDK
3209         https://bugs.webkit.org/show_bug.cgi?id=184864
3210
3211         Reviewed by Wenson Hsieh.
3212
3213         Internals API to let a test know if it is running with the
3214         Apple internal SDK.
3215
3216         * testing/Internals.cpp:
3217         (WebCore::usingAppleInternalSDK const):
3218         * testing/Internals.h:
3219         * testing/Internals.idl:
3220
3221 2018-04-20  Nan Wang  <n_wang@apple.com>
3222
3223         AX: AOM does not work with DOM Level 1 events
3224         https://bugs.webkit.org/show_bug.cgi?id=184847
3225
3226         Reviewed by Chris Fleizach.
3227
3228         Added the accessibility events to the HTML attribute names.
3229
3230         Test cases are added to the existing layout tests.
3231
3232         * html/HTMLAttributeNames.in:
3233         * html/HTMLElement.cpp:
3234         (WebCore::HTMLElement::createEventHandlerNameMap):
3235
3236 2018-04-20  Carlos Garcia Campos  <cgarcia@igalia.com>
3237
3238         REGRESSION(r228088): [SOUP] Check TLS errors for WebSockets on GTlsConnection::accept-certificate
3239         https://bugs.webkit.org/show_bug.cgi?id=184804
3240
3241         Reviewed by Michael Catanzaro.
3242
3243         * platform/network/soup/SocketStreamHandleImpl.h: Add a public url getter.
3244         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
3245         (WebCore::acceptCertificateCallback): Call SoupNetworkSession::checkTLSErrors() to decide whether to accept the
3246         certificate or not.
3247         (WebCore::connectProgressCallback): Receive the SocketStreamHandle and pass it to acceptCertificateCallback callback.
3248         (WebCore::socketClientEventCallback): Ditto.
3249         (WebCore::SocketStreamHandleImpl::create): Always connect to network events.
3250         (WebCore::wssConnectionAcceptCertificateCallback): Deleted.
3251         (WebCore::wssSocketClientEventCallback): Deleted.
3252
3253 2018-04-20  Carlos Garcia Campos  <cgarcia@igalia.com>
3254
3255         [SOUP] Do TLS error checking on GTlsConnection::accept-certificate
3256         https://bugs.webkit.org/show_bug.cgi?id=184480
3257
3258         Reviewed by Michael Catanzaro.
3259
3260         * platform/network/soup/ResourceError.h: Change tlsError to recieve a failing URL instead of a SoupRequest,
3261         since the request was only used to get the failing URL.
3262         * platform/network/soup/ResourceErrorSoup.cpp:
3263         (WebCore::ResourceError::tlsError): Use the given failing URL.
3264         * platform/network/soup/SoupNetworkSession.cpp:
3265         (WebCore::SoupNetworkSession::SoupNetworkSession): Use ssl-strict when creating the SoupSession to handle the
3266         certificates ourselves by connecting to GTlsConnection::accept-certificate.
3267         (WebCore::SoupNetworkSession::checkTLSErrors): Updated to receive a URL, certificate and errors instead of
3268         receiving a SoupRequest and SoupMessage and extract the url, certirficate and errors from them. Also return the
3269         optional error directly instead of using a completion handler since the function is always synchronous.
3270         * platform/network/soup/SoupNetworkSession.h:
3271
3272 2018-04-20  Tim Horton  <timothy_horton@apple.com>
3273
3274         Adjust geolocation feature flag
3275         https://bugs.webkit.org/show_bug.cgi?id=184856
3276
3277         Reviewed by Wenson Hsieh.
3278
3279         * Configurations/FeatureDefines.xcconfig:
3280
3281 2018-04-20  Chris Dumez  <cdumez@apple.com>
3282
3283         Unreviewed attempt to fix Windows build after r230875.
3284
3285         * platform/network/cf/CookieJarCFNet.cpp:
3286         (WebCore::cookieRequestHeaderFieldValue):
3287         * platform/network/curl/CookieJarCurlDatabase.cpp:
3288
3289 2018-04-20  Chris Dumez  <cdumez@apple.com>
3290
3291         REGRESSION (r229828): web view doesn’t update or respond to resizing until client calls policy decision handler
3292         https://bugs.webkit.org/show_bug.cgi?id=184210
3293         <rdar://problem/39072354>
3294
3295         Reviewed by Wenson Hsieh.
3296
3297         r229828 tried to have some API tests happy on iOS by freezing the layer tree
3298         during the navigation policy decision. However, this is observable by the client
3299         application and a regression from when the policy delegate was synchronous.
3300
3301         To address the issue, this patch reverts r229828 and instead updates the iOS
3302         API tests to wait for the next presentation update after navigating
3303         before interacting with the view.
3304
3305         * loader/FrameLoaderClient.h:
3306         * loader/PolicyChecker.cpp:
3307         (WebCore::PolicyChecker::checkNavigationPolicy):
3308
3309 2018-04-20  Brent Fulgham  <bfulgham@apple.com>
3310
3311         Limit cookie header access to Network process
3312         https://bugs.webkit.org/show_bug.cgi?id=184764
3313         <rdar://problem/36785285>
3314
3315         Reviewed by Youenn Fablet.
3316
3317         Revise the handling of cookie request headers so that we don't interact with them in the
3318         WebContent process. They are only needed for interaction with the server and the network
3319         process, so we should limit their scope to just the Network process.
3320
3321         Instead, we should handle a token that represents the cookie headers in the WebContent
3322         process, which can be converted to the relevant cookie data in the network process when
3323         needed.
3324
3325         * Modules/websockets/WebSocketChannel.cpp:
3326         (WebCore::WebSocketChannel::didOpenSocketStream):
3327         * Modules/websockets/WebSocketHandshake.cpp:
3328         (WebCore::WebSocketHandshake::clientHandshakeMessage const):
3329         (WebCore::WebSocketHandshake::clientHandshakeRequest const):
3330         (WebCore::WebSocketHandshake::clientHandshakeCookieRequestHeaderFieldProxy const):
3331         (WebCore::WebSocketHandshake::clientHandshakeMessage): Deleted.
3332         (WebCore::WebSocketHandshake::clientHandshakeRequest): Deleted.
3333         * Modules/websockets/WebSocketHandshake.h:
3334         * WebCore.xcodeproj/project.pbxproj:
3335         * loader/CookieJar.cpp:
3336         (WebCore::cookieRequestHeaderFieldProxy):
3337         * loader/CookieJar.h:
3338         * platform/network/CookieRequestHeaderFieldProxy.h: Added.
3339         (WebCore::CookieRequestHeaderFieldProxy::CookieRequestHeaderFieldProxy):
3340         (WebCore::CookieRequestHeaderFieldProxy::isolatedCopy const):
3341         (WebCore::CookieRequestHeaderFieldProxy::encode const):
3342         (WebCore::CookieRequestHeaderFieldProxy::decode):
3343         * platform/network/PlatformCookieJar.h:
3344         * platform/network/SocketStreamHandle.cpp:
3345         (WebCore::SocketStreamHandle::sendHandshake):
3346         * platform/network/SocketStreamHandle.h:
3347         * platform/network/SocketStreamHandleImpl.cpp:
3348         (WebCore::SocketStreamHandleImpl::platformSendHandshake):
3349         * platform/network/cf/SocketStreamHandleImpl.h:
3350         * platform/network/curl/CookieJarCurl.cpp:
3351         (WebCore::cookieRequestHeaderFieldValue):
3352         * platform/network/curl/CookieJarCurl.h:
3353         * platform/network/curl/SocketStreamHandleImpl.h:
3354         * platform/network/mac/CookieJarMac.mm:
3355         (WebCore::cookieRequestHeaderFieldValue):
3356         * platform/network/soup/CookieJarSoup.cpp: