:first-child, :last-child, :nth-child, and :nth-of-type don't work on shadow root...
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-09-08  Ryosuke Niwa  <rniwa@webkit.org>
2
3         :first-child, :last-child, :nth-child, and :nth-of-type don't work on shadow root's children
4         https://bugs.webkit.org/show_bug.cgi?id=166748
5         <rdar://problem/29649177>
6
7         Reviewed by Yusuke Suzuki.
8
9         Added the support for matching positional pseudo classes. For now, we invalidate whenever a child node
10         of a non-UA ShadowRoot is mutated instead of a fine-grained style invalidation as done for regular elements.
11
12         Tests: fast/shadow-dom/nth-node-on-shadow-child-invalidation.html
13                fast/shadow-dom/nth-node-on-shadow-child-no-jit.html
14                fast/shadow-dom/nth-node-on-shadow-child.html
15
16         * css/SelectorChecker.cpp:
17         (WebCore::SelectorChecker::checkOne const):
18         * cssjit/SelectorCompiler.cpp:
19         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateWalkToParentElementOrShadowRoot):
20         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsFirstChild):
21         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsLastChild):
22         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsOnlyChild):
23         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateNthChildParentCheckAndRelationUpdate):
24         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChild):
25         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChildOf):
26         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateNthLastChildParentCheckAndRelationUpdate):
27         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthLastChild):
28         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthLastChildOf):
29         * dom/ShadowRoot.cpp:
30         (WebCore::ShadowRoot::childrenChanged): Invalidate the subtree whenever a child node is mutated.
31         * dom/ShadowRoot.h:
32         * domjit/DOMJITHelpers.h:
33         (WebCore::DOMJIT::branchTestIsShadowRootFlagOnNode): Added.
34         (WebCore::DOMJIT::branchTestIsElementOrShadowRootFlagOnNode): Added.
35
36 2018-09-11  Per Arne Vollan  <pvollan@apple.com>
37
38         Addressing post-review feedback on r235619.
39         https://bugs.webkit.org/show_bug.cgi?id=187925
40
41         Unreviewed.
42
43         * testing/Internals.cpp:
44         (WebCore::Internals::primaryScreenDisplayID):
45         * testing/Internals.h:
46
47 2018-09-11  Wenson Hsieh  <wenson_hsieh@apple.com>
48
49         [macOS] [WK2] Support changing foreground colors via color panel
50         https://bugs.webkit.org/show_bug.cgi?id=189382
51         <rdar://problem/44227311>
52
53         Reviewed by Ryosuke Niwa.
54
55         Small adjustments to support changing foreground text color using NSColorPanel in WebKit2. See comments below.
56         Tested by FontManagerTests.ChangeFontColorWithColorPanel.
57
58         * editing/EditingStyle.cpp:
59         (WebCore::StyleChange::extractTextStyles):
60
61         Support setting foreground text color with alpha by using a styled span element rather than a font element with
62         attributes. To do this, only populate `StyleChange::m_applyFontColor` if the color is opaque. This is because
63         the font element does not support `rgba()` syntax, so any font colors here with alpha that are serialized to
64         `rgba()` result in a garbage value for the computed color style.
65
66         * editing/FontAttributeChanges.cpp:
67         (WebCore::FontAttributeChanges::editAction const):
68
69         Add a helper to return the relevant EditAction describing this set of FontAttributeChanges.
70
71         * editing/FontAttributeChanges.h:
72         (WebCore::FontChanges::isEmpty const):
73
74 2018-09-11  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
75
76         Shrink size of ResourseResponseBase
77         https://bugs.webkit.org/show_bug.cgi?id=189501
78
79         Reviewed by Simon Fraser.
80
81         We reduce the size of ResourceResponseBase by the following two optimizations.
82
83         1. Use bitfields for bool flags and reorder them.
84
85         2. Use Markable<> in CacheControlDirectives, which is held by ResourceResponseBase.
86
87         This patch reduces the size of ResourceResponseBase from 416 to 392 bytes.
88
89         No behavior change.
90
91         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
92         (WebCore::WebCoreAVFResourceLoader::responseReceived):
93         (WebCore::WebCoreAVFResourceLoader::fulfillRequestWithResource):
94         * platform/network/CacheValidation.h:
95         (WebCore::CacheControlDirectives::CacheControlDirectives):
96         * platform/network/ResourceResponseBase.cpp:
97         (WebCore::ResourceResponseBase::ResourceResponseBase):
98         (WebCore::ResourceResponseBase::contentRange const):
99         * platform/network/ResourceResponseBase.h:
100         (WebCore::ResourceResponseBase::decode):
101
102 2018-09-11  Michael Catanzaro  <mcatanzaro@igalia.com>
103
104         Unreviewed, fix some -Wreturn-type warnings
105
106         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
107         (WebCore::sourceFromNewReceiver):
108         * Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp:
109         (WebCore::toRTCRtpTransceiverDirection):
110         (WebCore::fromRTCRtpTransceiverDirection):
111
112 2018-09-11  Jiewen Tan  <jiewen_tan@apple.com>
113
114         Unreviewed, a speculative build fix for r235888.
115
116         * Modules/mediastream/MediaDevices.h:
117         Add class Document forward declaration.
118
119 2018-09-11  Woodrow Wang  <woodrow_wang@apple.com>
120
121         Add Web API Statistics Collection
122         https://bugs.webkit.org/show_bug.cgi?id=187773
123         <rdar://problem/44155162>
124
125         Reviewed by Brent Fulgham.
126
127         Added data collection for web API statistics, specifically regarding the canvas, font loads, 
128         screen functions, and navigator functions. The data collection code is placed under a runtime 
129         enabled feature flag. The statistics are stored in a ResourceLoadStatistics object and written 
130         to a plist on disk. Added a new file CanvasActivityRecord.h and CanvasActivityRecord.cpp which
131         includes a struct to keep track of HTML5 canvas element read and writes. 
132
133         Tests: http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html
134                http/tests/webAPIStatistics/font-load-data-collection.html
135                http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html
136                http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html
137
138         * Sources.txt:
139         * WebCore.xcodeproj/project.pbxproj:
140         * css/CSSFontFaceSource.cpp:
141         (WebCore::CSSFontFaceSource::load):
142         * css/CSSFontSelector.cpp:
143         (WebCore::CSSFontSelector::fontRangesForFamily):
144         (WebCore::CSSFontSelector::fallbackFontAt):
145
146         The following are the functions where we'd like to record a canvas read.
147
148         * html/HTMLCanvasElement.cpp:
149         (WebCore::HTMLCanvasElement::toDataURL):
150         (WebCore::HTMLCanvasElement::toBlob):
151         (WebCore::HTMLCanvasElement::getImageData):
152         (WebCore::HTMLCanvasElement::toMediaSample):
153         (WebCore::HTMLCanvasElement::captureStream):
154
155         The following are the functions where we'd like to record a canvas write.
156
157         * html/canvas/CanvasRenderingContext2D.cpp:
158         (WebCore::CanvasRenderingContext2D::measureText):
159         (WebCore::CanvasRenderingContext2D::drawTextInternal):
160
161         The following files and functions handle the CanvasActivityRecord struct and
162         its respective functions.
163
164         * loader/CanvasActivityRecord.cpp: Added.
165         (WebCore::CanvasActivityRecord::recordWrittenOrMeasuredText):
166         (WebCore::CanvasActivityRecord::mergeWith):
167         * loader/CanvasActivityRecord.h: Added.
168         (WebCore::CanvasActivityRecord::encode const):
169         (WebCore::CanvasActivityRecord::decode):
170
171         * loader/DocumentThreadableLoader.cpp:
172         * loader/FrameLoader.cpp:
173         * loader/ResourceLoadObserver.cpp:
174         (WebCore::ResourceLoadObserver::logFontLoad):
175         (WebCore::ResourceLoadObserver::logCanvasRead):
176         (WebCore::ResourceLoadObserver::logCanvasWriteOrMeasure):
177         (WebCore::ResourceLoadObserver::logNavigatorAPIAccessed):
178         (WebCore::ResourceLoadObserver::logScreenAPIAccessed):
179
180         Before, entries in the ResourceLoadStatistics involving HashSets used "origin" as the key. 
181         Now the encodeHashSet function has been generalized to take any key to encode the entries 
182         in the HashSet. Also added functionality to encode an OptionSet by converting it to its 
183         raw bitmask state. 
184
185         * loader/ResourceLoadObserver.h:
186         * loader/ResourceLoadStatistics.cpp:
187         (WebCore::encodeHashSet):
188         (WebCore::encodeOriginHashSet):
189         (WebCore::encodeOptionSet):
190         (WebCore::encodeFontHashSet):
191         (WebCore::encodeCanvasActivityRecord):
192         (WebCore::ResourceLoadStatistics::encode const):
193         (WebCore::decodeHashSet):
194         (WebCore::decodeOriginHashSet):
195         (WebCore::decodeOptionSet):
196         (WebCore::decodeFontHashSet):
197         (WebCore::decodeCanvasActivityRecord):
198         (WebCore::ResourceLoadStatistics::decode):
199         (WebCore::navigatorAPIEnumToString):
200         (WebCore::screenAPIEnumToString):
201         (WebCore::appendNavigatorAPIOptionSet):
202         (WebCore::appendScreenAPIOptionSet):
203         (WebCore::ResourceLoadStatistics::toString const):
204         (WebCore::ResourceLoadStatistics::merge):
205         * loader/ResourceLoadStatistics.h:
206         * loader/ResourceTiming.cpp:
207
208         The following are the navigator functions recorded for the web API statistics.
209
210         * page/Navigator.cpp:
211         (WebCore::Navigator::appVersion const):
212         (WebCore::Navigator::userAgent const):
213         (WebCore::Navigator::plugins):
214         (WebCore::Navigator::mimeTypes):
215         (WebCore::Navigator::cookieEnabled const):
216         (WebCore::Navigator::javaEnabled const):
217
218         The following are the screen functions recorded for the web API statistics.
219
220         * page/Screen.cpp:
221         (WebCore::Screen::height const):
222         (WebCore::Screen::width const):
223         (WebCore::Screen::colorDepth const):
224         (WebCore::Screen::pixelDepth const):
225         (WebCore::Screen::availLeft const):
226         (WebCore::Screen::availTop const):
227         (WebCore::Screen::availHeight const):
228         (WebCore::Screen::availWidth const):
229
230 2018-09-11  Pablo Saavedra  <psaavedra@igalia.com>
231
232         playbackControlsManagerUpdateTimerFired and
233         m_playbackControlsManagerUpdateTimer must be
234         guarded with ENABLE(VIDEO), otherwise the following
235         error occurs with the VIDEO feature turned off:
236
237           error: 'MediaElementSession' has not been declared
238
239         Add missing #if ENABLE(VIDEO) Page.cpp and Page.h
240         https://bugs.webkit.org/show_bug.cgi?id=189500
241
242         Reviewed by Anders Carlsson.
243
244         * page/Page.cpp:
245         (WebCore::Page::Page):
246         (WebCore::Page::schedulePlaybackControlsManagerUpdate):
247         * page/Page.h:
248
249 2018-09-11  Frederic Wang  <fwang@igalia.com>
250
251         Refactor filter list checking code
252         https://bugs.webkit.org/show_bug.cgi?id=185087
253
254         Reviewed by Antonio Gomes.
255
256         No new tests, behavior unchanged.
257
258         * page/animation/KeyframeAnimation.h: Add missing forward-declaration FilterOperations.
259
260 == Rolled over to ChangeLog-2018-09-11 ==