Viewport unit values affected by Comand-+ zoom
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-11-29  Simon Fraser  <simon.fraser@apple.com>
2
3         Viewport unit values affected by Comand-+ zoom
4         https://bugs.webkit.org/show_bug.cgi?id=145614
5
6         Reviewed by Zalan Bujtas.
7         
8         Don't apply zooming when resolving viewport-relative lengths, since they should not
9         change based on the zoom level.
10
11         Test: fast/css/viewport-units-zoom.html
12
13         * css/CSSPrimitiveValue.cpp:
14         (WebCore::CSSPrimitiveValue::computeNonCalcLengthDouble):
15
16 2017-11-29  Brent Fulgham  <bfulgham@apple.com>
17
18         Unreviewed test fix after r225264.
19         <rdar://problem/35750689>
20
21         The changes in r225264 were meant to have no changes in behavior. However, I mistakenly
22         switched to a secure coding API call in the PlatformPasteboard::write method. This should
23         have used the 'insecure' version of this function.
24
25         * platform/ios/PlatformPasteboardIOS.mm:
26         (WebCore::PlatformPasteboard::write): 
27
28 2017-11-29  Youenn Fablet  <youenn@apple.com>
29
30         LibWebRTCPeerConnectionBackend should clean its stats promises when being cleaned
31         https://bugs.webkit.org/show_bug.cgi?id=180101
32
33         Reviewed by Eric Carlson.
34
35         No change of behavior.
36
37         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
38         (WebCore::LibWebRTCPeerConnectionBackend::doStop): Cleaning stat promises hash map.
39
40 2017-11-29  Zan Dobersek  <zdobersek@igalia.com>
41
42         [CoordGraphics] Rename CoordinatedBuffer to Nicosia::Buffer
43         https://bugs.webkit.org/show_bug.cgi?id=180135
44
45         Reviewed by Carlos Garcia Campos.
46
47         Rename CoordinatedBuffer to Nicosia::Buffer, starting an abstraction
48         layer that will in the future allow us to prototype and potentially
49         support different 2D rasterization libraries. The layer is envisioned
50         as separate from the CoordinatedGraphics code, but will in the mid-term
51         only be used there.
52
53         In order to keep CMake changes to a minimum for now, the source code is
54         included in the build along with the CoordinatedGraphics source files,
55         in TextureMapper.cmake.
56
57         No new tests -- no change in functionality.
58
59         * platform/TextureMapper.cmake:
60         * platform/graphics/nicosia/NicosiaBuffer.cpp: Renamed from Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBuffer.cpp.
61         (Nicosia::Buffer::create):
62         (Nicosia::Buffer::Buffer):
63         (Nicosia::Buffer::context):
64         (Nicosia::Buffer::uploadImage):
65         * platform/graphics/nicosia/NicosiaBuffer.h: Renamed from Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBuffer.h.
66         (Nicosia::Buffer::size const):
67         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
68         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
69         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
70         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
71         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
72         (WebCore::CoordinatedImageBacking::update):
73         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.h:
74         * platform/graphics/texmap/coordinated/Tile.h:
75
76 2017-11-29  Antoine Quint  <graouts@apple.com>
77
78         Pressing the space bar while watching a fullscreen video doesn't play or pause
79         https://bugs.webkit.org/show_bug.cgi?id=180033
80         <rdar://problem/33610443>
81
82         Reviewed by Eric Carlson.
83
84         We register a "keydown" event to track when the space bar is pressed, and if the media is playing
85         in fullscreen, we toggle playback. This does not interfere with full keyboard access since activating
86         one of the media controls using the keyboard will not let the events we register for be dispatched
87         this far along the event dispatch phase.
88
89         Test: media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html
90
91         * Modules/modern-media-controls/media/media-controller.js:
92         (MediaController):
93         (MediaController.prototype.togglePlayback): Add a catch() statement since calling play() could sometime
94         lead to some extraneous unhandled promise console logging that pollutes test output.
95         (MediaController.prototype.handleEvent):
96
97 2017-11-28  Brent Fulgham  <bfulgham@apple.com>
98
99         Adopt updated NSKeyed[Un]Archiver API when available
100         https://bugs.webkit.org/show_bug.cgi?id=180127
101         <rdar://problem/35710738>
102
103         Reviewed by Alex Christensen.
104
105         Switch to new NSKeyed[Un]Archiver methods when available. We do not attempt
106         to adopt secure coding in places we were not under the original API.
107
108         Most of the new API is wrapped in a set of convenience methods so we can
109         build without the new API on older systems.
110
111         No change in behavior.
112
113         * editing/cocoa/EditorCocoa.mm:
114         (WebCore::archivedDataForAttributedString): Use new convenience method
115         to archive the string object.
116         * loader/archive/cf/LegacyWebArchiveMac.mm:
117         (WebCore::LegacyWebArchive::createResourceResponseFromMacArchivedData): Update to
118         use secure coding where possible.
119         (WebCore::LegacyWebArchive::createPropertyListRepresentation): Ditto.
120         * platform/ios/PlatformPasteboardIOS.mm:
121         (WebCore::PlatformPasteboard::write): Use new secure API.
122         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Ditto.
123         * testing/cocoa/WebArchiveDumpSupport.mm:
124         (WebCoreTestSupport::createCFURLResponseFromResponseData): Update to
125         secure coding API where possible.
126
127 2017-11-28  Joseph Pecoraro  <pecoraro@apple.com>
128
129         Web Inspector: Cleanup Inspector classes be more consistent about using fast malloc / noncopyable
130         https://bugs.webkit.org/show_bug.cgi?id=180119
131
132         Reviewed by Devin Rousso.
133
134         * inspector/InspectorCanvas.cpp:
135         * inspector/InspectorDatabaseResource.cpp:
136         * inspector/InspectorFrontendClientLocal.cpp:
137         * inspector/InspectorFrontendClientLocal.h:
138         * inspector/InspectorFrontendHost.cpp:
139         * inspector/InspectorHistory.h:
140         * inspector/InspectorInstrumentation.cpp:
141         * inspector/InspectorOverlay.cpp:
142         * inspector/InspectorShaderProgram.cpp:
143         * inspector/InspectorStyleSheet.cpp:
144         * inspector/InstrumentingAgents.cpp:
145         * inspector/PageScriptDebugServer.h:
146         * inspector/TimelineRecordFactory.cpp:
147         * inspector/WebInjectedScriptManager.cpp:
148         * inspector/WebInjectedScriptManager.h:
149         * inspector/WorkerScriptDebugServer.cpp:
150         * inspector/WorkerScriptDebugServer.h:
151         * inspector/agents/*
152         Be more consistent about namespace / fast malloc / noncopyable.
153
154 2017-11-28  Zan Dobersek  <zdobersek@igalia.com>
155
156         [Cairo] Limit the number of active contexts in GraphicsContext3DCairo
157         https://bugs.webkit.org/show_bug.cgi?id=166968
158
159         Reviewed by Alex Christensen.
160
161         Cairo's implementation of GraphicsContext3D should follow the Mac's
162         and limit the number of active GraphicsContext3D objects.
163
164         The active contexts are listed in a global Deque, with the first
165         among them being recycled when the GraphicsContext3D::create()
166         function sees that the limit has been reached. That function still
167         returns null if even after recycling the number of contexts didn't
168         decrease.
169
170         Finally, in the GraphicsContext3D destructor, the context being
171         destroyed is removed from the list of active contexts.
172
173         No new tests -- relevant tests are now passing.
174
175         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
176         (WebCore::activeContexts):
177         (WebCore::GraphicsContext3D::create):
178         (WebCore::GraphicsContext3D::~GraphicsContext3D):
179
180 2017-11-28  Zalan Bujtas  <zalan@apple.com>
181
182         Clean up spanners before creating nested column context
183         https://bugs.webkit.org/show_bug.cgi?id=180107
184         <rdar://problem/35686655>
185         
186         Reviewed by Antti Koivisto.
187
188         When an existing spanner placeholder is moved into a newly constructed (and nested)
189         multicolumn context, we figure it's not valid anymore and end up destroying it
190         (see RenderMultiColumnFlow::fragmentedFlowDescendantInserted).
191         This is very unfortunate since as we climb back on the stack, we could hit this renderer as
192         the newly inserted child. 
193
194         This patch proactively removes the invalid placeholders and moves the associated spanners back to their
195         original position. 
196
197         Test: fast/multicol/crash-when-constructing-nested-columns.html
198
199         * rendering/RenderMultiColumnFlow.h:
200         * style/RenderTreeUpdaterMultiColumn.cpp:
201         (WebCore::RenderTreeUpdater::MultiColumn::createFragmentedFlow): 
202         RenderTreeUpdater::MultiColumn::destroyFragmentedFlow still relies on the placeholder removal
203         logic in RenderMultiColumnFlow::fragmentedFlowDescendantInserted.
204
205 2017-11-28  Tim Horton  <timothy_horton@apple.com>
206
207         REGRESSION (High Sierra): Layout Test fast/multicol/newmulticol/spanner2.html is a flaky image failure on WK1
208         https://bugs.webkit.org/show_bug.cgi?id=177826
209         <rdar://problem/34876498>
210
211         Reviewed by Alexey Proskuryakov.
212
213         No new tests, fixes some already-broken tests.
214
215         * platform/graphics/mac/PDFDocumentImageMac.mm:
216         (WebCore::PDFDocumentImage::drawPDFPage):
217         Save and restore one more piece of context state that
218         PDFKit mutates while drawing.
219
220 2017-11-28  Wenson Hsieh  <wenson_hsieh@apple.com>
221
222         Allow attachment elements with no appearance to defer rendering to child nodes
223         https://bugs.webkit.org/show_bug.cgi?id=180117
224         <rdar://problem/35735339>
225
226         Reviewed by Tim Horton.
227
228         Test: fast/attachment/attachment-without-appearance.html
229
230         When -webkit-appearance: none; is specified on an attachment element, allow it to fall back to rendering its
231         subtree. Currently, attachment elements without an appearance don't allow this and truncate the render tree at
232         the RenderAttachment, since RenderAttachment cannot have any children.
233
234         In a followup, this will enable us to render a shadow subtree under the attachment element to display in-place
235         attachment content, and easily toggle between in-place and icon display by changing the appearance.
236
237         * html/HTMLAttachmentElement.cpp:
238         (WebCore::HTMLAttachmentElement::createElementRenderer):
239
240         If no appearance is specified, emit a RenderBlockFlow instead of a RenderAttachment.
241
242         (WebCore::HTMLAttachmentElement::setFile):
243         (WebCore::HTMLAttachmentElement::attachmentRenderer const):
244
245         Renamed from renderer(). HTMLAttachmentElement::renderer() now uses the superclass' implementation, and no
246         longer returns a RenderAttachment in all circumstances. Instead, places that expect a RenderAttachment now go
247         through HTMLAttachmentElement::renderAttachment() instead.
248
249         (WebCore::HTMLAttachmentElement::parseAttribute):
250         * html/HTMLAttachmentElement.h:
251         * page/DragController.cpp:
252         (WebCore::DragController::startDrag):
253         * rendering/RenderAttachment.h:
254         (WebCore::HTMLAttachmentElement::renderer const): Deleted.
255
256 2017-11-28  Youenn Fablet  <youenn@apple.com>
257
258         Register Documents as ServiceWorker clients to the StorageProcess
259         https://bugs.webkit.org/show_bug.cgi?id=180047
260
261         Reviewed by Brady Eidson.
262
263         No change of behavior.
264         These changes will be covered when implementing ServiceWorker Clients API.
265
266         Registering a document when being created by DocumentLoader.
267         In the future, we may restrict registration to only documents related to origins that have some ongoing service worker activity.
268         This would require to keep track of which documents are registered so that we unregister these ones.
269         This would also require to register existing documents when one of the document with the same origin starts registering a service worker.
270         Unregistering a document inside prepareForDestruction.
271
272         Storing all clients in SWServer as a HasMap keyed by ClientOrigin.
273         Processing will then iterate through the list of clients scoped by the client origin.
274
275         Adding a ClientOrigin class as a pair of top origin and frame origin since service workers will be related based on that information.
276
277         * WebCore.xcodeproj/project.pbxproj:
278         * dom/Document.cpp:
279         (WebCore::Document::prepareForDestruction):
280         * loader/DocumentLoader.cpp:
281         (WebCore::DocumentLoader::commitData):
282         * page/ClientOrigin.h: Added.
283         (WebCore::ClientOrigin::emptyKey):
284         (WebCore::ClientOrigin::hash const):
285         (WebCore::ClientOrigin::operator== const):
286         (WTF::ClientOriginKeyHash::hash):
287         (WTF::ClientOriginKeyHash::equal):
288         (WTF::HashTraits<WebCore::ClientOrigin>::emptyValue):
289         (WTF::HashTraits<WebCore::ClientOrigin>::constructDeletedValue):
290         (WTF::HashTraits<WebCore::ClientOrigin>::isDeletedValue):
291         * workers/service/ServiceWorkerClientIdentifier.h:
292         (WebCore::ServiceWorkerClientIdentifier::operator== const):
293         * workers/service/server/SWClientConnection.h:
294         * workers/service/server/SWServer.cpp:
295         (WebCore::SWServer::registerServiceWorkerClient):
296         (WebCore::SWServer::unregisterServiceWorkerClient):
297         * workers/service/server/SWServer.h:
298
299 2017-11-28  Chris Dumez  <cdumez@apple.com>
300
301         ServiceWorkerGlobalScope.clients should always return the same object
302         https://bugs.webkit.org/show_bug.cgi?id=180116
303
304         Reviewed by Geoffrey Garen.
305
306         ServiceWorkerGlobalScope.clients should always return the same object, as per the specification:
307         - https://w3c.github.io/ServiceWorker/#serviceworkerglobalscope-interface
308
309         Test: http/tests/workers/service/ServiceWorkerGlobalScope_clients_SameObject.html
310
311         * Sources.txt:
312         * WebCore.xcodeproj/project.pbxproj:
313         * bindings/js/JSServiceWorkerGlobalScopeCustom.cpp: Added.
314         (WebCore::JSServiceWorkerGlobalScope::visitAdditionalChildren):
315         * workers/service/ServiceWorkerClients.idl:
316         * workers/service/ServiceWorkerGlobalScope.idl:
317
318 2017-11-28  Chris Dumez  <cdumez@apple.com>
319
320         Get rid of ServiceWorker::allWorkers() hashmap
321         https://bugs.webkit.org/show_bug.cgi?id=180111
322
323         Reviewed by Brady Eidson.
324
325         Get rid of ServiceWorker::allWorkers() hashmap as it is not thread safe and we'll soon have
326         ServiceWorker objects living in various service worker threads.
327
328         Instead, we now have a per-ScriptExecutionContext map, which is inherently thread-safe.
329
330         No new tests, no web-facing behavior change.
331
332         * dom/ScriptExecutionContext.cpp:
333         (WebCore::ScriptExecutionContext::registerServiceWorker):
334         (WebCore::ScriptExecutionContext::unregisterServiceWorker):
335         * dom/ScriptExecutionContext.h:
336         (WebCore::ScriptExecutionContext::serviceWorker):
337         * workers/service/ServiceWorker.cpp:
338         (WebCore::ServiceWorker::getOrCreate):
339         (WebCore::ServiceWorker::ServiceWorker):
340         (WebCore::ServiceWorker::~ServiceWorker):
341         (WebCore::ServiceWorker::stop):
342         * workers/service/ServiceWorker.h:
343         * workers/service/server/SWClientConnection.cpp:
344         (WebCore::SWClientConnection::updateWorkerState):
345
346 2017-11-28  Said Abou-Hallawa  <sabouhallawa@apple.com>
347
348         [CG] PostScript images should be supported if they are sub-resource images
349         https://bugs.webkit.org/show_bug.cgi?id=178502
350         <rdar://problem/35102988>
351
352         Reviewed by Simon Fraser.
353
354         Make CachedImage detect the PostScript mime type and the file extension.
355         Let PDFDocumentImage replaces the PostScript data with the equivalent PDF
356         data and use it when creating the PDFDocument.
357
358         Test: fast/images/eps-as-image.html
359
360         * WebCore.xcodeproj/project.pbxproj:
361         * loader/cache/CachedImage.cpp:
362         (WebCore::CachedImage::isPDFRequest const):
363         (WebCore::CachedImage::isPostScriptRequest const):
364         These functions return whether the request is for a PDF or a PostScript 
365         image. They check for the same conditions we do in WebPage::createPlugin().
366
367         (WebCore::CachedImage::createImage): Create a PDFDocumentImage for either
368         a PDF or a PostScript image. For PostScript, the data will be converted
369         to PDF when all the data is received.
370
371         (WebCore::CachedImage::updateBufferInternal): Use the size() of m_data
372         instead of using the m_image->data() to setEncodedSize(). Image::m_data
373         and CachedImage::m_data point to the same SharedBuffer.
374
375         (WebCore::CachedImage::convertedDataIfNeeded const): Convert the PostScript
376         data to PDF if the system can convert it. If the same can't convert it,
377         return null so loading the image will be canceled.
378
379         (WebCore::CachedImage::updateImageData): Get rid of the data argument since
380         we always send the member m_data to this function.
381
382         (WebCore::CachedImage::finishLoading): Convert the PostScript data to PDF 
383         data since all the data is received. Use m_data to set setEncodedSize().
384
385         * loader/cache/CachedImage.h:
386         * platform/MIMETypeRegistry.cpp:
387         (WebCore::MIMETypeRegistry::isPostScriptMIMEType):
388         (WebCore::MIMETypeRegistry::isPDFOrPostScriptMIMEType):
389         * platform/MIMETypeRegistry.h:
390         * platform/graphics/cg/PDFDocumentImage.cpp:
391         (WebCore::PDFDocumentImage::PDFDocumentImage):
392         (WebCore::PDFDocumentImage::convertPostScriptDataToPDF):
393         * platform/graphics/cg/PDFDocumentImage.h:
394
395 2017-11-14  Carlos Garcia Campos  <cgarcia@igalia.com>
396
397         Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h
398         https://bugs.webkit.org/show_bug.cgi?id=173793
399
400         Reviewed by Joseph Pecoraro.
401
402         Based on patch by Brian Burg.
403
404         * ForwardingHeaders/inspector/InspectorValues.h: Removed.
405         * Modules/encryptedmedia/InitDataRegistry.cpp:
406         (WebCore::extractKeyIDsKeyids):
407         (WebCore::sanitizeKeyids):
408         * html/parser/XSSAuditorDelegate.cpp:
409         (WebCore::XSSAuditorDelegate::generateViolationReport):
410         * inspector/CommandLineAPIHost.cpp:
411         (WebCore::CommandLineAPIHost::inspect):
412         * inspector/CommandLineAPIHost.h:
413         * inspector/InspectorCanvas.cpp:
414         (WebCore::InspectorCanvas::recordAction):
415         (WebCore::InspectorCanvas::releaseData):
416         (WebCore::InspectorCanvas::indexForData):
417         (WebCore::buildArrayForVector):
418         (WebCore::InspectorCanvas::buildInitialState):
419         (WebCore::InspectorCanvas::buildAction):
420         (WebCore::InspectorCanvas::buildArrayForCanvasGradient):
421         (WebCore::InspectorCanvas::buildArrayForCanvasPattern):
422         (WebCore::InspectorCanvas::buildArrayForImageData):
423         (WebCore::InspectorCanvas::buildArrayForImageBitmap):
424         * inspector/InspectorCanvas.h:
425         * inspector/InspectorDatabaseResource.cpp:
426         * inspector/InspectorOverlay.cpp:
427         (WebCore::evaluateCommandInOverlay):
428         (WebCore::InspectorOverlay::evaluateInOverlay):
429         * inspector/InspectorOverlay.h:
430         * inspector/InspectorShaderProgram.h:
431         * inspector/InspectorStyleSheet.h:
432         (WebCore::InspectorCSSId::InspectorCSSId):
433         * inspector/TimelineRecordFactory.cpp:
434         (WebCore::TimelineRecordFactory::createGenericRecord):
435         (WebCore::TimelineRecordFactory::createFunctionCallData):
436         (WebCore::TimelineRecordFactory::createConsoleProfileData):
437         (WebCore::TimelineRecordFactory::createProbeSampleData):
438         (WebCore::TimelineRecordFactory::createEventDispatchData):
439         (WebCore::TimelineRecordFactory::createGenericTimerData):
440         (WebCore::TimelineRecordFactory::createTimerInstallData):
441         (WebCore::TimelineRecordFactory::createEvaluateScriptData):
442         (WebCore::TimelineRecordFactory::createTimeStampData):
443         (WebCore::TimelineRecordFactory::createAnimationFrameData):
444         (WebCore::createQuad):
445         (WebCore::TimelineRecordFactory::createPaintData):
446         (WebCore::TimelineRecordFactory::appendLayoutRoot):
447         * inspector/TimelineRecordFactory.h:
448         * inspector/agents/InspectorApplicationCacheAgent.cpp:
449         * inspector/agents/InspectorApplicationCacheAgent.h:
450         * inspector/agents/InspectorCSSAgent.cpp:
451         (WebCore::computePseudoClassMask):
452         (WebCore::InspectorCSSAgent::setStyleText):
453         (WebCore::InspectorCSSAgent::setRuleSelector):
454         (WebCore::InspectorCSSAgent::forcePseudoState):
455         * inspector/agents/InspectorCSSAgent.h:
456         * inspector/agents/InspectorDOMAgent.cpp:
457         (WebCore::parseColor):
458         (WebCore::parseConfigColor):
459         (WebCore::parseQuad):
460         (WebCore::InspectorDOMAgent::performSearch):
461         (WebCore::InspectorDOMAgent::setSearchingForNode):
462         (WebCore::InspectorDOMAgent::highlightConfigFromInspectorObject):
463         (WebCore::InspectorDOMAgent::setInspectModeEnabled):
464         (WebCore::InspectorDOMAgent::highlightRect):
465         (WebCore::InspectorDOMAgent::highlightQuad):
466         (WebCore::InspectorDOMAgent::innerHighlightQuad):
467         (WebCore::InspectorDOMAgent::highlightSelector):
468         (WebCore::InspectorDOMAgent::highlightNode):
469         (WebCore::InspectorDOMAgent::highlightNodeList):
470         (WebCore::InspectorDOMAgent::highlightFrame):
471         * inspector/agents/InspectorDOMAgent.h:
472         * inspector/agents/InspectorDOMDebuggerAgent.cpp:
473         (WebCore::InspectorDOMDebuggerAgent::didInvalidateStyleAttr):
474         (WebCore::InspectorDOMDebuggerAgent::willInsertDOMNode):
475         (WebCore::InspectorDOMDebuggerAgent::willRemoveDOMNode):
476         (WebCore::InspectorDOMDebuggerAgent::willModifyDOMAttr):
477         (WebCore::InspectorDOMDebuggerAgent::descriptionForDOMEvent):
478         (WebCore::InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded):
479         (WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest):
480         * inspector/agents/InspectorDOMDebuggerAgent.h:
481         * inspector/agents/InspectorDOMStorageAgent.cpp:
482         (WebCore::InspectorDOMStorageAgent::getDOMStorageItems):
483         (WebCore::InspectorDOMStorageAgent::setDOMStorageItem):
484         (WebCore::InspectorDOMStorageAgent::removeDOMStorageItem):
485         (WebCore::InspectorDOMStorageAgent::findStorageArea):
486         * inspector/agents/InspectorDOMStorageAgent.h:
487         * inspector/agents/InspectorDatabaseAgent.cpp:
488         * inspector/agents/InspectorIndexedDBAgent.cpp:
489         (WebCore::Inspector::idbKeyFromInspectorObject):
490         (WebCore::Inspector::idbKeyRangeFromKeyRange):
491         (WebCore::InspectorIndexedDBAgent::requestData):
492         * inspector/agents/InspectorIndexedDBAgent.h:
493         * inspector/agents/InspectorNetworkAgent.cpp:
494         (WebCore::buildObjectForHeaders):
495         (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
496         (WebCore::InspectorNetworkAgent::setExtraHTTPHeaders):
497         * inspector/agents/InspectorNetworkAgent.h:
498         * inspector/agents/InspectorPageAgent.cpp:
499         * inspector/agents/InspectorPageAgent.h:
500         * inspector/agents/InspectorTimelineAgent.cpp:
501         (WebCore::InspectorTimelineAgent::setInstruments):
502         (WebCore::InspectorTimelineAgent::internalStart):
503         (WebCore::InspectorTimelineAgent::didInvalidateLayout):
504         (WebCore::InspectorTimelineAgent::willLayout):
505         (WebCore::InspectorTimelineAgent::didScheduleStyleRecalculation):
506         (WebCore::InspectorTimelineAgent::willRecalculateStyle):
507         (WebCore::InspectorTimelineAgent::willComposite):
508         (WebCore::InspectorTimelineAgent::willPaint):
509         (WebCore::InspectorTimelineAgent::addRecordToTimeline):
510         (WebCore::InspectorTimelineAgent::setFrameIdentifier):
511         (WebCore::InspectorTimelineAgent::appendRecord):
512         (WebCore::InspectorTimelineAgent::sendEvent):
513         (WebCore::InspectorTimelineAgent::createRecordEntry):
514         (WebCore::InspectorTimelineAgent::pushCurrentRecord):
515         * inspector/agents/InspectorTimelineAgent.h:
516         * page/csp/ContentSecurityPolicy.cpp:
517         (WebCore::ContentSecurityPolicy::reportViolation const):
518         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
519         (WebCore::parseJSONObject):
520         (WebCore::parseLicenseFormat):
521         (WebCore::parseLicenseReleaseAcknowledgementFormat):
522         (WebCore::CDMInstanceClearKey::updateLicense):
523         (WebCore::CDMInstanceClearKey::removeSessionData):
524         * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
525         (WebCore::extractSinfData):
526         * testing/Internals.cpp:
527
528 2017-11-28  Simon Fraser  <simon.fraser@apple.com>
529
530         Use the TextStream indent manipulator in more places
531         https://bugs.webkit.org/show_bug.cgi?id=180065
532
533         Reviewed by Sam Weinig.
534
535         Replace writeIndent() with << indent, and use an IndentScope in a few places.
536
537         * dom/ViewportArguments.cpp:
538         (WebCore::operator<<):
539         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
540         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties const):
541         * page/scrolling/ScrollingStateNode.cpp:
542         (WebCore::ScrollingStateNode::dump const):
543         * platform/graphics/FloatRoundedRect.cpp:
544         (WebCore::operator<<):
545         * platform/graphics/transforms/TransformationMatrix.cpp:
546         (WebCore::operator<<):
547
548 2017-11-28  Noah Chase  <nchase@gmail.com>
549
550         Web Audio's AnalyserNode.fftSize cannot be greater than 2048 in Safari; spec says it can be up to 32768
551         https://bugs.webkit.org/show_bug.cgi?id=180040
552
553         Reviewed by Alex Christensen.
554
555         I fixed up the existing test/output for realtimeanalyser-fft-sizing.
556         one thing that I'm a bit unsure of here is whether or not there are other
557         places in WebKit's Web Audio implementation that use fftSize and
558         should have the wider range available (instead of capping out at
559         2048). based on a quick naive scan I think that there are.
560
561         * Modules/webaudio/RealtimeAnalyser.cpp:
562
563 2017-11-28  Daniel Bates  <dabates@apple.com>
564
565         Add WebKitAdditions extension point to add user-agent stylesheet
566         https://bugs.webkit.org/show_bug.cgi?id=179702
567         <rdar://problem/35711147>
568
569         Reviewed by Andy Estes.
570
571         * DerivedSources.make: Write user agent stylesheet generation recipe in terms of the
572         automatic variable $^, which represents the list of the names of all prerequisites
573         for the rule. Make automatically expands the names in $^ up to their full absolute
574         path.
575
576 2017-11-28  Daniel Bates  <dabates@apple.com>
577
578         [Cocoa] First pass at implementing alternative presentation button element
579         https://bugs.webkit.org/show_bug.cgi?id=179785
580         Part of <rdar://problem/34917108>
581
582         Reviewed by Brent Fulgham.
583
584         Implement support for substituting a button for one or more elements in a page.
585         This is a first pass. We will refine the logic and the API/SPI in subsequent
586         commits.
587
588         Tests: accessibility/alternative-presentation-button-input-type.html
589                accessibility/alternative-presentation-button.html
590                fast/forms/alternative-presentation-button/replace-and-remove.html
591                fast/forms/alternative-presentation-button/replacement.html
592
593         * English.lproj/Localizable.strings: Add placeholder strings for localization.
594         * SourcesCocoa.txt: Add some files.
595         * WebCore.xcodeproj/project.pbxproj: Ditto.
596         * dom/Element.h:
597         * editing/Editor.cpp:
598         (WebCore::Editor::clear): Clear out all substitutions. This is called whenever
599         we are navigating between pages.
600         (WebCore::Editor::substituteWithAlternativePresentationButton): Added.
601         (WebCore::Editor::removeAlternativePresentationButton): Added.
602         (WebCore::Editor::didInsertAlternativePresentationButtonElement): Added.
603         (WebCore::Editor::didRemoveAlternativePresentationButtonElement): Added.
604         * editing/Editor.h:
605         * editing/cocoa/AlternativePresentationButtonSubstitution.cpp: Added.
606         (WebCore::AlternativePresentationButtonSubstitution::AlternativePresentationButtonSubstitution):
607         (WebCore::AlternativePresentationButtonSubstitution::initializeSavedDisplayStyles):
608         (WebCore::AlternativePresentationButtonSubstitution::apply):
609         (WebCore::AlternativePresentationButtonSubstitution::unapply):
610         * editing/cocoa/AlternativePresentationButtonSubstitution.h:
611         * html/HTMLInputElement.cpp:
612         (WebCore::HTMLInputElement::alternativePresentationButtonElement const): Added.
613         (WebCore::HTMLInputElement::setTypeWithoutUpdatingAttribute): Added.
614         (WebCore::HTMLInputElement::createInputType): Extracted the logic to create the InputType from
615         HTMLInputElement::updateType() to here and added logic to create the input type for the
616         alternative presentation button. This input type is not web exposed.
617         (WebCore::HTMLInputElement::updateType): Modified to take the name of the InputType object to
618         create as an argument and pass it through to HTMLInputElement::createInputType() to actually
619         create it. Reordered the logic for destroying the shadow tree of the old InputType, deallocating
620         the old InputType, and assigning the new InputType such that we assign the new InputType,
621         destroy the shadow tree of the old InputType, and deallocate the old InputType. This ordering
622         allows AlternativePresentationButtonSubstitution::substitute() to avoid restoring the input
623         type saved before the substitution when the input type is changed by the page as opposed to
624         by SPI.
625         (WebCore::HTMLInputElement::parseAttribute): Pass the parsed type.
626         (WebCore::HTMLInputElement::willAttachRenderers): Ditto.
627         * html/HTMLInputElement.h: Change visibility of removeShadowRoot() from private to public so
628         that it can be called from AlternativePresentationButtonSubstitution.
629         * html/InputType.h:
630         (WebCore::InputType::alternativePresentationButtonElement const): Added.
631         * html/InputTypeNames.cpp:
632         (WebCore::InputTypeNames::alternativePresentationButton): Added.
633         * html/InputTypeNames.h:
634         * html/shadow/cocoa/AlternativePresentationButtonElement.cpp: Added.
635         (WebCore::AlternativePresentationButtonElement::create):
636         (WebCore::AlternativePresentationButtonElement::AlternativePresentationButtonElement):
637         (WebCore::AlternativePresentationButtonElement::insertedIntoAncestor):
638         (WebCore::AlternativePresentationButtonElement::removedFromAncestor):
639         (WebCore::AlternativePresentationButtonElement::didFinishInsertingNode):
640         (WebCore::AlternativePresentationButtonElement::defaultEventHandler):
641         * html/shadow/cocoa/AlternativePresentationButtonElement.h:
642         * html/shadow/cocoa/AlternativePresentationButtonInputType.cpp: Added.
643         (WebCore::AlternativePresentationButtonInputType::AlternativePresentationButtonInputType):
644         (WebCore::AlternativePresentationButtonInputType::formControlType const):
645         (WebCore::AlternativePresentationButtonInputType::appendFormData const):
646         (WebCore::AlternativePresentationButtonInputType::supportsValidation const):
647         (WebCore::AlternativePresentationButtonInputType::isTextButton const):
648         (WebCore::AlternativePresentationButtonInputType::alternativePresentationButtonElement const):
649         (WebCore::AlternativePresentationButtonInputType::createShadowSubtree):
650         (WebCore::AlternativePresentationButtonInputType::destroyShadowSubtree):
651         * html/shadow/cocoa/AlternativePresentationButtonInputType.h:
652         * page/ChromeClient.h:
653         * platform/LocalizedStrings.cpp:
654         (WebCore::AXAlternativePresentationButtonLabel):
655         (WebCore::alternativePresentationButtonTitle):
656         (WebCore::alternativePresentationButtonSubtitle):
657         * platform/LocalizedStrings.h:
658         * testing/Internals.cpp:
659         (WebCore::Internals::substituteWithAlternativePresentationButton): Added.
660         (WebCore::Internals::removeAlternativePresentationButton): Added.
661         * testing/Internals.h:
662         * testing/Internals.idl:
663
664 2017-11-28  Commit Queue  <commit-queue@webkit.org>
665
666         Unreviewed, rolling out r225209.
667         https://bugs.webkit.org/show_bug.cgi?id=180092
668
669         Tests are still timing out (Requested by ap on #webkit).
670
671         Reverted changeset:
672
673         "Pressing the space bar while watching a fullscreen video
674         doesn't play or pause"
675         https://bugs.webkit.org/show_bug.cgi?id=180033
676         https://trac.webkit.org/changeset/225209
677
678 2017-11-28  Chris Dumez  <cdumez@apple.com>
679
680         Start exposing navigator.serviceWorker inside service workers
681         https://bugs.webkit.org/show_bug.cgi?id=180087
682
683         Reviewed by Brady Eidson.
684
685         Start exposing navigator.serviceWorker inside service workers as per:
686         - https://w3c.github.io/ServiceWorker/#navigator-serviceworker
687
688         Although the property is now exposed, the API on ServiceWorkerContainer is not
689         supported yet inside service workers and the promise will be rejected. This will
690         be implemented in a follow-up.
691
692         Test: http/tests/workers/service/WorkerNavigator_serviceWorker.html
693
694         * Sources.txt:
695         * WebCore.xcodeproj/project.pbxproj:
696         * bindings/js/JSWorkerNavigatorCustom.cpp: Added.
697         (WebCore::JSWorkerNavigator::visitAdditionalChildren):
698         * page/WorkerNavigator.idl:
699         * workers/service/ServiceWorker.idl:
700         * workers/service/ServiceWorkerContainer.cpp:
701         (WebCore::ServiceWorkerContainer::controller const):
702         (WebCore::ServiceWorkerContainer::addRegistration):
703         (WebCore::ServiceWorkerContainer::getRegistration):
704         (WebCore::ServiceWorkerContainer::getRegistrations):
705         * workers/service/ServiceWorkerContainer.idl:
706         * workers/service/ServiceWorkerRegistration.cpp:
707         (WebCore::ServiceWorkerRegistration::update):
708         (WebCore::ServiceWorkerRegistration::unregister):
709         * workers/service/ServiceWorkerRegistration.idl:
710
711 2017-11-28  Simon Fraser  <simon.fraser@apple.com>
712
713         Modernize GraphicsLayer dumping
714         https://bugs.webkit.org/show_bug.cgi?id=180067
715
716         Reviewed by Sam Weinig.
717
718         Use the indent stream manipulator, and TextStream's built-in indent amount
719         for GraphicsLayer dumping.
720
721         * platform/graphics/GraphicsLayer.cpp:
722         (WebCore::GraphicsLayer::dumpLayer const):
723         (WebCore::dumpChildren):
724         (WebCore::GraphicsLayer::dumpProperties const):
725         (WebCore::GraphicsLayer::layerTreeAsText const):
726         * platform/graphics/GraphicsLayer.h:
727         (WebCore::GraphicsLayer::dumpAdditionalProperties const):
728         * platform/graphics/ca/GraphicsLayerCA.cpp:
729         (WebCore::dumpInnerLayer):
730         (WebCore::GraphicsLayerCA::dumpAdditionalProperties const):
731         * platform/graphics/ca/GraphicsLayerCA.h:
732
733 2017-11-28  Antoine Quint  <graouts@apple.com>
734
735         Remove dead debugging code in modern media controls
736         https://bugs.webkit.org/show_bug.cgi?id=180079
737
738         Reviewed by Eric Carlson.
739
740         This debug utility is no longer necessary and is just dead code.
741
742         * Modules/modern-media-controls/controls/scheduler.js:
743         (const.scheduler.new.prototype.scheduleLayout):
744         (const.scheduler.new.prototype.unscheduleLayout):
745         (const.scheduler.new.prototype._requestFrameIfNeeded):
746         (const.scheduler.new.prototype._frameDidFire):
747         (const.scheduler.new.prototype._layout):
748
749 2017-11-28  Antoine Quint  <graouts@apple.com>
750
751         Skip back and forward buttons should not hard-code their numeric amount in localised strings
752         https://bugs.webkit.org/show_bug.cgi?id=180077
753
754         Reviewed by Eric Carlson.
755
756         Split out the numeric value used in the skip forward and skip back localized strings to make
757         it easier to localized the numeric value itself.
758
759         Test: media/modern-media-controls/localized-strings/replaced-string.html
760
761         * English.lproj/modern-media-controls-localized-strings.js:
762         * Modules/modern-media-controls/main.js:
763         (UIString):
764
765 2017-11-28  Antoine Quint  <graouts@apple.com>
766
767         Pressing the space bar while watching a fullscreen video doesn't play or pause
768         https://bugs.webkit.org/show_bug.cgi?id=180033
769         <rdar://problem/33610443>
770
771         Reviewed by Eric Carlson.
772
773         We register a "keydown" event to track when the space bar is pressed, and if the media is playing
774         in fullscreen, we toggle playback. This does not interfere with full keyboard access since activating
775         one of the media controls using the keyboard will not let the events we register for be dispatched
776         this far along the event dispatch phase.
777
778         Test: media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html
779
780         * Modules/modern-media-controls/media/media-controller.js:
781         (MediaController):
782         (MediaController.prototype.togglePlayback): Add a catch() statement since calling play() could sometime
783         lead to some extraneous unhandled promise console logging that pollutes test output.
784         (MediaController.prototype.handleEvent):
785
786 2017-11-27  Tim Horton  <timothy_horton@apple.com>
787
788         Web Content process crashes when dragging a link in recovery mode
789         https://bugs.webkit.org/show_bug.cgi?id=180058
790         <rdar://problem/35172170>
791
792         Reviewed by Alexey Proskuryakov.
793
794         * platform/mac/DragImageMac.mm:
795         (WebCore::LinkImageLayout::LinkImageLayout):
796         LinkPresentation isn't available in the base system. Make it optional,
797         and fall back to the full URL like we do on platforms where it doesn't
798         exist at all.
799
800 2017-11-27  Chris Dumez  <cdumez@apple.com>
801
802         Move callOnMainThreadAndWait() from SocketStreamHandleImplCFNet.cpp to MainThread.h
803         https://bugs.webkit.org/show_bug.cgi?id=180060
804
805         Reviewed by Alex Christensen.
806
807         Move callOnMainThreadAndWait() from SocketStreamHandleImplCFNet.cpp to MainThread.h so that it can be reused.
808
809         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
810         (WebCore::callOnMainThreadAndWait): Deleted.
811
812 2017-11-27  Matt Lewis  <jlewis3@apple.com>
813
814         Unreviewed, rolling out r225201.
815
816         This caused multiple tests to timeout consistently.
817
818         Reverted changeset:
819
820         "Pressing the space bar while watching a fullscreen video
821         doesn't play or pause"
822         https://bugs.webkit.org/show_bug.cgi?id=180033
823         https://trac.webkit.org/changeset/225201
824
825 2017-11-27  Chris Dumez  <cdumez@apple.com>
826
827         NavigatorBase::serviceWorker() should return a reference instead of a raw pointer
828         https://bugs.webkit.org/show_bug.cgi?id=180059
829
830         Reviewed by Geoffrey Garen.
831
832         NavigatorBase::serviceWorker() should return a reference instead of a raw pointer
833         as it can never return null.
834
835         * bindings/js/JSNavigatorCustom.cpp:
836         (WebCore::JSNavigator::visitAdditionalChildren):
837         * dom/ScriptExecutionContext.cpp:
838         (WebCore::ScriptExecutionContext::serviceWorkerContainer):
839         * page/NavigatorBase.cpp:
840         (WebCore::NavigatorBase::serviceWorker):
841         * page/NavigatorBase.h:
842
843 2017-11-27  Antoine Quint  <graouts@apple.com>
844
845         Pressing the space bar while watching a fullscreen video doesn't play or pause
846         https://bugs.webkit.org/show_bug.cgi?id=180033
847         <rdar://problem/33610443>
848
849         Reviewed by Eric Carlson.
850
851         We register a "keydown" event to track when the space bar is pressed, and if the media is playing
852         in fullscreen, we toggle playback. This does not interfere with full keyboard access since activating
853         one of the media controls using the keyboard will not let the events we register for be dispatched
854         this far along the event dispatch phase.
855
856         Test: media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html
857
858         * Modules/modern-media-controls/media/media-controller.js:
859         (MediaController):
860         (MediaController.prototype.togglePlayback): Add a catch() statement since calling play() could sometime
861         lead to some extraneous unhandled promise console logging that pollutes test output.
862         (MediaController.prototype.handleEvent):
863
864 2017-11-27  Matt Lewis  <jlewis3@apple.com>
865
866         Unreviewed, rolling out r225173.
867
868         This caused multiple tests to timeout consistently.
869
870         Reverted changeset:
871
872         "Pressing the space bar while watching a fullscreen video
873         doesn't play or pause"
874         https://bugs.webkit.org/show_bug.cgi?id=180033
875         https://trac.webkit.org/changeset/225173
876
877 2017-11-27  Chris Dumez  <cdumez@apple.com>
878
879         ASSERTION FAILED: addResult.isNewEntry WebCore::SWServerRegistration::addClientUsingRegistration(WebCore::ServiceWorkerClientIdentifier const&) + 141
880         https://bugs.webkit.org/show_bug.cgi?id=180049
881
882         Reviewed by Brady Eidson.
883
884         SWServer::serviceWorkerStoppedControllingClient() was failing to remove the client from the
885         SWServerRegistration in some cases. This is because we relied on the Service Worker Identifier
886         to get the SWServerRegistration, via the corresponding SWServerServiceWorker object. However,
887         It is possible for the SWServerServiceWorker to have been destroyed already.
888
889         In serviceWorkerStartedControllingClient / serviceWorkerStoppedControllingClient, we now
890         pass the registration identifier, so that we are able to look up the registration directly,
891         without going through the service worker object.
892
893         No new tests, already covered by imported/w3c/web-platform-tests/service-workers/service-worker/claim-affect-other-registration.https.html.
894
895         * dom/ScriptExecutionContext.cpp:
896         (WebCore::ScriptExecutionContext::setActiveServiceWorker):
897         * workers/service/ServiceWorker.h:
898         * workers/service/ServiceWorkerContainer.cpp:
899         (WebCore::ServiceWorkerContainer::addRegistration):
900         (WebCore::ServiceWorkerContainer::removeRegistration):
901         * workers/service/ServiceWorkerData.cpp:
902         (WebCore::ServiceWorkerData::isolatedCopy const):
903         * workers/service/ServiceWorkerData.h:
904         (WebCore::ServiceWorkerData::encode const):
905         (WebCore::ServiceWorkerData::decode):
906         * workers/service/server/SWClientConnection.h:
907         * workers/service/server/SWServer.cpp:
908         (WebCore::SWServer::addRegistration):
909         (WebCore::SWServer::removeRegistration):
910         (WebCore::SWServer::clearAll):
911         (WebCore::SWServer::Connection::addServiceWorkerRegistrationInServer):
912         (WebCore::SWServer::Connection::removeServiceWorkerRegistrationInServer):
913         (WebCore::SWServer::Connection::serviceWorkerStartedControllingClient):
914         (WebCore::SWServer::Connection::serviceWorkerStoppedControllingClient):
915         (WebCore::SWServer::addClientServiceWorkerRegistration):
916         (WebCore::SWServer::removeClientServiceWorkerRegistration):
917         (WebCore::SWServer::serviceWorkerStartedControllingClient):
918         (WebCore::SWServer::serviceWorkerStoppedControllingClient):
919         (WebCore::SWServer::installContextData):
920         * workers/service/server/SWServer.h:
921         * workers/service/server/SWServerWorker.cpp:
922         (WebCore::SWServerWorker::SWServerWorker):
923         * workers/service/server/SWServerWorker.h:
924
925 2017-11-27  Tim Horton  <timothy_horton@apple.com>
926
927         REGRESSION (r225142): Crashes when command clicking or force touching links
928         https://bugs.webkit.org/show_bug.cgi?id=180055
929         <rdar://problem/35703910>
930
931         Reviewed by Wenson Hsieh.
932
933         No new tests; affects an existing API test.
934
935         * editing/mac/DictionaryLookup.mm:
936         (WebCore::tokenRange):
937         The 'options' out argument from tokenRangeForString is autoreleased.
938
939 2017-11-27  Dean Jackson  <dino@apple.com>
940
941         Implement OffscreenCanvas.getContext("webgl")
942         https://bugs.webkit.org/show_bug.cgi?id=180050
943         <rdar://problem/35705473>
944
945         Reviewed by Sam Weinig.
946
947         Implement enough of getContext("webgl") to actually return an
948         active WebGLRenderingContext, even though it isn't actually
949         hooked up to draw.
950
951         Introduce a new type, WebGLCanvas, which is a variant of HTMLCanvasElement
952         and OffscreenCanvas, so that it can be exposed by the 'canvas' attribute
953         on WebGLRenderingContext.
954
955         At the moment we still assume that all uses of WebGLRenderingContext come
956         from HTMLCanvasElement, so add a bunch of logic to detect that case.
957
958         Updated the existing (proposed) WPT.
959
960         * html/OffscreenCanvas.cpp:
961         (WebCore::OffscreenCanvas::getContext): Implement enough of getContext to
962         return a WebGLRenderingContext.
963         * html/OffscreenCanvas.h: Use the new OffscreenRenderingContext type, even
964         though it's just a WebGLRenderingContext at the moment.
965
966         * html/canvas/WebGLRenderingContextBase.cpp:
967         (WebCore::WebGLRenderingContextBase::canvas): Now returns a WebGLCanvas.
968         (WebCore::WebGLRenderingContextBase::htmlCanvas): Helper to get the HTMLCanvasElement if it exists.
969         (WebCore::WebGLRenderingContextBase::offscreenCanvas): Ditto for OffscreenCanvas.
970         (WebCore::WebGLRenderingContextBase::checkForContextLossHandling): Guard for htmlCanvas().
971         (WebCore::WebGLRenderingContextBase::registerWithWebGLStateTracker):
972         (WebCore::WebGLRenderingContextBase::setupFlags):
973         (WebCore::WebGLRenderingContextBase::addActivityStateChangeObserverIfNecessary):
974         (WebCore::WebGLRenderingContextBase::removeActivityStateChangeObserver):
975         (WebCore::WebGLRenderingContextBase::markContextChanged):
976         (WebCore::WebGLRenderingContextBase::markContextChangedAndNotifyCanvasObserver):
977         (WebCore::WebGLRenderingContextBase::paintRenderingResultsToCanvas):
978         (WebCore::WebGLRenderingContextBase::reshape):
979         (WebCore::WebGLRenderingContextBase::compileShader):
980         (WebCore::WebGLRenderingContextBase::isContextLostOrPending):
981         (WebCore::WebGLRenderingContextBase::readPixels):
982         (WebCore::WebGLRenderingContextBase::loseContextImpl):
983         (WebCore::WebGLRenderingContextBase::printToConsole):
984         (WebCore::WebGLRenderingContextBase::dispatchContextLostEvent):
985         (WebCore::WebGLRenderingContextBase::maybeRestoreContext):
986         (WebCore::WebGLRenderingContextBase::dispatchContextChangedEvent):
987         (WebCore::WebGLRenderingContextBase::clampedCanvasSize):
988         * html/canvas/WebGLRenderingContextBase.h: Define WebGLCanvas.
989         * html/canvas/WebGLRenderingContextBase.idl:
990
991         * inspector/InspectorInstrumentation.h: Handle the variant options, although leave OffscreenCanvas
992         unimplemented for the moment.
993         (WebCore::InspectorInstrumentation::didEnableExtension):
994         (WebCore::InspectorInstrumentation::didCreateProgram):
995         (WebCore::InspectorInstrumentation::willDeleteProgram):
996         (WebCore::InspectorInstrumentation::isShaderProgramDisabled):
997         * inspector/agents/InspectorCanvasAgent.cpp:
998         (WebCore::InspectorCanvasAgent::didEnableExtension):
999         (WebCore::InspectorCanvasAgent::didCreateProgram):
1000
1001 2017-11-27  Michael Catanzaro  <mcatanzaro@igalia.com>
1002
1003         Unreviewed, fix an improper #include
1004
1005         * platform/network/soup/NetworkStorageSessionSoup.cpp:
1006
1007 2017-11-27  Alex Christensen  <achristensen@webkit.org>
1008
1009         imported/w3c/web-platform-tests/url/failure.html crashes on debug builds
1010         https://bugs.webkit.org/show_bug.cgi?id=172337
1011
1012         Reviewed by Chris Dumez.
1013
1014         There were two problems:
1015         1. Invalid URLs can contain non-ASCII characters in its UTF8 representation.
1016         We should not put these URLs into content extension finite state machines.  They won't load anyways.
1017         2. If we don't have any content extensions installed, we still call String.utf8 unnecessarily.  Let's not.
1018
1019         * contentextensions/ContentExtensionsBackend.cpp:
1020         (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad const):
1021
1022 2017-11-27  Simon Fraser  <simon.fraser@apple.com>
1023
1024         Use TextStream's indent tracking, rather than passing indent to all the externalRepresentation() functions
1025         https://bugs.webkit.org/show_bug.cgi?id=180027
1026
1027         Reviewed by Jon Lee.
1028
1029         Remove all the indent arguments, and make use of TextStream::IndentScope to control
1030         output indentation.
1031         
1032         Add an indent stream manipulator so you can say
1033           ts << indent << "text"
1034         to write the indent.
1035
1036         * platform/graphics/filters/FEBlend.cpp:
1037         (WebCore::FEBlend::externalRepresentation const):
1038         * platform/graphics/filters/FEBlend.h:
1039         * platform/graphics/filters/FEColorMatrix.cpp:
1040         (WebCore::FEColorMatrix::externalRepresentation const):
1041         * platform/graphics/filters/FEColorMatrix.h:
1042         * platform/graphics/filters/FEComponentTransfer.cpp:
1043         (WebCore::FEComponentTransfer::externalRepresentation const):
1044         * platform/graphics/filters/FEComponentTransfer.h:
1045         * platform/graphics/filters/FEComposite.cpp:
1046         (WebCore::FEComposite::externalRepresentation const):
1047         * platform/graphics/filters/FEComposite.h:
1048         * platform/graphics/filters/FEConvolveMatrix.cpp:
1049         (WebCore::FEConvolveMatrix::externalRepresentation const):
1050         * platform/graphics/filters/FEConvolveMatrix.h:
1051         * platform/graphics/filters/FEDiffuseLighting.cpp:
1052         (WebCore::FEDiffuseLighting::externalRepresentation const):
1053         * platform/graphics/filters/FEDiffuseLighting.h:
1054         * platform/graphics/filters/FEDisplacementMap.cpp:
1055         (WebCore::FEDisplacementMap::externalRepresentation const):
1056         * platform/graphics/filters/FEDisplacementMap.h:
1057         * platform/graphics/filters/FEDropShadow.cpp:
1058         (WebCore::FEDropShadow::externalRepresentation const):
1059         * platform/graphics/filters/FEDropShadow.h:
1060         * platform/graphics/filters/FEFlood.cpp:
1061         (WebCore::FEFlood::externalRepresentation const):
1062         * platform/graphics/filters/FEFlood.h:
1063         * platform/graphics/filters/FEGaussianBlur.cpp:
1064         (WebCore::FEGaussianBlur::externalRepresentation const):
1065         * platform/graphics/filters/FEGaussianBlur.h:
1066         * platform/graphics/filters/FEMerge.cpp:
1067         (WebCore::FEMerge::externalRepresentation const):
1068         * platform/graphics/filters/FEMerge.h:
1069         * platform/graphics/filters/FEMorphology.cpp:
1070         (WebCore::FEMorphology::externalRepresentation const):
1071         * platform/graphics/filters/FEMorphology.h:
1072         * platform/graphics/filters/FEOffset.cpp:
1073         (WebCore::FEOffset::externalRepresentation const):
1074         * platform/graphics/filters/FEOffset.h:
1075         * platform/graphics/filters/FESpecularLighting.cpp:
1076         (WebCore::FESpecularLighting::externalRepresentation const):
1077         * platform/graphics/filters/FESpecularLighting.h:
1078         * platform/graphics/filters/FETile.cpp:
1079         (WebCore::FETile::externalRepresentation const):
1080         * platform/graphics/filters/FETile.h:
1081         * platform/graphics/filters/FETurbulence.cpp:
1082         (WebCore::FETurbulence::externalRepresentation const):
1083         * platform/graphics/filters/FETurbulence.h:
1084         * platform/graphics/filters/FilterEffect.cpp:
1085         (WebCore::FilterEffect::externalRepresentation const):
1086         * platform/graphics/filters/FilterEffect.h:
1087         * platform/graphics/filters/SourceAlpha.cpp:
1088         (WebCore::SourceAlpha::externalRepresentation const):
1089         * platform/graphics/filters/SourceAlpha.h:
1090         * platform/graphics/filters/SourceGraphic.cpp:
1091         (WebCore::SourceGraphic::externalRepresentation const):
1092         * platform/graphics/filters/SourceGraphic.h:
1093         * rendering/RenderTreeAsText.cpp:
1094         (WebCore::write):
1095         (WebCore::writeLayer):
1096         (WebCore::writeLayerRenderers):
1097         (WebCore::writeLayers):
1098         (WebCore::externalRepresentation):
1099         * rendering/RenderTreeAsText.h:
1100         * rendering/svg/SVGRenderTreeAsText.cpp:
1101         (WebCore::writeSVGInlineTextBox):
1102         (WebCore::writeSVGInlineTextBoxes):
1103         (WebCore::writeStandardPrefix):
1104         (WebCore::writeChildren):
1105         (WebCore::writeSVGResourceContainer):
1106         (WebCore::writeSVGContainer):
1107         (WebCore::write):
1108         (WebCore::writeSVGText):
1109         (WebCore::writeSVGInlineText):
1110         (WebCore::writeSVGImage):
1111         (WebCore::writeSVGGradientStop):
1112         (WebCore::writeResources):
1113         * rendering/svg/SVGRenderTreeAsText.h:
1114         * svg/graphics/filters/SVGFEImage.cpp:
1115         (WebCore::FEImage::externalRepresentation const):
1116         * svg/graphics/filters/SVGFEImage.h:
1117
1118 2017-11-27  Chris Dumez  <cdumez@apple.com>
1119
1120         Give Document a strongly typed identifier instead of a uint64_t
1121         https://bugs.webkit.org/show_bug.cgi?id=180041
1122
1123         Reviewed by Youenn Fablet.
1124
1125         Give Document a strongly typed identifier instead of a uint64_t, for clarity.
1126
1127         * WebCore.xcodeproj/project.pbxproj:
1128         * dom/Document.cpp:
1129         (WebCore::m_identifier):
1130         * dom/Document.h:
1131         (WebCore::Document::identifier const):
1132         * dom/DocumentIdentifier.h: Copied from Source/WebCore/workers/service/ServiceWorkerClientIdentifier.h.
1133         * workers/service/ServiceWorkerClientIdentifier.h:
1134         (WebCore::ServiceWorkerClientIdentifier::toString const):
1135         (WebCore::ServiceWorkerClientIdentifier::encode const):
1136         (WebCore::ServiceWorkerClientIdentifier::decode):
1137         * workers/service/server/SWClientConnection.cpp:
1138         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
1139         (WebCore::SWClientConnection::notifyClientsOfControllerChange):
1140         * workers/service/server/SWClientConnection.h:
1141         * workers/service/server/SWServer.cpp:
1142         (WebCore::SWServer::Connection::serviceWorkerStartedControllingClient):
1143         (WebCore::SWServer::Connection::serviceWorkerStoppedControllingClient):
1144         (WebCore::SWServer::serviceWorkerStartedControllingClient):
1145         (WebCore::SWServer::serviceWorkerStoppedControllingClient):
1146         * workers/service/server/SWServer.h:
1147         * workers/service/server/SWServerRegistration.cpp:
1148         (WebCore::SWServerRegistration::addClientUsingRegistration):
1149         (WebCore::SWServerRegistration::removeClientUsingRegistration):
1150         * workers/service/server/SWServerRegistration.h:
1151
1152 2017-11-27  Simon Fraser  <simon.fraser@apple.com>
1153
1154         Optimize FEDisplacementMap
1155         https://bugs.webkit.org/show_bug.cgi?id=180023
1156
1157         Reviewed by Sam Weinig.
1158
1159         Make FEDisplacementMap about 3x faster by operating on whole pixels rather than
1160         individual channels. There's no per-channel logic once the srcX and srcY are computed.
1161         
1162         Other sundry cleanup.
1163
1164         * platform/graphics/ColorUtilities.h:
1165         (WebCore::byteOffsetOfPixel): Will use this in more places in future.
1166         * platform/graphics/filters/FEDisplacementMap.cpp:
1167         (WebCore::FEDisplacementMap::platformApplySoftware):
1168         * platform/graphics/filters/FEDisplacementMap.h:
1169         (WebCore::FEDisplacementMap::xChannelIndex const):
1170         (WebCore::FEDisplacementMap::yChannelIndex const):
1171
1172 2017-11-27  Tim Horton  <timothy_horton@apple.com>
1173
1174         One too many zeroes in macOS version number in FeatureDefines
1175         https://bugs.webkit.org/show_bug.cgi?id=180011
1176
1177         Reviewed by Dan Bernstein.
1178
1179         * Configurations/FeatureDefines.xcconfig:
1180
1181 2017-11-27  Zan Dobersek  <zdobersek@igalia.com>
1182
1183         [CoordGraphics] CoordinatedGraphicsLayer doesn't need to inherit from TextureMapperPlatformLayer::Client
1184         https://bugs.webkit.org/show_bug.cgi?id=180036
1185
1186         Reviewed by Carlos Garcia Campos.
1187
1188         There's no reason CoordinatedGraphicsLayer should inherit from
1189         TextureMapperPlatformLayer::Client. CoordinatedGraphicsLayer objects are
1190         not used anywhere through that type, and all the overridden methods are
1191         empty anyway. The TextureMapperPlatformLayer::Client class (along with
1192         TextureMapperPlatformLayer) is nowadays only used in the direct
1193         TextureMapper implementation of GraphicsLayer.
1194
1195         No new tests -- no change in behavior.
1196
1197         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1198         (WebCore::CoordinatedGraphicsLayer::platformLayerWillBeDestroyed): Deleted.
1199         (WebCore::CoordinatedGraphicsLayer::setPlatformLayerNeedsDisplay): Deleted.
1200         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
1201
1202 2017-11-27  Antoine Quint  <graouts@apple.com>
1203
1204         Pressing the space bar while watching a fullscreen video doesn't play or pause
1205         https://bugs.webkit.org/show_bug.cgi?id=180033
1206         <rdar://problem/33610443>
1207
1208         Reviewed by Eric Carlson.
1209
1210         We register a "keydown" event to track when the space bar is pressed, and if the media is playing
1211         in fullscreen, we toggle playback. This does not interfere with full keyboard access since activating
1212         one of the media controls using the keyboard will not let the events we register for be dispatched
1213         this far along the event dispatch phase.
1214
1215         Test: media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html
1216
1217         * Modules/modern-media-controls/media/media-controller.js:
1218         (MediaController):
1219         (MediaController.prototype.togglePlayback): Add a catch() statement since calling play() could sometime
1220         lead to some extraneous unhandled promise console logging that pollutes test output.
1221         (MediaController.prototype.handleEvent):
1222
1223 2017-11-27  Simon Fraser  <simon.fraser@apple.com>
1224
1225         Optimize FEMorphology
1226         https://bugs.webkit.org/show_bug.cgi?id=180020
1227
1228         Reviewed by Sam Weinig.
1229
1230         Use const PaintingData&.
1231         Compute all components at once.
1232         Avoid Vector<> capacity changes during the pixel loop.
1233         Tweak the parallel jobs scaling.
1234         Templatize the the inner loop functions that compute min or max based
1235         on the filter type to avoid conditionals in tight loops.
1236         
1237         This is about a 4x speedup before the parallel jobs tweaking. With fixed parallelism,
1238         a 200x200 filter went from 15ms to about 1ms with these changes.
1239
1240         * platform/graphics/ColorUtilities.h:
1241         (WebCore::ColorComponents::fromRGBA):
1242         (WebCore::ColorComponents::toRGBA const):
1243         (WebCore::perComponentMax):
1244         (WebCore::perComponentMin):
1245         * platform/graphics/filters/FEColorMatrix.cpp:
1246         (WebCore::FEColorMatrix::platformApplySoftware): Remove some old perf logging code.
1247         TimingScope now does something similar.
1248         * platform/graphics/filters/FEMorphology.cpp:
1249         (WebCore::pixelArrayIndex):
1250         (WebCore::minOrMax):
1251         (WebCore::columnExtremum):
1252         (WebCore::kernelExtremum):
1253         (WebCore::FEMorphology::platformApplyGeneric):
1254         (WebCore::FEMorphology::platformApplyWorker):
1255         (WebCore::FEMorphology::platformApply):
1256         (WebCore::FEMorphology::platformApplySoftware):
1257         (WebCore::shouldSupersedeExtremum): Deleted.
1258         * platform/graphics/filters/FEMorphology.h:
1259
1260 2017-11-27  Yacine Bandou  <yacine.bandou_ext@softathome.com>
1261
1262         [EME][GStreamer] Change the ClearKey's SystemID value
1263         https://bugs.webkit.org/show_bug.cgi?id=180007
1264
1265         Reviewed by Xabier Rodriguez-Calvar.
1266
1267         Use 1077efec-c0b2-4d02-ace3-3c1e52e2fb4b instead of
1268         58147ec8-0423-4659-92e6-f52c5ce8c3cc, as is specified in W3C.
1269         https://www.w3.org/TR/eme-initdata-cenc/#common-system-definition
1270
1271         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
1272
1273 2017-11-27  Javier Fernandez  <jfernandez@igalia.com>
1274
1275         [css-grid] Display issues with child with max-width
1276         https://bugs.webkit.org/show_bug.cgi?id=178973
1277
1278         Reviewed by Darin Adler.
1279
1280         We have an utility function to compute the grid item's margins
1281         when the item still needs to layout. We used the function
1282         RenderStyle::hasMarings to decide whether such margin computation
1283         worths. However, we need that function to operate on a specific
1284         axis, hence I added a new function adding such logic.
1285
1286         Additionally, we must treat any 'auto' margin as 0px during the
1287         tracks sizing algorithm, as the CSS Grid spec states:
1288
1289           - https://drafts.csswg.org/css-grid/#auto-margins
1290
1291         Test: fast/css-grid-layout/auto-margins-ignored-during-track-sizing.html
1292
1293         * rendering/GridLayoutFunctions.cpp:
1294         (WebCore::GridLayoutFunctions::childHasMargin): New funciton with axis dependent logic.
1295         (WebCore::GridLayoutFunctions::computeMarginLogicalSizeForChild): Ignore auto margins.
1296         (WebCore::GridLayoutFunctions::marginLogicalSizeForChild): Ignore auto margins.
1297
1298 2017-11-26  Simon Fraser  <simon.fraser@apple.com>
1299
1300         feImage as filter input has skewed colors
1301         https://bugs.webkit.org/show_bug.cgi?id=180021
1302
1303         Reviewed by Sam Weinig.
1304         
1305         Using an <feImage> as a filter input sometimes results in incorrect colors, because
1306         the image is being sourced as linearRGB when it should always be sRGB.
1307         
1308         Fix by setting the result colorspace in FEImage before we allocate the output
1309         buffer.
1310
1311         Tests: svg/filters/feImage-color-fidelity-expected.svg
1312                svg/filters/feImage-color-fidelity.svg
1313
1314         * svg/graphics/filters/SVGFEImage.cpp:
1315         (WebCore::FEImage::platformApplySoftware):
1316
1317 2017-11-26  Minsheng Liu  <lambda@liu.ms>
1318
1319         Cleanup code for RenderMathMLUnderOver::layoutBlock
1320         https://bugs.webkit.org/show_bug.cgi?id=179681
1321
1322         Reviewed by Frédéric Wang.
1323
1324         The patch removes some unnecessary calls to layoutIfNeeds() and guards the change
1325         with assertion. Since there is no behavior change, no new tests are required.
1326
1327         * rendering/mathml/RenderMathMLUnderOver.cpp:
1328         (WebCore::RenderMathMLUnderOver::stretchHorizontalOperatorsAndLayoutChildren):
1329         (WebCore::RenderMathMLUnderOver::layoutBlock):
1330         (WebCore::RenderMathMLUnderOver::computeOperatorsHorizontalStretch): Deleted.
1331         * rendering/mathml/RenderMathMLUnderOver.h:
1332
1333 2017-11-26  Simon Fraser  <simon.fraser@apple.com>
1334
1335         Use more Uint8ClampedArray& and constness in filter and image buffer code
1336         https://bugs.webkit.org/show_bug.cgi?id=180008
1337
1338         Reviewed by Darin Adler.
1339
1340         Use references to Uint8ClampedArrays rather than pointers where necessary.
1341         
1342         Use const for source data buffers when possible, and uint8_t for the underlying
1343         data type.
1344         
1345         Fix a bug in FEGaussianBlur where the output of the last blur pass wasn't
1346         copied to the result buffer, which required a test adjustment.
1347
1348         * html/canvas/CanvasRenderingContext2D.cpp:
1349         (WebCore::CanvasRenderingContext2D::putImageData):
1350         * platform/graphics/ImageBuffer.cpp:
1351         (WebCore::ImageBuffer::genericConvertToLuminanceMask):
1352         * platform/graphics/ImageBuffer.h:
1353         * platform/graphics/ShadowBlur.cpp:
1354         (WebCore::ShadowBlur::blurShadowBuffer):
1355         * platform/graphics/cairo/ImageBufferCairo.cpp:
1356         (WebCore::ImageBuffer::putByteArray):
1357         * platform/graphics/cg/ImageBufferCG.cpp:
1358         (WebCore::ImageBuffer::putByteArray):
1359         * platform/graphics/cg/ImageBufferDataCG.cpp:
1360         (WebCore::ImageBufferData::getData const):
1361         (WebCore::ImageBufferData::putData):
1362         * platform/graphics/cg/ImageBufferDataCG.h:
1363         * platform/graphics/cpu/arm/filters/FEBlendNEON.h:
1364         (WebCore::FEBlend::platformApplySoftware):
1365         * platform/graphics/cpu/arm/filters/FECompositeArithmeticNEON.h:
1366         (WebCore::FEComposite::computeArithmeticPixelsNeon):
1367         (WebCore::FEComposite::platformArithmeticNeon):
1368         * platform/graphics/cpu/arm/filters/FEGaussianBlurNEON.h:
1369         (WebCore::boxBlurNEON):
1370         * platform/graphics/cpu/arm/filters/NEONHelpers.h:
1371         (WebCore::loadRGBA8AsFloat):
1372         * platform/graphics/filters/FEColorMatrix.cpp:
1373         (WebCore::effectApplyAccelerated):
1374         (WebCore::effectType):
1375         (WebCore::FEColorMatrix::platformApplySoftware):
1376         * platform/graphics/filters/FEComponentTransfer.cpp:
1377         (WebCore::FEComponentTransfer::platformApplySoftware):
1378         * platform/graphics/filters/FEComposite.cpp:
1379         (WebCore::computeArithmeticPixels):
1380         (WebCore::FEComposite::platformArithmeticSoftware):
1381         (WebCore::FEComposite::platformApplySoftware):
1382         * platform/graphics/filters/FEComposite.h:
1383         * platform/graphics/filters/FEConvolveMatrix.cpp:
1384         (WebCore::setDestinationPixels):
1385         (WebCore::FEConvolveMatrix::fastSetInteriorPixels):
1386         (WebCore::FEConvolveMatrix::fastSetOuterPixels):
1387         (WebCore::FEConvolveMatrix::platformApplySoftware):
1388         * platform/graphics/filters/FEConvolveMatrix.h:
1389         * platform/graphics/filters/FEDisplacementMap.cpp:
1390         (WebCore::FEDisplacementMap::platformApplySoftware):
1391         * platform/graphics/filters/FEDropShadow.cpp:
1392         (WebCore::FEDropShadow::platformApplySoftware):
1393         * platform/graphics/filters/FEGaussianBlur.cpp:
1394         (WebCore::boxBlurAlphaOnly):
1395         (WebCore::boxBlur):
1396         (WebCore::accelerateBoxBlur):
1397         (WebCore::standardBoxBlur):
1398         (WebCore::FEGaussianBlur::platformApplyGeneric):
1399         (WebCore::FEGaussianBlur::platformApplyWorker):
1400         (WebCore::FEGaussianBlur::platformApply):
1401         (WebCore::FEGaussianBlur::platformApplySoftware):
1402         * platform/graphics/filters/FEGaussianBlur.h:
1403         * platform/graphics/filters/FELighting.cpp:
1404         (WebCore::FELighting::drawLighting):
1405         (WebCore::FELighting::platformApplySoftware):
1406         * platform/graphics/filters/FELighting.h:
1407         * platform/graphics/filters/FEMorphology.cpp:
1408         (WebCore::columnExtremum):
1409         (WebCore::FEMorphology::platformApplyGeneric):
1410         (WebCore::FEMorphology::platformApplyDegenerate):
1411         (WebCore::FEMorphology::platformApplySoftware):
1412         * platform/graphics/filters/FEMorphology.h:
1413         * platform/graphics/filters/FETurbulence.cpp:
1414         (WebCore::FETurbulence::fillRegion const):
1415         (WebCore::FETurbulence::fillRegionWorker):
1416         (WebCore::FETurbulence::platformApplySoftware):
1417         * platform/graphics/filters/FETurbulence.h:
1418         * platform/graphics/filters/FilterEffect.cpp:
1419         (WebCore::FilterEffect::forceValidPreMultipliedPixels):
1420         (WebCore::FilterEffect::imageBufferResult):
1421         (WebCore::FilterEffect::unmultipliedResult):
1422         (WebCore::FilterEffect::premultipliedResult):
1423         (WebCore::FilterEffect::copyImageBytes const):
1424         (WebCore::copyPremultiplyingAlpha):
1425         (WebCore::copyUnpremultiplyingAlpha):
1426         (WebCore::FilterEffect::copyUnmultipliedResult):
1427         (WebCore::FilterEffect::copyPremultipliedResult):
1428         * platform/graphics/filters/FilterEffect.h:
1429         * platform/graphics/win/ImageBufferDataDirect2D.cpp:
1430         (WebCore::ImageBufferData::putData):
1431         * platform/graphics/win/ImageBufferDataDirect2D.h:
1432
1433 2017-11-25  Zalan Bujtas  <zalan@apple.com>
1434
1435         Make RenderSnapshottedPlugIn ISO allocated
1436         https://bugs.webkit.org/show_bug.cgi?id=180010
1437         <rdar://problem/35671977>
1438
1439         Reviewed by David Kilzer.
1440
1441         RenderEmbeddedObject, the base class is ISO allocated since r224537. 
1442
1443         * rendering/RenderSnapshottedPlugIn.cpp:
1444         * rendering/RenderSnapshottedPlugIn.h:
1445
1446 2016-08-05  Darin Adler  <darin@apple.com>
1447
1448         Fix some minor problems in the StringImpl header
1449         https://bugs.webkit.org/show_bug.cgi?id=160630
1450
1451         Reviewed by Brent Fulgham.
1452
1453         * html/HTMLOptionElement.cpp:
1454         (WebCore::HTMLOptionElement::text): Use stripLeadingAndTrailingHTMLSpaces
1455         instead of stripWhiteSpace(isHTMLSpace).
1456         (WebCore::HTMLOptionElement::value): Ditto.
1457         (WebCore::HTMLOptionElement::label): Ditto.
1458         (WebCore::HTMLOptionElement::displayLabel): Ditto.
1459         * loader/FrameLoader.cpp:
1460         (WebCore::FrameLoader::didBeginDocument): Use stripLeadingAndTrailingHTMLSpaces
1461         instead of calling the general purpose one and passing isHTMLSpace.
1462         * platform/network/HTTPParsers.h:
1463         (WebCore::stripLeadingAndTrailingHTTPSpaces): Updated to use the
1464         new name, stripLeadingAndTrailingCharacters.
1465
1466 2017-11-23  Darin Adler  <darin@apple.com>
1467
1468         Fix dictionary leak in lookup, convert FindOptions to OptionSet, tweak code style nearby
1469         https://bugs.webkit.org/show_bug.cgi?id=179981
1470
1471         Reviewed by Sam Weinig.
1472
1473         * accessibility/AXObjectCache.cpp:
1474         (WebCore::AXObjectCache::rangeMatchesTextNearRange): Pass { } instead of 0.
1475         * accessibility/AccessibilityObject.cpp:
1476         (WebCore::AccessibilityObject::rangeOfStringClosestToRangeInDirection const): Use { }
1477         instead of | to construct value.
1478         * editing/Editor.cpp:
1479         (WebCore::Editor::findString): Use contains instead of & to test an option.
1480         (WebCore::Editor::rangeOfString): Ditto.
1481         (WebCore::Editor::countMatchesForText): Ditto.
1482         * editing/EditorCommand.cpp:
1483         (WebCore::executeFindString): Use { } instead of | to construct value.
1484         * editing/FindOptions.h: Use OptionSet for type.
1485         * editing/TextIterator.cpp:
1486         (WebCore::SearchBuffer::SearchBuffer): Use contains instead of &. Also use -= instead
1487         of &= coupled with ~ to remove a flag.
1488         (WebCore::SearchBuffer::isWordEndMatch const): Ditto.
1489         (WebCore::SearchBuffer::isWordStartMatch const): Ditto.
1490         (WebCore::SearchBuffer::search): Ditto.
1491         (WebCore::findIteratorOptions): Ditto.
1492         (WebCore::findClosestPlainText): Ditto.
1493         (WebCore::findPlainText): Ditto.
1494
1495         * editing/mac/DictionaryLookup.h: Changed optional dictionary out arguments to
1496         RetainPtr<NSDictionary>. Before, they were returning a retained object, but callers
1497         did not seem to realize that.
1498         * editing/mac/DictionaryLookup.mm:
1499         (WebCore::tokenRange): Added helper. Takes care of doing adoptNS on the options
1500         dictionary, and also handles the Objective-C exception possibility cleanly. Also
1501         fixed the exception case to return NSNotFound instead of a zero-length range at
1502         the location we are searching, which is what the code expects.
1503         (WebCore::DictionaryLookup::rangeForSelection): Refactored to use the tokenRange
1504         helper function, and also to do much less work when the options pointer is null.
1505         (WebCore::DictionaryLookup::rangeAtHitTestResult): Use the tokenRange helper
1506         function and also use auto a bunch to tighten up the code a bit.
1507         (WebCore::DictionaryLookup::stringForPDFSelection): Ditto.
1508
1509         * page/DOMWindow.cpp:
1510         (WebCore::DOMWindow::find const): Use |= instead of | to build find options.
1511         * page/Page.cpp:
1512         (WebCore::Page::findString): Use contains instead of & and also - instead of
1513         & combined with ~.
1514         (WebCore::Page::findStringMatchingRanges): Ditto.
1515         (WebCore::Page::rangeOfString): Ditto.
1516
1517         * page/mac/EventHandlerMac.mm:
1518         (WebCore::EventHandler::selectClosestWordFromHitTestResultBasedOnLookup):
1519         Pass nullptr to indicate we don't need the options dictionary. The code before
1520         was passing a pointer to a null, which meant we would do the work to get the
1521         options dictionary, not use it, and also leak it.
1522
1523         * testing/Internals.cpp:
1524         (WebCore::Internals::rangeOfStringNearLocation): Pass { } instead of 0.
1525         (WebCore::Internals::rangeForDictionaryLookupAtLocation): Pass nullptr to
1526         indicate we don't need the options dictionary as above.
1527         (WebCore::parseFindOptions): Initialize options without an explicit 0, since
1528         an OptionSet starts out empty rather than uninitialized.
1529
1530 2017-11-24  Antti Koivisto  <antti@apple.com>
1531
1532         Style resolution spin due to calc() values always comparing inequal (seen on arstechnica.com)
1533         https://bugs.webkit.org/show_bug.cgi?id=179982
1534         <rdar://problem/35677991>
1535
1536         Reviewed by Darin Adler.
1537
1538         Test: transitions/transition-with-calc-spin.html
1539
1540         Something like calc(100% - 10px) would compare inequal to itself. This causes the implicit animation engine think that
1541         there is a new target value after style resolution and restart the transition. Starting the transition triggers another style
1542         resolution on zero duration timer and so on.
1543
1544         * platform/CalculationValue.cpp:
1545         (WebCore::operator==):
1546         * platform/CalculationValue.h:
1547
1548         Deep compare the child vectors.
1549
1550 2017-11-24  Antoine Quint  <graouts@apple.com>
1551
1552         Captions move when <video> with no controls is hovered
1553         https://bugs.webkit.org/show_bug.cgi?id=178600
1554         <rdar://problem/35112309>
1555
1556         Reviewed by Jer Noble.
1557
1558         We should only reduce the text tracks container height to make room for the controls
1559         bar when controls are enabled.
1560
1561         Tests: media/modern-media-controls/text-tracks/text-tracks-height-no-controls.html
1562                media/modern-media-controls/text-tracks/text-tracks-height-with-controls.html
1563
1564         * Modules/modern-media-controls/controls/text-tracks.css:
1565         (video[controls]::-webkit-media-text-track-container.visible-controls-bar):
1566         (video::-webkit-media-text-track-container.visible-controls-bar): Deleted.
1567
1568 2017-11-23  Simon Fraser  <simon.fraser@apple.com>
1569
1570         Some FilterEffect cleanup and logging
1571         https://bugs.webkit.org/show_bug.cgi?id=179932
1572
1573         Reviewed by Darin Adler.
1574         
1575         Rename the FilterEffect functions that get the result of the filter
1576         to have "result" in the name.
1577         
1578         Re-order FilterEffect member variables and use initializers. webkit.org/b/45614
1579         is closed so remove the comment about things moving to RenderSVGResourceFilterPrimitive.
1580         
1581         Add a virtual filterName() function for use by logging.
1582         
1583         Add a Filters log channel. Log some stuff.
1584         
1585         Rename RenderSVGResourceFilter::m_filter to m_rendererFilterDataMap.
1586
1587         * platform/Logging.h:
1588         * platform/graphics/cpu/arm/filters/FEBlendNEON.h:
1589         (WebCore::FEBlend::platformApplySoftware):
1590         * platform/graphics/filters/FEBlend.cpp:
1591         (WebCore::FEBlend::platformApplySoftware):
1592         * platform/graphics/filters/FEBlend.h:
1593         * platform/graphics/filters/FEColorMatrix.cpp:
1594         (WebCore::FEColorMatrix::platformApplySoftware):
1595         * platform/graphics/filters/FEColorMatrix.h:
1596         * platform/graphics/filters/FEComponentTransfer.cpp:
1597         (WebCore::FEComponentTransfer::platformApplySoftware):
1598         * platform/graphics/filters/FEComponentTransfer.h:
1599         * platform/graphics/filters/FEComposite.cpp:
1600         (WebCore::FEComposite::platformApplySoftware):
1601         * platform/graphics/filters/FEComposite.h:
1602         * platform/graphics/filters/FEConvolveMatrix.cpp:
1603         (WebCore::FEConvolveMatrix::platformApplySoftware):
1604         * platform/graphics/filters/FEConvolveMatrix.h:
1605         * platform/graphics/filters/FEDisplacementMap.cpp:
1606         (WebCore::FEDisplacementMap::platformApplySoftware):
1607         * platform/graphics/filters/FEDisplacementMap.h:
1608         * platform/graphics/filters/FEDropShadow.cpp:
1609         (WebCore::FEDropShadow::platformApplySoftware):
1610         * platform/graphics/filters/FEDropShadow.h:
1611         * platform/graphics/filters/FEFlood.h:
1612         * platform/graphics/filters/FEGaussianBlur.cpp:
1613         (WebCore::FEGaussianBlur::platformApplySoftware):
1614         * platform/graphics/filters/FEGaussianBlur.h:
1615         * platform/graphics/filters/FELighting.cpp:
1616         (WebCore::FELighting::platformApplySoftware):
1617         * platform/graphics/filters/FELighting.h:
1618         * platform/graphics/filters/FEMerge.cpp:
1619         (WebCore::FEMerge::platformApplySoftware):
1620         * platform/graphics/filters/FEMerge.h:
1621         * platform/graphics/filters/FEMorphology.cpp:
1622         (WebCore::FEMorphology::platformApplyDegenerate):
1623         (WebCore::FEMorphology::platformApplySoftware):
1624         * platform/graphics/filters/FEMorphology.h:
1625         * platform/graphics/filters/FEOffset.cpp:
1626         (WebCore::FEOffset::platformApplySoftware):
1627         * platform/graphics/filters/FEOffset.h:
1628         * platform/graphics/filters/FETile.cpp:
1629         (WebCore::FETile::platformApplySoftware):
1630         * platform/graphics/filters/FETile.h:
1631         * platform/graphics/filters/FETurbulence.cpp:
1632         (WebCore::operator<<):
1633         * platform/graphics/filters/FETurbulence.h:
1634         * platform/graphics/filters/FilterEffect.cpp:
1635         (WebCore::FilterEffect::FilterEffect):
1636         (WebCore::FilterEffect::imageBufferResult):
1637         (WebCore::FilterEffect::unmultipliedResult):
1638         (WebCore::FilterEffect::premultipliedResult):
1639         (WebCore::FilterEffect::copyImageBytes const): This can be const. It'a also crazy
1640         to mark a large, slow function like this as 'inline'.
1641         (WebCore::FilterEffect::copyUnmultipliedResult):
1642         (WebCore::FilterEffect::copyPremultipliedResult):
1643         (WebCore::FilterEffect::createImageBufferResult):
1644         (WebCore::FilterEffect::createUnmultipliedImageResult):
1645         (WebCore::FilterEffect::createPremultipliedImageResult):
1646         (WebCore::FilterEffect::transformResultColorSpace):
1647         (WebCore::FilterEffect::asImageBuffer): Deleted.
1648         (WebCore::FilterEffect::asUnmultipliedImage): Deleted.
1649         (WebCore::FilterEffect::asPremultipliedImage): Deleted.
1650         (WebCore::FilterEffect::copyImageBytes): Deleted.
1651         (WebCore::FilterEffect::copyUnmultipliedImage): Deleted.
1652         (WebCore::FilterEffect::copyPremultipliedImage): Deleted.
1653         * platform/graphics/filters/FilterEffect.h:
1654         * platform/graphics/filters/SourceAlpha.cpp:
1655         (WebCore::SourceAlpha::platformApplySoftware):
1656         * platform/graphics/filters/SourceAlpha.h:
1657         * platform/graphics/filters/SourceGraphic.h:
1658         * rendering/FilterEffectRenderer.cpp:
1659         (WebCore::FilterEffectRenderer::output const):
1660         * rendering/svg/RenderSVGResourceFilter.cpp:
1661         (WebCore::RenderSVGResourceFilter::removeAllClientsFromCache):
1662         (WebCore::RenderSVGResourceFilter::removeClientFromCache):
1663         (WebCore::RenderSVGResourceFilter::applyResource):
1664         (WebCore::RenderSVGResourceFilter::postApplyResource):
1665         (WebCore::RenderSVGResourceFilter::primitiveAttributeChanged):
1666         (WebCore::RenderSVGResourceFilter::drawingRegion const):
1667         (WebCore::operator<<):
1668         * rendering/svg/RenderSVGResourceFilter.h:
1669         (WebCore::FilterData::FilterData): Deleted.
1670         * svg/graphics/filters/SVGFEImage.h:
1671
1672 2017-11-24  Antoine Quint  <graouts@apple.com>
1673
1674         [Web Animations] Allow getComputedStyle() to return animated values for accelerated animations
1675         https://bugs.webkit.org/show_bug.cgi?id=179975
1676         <rdar://problem/35676811>
1677
1678         Reviewed by Dean Jackson.
1679
1680         In case we're running an accelerated animation, we are not blending RenderStyles as the animation
1681         progresses and thus we need to hook into computeRenderStyleForProperty() to query the DocumentTimeline
1682         for the animated style of running accelerated animations where we blend styles manually for the
1683         animation's current time.
1684
1685         Test: http/wpt/wk-web-animations/interfaces/keyframe-effect-getComputedStyle.html
1686
1687         * animation/DocumentTimeline.cpp:
1688         (WebCore::DocumentTimeline::animatedStyleForRenderer): Iterate through all running accelerated animations
1689         for the element to which the provided renderer is attached and ask for their animated styles.
1690         * animation/DocumentTimeline.h:
1691         * animation/KeyframeEffect.cpp:
1692         (WebCore::KeyframeEffect::getAnimatedStyle): Manually blend all animated properties and populate the provided
1693         RenderStyle with their values, creating the RenderStyle if needed.
1694         * animation/KeyframeEffect.h:
1695         * css/CSSComputedStyleDeclaration.cpp:
1696         (WebCore::computeRenderStyleForProperty): Query the DocumentTimeline for accelerated animated properties in
1697         case such animations are running, otherwise let the CSS animation controller report the animated values.
1698
1699 2017-11-24  Zan Dobersek  <zdobersek@igalia.com>
1700
1701         [CoordGraphics] CoordinatedGraphicsLayer::updateContentBuffers() should always assume a non-null CoordinatedBuffer
1702         https://bugs.webkit.org/show_bug.cgi?id=179977
1703
1704         Reviewed by Carlos Garcia Campos.
1705
1706         CoordinatedGraphicsLayer::updateContentBuffers() retrieves a RefPtr<CoordinatedBuffer>
1707         from the CompositingCoordinator. This pointer should never be null since if no
1708         existing UpdateAtlas can provide the necessary memory area, a fresh UpdateAtlas is
1709         created and its buffer returned. This can't fail in theory since the tiles that are
1710         being updated are smaller than the UpdateAtlas area.
1711
1712         The CoordinatedGraphicsLayerClient::getCoordinatedBuffer() method is updated to
1713         always return a Ref<CoordinatedBuffer> value. Code in updateContentBuffers() is
1714         updated to remove a null-check on what is now the Ref<CoordinatedBuffer> value.
1715
1716         No new tests -- no change in functionality.
1717
1718         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1719         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
1720         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
1721
1722 2017-11-23  Antoine Quint  <graouts@apple.com>
1723
1724         [Web Animations] Perform accelerated animations when possible
1725         https://bugs.webkit.org/show_bug.cgi?id=179973
1726         <rdar://problem/34953922>
1727
1728         Reviewed by Dean Jackson.
1729
1730         When we're entering and leaving the active duration of an animation effect, we now check
1731         whether the animation can be accelerated, using the existing CSSPropertyAnimation::animationOfPropertyIsAccelerated()
1732         utility, and start and stop animations using the startAnimation() and animationFinished() functions on RenderBoxModelObject.
1733
1734         This patch is only a first step towards full support for accelerated animations,
1735         there are two known issues at the moment. Because we're not blending the styles to perform
1736         the animation, getComputedStyle() will not return the animated value (webkit.org/b/179974).
1737         Additionally, if other animations happen to run later during the active state of an animation
1738         that can run accelerated, we will not fall back to software-only animation for this
1739         element and these animations will appear not to run (webkit.org/b/179975). These will be
1740         addressed in follow-up patches.
1741
1742         Tests: webanimations/left-and-opacity-animation-yields-no-compositing.html
1743                webanimations/opacity-animation-no-longer-composited-upon-completion.html
1744                webanimations/opacity-animation-yields-compositing.html
1745                webanimations/width-and-opacity-separate-animation-yields-no-compositing.html
1746
1747         * animation/DocumentTimeline.cpp:
1748         (WebCore::DocumentTimeline::updateAnimations): Check in the map of pending accelerated animations
1749         to see if any animation requires toggling their active state after their styles have been invalidated.
1750         (WebCore::DocumentTimeline::animationAcceleratedRunningStateDidChange): New function to
1751         let animations indicate that they need to have their accelerated backing animation toggled after
1752         style invalidation has been completed.
1753         (WebCore::DocumentTimeline::runningAnimationsForElementAreAllAccelerated): This function is used
1754         in RenderLayerCompositor::requiresCompositingForAnimation() to identify whether an element requires
1755         hardware compositing due to running accelerated animations. We check all running animations for the
1756         provided element to see if they can all be running accelerated and return true in this situation only.
1757         * animation/DocumentTimeline.h:
1758         * animation/KeyframeEffect.cpp:
1759         (WebCore::KeyframeEffect::applyAtLocalTime): Identify if we're crossing into or out of the active state
1760         for an animation and check if it will be or has been running accelerated such that we can notify the
1761         DocumentTimeline, through the associated animation, that the accelerated backing animation will need to
1762         be toggled after style invalidation has been completed.
1763         (WebCore::KeyframeEffect::shouldRunAccelerated): Check that all properties for this animation
1764         effect can be accelerated according to CSSPropertyAnimation::animationOfPropertyIsAccelerated().
1765         (WebCore::KeyframeEffect::startOrStopAccelerated): Start or stop the associated accelerated
1766         animation through the associated element's RenderBoxModelObject renderer.
1767         * animation/KeyframeEffect.h:
1768         * animation/WebAnimation.cpp:
1769         (WebCore::WebAnimation::acceleratedRunningStateDidChange): Called from AnimationEffect::applyAtLocalTime(),
1770         we forward to the DocumentTimeline the information that the animation will cross an active state boundary while
1771         allowing to be backed by hardware compositing.
1772         (WebCore::WebAnimation::startOrStopAccelerated): Forward to the associated KeyframeEffect that accelerated
1773         animation backing should be toggled.
1774         * animation/WebAnimation.h:
1775         * rendering/RenderLayerCompositor.cpp:
1776         (WebCore::RenderLayerCompositor::requiresCompositingForAnimation const): Check via the renderer's element's
1777         DocumentTimeline that all running animations for this particular element are accelerated to ensure that
1778         the element will be hardware-composited.
1779
1780 2017-11-23  Fujii Hironori  <Hironori.Fujii@sony.com>
1781
1782         [Win] PasteboardWin.cpp(653): error C2039: 'containsOnlyASCII': is not a member of 'WTF::String'
1783         https://bugs.webkit.org/show_bug.cgi?id=179991
1784
1785         Unreviewed build fix.
1786
1787         No new tests (No behaviour change).
1788
1789         * platform/win/PasteboardWin.cpp:
1790         (WebCore::Pasteboard::writeURLToDataObject): Renamed containsOnlyASCII() to isAllASCII().
1791
1792 2017-11-23  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1793
1794         [GTK] [Debug] Fix build after r225117.
1795         https://bugs.webkit.org/show_bug.cgi?id=179907
1796
1797         Unreviewed build fix.
1798
1799         r225117 renamed containsOnlyASCII() to isAllASCII().
1800         And this reference was not updated for the GTK Debug build.
1801
1802         No new tests, its a build fix.
1803
1804         * loader/archive/mhtml/MHTMLArchive.cpp:
1805         (WebCore::MHTMLArchive::generateMHTMLData):
1806
1807 2017-11-23  Simon Fraser  <simon.fraser@apple.com>
1808
1809         FELighting cleanup and optimization
1810         https://bugs.webkit.org/show_bug.cgi?id=179933
1811
1812         Reviewed by Darin Adler.
1813
1814         Make FELighting about 25% faster by maintaining an "alpha" window of the alpha
1815         values of the 9 pixels surrounding the current pixel, and sliding this window over
1816         when moving to the next pixel. This avoids reading the same alpha values from the original
1817         buffer multiple times.
1818
1819         Clean up LightSource and subclasses, adding SPECIALIZE_TYPE_TRAITS macros,
1820         and turning updatePaintingData() into a function with no side effects that returns
1821         the required data.
1822
1823         Remove explicit 'inline' keywords, allowing the compiler to make inlining decisions.
1824
1825         * platform/graphics/cpu/arm/filters/FELightingNEON.h:
1826         (WebCore::FELighting::platformApplyNeon):
1827         * platform/graphics/filters/DistantLightSource.cpp:
1828         (WebCore::DistantLightSource::initPaintingData):
1829         (WebCore::DistantLightSource::computePixelLightingData const):
1830         (WebCore::DistantLightSource::updatePaintingData): Deleted.
1831         * platform/graphics/filters/DistantLightSource.h:
1832         * platform/graphics/filters/FELighting.cpp:
1833         (WebCore::FELighting::LightingData::interiorNormal const):
1834         (WebCore::FELighting::setPixel):
1835         (WebCore::FELighting::setPixelInternal):
1836         (WebCore::FELighting::platformApplyGenericPaint):
1837         (WebCore::FELighting::platformApplyGeneric):
1838         (WebCore::FELighting::platformApply):
1839         (WebCore::FELighting::drawLighting):
1840         (WebCore::FELighting::inlineSetPixel): Deleted.
1841         * platform/graphics/filters/FELighting.h:
1842         (WebCore::FELighting::AlphaWindow::topLeft const):
1843         (WebCore::FELighting::AlphaWindow::left const):
1844         (WebCore::FELighting::AlphaWindow::bottomLeft const):
1845         (WebCore::FELighting::AlphaWindow::top const):
1846         (WebCore::FELighting::AlphaWindow::center const):
1847         (WebCore::FELighting::AlphaWindow::bottom const):
1848         (WebCore::FELighting::AlphaWindow::setTop):
1849         (WebCore::FELighting::AlphaWindow::setCenter):
1850         (WebCore::FELighting::AlphaWindow::setBottom):
1851         (WebCore::FELighting::AlphaWindow::setTopRight):
1852         (WebCore::FELighting::AlphaWindow::setRight):
1853         (WebCore::FELighting::AlphaWindow::setBottomRight):
1854         (WebCore::FELighting::AlphaWindow::shiftRow):
1855         (WebCore::FELighting::AlphaWindow::shift):
1856         * platform/graphics/filters/LightSource.h:
1857         * platform/graphics/filters/PointLightSource.cpp:
1858         (WebCore::PointLightSource::computePixelLightingData const):
1859         (WebCore::PointLightSource::updatePaintingData): Deleted.
1860         * platform/graphics/filters/PointLightSource.h:
1861         * platform/graphics/filters/SpotLightSource.cpp:
1862         (WebCore::SpotLightSource::initPaintingData):
1863         (WebCore::SpotLightSource::computePixelLightingData const):
1864         (WebCore::SpotLightSource::updatePaintingData): Deleted.
1865         * platform/graphics/filters/SpotLightSource.h:
1866
1867 2017-11-23  Simon Fraser  <simon.fraser@apple.com>
1868
1869         Add support for CanvasPattern.setTransform()
1870         https://bugs.webkit.org/show_bug.cgi?id=179935
1871
1872         Reviewed by Sam Weinig.
1873         
1874         Add support for setTransform() on CanvasPattern, per
1875         <https://html.spec.whatwg.org/multipage/canvas.html#dom-canvaspattern-settransform>
1876         It uses [MayThrowException] since the "validate and fixup" steps for DOMMatrix can throw
1877         an exception.
1878         
1879         Under the hood, the transform is just pushed onto Pattern as the patternSpaceTransform().
1880         
1881         Minor cleanup in Pattern.
1882
1883         Test: fast/canvas/canvas-pattern-with-transform.html
1884
1885         * html/canvas/CanvasPattern.cpp:
1886         (WebCore::CanvasPattern::setTransform):
1887         * html/canvas/CanvasPattern.h:
1888         * html/canvas/CanvasPattern.idl:
1889         * platform/graphics/Pattern.h:
1890
1891 2017-11-23  Sam Weinig  <sam@webkit.org>
1892
1893         Remove unneeded ScriptController::processingUserGesture() forwarding functions
1894         https://bugs.webkit.org/show_bug.cgi?id=179954
1895
1896         Reviewed by Darin Adler.
1897
1898         Replace ScriptController::processingUserGesture() and ScriptController::processingUserGestureForMedia()
1899         with direct calls to the corresponding UserGestureIndicator functions.
1900
1901         * Modules/applepay/ApplePaySession.cpp:
1902         (WebCore::ApplePaySession::create):
1903         (WebCore::ApplePaySession::openPaymentSetup):
1904         * Modules/speech/SpeechSynthesis.cpp:
1905         (WebCore::SpeechSynthesis::speak):
1906         * bindings/js/ScriptController.cpp:
1907         (WebCore::ScriptController::processingUserGesture): Deleted.
1908         (WebCore::ScriptController::processingUserGestureForMedia): Deleted.
1909         * bindings/js/ScriptController.h:
1910         * dom/Document.cpp:
1911         (WebCore::Document::processingUserGestureForMedia const):
1912         * html/BaseChooserOnlyDateAndTimeInputType.cpp:
1913         (WebCore::BaseChooserOnlyDateAndTimeInputType::handleDOMActivateEvent):
1914         * html/ColorInputType.cpp:
1915         (WebCore::ColorInputType::handleDOMActivateEvent):
1916         * html/FileInputType.cpp:
1917         (WebCore::FileInputType::handleDOMActivateEvent):
1918         * html/HTMLFormElement.cpp:
1919         (WebCore::HTMLFormElement::submitFromJavaScript):
1920         * html/HTMLPlugInImageElement.cpp:
1921         (WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement):
1922         (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn):
1923         * loader/FrameLoader.cpp:
1924         (WebCore::FrameLoader::submitForm):
1925         (WebCore::shouldOpenExternalURLsPolicyToApply):
1926         * page/DOMWindow.cpp:
1927         (WebCore::DOMWindow::allowPopUp):
1928         (WebCore::DOMWindow::setLocation):
1929         (WebCore::DOMWindow::createWindow):
1930         (WebCore::DOMWindow::open):
1931         * page/PointerLockController.cpp:
1932         (WebCore::PointerLockController::requestPointerLock):
1933
1934 2017-11-22  Dean Jackson  <dino@apple.com>
1935
1936         Add a base class for HTMLCanvasElement and OffscreenCanvas
1937         https://bugs.webkit.org/show_bug.cgi?id=179701
1938         <rdar://problem/35545195>
1939
1940         Post-review updates from Darin Adler review.
1941
1942         * html/CanvasBase.cpp:
1943         (WebCore::CanvasBase::asHTMLCanvasElement): Deleted. Replaced by having the call
1944         sites get the reference and do the correct downcast<>.
1945         * html/CanvasBase.h: Remove asHTMLCanvasElement. Add pure virtual ref/deref functions
1946         so they can be overridden by subclasses. Unfortunately they can't be called ref/deref otherwise
1947         they conflict with Node.
1948         * html/HTMLCanvasElement.h: Add the type traits, so is<HTMLCanvasElement>(canvasBase) will
1949         work.
1950         * html/HTMLTagNames.in: Specify the <canvas> element as having custom type traits.
1951         * html/OffscreenCanvas.h: Lots of overrides to finals.
1952         * html/canvas/CanvasRenderingContext.cpp: Use canvasBase.de/refCanvasBase rather than
1953         casting.
1954         (WebCore::CanvasRenderingContext::ref):
1955         (WebCore::CanvasRenderingContext::deref):
1956         * html/canvas/CanvasRenderingContext.h: Lots of overrides to finals.
1957         * html/canvas/CanvasRenderingContext2D.h:
1958         * html/canvas/ImageBitmapRenderingContext.cpp:
1959         (WebCore::ImageBitmapRenderingContext::canvas const):
1960         * html/canvas/WebGLRenderingContextBase.cpp:
1961         (WebCore::WebGLRenderingContextBase::create):
1962         (WebCore::WebGLRenderingContextBase::canvas):
1963         * html/canvas/WebGPURenderingContext.cpp:
1964         (WebCore::WebGPURenderingContext::canvas const):
1965         * inspector/InspectorInstrumentation.h:
1966         (WebCore::InspectorInstrumentation::recordCanvasAction):
1967         * inspector/agents/InspectorCanvasAgent.cpp:
1968         (WebCore::InspectorCanvasAgent::recordCanvasAction):
1969
1970 2017-11-23  Darin Adler  <darin@apple.com>
1971
1972         Reduce WTF::String operations that do unnecessary Unicode operations instead of ASCII
1973         https://bugs.webkit.org/show_bug.cgi?id=179907
1974
1975         Reviewed by Sam Weinig.
1976
1977         * Modules/plugins/YouTubePluginReplacement.cpp:
1978         (WebCore::hasCaseInsensitivePrefix): Deleted.
1979         (WebCore::processAndCreateYouTubeURL): Use startsWithLettersIgnoringASCIICase.
1980
1981         * Modules/websockets/WebSocketHandshake.cpp:
1982         (WebCore::WebSocketHandshake::readHTTPHeaders): Use isAllASCII.
1983
1984         * accessibility/atk/AccessibilityObjectAtk.cpp:
1985         (WebCore::AccessibilityObject::getLengthForTextRange const): Use text().length().
1986
1987         * accessibility/AXObjectCache.cpp:
1988         (WebCore::AXObjectCache::traverseToOffsetInRange): Use isHTMLSpace instead of
1989         isSpaceOrNewline since the code is trying to skip collapsible HTML spaces, not
1990         arbitrary Unicode whitespace.
1991         * accessibility/AccessibilityList.cpp:
1992         (WebCore::AccessibilityList::childHasPseudoVisibleListItemMarkers): Use
1993         isAllSpecialCharacters<isHTMLSpace> for the same reason as above.
1994
1995         * accessibility/AccessibilityNodeObject.cpp:
1996         (WebCore::AccessibilityNodeObject::isSearchField const): Use containsIgnoringASCIICase.
1997
1998         * accessibility/AccessibilityObject.cpp:
1999         (WebCore::AccessibilityObject::accessibilityObjectContainsText const): Use
2000         new findPlainText function exported from TextIterator so this can share the
2001         same search matching logic used to find text in webpages.
2002         (WebCore::AccessibilityObject::selectText): Use capitalize and its return value
2003         rather than makeCapitalize modifying a string in place.
2004
2005         * accessibility/AccessibilityRenderObject.cpp:
2006         (WebCore::objectInclusionFromAltText): Use isAllSpecialCharacters<isHTMLSpace>
2007         for the same reason as above.
2008         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const): Ditto.
2009
2010         * bindings/js/JSDOMConvertStrings.cpp:
2011         (WebCore::stringToByteString): Use isAllLatin1.
2012
2013         * contentextensions/ContentExtensionParser.cpp:
2014         (WebCore::ContentExtensions::containsOnlyASCIIWithNoUppercase): Use
2015         StringView::codeUnits instead of String::at.
2016
2017         * contentextensions/ContentExtensionsBackend.cpp:
2018         (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad const):
2019         Use isAllASCII.
2020         * contentextensions/URLFilterParser.cpp:
2021         (WebCore::ContentExtensions::URLFilterParser::addPattern): Ditto.
2022
2023         * css/CSSFontFaceSrcValue.cpp:
2024         (WebCore::CSSFontFaceSrcValue::isSupportedFormat const): Use protocolIs and
2025         endsWithIgnoringASCIICase.
2026
2027         * css/DOMCSSNamespace.cpp:
2028         (WebCore::valueWithoutImportant): Use endsWithIgnoringASCIICase.
2029
2030         * css/parser/CSSPropertyParser.cpp:
2031         (WebCore::parseGridTemplateAreasRow): Use isAllSpecialCharacters<isCSSSpace>,
2032         for the preflight, which matches what the actual parsing code uses.
2033
2034         * dom/CharacterData.cpp:
2035         (WebCore::CharacterData::containsOnlyWhitespace const): Deleted. Callers can
2036         efficiently get at the data and do this kind of check on the data directly.
2037         * dom/CharacterData.h: Updated for the above.
2038
2039         * dom/DataTransfer.cpp:
2040         (WebCore::normalizeType): Use startsWith since the string is already converted
2041         to ASCII lowercase.
2042
2043         * dom/Position.cpp:
2044         (WebCore::Position::leadingWhitespacePosition const): Use isHTMLSpace since
2045         since the code is trying to check for collapsible HTML spaces, not general
2046         Unicode spaces. Other call sites of isSpaceOrNewline need to be checked for
2047         this, but I did not fix them all at this time.
2048         (WebCore::Position::trailingWhitespacePosition const): Ditto.
2049
2050         * editing/Editor.cpp:
2051         (WebCore::Editor::editorUIUpdateTimerFired): Use noBreakSpace.
2052
2053         * editing/FrameSelection.cpp:
2054         (WebCore::FrameSelection::debugRenderer const): Use text().length() instead
2055         of textLength.
2056         (WebCore::FrameSelection::selectionAtWordStart const): Use noBreakSpace.
2057         (WebCore::FrameSelection::wordSelectionContainingCaretSelection): Ditto.
2058         (WebCore::FrameSelection::actualSelectionAtSentenceStart const): Ditto.
2059
2060         * editing/TextIterator.cpp:
2061         (WebCore::textNodeOffsetInFlow): Use text().length().
2062         (WebCore::TextIterator::handleTextNode): Ditto.
2063         (WebCore::collapsedSpaceLength): Updated since RenderText::text now returns
2064         a reference rather than a pointer.
2065         (WebCore::findPlainText): Added. Uses SearchBuffer to search for one string
2066         within another. Exported so accessibility code can do this operation.
2067         * editing/TextIterator.h: Updated for the above.
2068
2069         * editing/TypingCommand.cpp:
2070         (WebCore::TypingCommand::markMisspellingsAfterTyping): Use noBreakSpace.
2071
2072         * editing/VisibleUnits.cpp:
2073         (WebCore::findStartOfParagraph): Updated since RenderText::text now returns
2074         a reference.
2075         (WebCore::findEndOfParagraph): Ditto.
2076
2077         * editing/cocoa/HTMLConverter.mm:
2078         (HTMLConverter::_processText): Use String::characterAt instead of String::at.
2079         Use capitalize instead of makeCapitalized.
2080
2081         * editing/cocoa/WebContentReaderCocoa.mm:
2082         (WebCore::stripMicrosoftPrefix): Use findIgnoringASCIICase.
2083
2084         * html/Autofill.cpp:
2085         (WebCore::AutofillData::createFromHTMLFormControlElement): Use
2086         startsWithLettersIgnoringASCIICase.
2087
2088         * html/BaseTextInputType.cpp:
2089         (WebCore::BaseTextInputType::patternMismatch const): Removed explicit
2090         TextCaseSensitive since it now is the default, and needed to touch this anyway
2091         because the enumeration is now in a different namespace.
2092
2093         * html/EmailInputType.cpp:
2094         (WebCore::isValidEmailAddress): Updated to use JSC::Yarr::TextCaseInsensitive.
2095
2096         * html/HTMLObjectElement.cpp:
2097         (WebCore::HTMLObjectElement::hasFallbackContent const): Use
2098         isAllSpecialCharacters<isHTMLSpace>.
2099         (WebCore::HTMLObjectElement::shouldAllowQuickTimeClassIdQuirk): Use
2100         startsWithLettersIgnoringASCIICase.
2101         (WebCore::HTMLObjectElement::hasValidClassId): Use protocolIs.
2102         (WebCore::preventsParentObjectFromExposure): Use isAllSpecialCharacters<isHTMLSpace>.
2103
2104         * html/parser/HTMLConstructionSite.cpp:
2105         (WebCore::HTMLConstructionSite::setCompatibilityModeFromDoctype):
2106         Use startsWithLettersIgnoringASCIICase.
2107
2108         * html/parser/HTMLMetaCharsetParser.cpp:
2109         (WebCore::extractCharset): Use findIgnoringASCIICase.
2110
2111         * html/parser/XSSAuditor.cpp:
2112         (WebCore::XSSAuditor::isContainedInRequest): Use containsIgnoringASCIICase.
2113
2114         * html/track/WebVTTParser.cpp:
2115         (WebCore::WebVTTParser::hasRequiredFileIdentifier): Don't pass the length to
2116         the String::startsWith function. There has never been a version of that function
2117         that takes the length, there is no need to pass the length since the function
2118         handles null-terminated strings like the one here, and in the past the length
2119         has been getting converted to a boolean making the comparison be case sensitive.
2120         Removing the argument entirely leaves it case sensitive.
2121
2122         * inspector/InspectorNodeFinder.cpp:
2123         (WebCore::InspectorNodeFinder::matchesElement): Use startsWithIgnoringASCIICase
2124         and endsWithIgnoringASCIICase.
2125
2126         * inspector/InspectorStyleSheet.cpp:
2127         (WebCore::selectorsFromSource): Use JSC::Yarr::TextCaseSensitive.
2128
2129         * inspector/agents/InspectorDOMAgent.cpp:
2130         (WebCore::containsOnlyHTMLWhitespace): Made this a non-member function
2131         and reimplemented using isAllSpecialCharacters<isHTMLSpace>().
2132         (WebCore::InspectorDOMAgent::innerFirstChild): Use containsOnlyHTMLWhitespace.
2133         (WebCore::InspectorDOMAgent::innerNextSibling): Ditto.
2134         (WebCore::InspectorDOMAgent::innerPreviousSibling): Ditto.
2135         (WebCore::InspectorDOMAgent::innerChildNodeCount): Ditto.
2136         (WebCore::InspectorDOMAgent::didInsertDOMNode): Ditto.
2137         (WebCore::InspectorDOMAgent::didRemoveDOMNode): Ditto.
2138         * inspector/agents/InspectorDOMAgent.h: Updated for above change.
2139
2140         * loader/appcache/ApplicationCacheStorage.cpp:
2141         (WebCore::ApplicationCacheStorage::shouldStoreResourceAsFlatFile):
2142         Use startsWithLettersIgnoringASCIICase.
2143
2144         * page/Base64Utilities.cpp:
2145         (WebCore::Base64Utilities::btoa): Use isAllLatin1.
2146
2147         * page/Frame.cpp:
2148         (WebCore::createRegExpForLabels): Removed TextCaseSensitive argument since
2149         that is now the default and also used JSC::Yarr::TextCaseInsensitive.
2150         (WebCore::matchLabelsAgainstString): More of the same.
2151
2152         * page/FrameView.cpp:
2153         (WebCore::countRenderedCharactersInRenderObjectWithThreshold): Use
2154         text().length().
2155
2156         * page/SecurityOrigin.cpp:
2157         (WebCore::isFeedWithNestedProtocolInHTTPFamily): Use
2158         startsWithLettersIgnoringASCIICase.
2159
2160         * page/UserContentURLPattern.cpp:
2161         (WebCore::UserContentURLPattern::matchesHost const):
2162         Use endsWithIgnoringASCIICase.
2163         * page/csp/ContentSecurityPolicySource.cpp:
2164         (WebCore::ContentSecurityPolicySource::hostMatches const): Ditto.
2165
2166         * page/csp/ContentSecurityPolicySourceList.cpp:
2167         (WebCore::ContentSecurityPolicySourceList::parseNonceSource):
2168         Use startsWithIgnoringASCIICase.
2169
2170         * page/ios/FrameIOS.mm:
2171         (WebCore::Frame::wordsInCurrentParagraph const): Use noBreakSpace.
2172
2173         * platform/ContentType.cpp:
2174         (WebCore::ContentType::parameter const): Use findIgnoringASCIICase.
2175
2176         * platform/MIMETypeRegistry.cpp:
2177         (WebCore::MIMETypeRegistry::isSupportedFontMIMEType): Use
2178         startsWithLettersIgnoringASCIICase.
2179         (WebCore::MIMETypeRegistry::isSupportedJSONMIMEType): Use
2180         mimeType.endsWithIgnoringASCIICase.
2181         (WebCore::MIMETypeRegistry::isTextMIMEType): Use
2182         startsWithLettersIgnoringASCIICase.
2183         (WebCore::MIMETypeRegistry::isXMLMIMEType): Use endsWithIgnoringASCIICase.
2184         (WebCore::MIMETypeRegistry::isJavaAppletMIMEType): Use
2185         startsWithLettersIgnoringASCIICase.
2186         (WebCore::MIMETypeRegistry::canShowMIMEType): Ditto.
2187
2188         * platform/URL.cpp:
2189         (WebCore::isAllASCII): Renamed from containsOnlyASCII.
2190         (WebCore::appendEncodedHostname): Use isAllASCII.
2191
2192         * platform/URLParser.cpp:
2193         (WebCore::containsOnlyASCII): Deleted.
2194         (WebCore::URLParser::domainToASCII): Use StringImpl::isAllASCII. Changed
2195         to take StringImpl& to guarantee we won't keep doing null checks since
2196         the caller already checks for null.
2197         (WebCore::URLParser::parseHostAndPort): Pass StringImpl&.
2198         * platform/URLParser.h: Updated for above.
2199
2200         * platform/graphics/MediaPlayer.cpp:
2201         (WebCore::MediaPlayer::supportsType): Use endsWithIgnoringASCIICase
2202         and startsWithLettersIgnoringASCIICase.
2203
2204         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
2205         (WebCore::validKeySystemRE): Use JSC::Yarr::TextCaseInsensitive.
2206
2207         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2208         (WebCore::FontCache::similarFont): Use containsIgnoringASCIICase for
2209         the Geeza font special cases.
2210
2211         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
2212         (WebCore::shouldRejectMIMEType): Use startsWithLettersIgnoringASCIICase.
2213
2214         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2215         (WebCore::GraphicsContext3D::getUnmangledInfoLog): Removed
2216         TextCaseSensitive since it now is the default.
2217
2218         * platform/mac/PublicSuffixMac.mm:
2219         (WebCore::topPrivatelyControlledDomain): Use isAllASCII.
2220
2221         * platform/mac/SSLKeyGeneratorMac.mm:
2222         (WebCore::signedPublicKeyAndChallengeString): Use isAllASCII.
2223
2224         * platform/mac/StringUtilities.mm:
2225         (WebCore::stringMatchesWildcardString): Use JSC::Yarr::TextCaseInsensitive.
2226
2227         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2228         (WebCore::addStringToSHA1): Use isAllASCII.
2229
2230         * platform/network/CacheValidation.cpp:
2231         (WebCore::parseCacheControlDirectives): Use containsIgnoringASCIICase.
2232
2233         * platform/network/HTTPParsers.cpp:
2234         (WebCore::parseHTTPRefresh): Use findIgnoringASCIICase.
2235         (WebCore::findCharsetInMediaType): Ditto.
2236         (WebCore::parseRange): Use startsWithLettersIgnoringASCIICase.
2237
2238         * platform/network/curl/AuthenticationChallengeCurl.cpp:
2239         (WebCore::AuthenticationChallenge::protectionSpaceFromHandle):
2240         Use findIgnoringASCIICase.
2241         * platform/network/curl/MultipartHandle.cpp:
2242         (WebCore::MultipartHandle::extractBoundary): Ditto.
2243         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
2244         (WebCore::ResourceHandleCurlDelegate::handleDataURL): Use
2245         endsWithIgnoringASCIICase.
2246         * platform/network/curl/ResourceResponseCurl.cpp:
2247         (WebCore::ResourceResponse::isAppendableHeader): Use
2248         startsWithLettersIgnoringASCIICase.
2249         (WebCore::ResourceResponse::appendHTTPHeaderField): Ditto.
2250
2251         * platform/win/ClipboardUtilitiesWin.cpp:
2252         (WebCore::extractMarkupFromCFHTML): Use findIgnoringASCIICase.
2253         (WebCore::fragmentFromCFHTML): Ditto.
2254
2255         * rendering/BidiRun.cpp:
2256         (WebCore::BidiRun::BidiRun): Use text().length().
2257         * rendering/HitTestResult.cpp:
2258         (WebCore::HitTestResult::absolutePDFURL const): Use
2259         endsWithIgnoringASCIICase.
2260         * rendering/InlineFlowBox.cpp:
2261         (WebCore::InlineFlowBox::placeBoxRangeInInlineDirection): Use text().length().
2262         * rendering/InlineIterator.h:
2263         (WebCore::InlineIterator::fastIncrementInTextNode): Ditto.
2264         (WebCore::InlineIterator::increment): Dtto.
2265         * rendering/InlineTextBox.cpp:
2266         (WebCore::InlineTextBox::isLineBreak const): Updated since RenderText::text
2267         now returns a StringImpl&.
2268         (WebCore::InlineTextBox::selectionStartEnd const): Use text().length().
2269         (WebCore::InlineTextBox::text const): Updated since RenderText::text
2270         now returns a StringImpl&.
2271         * rendering/RenderBlock.cpp:
2272         (WebCore::RenderBlock::constructTextRun): Use text().length().
2273         * rendering/RenderBlockFlow.cpp:
2274         (WebCore::isVisibleRenderText): Use isAllSpecialCharacters<isHTMLSpace>().
2275         (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):
2276         Use the new trimmedPreferredWidths that returns a structure instead of the
2277         old one with lots of arguments. Also use text().length().
2278         * rendering/RenderBlockLineLayout.cpp:
2279         (WebCore::endsWithHTMLSpaces): Renamed and changed to use isHTMLSpace
2280         instead of isASCIISpace.
2281         (WebCore::reachedEndOfTextRenderer): Use endsWithHTMLSpaces.
2282         (WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment):
2283         Updated for hcanges to RenderText.
2284         (WebCore::RenderBlockFlow::handleTrailingSpaces): Ditto.
2285         (WebCore::RenderBlockFlow::determineStartPosition): Ditto.
2286
2287         * rendering/RenderCombineText.cpp:
2288         (WebCore::RenderCombineText::combineTextIfNeeded): Use
2289         isAllSpecialCharacters<isHTMLSpace>.
2290         * rendering/RenderLayer.cpp:
2291         (WebCore::RenderLayer::calculateClipRects const): Ditto.
2292
2293         * rendering/RenderListBox.cpp:
2294         (WebCore::bolder): Added. Helper function.
2295         (WebCore::RenderListBox::updateFromElement): Rewrote to
2296         only compute the bolder font once rather than for every item.
2297         (WebCore::RenderListBox::paintItemForeground): Updated for
2298         change to applyTextTransform.
2299
2300         * rendering/RenderMenuList.cpp:
2301         (WebCore::RenderMenuList::adjustInnerStyle): Updated for change
2302         to RenderText::text.
2303         (RenderMenuList::updateOptionsWidth): Updated for change to
2304         applyTextTransform.
2305         (RenderMenuList::itemText const): Ditto.
2306
2307         * rendering/RenderText.cpp:
2308         (WebCore::capitalize): Renamed from makeCapitalized. Changed to
2309         take and return a String instead of taking a String*.
2310         (WebCore::RenderText::RenderText): Use isAllASCII. Also moved
2311         initialization of most non-bitfield members to the class definition.
2312         (WebCore::RenderText::positionForPoint): Use text().
2313         (WebCore::RenderText::widthFromCache const): Ditto.
2314         (WebCore::RenderText::hangablePunctuationStartWidth const): Ditto.
2315         (WebCore::RenderText::hangablePunctuationEndWidth const): Ditto.
2316         (WebCore::RenderText::isHangableStopOrComma): Ditto.
2317         (WebCore::RenderText::firstCharacterIndexStrippingSpaces const): Ditto.
2318         (WebCore::RenderText::lastCharacterIndexStrippingSpaces const): Ditto.
2319         (WebCore::RenderText::trimmedPreferredWidths): Changed to return values
2320         in a structure instead of taking lots of arguments.
2321         (WebCore::RenderText::computePreferredLogicalWidths): Updated to use
2322         the text() function.
2323         (WebCore::isAllCollapsibleWhitespace): Added.
2324         (WebCore::RenderText::isAllCollapsibleWhitespace const): Updated to
2325         use a tighter loop.
2326         (WebCore::isAllPossiblyCollapsibleWhitespace): Added.
2327         (WebCore::RenderText::containsOnlyHTMLWhitespace const): Updated to
2328         use a tighter loop. Renamed from containsOnlyWhitespace.
2329         (WebCore::RenderText::setTextWithOffset): Updated to  use text().
2330         (WebCore::isInlineFlowOrEmptyText): Rewrote to be easier to read.
2331         (WebCore::RenderText::previousCharacter const): Got rid of unneeded
2332         null check and simplified.
2333         (WebCore::applyTextTransform): Changed to return a String rather
2334         than modifying one that is passed in.
2335         (WebCore::RenderText::setRenderedText): Updated use of applyTextTransform.
2336         (WebCore::RenderText::secureText): More of the same.
2337         (WebCore::RenderText::computeCanUseSimplifiedTextMeasuring const): Ditto.
2338         (WebCore::RenderText::textWithoutConvertingBackslashToYenSymbol const): Ditto.
2339         (WebCore::RenderText::width const): Ditto.
2340         (WebCore::RenderText::collectSelectionRectsForLineBoxes): Ditto.
2341         (WebCore::RenderText::previousOffset const): Ditto.
2342         (WebCore::RenderText::previousOffsetForBackwardDeletion const): Ditto.
2343         (WebCore::RenderText::nextOffset const): Ditto.
2344         (WebCore::RenderText::computeCanUseSimpleFontCodePath const): Ditto.
2345         (WebCore::RenderText::stringView const): Ditto.
2346
2347         * rendering/RenderText.h: Made some more members private and final.
2348         Updated for above, including adding the Widths structure. Got rid of the
2349         textLength function, which existed as a workaround before we could mark
2350         a function like length final. Made the text function return a StringImpl&,
2351         which is good since the m_text string is never null, and so callers end
2352         up using StringImpl directly and saving null checks. Removed functions
2353         that are not needed, including is8Bit, characters8, characters16,
2354         uncheckedCharacterAt, operator[], and isAllASCII.
2355
2356         * rendering/RenderTextFragment.cpp:
2357         (WebCore::RenderTextFragment::setText): Use text().length().
2358         * rendering/RenderTextLineBoxes.cpp:
2359         (WebCore::RenderTextLineBoxes::caretMaxOffset const): Ditto.
2360         (WebCore::RenderTextLineBoxes::positionForPoint const): Ditto.
2361         (WebCore::RenderTextLineBoxes::setSelectionState): Ditto.
2362         (WebCore::RenderTextLineBoxes::absoluteQuads const): Ditto.
2363         * rendering/SimpleLineLayout.cpp:
2364         (WebCore::SimpleLineLayout::canUseForFontAndText): Ditto.
2365         * rendering/SimpleLineLayoutCoverage.cpp:
2366         (WebCore::SimpleLineLayout::textLengthForSubtree): Ditto.
2367         (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlows): Ditto.
2368         * rendering/SimpleLineLayoutFlowContents.cpp:
2369         (WebCore::SimpleLineLayout::initializeSegments): Ditto.
2370         * rendering/SimpleLineLayoutFunctions.cpp:
2371         (WebCore::SimpleLineLayout::textOffsetForPoint): Ditto.
2372         * rendering/SimpleLineLayoutFunctions.h:
2373         (WebCore::SimpleLineLayout::findCaretMaximumOffset): Ditto.
2374         * rendering/line/BreakingContext.h:
2375         (WebCore::shouldAddBorderPaddingMargin): Ditto.
2376         (WebCore::shouldSkipWhitespaceAfterStartObject): Ditto.
2377         (WebCore::iteratorIsBeyondEndOfRenderCombineText): Ditto.
2378         (WebCore::textWidth): Ditto.
2379         (WebCore::BreakingContext::handleText): Ditto.
2380         (WebCore::BreakingContext::optimalLineBreakLocationForTrailingWord): Ditto.
2381         * rendering/line/TrailingObjects.cpp:
2382         (WebCore::TrailingObjects::updateWhitespaceCollapsingTransitionsForTrailingBoxes): Ditto.
2383
2384         * rendering/mathml/RenderMathMLFenced.cpp:
2385         (WebCore::RenderMathMLFenced::updateFromElement): Removed stray use of "unsigned int".
2386
2387         * rendering/svg/RenderSVGInlineText.cpp:
2388         (WebCore::RenderSVGInlineText::characterStartsNewTextChunk const): Use text().length().
2389         (WebCore::RenderSVGInlineText::positionForPoint): Ditto.
2390         * rendering/svg/SVGTextLayoutAttributesBuilder.cpp:
2391         (WebCore::processRenderSVGInlineText): Ditto.
2392         * rendering/svg/SVGTextLayoutEngine.cpp:
2393         (WebCore::SVGTextLayoutEngine::currentLogicalCharacterAttributes): Ditto.
2394         * rendering/svg/SVGTextQuery.cpp:
2395         (WebCore::SVGTextQuery::modifyStartEndPositionsRespectingLigatures const): Ditto.
2396
2397         * style/RenderTreeUpdater.cpp:
2398         (WebCore::RenderTreeUpdater::updateRenderTree): Use isAllSpecialCharacters<isHTMLSpace>.
2399         (WebCore::RenderTreeUpdater::textRendererIsNeeded): Ditto.
2400
2401         * svg/SVGTests.cpp:
2402         (WebCore::SVGTests::hasFeatureForLegacyBindings): Use startsWithLettersIgnoringASCIICase.
2403         * xml/parser/XMLDocumentParserLibxml2.cpp:
2404         (WebCore::shouldAllowExternalLoad): Ditto.
2405
2406 2017-11-23  Zan Dobersek  <zdobersek@igalia.com>
2407
2408         [CoordGraphics] Simplify CoordinatedGraphicsLayer's content buffer updates
2409         https://bugs.webkit.org/show_bug.cgi?id=179972
2410
2411         Reviewed by Carlos Garcia Campos.
2412
2413         During layer flushes, when a CoordinatedGraphicsLayer's tiled backing store
2414         has dirty tiles that need to be updated, the following chain of calls would
2415         be invoked to perform the painting, starting in
2416         CoordinatedGraphicsLayer::updateContentBuffers():
2417         |- CoordinatedGraphicsLayer::updateContentBuffers()
2418          |- TiledBackingStore::updateTileBuffers()
2419           |- Tile::updateBackBuffer()
2420            |- CoordinatedGraphicsLayer::paintToSurface()
2421             |- CompositingCoordinator::paintToSurface()
2422              |- UpdateAtlas::paintOnAvailableBuffer()
2423               |- ThreadSafeCoordinatedSurface::paintToSurface()
2424                |- Tile::paintToSurfaceContext()
2425                 |- CoordinatedGraphicsLayer::tiledBackingStorePaint()
2426                  |- GraphicsLayer::paintGraphicsLayerContents()
2427
2428         That's a bit much.
2429
2430         In CoordinatedGraphicsLayer::updateContentBuffers(), we now first retrieve
2431         all the dirty layers in our TiledBackingStore. We then iterate through them,
2432         first establishing their ID and then retrieving an available CoordinatedBuffer
2433         that we can use for painting. The CoordinatedBuffer is retrieved through
2434         CompositingCoordinator, which is still caching these buffers via UpdateAtlas
2435         objects.
2436
2437         With a CoordinatedBuffer available, we can then proceed with painting. The
2438         painting context has to be properly set up to paint into the correct area of
2439         the given buffer, and the alpha channel, if necessary, has to be addressed.
2440         After properly positioning and scaling ourselves on the given context, we
2441         can proceed with the GraphicsLayer::paintGraphicsLayerContents() call.
2442
2443         What's left is filling out the missing SurfaceUpdateInfo information which is
2444         then passed to the updateTile() method that properly registers the tile
2445         update we've just performed. The tile itself is marked clean. After the
2446         iteration, we call the didUpdateTileBuffers() method in case any successful
2447         tile update was indeed performed, incrementing the repaint counter.
2448
2449         That's it -- we clipped 8 calls from the call chain. We can now also remove
2450         the CoordinatedBuffer::Client interface, as well as slim down the
2451         TiledBackingStore interface. The Tile class is cleaned up a bit, with methods
2452         shifted into a more sensible order.
2453
2454         No new tests -- no change in functionality.
2455
2456         * platform/graphics/texmap/coordinated/CoordinatedBuffer.cpp:
2457         * platform/graphics/texmap/coordinated/CoordinatedBuffer.h:
2458         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2459         (WebCore::CoordinatedGraphicsLayer::didUpdateTileBuffers):
2460         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
2461         (WebCore::CoordinatedGraphicsLayer::tiledBackingStorePaint): Deleted.
2462         (WebCore::CoordinatedGraphicsLayer::paintToSurface): Deleted.
2463         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2464         * platform/graphics/texmap/coordinated/Tile.cpp:
2465         (WebCore::Tile::ensureTileID):
2466         (WebCore::Tile::isDirty const):
2467         (WebCore::Tile::invalidate):
2468         (WebCore::Tile::markClean):
2469         (WebCore::Tile::updateBackBuffer): Deleted.
2470         (WebCore::Tile::paintToSurfaceContext): Deleted.
2471         * platform/graphics/texmap/coordinated/Tile.h:
2472         (WebCore::Tile::tileID const):
2473         (WebCore::Tile::dirtyRect const):
2474         * platform/graphics/texmap/coordinated/TiledBackingStore.cpp:
2475         (WebCore::TiledBackingStore::dirtyTiles):
2476         (WebCore::TiledBackingStore::updateTileBuffers): Deleted.
2477         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
2478         * platform/graphics/texmap/coordinated/TiledBackingStoreClient.h:
2479
2480 2017-11-23  Zan Dobersek  <zdobersek@igalia.com>
2481
2482         [CoordGraphics] Remove relay CoordinatedBuffer::Client implementations
2483         https://bugs.webkit.org/show_bug.cgi?id=179970
2484
2485         Reviewed by Carlos Garcia Campos.
2486
2487         Drop CoordinatedBuffer::painToSurface() in favor of a simpler
2488         GraphicsContext reference getter that returns a reference to the
2489         GraphicsContext object of the internal ImageBuffer.
2490
2491         Remove the ImageBackingSurfaceClient class that only acted as a relay
2492         that enabled a CoordinatedBuffer to draw an image through its context.
2493         Instead, we use the GraphicsContext of the allocated CoordinatedBuffer
2494         to draw the image directly. We still use a rectangle whose size
2495         matches the size of the given Image as the clipping area and as the
2496         source and destination rectangle for the image.
2497
2498         No new tests -- no change in behavior.
2499
2500         * platform/graphics/texmap/coordinated/CoordinatedBuffer.cpp:
2501         (WebCore::CoordinatedBuffer::context):
2502         (WebCore::CoordinatedBuffer::paintToSurface): Deleted.
2503         * platform/graphics/texmap/coordinated/CoordinatedBuffer.h:
2504         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
2505         (WebCore::CoordinatedImageBacking::update):
2506         (WebCore::ImageBackingSurfaceClient::ImageBackingSurfaceClient): Deleted.
2507
2508 2017-11-23  Zan Dobersek  <zdobersek@igalia.com>
2509
2510         [CoordGraphics] TiledBackingStore: use a reference to the client
2511         https://bugs.webkit.org/show_bug.cgi?id=179969
2512
2513         Reviewed by Carlos Garcia Campos.
2514
2515         TiledBackingStore should keep a C++ reference to the TiledBackingStoreClient
2516         object, and not a pointer. client() method is updated to reflect that, and
2517         uses of this method and the member variable are updated accordingly.
2518
2519         No new tests -- no change in behavior.
2520
2521         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2522         (WebCore::CoordinatedGraphicsLayer::createBackingStore):
2523         * platform/graphics/texmap/coordinated/Tile.cpp:
2524         (WebCore::Tile::~Tile):
2525         (WebCore::Tile::updateBackBuffer):
2526         (WebCore::Tile::paintToSurfaceContext):
2527         * platform/graphics/texmap/coordinated/TiledBackingStore.cpp:
2528         (WebCore::TiledBackingStore::TiledBackingStore):
2529         (WebCore::TiledBackingStore::updateTileBuffers):
2530         (WebCore::TiledBackingStore::createTiles):
2531         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
2532         (WebCore::TiledBackingStore::client):
2533
2534 2017-11-23  Zan Dobersek  <zdobersek@igalia.com>
2535
2536         [CoordGraphics] Early tile buffer update in TiledBackingStore::createTiles() is unnecessary
2537         https://bugs.webkit.org/show_bug.cgi?id=179968
2538
2539         Reviewed by Carlos Garcia Campos.
2540
2541         Under CoordinatedGraphicsLayer::updateContentBuffers(), the TiledBackingStore
2542         object has the createTilesIfNeeded() method invoked, if necessary. This
2543         invokes createTiles(), where the edge tiles are resized if necessary, and
2544         the missing tiles are created. If any of those two cases is fulfilled, the
2545         updateTileBuffers() method is invoked, updating any dirty tiles (i.e. the
2546         ones that were resized or newly-created).
2547
2548         This specific invocation of updateTileBuffers() is not needed since it's the
2549         very next method that's invoked on the TiledBackingStore object by
2550         CoordinatedGraphicsLayer::updateContentBuffers(). It's therefore removed,
2551         and the resizeEdgeTiles() method is changed to not return any value.
2552
2553         No new tests -- no change in behavior.
2554
2555         * platform/graphics/texmap/coordinated/TiledBackingStore.cpp:
2556         (WebCore::TiledBackingStore::createTiles):
2557         (WebCore::TiledBackingStore::resizeEdgeTiles):
2558         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
2559
2560 2017-11-23  Antti Koivisto  <antti@apple.com>
2561
2562         RenderBlockFlow::layoutRunsAndFloatsInRange is O(n^2) for runs of inlines without any text
2563         https://bugs.webkit.org/show_bug.cgi?id=179950
2564
2565         Reviewed by Simon Fraser.
2566
2567         It calls createBidiRunsForLine for each line. createBidiRunsForLine traverses past the end of the line until
2568         it finds the end of the current bidi run. If there is no text in the flow, it never finds anything and traverses
2569         the entire flow. This is O(n^2) for the number of renderers in the flow.
2570
2571         Tested by PerformanceTests/Layout/inline-layout-no-text.html
2572
2573         * platform/text/BidiResolver.h:
2574         (WebCore::BidiResolverBase::needsContinuePastEnd const):
2575         (WebCore::BidiResolverBase::needsContinuePastEndInternal const):
2576         (WebCore::DerivedClass>::createBidiRunsForLine):
2577
2578             When past end of line call needsContinuePastEnd() to see if we need to continue searching for the end of the bidi run.
2579
2580         * rendering/InlineIterator.h:
2581         (WebCore::InlineBidiResolver::needsContinuePastEndInternal const):
2582
2583             InlineBidiResolver only returns runs up to the last renderer on the line and can bail out.
2584
2585 2017-11-23  Zan Dobersek  <zdobersek@igalia.com>
2586
2587         [CoordGraphics] Replace CoordinatedSurface, ThreadSafeCoordinatedSurface with CoordinatedBuffer
2588         https://bugs.webkit.org/show_bug.cgi?id=179967
2589
2590         Reviewed by Carlos Garcia Campos.
2591
2592         Roll the CoordinatedSurface and ThreadSafeCoordinatedSurface classes
2593         into one CoordinatedBuffer class.
2594
2595         CoordinatedBuffer class mimics CoordinatedSurface in providing the
2596         Client class that allows specifying how the client should paint using a
2597         GraphicsContext object. supportsAlpha() and size() methods are also
2598         present, as well as paintToSurface(). uploadImage() retrieves the
2599         Image that's created from the contained ImageBuffer, allowing the user
2600         to then manually upload the buffer data onto the GPU.
2601
2602         CoordinatedBuffer otherwise serves as a drop-in replacement for the
2603         CoordinatedSurface class, and the remaining changes in the
2604         CoordiantedGraphics code reflect that.
2605
2606         No new tests -- no change in behavior.
2607
2608         * platform/TextureMapper.cmake:
2609         * platform/graphics/texmap/coordinated/CoordinatedBuffer.cpp: Added.
2610         (WebCore::CoordinatedBuffer::create):
2611         (WebCore::CoordinatedBuffer::CoordinatedBuffer):
2612         (WebCore::CoordinatedBuffer::paintToSurface):
2613         (WebCore::CoordinatedBuffer::uploadImage):
2614         * platform/graphics/texmap/coordinated/CoordinatedBuffer.h: Added.
2615         (WebCore::CoordinatedBuffer::supportsAlpha const):
2616         (WebCore::CoordinatedBuffer::size const):
2617         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2618         (WebCore::CoordinatedGraphicsLayer::paintToSurface):
2619         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2620         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
2621         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
2622         (WebCore::CoordinatedImageBacking::update):
2623         (WebCore::CoordinatedImageBacking::releaseSurfaceIfNeeded):
2624         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.h:
2625         * platform/graphics/texmap/coordinated/CoordinatedSurface.cpp: Removed.
2626         * platform/graphics/texmap/coordinated/CoordinatedSurface.h: Removed.
2627         * platform/graphics/texmap/coordinated/Tile.h:
2628         * platform/graphics/texmap/coordinated/TiledBackingStoreClient.h:
2629
2630 2017-11-22  Simon Fraser  <simon.fraser@apple.com>
2631
2632         FEComponentTransfer cleanup and optimization
2633         https://bugs.webkit.org/show_bug.cgi?id=179952
2634
2635         Reviewed by Darin Adler.
2636
2637         Change terminology for FEComponentTransfer to be more explicit about the fact
2638         that it's creating and using lookup tables. Use std::array for the lookup tables.
2639         
2640         Use uint8_t instead of unsigned char.
2641         
2642         Avoid confusing arrays for channels in computeLookupTables; just setup the lut for
2643         each channel manually.
2644         
2645         This is about 1.25x faster than before.
2646
2647         * platform/graphics/filters/FEComponentTransfer.cpp:
2648         (WebCore::FEComponentTransfer::computeIdentityTable):
2649         (WebCore::FEComponentTransfer::computeTabularTable):
2650         (WebCore::FEComponentTransfer::computeDiscreteTable):
2651         (WebCore::FEComponentTransfer::computeLinearTable):
2652         (WebCore::FEComponentTransfer::computeGammaTable):
2653         (WebCore::FEComponentTransfer::platformApplySoftware):
2654         (WebCore::FEComponentTransfer::computeLookupTables):
2655         (WebCore::operator<<):
2656         (WebCore::identity): Deleted.
2657         (WebCore::table): Deleted.
2658         (WebCore::discrete): Deleted.
2659         (WebCore::linear): Deleted.
2660         (WebCore::gamma): Deleted.
2661         (WebCore::FEComponentTransfer::getValues): Deleted.
2662         * platform/graphics/filters/FEComponentTransfer.h:
2663         (WebCore::ComponentTransferFunction::ComponentTransferFunction): Deleted.
2664
2665 2017-11-22  Javier Fernandez  <jfernandez@igalia.com>
2666
2667         [css-grid] Refactoring and new namespace with grid related utility functions
2668         https://bugs.webkit.org/show_bug.cgi?id=179633
2669
2670         Reviewed by Darin Adler.
2671
2672         Added a new namespace with several utility functions to share logic
2673         between RenderGrid and GridTrackSizingAlgorithm.
2674
2675         No new tests, since no new functionality is added.
2676
2677         * Sources.txt:
2678         * WebCore.xcodeproj/project.pbxproj:
2679         * rendering/GridLayoutUtils.cpp: Added.
2680         (WebCore::GridLayoutUtils::computeMarginLogicalSizeForChild):
2681         (WebCore::GridLayoutUtils::marginLogicalSizeForChild):
2682         (WebCore::GridLayoutUtils::isOrthogonalChild):
2683         (WebCore::GridLayoutUtils::flowAwareDirectionForChild):
2684         * rendering/GridLayoutUtils.h: Added.
2685         * rendering/GridTrackSizingAlgorithm.cpp:
2686         (WebCore::GridTrackSizingAlgorithm::assumedRowsSizeForOrthogonalChild const):
2687         (WebCore::GridTrackSizingAlgorithmStrategy::logicalHeightForChild const):
2688         (WebCore::GridTrackSizingAlgorithmStrategy::minContentForChild const):
2689         (WebCore::GridTrackSizingAlgorithmStrategy::maxContentForChild const):
2690         (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild const):
2691         (WebCore::DefiniteSizeStrategy::minLogicalWidthForChild const):
2692         * rendering/RenderGrid.cpp:
2693         (WebCore::RenderGrid::layoutBlock):
2694         (WebCore::RenderGrid::placeItemsOnGrid const):
2695         (WebCore::RenderGrid::layoutPositionedObject):
2696         (WebCore::RenderGrid::availableAlignmentSpaceForChildBeforeStretching const):
2697         (WebCore::RenderGrid::applyStretchAlignmentToChildIfNeeded):
2698         (WebCore::RenderGrid::isInlineBaselineAlignedChild const):
2699         (WebCore::RenderGrid::firstLineBaseline const):
2700         (WebCore::RenderGrid::columnAxisPositionForChild const):
2701         (WebCore::RenderGrid::rowAxisPositionForChild const):
2702         (WebCore::RenderGrid::columnAxisOffsetForChild const):
2703         (WebCore::RenderGrid::rowAxisOffsetForChild const):
2704         (WebCore::RenderGrid::findChildLogicalPosition const):
2705
2706 2017-11-22  Ali Juma  <ajuma@chromium.org>
2707
2708         Implement VisualViewport API attributes
2709         https://bugs.webkit.org/show_bug.cgi?id=179385
2710
2711         Reviewed by Frédéric Wang.
2712
2713         Add a visualViewport attribute to Window, and implement the VisualViewport
2714         interface (https://wicg.github.io/visual-viewport/#the-visualviewport-interface).
2715
2716         This is behind a newly-added VisualViewportAPI experimental feature flag.
2717
2718         Tests: fast/visual-viewport/viewport-dimensions-exclude-custom-scrollbars.html
2719                fast/visual-viewport/viewport-dimensions-exclude-scrollbars.html
2720                fast/visual-viewport/viewport-dimensions-iframe.html
2721                fast/visual-viewport/viewport-dimensions-under-page-zoom.html
2722                fast/visual-viewport/viewport-dimensions.html
2723
2724         * CMakeLists.txt:
2725         * DerivedSources.cpp:
2726         * DerivedSources.make:
2727         * Sources.txt:
2728         * WebCore.xcodeproj/project.pbxproj:
2729         * bindings/js/WebCoreBuiltinNames.h:
2730         * dom/EventTargetFactory.in:
2731         * page/DOMWindow.cpp:
2732         (WebCore::DOMWindow::~DOMWindow):
2733         (WebCore::DOMWindow::resetDOMWindowProperties):
2734         (WebCore::DOMWindow::visualViewport const):
2735         * page/DOMWindow.h:
2736         * page/DOMWindow.idl:
2737         * page/Settings.yaml:
2738         * page/VisualViewport.cpp: Added.
2739         (WebCore::VisualViewport::VisualViewport):
2740         (WebCore::VisualViewport::eventTargetInterface const):
2741         (WebCore::VisualViewport::scriptExecutionContext const):
2742         (WebCore::getFrameViewAndLayoutIfNonNull):
2743         (WebCore::VisualViewport::offsetLeft const):
2744         (WebCore::VisualViewport::offsetTop const):
2745         (WebCore::VisualViewport::pageLeft const):
2746         (WebCore::VisualViewport::pageTop const):
2747         (WebCore::VisualViewport::width const):
2748         (WebCore::VisualViewport::height const):
2749         (WebCore::VisualViewport::scale const):
2750         * page/VisualViewport.h: Added.
2751         * page/VisualViewport.idl: Added.
2752
2753 2017-11-22  Manuel Rego Casasnovas  <rego@igalia.com>
2754
2755         Available height is wrong for positioned elements with "box-sizing: border-box"
2756         https://bugs.webkit.org/show_bug.cgi?id=178783
2757
2758         Reviewed by Darin Adler.
2759
2760         These methods were returning a wrong value for positioned items
2761         in combination with "box-sizing: border-box".
2762         The problem was that if the height of the element is given
2763         by its offset properties (top and bottom) we don't need to call
2764         adjustContentBoxLogicalHeightForBoxSizing().
2765
2766         Tests: fast/box-sizing/fill-available.html
2767                fast/box-sizing/replaced.html
2768
2769         * rendering/RenderBox.cpp:
2770         (WebCore::RenderBox::computeReplacedLogicalHeightUsing const):
2771         (WebCore::RenderBox::availableLogicalHeightUsing const):
2772
2773 2017-11-22  Christopher Reid  <chris.reid@sony.com>
2774
2775         WebCoreObjCExtras.h is being included in too many places
2776         https://bugs.webkit.org/show_bug.cgi?id=179931
2777
2778         Reviewed by Darin Adler.
2779
2780         No new tests no change in behavior.
2781
2782         Fixing cases where WebCoreObjCExtras.h is imported but not used.
2783
2784         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
2785         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2786         * platform/mac/WebCoreNSURLExtras.mm:
2787
2788 2017-11-22  Antoine Quint  <graouts@apple.com>
2789
2790         [Web Animations] Adopt KeyframeList in KeyframeEffect
2791         https://bugs.webkit.org/show_bug.cgi?id=179941
2792         <rdar://problem/35666924>
2793
2794         Reviewed by Darin Adler.
2795
2796         KeyframeEffect used to model its keyframes by creating a new Keyframe struct and storing them in a Vector<Keyframe>.
2797         However, there already is a way to model keyframes in WebCore using the KeyframeList class. We now adopt this class
2798         in KeyframeEffect, which makes it possible to run hardware-composited animations using RenderBoxModelObject::startAnimation()
2799         in a follow-up patch, since this function expects a KeyframeList.
2800
2801         No news tests, this is an internals change and does not yield any changes in Web content.
2802
2803         * animation/KeyframeEffect.cpp:
2804         (WebCore::KeyframeEffect::KeyframeEffect): Create a default m_keyframes at construction time.
2805         (WebCore::KeyframeEffect::processKeyframes): Create a temporary KeyframeList as we parse keyframes passed from the JS API
2806         and assign it to m_keyframes upon successful parsing. We also use cssPropertyId to refer to a CSSPropertyID to make the code
2807         clearer and ensure there is no confusion with JS properties that we manipulate in this function.
2808         (WebCore::KeyframeEffect::computeStackingContextImpact): Use the list of CSS properties exposed on KeyframeList directly rather
2809         than enumerating each keyframe and use cssPropertyId to refer to individual CSSPropertyID values for consistency.
2810         (WebCore::KeyframeEffect::applyAtLocalTime): Use the list of CSS properties exposed on KeyframeList directly rather than
2811         using the properties specified on the first keyframe only. We also remove a stale FIXME comment which was addressed in r224957.
2812         * animation/KeyframeEffect.h: Remove the Keyframe struct and change the type of m_keyframes from Vector<Keyframe> to KeyframeList.
2813         * rendering/style/KeyframeList.h:
2814         (WebCore::KeyframeList::KeyframeList): We remove the default insertions at KeyframeList construction time since it requires
2815         an immediate call to clear() when doing any meaningful work with a KeyframeList. We also add the default move assignment operator
2816         to allow KeyframeEffect::processKeyframes() to make a move assignment from the temporary keyframe list we build at parsing to the
2817         member variable.
2818
2819 2017-11-22  Commit Queue  <commit-queue@webkit.org>
2820
2821         Unreviewed, rolling out r225093.
2822         https://bugs.webkit.org/show_bug.cgi?id=179938
2823
2824         Compilation failed on WinCairo 64-bit Release (Requested by
2825         fredw on #webkit).
2826
2827         Reverted changeset:
2828
2829         "Implement VisualViewport API attributes"
2830         https://bugs.webkit.org/show_bug.cgi?id=179385
2831         https://trac.webkit.org/changeset/225093
2832
2833 2017-11-21  Ali Juma  <ajuma@chromium.org>
2834
2835         Implement VisualViewport API attributes
2836         https://bugs.webkit.org/show_bug.cgi?id=179385
2837
2838         Reviewed by Frédéric Wang.
2839
2840         Add a visualViewport attribute to Window, and implement the VisualViewport
2841         interface (https://wicg.github.io/visual-viewport/#the-visualviewport-interface).
2842
2843         This is behind a newly-added VisualViewportAPI experimental feature flag.
2844
2845         Tests: fast/visual-viewport/viewport-dimensions-exclude-custom-scrollbars.html
2846                fast/visual-viewport/viewport-dimensions-exclude-scrollbars.html
2847                fast/visual-viewport/viewport-dimensions-iframe.html
2848                fast/visual-viewport/viewport-dimensions-under-page-zoom.html
2849                fast/visual-viewport/viewport-dimensions.html
2850
2851         * CMakeLists.txt:
2852         * DerivedSources.cpp:
2853         * DerivedSources.make:
2854         * Sources.txt:
2855         * WebCore.xcodeproj/project.pbxproj:
2856         * bindings/js/WebCoreBuiltinNames.h:
2857         * dom/EventTargetFactory.in:
2858         * page/DOMWindow.cpp:
2859         (WebCore::DOMWindow::~DOMWindow):
2860         (WebCore::DOMWindow::resetDOMWindowProperties):
2861         (WebCore::DOMWindow::visualViewport const):
2862         * page/DOMWindow.h:
2863         * page/DOMWindow.idl:
2864         * page/Settings.yaml:
2865         * page/VisualViewport.cpp: Added.
2866         (WebCore::VisualViewport::VisualViewport):
2867         (WebCore::VisualViewport::eventTargetInterface const):
2868         (WebCore::VisualViewport::scriptExecutionContext const):
2869         (WebCore::getFrameViewAndLayoutIfNonNull):
2870         (WebCore::VisualViewport::offsetLeft const):
2871         (WebCore::VisualViewport::offsetTop const):
2872         (WebCore::VisualViewport::pageLeft const):
2873         (WebCore::VisualViewport::pageTop const):
2874         (WebCore::VisualViewport::width const):
2875         (WebCore::VisualViewport::height const):
2876         (WebCore::VisualViewport::scale const):
2877         * page/VisualViewport.h: Added.
2878         * page/VisualViewport.idl: Added.
2879
2880 2017-11-21  Frederic Wang  <fwang@igalia.com>
2881
2882         Async frame scrolling: handle fixed root backgrounds in frames
2883         https://bugs.webkit.org/show_bug.cgi?id=176261
2884
2885         Based on patch by Simon Fraser <simon.fraser@apple.com>
2886         Reviewed by Antonio Gomes.
2887
2888         For frames with tiled backing, we register a slow-repaint object because we hit
2889         RenderElement::styleWillChange() before we've made a backing for the iframe's RenderView so
2890         view().compositor().supportsFixedRootBackgroundCompositing() returns false. This patch
2891         ensures that this object is removed when setBackgroundLayerPaintsFixedRootBackground is
2892         called. It also removes the opaque background of non-main frames with tiled backing.
2893         This fixes a possible hit of ASSERT(!m_backgroundLayer) after r221615.
2894
2895         Test: compositing/tiling/tiled-drawing-async-frame-scrolling.html
2896
2897         * rendering/RenderLayerBacking.cpp:
2898         (WebCore::RenderLayerBacking::updateGeometry): Do not set opaque contents for frames with
2899         tiled backing. We keep !m_isMainFrameRenderViewLayer for backward compatibility with WK1.
2900         (WebCore::RenderLayerBacking::setBackgroundLayerPaintsFixedRootBackground): Add an early
2901         return when m_backgroundLayerPaintsFixedRootBackground is not changed. Remove the slow
2902         repaint object previously registered for this frame. Also add an ASSERT to ensure that a
2903         fixed root background is only set for frames with async scrolling.
2904         (WebCore::RenderLayerBacking::updateRootLayerConfiguration): Restrict some special handling
2905         of background and opaqueness to the main frame.
2906
2907 2017-11-21  Zan Dobersek  <zdobersek@igalia.com>
2908
2909         Drop ENABLE_IMAGE_DECODER_DOWN_SAMPLING code
2910         https://bugs.webkit.org/show_bug.cgi?id=179921
2911
2912         Reviewed by Carlos Garcia Campos.
2913
2914         Drop the ENABLE_IMAGE_DECODER_DOWN_SAMPLING code, along with the build
2915         guard definitions in WTF and CMake.
2916
2917         This was apparently in use in the Qt port, but since then no port
2918         enables this. It's not exposed in the Xcode build, and the CMake option
2919         is disabled by default, with no way to enable it through build-webkit.
2920
2921         While the code guarded with this build guard is removed, there's still
2922         code in the ScalableImageDecoder class that only operated when this
2923         feature was enabled. This should be addressed in the future, after
2924         evaluating the need for this scaling capability.
2925
2926         No new tests -- no change in behavior.
2927
2928         * platform/graphics/Image.cpp:
2929         (WebCore::Image::adjustSourceRectForDownSampling const): Deleted.
2930         * platform/graphics/Image.h:
2931         * platform/graphics/cairo/CairoOperations.cpp:
2932         (WebCore::Cairo::drawNativeImage):
2933         * platform/image-decoders/ScalableImageDecoder.h:
2934         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
2935         (WebCore::JPEGImageReader::decode):
2936         * platform/image-decoders/png/PNGImageDecoder.cpp:
2937         (WebCore::PNGImageDecoder::rowAvailable):
2938         (WebCore::PNGImageDecoder::frameComplete):
2939
2940 2017-11-21  Commit Queue  <commit-queue@webkit.org>
2941
2942         Unreviewed, rolling out r225089.
2943         https://bugs.webkit.org/show_bug.cgi?id=179937
2944
2945         This patch caused compilation failures (Requested by fredw on
2946         #webkit).
2947
2948         Reverted changeset:
2949
2950         "Async frame scrolling: handle fixed root backgrounds in
2951         frames"
2952         https://bugs.webkit.org/show_bug.cgi?id=176261
2953         https://trac.webkit.org/changeset/225089
2954
2955 2017-11-21  Frederic Wang  <fwang@igalia.com>
2956
2957         Async frame scrolling: handle fixed root backgrounds in frames
2958         https://bugs.webkit.org/show_bug.cgi?id=176261
2959
2960         Based on patch by Simon Fraser <simon.fraser@apple.com>
2961         Reviewed by Antonio Gomes.
2962
2963         For frames with tiled backing, we register a slow-repaint object because we hit
2964         RenderElement::styleWillChange() before we've made a backing for the iframe's RenderView so
2965         view().compositor().supportsFixedRootBackgroundCompositing() returns false. This patch
2966         ensures that this object is removed when setBackgroundLayerPaintsFixedRootBackground is
2967         called. It also removes the opaque background of non-main frames with tiled backing.
2968         This fixes a possible hit of ASSERT(!m_backgroundLayer) after r221615.
2969
2970         Test: compositing/tiling/tiled-drawing-async-frame-scrolling.html
2971
2972         * rendering/RenderLayerBacking.cpp:
2973         (WebCore::RenderLayerBacking::updateGeometry): Do not set opaque contents for frames with
2974         tiled backing. We keep !m_isMainFrameRenderViewLayer for backward compatibility with WK1.
2975         (WebCore::RenderLayerBacking::setBackgroundLayerPaintsFixedRootBackground): Add an early
2976         return when m_backgroundLayerPaintsFixedRootBackground is not changed. Remove the slow
2977         repaint object previously registered for this frame. Also add an ASSERT to ensure that a
2978         fixed root background is only set for frames with async scrolling.
2979         (WebCore::RenderLayerBacking::updateRootLayerConfiguration): Restrict some special handling
2980         of background and opaqueness to the main frame.
2981
2982 2017-11-21  Simon Fraser  <simon.fraser@apple.com>
2983
2984         Some FELighting cleanup
2985         https://bugs.webkit.org/show_bug.cgi?id=179924
2986
2987         Reviewed by Sam Weinig.
2988
2989         Make the normal-computation functions const and have them return an IntSize.
2990         Replace bit shifting with multiply by two (compilers know how to do this, folks).
2991
2992         * platform/graphics/filters/FELighting.cpp:
2993         (WebCore::FELighting::LightingData::topLeftNormal const):
2994         (WebCore::FELighting::LightingData::topRowNormal const):
2995         (WebCore::FELighting::LightingData::topRightNormal const):
2996         (WebCore::FELighting::LightingData::leftColumnNormal const):
2997         (WebCore::FELighting::LightingData::interiorNormal const):
2998         (WebCore::FELighting::LightingData::rightColumnNormal const):
2999         (WebCore::FELighting::LightingData::bottomLeftNormal const):
3000         (WebCore::FELighting::LightingData::bottomRowNormal const):
3001         (WebCore::FELighting::LightingData::bottomRightNormal const):
3002         (WebCore::FELighting::inlineSetPixel):
3003         (WebCore::FELighting::setPixel):
3004         (WebCore::FELighting::platformApplyGenericPaint):
3005         (WebCore::FELighting::drawLighting):
3006         (WebCore::FELighting::LightingData::topLeft): Deleted.
3007         (WebCore::FELighting::LightingData::topRow): Deleted.
3008         (WebCore::FELighting::LightingData::topRight): Deleted.
3009         (WebCore::FELighting::LightingData::leftColumn): Deleted.
3010         (WebCore::FELighting::LightingData::interior): Deleted.
3011         (WebCore::FELighting::LightingData::rightColumn): Deleted.
3012         (WebCore::FELighting::LightingData::bottomLeft): Deleted.
3013         (WebCore::FELighting::LightingData::bottomRow): Deleted.
3014         (WebCore::FELighting::LightingData::bottomRight): Deleted.
3015         * platform/graphics/filters/FELighting.h:
3016
3017 2017-11-21  Christopher Reid  <chris.reid@sony.com>
3018
3019         [PAL] Remove FileSystem's dependency on WebCoreNSStringExtras
3020         https://bugs.webkit.org/show_bug.cgi?id=179504
3021
3022         Reviewed by Darin Adler.
3023
3024         No new tests no change in behavior.
3025
3026         Removed WebCoreNSStringExtras.
3027         Replaced calls to string helpers in WebCoreNSStringExtras with calls to WTF::String.
3028         Moved filenameByFixingIllegalCharacters into LoaderNSURLExtras.
3029         Moved preferredBundleLocalizationName into WebKitLegacy.
3030
3031         * PlatformMac.cmake: Removed WebCoreNSStringExtras.mm
3032         * SourcesCocoa.txt: Removed WebCoreNSStringExtras.mm
3033         * WebCore.xcodeproj/project.pbxproj: Removed WebCoreNSStringExtras
3034         * loader/mac/LoaderNSURLExtras.h:
3035         * loader/mac/LoaderNSURLExtras.mm:
3036         * platform/graphics/mac/FontCacheMac.mm:
3037         * platform/mac/PasteboardMac.mm:
3038         * platform/mac/WebCoreNSURLExtras.mm:
3039
3040 2017-11-21  Simon Fraser  <simon.fraser@apple.com>
3041
3042         Use vImage to do alpha premultiplication/unpremultiplication in FilterEffect
3043         https://bugs.webkit.org/show_bug.cgi?id=179928
3044
3045         Reviewed by Tim Horton.
3046
3047         The vImage functions are about twice as fast as the existing code.
3048
3049         * platform/graphics/filters/FilterEffect.cpp:
3050         (WebCore::copyPremultiplyingAlpha):
3051         (WebCore::copyUnpremultiplyingAlpha):
3052         (WebCore::FilterEffect::copyUnmultipliedImage):
3053         (WebCore::FilterEffect::copyPremultipliedImage):
3054
3055 2017-11-21  Carlos Garcia Campos  <cgarcia@igalia.com>
3056
3057         [GLIB] Test FileMonitorTest.DetectChangeAndThenDelete sometimes crashes
3058         https://bugs.webkit.org/show_bug.cgi?id=179909
3059
3060         Reviewed by Michael Catanzaro.
3061
3062         The problem sems to be that the GFileMonitor is created in the main thread, but destroyed in the WorkQueue
3063         thread. We can create the monitor in the WorkQueue thread and do the monitoring there.
3064
3065         Fixes unit test FileMonitorTest.DetectChangeAndThenDelete.
3066
3067         * platform/glib/FileMonitorGLib.cpp:
3068         (WebCore::FileMonitor::FileMonitor): Create the GFileMonitor in the WorkQueue.
3069         (WebCore::FileMonitor::didChange): No need to dispatch the handler in the WorkQueue, since this is now called in
3070         the WorkQueue.
3071
3072 2017-11-21  Zan Dobersek  <zdobersek@igalia.com>
3073
3074         [Cairo] drawNativeImage(), drawPattern() in CairoOperations should operate directly with cairo_surface_t objects
3075         https://bugs.webkit.org/show_bug.cgi?id=179888
3076
3077         Reviewed by Carlos Garcia Campos.
3078
3079         Cairo::drawNativeImage() should receive a valid cairo_surface_t pointer
3080         and work with that, instead of using a NativeImagePtr. Callers are thus
3081         forced to pass the pointer into the drawNativeImage() call, and the
3082         CairoOperations implementation file drops the need to know about the
3083         NativeImagePtr type alias.
3084
3085         Cairo::drawPattern() now accepts pointer to the cairo_surface_t object,
3086         along with an IntSize object that descibes the surface's size. This way
3087         it's up to the caller to retrieve any valid native image for the current
3088         frame and pass that to the drawPattern() call. The need to use IntSize
3089         here is strange, but we should investigate this later.
3090
3091         No new tests -- no change in behavior.
3092
3093         * platform/graphics/cairo/CairoOperations.cpp:
3094         (WebCore::Cairo::drawNativeImage):
3095         (WebCore::Cairo::drawPattern):
3096         * platform/graphics/cairo/CairoOperations.h: Include the Cairo header.
3097         Also fix forward declaration of Cairo::drawGlyphs().
3098         * platform/graphics/cairo/GraphicsContextCairo.cpp:
3099         (WebCore::GraphicsContext::drawNativeImage):
3100         (WebCore::GraphicsContext::drawPattern):
3101         * platform/graphics/cairo/NativeImageCairo.cpp:
3102         (WebCore::drawNativeImage): Execute operation through GraphicsContext,
3103         kicking into effect any recording that could be done this way.
3104
3105 2017-11-21  Zan Dobersek  <zdobersek@igalia.com>
3106
3107         [Cairo] Gradient::fill() should only operate on PlatformContextCairo
3108         https://bugs.webkit.org/show_bug.cgi?id=179887
3109
3110         Reviewed by Carlos Garcia Campos.
3111
3112         In Gradient::fill(), directly invoke Cairo::save() and Cairo::restore(),
3113         instead of doing so indirectly through GraphicsContext::save() and
3114         GraphicsContext::restore(). The latter pair stashes the internal state
3115         that's managed in GraphicsContext, but that doesn't get modified at all
3116         in this case.
3117
3118         No new tests -- no change in behavior.
3119
3120         * platform/graphics/cairo/GradientCairo.cpp:
3121         (WebCore::Gradient::fill):
3122
3123 2017-11-21  Frederic Wang  <fwang@igalia.com>
3124
3125         Remove unintentionally committed .orig file.
3126         https://bugs.webkit.org/show_bug.cgi?id=174131
3127
3128         Unreviewed, fix previous commit.
3129
3130         * rendering/mathml/RenderMathMLScripts.cpp.orig: Removed.
3131
3132 2017-11-21  Frederic Wang  <fwang@igalia.com>
3133
3134         ASSERTION FAILED: !needsLayout() in WebCore::RenderMathMLScripts::firstLineBaseline
3135         https://bugs.webkit.org/show_bug.cgi?id=174131
3136
3137         Reviewed by Alejandro G. Castro.
3138
3139         RenderMathMLScripts::firstLineBaseline() has an ASSERT at the beginning to ensure that the function
3140         is called after the element was laid out. However, this is not respected by HTML table layout as
3141         RenderBlock::firstLineBaseline() is called for elements in a table cell before they are laid out.
3142         This happens for example for RenderGrid::firstLineBaseline() and probably for other renderers.
3143         Additionally, RenderMathMLScripts::firstLineBaseline() only involves calling firstLineBaseline();
3144         logicalTop() or logicalHeight() on the first child box so it is safe to call it before layout, even
3145         if the return value might be wrong at that time. This patch removes this too restrictive ASSERT for
3146         RenderMathMLScripts, for consistency with other implementations of firstLineBaseline().
3147
3148         Test: mathml/cells-and-scripts-crash.html
3149
3150         * rendering/mathml/RenderMathMLScripts.cpp:
3151         (WebCore::RenderMathMLScripts::firstLineBaseline const): Remove the ASSERT.
3152
3153 2017-11-20  Mario Sanchez Prada  <mario@endlessm.com>
3154
3155         [GTK] New API to add, retrieve and delete cookies via WebKitCookieManager
3156         https://bugs.webkit.org/show_bug.cgi?id=177932
3157
3158         Reviewed by Carlos Garcia Campos.
3159
3160         Implemented setCookie(), getCookies() and deleteCookie() in the Soup
3161         backend, and refactored some utility functions and conversions out of
3162         NetworkStorageSessionSoup into a new CookieSoup.cpp file, so
3163         that we now can convert between SoupCookie* and WebCore::Cookie
3164         easily from anywhere (this is now needed from the UI Process).
3165
3166         * platform/Cookie.h: Add declarations for the new conversions.
3167         * platform/SourcesSoup.txt: Add CookieSoup.cpp.
3168         * platform/network/soup/CookieSoup.cpp: Added.
3169         (WebCore::Cookie::Cookie): New constructor, creates a WebCore::Cookie out of a SoupCookie*.
3170         (WebCore::msToSoupDate): Moved from NetworkStorageSessionSoup.cpp.
3171         (WebCore::Cookie::toSoupCookie): New, based on toSoupCookie() from NetworkStorageSessionSoup.cpp.
3172         * platform/network/soup/NetworkStorageSessionSoup.cpp:
3173         (WebCore::NetworkStorageSession::setCookies): Used the new implicit conversion.
3174         (WebCore::NetworkStorageSession::setCookie): Newly implemented.
3175         (WebCore::NetworkStorageSession::deleteCookie): Newly implemented.
3176         (WebCore::NetworkStorageSession::getCookies): Newly implemented.
3177
3178 2017-11-20  Zalan Bujtas  <zalan@apple.com>
3179
3180         Remove slow repaint object from FrameView when style changes.
3181         https://bugs.webkit.org/show_bug.cgi?id=179871
3182
3183         Reviewed by Antti Koivisto.
3184
3185         The "oldStyleSlowScroll" value does not need to be computed. We already know its value
3186         by checking the HashSet. This code is also unnecessarily complicated and error prone
3187         (could lead to UAF errors by leaving stale renderers in the slow paint list).
3188
3189         Test: fast/repaint/slow-repaint-object-crash.html
3190
3191         * rendering/RenderElement.cpp:
3192         (WebCore::RenderElement::styleWillChange):
3193
3194 2017-11-20  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3195
3196         [WPE] GLContextEGLWPE.cpp:44:96: error: invalid cast from type ‘GLNativeWindowType {aka long long unsigned int}’ to type ‘EGLNativeWindowType {aka unsigned int}
3197         https://bugs.webkit.org/show_bug.cgi?id=179511
3198
3199         Reviewed by Žan Doberšek.
3200
3201         r217208 changed the definition of GLNativeWindowType from EGLNativeWindowType to uint64_t for platform WPE.
3202         This built fine on a 64-bit platform since uint64_t matches the size of a pointer, but fails on 32-bits.
3203
3204         This switches back the definition to EGLNativeWindowType.
3205         And we need to include <EGL/eglplatform.h> first in order to get a definition for EGLNativeWindowType itself.
3206
3207         This commit pretty much reverts the changes r217208 did on platform/graphics/GLContext.h
3208
3209         No new tests, it is a build fix.
3210
3211         * platform/graphics/GLContext.h:
3212
3213 2017-11-20  Michael Catanzaro  <mcatanzaro@igalia.com>
3214
3215         Remove ENABLE_ALLINONE_BUILD option
3216         https://bugs.webkit.org/show_bug.cgi?id=179823
3217
3218         Reviewed by Darin Adler.
3219
3220         * CMakeLists.txt:
3221
3222 2017-11-20  Emilio Cobos Álvarez  <emilio@crisal.io>
3223
3224         Incorrect computed style in pseudo-elements with display: contents
3225         https://bugs.webkit.org/show_bug.cgi?id=179812
3226
3227         Reviewed by Antti Koivisto.
3228
3229         Bug 178513 gave them an anon renderer as the main renderer. Unfortunately, the
3230         style of that box is exposed via getComputedStyle, so that needs to be handled
3231         somehow to return the correct style.
3232
3233         Tests: imported/w3c/web-platform-tests/cssom/getComputedStyle-pseudo.html
3234
3235         * css/CSSComputedStyleDeclaration.cpp:
3236         (WebCore::ComputedStyleExtractor::styledRenderer const):
3237           Don't return a display: contents pseudo anon box.
3238         * dom/Element.cpp:
3239         (WebCore::Element::hasDisplayContents const):
3240           Just look at the rare data style.
3241         (WebCore::Element::existingComputedStyle const):
3242           Look at the rare data first. This also fixes an inefficiency in the
3243           sense that before then we'd compare the anon box style to the
3244           pseudo-element style during style update, that may be more changes
3245           than needed.
3246         * style/RenderTreeUpdaterGeneratedContent.cpp:
3247         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
3248         * style/StyleTreeResolver.cpp:
3249         (WebCore::Style::TreeResolver::resolvePseudoStyle):
3250           Move the anon box creation to render tree update instead of style
3251           resolution.
3252
3253 2017-11-19  Tim Horton  <timothy_horton@apple.com>
3254
3255         Remove unused TOUCH_ICON_LOADING feature flag
3256         https://bugs.webkit.org/show_bug.cgi?id=179873
3257
3258         Reviewed by Simon Fraser.
3259
3260         * Configurations/FeatureDefines.xcconfig:
3261
3262 2017-11-19  Tim Horton  <timothy_horton@apple.com>
3263
3264         Remove unused LEGACY_VENDOR_PREFIXES feature flag
3265         https://bugs.webkit.org/show_bug.cgi?id=179872
3266
3267         Reviewed by Darin Adler.
3268
3269         * Configurations/FeatureDefines.xcconfig:
3270
3271 2017-11-18  Darin Adler  <darin@apple.com>
3272
3273         Eliminate some cases of double hashing, other related refactoring
3274         https://bugs.webkit.org/show_bug.cgi?id=179867
3275
3276         Reviewed by Sam Weinig.
3277
3278         * Modules/indexeddb/IDBTransaction.cpp:
3279         (WebCore::IDBTransaction::objectStore): Use get instead of find.
3280
3281         * Modules/mediasource/MediaSourceRegistry.cpp:
3282         (WebCore::MediaSourceRegistry::unregisterURL): Use take instead of find/remove.
3283
3284         * accessibility/AXObjectCache.cpp:
3285         (WebCore::AXObjectCache::~AXObjectCache): Call setAXObjectID instead of
3286         using the removeAXID, which doesn't do anything else useful in the destructor.
3287         (WebCore::AXObjectCache::remove): Use take instead of get/remove. Also rearrange
3288         logic to eliminate the removeAXID function.
3289         (WebCore::AXObjectCache::removeAXID): Deleted. This only did two things,
3290         setAXObjectID(0) and remove from m_idsInUse, and was only called in one place
3291         besides the destructor. Clearer to not have this funtion.
3292         (WebCore::AXObjectCache::visiblePositionForTextMarkerData): Use m_idsInUse
3293         directly instead of using a function.
3294
3295         * accessibility/AXObjectCache.h: Deleted removeAXID and isIDinUse.
3296
3297         * dom/Document.cpp:
3298         (WebCore::Document::removedLastRef): Call UserActionElementSet::clear instead
3299         of UserActionElementSet::documentDidRemoveLastRef; new name fo the same function.
3300         (WebCore::Document::updateHoverActiveState): Use a reference when calling
3301         setInActiveChain.
3302
3303         * dom/Element.cpp:
3304         (WebCore::Element::isUserActionElementInActiveChain const): Pass reference
3305         instead of pointer.
3306         (WebCore::Element::isUserActionElementActive const): Ditto.
3307         (WebCore::Element::isUserActionElementFocused const): Ditto.
3308         (WebCore::Element::isUserActionElementHovered const): Ditto.
3309         (WebCore::Element::setActive): Ditto.
3310         (WebCore::Element::setFocus): Ditto.
3311         (WebCore::Element::setHovered): Ditto.
3312         (WebCore::Element::clearHoverAndActiveStatusBeforeDetachingRenderer): Ditto.
3313
3314         * dom/GenericEventQueue.cpp:
3315         (WebCore::GenericEventQueue::resume): Removed unneeded speical case for
3316         empty vector.
3317
3318         * dom/ProcessingInstruction.cpp:
3319         (WebCore::ProcessingInstruction::checkStyleSheet): Updated now that
3320         parseAttributes returns an optional instead of using a boolean "OK" out argument.
3321
3322         * dom/SelectorQuery.cpp:
3323         (WebCore::SelectorQueryCache::add): Use get instead of find.
3324
3325         * dom/UserActionElementSet.cpp:
3326         (WebCore::UserActionElementSet::didDetach): Deleted. Moved to class definition and
3327         named clearActiveAndHovered.
3328         (WebCore::UserActionElementSet::clear): Renamed documentDidRemoveLastRef to clear.
3329         (WebCore::UserActionElementSet::hasFlag const): Renamed from hasFlags and also
3330         take reference and enumeration instead of pointer and unsigned. Makes it clearer
3331         this does not allow null and that it works on a single flag, not a set of flags.
3332         (WebCore::UserActionElementSet::clearFlags): Changed argument types to reference
3333         and OptionSet to make it clear this works on a set of flags.
3334         (WebCore::UserActionElementSet::setFlags): Ditto.
3335
3336         * dom/UserActionElementSet.h: Updated for changes above. Also made some name
3337         changes, and used an enum class instead of an enum.
3338
3339         * html/BaseCheckableInputType.cpp:
3340         (WebCore::BaseCheckableInputType::saveFormControlState const): Updated since
3341         FormControlState is now just a vector, not a class.
3342         * html/FileInputType.cpp:
3343         (WebCore::FileInputType::filesFromFormControlState): Ditto.
3344         (WebCore::FileInputType::restoreFormControlState): Removed unneeded check that
3345         valueSize is a multiple of 2. Code will ignore any extra strings at the end, so
3346         there is no need for the validity check.
3347
3348         * html/FormController.cpp:
3349         (WebCore::serializeFormControlStateTo): Made a non-member function since
3350         FormControlState is now just a vector, not a class.
3351         (WebCore::deserializeFormControlState): Ditto. Also return optional instead
3352         of relying on a special failure state.
3353         (WebCore::SavedFormState::deserialize): Updated for above changes.
3354         (WebCore::SavedFormState::serializeTo const): Ditto.
3355         (WebCore::SavedFormState::appendControlState): Use add instead of both find and add
3356         to avoid double hashing.
3357         (WebCore::SavedFormState::takeControlState): Removed unneeded check for empty
3358         hash table and tweaked coding style.
3359         (WebCore::SavedFormState::referencedFilePaths const): Renamed to remove "get".
3360         (WebCore::FormKeyGenerator::formKey): Use ensure instead of find and add.
3361         (WebCore::FormController::formElementsCharacterCount const): Don't call
3362         saveFormControlState for non-text-form-controls since we ignored those values.
3363         (WebCore::FormController::willDeleteForm): Take a reference.
3364         (WebCore::FormController::restoreControlStateFor): Update since FormControlState
3365         is now a vector.
3366         (WebCore::FormController::restoreControlStateIn): Use is/downcast and update
3367         since FormControlState is now a vector.
3368         (WebCore::FormController::referencedFilePaths): Renamed to remove "get".
3369         (WebCore::FormController::registerFormElementWithState):Take a reference.
3370         (WebCore::FormController::unregisterFormElementWithState): Ditto.
3371
3372         * html/FormController.h: Removed FormControlState class since it was just a
3373         Vector<String> with various unneeded features, such as a "failure" state,
3374         and a never-looked-at type of "skip" or "restore". Updated for other changes
3375         above.
3376