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