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