2017-05-07 Michael Catanzaro [GTK] Cannot sign in with new Google sign-in page https://bugs.webkit.org/show_bug.cgi?id=171770 Reviewed by Carlos Garcia Campos. Google's new authentication page does not work with the Firefox user agent that's required to make various Google websites work. Special-case accounts.google.com so that it receives our standard user agent. * platform/UserAgentQuirks.cpp: (WebCore::isGoogle): (WebCore::urlRequiresFirefoxBrowser): 2017-05-03 Michael Catanzaro YouTube user agent quirk breaks new YouTube https://bugs.webkit.org/show_bug.cgi?id=171603 Reviewed by Carlos Garcia Campos. Our user agent quirk to make YouTube 360 work breaks the new YouTube UI, causing it to attempt to use the obsolete custom elements v0 API. WebKit only supports the v1 API. We have to remove this quirk. Note this does not affect Safari as Apple ports don't use our user agent quirks. * platform/UserAgentQuirks.cpp: (WebCore::urlRequiresChromeBrowser): 2017-04-21 Gwang Yoon Hwang Do not paint the border of the box if the dirty region does not intersect with border area https://bugs.webkit.org/show_bug.cgi?id=170988 Reviewed by Simon Fraser. No new tests, since there is no change in behavior. * platform/graphics/GeometryUtilities.cpp: (WebCore::ellipseContainsPoint): Checks if a point is within an ellipse. * platform/graphics/GeometryUtilities.h: Replace header-guards with #pragma once. * platform/graphics/RoundedRect.cpp: (WebCore::RoundedRect::contains): Implemented to know the dirty rectangle intersects with rounded rectangle or not. * platform/graphics/RoundedRect.h: * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintBorder): When typing in decorated text box, the dirty rect generated only for the inside of the text box, not for the decorations. So we can avoid the calculations to draw borders if the inner border totally covers the target surface. It will optimize the rendering process since we don't have to render border decorations whenever we type somethings in side of the text input element. 2017-05-05 Carlos Garcia Campos [GStreamer] Do not report more errors after the first one https://bugs.webkit.org/show_bug.cgi?id=171722 Reviewed by Xabier Rodriguez-Calvar. We can receive several error messages for the same error from different elements. That's not expected by the media source selection algorithm implementation. I don't know if didn't happen with previous versions of GST, but since the upgrade to 1.10.4 several tests are failing because of this. Fixes: media/video-error-does-not-exist.html media/video-load-networkState.html media/video-source-error.html media/video-source-none-supported.html media/video-source-moved.html * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Return early also when an error already occured. 2017-05-05 Carlos Garcia Campos [GStreamer] Fix handling of gst errors in MediaPlayerPrivateGStreamer::handleMessage https://bugs.webkit.org/show_bug.cgi?id=171721 Reviewed by Xabier Rodriguez-Calvar. We are checking the GError only comparing the code, and ignoring the domain in some cases. Use g_error_matches() in those cases instead of only checking the code. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::handleMessage): 2017-05-02 Carlos Garcia Campos [GStreamer] Dailymotion live stream videos don't play https://bugs.webkit.org/show_bug.cgi?id=170767 Reviewed by Sergio Villar Senin. The video shows a message saying that an error occurred and nothing is played. There are actually several problems with dailymotion. The main issue is that URLs are redirected by the server, and GStreamer needs to know the redirected URL. Once GStreamer knows the redirected URL the error message no longer appears, the video starts but it always stops after a few seconds. This is because the source receives an early EOS while still downloading the fragments. The reason of the early EOS is because dailymotion sends a wrong Content-Length header, something that is expected to happen and we correctly handle that case when receiving the data, by updating the size accordingly if the bytes received are longer than the expected content length. This particular case doesn't work well with GStreamer automatic EOS handling, which is the default. At some point, GStreamer detects that the bytes received are at least the expected ones and emits a GST_EVENT_EOS that the GstUriDownloader handles finishing the download early. We should always disable automatic EOS, since we know when EOS actually happens and we already call gst_app_src_end_of_stream(). This patch also emits a GST_EVENT_CUSTOM_DOWNSTREAM_STICKY event to let GStreamer know about the HTTP headers sent and received. * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (webkit_web_src_init): Disable automatic EOS. (webKitWebSrcGetProperty): Return the redirected URL in case of redirection. (webKitWebSrcStart): Pass the ResourceRequest to the stream clients. (webKitWebSrcQueryWithParent): Set the redirected URL in the query in case of redirection. (webKitWebSrcSetUri): Clear also the redirected URL when setting a new URI. (StreamingClient::StreamingClient): Use GRefPtr for the source and initialize the request too. (StreamingClient::~StreamingClient): Remove explicit unref. (StreamingClient::createReadBuffer): (StreamingClient::handleResponseReceived): Initialize the redirected URL in case of redirection. Create and push the HTTP headers event. (StreamingClient::handleDataReceived): (StreamingClient::handleNotifyFinished): (CachedResourceStreamingClient::CachedResourceStreamingClient): (CachedResourceStreamingClient::responseReceived): (CachedResourceStreamingClient::accessControlCheckFailed): (CachedResourceStreamingClient::loadFailed): (ResourceHandleStreamingClient::ResourceHandleStreamingClient): (ResourceHandleStreamingClient::didFail): (ResourceHandleStreamingClient::wasBlocked): (ResourceHandleStreamingClient::cannotShowURL): 2017-02-14 Carlos Garcia Campos [GStreamer] Implement MediaPlayerPrivate::hasSingleSecurityOrigin() https://bugs.webkit.org/show_bug.cgi?id=168322 Reviewed by Žan Doberšek. It currently returns true unconditionally. Add resolved-location property to WebKitWebSourceGStreamer to track the resolved url returned by the server and use that from MediaPlayerPrivate to check if there was a cross origin redirection. Fixes: http/tests/security/canvas-remote-read-remote-video-redirect.html * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::hasSingleSecurityOrigin): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (webKitWebSrcFinalize): (webKitWebSrcGetProperty): (webKitWebSrcStart): (webKitWebSrcQueryWithParent): (webKitWebSrcGetUri): (webKitWebSrcSetUri): (StreamingClient::handleResponseReceived): (ResourceHandleStreamingClient::wasBlocked): (ResourceHandleStreamingClient::cannotShowURL): 2017-04-12 Carlos Garcia Campos [GTK] Crash at WebCore::ResourceHandle::clearClient() when streaming live video from dailymotion https://bugs.webkit.org/show_bug.cgi?id=169725 Reviewed by Michael Catanzaro. Make ResourceHandleStreamingClient refcounted and add an invalidate method to do the cleanup in the networking thread while keeping a reference. * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (webKitWebSrcStop): Call invalidate before reseting client pointer. (webKitWebSrcStart): Ditto. (ResourceHandleStreamingClient::ResourceHandleStreamingClient): Remove all cleanup code after the run loop run call. (ResourceHandleStreamingClient::~ResourceHandleStreamingClient): Just detach the thread. (ResourceHandleStreamingClient::invalidate): Schedule a task on the networking thread to clean up and fiish the run loop, protecting this. (ResourceHandleStreamingClient::setDefersLoading): Protect this. (ResourceHandleStreamingClient::didReceiveResponse): Do nothing if client was invalidated. (ResourceHandleStreamingClient::didReceiveBuffer): Ditto. (ResourceHandleStreamingClient::didFinishLoading): Ditto. 2017-04-07 Alex Christensen REGRESSION(r204512): WebSocket errors with "Failed to send WebSocket frame." if too much data is sent https://bugs.webkit.org/show_bug.cgi?id=170463 Reviewed by Michael Catanzaro. This only reproduces when using WebSockets to communicate with an external server. When communicating with a local server, CFWriteStreamWrite succeeds too reliably, so CFWriteStreamCanAcceptBytes returns true, when sometimes it doesn't when communicating across the real internet. * platform/network/cf/SocketStreamHandleImplCFNet.cpp: (WebCore::SocketStreamHandleImpl::platformSendInternal): * platform/network/soup/SocketStreamHandleImplSoup.cpp: (WebCore::SocketStreamHandleImpl::platformSendInternal): Returning std::nullopt means there was an error, which is not true when the socket stream is in a state where it cannot be written to because it is actively communicating. Returning 0 means 0 new bytes were sent, so we will try again later. 2017-03-22 Michael Catanzaro [GTK] Honor GTK+ font settings https://bugs.webkit.org/show_bug.cgi?id=82889 Reviewed by Carlos Garcia Campos. After much discussion with Behdad and Martin (who is still not completely convinced I think :) I want to merge cairo font options into the Fontconfig pattern used for rendering using cairo_ft_font_options_substitute(). This is how the API was designed to be used anyway. Fontconfig will still have final say over whether to actually respect the desktop settings or not, so it can still choose to ignore the desktop's settings, but I don't think it makes sense to have desktop-wide font settings and not tell Fontconfig about them, especially when the whole point of WebKitGTK+ is desktop integration. This should also reduce complaints that we're not following desktop settings and that we're drawing fonts differently than Firefox. * PlatformGTK.cmake: * platform/graphics/cairo/CairoUtilities.cpp: (WebCore::getDefaultCairoFontOptions): * platform/graphics/cairo/CairoUtilities.h: * platform/graphics/freetype/FontCacheFreeType.cpp: (WebCore::createFontConfigPatternForCharacters): (WebCore::strongAliasesForFamily): (WebCore::FontCache::createFontPlatformData): * platform/graphics/freetype/FontPlatformDataFreeType.cpp: (WebCore::getDefaultFontconfigOptions): (WebCore::getDefaultCairoFontOptions): Deleted. * platform/graphics/gtk/GdkCairoUtilities.cpp: (getDefaultCairoFontOptions): 2017-03-21 Sergio Villar Senin [Soup] "Only from websites I visit" cookie policy is broken https://bugs.webkit.org/show_bug.cgi?id=168912 Reviewed by Carlos Garcia Campos. Do not reset the first party for cookies on redirects. That's properly done for the main resource in DocumentLoader::willSendRequest and, in the case of subresources, is absolutely wrong (which is what we were doing since r143931). The most notable effect was that subresources loaded via redirects were effectively bypassing the "no third party" policy for cookies. Test: http/tests/security/cookies/third-party-cookie-blocking-redirect.html * platform/network/soup/ResourceHandleSoup.cpp: (WebCore::doRedirect): 2017-03-20 Emanuele Aina [Cairo] Ensure depth and stencil renderbuffers are created on GLESv2 https://bugs.webkit.org/show_bug.cgi?id=166643 Reviewed by Darin Adler. If the gfx device doesn't support GL_OES_packed_depth_stencil, the separate depth and stencil buffers are not generated. Copy what GraphicsContext3DEfl used to do and apply it in GraphicsContext3DCairo. The Intel gfx driver seem to tolerate unbound renderbuffers, but enabling debugging in Mesa yields an error: $ MESA_DEBUG=1 \ MESA_EXTENSION_OVERRIDE=-GL_OES_packed_depth_stencil ./bin/MiniBrowser http://webglsamples.org/aquarium/aquarium.html Mesa: User error: GL_INVALID_OPERATION in glRenderbufferStorage(no renderbuffer bound) * platform/graphics/GraphicsContext3D.h: * platform/graphics/cairo/GraphicsContext3DCairo.cpp: (WebCore::GraphicsContext3D::GraphicsContext3D): Ensure separate depth and stencil renderbuffers are created. (WebCore::GraphicsContext3D::~GraphicsContext3D): Ensure separate depth and stencil renderbuffers are released. 2017-03-17 Carlos Garcia Campos [Cairo] Handle the blend mode in GraphicsContext::drawPattern https://bugs.webkit.org/show_bug.cgi?id=169746 Reviewed by Žan Doberšek. We are not taking into account the blend mode when passing the cairo operator to drawPatternToCairoContext(). This is based on patch by Žan Doberšek, just adding the toCairoOperator changes to make it easier to handle it. Instead of checking everywhere if blend mode is Normal to decide whether to use toCairoOperator with CompositeOperator or BlendMode, there's no a single toCairoOperator that receives both parameters, but BlendMode is optional and defaults to Normal. * platform/graphics/cairo/CairoUtilities.cpp: (WebCore::toCairoCompositeOperator): (WebCore::toCairoOperator): * platform/graphics/cairo/CairoUtilities.h: * platform/graphics/cairo/GraphicsContextCairo.cpp: (WebCore::GraphicsContext::setPlatformCompositeOperation): (WebCore::GraphicsContext::drawPattern): 2017-02-16 Miguel Gomez [GTK] scroll with transparent background not repainted after scrollY >= 32768 https://bugs.webkit.org/show_bug.cgi?id=154283 Reviewed by Carlos Garcia Campos. Due to a limitation of the pixman backend, which uses 16 bits to hold signed integers, cairo is not able to draw anything when using transformation matrices with values bigger than 32768. When drawing patterns into large pages, the matrices values can overflow those 16 bits, so cairo doesn't draw anything in, which causes the reported transparent backgrounds. The patch modifies the transformation matrices both from the current context and the pattern we are painting, to avoid them to hold values that cannot stored in 16 bits. There's still the possibility that this happens, but it would require using a pattern with a size bigger than 32768. Based on a previous patch by Gwang Yoon Hwang . Test: fast/backgrounds/background-repeat-long-scroll.html * platform/graphics/cairo/CairoUtilities.cpp: (WebCore::drawPatternToCairoContext): 2017-03-07 Fujii Hironori ShadowBlur::calculateLayerBoundingRect doesn't need to return the enclosingIntRect of layerRect https://bugs.webkit.org/show_bug.cgi?id=168650 Reviewed by Simon Fraser. No new tests, no behavior change. * platform/graphics/ShadowBlur.h: Change the type of return value from IntRect to IntSize. * platform/graphics/ShadowBlur.cpp: (WebCore::ShadowBlur::calculateLayerBoundingRect): Ditto. (WebCore::ShadowBlur::drawRectShadow): Rename a variable layerRect layerSize. (WebCore::ShadowBlur::drawInsetShadow): Ditto. (WebCore::ShadowBlur::drawRectShadowWithoutTiling): Ditto. (WebCore::ShadowBlur::drawInsetShadowWithoutTiling): Ditto. (WebCore::ShadowBlur::beginShadowLayer): Ditto. 2017-03-02 Carlos Garcia Campos [GTK] Crash in WebCore::CoordinatedGraphicsLayer::notifyFlushRequired https://bugs.webkit.org/show_bug.cgi?id=166420 Reviewed by Žan Doberšek. This is happening when closing a page that is being inspected. When CoordinatedGraphicsLayer::removeFromParent() is called, the coordinator has already been invalidated, so all its layers were set a nullptr coordinator. I think it's safe to simply handle m_coordinator being nullptr in notifyFlushRequired(). * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::notifyFlushRequired): Return early if the coordinator is nullptr. 2017-03-01 Carlos Garcia Campos [GTK] fast/canvas/canvas-createPattern-video-loading.html makes its subsequent test timeout https://bugs.webkit.org/show_bug.cgi?id=169019 Reviewed by Xabier Rodriguez-Calvar. The timeout happens normally when the media player is deleted and the pipeline state is set to NULL. The call to gst_element_set_state() never returns because of different deadlocks with the video sink. Sometimes the deadlock happens with the sample mutex used by VideoRenderRequestScheduler. VideoRenderRequestScheduler::requestRender() calls webkitVideoSinkRepaintRequested() with the lock held, that ends up calling MediaPlayerPrivateGStreamerBase::triggerRepaint(). When rendering can't be accelerated the draw timer is scheduled and triggerRepaint blocks until the timer is fired. If the media player is destroyed before the timer is fired, when setting the pipeline state to NULL, other VideoRenderRequestScheduler methods can be called, like stop() that tries to get the sample mutex that is still held by requestRender(). So, first we need to make sure that requestRender() releases the lock before calling webkitVideoSinkRepaintRequested(). But that's not enough, we also need to ensure that the pipeline is set to NULL state after everyting has been properly stopped. This is currently done in ~MediaPlayerPrivateGStreamer that happens before ~MediaPlayerPrivateGStreamerBase, so gst_element_set_state() is hanging before allowing the MediaPlayerPrivateGStreamerBase to be cleaned up. We should move the call to the end of ~MediaPlayerPrivateGStreamerBase and ensure the draw timer and mutex are properly cleaned up before. Fixes: fast/canvas/canvas-createPattern-video-loading.html * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): Do not reset pipeline here. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase): Stop the draw mutex and notify the lock to ensure we unblock. Do the pipeline reset at the end. * platform/graphics/gstreamer/VideoSinkGStreamer.cpp: (VideoRenderRequestScheduler::requestRender): Release the mutex lock before calling webkitVideoSinkRepaintRequested(). 2017-03-01 Tomas Popela [Cairo] Incorrectly determining height in GraphicsContext::roundToDevicePixels() https://bugs.webkit.org/show_bug.cgi?id=169031 Reviewed by Carlos Garcia Campos. We should compare if height is between -1 and 0 and not mixing height and width together. * platform/graphics/cairo/GraphicsContextCairo.cpp: (WebCore::GraphicsContext::roundToDevicePixels): 2017-02-24 Miguel Gomez [GTK] WebkitWebProcess crashes on exit on nvidia if threaded compositing is enabled https://bugs.webkit.org/show_bug.cgi?id=165522 Reviewed by Carlos Garcia Campos. Before destrying a GLContextGLX we need to set the default framebufer to avoid a bug in some nvidia drivers. Ensure that we set the context as current before performing that operation, and set the appropriate current context after doing so. No new tests. * platform/graphics/glx/GLContextGLX.cpp: (WebCore::GLContextGLX::~GLContextGLX): 2017-02-23 Carlos Garcia Campos [GStreamer] Several layout tests trigger GStreamer-CRITICAL **: gst_bin_get_by_name: assertion 'GST_IS_BIN (bin)' failed https://bugs.webkit.org/show_bug.cgi?id=167016 Reviewed by Xabier Rodriguez-Calvar. This is because we create AudioSourceProviderGStreamer objects that are never loaded. In the destructor the AudioSourceProviderGStreamer calls gst_bin_get_by_name() on its m_audioSinkBin that is nullptr. We could simply check m_audioSinkBin in the destructor, but I think it's better to simply not create AudioSourceProviderGStreamer for nothing. MediaPlayerPrivateGStreamer should create the AudioSourceProvider on demand. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer): Do not create the AudioSourceProvider. (WebCore::MediaPlayerPrivateGStreamer::createAudioSink): Call ensureAudioSourceProvider() before using m_audioSourceProvider. (WebCore::MediaPlayerPrivateGStreamer::ensureAudioSourceProvider): Create the AudioSourceProvider if needed. (WebCore::MediaPlayerPrivateGStreamer::audioSourceProvider): Ensure and return the m_audioSourceProvider. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: 2017-02-23 Tomas Popela [GTK] Drag and drop is always moving the content even if copy is requested https://bugs.webkit.org/show_bug.cgi?id=168424 Reviewed by Carlos Garcia Campos. Drag and drop is always moving the content around even if the copy is requested (i.e. by pressing the Control key). Test: editing/pasteboard/drag-drop-copy-content.html * page/gtk/DragControllerGtk.cpp: (WebCore::DragController::isCopyKeyDown): 2017-02-09 Chris Dumez Crash under FormSubmission::create() https://bugs.webkit.org/show_bug.cgi?id=167200 Reviewed by Darin Adler. The issue is that FormSubmission::create() was iterating over form.associatedElements() as was calling Element::appendFormData() in the loop. HTMLObjectElement::appendFormData() was calling pluginWidget(PluginLoadingPolicy::Load) which causes a synchronous layout and can fire events (such as focus event) synchronously. Firing those events synchronously allows the JS to modify the form.associatedElements() vector we are currently iterating on. To avoid this issue, we now call pluginWidget(PluginLoadingPolicy::DoNotLoad) in HTMLObjectElement::appendFormData() as we are not allowed to fire synchronous events at this point. I also added a security assertion in FormSubmission::create() to catch cases where we fire JS events while iterating over the form associated elements to more easily notice these things in the future. Test: fast/forms/formsubmission-appendFormData-crash.html * html/HTMLObjectElement.cpp: (WebCore::HTMLObjectElement::appendFormData): * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): 2017-02-18 Ryosuke Niwa REGRESSION(r212218): Assertion failures in and after parserRemoveChild https://bugs.webkit.org/show_bug.cgi?id=168458 Reviewed by Antti Koivisto. The bug was caused by parserRemoveChild not preceeding to remove oldChild even when oldChild had been inserted elsewhere during unload evnets of the disconnected frames. Fixed the bug by checking this condition and exiting early. Also fixed various callers of parserRemoveChild to not call parserAppendChild when the removed node had already been inserted elsewhere by scripts. Tests: fast/parser/adoption-agency-unload-iframe-3.html fast/parser/adoption-agency-unload-iframe-4.html fast/parser/xml-error-unload-iframe.html * dom/ContainerNode.cpp: (WebCore::ContainerNode::parserRemoveChild): Exit early when the node had been inserted elsewhere while firing unload events. Also moved the call to notifyRemovePendingSheetIfNeeded outside NoEventDispatchAssertion since it can synchrnously fire a focus event. (WebCore::ContainerNode::parserAppendChild): Moved adoptNode call to inside NoEventDispatchAssertion since adoptNode call here should never mutate DOM. * html/parser/HTMLConstructionSite.cpp: (WebCore::executeReparentTask): Added an early exit when the node had already been inserted elsewhere. (WebCore::executeInsertAlreadyParsedChildTask): Ditto. * xml/XMLErrors.cpp: (WebCore::XMLErrors::insertErrorMessageBlock): Ditto. * xml/parser/XMLDocumentParser.cpp: (WebCore::XMLDocumentParser::end): Fixed a crash unveiled by one of the test cases. Exit early when insertErrorMessageBlock detached the parser (by author scripts). (WebCore::XMLDocumentParser::finish): Keep the parser alive until we exit. 2017-02-12 Ryosuke Niwa parserRemoveChild should unload subframes https://bugs.webkit.org/show_bug.cgi?id=168151 Reviewed by Darin Adler. Fix the bug that the adoption agency algorithm does not unload subframes as it disconnects nodes. Also moved calls to nodeWillBeRemoved inside NoEventDispatchAssertion to expand on r211965. Tests: fast/parser/adoption-agency-clear-focus-range.html fast/parser/adoption-agency-unload-iframe-1.html fast/parser/adoption-agency-unload-iframe-2.html * dom/ContainerNode.cpp: (WebCore::ContainerNode::takeAllChildrenFrom): Rewritten using idioms used in removeChildren and parserAppendChild. Disconnect all subframes first since this can synchronously dispatch an unload event. Then update DOM ranges, the focused element, and other states in the document. Second, use the regular removeBetween, notifyChildNodeRemoved, childrenChanged sequence of calls to disconnect nodes instead of a single call to removeDetachedChildren to properly disconnect child nodes since those nodes may have already come live due to execution of synchronous scripts prior to the adoption agency algorithm has run, or in response to the unload event we just dispatched. Third, append these nodes using parserAppendChild to avoid dispatching mutation events. (WebCore::willRemoveChild): Removed the call to nodeWillBeRemoved. It's now called within NoEventDispatchAssertion in each call site of willRemoveChild and willRemoveChildren. (WebCore::willRemoveChildren): Ditto. (WebCore::ContainerNode::removeChild): Call nodeWillBeRemoved inside NoEventDispatchAssertion. (WebCore::ContainerNode::replaceAllChildren): Call nodeWillBeRemoved inside NoEventDispatchAssertion. (WebCore::ContainerNode::parserRemoveChild): Disconnect subframes and update document's states. * html/parser/HTMLConstructionSite.cpp: (WebCore::executeTakeAllChildrenAndReparentTask): Add a release assert that new parent does not already have a parent. 2017-02-12 Ryosuke Niwa REGRESSION (r179497): Crash inside setAttributeNode https://bugs.webkit.org/show_bug.cgi?id=168161 Reviewed by Andreas Kling. The bug was caused by setAttributeNode calling setAttributeInternal with the same element data as the one used to call removeAttributeInternal despite of the fact removeAttributeInternal could have invoked arbitrary scripts and mutated element's m_elementData. Fixed the bug by calling with setAttributeInternal with the result of new invocation of ensureUniqueElementData(). Test: fast/dom/Attr/make-unique-element-data-while-replacing-attr.html * dom/Element.cpp: (WebCore::Element::setAttributeNode): 2017-02-09 Chris Dumez Make sure Event keeps its current target element alive https://bugs.webkit.org/show_bug.cgi?id=167885 Reviewed by Brent Fulgham. Make sure Event keeps its current target element alive to avoid crashes if it is accessed by JS after it has been garbage collected. Test: fast/events/currentTarget-gc-crash.html * dom/Event.cpp: (WebCore::Event::setCurrentTarget): * dom/Event.h: (WebCore::Event::currentTarget): 2017-02-09 Ryosuke Niwa Crash in render tree after dynamically mutating the slot value https://bugs.webkit.org/show_bug.cgi?id=167502 Reviewed by Antti Koivisto. The crash was caused by attributeChanged not destructing the render tree after an assigned element had been removed from its slot. Since the style resolver can no longer find this element in the flat tree, we need to delete its render object as if the element had been removed from the DOM tree. Tests: fast/html/details-summary-slot.html fast/shadow-dom/shadow-slot-attribute-change-crash.html * dom/Element.cpp: (WebCore::Element::attributeChanged): * html/HTMLSummaryElement.cpp: (WebCore::SummarySlotElement): Added. Always use the default slot regardless of the slot attribute's value. (WebCore::HTMLSummaryElement::create): Use SummarySlotElement 2017-02-09 Antti Koivisto Details element doesn't work correctly when mutating content between closing and opening https://bugs.webkit.org/show_bug.cgi?id=167310 Reviewed by Ryosuke Niwa. Tests: fast/html/details-close-modify-open.html fast/shadow-dom/slot-remove-mutate-add.html * dom/SlotAssignment.cpp: (WebCore::SlotAssignment::didChangeSlot): Always reset the slot assignment when content is mutated. 2017-02-09 Chris Dumez Crash under HTMLFormElement::registerFormElement() https://bugs.webkit.org/show_bug.cgi?id=167162 Reviewed by Ryosuke Niwa. didMoveToNewDocument() was re-registering FormAttributeTargetObserver even if the element's inDocument was not set yet. As a result, it was possible for FormAssociatedElement::resetFormOwner() to be called when the element was in the tree but with its inDocument still being false (because insertedInto() has not been called yet). This could end up calling HTMLFormElement::registerFormElement() even though the element is still recognized as detached. This is an issue because HTMLFormElement::m_associatedElements's order and its corresponding indexes (m_associatedElementsBeforeIndex / m_associatedElementsAfterIndex) rely on the position of the element with regards to the form element (before / inside / after). To address the issue, we now only register the FormAttributeTargetObserver in didMoveToNewDocument() if the inDocument flag is set to true. This is similar to what is done at other call sites of resetFormAttributeTargetObserver(). We also ignore the form content attribute in HTMLFormElement::formElementIndex() if the element is not connected. As per the HTML specification [1], the form content attribute is only taken if the element is connected (i.e. inDocument flag is true). Note that FormAssociatedElement::findAssociatedForm() was already ignoring the form content attribute if the element is disconnected. [1] https://html.spec.whatwg.org/#reset-the-form-owner (step 3) Test: fast/forms/registerFormElement-crash.html * html/FormAssociatedElement.cpp: (WebCore::FormAssociatedElement::didMoveToNewDocument): Only call resetFormAttributeTargetObserver() if inDocument flag is set, similarly to what is done at other call sites. (WebCore::FormAssociatedElement::resetFormAttributeTargetObserver): Add an assertion to make sure no one call this method on an element that is not connected. * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::formElementIndex): Ignore the form content attribute if the element is not connected, as per the HTML specification [1]. 2017-02-09 Brent Fulgham Handle synchronous layout when setting a selection range https://bugs.webkit.org/show_bug.cgi?id=167092 Reviewed by Antti Koivisto. The 'innerTextElement' of a form control can change during layout due to arbitrary JavaScript executing. Handle the case where the inner text element has changed so that current render box height is while setting a selection range. Test: fast/forms/input-type-change-during-selection.html * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::setSelectionRange): 2017-02-09 Ryosuke Niwa Adopting a child node of a script element can run script https://bugs.webkit.org/show_bug.cgi?id=167318 Reviewed by Darin Adler. The bug was caused by ScriptElement::childrenChanged indiscriminately running the script. Do this only if some node has been inserted as spec'ed: https://html.spec.whatwg.org/multipage/scripting.html#script-processing-model "The script element is connected and a node or document fragment is inserted into the script element, after any script elements inserted at that time." Split NonContentsChildChanged into NonContentsChildInserted and NonContentsChildRemoved to disambiguate non-contents child such as text and element being removed or inserted. New behavior matches that of Gecko and Chrome as well as the latest HTML5 specification. Also deploy NoEventDispatchAssertion in more places. Unfortunately, this results in some DOM trees internal to WebKit to be mutated while there is NoEventDispatchAssertion in the stack. Added a new RAII object "EventAllowedScope" to temporarily disable this assertion within such a tree. CachedSVGFont's ensureCustomFontData used to completely disable this assertion but we no longer have to do this either. To clarify the new semantics, renamed isEventDispatchForbidden to isEventAllowedInMainThread with the negated boolean value, and added a new variant isEventDispatchAllowedInSubtree, which checks isEventDispatchForbidden() is true or if the node was one of an internal DOM node or its descendent held by EventAllowedScope. Inspired by https://chromium.googlesource.com/chromium/src/+/604e798ec6ee30f44d57a5c4a44ce3dab3a871ed Tests: fast/html/script-must-not-run-when-child-is-adopted.html fast/html/script-must-not-run-when-child-is-removed.html * dom/CharacterData.cpp: (WebCore::CharacterData::notifyParentAfterChange): Added NoEventDispatchAssertion. * dom/ContainerNode.cpp: (WebCore::ContainerNode::insertBefore): Added NoEventDispatchAssertion around TreeScope's adoptIfNeeded and insertBeforeCommon as done elsewhere. (WebCore::ContainerNode::appendChildCommon): Added NoEventDispatchAssertion. (WebCore::ContainerNode::changeForChildInsertion): Use NonContentsChildInserted here. (WebCore::ContainerNode::notifyChildRemoved): Added NoEventDispatchAssertion. (WebCore::ContainerNode::replaceChild): Moved adoptIfNeeded into NoEventDispatchAssertion. (WebCore::ContainerNode::removeChild): Added NoEventDispatchAssertion. (WebCore::ContainerNode::parserRemoveChild): Added NoEventDispatchAssertion. (WebCore::ContainerNode::removeChildren): Call childrenChanged in NoEventDispatchAssertion. (WebCore::ContainerNode::appendChildWithoutPreInsertionValidityCheck): Moved adoptIfNeeded into NoEventDispatchAssertion. (WebCore::dispatchChildInsertionEvents): Check the forbidden-ness more precisely. (WebCore::dispatchChildRemovalEvents): Ditto. * dom/ContainerNode.h: (WebCore::ContainerNode::ChildChange::isInsertion): Added. * dom/ContainerNodeAlgorithms.cpp: (WebCore::notifyChildNodeInserted): Check the forbidden-ness more precisely. Here, we check against insertionPoint since EventAllowedScope checks against the root node. * dom/Document.cpp: (WebCore::Document::adoptNode): Assert the node to be adopted has not been inserted back, or else remove() had resulted in an exception before calling TreeScope::adoptIfNeeded. * dom/Element.cpp: (WebCore::Element::childrenChanged): * dom/NoEventDispatchAssertion.h: (WebCore::NoEventDispatchAssertion::isEventDispatchForbidden): Added a new variant that takes a node. If this node is a descendent of a node "marked as safe" by EventAllowedScope, then we don't consider the event dispatch to be forbidden. (WebCore::NoEventDispatchAssertion::dropTemporarily): Deleted. (WebCore::NoEventDispatchAssertion::restoreDropped): Deleted. (WebCore::NoEventDispatchAssertion::EventAllowedScope): Added. A RAII object which marks descendants of a given node as "safe" for the purpose of checking isEventDispatchForbidden. (WebCore::NoEventDispatchAssertion::EventAllowedScope::EventAllowedScope): Added. There can be a chain of EventAllowedScope objects in the stack. s_currentScope points to the most recently instantiated RAII object, and each instance remembers prior instance. (WebCore::NoEventDispatchAssertion::EventAllowedScope::~EventAllowedScope): Added. (WebCore::NoEventDispatchAssertion::EventAllowedScope::isAllowedNode): Added. Returns true if the given node is a descendent of any node held by instances of EventAllowedScope. (WebCore::NoEventDispatchAssertion::EventAllowedScope::isAllowedNodeInternal): Added. A helper function for isAllowedNode. * dom/Node.cpp: (WebCore::Node::dispatchSubtreeModifiedEvent): Check the forbidden-ness more precisely. * dom/ScriptElement.cpp: (WebCore::ScriptElement::childrenChanged): Only prepare the script if we've inserted nodes. (WebCore::ScriptElement::executeClassicScript): Assert isEventDispatchForbidden is false since running arbitrary author scripts can, indeed, result dispatch any events. * dom/ScriptElement.h: * html/HTMLElement.cpp: (WebCore::textToFragment): Made this a static local function and not return an exception since there is no way appendChild called in this function can throw an exception. (WebCore::HTMLElement::setInnerText): Create EventAllowedScope for the fragment. It's called called by HTMLTextAreaElement's childrenChanged to update its UA shadow tree, and it's dispatching as event on a new fragment can't execute arbitrary scripts since it has never been exposed to author scripts. Because of the precise-ness of this check, this does not disable the assertion for "this" element. HTMLTextFormControlElement::setInnerTextValue explicitly creates another EventAllowedScope to mark the shadow tree into which the fragment is inserted safe. (WebCore::HTMLElement::setOuterText): * html/HTMLElement.h: * html/HTMLScriptElement.cpp: (WebCore::HTMLScriptElement::childrenChanged): * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::setInnerTextValue): See above (setInnerText). * html/track/VTTCue.cpp: (WebCore::VTTCue::createCueRenderingTree): Create EventAllowedScope for the cloned fragment here since the VTT tree is never exposed to author scripts. (WebCore::VTTCue::updateDisplayTree): Ditto. * loader/cache/CachedSVGFont.cpp: (WebCore::CachedSVGFont::ensureCustomFontData): Use EventAllowedScope to disable assertions only on the new SVG document we just created instead of disabling for all DOM trees. * svg/SVGScriptElement.cpp: (WebCore::SVGScriptElement::childrenChanged): 2017-01-25 Ryosuke Niwa Crash under DOMSelection::deleteFromDocument() https://bugs.webkit.org/show_bug.cgi?id=167232 Reviewed by Chris Dumez. The crash was caused by DOMSelection's deleteFromDocument() mutating contents inside the user-agent shadow tree of an input element when the text field is readonly. Fixed the bug by exiting early whenever the selection is inside a shadow tree since getSelection().getRangeAt(0) always returns a range outside the input element or any shadow tree for that matter. New behavior matches that of Gecko. The working draft spec of which I'm the editor states that deleteFromDocument() must invoke Range's deleteContents() on the associated range, which is the collapsed range returned by getSelection().getRangeAt(0) in the spec: https://www.w3.org/TR/2016/WD-selection-api-20160921/#widl-Selection-deleteFromDocument-void And Range's deleteContents() immediately terminates in step 1 when start and end are identical: https://dom.spec.whatwg.org/commit-snapshots/6b7621282c2e3b222ac585650e484abf4c0a416b/ Note that Range's DOM mutating methods are not available inside an user-agent shadow tree because WebKit never returns a Range whose end boundary points are inside the tree to author scripts. Editing commands (ones executable from document.execCommand) that mutate DOM like this check whether the content is editable or not. Since VisibleSelection's validate() function makes sure the selection is either entirely within or outside of an root editable element (editing host in the W3C spec lingo), editing commands should never mutate a random node inside an user-agent shadow tree. Test: editing/selection/deleteFromDocument-shadow-tree-crash.html * page/DOMSelection.cpp: (WebCore::DOMSelection::deleteFromDocument): 2017-01-17 Joseph Pecoraro Crash when closing tab with debugger paused https://bugs.webkit.org/show_bug.cgi?id=161746 Reviewed by Brian Burg and Brent Fulgham. * page/Page.h: (WebCore::Page::incrementNestedRunLoopCount): (WebCore::Page::decrementNestedRunLoopCount): (WebCore::Page::insideNestedRunLoop): Keep track of whether or not this Page is inside of a nested run loop. Currently the only nested run loop we know about is EventLoop used by Web Inspector when debugging JavaScript. (WebCore::Page::whenUnnested): Callback that can be called when we are no longer inside of a nested run loop. (WebCore::Page::~Page): Ensure we are not in a known nested run loop when destructing, since that could be unsafe. * inspector/PageScriptDebugServer.cpp: (WebCore::PageScriptDebugServer::runEventLoopWhilePausedInternal): Increment and decrement as we go into or leave the nested runloop. * inspector/InspectorController.cpp: (WebCore::InspectorController::inspectedPageDestroyed): (WebCore::InspectorController::disconnectAllFrontends): Rework destruction to allow disconnectAllFrontends to happen earlier if necessary. WebKit clients may use this to disconnect remote frontends when closing a Page. 2017-01-09 Daniel Bates Evaluating window named element may return wrong result https://bugs.webkit.org/show_bug.cgi?id=166792 Reviewed by Chris Dumez. * bindings/js/JSDOMWindowProperties.cpp: (WebCore::jsDOMWindowPropertiesGetOwnPropertySlotNamedItemGetter): 2017-01-06 Chris Dumez Regression(r189230): DOM Callbacks may use wrong global object https://bugs.webkit.org/show_bug.cgi?id=166784 Reviewed by Mark Lam. DOM Callbacks could end up using the wrong global object after r189230 because we were getting the globalObject from the callback object instead of the one at the point the callback object was passed in by JavaScript. This patch fixes the issue. Test: fast/frames/frame-window-as-callback.html * bindings/js/JSCallbackData.cpp: (WebCore::JSCallbackData::invokeCallback): * bindings/js/JSCallbackData.h: (WebCore::JSCallbackData::globalObject): (WebCore::JSCallbackData::JSCallbackData): (WebCore::JSCallbackDataStrong::JSCallbackDataStrong): (WebCore::JSCallbackDataStrong::callback): (WebCore::JSCallbackDataStrong::invokeCallback): (WebCore::JSCallbackDataWeak::JSCallbackDataWeak): (WebCore::JSCallbackDataWeak::callback): (WebCore::JSCallbackDataWeak::invokeCallback): * bindings/scripts/CodeGeneratorJS.pm: (GenerateCallbackImplementationContent): 2017-01-03 Carlos Alberto Lopez Perez A floating element within
  • overlaps with the marker https://bugs.webkit.org/show_bug.cgi?id=166528 Reviewed by Zalan Bujtas. Merged from Blink (patch by trobhogan@gmail.com): https://crrev.com/c896e79e5ba348d7ed87438cd3a19d0176f3036d https://crbug.com/548616 Establish a list marker's offset before floats have been added to its line. Computing the offset for a list marker after the rest of the objects on the line it is on have been laid out, means it will avoid floats it ought not to. Instead, compute the offset when laying out the marker and cache it for use later. Tests: fast/lists/list-marker-before-float-nested-rtl.html fast/lists/list-marker-before-float-nested.html fast/lists/list-marker-before-float-rtl.html fast/lists/list-marker-before-float.html * rendering/RenderListItem.cpp: (WebCore::RenderListItem::positionListMarker): * rendering/RenderListMarker.cpp: (WebCore::RenderListMarker::RenderListMarker): (WebCore::RenderListMarker::layout): * rendering/RenderListMarker.h: 2016-12-09 Daniel Bates [CSP] Policy of window opener not applied to about:blank window https://bugs.webkit.org/show_bug.cgi?id=165531 Reviewed by Brent Fulgham. Fixes an issue where the content security policy of the opener document was not applied to an about:blank window. An about:blank window inherits its security origin from its opener document. It should also copy (inherit) the ContentSecurityPolicy from its opener document. When copying the ContentSecurityPolicy state from the opener document to the about:blank document we must take care to avoid copying any upgrade-insecure-request directive because new windows should not inherit it by definition. With respect to upgrade-insecure-requests, new windows should only inherit the insecure navigation set from their opener document. Test: http/tests/security/contentSecurityPolicy/image-blocked-in-about-blank-window.html * dom/Document.cpp: (WebCore::Document::initContentSecurityPolicy): Copy the ContentSecurityPolicy state from the owner document to this document when it inherits its security origin from its owner. An about:blank window is one example of a document that inherits its security origin from its owner. * loader/WorkerThreadableLoader.cpp: (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge): Call ContentSecurityPolicy::copyUpgradeInsecureRequestStateFrom() to copy the upgrade insecure requests state from the owner document to the worker now that ContentSecurityPolicy::copyStateFrom() no longer does this. * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::copyStateFrom): Do not copy the upgrade insecure request state. Callers are now responsible for calling ContentSecurityPolicy::copyUpgradeInsecureRequestStateFrom() to copy this state. * page/csp/ContentSecurityPolicyDirectiveList.cpp: (WebCore::ContentSecurityPolicyDirectiveList::parse): Ignore directive upgrade-insecure-requests when inheriting ContentSecurityPolicy state as this directive as the Upgrade Insecure Requests feature has its own inheritance semantics that differ from the semantics of copying a ContentSecurityPolicy object. * xml/XSLTProcessor.cpp: (WebCore::XSLTProcessor::createDocumentFromSource): Call ContentSecurityPolicy::copyUpgradeInsecureRequestStateFrom() to copy the upgrade insecure requests state from the original document to the transformed document now that ContentSecurityPolicy::copyStateFrom() no longer does this. 2016-11-30 Brent Fulgham Use 'childOfType' template when retrieving Shadow DOM elements https://bugs.webkit.org/show_bug.cgi?id=165145 Reviewed by Antti Koivisto. Tests: fast/shadow-dom/color-input-element-shadow-manipulation.html fast/shadow-dom/file-input-element-shadow-manipulation.html fast/shadow-dom/keygen-shadow-manipulation.html fast/shadow-dom/media-shadow-manipulation.html fast/shadow-dom/range-input-element-shadow-manipulation.html fast/shadow-dom/textarea-shadow-manipulation.html Switch to using 'childOfType' when retrieving Shadow DOM elements, rather than relying on expected element positions, as these can be changed by JavaScript. Drive by fix: Make more use of is<> and downcast<> templates rather than blindly casting. * dom/Element.h: (WebCore::Element::isUploadButton): Added. (WebCore::Element::isSliderContainerElement): Added. * html/ColorInputType.cpp: (WebCore::ColorInputType::shadowColorSwatch): Use 'childOfType' rather than assuming the first child is the one we want. * html/FileInputType.cpp: (isType): Added. (WebCore::FileInputType::disabledAttributeChanged): Use 'childOfType' rather than assuming the first child is the one we want. (WebCore::FileInputType::multipleAttributeChanged): Ditto. * html/HTMLKeygenElement.cpp: (WebCore::HTMLKeygenElement::shadowSelect): Ditto. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::mediaControls): Ditto. (WebCore::HTMLMediaElement::hasMediaControls): Ditto. * html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::innerTextElement): Ditto. * html/RangeInputType.cpp: (WebCore::RangeInputType::sliderTrackElement): Ditto. * html/shadow/SliderThumbElement.h: (isType): Added. * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::targetClone): Use 'childOfType' rather than assuming the first child is the one we want. 2016-10-31 Joseph Pecoraro Web Inspector: Provide an opportunity to clear ScriptValues associated with debugged target https://bugs.webkit.org/show_bug.cgi?id=164167 Reviewed by Mark Lam. * inspector/InspectorController.cpp: (WebCore::InspectorController::inspectedPageDestroyed): Page is going away, discard values. * inspector/WorkerInspectorController.h: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::workerTerminating): Worker is going away, discard values. 2016-09-30 Youenn Fablet DumpRenderTree crashed in com.apple.WebCore: WTF::Optional::operator bool const + 12 https://bugs.webkit.org/show_bug.cgi?id=162483 Reviewed by Alex Christensen. Test: fetch/closing-while-fetching-blob.html No change of behavior. * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::stop): Asserting m_blobLoader is null (meaning that unsetPendingActivity was done) only in case FetchBodyOwner has no risk being destroyed. 2017-02-14 Carlos Garcia Campos Unreviewed, rolling out r211967. Caused rendering issues in HiDPI Reverted changeset: "[GTK] scroll with transparent background not repainted after scrollY >= 32768" https://bugs.webkit.org/show_bug.cgi?id=154283 http://trac.webkit.org/changeset/211967 2017-02-13 Carlos Garcia Campos [GTK] Non-accelerated drawing is broken with HiDPI https://bugs.webkit.org/show_bug.cgi?id=168128 Reviewed by Michael Catanzaro. When device scale factor changes, the page notifies the page overlay controller about it. Then overlay root layers are created to be notified about the device scale factor. That causes us to enter in accelerated compositing mode, because the graphics layer factory is called. But the render layer compositor doesn't really enter in accelerated mode, because there aren't page overlays, the accelerated mode is not forced and the website doesn't require acceleration either. This leaves our drawing area in an inconsistent state, it thinks it's in AC mode because it has a layer tree host, but without a root layer attached, so nothing is rendered. The page overlay controller doesn't need to create the layers when device scale factor changes, when an overlay is installed, layers will be created with the current device scale factor anyway. * page/PageOverlayController.cpp: (WebCore::PageOverlayController::didChangeDeviceScaleFactor): Return early if not initialized yet. 2017-02-09 Miguel Gomez [GTK] scroll with transparent background not repainted after scrollY >= 32768 https://bugs.webkit.org/show_bug.cgi?id=154283 Reviewed by Carlos Garcia Campos. Due to a limitation of the pixman backend, which uses 16 bits to hold signed integers, cairo is not able to draw anything when using transformation matrices with values bigger than 32768. When drawing patterns into large pages, the matrices values can overflow those 16 bits, so cairo doesn't draw anything in, which causes the reported transparent backgrounds. The patch modifies the transformation matrices both from the current context and the pattern we are painting, to avoid them to hold values that cannot stored in 16 bits. There's still the possibility that this happens, but it would require using a pattern with a size bigger than 32768. Based on a previous patch by Gwang Yoon Hwang . No new tests. * platform/graphics/cairo/CairoUtilities.cpp: (WebCore::drawPatternToCairoContext): 2017-02-08 Miguel Gomez [GTK] Reduce TiledBackingStore tile coverage when on memory pressure state https://bugs.webkit.org/show_bug.cgi?id=167980 Reviewed by Carlos Garcia Campos. Use a smaller coverAreaMultiplier in the TiledBackingStore when in memory pressure situation, to reduce the amount of tiles created. No new tests. * platform/graphics/texmap/coordinated/TiledBackingStore.cpp: (WebCore::TiledBackingStore::createTilesIfNeeded): (WebCore::TiledBackingStore::createTiles): * platform/graphics/texmap/coordinated/TiledBackingStore.h: 2017-02-09 Antti Koivisto Tear down existing renderers when adding a shadow root. https://bugs.webkit.org/show_bug.cgi?id=167117 Reviewed by Andreas Kling. Adding a shadow root may cause children no longer be part of the flat tree. If they had renderers tear down code would no longer reach them. Test: fast/shadow-dom/attach-shadow-teardown.html * dom/Element.cpp: (WebCore::Element::addShadowRoot): Tear down existing render tree when adding a shadow root. 2017-02-09 Brent Fulgham Handle synchronous layout when setting a selection range https://bugs.webkit.org/show_bug.cgi?id=167092 Reviewed by Antti Koivisto. The 'innerTextElement' of a form control can change during layout due to arbitrary JavaScript executing. Handle the case where the inner text element has changed so that current render box height is while setting a selection range. Test: fast/forms/input-type-change-during-selection.html * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::setSelectionRange): 2017-02-09 Brent Fulgham Disconnect shadow children of root when detaching a frame https://bugs.webkit.org/show_bug.cgi?id=166851 Reviewed by Andy Estes. If the root of the tree we are disconnecting has a shadow element, include it in the set of things to disconnect. Tests: fast/shadow-dom/shadow-at-root-during-disconnect.html * dom/ContainerNodeAlgorithms.cpp: (WebCore::disconnectSubframes): 2016-11-30 Brent Fulgham Use 'childOfType' template when retrieving Shadow DOM elements https://bugs.webkit.org/show_bug.cgi?id=165145 Reviewed by Antti Koivisto. Tests: fast/shadow-dom/color-input-element-shadow-manipulation.html fast/shadow-dom/file-input-element-shadow-manipulation.html fast/shadow-dom/keygen-shadow-manipulation.html fast/shadow-dom/media-shadow-manipulation.html fast/shadow-dom/range-input-element-shadow-manipulation.html fast/shadow-dom/textarea-shadow-manipulation.html Switch to using 'childOfType' when retrieving Shadow DOM elements, rather than relying on expected element positions, as these can be changed by JavaScript. Drive by fix: Make more use of is<> and downcast<> templates rather than blindly casting. * dom/Element.h: (WebCore::Element::isUploadButton): Added. (WebCore::Element::isSliderContainerElement): Added. * html/ColorInputType.cpp: (WebCore::ColorInputType::shadowColorSwatch): Use 'childOfType' rather than assuming the first child is the one we want. * html/FileInputType.cpp: (isType): Added. (WebCore::FileInputType::disabledAttributeChanged): Use 'childOfType' rather than assuming the first child is the one we want. (WebCore::FileInputType::multipleAttributeChanged): Ditto. * html/HTMLKeygenElement.cpp: (WebCore::HTMLKeygenElement::shadowSelect): Ditto. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::mediaControls): Ditto. (WebCore::HTMLMediaElement::hasMediaControls): Ditto. * html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::innerTextElement): Ditto. * html/RangeInputType.cpp: (WebCore::RangeInputType::sliderTrackElement): Ditto. * html/shadow/SliderThumbElement.h: (isType): Added. * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::targetClone): Use 'childOfType' rather than assuming the first child is the one we want. 2016-12-22 Brent Fulgham Nested calls to setDocument can omit firing 'unload' events https://bugs.webkit.org/show_bug.cgi?id=166422 Reviewed by Alex Christensen. Test: fast/loader/nested-document-handling.html Only allow a single document change to be taking place during a given runloop cycle. * bindings/js/ScriptController.cpp: (WebCore::ScriptController::executeIfJavaScriptURL): Block script changing the document when we are in the middle of changing the document. * page/Frame.cpp: (WebCore::Frame::setDocument): Keep track of document change state. * page/Frame.h: 2017-01-26 Chris Dumez Crash when navigating back to a page in PacheCache when one of its frames has been removed https://bugs.webkit.org/show_bug.cgi?id=167421 Reviewed by Darin Adler. Disallow page caching of a page if: 1. The main window has an opener (i.e. it was opened via window.open) 2. It has ever used window.open() This is because allowing page caching in this case would allow such windows to script each other even after one of them entered Page Cache. Allowing this is dangerous and easily causes crashes. This is a short term workaround until we find a better solution to the problem. One issue is this workaround is that navigating back to a page that has an opener or used window.open() will not longer get the page from PageCache. As a result, state may be lost upon navigating back. However, we never guarantee that pages get page cached, and Chrome does not have a PageCache. Tests: fast/history/page-cache-after-window-open.html fast/history/page-cache-back-navigation-crash.html fast/history/page-cache-with-opener.html * dom/Document.cpp: (WebCore::Document::hasEverCalledWindowOpen): (WebCore::Document::markHasCalledWindowOpen): * dom/Document.h: * history/PageCache.cpp: (WebCore::canCachePage): * page/DOMWindow.cpp: (WebCore::DOMWindow::createWindow): * page/DiagnosticLoggingKeys.cpp: (WebCore::DiagnosticLoggingKeys::hasCalledWindowOpenKey): (WebCore::DiagnosticLoggingKeys::hasOpenerKey): * page/DiagnosticLoggingKeys.h: * page/Page.cpp: (WebCore::Page::openedByWindowOpen): * page/Page.h: * page/Settings.in: 2016-12-22 Zalan Bujtas Do not destroy the RenderNamedFlowFragment as leftover anonymous block. https://bugs.webkit.org/show_bug.cgi?id=166436 rdar://problem/29772233 Reviewed by Simon Fraser. When as the result of certain style change, the generated anonymous block is not needed anymore, we move its descendants up to the parent and destroy the generated box. While RenderNamedFlowFragment is a generated block, the cleanup code should just ignore it the same way we ignore boxes like multicolumn, mathml etc. Test: fast/regions/flow-fragment-as-anonymous-block-crash.html * rendering/RenderObject.h: (WebCore::RenderObject::isAnonymousBlock): 2016-12-16 Zalan Bujtas Defer certain accessibility callbacks until after layout is finished. https://bugs.webkit.org/show_bug.cgi?id=165861 rdar://problem/29646301 Reviewed by Chris Fleizach. Currently with certain AXObjectCache callbacks, we can end up in a layout while the render tree is being mutated. This patch ensures that such callbacks are deferred until after tree mutation/layout is finished. Test: accessibility/accessibility-crash-with-dynamic-inline-content.html * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::remove): (WebCore::AXObjectCache::performDeferredIsIgnoredChange): (WebCore::AXObjectCache::insertDeferredIsIgnoredChange): * accessibility/AXObjectCache.h: * page/FrameView.cpp: (WebCore::FrameView::performPostLayoutTasks): * rendering/RenderBlock.cpp: (WebCore::RenderBlock::deleteLines): * rendering/RenderBlockLineLayout.cpp: (WebCore::RenderBlockFlow::createAndAppendRootInlineBox): 2016-01-04 Brent Fulgham Correct DOMWindow handling during FrameLoader::clear https://bugs.webkit.org/show_bug.cgi?id=166357 Reviewed by Andy Estes. Make sure that we always clean up the DOM window when clearing Window properties, even if the document will remain in the page cache. Since 'clearWindowShell' is only used in FrameLoader, divide it's beahvior into two steps: 1. Rename 'clearWindowShell' to 'clearWIndowShellsNotMatchingDOMWindow' to better describe its function. Switch to a modern C++ loop. Do not switch to the new DOMWindow here, but detach and clear existing DOMWindow connections. 2. Add a new method 'setDOMWindowForWindowShell'. Complete switch to the new DOMWindow. This change allows us to disconnect the old DOMWindow, perform the 'setDocument(nullptr)' operation, and then connect to the new Window without leaving the loader in an inconsistent state. * loader/bindings/js/ScriptController.cpp: (WebCore::clearWindowShellsNotMatchingDOMWindow): Renamed from 'clearWindowShell' (WebCore::setDOMWindowForWindowShell): Added. * loader/bindings/js/ScriptController.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::clear): Revise to use the new two-step DOMWindow switch logic. 2016-12-18 Brent Fulgham Side effects while restting form elements https://bugs.webkit.org/show_bug.cgi?id=165959 Reviewed by Anders Carlsson. JavaScript logic can run while resetting FormElement objects. This can lead to unintended side-effets and other unwanted behavior. We should protect these elements during the reset. Test: fast/html/form-mutate.html * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::HTMLFormElement): Switch to C++11 initialization. (WebCore::HTMLFormElement::reset): Protect elements until the reset operation is finished. (WebCore::HTMLFormElement::resetAssociatedFormControlElements): Added to share code with 'resumeFromDocument'. (WebCore::HTMLFormElement::resumeFromDocument): Protect elements until the reset operation is finished. 2016-12-06 Mark Lam Introduce the concept of Immutable Prototype Exotic Objects to comply with the spec. https://bugs.webkit.org/show_bug.cgi?id=165227 Reviewed by Saam Barati. Make all objects in window.__proto__'s prototype chain immutable prototype exotic objects. This gives us roughly equivalent behavior to other browsers. Firefox's behavior differ slightly in that Firefox will fail any attempted assignment their __proto__, while the immutable prototype exotic objects will only fail if the assignment is of a different value. See https://tc39.github.io/ecma262/#sec-immutable-prototype-exotic-objects. Chrome differs in that assignment to window.__proto__ is also handled like an immutable prototype exotic object. Instead we adhere to the current HTML spec that says that the assignment should fail unconditionally. See https://html.spec.whatwg.org/#the-windowproxy-exotic-object and https://html.spec.whatwg.org/#windowproxy-setprototypeof. If the HTML spec is changed to make the WindowProxy and Location objects into immutable prototype exotic objects later, we can update to match the spec then. Test: js/prototype-assignment.html * bindings/js/JSDOMWindowProperties.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): (GeneratePrototypeDeclaration): * bindings/scripts/IDLAttributes.txt: * dom/EventTarget.idl: * page/DOMWindow.idl: 2016-11-14 Brent Fulgham Correct handling of changing input type https://bugs.webkit.org/show_bug.cgi?id=164759 Reviewed by Darin Adler. Test: fast/forms/search-cancel-button-change-input.html It is possible for JavaScript to change the type property of an input field. WebKit needs to gracefully handle this case. Add a type traits specialization so we can properly downcast InputType elements. Use this to only call search functions on actual search input types. * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::onSearch): Only perform search functions if the input type is actually a search field. * html/InputType.h: Add type traits specialization for 'downcast' template. * html/SearchInputType.h: Ditto. 2016-11-11 Brent Fulgham Unreviewed build fix after r208628 * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::readTerminal): Cast pointer arithmetic to uint32_t to avoid warning. 2016-11-11 Brent Fulgham Neutered ArrayBuffers are not properly serialized https://bugs.webkit.org/show_bug.cgi?id=164647 Reviewed by David Kilzer. Correct binding logic to handle ImageBuffers being deserialized from neutered ArrayBuffers. Test: fast/canvas/neutered-imagedata.html * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::readTerminal): 2016-11-16 Brent Fulgham Clear track client when removing a track https://bugs.webkit.org/show_bug.cgi?id=164842 Reviewed by Eric Carlson. Call 'clearClient' when removing a track from an HTMLMediaElement. Test: media/track/audio-track-add-remove.html media/track/video-track-add-remove.html * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::removeAudioTrack): Call 'clearClient' (WebCore::HTMLMediaElement::removeVideoTrack): Ditto. 2016-12-22 Daniel Bates Bypass pop-up blocker from cross-origin or sandboxed frame https://bugs.webkit.org/show_bug.cgi?id=166290 Reviewed by Darin Adler. Tests: fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame.html fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame2.html fast/events/popup-blocked-from-unique-frame-via-window-open-named-sibling-frame.html * page/DOMWindow.cpp: (WebCore::DOMWindow::open): Use FrameLoader::findFrameForNavigation() to find the target frame to navigate with respect to the active document just as we do in WebCore::createWindow(). 2017-01-23 Gustavo Noronha Silva [GTK] asserting on unknown locale for hyphenation is wrong https://bugs.webkit.org/show_bug.cgi?id=167312 Reviewed by Carlos Garcia Campos. The fact that we hit the assert on a test called 'hyphenation-unknown-locale' is already a strong indication we should not have it. In addition to that, Carlos Lopez pointed out a similar assert was removed from the Mac codepaths when the test was introduced. * platform/text/hyphen/HyphenationLibHyphen.cpp: (WebCore::lastHyphenLocation): early return when a locale that is not available is provided for hyphenation, instead of asserting. 2017-02-03 Enrique Ocaña González [GStreamer] Store preloaded media in webkit's cache https://bugs.webkit.org/show_bug.cgi?id=119477 Reviewed by Xabier Rodriguez-Calvar. Files cached on disk by MediaPlayerPrivateGStreamer are deleted only when the player is closed. If the WebProcess crashed, they're just left there in the cache directory. This patch changes the location of those temporary files to a proper temporary directory (/var/tmp, as those files aren't actually reusable, so they don't belong to a cache directory, and /tmp is a bad place because it's RAM-based on some distros), unlinks (deletes) them right after creation and also deletes any other stalled temporary file on the old legacy cache directory. There's no API in GstPlaybin to control the temporary file location, so we do it manually by locating the GstDownloadBuffer element in the pipeline as soon as it's created, reconfiguring it with the right temporary file path and deleting the file as soon as it's created. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): Stop listening to element-added. (WebCore::MediaPlayerPrivateGStreamer::uriDecodeBinElementAddedCallback): Look for GstDownloadBuffer. (WebCore::MediaPlayerPrivateGStreamer::downloadBufferFileCreatedCallback): Remove the file after creation. (WebCore::MediaPlayerPrivateGStreamer::purgeOldDownloadFiles): Delete legacy files. (WebCore::MediaPlayerPrivateGStreamer::sourceChanged): Listen to element-added signals on GstUriDecodeBin. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: New reference to GstDownloadBuffer. 2017-01-26 Enrique Ocaña González [GStreamer] ASSERTION FAILED: !g_object_is_floating(ptr) in adoptGRef(GstContext* ptr) https://bugs.webkit.org/show_bug.cgi?id=167458 Reviewed by Xabier Rodriguez-Calvar. GstContext is a mini_object, not a GObject. Therefore it shouldn't (and can't) be checked for floatingness. * platform/graphics/gstreamer/GRefPtrGStreamer.cpp: (WTF::adoptGRef): Removed incorrect assertion. 2017-02-07 Carlos Garcia Campos [GStreamer] Deadlock when media player is destroyed https://bugs.webkit.org/show_bug.cgi?id=167861 Reviewed by Michael Catanzaro. The problem is that we are calling notifyOne() for the draw mutex without taking the lock. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::repaint): 2017-02-06 Carlos Garcia Campos Overlay scrolling with iframe-s broken https://bugs.webkit.org/show_bug.cgi?id=165056 Reviewed by Antonio Gomes. Mouse press events for overlay scrollbars are ignored if there's a subframe under the scrollbar. This doesn't happen with normal scrollbars, because the subframe is not really under the scrollbar, so events are always correctly passed to the scrollbar. With overlay scrollbars, the hit test detects the scrollbar, but events are always passed first to the subframe. Scrollbars are correctly updated on hover though, because handleMouseMoveEvent checks the presence of scrollbars before checking for subframes and move events are actually passed to both, the scrollbar and the subframe. Overlay scrollbars should always take precedence over subframes to handle mouse press events, so we should check first if mouse is over a scrollbar and never pass the event to a subframe in that case. Another problem is that the cursor is not updated either when the overlay scrollbar is hovered and there's a subframe. This is because in handleMouseMoveEvent we pass the event to both the scrollbar and subframe but we never update the cursor when a suframe was found. So, here again we need to make an exception for scrollbars and upate the cursor when mouse is over the scrollbar even if a subframe was found. Test: fast/scrolling/scroll-animator-overlay-scrollbars-clicked.html * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEvent): Move the scrollbar check before the subframe check. (WebCore::EventHandler::handleMouseMoveEvent): Update the cursor when hovering a scrollbar even if a subframe was found. (WebCore::EventHandler::updateLastScrollbarUnderMouse): Use an enum instead of a boolean for setLast parameter. * page/EventHandler.h: 2017-01-26 Zan Dobersek ImageBufferCairo: cairo_image_surface should use bmalloc-allocated memory https://bugs.webkit.org/show_bug.cgi?id=165751 Reviewed by Carlos Garcia Campos. Allocate the underlying memory for cairo_image_surface objects through FastMalloc. This way we can steer such large allocations away from the default libc allocator. Objects of this class can create Cairo surfaces that need as much as 4MB of memory for the underlying pixel buffer. Allocating such objects through the default libc allocator can lead to increased memory usage because of non-optimal allocation strategy in libc. In contrast, bmalloc performs large allocations by directly using mmap() to reserve the necessary memory. The improvements can be significant. On nytimes.com, with the threaded version of the CoordinatedGraphics system, the memory consumption can drop by roughly 20%. * platform/graphics/cairo/ImageBufferCairo.cpp: (WebCore::ImageBuffer::ImageBuffer): Zero-allocate the necessary memory via FastMalloc. Tie that memory lifetime to the lifetime of the surface by using cairo_surface_set_user_data() with the specific user data key. 2017-01-30 Carlos Garcia Campos [Threaded Compositor] Crash in GraphicsContext3D::deleteTexture when destroying TextureMapperPlatformLayerProxy https://bugs.webkit.org/show_bug.cgi?id=167575 Reviewed by Žan Doberšek. We should clear all the buffers on invalidate to ensure we don't have textures alive after CoordinatedGraphicsScene::purgeGLResources(). Fix crash in media/video-poster-background.html. * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp: (WebCore::TextureMapperPlatformLayerProxy::invalidate): Clear current, pending and all used buffers. 2017-01-29 Carlos Garcia Campos [Threaded Compositor] Crash on WebCore::GLContext::version() https://bugs.webkit.org/show_bug.cgi?id=167559 Reviewed by Michael Catanzaro. Fixes crashes in several media tests. * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp: (WebCore::TextureMapperPlatformLayerProxy::invalidate): Clear m_compositorThreadUpdateTimer and call the update function. 2017-01-26 Miguel Gomez [GTK] WebProcess from WebKitGtk+ 2.15.3 SIGSEVs in WebCore::GraphicsContext3D::drawArrays(unsigned int, int, int) at Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:740 https://bugs.webkit.org/show_bug.cgi?id=167296 Reviewed by Sergio Villar Senin. Use a VBO to pass the vertex data when using the stencil for clipping. Passing a custom array without using an VBO is deprecated when using OpenGL >= 3.0 and a Core profile. No behaviour change, no new tests. * platform/graphics/texmap/TextureMapperGL.cpp: (WebCore::TextureMapperGL::beginClip): 2017-01-25 Carlos Garcia Campos [GTK] UIProcess from WebKitGtk+ 2.15.x SIGSEGVs because of X Error BadDamage in WebKit::AcceleratedBackingStoreX11::update(WebKit::LayerTreeContext const&) () at Source/WebKit2/UIProcess/gtk/AcceleratedBackingStoreX11.cpp:145 https://bugs.webkit.org/show_bug.cgi?id=165656 Reviewed by Michael Catanzaro. Also return the base error code from PlatformDisplayX11::supportsXDamage(). * platform/graphics/x11/PlatformDisplayX11.cpp: (WebCore::PlatformDisplayX11::supportsXDamage): * platform/graphics/x11/PlatformDisplayX11.h: 2017-01-25 Miguel Gomez [GTK] The inspector is broken when AC support is disabled https://bugs.webkit.org/show_bug.cgi?id=165237 Reviewed by Carlos Garcia Campos. Ensure that PageOverlayController destroys its root GraphicsLayers when leaving AC. They will be recreated if we enter AC again, avoiding a crash because the layers don't belong to the appropriate compositor. Also, don't append the document overlay layers if we are not in compositing mode. No new tests added. * page/PageOverlayController.cpp: (WebCore::PageOverlayController::willDetachRootLayer): * page/PageOverlayController.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): (WebCore::RenderLayerCompositor::detachRootLayer): 2017-01-24 Miguel Gomez [GTK] Do not paint non composited content into the window when using the threaded compositor https://bugs.webkit.org/show_bug.cgi?id=167367 Reviewed by Carlos Garcia Campos. When using the threaded compositor we need to send the non composited content for compositing as well, not painting it directly into the window. No new tests. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::paintsIntoWindow): 2017-01-18 Miguel Gomez [GTK] [TextureMapper] [GLES2] Draw repeated patterns for NPOT textures manually https://bugs.webkit.org/show_bug.cgi?id=167118 Reviewed by Žan Doberšek. When using GLES2 without the GL_OES_texture_npot extension, some implementations fail to properly draw repeated patters from a texture (using GL_REPEAT). For those cases, perform the repetition manually using the shader. Covered by existent tests. * platform/graphics/texmap/TextureMapperGL.cpp: (WebCore::driverSupportsNPOTTextures): (WebCore::TextureMapperGL::drawTexture): (WebCore::TextureMapperGL::drawTexturedQuadWithProgram): * platform/graphics/texmap/TextureMapperShaderProgram.cpp: (WebCore::TextureMapperShaderProgram::create): * platform/graphics/texmap/TextureMapperShaderProgram.h: 2017-01-10 Zan Dobersek [CoordinatedGraphics] TextureMapperPlatformLayerProxy is constantly getting activated https://bugs.webkit.org/show_bug.cgi?id=166856 Reviewed by Michael Catanzaro. When CoordinatedGraphicsLayer::setContentsNeedsDisplay() is called, currently with the threaded CoordinatedGraphics mode the platform layer is marked for synchronizing. This means that at flush-time this layer swaps the buffer of the wrapped platform layer and updates the layer state to indicate that the underlying TextureMapperPlatformLayerProxy object has to be activated on the composition thread. This current logic results in the TextureMapperPlatformLayerProxy object being reactivated for every display request that arrives via setContentsNeedsDisplay(). This is pretty wasteful since this activation heap-allocates a RunLoop::Timer object which internally also locks up the GLib main context to attach a new source, and that's only after the source on the previous RunLoop::Timer was detached before that RunLoop::Timer was destroyed. To avoid this, CoordinatedGraphicsLayer::setContentsNeedsDisplay() sets a new flag, m_shouldUpdatePlatformLayer. During flush, this flag is checked in CoordinatedGraphicsLayer::updatePlatformLayer(), with the buffer swap performed in case it's set. CoordinatedGraphicsLayer::syncPlatformLayer() now only sets the platform layer proxy object for that layer's state. * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer): (WebCore::CoordinatedGraphicsLayer::setContentsNeedsDisplay): (WebCore::CoordinatedGraphicsLayer::syncPlatformLayer): (WebCore::CoordinatedGraphicsLayer::updatePlatformLayer): (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly): * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: 2017-01-10 Zan Dobersek [TexMap] Use WTF::Function in TextureMapperPlatformLayerProxy https://bugs.webkit.org/show_bug.cgi?id=166853 Reviewed by Michael Catanzaro. Use WTF::Function in the TextureMapperPlatformLayerProxy, instead of the std::function bloat. * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp: (WebCore::TextureMapperPlatformLayerProxy::scheduleUpdateOnCompositorThread): (WebCore::TextureMapperPlatformLayerProxy::compositorThreadUpdateTimerFired): * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h: 2017-01-10 Zan Dobersek [TextureMapper] TextureMapperPlatformLayerProxy::swapBuffers() should hold the lock throughout invocation https://bugs.webkit.org/show_bug.cgi?id=166852 Reviewed by Michael Catanzaro. * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp: (WebCore::TextureMapperPlatformLayerProxy::swapBuffer): Append to previous buffer to the m_usedBuffers Vector while the object's lock is held. Everywhere else the m_usedBuffers Vector is used under the lock, no reason to not do the same here. 2016-11-25 Andreas Kling MemoryPressureHandler should only trigger synchronous GC on iOS Reviewed by Sam Weinig. On iOS we know that there is really only one web process in play at a time, so it's okay to do a synchronous GC immediately in response to high memory pressure. On other platforms, we may have tens or hundreds of web processes, and if they all start doing full GCs at the same time, it can easily bring a system to its knees if it's already under pressure. Fix this by using garbageCollectSoon() on non-iOS platforms. * page/MemoryRelease.cpp: (WebCore::releaseCriticalMemory): 2017-01-02 Carlos Garcia Campos [GTK] Since the memory pressure relief has been activated, my disk has a high usage and the desktop stalls https://bugs.webkit.org/show_bug.cgi?id=164052 Reviewed by Michael Catanzaro. Check how much memory is freed by the memory pressure handler and wait for a long time if we didn't free that much. * platform/linux/MemoryPressureHandlerLinux.cpp: (WebCore::MemoryPressureHandler::EventFDPoller::EventFDPoller): 2016-11-10 Carlos Garcia Campos [Linux] Memory values shown by memory pressure handler logger are not useful https://bugs.webkit.org/show_bug.cgi?id=164589 Reviewed by Michael Catanzaro. We are currently using the VmSize field from /proc/self/status which is the virtual memory size of the process and doesn't normally change even when the memory pressure handler manages to release memory. So, most of the time we see that there's no changes in memory usage in the logs. We should use the actual memory used by the process, memory that the process can release and then it's relevant for the memory pressure handler. Using other fields from /proc/self/status we could do something like VmRSS - (RssFile + RssShme), but there's also /proc/self/statm that provides the same information in a single. The main different is that statm provides both resident and shared memory directly, but in number of pages, so we need to multiply by the size of the page. This patch adds a method to parse /proc/self/statm in its given file, because I plan to use this for the linux memory sampler that is incorrectly parsing /proc/self/statm. * platform/Linux.cmake: Add new files to compilation. * platform/linux/CurrentProcessMemoryStatus.cpp: Added. (WebCore::systemPageSize): Return the page size. (WebCore::currentProcessMemoryStatus): Parse /proc/self/statm and fill the given ProcessMemoryStatus. * platform/linux/CurrentProcessMemoryStatus.h: Added. * platform/linux/MemoryPressureHandlerLinux.cpp: (WebCore::MemoryPressureHandler::processMemoryUsage(): Helper function to return the memory used by the process in bytes. (WebCore::MemoryPressureHandler::ReliefLogger::platformMemoryUsage): Use processMemoryUsage(). 2017-01-11 Commit Queue Unreviewed, rolling out r182947. https://bugs.webkit.org/show_bug.cgi?id=166922 Caused huge memory leak see https://webkit.org/b/166884 (Requested by KaL on #webkit). Reverted changeset: "[GStreamer] Silent WebAudio buffers support" https://bugs.webkit.org/show_bug.cgi?id=143869 http://trac.webkit.org/changeset/182947 2017-01-17 Michael Catanzaro REGRESSION(r203047): [GTK][Stable] "notify::title" signal unreliably triggered multiple times https://bugs.webkit.org/show_bug.cgi?id=165073 Reviewed by Carlos Garcia Campos. * dom/Document.cpp: (WebCore::Document::setTitle): 2017-01-12 Zan Dobersek [GTK] WebKitWebProcess at 100% CPU loading hyphenation dictionaries https://bugs.webkit.org/show_bug.cgi?id=165601 Reviewed by Carlos Garcia Campos. In HyphenationLibHyphen, retrieve the canonicalized absolute pathname of the dictionary file in order to avoid storing symbolic links as the target files for specific locales. libhyphen distributes its dictionary files by linking a set of similar locales files to a single file. Not resolving those symbolic links means we'll be opening a single file via multiple HyphenationDictionary objects, which is far from optimal. To add insult to injury, these HyphenationDictionary objects were stored in a TinyLRUCache with a slim capacity of 4. This meant that while already loading one single file through multiple symlinks, because of continuous eviciton from this LRU cache the same symlinks continued to be processed, in some cases resulting in opening the same dictionary file hundreds or thousands of times. The capacity of this TinyLRUCache is increased to 32 to keep the amount of open libhyphen dictionaries capped at some reasonable number. * platform/text/hyphen/HyphenationLibHyphen.cpp: (WebCore::scanDirectoryForDicionaries): 2017-01-05 Milan Crha [SOUP] AddressSanitizer: heap-use-after-free under WTF::String::fromUTF8() https://bugs.webkit.org/show_bug.cgi?id=166722 Reviewed by Alex Christensen. * platform/soup/PublicSuffixSoup.cpp: (WebCore::topPrivatelyControlledDomain): Use a variable to hold UTF-8 version of the domain, because the soup_tld_get_base_domain() returns a pointer into the passed-in string, which could be freed due to the temporary object being freed. 2016-12-14 Daniel Bates CSP: Allow HTTPS URL to match HTTP source expression https://bugs.webkit.org/show_bug.cgi?id=159520 Reviewed by Brent Fulgham. Test: http/tests/security/contentSecurityPolicy/script-src-parsing-implicit-and-explicit-port-number.html * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::schemeMatches): (WebCore::ContentSecurityPolicySource::portMatches): 2016-12-13 Daniel Bates CSP: ws: and wss: blocked with connect-src * https://bugs.webkit.org/show_bug.cgi?id=165804 Reviewed by David Kilzer. Allow * to match ws: and wss:. This will make our behavior of * more closely conform the behavior of * in the Content Security Policy Level 3 spec., (Editor's Draft, 2 December 2016). Tests: http/tests/security/contentSecurityPolicy/connect-src-star-secure-websocket-allowed.html http/tests/security/contentSecurityPolicy/connect-src-star-websocket-allowed.html http/tests/security/contentSecurityPolicy/default-src-star-secure-websocket-allowed.html http/tests/security/contentSecurityPolicy/default-src-star-websocket-allowed.html * page/csp/ContentSecurityPolicySourceList.cpp: (WebCore::ContentSecurityPolicySourceList::isProtocolAllowedByStar): 2017-01-17 Miguel Gomez REGRESSION(r208997): [GLX] Google maps labels broken when using glXCreateContextAttribsARB https://bugs.webkit.org/show_bug.cgi?id=166489 Reviewed by Žan Doberšek. The format GL_ALPHA that can be used in WebGL's texImage2D and texSubImage2D functions is deprecated in the OpenGL layer when using a core profile. Due to this, when using core, we need to transform that parameter into something supported by OpenGL. What we do is to use a texture with just GL_RED format (that allows a single color component) to store the alpha values, and then configure the texture to swizzle red and alpha when accessing the pixel components. No new tests added. * platform/graphics/GraphicsContext3D.h: * platform/graphics/cairo/GraphicsContext3DCairo.cpp: (WebCore::GraphicsContext3D::GraphicsContext3D): * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: (WebCore::GraphicsContext3D::texImage2D): * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: (WebCore::GraphicsContext3D::texSubImage2D): 2016-12-30 Michael Catanzaro [GTK] Improve user agent construction https://bugs.webkit.org/show_bug.cgi?id=142074 Reviewed by Carlos Garcia Campos. Using the macOS quirk rather than the Chrome quirk for Google domains was a mistake: it broke Hangouts in a different way than the Chrome quirk, and also prevents use of the nice Earth mode on Google Maps. Google is making it really hard to develop a sane quirk. Eventually I settled on the combination of two quirks: (1) Firefox browser, and (2) Linux x86_64 platform. See the bug for full discussion on why these quirks are the best way to make Google domains work properly in WebKit. This is an extremely sad state of affairs, but I'm confident it is the best option. Note this effectively includes a rollout of r210168. Also, fix a bug that caused an extra space to be inserted in the middle of the user agent. * platform/UserAgentQuirks.cpp: (WebCore::isGoogle): (WebCore::urlRequiresFirefoxBrowser): (WebCore::urlRequiresMacintoshPlatform): (WebCore::urlRequiresLinuxDesktopPlatform): (WebCore::UserAgentQuirks::quirksForURL): (WebCore::UserAgentQuirks::stringForQuirk): (WebCore::UserAgentQuirks::firefoxRevisionString): * platform/UserAgentQuirks.h: * platform/gtk/UserAgentGtk.cpp: (WebCore::buildUserAgentString): 2016-09-30 Said Abou-Hallawa Unreviewed, fix 32-bit build. * loader/cache/CachedImage.cpp: (WebCore::CachedImage::decodedSizeChanged): 2016-09-30 Said Abou-Hallawa Change the MemoryCache and CachedResource adjustSize functions to take a long argument https://bugs.webkit.org/show_bug.cgi?id=162708 Reviewed by Brent Fulgham. Because the MemoryCache stores the size of the cached memory in unsigned, two problems my happen when reporting a change in the size of the memory: 1. Signed integer overflow -- which can happen because MemoryCache::adjustSize() takes a signed integer argument. If the allocated or the freed memory size is larger than the maximum of a signed integer, an overflow will happen. For the image caching code, this can be seen where the unsigned decodedSize is casted to an integer before passing it to ImageObserver::decodedSizeChanged(). 2. Unsigned integer overflow -- which can happen if the new allocated memory size plus the currentSize exceeds the maximum of unsigned. This can be seen in MemoryCache::adjustSize() where we add delta to m_liveSize or m_deadSize without checking whether this addition will overflow or not. We do not assert for overflow although we assert for underflow. The fix for these two problems can be the following: 1. Make all the adjustSize functions all the way till MemoryCache::adjustSize() take a signed long integer argument. 2. Do not create a NativeImagePtr for an ImageFrame if its frameBytes plus the ImageFrameCache::decodedSize() will exceed the maximum of an unsigned integer. * loader/cache/CachedImage.cpp: (WebCore::CachedImage::decodedSizeChanged): Change the argument to be long. No overflow will happen when casting the argument from unsigned to long. * loader/cache/CachedImage.h: * loader/cache/CachedResource.cpp: (WebCore::CachedResource::setDecodedSize): Use long integer casting when calling MemoryCache::adjustSize(). (WebCore::CachedResource::setEncodedSize): Ditto. * loader/cache/MemoryCache.cpp: (WebCore::MemoryCache::MemoryCache): Add as static assert to ensure sizeof(long long) can hold any unsigned or its negation. (WebCore::MemoryCache::revalidationSucceeded): Use long integer casting when calling MemoryCache::adjustSize(). (WebCore::MemoryCache::remove): Ditto. (WebCore::MemoryCache::adjustSize): Change the function argument to long integer. No overflow will happen when casting the argument from unsigned to long. * loader/cache/MemoryCache.h: * platform/graphics/ImageFrameCache.cpp: (WebCore::ImageFrameCache::destroyIncompleteDecodedData): Call a function with its new name. (WebCore::ImageFrameCache::decodedSizeChanged): Change the function argument to long integer. No overflow will happen when casting the argument from unsigned to long. (WebCore::ImageFrameCache::decodedSizeIncreased): Use long integer casting when calling decodedSizeChanged(). (WebCore::ImageFrameCache::decodedSizeDecreased): Ditto. (WebCore::ImageFrameCache::decodedSizeReset): Ditto. (WebCore::ImageFrameCache::didDecodeProperties): Ditto. (WebCore::ImageFrameCache::frameAtIndex): Do not create the NativeImage if adding its frameByes to the MemoryCache will cause numerical overflow. (WebCore::ImageFrameCache::decodedSizeIncremented): Deleted. This function is renamed decodedSizeIncreased(). (WebCore::ImageFrameCache::decodedSizeDecremented): Deleted. This function is renamed decodedSizeDecreased(). * platform/graphics/ImageFrameCache.h: * platform/graphics/ImageObserver.h: * platform/graphics/IntSize.h: (WebCore::IntSize::unclampedArea): Returns the area of an IntSize in size_t. * platform/graphics/cg/PDFDocumentImage.cpp: (WebCore::PDFDocumentImage::decodedSizeChanged): Use long integer casting when calling ImageObserver::decodedSizeChanged(). 2016-10-28 Brent Fulgham Do a better job of protecting Frame objects in the context of JavaScript calls https://bugs.webkit.org/show_bug.cgi?id=164163 Reviewed by Darin Adler. * editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::respondToUnappliedSpellCorrection): Protected the Frame. * editing/Editor.cpp: (WebCore::Editor::setTextAsChildOfElement): Ditto. * editing/EditorCommand.cpp: (WebCore::executeSwapWithMark): Ditto. * editing/TypingCommand.cpp: (WebCore::TypingCommand::deleteKeyPressed): Ditto. (WebCore::TypingCommand::forwardDeleteKeyPressed): Ditto. * editing/mac/EditorMac.mm: (WebCore::Editor::replaceNodeFromPasteboard): Ditto. * page/ContextMenuController.cpp: (WebCore::ContextMenuController::contextMenuItemSelected): Ditto. * page/DOMSelection.cpp: (WebCore::DOMSelection::collapse): Ditto. (WebCore::DOMSelection::collapseToEnd): Ditto. (WebCore::DOMSelection::collapseToStart): Ditto. (WebCore::DOMSelection::setBaseAndExtent): Ditto. (WebCore::DOMSelection::setPosition): Ditto. (WebCore::DOMSelection::modify): Ditto. (WebCore::DOMSelection::extend): Ditto. (WebCore::DOMSelection::addRange): Ditto. (WebCore::DOMSelection::deleteFromDocument): Ditto. * page/DragController.cpp: (WebCore::setSelectionToDragCaret): Ditto. (WebCore::DragController::startDrag): Ditto. * page/Frame.cpp: (WebCore::Frame::checkOverflowScroll): Ditto. * page/TextIndicator.cpp: (WebCore::TextIndicator::createWithRange): Ditto. 2016-10-27 Brent Fulgham Prevent hit tests from being performed on an invalid render tree https://bugs.webkit.org/show_bug.cgi?id=163877 Reviewed by Simon Fraser. Changeset r200971 added code to ensure that layout is up-to-date before hit testing, but did so only for the main frame. It was still possible to enter cross-frame hit testing with a subframe needing style recalc. In that situation, the subframe's updateLayout() would get called, which could trigger a compositing change that marked the parent frame as needing style recalc. A subsequent layout on the parent frame (for example by hit testing traversing into a second subframe) could then mutate the parent frame's layer tree while hit testing was traversing it. This patch modifies the hit test logic to ensure that a recursive layout is performed so that we always perform hit tests on a clean set of frames. It also adds some assertions to warn us if we encounter this invalid state. Tested by fast/layers/prevent-hit-test-during-layout.html. * dom/Document.cpp: (WebCore::Document::scheduleStyleRecalc): Assert that we are not hit testing during style recalculation. * page/EventHandler.cpp: (WebCore::EventHandler::hitTestResultAtPoint): Ensure that we have a clean render tree when hit testing. * page/FrameView.cpp: (WebCore::FrameView::setNeedsLayout): Assert that we are not in the process of hit testing when we schedule a layout. * rendering/RenderView.cpp: (WebCore::RenderView::hitTest): Mark RenderView as in an active hit test. * rendering/RenderView.h: 2016-10-26 Zalan Bujtas Ignore out-of-flow siblings when searching for a spanner candidate. https://bugs.webkit.org/show_bug.cgi?id=164042. Reviewed by Simon Fraser. While searching for the spanner candidates in a flow thread, we have to take into account whether renderers are in- or out-of-flow. What it means is that while traversing the renderer tree to find the the candidate renderer (next sibling/ancestor's next child in pre-order traversal), we have to check if the candidate is in the same layout context too. Test: fast/multicol/crash-when-spanner-candidate-is-out-of-flow.html * rendering/RenderMultiColumnFlowThread.cpp: (WebCore::spannerPlacehoderCandidate): (WebCore::RenderMultiColumnFlowThread::processPossibleSpannerDescendant): 2016-10-21 David Kilzer Bug 163762: IntSize::area() should used checked arithmetic Reviewed by Darin Adler. No new tests since no change in nominal behavior. * platform/graphics/IntSize.h: (WebCore::IntSize::area): Change to return a Checked value. Use WTF:: namespace to avoid including another header. * platform/graphics/IntRect.h: (WebCore::IntRect::area): Ditto. The remaining changes are to use the Checked return value of IntSize::area() and IntRect::area() correctly in context, in addition to items noted below. * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::isTopLevelFullPagePlugin): Declare contentWidth and contentHeight as float values to prevent overflow when computing the area, and to make the inequality comparison in the return statement uses the same type for both sides. * html/ImageData.cpp: (WebCore::ImageData::ImageData): * html/MediaElementSession.cpp: (WebCore::isElementRectMostlyInMainFrame): * platform/graphics/ImageBackingStore.h: (WebCore::ImageBackingStore::setSize): Restructure logic to compute area only once. (WebCore::ImageBackingStore::clear): * platform/graphics/ImageFrame.h: (WebCore::ImageFrame::frameBytes): * platform/graphics/ImageSource.cpp: (WebCore::ImageSource::maximumSubsamplingLevel): * platform/graphics/ca/LayerPool.cpp: (WebCore::LayerPool::backingStoreBytesForSize): * platform/graphics/cg/ImageDecoderCG.cpp: (WebCore::ImageDecoder::frameBytesAtIndex): * platform/graphics/filters/FEGaussianBlur.cpp: (WebCore::FEGaussianBlur::platformApplySoftware): * platform/graphics/filters/FilterEffect.cpp: (WebCore::FilterEffect::asUnmultipliedImage): (WebCore::FilterEffect::asPremultipliedImage): (WebCore::FilterEffect::copyUnmultipliedImage): (WebCore::FilterEffect::copyPremultipliedImage): (WebCore::FilterEffect::createUnmultipliedImageResult): (WebCore::FilterEffect::createPremultipliedImageResult): * platform/graphics/win/ImageBufferDataDirect2D.cpp: (WebCore::ImageBufferData::getData): Update overflow check, rename local variable to numBytes, and compute numBytes once. * platform/graphics/win/ImageDecoderDirect2D.cpp: (WebCore::ImageDecoder::frameBytesAtIndex): * platform/image-decoders/ImageDecoder.cpp: (WebCore::ImageDecoder::frameBytesAtIndex): * platform/ios/LegacyTileLayerPool.mm: (WebCore::LegacyTileLayerPool::bytesBackingLayerWithPixelSize): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::requiresCompositingForCanvas): * rendering/shapes/Shape.cpp: (WebCore::Shape::createRasterShape): 2016-10-20 Dean Jackson SVG should not paint selection within a mask https://bugs.webkit.org/show_bug.cgi?id=163772 Reviewed by Simon Fraser. When masking content, we shouldn't paint the text selection as we are rendering into the masking offscreen buffer. Test: svg/masking/mask-should-not-paint-selection.html * rendering/PaintPhase.h: Add a new behavior - PaintBehaviorSkipSelectionHighlight. * rendering/svg/SVGInlineTextBox.cpp: (WebCore::SVGInlineTextBox::paint): Don't update the selectionStyle if PaintBehaviorSkipSelectionHighlight is true. * rendering/svg/SVGRenderingContext.cpp: (WebCore::SVGRenderingContext::renderSubtreeToImageBuffer): Add PaintBehaviorSkipSelectionHighlight to the PaintInfo. 2016-10-05 Daniel Bates Do not follow redirects when sending violation report https://bugs.webkit.org/show_bug.cgi?id=162520 Reviewed by Alex Christensen. Do not follow redirects when sending a Content Security Policy or XSS Auditor violation report as redirects can be used to forward report details to a third-party. This changes makes WebKit more closely conform to the reporting requirements in section Reporting of the Content Security Level 2 standard: (Editor's Draft, 25 April 2016). Tests: http/tests/security/contentSecurityPolicy/report-blocked-uri-and-do-not-follow-redirect-when-sending-report.php http/tests/security/xssAuditor/report-script-tag-and-do-not-follow-redirect-when-sending-report.html http/tests/security/xssAuditor/report-script-tag-full-block-and-do-not-follow-redirect-when-sending-report.html * loader/LoaderStrategy.h: Modified createPingHandle() to take a boolean, shouldFollowRedirects, whether to follow redirect responses for a ping request. * loader/PingLoader.cpp: (WebCore::PingLoader::loadImage): Pass ShouldFollowRedirects::Yes to PingLoader::startPingLoad to keep our current behavior. (WebCore::PingLoader::sendPing): Ditto. Note our current behavior of following redirects matches the behavior described in the section "Hyperlink auditing" of the HTML standard: (23 September 2016). (WebCore::PingLoader::sendViolationReport): Pass ShouldFollowRedirects::No to PingLoader::startPingLoad so that we do not follow redirects when sending a violation report. (WebCore::PingLoader::startPingLoad): Modified to take argument shouldFollowRedirects whether to follow redirect responses for a ping request. * loader/PingLoader.h: * platform/network/PingHandle.h: Add boolean m_shouldFollowRedirects. I grouped this boolean with the existing boolean, m_shouldUseCredentialStorage, as opposed to appending to the end of the class definition to avoid increasing object size as clang will coalesces the two bools into a single machine word. Override ResourceHandleClient::willSendRequest() and ResourceHandleClient::willSendRequestAsync() to follow a redirect, if applicable. 2016-09-22 Daniel Bates [CSP] Violation report may be sent to wrong domain on frame-ancestors violation https://bugs.webkit.org/show_bug.cgi?id=162079 Reviewed by Andy Estes. Fixes an issue where a CSP violation report may be sent to the wrong domain when the frame-ancestors directive is violated. In particular, when the frame-ancestors directive is violated for a page that specifies a report URI that is a relative URL then the report URI would be resolved with respect to the parent frame's document URL and hence be sent to the domain of the parent frame's document. * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::reportViolation): Adjust the report URL with respect to the blocked URL when we do not have a script execution context. 2016-09-19 Anders Carlsson Suppress JavaScript prompts early on in certain cases https://bugs.webkit.org/show_bug.cgi?id=162243 rdar://problem/27661602 Reviewed by Geoffrey Garen. Export symbols needed by WebKit2. * loader/FrameLoader.h: * loader/FrameLoaderStateMachine.h: 2016-08-30 Youenn Fablet [Fetch API] Blob not found URL should result in a network error https://bugs.webkit.org/show_bug.cgi?id=161381 Reviewed by Sam Weinig. Covered by rebased and updated tests. Raising a network error if no blob can be found from the URL. It is no longer notified by a 404 response. Updated FileReaderLoader to generate the correct exception. Made some clean-up in the code, in particular adding an enum class for BlobResourceHandle errors. * fileapi/FileReaderLoader.cpp: (WebCore::FileReaderLoader::didFail): (WebCore::FileReaderLoader::toErrorCode): (WebCore::FileReaderLoader::httpStatusCodeToErrorCode): * fileapi/FileReaderLoader.h: * platform/network/BlobResourceHandle.cpp: (WebCore::BlobResourceHandle::loadResourceSynchronously): (WebCore::BlobResourceHandle::doStart): (WebCore::BlobResourceHandle::didGetSize): (WebCore::BlobResourceHandle::readSync): (WebCore::BlobResourceHandle::readFileSync): (WebCore::BlobResourceHandle::readAsync): (WebCore::BlobResourceHandle::didOpen): (WebCore::BlobResourceHandle::didRead): (WebCore::BlobResourceHandle::failed): (WebCore::BlobResourceHandle::notifyResponse): (WebCore::BlobResourceHandle::notifyResponseOnError): (WebCore::BlobResourceHandle::notifyFail): * platform/network/BlobResourceHandle.h: 2016-12-27 Michael Catanzaro [GTK] Improve user agent construction https://bugs.webkit.org/show_bug.cgi?id=142074 Reviewed by Carlos Garcia Campos. Use the macOS rather than the Chrome quirk for Google domains, to avoid problems with Google Calendar and Google Maps. * platform/UserAgentQuirks.cpp: (WebCore::urlRequiresChromeBrowser): (WebCore::urlRequiresMacintoshPlatform): 2016-11-28 Carlos Garcia Campos [GTK] Crash in WebCore::PlatformDisplayX11::supportsXComposite when running under Wayland https://bugs.webkit.org/show_bug.cgi?id=164917 Reviewed by Michael Catanzaro. WebKitGTK+ appplications are expected to call gtk_init(), because WebKitGTK+, like GTK+ itself, requires a display to work. We currently fallback to create a X11 display when X11 is enabled in cases where GTK+ doesn't have a default display (gtk_init() wasn't called or failed). That's why we end up creating an X11 display under Wayland when both Wayland and X11 option are enabled. The code assumes X11 display creation will always work if X11 is enabled, but that's not true now that we support also Wayland at runtime. So, we should try to get a native display before creating the PlatformDisplay. Rendering will not work in any case when gtk_init() is not called, but in most of the cases those applications are not actually going to render anything, so this way at least we will not crash. * platform/graphics/PlatformDisplay.cpp: (WebCore::PlatformDisplay::createPlatformDisplay): Use create() method for X11 and Wayland if we couldn't get a native display from GTK+. If everything fails create a display with no native. (WebCore::PlatformDisplay::PlatformDisplay): Add NativeDisplayOwned parameter. * platform/graphics/PlatformDisplay.h: * platform/graphics/wayland/PlatformDisplayWayland.cpp: (WebCore::PlatformDisplayWayland::create): Try to create a native Wayland display or return nullptr. (WebCore::PlatformDisplayWayland::PlatformDisplayWayland): Initialize NativeDisplayOwned parameter. (WebCore::PlatformDisplayWayland::~PlatformDisplayWayland): Destroy the display if owned. (WebCore::PlatformDisplayWayland::initialize): Return early if native display is nullptr. * platform/graphics/wayland/PlatformDisplayWayland.h: * platform/graphics/x11/PlatformDisplayX11.cpp: (WebCore::PlatformDisplayX11::create): Try to create a native X11 display or return nullptr. (WebCore::PlatformDisplayX11::PlatformDisplayX11): Use NativeDisplayOwned now. (WebCore::PlatformDisplayX11::~PlatformDisplayX11): Ditto. * platform/graphics/x11/PlatformDisplayX11.h: 2016-09-12 Carlos Garcia Campos [GTK] Crash of WebProcess on the last WebView disconnect (take two) https://bugs.webkit.org/show_bug.cgi?id=161842 Reviewed by Michael Catanzaro. The problem is that when PlatformDisplayX11 is destroyed, the sharing GL context is deleted and its destructor makes a downcast of PlatformDisplay to get the native X11 display. We could simply keep a pointer to the native X11 display in GLContextGLX, got at construction time from the PlatformDisplay, and ensure the sharing GL context is deleted before the native X11 display is closed. * platform/graphics/PlatformDisplay.h: Make m_sharingGLContext protected. * platform/graphics/glx/GLContextGLX.cpp: (WebCore::GLContextGLX::GLContextGLX): Initialize m_x11Display. (WebCore::GLContextGLX::~GLContextGLX): Use m_x11Display and remove confusing comment about possible crash with nviedia closed drivers. (WebCore::GLContextGLX::defaultFrameBufferSize): Use m_x11Display. (WebCore::GLContextGLX::makeContextCurrent): Ditto. (WebCore::GLContextGLX::swapBuffers): Ditto. (WebCore::GLContextGLX::swapInterval): Ditto. (WebCore::GLContextGLX::cairoDevice): Ditto. * platform/graphics/glx/GLContextGLX.h: * platform/graphics/x11/PlatformDisplayX11.cpp: (WebCore::PlatformDisplayX11::~PlatformDisplayX11): Delete the sharing GL context before closing the display. 2016-12-20 Carlos Garcia Campos [Cairo] Conditional jump or move depends on uninitialised value(s) https://bugs.webkit.org/show_bug.cgi?id=166058 Reviewed by Michael Catanzaro. Initialize x and y members of cairo_glyph_t struct before passing it to cairo_glyph_path. * platform/graphics/cairo/FontCairo.cpp: (WebCore::CairoGlyphToPathTranslator::path): 2016-11-13 Fujii Hironori [HarfBuzz] HarfBuzzShaper should not assume numGlyphs is greater than 0 https://bugs.webkit.org/show_bug.cgi?id=164500 Reviewed by Myles C. Maxfield. Test: fast/text/international/harfbuzz-runs-with-no-glyph.html HarfBuzzShaper assumes numGlyphs of HarfBuzzRun is greater than zero. But this is not necessarily true. If a font does not have a glyph of SPACE (U+0020), HarfBuzz removes ignorable glyphs. In this case, HarfBuzzRun can have no glyphs. * platform/graphics/harfbuzz/HarfBuzzShaper.cpp: (WebCore::HarfBuzzShaper::HarfBuzzRun::applyShapeResult): Resize m_offsets to one if m_numGlyphs is zero. * platform/graphics/harfbuzz/HarfBuzzShaper.h: (WebCore::HarfBuzzShaper::HarfBuzzRun::glyphs): Use Vector::data() instread of operator[0]. (WebCore::HarfBuzzShaper::HarfBuzzRun::advances): Ditto. (WebCore::HarfBuzzShaper::HarfBuzzRun::offsets): Ditto. (WebCore::HarfBuzzShaper::HarfBuzzRun::glyphToCharacterIndexes): Ditto. 2016-12-19 Miguel Gomez [GTK] GLXBadFBConfig error when creating an OpenGL context https://bugs.webkit.org/show_bug.cgi?id=165200 Reviewed by Carlos Garcia Campos. glXCreateContextAttribsARB causes a GLXBadFBConfig X error when it's not able to provide the OpenGL version >= 3.2 we are requesting. Due to this, the app crashes instead of falling back to the legacy path. The patch modifies GLX context creation using a XErrorTrapper, so the first time a context is created we don't crash if OpenGL >= 3.2 is not available. If the gotten context is not valid, we fall back to whatever version glXCreateContextAttribsARB is able to provide. The legacy glXCreateContext is only used if the GLX_ARB_create_context extension is not available. Covered by existent tests. * platform/graphics/glx/GLContextGLX.cpp: (WebCore::tryCreateGLXARBContext): (WebCore::GLContextGLX::createWindowContext): (WebCore::GLContextGLX::createPbufferContext): 2016-12-02 Miguel Gomez [GTK] Use an OpenGL < 3.0 compliant way to request the OpenGL version https://bugs.webkit.org/show_bug.cgi?id=165253 Reviewed by Carlos Garcia Campos. Use glGetString(GL_VERSION) to get the OpenGL version, as glGetIntegerv with GL_MAJOR_VERSION and GL_MINOR_VERSION is only supported from 3.0 on. Covered by existent tests. * platform/graphics/GLContext.cpp: (WebCore::GLContext::version): 2016-12-22 Michael Catanzaro [GTK] GLES build broken since r208997 https://bugs.webkit.org/show_bug.cgi?id=166455 Unreviewed. Fix the preprocessor guards here; this code is incompatible with GLES2. Looks like it's been broken for a month. Typical! * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp: (WebCore::Extensions3DOpenGLCommon::initializeAvailableExtensions): 2016-11-28 Miguel Gomez [GTK] Dramatic increase on memory usage since 2.14.x https://bugs.webkit.org/show_bug.cgi?id=164049 Reviewed by Žan Doberšek. Use OpenGL version 3.2 Core for rendering when available. Update some operations that have changed when using 3.2 Core: - Use glGetStringi to get the extensions list. - Do not use GL_POINT_SPRITE. - Always use a VAO when rendering. - Use a GLSL 1.50 compatible shader. No new tests needed. * platform/graphics/GLContext.cpp: (WebCore::GLContext::version): Add a method to get OpenGL version we are using. * platform/graphics/GLContext.h: Ditto. * platform/graphics/GraphicsContext3D.h: Add an attribute to store the VAO used for rendering. * platform/graphics/OpenGLShims.cpp: (WebCore::initializeOpenGLShims): Add glGetStringi to the list of functions. * platform/graphics/OpenGLShims.h: Ditto. * platform/graphics/cairo/GraphicsContext3DCairo.cpp: (WebCore::GraphicsContext3D::GraphicsContext3D): Set appropriate output to the shader compiler and initalize the VAO if needed. (WebCore::GraphicsContext3D::~GraphicsContext3D): Delete the VAO if needed. (WebCore::GraphicsContext3D::getExtensions): Use glGetExtensionsi for OpenGL versions >= 3.2. * platform/graphics/glx/GLContextGLX.cpp: (WebCore::hasGLXARBCreateContextExtension): Check whether the GLX_ARB_create_context extension is available. (WebCore::GLContextGLX::createWindowContext): Use glXCreateContextAttribsARB() if possible to request an OpenGL 3.2 context. (WebCore::GLContextGLX::createPbufferContext): Ditto. * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp: (WebCore::Extensions3DOpenGLCommon::initializeAvailableExtensions): Enable glGetStringi for GTK. * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: Do not use default getExtensions() method for GTK. * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp: Ditto. 2016-10-28 Alex Christensen Fix Windows WebGL build after r208022 https://bugs.webkit.org/show_bug.cgi?id=164091 * platform/graphics/opengl/Extensions3DOpenGLCommon.h: * platform/graphics/opengl/Extensions3DOpenGLES.cpp: (WebCore::Extensions3DOpenGLES::Extensions3DOpenGLES): * platform/graphics/opengl/Extensions3DOpenGLES.h: * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp: (WebCore::GraphicsContext3D::getExtensions): 2016-10-27 Alex Christensen Update ANGLE https://bugs.webkit.org/show_bug.cgi?id=164101 Reviewed by Darin Adler. ShCheckVariablesWithinPackingLimits has changed signatures from taking a ShVariableInfo* and length to taking a std::vector which requires more information about the shader variables than we kept in GraphicsContext3D::SymbolInfo. I removed the SymbolInfo class because it was redundant with ANGLE's sh::ShaderVariable and now unused. Covered by existing WebGL tests. * CMakeLists.txt: * PlatformMac.cmake: * PlatformWin.cmake: * platform/graphics/ANGLEWebKitBridge.cpp: (WebCore::appendSymbol): (WebCore::getStructInfo): (WebCore::getSymbolInfo): (WebCore::ANGLEWebKitBridge::compileShaderSource): * platform/graphics/ANGLEWebKitBridge.h: (WebCore::ANGLEShaderSymbol::isSampler): Deleted. * platform/graphics/GraphicsContext3D.h: (WebCore::GraphicsContext3D::SymbolInfo::SymbolInfo): Deleted. (WebCore::GraphicsContext3D::SymbolInfo::operator==): Deleted. * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp: (WebCore::Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE): * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: (WebCore::GraphicsContext3D::checkVaryingsPacking): (WebCore::GraphicsContext3D::precisionsMatch): (WebCore::GraphicsContext3D::mappedSymbolName): (WebCore::GraphicsContext3D::originalSymbolName): 2016-10-27 Myles C. Maxfield [macOS] [WebGL2] Temporarily upgrade WebGL 2's internal OpenGL context from version 2.1 to 3.2 https://bugs.webkit.org/show_bug.cgi?id=164091 Reviewed by Dean Jackson. In order to test WebGL2 correctly, I had to upgrade the macOS's OpenGL context to a 3.2-compatible context to make sure the new symbols are accepted. Eventually, this 3.2-compatible context will have to be reverted and replaced with an ANGLE context. The current 3.2-compatible context is just for testing. Test: fast/canvas/webgl/webgl2-context-creation.html * html/canvas/WebGLBuffer.cpp: Use "nullptr" instead of 0. (WebCore::WebGLBuffer::associateBufferData): * html/canvas/WebGLRenderingContextBase.cpp: Use make_unique() instead of the unique_ptr constructor. (WebCore::WebGLRenderingContextBase::create): * platform/graphics/GraphicsContext3D.h: GraphicsContext should know if it is using a 3.2-compatible context because some parts of 2.1 are removed in these contexts, and replaced with new things which aren't in 2.1. * platform/graphics/mac/GraphicsContext3DMac.mm: (WebCore::setPixelFormat): Use kCGLPFAOpenGLProfile to specify an OpenGL 3.2 context. (WebCore::GraphicsContext3D::GraphicsContext3D): GL_CLAMP is deprecated in OpenGL 3.2. Fortunately, GL_CLAMP_TO_EDGE isn't deprecated and does exactly what we want. In OpenGL3.2, point sprites are always enabled, so there's no need to enable them in those contexts. (WebCore::GraphicsContext3D::isGLES2Compliant): * platform/graphics/opengl/Extensions3DOpenGL.cpp: In OpenGL 3.2, glGetString() no longer accepts GL_EXTENSIONS. Instead, glGetStringi() is used instead. Unfortunately, glGetString() is not available in OpenGL 2.1 contexts, so we need to use one or the other based on the version of the context we're using. (WebCore::Extensions3DOpenGL::Extensions3DOpenGL): (WebCore::Extensions3DOpenGL::getExtensions): * platform/graphics/opengl/Extensions3DOpenGL.h: * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp: (WebCore::Extensions3DOpenGLCommon::Extensions3DOpenGLCommon): (WebCore::Extensions3DOpenGLCommon::initializeAvailableExtensions): Instead of modifying getExtensions() to use glGetStringi(), it makes better sense to modify this function because getExtensions() returns a string. Building up a string just to split it up again is silly, so modifying this function instead makes more sense. * platform/graphics/opengl/Extensions3DOpenGLCommon.h: * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: (WebCore::GraphicsContext3D::getIntegerv): GL_MAX_VARYING_FLOATS is removed in OpenGL 3.2 contexts. However, it is replaced by GL_MAX_VARYING_COMPONENTS, though this is deprecated but not removed. In the more recent OpenGL context versions, GL_MAX_VARYING_VECTORS is recommended instead, but that isn't available in OpenGL 3.2. (WebCore::GraphicsContext3D::getExtensions): 2016-10-21 Miguel Gomez [GTK] Several tests crashing on debug bot in (anonymous namespace)::MediaPlayerPrivateGStreamerBase::repaint https://bugs.webkit.org/show_bug.cgi?id=163511 Reviewed by Carlos Garcia Campos. Perform the video repaint in the main thread when accelerated compositing is disabled. Added a new method to MediaPlayerClient to get whether accelerated compositing is enabled from the MediaPlayer. This is needed because mediaPlayerAcceleratedCompositingEnabled() will return false while HTMLMediaElement doesn't have a RenderVideo, even when accelerated compositing is enabled. Covered by existent tests. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::mediaPlayerAcceleratedCompositingEnabled): * html/HTMLMediaElement.h: * platform/graphics/MediaPlayer.h: (WebCore::MediaPlayerClient::mediaPlayerAcceleratedCompositingEnabled): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase): (WebCore::MediaPlayerPrivateGStreamerBase::repaint): (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: 2016-10-13 Miguel Gomez [GTK] Video playback doesn't work properly with accelerated compositing disabled https://bugs.webkit.org/show_bug.cgi?id=163386 Reviewed by Carlos Garcia Campos. Trigger a repaint of the player when a new frame arrives and accelerated compositing is disabled. Covered by existent tests. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint): 2016-09-07 Carlos Garcia Campos [GTK] Crash of WebProcess on the last WebView disconnect https://bugs.webkit.org/show_bug.cgi?id=161605 Reviewed by Michael Catanzaro. Stop tracking X11 GL contexts to be cleanered on an exit handler. This was added to work around bugs on drivers, and it's assuming that all GLContext not deleted when the exit handler is called are leaked, which is no longer true, because PlatformDisplay now owns a GLContext and is deleted after exit handlers. * platform/graphics/GLContext.cpp: (WebCore::GLContext::GLContext): (WebCore::GLContext::~GLContext): (WebCore::activeContextList): Deleted. (WebCore::GLContext::addActiveContext): Deleted. (WebCore::GLContext::removeActiveContext): Deleted. (WebCore::GLContext::cleanupActiveContextsAtExit): Deleted. 2016-09-13 Dean Jackson Remove a .rej file. * animation/DocumentTimeline.h.rej: Removed. 2016-10-25 Daniel Bates REGRESSION (r178265): XSS Auditor fails to block document.write() of incomplete tag https://bugs.webkit.org/show_bug.cgi?id=163978 Reviewed by Darin Adler. During the tokenization process of an HTML tag the start and end positions of each of its attributes is tracked so that the XSS Auditor can request a snippet around a suspected injected attribute. We need to take care to consider document.write() boundaries when tracking the start and end positions of each HTML tag and attribute so that the XSS Auditor receives the correct snippet. Following r178265 we no longer consider document.write() boundaries when tracking the start and end positions of attributes. So, the substring represented by the start and end positions of an attribute may correspond to some other attribute in the tag. Therefore the XSS Auditor may fail to block an injection because the snippet it requested may not be the snippet that it intended to request. Tests: http/tests/security/xssAuditor/dom-write-location-dom-write-open-img-onerror.html http/tests/security/xssAuditor/dom-write-location-open-img-onerror.html http/tests/security/xssAuditor/nested-dom-write-location-open-img-onerror.html * html/parser/HTMLSourceTracker.cpp: (WebCore::HTMLSourceTracker::startToken): Set the attribute base offset to be the token start position. (WebCore::HTMLSourceTracker::source): Use the specified attribute start position as-is. We no longer adjust it here because it was adjusted with respect to the attribute base offset, which takes into account document.write() boundaries. * html/parser/HTMLToken.h: (WebCore::HTMLToken::setAttributeBaseOffset): Added. (WebCore::HTMLToken::beginAttribute): Subtract attribute base offset from the specified offset. (WebCore::HTMLToken::endAttribute): Ditto. * html/parser/HTMLTokenizer.h: (WebCore::HTMLTokenizer::setTokenAttributeBaseOffset): Added. 2016-10-24 Zalan Bujtas Do not update selection rect on dirty lineboxes. https://bugs.webkit.org/show_bug.cgi?id=163862 Reviewed by Simon Fraser. In certain cases RenderBlock::updateFirstLetter() triggers unwanted render tree mutation while the caller assumes intact renderers. This patch ensures that no renderers gets destroyed while computing the preferred widths when we are outside of layout context. Test: fast/css-generated-content/dynamic-first-letter-selection-clear-crash.html * rendering/RenderBlock.cpp: (WebCore::RenderBlock::computePreferredLogicalWidths): (WebCore::RenderBlock::updateFirstLetter): * rendering/RenderBlock.h: * rendering/RenderListItem.cpp: (WebCore::RenderListItem::insertOrMoveMarkerRendererIfNeeded): * rendering/RenderRubyRun.cpp: (WebCore::RenderRubyRun::updateFirstLetter): * rendering/RenderRubyRun.h: * rendering/RenderTable.cpp: (WebCore::RenderTable::updateFirstLetter): * rendering/RenderTable.h: * rendering/svg/RenderSVGText.cpp: (WebCore::RenderSVGText::updateFirstLetter): * rendering/svg/RenderSVGText.h: 2016-10-21 Zalan Bujtas Do not mutate the render tree while collecting selection repaint rects. https://bugs.webkit.org/show_bug.cgi?id=163800 Reviewed by David Hyatt. RenderListItem not only mutates the tree while in layout but it also uses the old descendant context to find the insertion point. This patch strictly ensures that we only do it while in layout and never in other cases such as collecting repaint rects. This gets redundant when webkit.org/b/163789 is fixed. Test: fast/lists/crash-when-list-marker-is-moved-during-selection.html * rendering/RenderListItem.cpp: (WebCore::RenderListItem::insertOrMoveMarkerRendererIfNeeded): 2016-10-20 Carlos Garcia Campos [GTK] Configures but fails to link with ENABLE_OPENGL=OFF https://bugs.webkit.org/show_bug.cgi?id=163449 Reviewed by Michael Catanzaro. Only define sharingGLContext in PlatformDisplay if EGL or GLX are enabled. * platform/graphics/PlatformDisplay.cpp: * platform/graphics/PlatformDisplay.h: * platform/graphics/wayland/PlatformDisplayWayland.cpp: (WebCore::PlatformDisplayWayland::initialize): * platform/graphics/x11/PlatformDisplayX11.cpp: (WebCore::PlatformDisplayX11::~PlatformDisplayX11): 2016-10-20 Zalan Bujtas Stop searching for first-letter containers at multi-column boundary. https://bugs.webkit.org/show_bug.cgi?id=163739 We should not cross the multi-column boundary while searching for the first-letter container. While moving first-letter renderers to a multi-column parent, it could result in finding the wrong container and end up adding a new wrapper under the original container (from where we are moving the renderers). Reviewed by David Hyatt. Test: fast/css-generated-content/first-letter-move-to-multicolumn-crash.html * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::moveChildrenTo): * rendering/RenderTextFragment.cpp: (WebCore::RenderTextFragment::blockForAccompanyingFirstLetter): 2016-10-20 Carlos Alberto Lopez Perez [GTK] Build fix after r207616 https://bugs.webkit.org/show_bug.cgi?id=163333 Reviewed by Carlos Garcia Campos. EGL_PLATFORM_X11_KHR and EGL_PLATFORM_WAYLAND_KHR are not defined on the EGL headers shipped by Mesa 10.3 (shipped by Debian 8) * platform/graphics/wayland/PlatformDisplayWayland.cpp: (WebCore::PlatformDisplayWayland::initialize): * platform/graphics/x11/PlatformDisplayX11.cpp: (WebCore::PlatformDisplayX11::initializeEGLDisplay): 2016-10-20 Adam Jackson Prefer eglGetPlatformDisplay to eglGetDisplay https://bugs.webkit.org/show_bug.cgi?id=163333 Reviewed by Carlos Garcia Campos. eglGetDisplay forces the implementation to guess what kind of void* it's been handed. Different implementations do different things, in particular glvnd and Mesa behave differently. Fortunately there exists API to tell EGL what kind of display it is, so let's use it. * platform/graphics/wayland/PlatformDisplayWayland.cpp: (WebCore::PlatformDisplayWayland::initialize): * platform/graphics/x11/PlatformDisplayX11.cpp: (WebCore::PlatformDisplayX11::initializeEGLDisplay): 2016-10-20 Carlos Garcia Campos [GTK] Avoid including egl.h headers in internal headers https://bugs.webkit.org/show_bug.cgi?id=163722 Reviewed by Žan Doberšek. egl.h includes eglplatform.h that decides the native types for the platform at compile time. However, we support to build with X11 and Wayland at the same time and decide what to use at runtime. Currently GLContext.h includes eglplatform.h after wayland-egl.h if Wayland is enabled. That means that the wayland native types are used by default from all cpp files including GLContext.h. It currently works in X11 because we cast the value anyway and for example EGLNativeWindowType is a pointer in Wayland that can be casted to unsigned long in X11 to represent the X Window. This is very fragile in any case, we should avoid adding egl headers in our headers and only include it in cpp files. But we also need to ensure we don't use X11 and Wayland in the same cpp file. * PlatformGTK.cmake: * platform/graphics/GLContext.cpp: (WebCore::GLContext::createContextForWindow): * platform/graphics/GLContext.h: * platform/graphics/egl/GLContextEGL.cpp: (WebCore::GLContextEGL::createWindowContext): (WebCore::GLContextEGL::createContext): (WebCore::GLContextEGL::~GLContextEGL): * platform/graphics/egl/GLContextEGL.h: * platform/graphics/egl/GLContextEGLWayland.cpp: Added. (WebCore::GLContextEGL::GLContextEGL): (WebCore::GLContextEGL::createWindowSurfaceWayland): (WebCore::GLContextEGL::createWaylandContext): (WebCore::GLContextEGL::destroyWaylandWindow): * platform/graphics/egl/GLContextEGLX11.cpp: Added. (WebCore::GLContextEGL::GLContextEGL): (WebCore::GLContextEGL::createWindowSurfaceX11): (WebCore::GLContextEGL::createPixmapContext): * platform/graphics/glx/GLContextGLX.cpp: (WebCore::GLContextGLX::createWindowContext): (WebCore::GLContextGLX::createContext): (WebCore::GLContextGLX::GLContextGLX): * platform/graphics/glx/GLContextGLX.h: * platform/graphics/wayland/PlatformDisplayWayland.cpp: * platform/graphics/x11/PlatformDisplayX11.cpp: 2016-10-20 Carlos Garcia Campos [GTK] Avoid strstr() when checking (E)GL extensions https://bugs.webkit.org/show_bug.cgi?id=161958 Reviewed by Žan Doberšek. Add static method GLContext::isExtensionSupported() to properly search extenstions in the given extension list, and use it instead of strstr(). * platform/graphics/GLContext.cpp: (WebCore::GLContext::isExtensionSupported): * platform/graphics/GLContext.h: * platform/graphics/egl/GLContextEGL.cpp: (WebCore::GLContextEGL::createSurfacelessContext): * platform/graphics/glx/GLContextGLX.cpp: (WebCore::hasSGISwapControlExtension): 2016-10-20 Carlos Garcia Campos Wrong use of EGL_DEPTH_SIZE https://bugs.webkit.org/show_bug.cgi?id=155536 Reviewed by Michael Catanzaro. What happens here is that the driver doesn't implement EGL_DEPTH_SIZE and the default value, which is 0, is returned. Then XCreatePixmap fails because 0 is not a valid depth. The thing is that even if EGL_DEPTH_SIZE or EGL_BUFFER_SIZE returned a valid depth, it still might not be supported by the default screen and XCreatePixmap can fail. What we need to ensure is that the depth we pass is compatible with the X display, not only with the EGL config, to avoid failures when creating the pixmap. So, we can use EGL_NATIVE_VISUAL_ID instead, and then ask X for the visual info for that id. If it isn't found then we just return before creating the pixmap, but if the visual is found then we can be sure that the depth of the visual will not make the pixmap creation fail. However, with the driver I'm using it doesn't matter how we create the pixmap that eglCreatePixmapSurface always fails, again with X errors that are fatal by default. Since the driver is not free, I assume it doesn't support eglCreatePixmapSurface or it's just buggy, so the only option we have here is trap the x errors and ignore them. It turns out that the X errors are not fatal in this case, because eglCreatePixmapSurface ends up returning a surface, and since these are offscreen contexts, it doesn't really matter if they contain an invalid pixmap, because we never do swap buffer on them, so just ignoring the X errors fixes the crashes and makes everythig work. This patch adds a helper class XErrorTrapper that allows to trap XErrors and decide what to do with them (ignore, warn or crash) or even not consider a particular set of errors as errors. * PlatformEfl.cmake: Add new file to compilation. * PlatformGTK.cmake: Ditto. * platform/graphics/egl/GLContextEGL.cpp: (WebCore::GLContextEGL::createPixmapContext): Use EGL_NATIVE_VISUAL_ID instead of EGL_DEPTH_SIZE to figure out the depth to be passed to XCreatePixmap. Also use the XErrorTrapper class to ignore all BadDrawable errors produced by eglCreatePixmapSurface() and only show a warning about all other X errors. * platform/graphics/x11/XErrorTrapper.cpp: Added. (WebCore::xErrorTrappersMap): (WebCore::XErrorTrapper::XErrorTrapper): (WebCore::XErrorTrapper::~XErrorTrapper): (WebCore::XErrorTrapper::errorCode): (WebCore::XErrorTrapper::errorEvent): * platform/graphics/x11/XErrorTrapper.h: Added. (WebCore::XErrorTrapper::XErrorTrapper): 2016-10-19 Zalan Bujtas Use anonymous table row for new child at RenderTableRow::addChild() if available. https://bugs.webkit.org/show_bug.cgi?id=163651 Reviewed by David Hyatt. We should try to prevent the continuation siblings from getting separated and inserted into wrapper renderers. It makes finding these continuation siblings difficult. This patch adds a checks for anonymous table rows so that we could find a closer common ancestor of beforeChild/new child. Test: fast/table/crash-when-table-has-continuation-and-content-inserted.html * rendering/RenderObject.cpp: (WebCore::RenderObject::showRenderObject): Add continuation information. * rendering/RenderTableRow.cpp: (WebCore::RenderTableRow::addChild): 2016-10-18 Brent Fulgham Correct Document::removeAllEventListeners https://bugs.webkit.org/show_bug.cgi?id=163558 Reviewed by Chris Dumez. Tested by fast/dom/node-move-to-new-document-crash-main.html. * dom/Document.cpp: (WebCore::Document::removeAllEventListeners): Clear out the wheel and touch event targets when clearing all data. 2016-10-18 Said Abou-Hallawa SVGCSSParser: m_implicitShorthand value is not reset after adding the shorthand property https://bugs.webkit.org/show_bug.cgi?id=116470 Reviewed by Simon Fraser. When we encounter a shorthand css property, we set m_implicitShorthand to true to tell addProperty() later that the individual properties are all set through a short hand one. We need to make sure that setting m_implicitShorthand to true will not be leaked after finishing parsing the short hand property. Test: fast/css/implicit-property-restore.html * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseValue): (WebCore::CSSParser::parseFillShorthand): (WebCore::CSSParser::parseShorthand): (WebCore::CSSParser::parse4Values): (WebCore::CSSParser::parseBorderRadius): (WTF::ImplicitScope::ImplicitScope): Deleted. (WTF::ImplicitScope::~ImplicitScope): Deleted. Get rid of ImplicitScope and replace its calls by TemporaryChange. * css/parser/SVGCSSParser.cpp: (WebCore::CSSParser::parseSVGValue): Restore m_implicitShorthand value after setting it temporarily to true. 2016-10-17 Alberto Garcia [GTK] gobject-introspection on package build with webkit2gtk fails without active X session https://bugs.webkit.org/show_bug.cgi?id=163105 Reviewed by Carlos Garcia Campos. Don't call XCompositeQueryExtension() or XDamageQueryExtension() if m_display is NULL. * platform/graphics/x11/PlatformDisplayX11.cpp: (WebCore::PlatformDisplayX11::supportsXComposite): (WebCore::PlatformDisplayX11::supportsXDamage): 2016-10-16 Carlos Garcia Campos Document request not updated after willSendRequest is called for a redirect https://bugs.webkit.org/show_bug.cgi?id=163436 Reviewed by Michael Catanzaro. The first willSendRequest happens before DocumentLoader::startLoadingMainResource(), that calls setRequest, but the second one happens after DocumentLoader::redirectReceived() and then the request is never updated again. Covered by GTK+ unit tests. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willContinueMainResourceLoadAfterRedirect): Set the new request. * loader/DocumentLoader.h: * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::willSendRequestInternal): Notify the document loader when loading the main resource and called for a redirection. 2016-10-15 Michael Catanzaro [GTK] Restore user agent quirk for Yahoo https://bugs.webkit.org/show_bug.cgi?id=163481 Reviewed by Carlos Garcia Campos. finance.yahoo.com is sending a mobile version in response to our standard user agent. * platform/gtk/UserAgentGtk.cpp: (WebCore::urlRequiresMacintoshPlatform): 2016-10-15 Zalan Bujtas CounterNode::resetRenderers is so inefficient. https://bugs.webkit.org/show_bug.cgi?id=163480 Reviewed by Simon Fraser. CounterNode::resetRenderers() removes all the associated renderers from this CounterNode and sets the dirty bit on them. This patch does all that in a loop, instead of traversing the linked tree on each removal. No change in functionality. * rendering/CounterNode.cpp: (WebCore::CounterNode::CounterNode): (WebCore::CounterNode::~CounterNode): (WebCore::CounterNode::nextInPreOrderAfterChildren): (WebCore::CounterNode::lastDescendant): (WebCore::CounterNode::addRenderer): These assertions do not seem super useful. (WebCore::CounterNode::removeRenderer): (WebCore::CounterNode::resetRenderers): (WebCore::CounterNode::insertAfter): (WebCore::CounterNode::removeChild): * rendering/CounterNode.h: * rendering/RenderCounter.cpp: (WebCore::makeCounterNode): (WebCore::RenderCounter::RenderCounter): (WebCore::RenderCounter::~RenderCounter): (WebCore::RenderCounter::originalText): (WebCore::updateCounters): (WebCore::RenderCounter::invalidate): Deleted. * rendering/RenderCounter.h: 2016-10-14 Antti Koivisto 100% CPU on homedepot.com page https://bugs.webkit.org/show_bug.cgi?id=163452 Reviewed by Simon Fraser. The site has a keyframe animation on body. Currently this causes the animation to invalidate the style of the entire document. Animations use SyntheticStyleChange to invalidate elements when animation progresses and currently that causes full subtree invalidation. However animation only ever affect individual elements and the normal style resolution mechanism should be able to deal with things like inheritance as needed. Test: fast/animation/animation-style-update-size.html * dom/Document.cpp: (WebCore::Document::recalcStyle): * dom/Document.h: (WebCore::Document::lastStyleUpdateSizeForTesting): Testing support. * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::resolveElement): Don't force subtree style resolution for SyntheticStyleChange. * style/StyleUpdate.h: (WebCore::Style::Update::size): * testing/Internals.cpp: (WebCore::Internals::lastStyleUpdateSize): * testing/Internals.h: * testing/Internals.idl: 2016-10-13 Carlos Garcia Campos WebView and WebPage URLs not updated after URL is modified by InjectedBundlePageResourceLoadClient::willSendRequestForFrame https://bugs.webkit.org/show_bug.cgi?id=146306 Reviewed by Darin Adler. Notify about the provisional URL change when new request set for main resource load in DocumentLoader has a different URL than the previous one. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::setRequest): 2016-10-13 Zalan Bujtas [Clean RenderTree] LayoutTests/imported/blink/fast/table/crash-bad-child-table-continuation.html fails. https://bugs.webkit.org/show_bug.cgi?id=163399 Reviewed by David Hyatt. When we try to insert a renderer before a child whose direct parent is a (anonymus) RenderTable, continuation logic should dismiss the RenderTable as the parent and find a more appropriate ancestor. RenderTables assumes a certain descendant tree structure which might not be available in the continuation. Will be testable with webkit.org/b/162834 * rendering/RenderInline.cpp: (WebCore::canUseAsParentForContinuation): (WebCore::RenderInline::addChildToContinuation): 2016-10-07 Ryosuke Niwa REGRESSION(r165103): labels list doesn't get invalidated when other lists are invalidated at document level https://bugs.webkit.org/show_bug.cgi?id=163145 Reviewed by Darin Adler. The bug was caused by Document::invalidateNodeListAndCollectionCaches removing all node lists regardless of whether they have been invalidated or not. Fixed the bug by removing only those node lists that got invalidated via LiveNodeList::invalidateCache. Test: fast/dom/NodeList/form-labels-length.html * dom/Document.cpp: (WebCore::Document::Document): (WebCore::Document::unregisterNodeListForInvalidation): Removed the conditional which allowed removal to happen while m_listsInvalidatedAtDocument is empty inside invalidateNodeListAndCollectionCaches. * dom/Document.h: * dom/Node.cpp: (WebCore::Document::invalidateNodeListAndCollectionCaches): Just remove the node lists being invalidated via LiveNodeList's invalidateCache, which calls unregisterNodeListForInvalidation, instead of removing them all. We make a copy of the list of node lists into a local vector because mutating HashMap while iterating over it is not a safe operation. 2016-10-07 Brent Fulgham EventHandler functions that need to guarantee event handler lifetime need to use Ref https://bugs.webkit.org/show_bug.cgi?id=98617 Reviewed by Daniel Bates. Improve stability by ensuring that the Frame holding an active EventHandler is kept alive while in the process of handling events and executing JavaScript. No new tests since there is no change in behavior. * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEventSingleClick): Protect the Frame with a Ref<>. (WebCore::EventHandler::handleMousePressEvent): Ditto. (WebCore::EventHandler::handleMouseDraggedEvent): Ditto. (WebCore::EventHandler::eventMayStartDrag): Ditto. (WebCore::EventHandler::handleMouseReleaseEvent): Ditto. (WebCore::EventHandler::hitTestResultAtPoint): Ditto. (WebCore::EventHandler::scrollRecursively): Ditto. (WebCore::EventHandler::logicalScrollRecursively): Ditto. (WebCore::EventHandler::selectCursor): Ditto. (WebCore::EventHandler::handleMouseDoubleClickEvent): Ditto. (WebCore::EventHandler::mouseMoved): Ditto. (WebCore::EventHandler::handleMouseMoveEvent): Ditto. (WebCore::EventHandler::handleMouseForceEvent): Ditto. (WebCore::EventHandler::dispatchDragEvent): Ditto. (WebCore::EventHandler::updateDragAndDrop): Ditto. (WebCore::EventHandler::cancelDragAndDrop): Ditto. (WebCore::EventHandler::performDragAndDrop): Ditto. (WebCore::EventHandler::prepareMouseEvent): Ditto. (WebCore::EventHandler::updateMouseEventTargetNode): Ditto. (WebCore::EventHandler::dispatchMouseEvent): Ditto. (WebCore::EventHandler::platformCompleteWheelEvent): Ditto. (WebCore::EventHandler::handleWheelEvent): Ditto. (WebCore::EventHandler::defaultWheelEventHandler): Ditto. (WebCore::EventHandler::sendContextMenuEvent): Ditto. (WebCore::EventHandler::sendContextMenuEventForKey): Ditto. (WebCore::EventHandler::hoverTimerFired): Ditto. (WebCore::EventHandler::keyEvent): Ditto. (WebCore::EventHandler::defaultKeyboardEventHandler): Ditto. (WebCore::EventHandler::handleDrag): Ditto. (WebCore::EventHandler::handleTextInputEvent): Ditto. (WebCore::EventHandler::defaultSpaceEventHandler): Ditto. (WebCore::EventHandler::defaultTabEventHandler): Ditto. (WebCore::EventHandler::sendScrollEvent): Ditto. (WebCore::EventHandler::handleTouchEvent): Ditto. * page/ios/EventHandlerIOS.mm: (WebCore::EventHandler::focusDocumentView): Ditto. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::platformCompleteWheelEvent): Ditto. 2016-10-07 Andreas Kling [WK2] didRemoveFrameFromHierarchy callback doesn't fire for subframes when evicting from PageCache. Reviewed by Antti Koivisto. Fix a bug where WK2 didRemoveFrameFromHierarchy callbacks wouldn't fire for subframes that were getting kicked out of PageCache. The problem was happening because CachedFrame would disconnect the Frame from its Page just before calling FrameLoader::detachViewsAndDocumentLoader() where the callbacks are fired. Without a Page, the WebFrame on WK2 side can't find its WebPage, and so it can't fire its callbacks. The fix is just to switch the order of those two lines. This bug was causing frequent DOM and window object leaks in some clients *cough* Safari *cough* that were relying on didRemoveFrameFromHierarchy to release their isolated worlds. Test: WebKit2.DidRemoveFrameFromHiearchyInPageCache * history/CachedFrame.cpp: (WebCore::CachedFrame::destroy): 2016-10-07 Zalan Bujtas https://vuldb.com/?cvssv3.2012 takes long time to load. https://bugs.webkit.org/show_bug.cgi?id=162994 Reviewed by Darin Adler. Stop visiting cousins when we hit the style sharing search threshold. In addition to mistakenly ignoring the threshold at SharingResolver::findSibling(), we continued on searching for cousin elements. Test: fast/selectors/slow-style-sharing-with-long-cousin-list.html * style/StyleSharingResolver.cpp: (WebCore::Style::SharingResolver::resolve): (WebCore::Style::SharingResolver::findSibling): (WebCore::Style::SharingResolver::locateCousinList): 2016-10-07 Gwang Yoon Hwang [GTK] Remove unneeded creation of TextureMapperPlatformLayerProxy https://bugs.webkit.org/show_bug.cgi?id=163101 Reviewed by Žan Doberšek. Covered by existing tests. * platform/graphics/cairo/ImageBufferCairo.cpp: (WebCore::ImageBufferData::ImageBufferData): Modified not to create TextureMapperPlatformLayerProxy if it is not created for the accelerated 2d canvas. 2016-10-05 Zalan Bujtas Missing quotation mark when gets reparented. https://bugs.webkit.org/show_bug.cgi?id=162940 Reviewed by Darin Adler. When an opening RenderQuote gets removed due to some change in the render tree, we notify the closing RenderQuote so that it can update its content (") accordingly (and vice versa). However when the same RenderQuote is added back to the render tree (aka reparenting), we fail to let the other RenderQuote know about it and its content becomes stale. This patch ensures that when either the opening or closing part of the quotation mark gets reparented, we inform the other, corresponding opening/closing renderer about it. Test: fast/css-generated-content/missing-quotes-with-dynamic-content.html * dom/PseudoElement.cpp: (WebCore::PseudoElement::didAttachRenderers): * rendering/RenderQuote.cpp: (WebCore::RenderQuote::insertedIntoTree): * rendering/RenderQuote.h: 2016-10-03 Zalan Bujtas [ListItems] Render tree should be all clean by the end of FrameView::layout(). https://bugs.webkit.org/show_bug.cgi?id=162832 Reviewed by Simon Fraser. List item markers are inserted into the tree during layout, right before laying out the list item (that's a big FIXME). At this point we already know what part of the tree needs to be laid out. Inserting a list item marker does not expand this dirty area. However whenever we insert a new renderer into the tree, we call setNeedsLayout on the contining block chain. In certain cases (floating renderers), it could potentially trigger some unintentional markings and we return from FrameView::layout() with a dirty subtree. This patch preemptively marks the list item and its marker dirty so that when the marker is getting inserted into the tree, we stop the marking at the parent. Not testable. * rendering/RenderListItem.cpp: (WebCore::RenderListItem::insertOrMoveMarkerRendererIfNeeded): 2016-10-04 Carlos Garcia Campos [SOUP] Remove SSLPolicyFlags from SoupNetworkSession https://bugs.webkit.org/show_bug.cgi?id=162906 Reviewed by Michael Catanzaro. All soup based ports are setting SSLUseSystemCAFile flag unconditionally, so we can just use that when creating the session like we do for all other construct parameters. * platform/network/soup/SoupNetworkSession.cpp: (WebCore::SoupNetworkSession::createTestingSession): (WebCore::SoupNetworkSession::setupLogger): (WebCore::SoupNetworkSession::SoupNetworkSession): Deleted. (WebCore::SoupNetworkSession::clearOldSoupCache): Deleted. (WebCore::SoupNetworkSession::setHTTPProxy): Deleted. * platform/network/soup/SoupNetworkSession.h: (WebCore::SoupNetworkSession::soupSession): Deleted. 2016-10-03 Brent Fulgham Avoid null dereference when changing focus in design mode. https://bugs.webkit.org/show_bug.cgi?id=162877 Reviewed by Chris Dumez. The bare m_frame pointer in DOMWindow can be cleared when setting focus to a new element. Check that the m_frame pointer is non-null before using it after calling a routine that could clear the pointer value. Test: fast/frames/iframe-focus-crash.html * page/DOMWindow.cpp: (WebCore::DOMWindow::focus): Check that the pointer is still non-null after setting the current focused element to nullptr. 2016-10-03 Carlos Garcia Campos Unreviewed. Fix the build with coordinated graphics enabled after r206712. * page/scrolling/ScrollingStateTree.cpp: (WebCore::ScrollingStateTree::attachNode): 2016-10-01 Simon Fraser Bad cast when CSS position programmatically changed from -webkit-sticky to fixed https://bugs.webkit.org/show_bug.cgi?id=160826 Reviewed by Zalan Bujtas. If a scrolling state tree node changed type (e.g. from sticky to fixed), we'd fail to recreate the node so keep a node with the wrong type. Fix by destroying the node and making a new one with a new ID in this case. The new ID is necessary to ensure that the scrolling tree is updated. Test: fast/scrolling/sticky-to-fixed.html * page/scrolling/ScrollingStateTree.cpp: (WebCore::ScrollingStateTree::nodeTypeAndParentMatch): (WebCore::ScrollingStateTree::attachNode): (WebCore::ScrollingStateTree::stateNodeForID): * page/scrolling/ScrollingStateTree.h: 2016-09-30 Joonghun Park [EFL] Fix build break since r206661. Unreviewed https://bugs.webkit.org/show_bug.cgi?id=162825 No new tests, no new behaviours. * rendering/RenderLayer.cpp: (WebCore::ClipRects::ClipRects): 2016-09-30 Zalan Bujtas Remove ClipRects's custom refcounting. https://bugs.webkit.org/show_bug.cgi?id=162798 Reviewed by Simon Fraser. It's safer to use RefCounted<>. No change in functionality. * rendering/RenderLayer.cpp: (WebCore::ClipRects::ClipRects): (WebCore::ClipRectsCache::getClipRects): (WebCore::ClipRectsCache::setClipRects): (WebCore::ClipRectsCache::getIndex): (WebCore::RenderLayer::updateClipRects): (WebCore::ClipRects::ref): Deleted. (WebCore::ClipRects::deref): Deleted. 2016-09-30 Zalan Bujtas RenderLayer::clipRects may return nullptr. https://bugs.webkit.org/show_bug.cgi?id=162729 Reviewed by Chris Dumez. This patch refactors RenderLayer::updateClipRects(), parentClipRects() and backgroundClipRect() so that we don't have to rely on this seemingly unsafe line: clipRects = *parent()->clipRects(clipRectsContext); Now updateClipRects() returns the computed/cached clip rects as opposed to update and refetch them. While this patch makes the code look more readable/safer, it also eliminates cached item tripple retrievals. No change in functionality. * rendering/RenderLayer.cpp: (WebCore::ClipRectsCache::getClipRects): (WebCore::ClipRectsCache::setClipRects): (WebCore::RenderLayer::updateClipRects): (WebCore::RenderLayer::clipRects): (WebCore::RenderLayer::calculateClipRects): * rendering/RenderLayer.h: 2016-09-29 Simon Fraser Fix hit testing on display:block elements https://bugs.webkit.org/show_bug.cgi?id=162717 rdar://problem/23261130 Reviewed by Zalan Bujtas. RenderSVGRoot::nodeAtPoint() needs to test for both the HitTestBlockBackground and HitTestChildBlockBackground phases, since we only get the HitTestChildBlockBackground phase when the is a block. This is similar to code in RenderTable::nodeAtPoint(), and matches Blink code. This fixes the point dragging on http://anthonydugois.com/svg-path-builder/. Test: svg/hittest/block-svg.html * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::nodeAtPoint): 2016-10-05 Michael Catanzaro [GTK] Bump Chrome version in Chrome user agent quirk https://bugs.webkit.org/show_bug.cgi?id=162984 Reviewed by Carlos Garcia Campos. * platform/gtk/UserAgentGtk.cpp: (WebCore::buildUserAgentString): 2016-10-05 Michael Catanzaro [GTK] Improve OS X UA quirk https://bugs.webkit.org/show_bug.cgi?id=162613 Reviewed by Carlos Garcia Campos. Include OS X version number in user agent, like Safari does. * platform/gtk/UserAgentGtk.cpp: (WebCore::buildUserAgentString): 2016-10-05 Michael Catanzaro [GTK] Improve comment in platformVersionForUAString https://bugs.webkit.org/show_bug.cgi?id=162612 Reviewed by Carlos Garcia Campos. * platform/gtk/UserAgentGtk.cpp: (WebCore::platformVersionForUAString): 2016-09-28 Michael Catanzaro [GTK] Add Chrome UA quirk https://bugs.webkit.org/show_bug.cgi?id=162617 Reviewed by Carlos Garcia Campos. Add Chrome UA quirk and use it on typekit.net, typekit.com, youtube.com, slack.com, and any domain that begins with "google". * platform/gtk/UserAgentGtk.cpp: (WebCore::buildUserAgentString): (WebCore::urlRequiresChromeBrowser): (WebCore::standardUserAgentForURL): 2016-09-28 Michael Catanzaro [GTK] User agent should always claim to be Intel https://bugs.webkit.org/show_bug.cgi?id=162610 Reviewed by Carlos Garcia Campos. We should always claim to be running on Intel regardless of actual CPU type. See discussion in bug #162548 for details. In particular, we can never advertise ARM because it causes dumb websites to send mobile pages. * platform/gtk/UserAgentGtk.cpp: (WebCore::platformVersionForUAString): (WebCore::buildUserAgentString): (WebCore::cpuDescriptionForUAString): Deleted. 2016-09-28 Michael Catanzaro [GTK] Adjust OS X UA quirks list https://bugs.webkit.org/show_bug.cgi?id=162616 Reviewed by Carlos Garcia Campos. Remove the OS X quirk for yahoo.com as it's no longer needed. Add quirks for taobao.com and whatsapp.com. * platform/gtk/UserAgentGtk.cpp: (WebCore::urlRequiresMacintoshPlatform): (WebCore::standardUserAgentForURL): 2016-09-28 Michael Catanzaro [GTK] Simplify platformForUAString https://bugs.webkit.org/show_bug.cgi?id=162614 Reviewed by Carlos Garcia Campos. Note in particular that the previous PLATFORM(MAC) check was wrong here, as that is never true for GTK; this patch risks changing it to OS(MAC_OS_X), on the hope that advertising Mac when running on Mac might not break anything. If it does, then we should remove it and just always pretend to be on X11. * platform/gtk/UserAgentGtk.cpp: (WebCore::platformForUAString): 2016-09-28 Michael Catanzaro [GTK] Bump fake Safari version in UA https://bugs.webkit.org/show_bug.cgi?id=162615 Reviewed by Carlos Garcia Campos. Pretend to be Safari 10.0 to fix sites that don't work when we pretend to be Safari 8.0. * platform/gtk/UserAgentGtk.cpp: (WebCore::buildUserAgentString): 2016-09-28 Michael Catanzaro [GTK] Add warning comment in UserAgentGtk.cpp https://bugs.webkit.org/show_bug.cgi?id=162618 Reviewed by Carlos Garcia Campos. * platform/gtk/UserAgentGtk.cpp: 2016-09-27 Michael Catanzaro Unreviewed typo fix * platform/gtk/UserAgentGtk.cpp: (WebCore::standardUserAgent): 2016-09-26 Antti Koivisto Input elements don't work inside shadow tree https://bugs.webkit.org/show_bug.cgi?id=160427 Reviewed by Darin Adler. There is a bug in ComposedTreeIterator. If the iterator is initialized with an initial state where the root is inside a shadow tree it won't iterate into slots. If an input element is in a shadow tree it generates narrowly scoped style updates. When RenderTreeUpdater applies such an update the update root will be inside the shadow tree and the bug will prevent the render tree for slotted content from updating. Added tests for both the iterator behavior and the specific symptom with input elements. Tests: fast/shadow-dom/composed-tree-shadow-child-subtree.html fast/shadow-dom/input-element-in-shadow.html * dom/ComposedTreeIterator.cpp: (WebCore::ComposedTreeIterator::ComposedTreeIterator): Check and cache if the root is inside shadow tree. (WebCore::ComposedTreeIterator::traverseNextInShadowTree): * dom/ComposedTreeIterator.h: (WebCore::ComposedTreeIterator::traverseNext): If it is, always use the shadow traversal code path. 2016-09-26 Michael Catanzaro Add CairoUniquePtr and use it in FontPlatformDataFreetype.cpp https://bugs.webkit.org/show_bug.cgi?id=162557 Reviewed by Alex Christensen. * platform/graphics/cairo/CairoUniquePtr.h: Added. (WebCore::CairoPtrDeleter::operator()): * platform/graphics/freetype/FontPlatformDataFreeType.cpp: (WebCore::getDefaultCairoFontOptions): Return a smart pointer. (WebCore::FontPlatformData::buildScaledFont): Use smart pointer. 2016-09-26 Michael Catanzaro std::unique_ptr deleter functions should not check if pointer is null https://bugs.webkit.org/show_bug.cgi?id=162558 Reviewed by Alex Christensen. std::unique_ptr already does this before calling the deleter. * platform/graphics/x11/XUniquePtr.h: (WebCore::XPtrDeleter::operator()): (WebCore::XPtrDeleter::operator()): (WebCore::XPtrDeleter<_XGC>::operator()): (WebCore::XPtrDeleter<__GLXcontextRec>::operator()): 2016-09-26 Michael Catanzaro [GTK] Unnecessary extern functions in FontPlatformDataFreeType.cpp https://bugs.webkit.org/show_bug.cgi?id=162555 Reviewed by Carlos Garcia Campos. These functions should be file-static. * platform/graphics/freetype/FontPlatformDataFreeType.cpp: (WebCore::convertFontConfigSubpixelOrder): (WebCore::convertFontConfigHintStyle): (WebCore::setCairoFontOptionsFromFontConfigPattern): 2016-09-23 Zalan Bujtas ASSERTION FAILED: !newRelayoutRoot.container() || is(newRelayoutRoot.container()) || !newRelayoutRoot.container()->needsLayout() while loading sohu.com https://bugs.webkit.org/show_bug.cgi?id=162466 Reviewed by Simon Fraser. When we come across a out-of-flow positioned renderer during layout, we add it to a tracker map with its containing block (calling RenderBlock::insertPositionedObject). It ensures that a containing block can easily access to the out-of-flow positioned descendants during layout/painting/hittesting. We do it even when the containing block - positioned renderer pair is already in this tracker map. RenderBlock::insertPositionedObject() eagerly sets the positioned-child-needs-layout flag on the containing block assuming it needs to layout this descendant later in the layout phase. This patch ensure that we only flag the containing block dirty when the descendant needs layout. Test: fast/block/positioning/subtree-assert-when-positioned-element-dirties-containing-block.html * rendering/RenderBlock.cpp: (WebCore::RenderBlock::insertPositionedObject): 2016-09-22 Brady Eidson IDBIndex.openCursor() matches indices on multiple object stores. and https://bugs.webkit.org/show_bug.cgi?id=158833 Reviewed by Alex Christensen. Tests: storage/indexeddb/modern/multiple-objectstore-index-cursor-collision-private.html storage/indexeddb/modern/multiple-objectstore-index-cursor-collision.html * Modules/indexeddb/server/SQLiteIDBCursor.cpp: (WebCore::IDBServer::buildIndexStatement): Need to include the object store id in the statement for index cursors, otherwise there will be collisions amongst multiple object stores that happen to share primary keys. (WebCore::IDBServer::SQLiteIDBCursor::bindArguments): 2016-09-22 Daniel Bates [XSS Auditor] HTML5 entities can bypass XSS Auditor https://bugs.webkit.org/show_bug.cgi?id=161939 Reviewed by David Kilzer. Merged from Blink: Truncate a src-like URL at the first & character as it may mark the start of an HTML entity. We will evaluate the effectiveness of this approach and adjust it if necessary if we see an increase in false positives. HTML5 defines more named character references, including named character references for common punctuation characters. Characters following some punctuation characters may come from the page itself. We truncate src-like strings at punctuation characters to avoid considering such page content when performing a match. Test: http/tests/security/xssAuditor/script-tag-with-source-data-url5.html * html/parser/XSSAuditor.cpp: (WebCore::truncateForSrcLikeAttribute): 2016-09-22 Daniel Bates [XSS Auditor] Truncate data URLs at quotes https://bugs.webkit.org/show_bug.cgi?id=161937 Reviewed by David Kilzer. Merged from Blink: Truncate a data URL at the first single or double quote character to avoid considering characters that may come from the page content following an injected data URL. Test: http/tests/security/xssAuditor/script-tag-with-source-data-url4.html * html/parser/XSSAuditor.cpp: (WebCore::truncateForSrcLikeAttribute): 2016-09-22 Carlos Garcia Campos [GTK] Rename DataObjectGtk as SelectionData https://bugs.webkit.org/show_bug.cgi?id=162380 Reviewed by Žan Doberšek. DataObjectGtk represents the data of a selection, like GtkSelectionData, used for clipboard and drag adn drop operations. Data object is a very generic name, and the Gtk suffix sounds like if this is the GTK implementation of a generic DataObject class. * PlatformGTK.cmake: * editing/gtk/EditorGtk.cpp: (WebCore::createFragmentFromPasteboardData): * page/gtk/DragControllerGtk.cpp: * platform/DragData.h: * platform/Pasteboard.h: * platform/PasteboardStrategy.h: (WebCore::PasteboardStrategy::~PasteboardStrategy): Deleted. * platform/PlatformPasteboard.h: * platform/gtk/DragDataGtk.cpp: * platform/gtk/PasteboardGtk.cpp: (WebCore::Pasteboard::createPrivate): (WebCore::Pasteboard::createForDragAndDrop): (WebCore::Pasteboard::Pasteboard): (WebCore::Pasteboard::selectionData): (WebCore::selectionDataTypeFromHTMLClipboardType): (WebCore::Pasteboard::writeToClipboard): (WebCore::Pasteboard::readFromClipboard): (WebCore::Pasteboard::writeString): (WebCore::Pasteboard::writePlainText): (WebCore::Pasteboard::write): (WebCore::Pasteboard::writePasteboard): (WebCore::Pasteboard::clear): (WebCore::Pasteboard::canSmartReplace): (WebCore::Pasteboard::read): (WebCore::Pasteboard::hasData): (WebCore::Pasteboard::types): (WebCore::Pasteboard::readString): (WebCore::Pasteboard::readFilenames): * platform/gtk/PasteboardHelper.cpp: (WebCore::PasteboardHelper::getClipboardContents): (WebCore::PasteboardHelper::targetListForSelectionData): (WebCore::PasteboardHelper::fillSelectionData): (WebCore::ClipboardSetData::ClipboardSetData): (WebCore::getClipboardContentsCallback): (WebCore::PasteboardHelper::writeClipboardContents): (WebCore::clearClipboardContentsCallback): Deleted. * platform/gtk/PasteboardHelper.h: * platform/gtk/PlatformPasteboardGtk.cpp: (WebCore::PlatformPasteboard::writeToClipboard): (WebCore::PlatformPasteboard::readFromClipboard): * platform/gtk/SelectionData.cpp: Renamed from Source/WebCore/platform/gtk/DataObjectGtk.cpp. (WebCore::SelectionData::setText): (WebCore::SelectionData::setURIList): (WebCore::SelectionData::setURL): (WebCore::SelectionData::urlLabel): (WebCore::SelectionData::clearAllExceptFilenames): (WebCore::SelectionData::clearAll): * platform/gtk/SelectionData.h: Renamed from Source/WebCore/platform/gtk/DataObjectGtk.h. (WebCore::SelectionData::create): (WebCore::SelectionData::text): (WebCore::SelectionData::hasText): (WebCore::SelectionData::clearText): (WebCore::SelectionData::setMarkup): (WebCore::SelectionData::markup): (WebCore::SelectionData::hasMarkup): (WebCore::SelectionData::clearMarkup): (WebCore::SelectionData::hasURL): (WebCore::SelectionData::clearURL): (WebCore::SelectionData::filenames): (WebCore::SelectionData::hasURIList): (WebCore::SelectionData::hasFilenames): (WebCore::SelectionData::setImage): (WebCore::SelectionData::image): (WebCore::SelectionData::hasImage): (WebCore::SelectionData::unknownTypeData): (WebCore::SelectionData::unknownTypes): (WebCore::SelectionData::hasUnknownTypeData): (WebCore::SelectionData::canSmartReplace): (WebCore::SelectionData::url): Deleted. (WebCore::SelectionData::uriList): Deleted. (WebCore::SelectionData::clearURIList): Deleted. (WebCore::SelectionData::clearImage): Deleted. (WebCore::SelectionData::setUnknownTypeData): Deleted. 2016-09-21 Jeremy Huddleston Sequoia [GTK] Fix build failure of ScrollbarThemeGtk with libc++ https://bugs.webkit.org/show_bug.cgi?id=162302 Reviewed by Carlos Garcia Campos. * platform/gtk/ScrollbarThemeGtk.cpp: (WebCore::ScrollbarThemeGtk::paint): Add missing #include 2016-09-21 Jeremy Huddleston Sequoia [GTK] Fix build failure in clipboard support https://bugs.webkit.org/show_bug.cgi?id=162261 Reviewed by Carlos Garcia Campos. * platform/PlatformPasteboard.h: Add missing #include * platform/gtk/PasteboardHelper.h: Add missing #include 2016-09-20 Carlos Garcia Campos [GTK] Clean up DataObjectGtk handling https://bugs.webkit.org/show_bug.cgi?id=162267 Reviewed by Michael Catanzaro. * platform/Pasteboard.h: Use Ref instead of RefPtr for DataObjectGtk member. * platform/PasteboardStrategy.h: Pass a const reference to DataObjectGtk in write method and return a Ref from read. * platform/PlatformPasteboard.h: Ditto. * platform/gtk/DataObjectGtk.h: (WebCore::DataObjectGtk::image): Use Image instead of GdkPixbuf. (WebCore::DataObjectGtk::setImage): * platform/gtk/PasteboardGtk.cpp: (WebCore::Pasteboard::createForDragAndDrop): Use a reference instead of a pointer. (WebCore::Pasteboard::Pasteboard): Receives a reference, so we can also remove the ASSERT. (WebCore::Pasteboard::dataObject): (WebCore::Pasteboard::writeToClipboard): Remove the ShouldIncludeSmartPaste parameter, callers should also update canSmartPaste property of DataObjectGtk before calling this. (WebCore::Pasteboard::writePlainText): (WebCore::Pasteboard::write): Do not convert the image the GdkPixbuf, pass the image to the DataObjectGtk instead. * platform/gtk/PasteboardHelper.cpp: (WebCore::PasteboardHelper::fillSelectionData): Convert the DataObjectGtk image to GdkPixbuf right before passing it to gtk_selection_data_set_pixbuf(). (WebCore::ClipboardSetData::ClipboardSetData): Use reference instead of pointer. (WebCore::getClipboardContentsCallback): (WebCore::clearClipboardContentsCallback): Never clear the saved DataObjectGtk, that was only needed when we had a global DataObjectGtk associated to a GtkClipboard. (WebCore::PasteboardHelper::writeClipboardContents): Use TemporaryChange to set the settingClipboardDataObject global. * platform/gtk/PlatformPasteboardGtk.cpp: (WebCore::PlatformPasteboard::writeToClipboard): (WebCore::PlatformPasteboard::readFromClipboard): 2016-09-20 Zalan Bujtas REGRESSION (r204552): Athlete search on Strava gives bad rendering. https://bugs.webkit.org/show_bug.cgi?id=162250 Reviewed by Simon Fraser. Test: fast/layers/blank-content-when-child-layer-is-at-negative-big-number.html * platform/graphics/LayoutRect.cpp: (WebCore::LayoutRect::checkedUnite): * platform/graphics/LayoutRect.h: (WebCore::LayoutRect::isMaxXMaxYRepresentable): (WebCore::LayoutRect::maxXMaxYCorner): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::calculateClipRects): 2016-09-19 Daniel Bates Cleanup: Remove an extraneous copy of SecurityOrigin https://bugs.webkit.org/show_bug.cgi?id=162118 Reviewed by Youenn Fablet. Share one isolated copy of the SecurityOrigin between the ContentSecurityPolicy and LoaderTaskOptions objects instead of creating two isolated copies of the SecurityOrigin. This is safe because both ContentSecurityPolicy and LoaderTaskOptions are instantiated in WorkerThreadableLoader::MainThreadBridge for use on the main thread only. * loader/WorkerThreadableLoader.cpp: (WebCore::LoaderTaskOptions::LoaderTaskOptions): (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge): 2016-09-19 Chris Dumez Update XHTMLParser to recognize "-//W3C//DTD MathML 2.0//EN" public identifier https://bugs.webkit.org/show_bug.cgi?id=162166 Reviewed by Alex Christensen. Update XHTMLParser to recognize "-//W3C//DTD MathML 2.0//EN" public identifier as per the latest HTML specification. - https://html.spec.whatwg.org/#parsing-xhtml-documents Firefox already recognizes it properly. Test: imported/w3c/web-platform-tests/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-support.htm * xml/parser/XMLDocumentParserLibxml2.cpp: (WebCore::convertUTF16EntityToUTF8): Fix assertion that was causing the new test to crash in debug. The input '\u0026' gets converted to '&' which is only 1 character. However, the assertion wrongly expected WTF::Unicode::convertUTF16ToUTF8() to generate more than 1 character. (WebCore::externalSubsetHandler): Add "-//W3C//DTD MathML 2.0//EN" to the list. 2016-09-19 Zalan Bujtas ASSERTION FAILED: clipRectsContext.rootLayer == m_clipRectsCache->m_clipRectsRoot[clipRectsType] while loading guardian.co.uk https://bugs.webkit.org/show_bug.cgi?id=162129 Reviewed by Antti Koivisto. Neither ::localClipRect() nor ::selfClipRect() accounts for paginated context while computing the cliprects (See FIXMEs). This patch ensures that we don't end up caching these invalid cliprects. Test: fast/multicol/assert-on-cliprect-caching-when-paginated.html * rendering/RenderLayer.cpp: (WebCore::RenderLayer::calculateClipRects): 2016-09-17 David Kilzer MainThreadBridge needs an isolatedCopy() of SecurityOrigin Reviewed by Carlos Garcia Campos. Covered by existing tests. * loader/WorkerThreadableLoader.cpp: (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge): Make an isolatedCopy() of SecurityOrigin here since that's the correct idiom to use when the object is passed from a worker thread back to the main thread. Fix suggested by Daniel Bates. 2016-09-16 Chris Dumez Cancelling one frame's load cancels load in other frames that have the same URL as well https://bugs.webkit.org/show_bug.cgi?id=162094 Reviewed by Antti Koivisto. Cancelling one frame's load cancels load in other frames that have the same URL as well. So if you have several frames that are loading URL X and you navigate one of the frames to Y, then the load of X will be cancelled and this frame will navigate to Y. All other frames will not load URL X even though they should. The issue is that all the DocumentLoaders share the same CachedResource because of the memoryCache. When we call DocumentLoader::stopLoading(), it will cancel the CachedResource's load even though there are several clients for this CachedResource and other clients still want the load. The approach chosen in this patch is to not reuse CachedResources that are still loading when trying to load a main resource. This is not the most efficient approach. I still chose this approach because: - It is very unlikely to introduce new bugs. - The change is very simple. - This is a corner case (several iframes having the same URL and cancelling the load in one of them). Test: http/tests/navigation/frames-same-url-cancel-load.html * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::determineRevalidationPolicy): 2016-09-16 Michael Catanzaro ASSERTION FAILED: The string being removed is atomic in the string table of an other thread! iterator != atomicStringTable.end() at Source/WTF/wtf/text/AtomicStringImpl.cpp(453) https://bugs.webkit.org/show_bug.cgi?id=161800 Reviewed by Žan Doberšek. Speculative fix. These strings are created as static objects on a secondary thread, but all static objects are destroyed in exit handlers on the main thread, and AtomicStrings must always be destroyed on the same thread they are created. * platform/graphics/texmap/TextureMapperShaderProgram.h: 2016-09-15 Zalan Bujtas ASSERTION FAILED: willBeComposited == needsToBeComposited(layer) in WebCore::RenderLayerCompositor::computeCompositingRequirements https://bugs.webkit.org/show_bug.cgi?id=151097 Reviewed by Simon Fraser. This patch ensures that when will-change property triggers stacking context, we make the associated layer a non-normal flow layer. (This is similar to what any other stacking context-triggering CSS property does.) Test: compositing/assert-on-will-change-transform-with-composited-descendant.html * rendering/RenderLayer.cpp: (WebCore::RenderLayer::calculateClipRects): 2016-09-15 Zalan Bujtas Cleanup RenderLayer::shouldBeNormalFlowOnly https://bugs.webkit.org/show_bug.cgi?id=161981 Reviewed by Simon Fraser. This patch changes the logic of figuring about if a particular layer is normal flow only by simply checking if the layer creates a stacking context. If it does, we assume that it can't be a normal flow layer anymore. This patch slightly changes behaviour by making layers with isolation and reflection to be non normal flow layers anymore. Covered by existing testcases. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::calculateClipRects): 2016-09-14 Zalan Bujtas ShowRenderTree should take position offset into account when printing inflow positioned renderers. https://bugs.webkit.org/show_bug.cgi?id=161978 Reviewed by Simon Fraser. Adjust (x, y) with the inflow positioned renderer's offset. Not testable. * rendering/RenderObject.cpp: (WebCore::RenderObject::showRenderObject): 2016-09-12 Zalan Bujtas Input type object and the associated render can go out of sync. https://bugs.webkit.org/show_bug.cgi?id=161871 Reviewed by Antti Koivisto. Bail out when we've got a mismatched renderer. Test: fast/forms/assert-on-input-type-change.html * html/ImageInputType.cpp: (WebCore::ImageInputType::altAttributeChanged): 2016-09-22 Zalan Bujtas Replace redundant prepareForDestruction() call with RELEASE_ASSERT in Document::removedLastRef. https://bugs.webkit.org/show_bug.cgi?id=162467 Reviewed by Chris Dumez. Since r205786 fixed the root cause of webkit.org/b/159372, we no longer need the workaround. Replace it with a RELEASE_ASSERT to ensure clean state. No new tests, covered by existing test. * dom/Document.cpp: (WebCore::Document::removedLastRef): 2016-09-10 Chris Dumez It is possible for Document::m_frame pointer to become stale https://bugs.webkit.org/show_bug.cgi?id=161812 Reviewed by Ryosuke Niwa. Document::m_frame is supposed to get cleared by Document::prepareForDestruction(). The Frame destructor calls Frame::setView(nullptr) which is supposed to call the prepareForDestruction() on the Frame's associated document. However, Frame::setView(nullptr) was calling prepareForDestruction() only if Document::inPageCache() returned true. This is because, we allow Documents to stay alive in the PageCache even though they don't have a frame. The issue is that Document::m_inPageCache flag was set to true right before firing the pagehide event, so technically before really entering PageCache. Therefore, we can run into problems if a Frame gets destroyed by a pagehide EventHandler because ~Frame() will not call Document::prepareForDestruction() due to Document::m_inPageCache being true. After the frame is destroyed, Document::m_frame becomes stale and any action on the document will likely lead to crashes (such as the one in the layout test and the radar which happens when trying to unregister event listeners from the document). The solution adopted in this patch is to replace the m_inPageCache boolean with a m_pageCacheState enumeration that has 3 states: - NotInPageCache - AboutToEnterPageCache - InPageCache Frame::setView() / Frame::setDocument() were then updated to call Document::prepareForDestruction() on the associated document whenever the document's pageCacheState is not InPageCache. This means that we will now call Document::prepareForDestruction() when the document is being detached from its frame while firing the pagehide event. Note that I tried to keep this patch minimal. Therefore, I kept the Document::inPageCache() getter for now. I plan to switch all its calls sites to the new Document::pageCacheState() getter in a follow-up patch so that we can finally drop the confusing Document::inPageCache(). Test: fast/history/pagehide-remove-iframe-crash.html * dom/Document.cpp: (WebCore::Document::Document): (WebCore::Document::~Document): (WebCore::Document::createRenderTree): (WebCore::Document::destroyRenderTree): (WebCore::Document::setFocusedElement): (WebCore::Document::setPageCacheState): (WebCore::Document::topDocument): * dom/Document.h: (WebCore::Document::pageCacheState): (WebCore::Document::inPageCache): * history/CachedFrame.cpp: (WebCore::CachedFrame::destroy): * history/PageCache.cpp: (WebCore::setPageCacheState): (WebCore::PageCache::addIfCacheable): * loader/FrameLoader.cpp: (WebCore::FrameLoader::stopAllLoaders): (WebCore::FrameLoader::open): * loader/HistoryController.cpp: (WebCore::HistoryController::invalidateCurrentItemCachedPage): * page/Frame.cpp: (WebCore::Frame::setView): 2016-09-09 Antti Koivisto v3: WebContent crash due to RELEASE_ASSERT in WebCore: WebCore::StyleResolver::styleForElement https://bugs.webkit.org/show_bug.cgi?id=161689 Reviewed by Andreas Kling. These crashes happen because synchronously triggered resource loads generate callbacks that may end up deleting the resource loader. Stop triggering resource loads from StyleResolver. Instead trigger them when applying style to render tree. * css/StyleResolver.cpp: (WebCore::StyleResolver::~StyleResolver): Replace the RELEASE_ASSERT against deletion during resource loads by a general isDeleted assert. (WebCore::StyleResolver::styleForElement): (WebCore::StyleResolver::styleForKeyframe): (WebCore::StyleResolver::pseudoStyleForElement): (WebCore::StyleResolver::styleForPage): (WebCore::StyleResolver::applyMatchedProperties): (WebCore::StyleResolver::loadPendingResources): Deleted. * css/StyleResolver.h: * page/animation/KeyframeAnimation.cpp: (WebCore::KeyframeAnimation::KeyframeAnimation): (WebCore::KeyframeAnimation::resolveKeyframeStyles): Ensure resource load for all animation frames. * page/animation/KeyframeAnimation.h: * rendering/RenderElement.cpp: (WebCore::RenderElement::createFor): (WebCore::RenderElement::initializeStyle): Load resources when renderer initializes a style. (WebCore::RenderElement::setStyle): (WebCore::RenderElement::getUncachedPseudoStyle): Load resources for pseudo styles. * rendering/RenderImage.cpp: (WebCore::RenderImage::RenderImage): (WebCore::RenderImage::styleWillChange): Shuffle image resource initialization out from constructor so initializeStyle gets called before. * rendering/RenderImage.h: * rendering/style/StyleCachedImage.cpp: (WebCore::StyleCachedImage::StyleCachedImage): Track pending status with a bit instead of implicitly by the existence of CachedResource. This is useful for asserts. (WebCore::StyleCachedImage::load): (WebCore::StyleCachedImage::isPending): (WebCore::StyleCachedImage::addClient): (WebCore::StyleCachedImage::removeClient): (WebCore::StyleCachedImage::image): * rendering/style/StyleCachedImage.h: 2016-09-08 Yusuke Suzuki [WTF] HashTable's rehash is not compatible to Ref and ASan https://bugs.webkit.org/show_bug.cgi?id=161763 Reviewed by Mark Lam. Include wtf/text/StringHash.h to avoid linking errors in EFL port. * loader/ResourceLoadStatistics.h: 2016-09-08 Simon Fraser Don't run transitions to or from undefined Lengths https://bugs.webkit.org/show_bug.cgi?id=161750 rdar://problem/28170460 Reviewed by Zalan Bujtas. For properties like max-height whose default value is 'none', we would erroneously attempt to run transitions/animations, and then assert when one of the endpoints was undefined. So don't attempt to blend such Length values, just as do when they are auto. Fixes some transitions on apple.com and developer.apple.com. Test: transitions/transition-to-from-undefined.html * page/animation/CSSPropertyAnimation.cpp: (WebCore::CSSPropertyAnimation::blendProperties): * platform/Length.cpp: (WebCore::blend): 2016-09-07 Chris Dumez Fix handling of negative radius in HTMLAreaElement's coords when in circle state https://bugs.webkit.org/show_bug.cgi?id=161690 Reviewed by Daniel Bates. Fix handling of negative radius in HTMLAreaElement's coords when in circle state: - https://html.spec.whatwg.org/#attr-area-shape-circle The radius must be non-negative as per the specification. However, our code fails to check. Firefox and Chrome both reject negative radius. No new tests, rebaselined existing test. * html/HTMLAreaElement.cpp: (WebCore::HTMLAreaElement::getRegion): 2016-09-16 Carlos Garcia Campos [TextureMapper] Scrolling through 01.org/dleyna crashes WebKitWebProcess https://bugs.webkit.org/show_bug.cgi?id=162020 Reviewed by Žan Doberšek. The problem is that we are trying to clone a ReferenceFilterOperation, which is not expected to be cloned, from FilterAnimationValue copy constructor, and FilterOperations are never expected to be nullptr, so we end up crashing. We just need to validate the filters before setting then and before creating a TextureMapperAnimation for them. * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp: (WebCore::GraphicsLayerTextureMapper::filtersCanBeComposited): Return false if there are reference filters or no filters at all. I don't know if we really support other filters, but at least we won't crash for the others. (WebCore::GraphicsLayerTextureMapper::addAnimation): Check if filters can be composited before creating a TextureMapperAnimation. (WebCore::GraphicsLayerTextureMapper::setFilters): Check if filters can be composited before setting them. * platform/graphics/texmap/GraphicsLayerTextureMapper.h: * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::filtersCanBeComposited): Return false if there are reference filters or no filters at all. I don't know if we really support other filters, but at least we won't crash for the others. (WebCore::CoordinatedGraphicsLayer::setFilters): Check if filters can be composited before setting them. (WebCore::CoordinatedGraphicsLayer::addAnimation): Check if filters can be composited before creating a TextureMapperAnimation. * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: 2016-09-14 Carlos Garnacho [GTK][Wayland] Implement clipboard support https://bugs.webkit.org/show_bug.cgi?id=146574 Reviewed by Carlos Garcia Campos. Implement PlatformPasteboard in the GTK+ platform, and move Pasteboard to using PasteboardStrategy so clipboard management is left to the UIProcess. DataObjectGtk is still used in the Pasteboard GTK implementation, it's now just never backed by a GtkClipboard, this object is instead serialized through PasteboardStrategy, so the UIProcess side can mirror the content in a GtkClipboard-backed DataObjectGtk, which is then exposed to the windowing through PlatformPasteboard/PasteboardHelper. When requesting clipboard content, it works similarly, the UIProcess side first updates its DataObjectGtk, which is then mirrored by the WebProcess through the PasteboardStrategy requests. * PlatformGTK.cmake: Added PlatformPasteboardGtk.cpp * editing/gtk/EditorGtk.cpp: (WebCore::Editor::writeSelectionToPasteboard): Eliminate usage of PasteboardWebContent callback argument. This is done differently as we have to signal back the WebProcess. * platform/Pasteboard.h: Cleaned up of direct GTK+ dependency. * platform/PasteboardStrategy.h: Added plumbing towards the pasteboard proxy. * platform/PlatformPasteboard.h: * platform/gtk/DataObjectGtk.cpp: (WebCore::DataObjectGtk::clearAllExceptFilenames): Clear the "smart paste" flag if set, now that this is DataObjectGtk data. * platform/gtk/DataObjectGtk.h: (WebCore::DataObjectGtk::canSmartReplace): (WebCore::DataObjectGtk::setCanSmartReplace): Added functions, in order to flag whether a DataObjectGtk has the "smart paste" feature enabled or not. * platform/gtk/PasteboardGtk.cpp: (WebCore::Pasteboard::createForCopyAndPaste): (WebCore::Pasteboard::createForGlobalSelection): (WebCore::Pasteboard::Pasteboard): (WebCore::Pasteboard::writeToClipboard): (WebCore::Pasteboard::readFromClipboard): (WebCore::Pasteboard::writePlainText): (WebCore::Pasteboard::write): (WebCore::Pasteboard::writePasteboard): (WebCore::Pasteboard::clear): (WebCore::Pasteboard::canSmartReplace): (WebCore::Pasteboard::read): (WebCore::Pasteboard::hasData): (WebCore::Pasteboard::types): (WebCore::Pasteboard::readString): (WebCore::Pasteboard::readFilenames): Made to use the PasteboardStrategy instead of PasteboardHelper/GTK+ API. * platform/gtk/PasteboardHelper.cpp: (WebCore::PasteboardHelper::~PasteboardHelper): (WebCore::ClipboardSetData::ClipboardSetData): (WebCore::clearClipboardContentsCallback): (WebCore::PasteboardHelper::writeClipboardContents): Remove the GClosure to notify whether the global selection has been replaced. Use std:function instead. Remove SmartPasteInclusion argument, now figured out through DataObjectGtk canSmartPaste() member. * platform/gtk/PasteboardHelper.h: * platform/gtk/PlatformPasteboardGtk.cpp: Added. (WebCore::PlatformPasteboard::PlatformPasteboard): (WebCore::PlatformPasteboard::writeToClipboard): (WebCore::PlatformPasteboard::readFromClipboard): Implemented PlatformPasteboard using PasteboardHelper/GTK+ API. 2016-09-13 Carlos Garcia Campos [GTK] Get rid of DataObjectGtk::forClipboard and cleanup pasteboard code https://bugs.webkit.org/show_bug.cgi?id=161907 Reviewed by Michael Catanzaro. We don't really need to keep a DataObjectGtk for every clipboard, we could simply pass the DataObjectGtk to read and write methods of PasteboardHelper. * editing/gtk/EditorGtk.cpp: (WebCore::createFragmentFromPasteboardData): Update for DataObjectGtk API changes. * platform/Pasteboard.h: * platform/gtk/DataObjectGtk.cpp: Remove forClipboard() static method. * platform/gtk/DataObjectGtk.h: Ditto. * platform/gtk/PasteboardGtk.cpp: (WebCore::Pasteboard::Pasteboard): Always create a new DataObjectGtk. (WebCore::Pasteboard::dataObject): Return a const reference instead of a pointer. (WebCore::Pasteboard::writePlainText): Pass the DataObjectGtk to PasteboardHelper. (WebCore::Pasteboard::write): Ditto. (WebCore::Pasteboard::writePasteboard): Ditto. (WebCore::Pasteboard::clear): Ditto. (WebCore::Pasteboard::read): Ditto. (WebCore::Pasteboard::hasData): Ditto. (WebCore::Pasteboard::types): Ditto. (WebCore::Pasteboard::readString): Ditto. (WebCore::Pasteboard::readFilenames): Ditto. * platform/gtk/PasteboardHelper.cpp: (WebCore::PasteboardHelper::getClipboardContents): Update the given DataObjectGtk. (WebCore::PasteboardHelper::fillSelectionData): Use a const reference to DataObjectGtk instead of a pointer. (WebCore::PasteboardHelper::targetListForDataObject): Ditto. (WebCore::PasteboardHelper::fillDataObjectFromDropData): Use a reference to DataObjectGtk instead of a pointer. (WebCore::ClipboardSetData::ClipboardSetData): Helper struct to pass DataObjectGtk and callback to clipboard callbacks. (WebCore::ClipboardSetData::~ClipboardSetData): (WebCore::getClipboardContentsCallback): Get the DataObjectGtk from ClipboardSetData struct passed as user data. (WebCore::clearClipboardContentsCallback): Get the DataObjectGtk and callback from ClipboardSetData struct passed as user data. (WebCore::PasteboardHelper::writeClipboardContents): Write the given DataObjectGtk. * platform/gtk/PasteboardHelper.h: 2016-09-12 Carlos Garcia Campos [GTK] Scrollbar too large https://bugs.webkit.org/show_bug.cgi?id=161735 Reviewed by Michael Catanzaro. We were not calculating the total scrollbar size correctly when the theme defines a minimum width/height. In that case we need to take the extra size into account (border, margin, padding), but not adding the minimum size. We were also adjusting the thumb position when rendering in indicator mode, but we really need to adjust the whole rectangle. This worked in Adwaita because it uses a transparent track when in indicator mode. We are also now taking into account the text direction when doing this adjustment for the indicator mode. * platform/gtk/ScrollbarThemeGtk.cpp: (WebCore::ScrollbarThemeGtk::paint): (WebCore::ScrollbarThemeGtk::scrollbarThickness): 2016-09-06 Carlos Garcia Campos [GTK] Crash of WebProcess on the last WebView disconnect https://bugs.webkit.org/show_bug.cgi?id=161605 Reviewed by Michael Catanzaro. The crash happens because GLX contexts are cleaned up in an exit handler to prevent X server crashes caused by buggy drivers when process finishes with active GLX contexts. The cleanup is assuming that all contexts not released when the exit handler is called are leaked, and then it manually deletes them. This assumption is no longer true because PlatformDisplay owns the sharing GLContext now, and it's freed after the exit handlers. Instead of deleting the GLContext objects, we could clear the internal GLXContext without breaking the pointer ownership. Since this is specific to GLX, I've moed the code from GLContext to GLContextGLX and simplified it. * platform/graphics/GLContext.cpp: (WebCore::GLContext::GLContext): (WebCore::GLContext::~GLContext): (WebCore::activeContextList): Deleted. (WebCore::GLContext::addActiveContext): Deleted. (WebCore::GLContext::removeActiveContext): Deleted. (WebCore::GLContext::cleanupActiveContextsAtExit): Deleted. * platform/graphics/glx/GLContextGLX.cpp: (WebCore::activeContexts): (WebCore::GLContextGLX::GLContextGLX): (WebCore::GLContextGLX::~GLContextGLX): (WebCore::GLContextGLX::clear): * platform/graphics/glx/GLContextGLX.h: 2016-09-06 Saam Barati Make JSMap and JSSet faster https://bugs.webkit.org/show_bug.cgi?id=160989 Reviewed by Filip Pizlo. * ForwardingHeaders/runtime/HashMapImpl.h: Added. * ForwardingHeaders/runtime/MapBase.h: Added. * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::serialize): (WebCore::CloneDeserializer::deserialize): 2016-09-06 Myles C. Maxfield Strikethrough positions are erroneously snapped twice https://bugs.webkit.org/show_bug.cgi?id=161647 Reviewed by Zalan Bujtas. Because we're using an int for the position of the baseline, the math to calculate the strikethrough position is snapped. Then, we snap it again inside GraphicsContext. Test: fast/text/strikethrough-int.html * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::paintDecoration): * rendering/TextDecorationPainter.h: (WebCore::TextDecorationPainter::setBaseline): 2016-09-06 Zalan Bujtas ASSERTION FAILED: !paintInfo.overlapTestRequests->contains(this) in WebCore::RenderWidget::paintContents https://bugs.webkit.org/show_bug.cgi?id=135602 Reviewed by Simon Fraser. ASSERT is updated to support multiple fragments painting. We just have to ensure that the FrameView's rect has not changed between the 2 paintContents calls. Test: fast/layers/assert-on-overlap-testing-with-frames-inside-columns.html * rendering/RenderWidget.cpp: (WebCore::RenderWidget::paintContents): 2016-09-06 Daniel Bates inside
    with large content inside = no scrollbar https://bugs.webkit.org/show_bug.cgi?id=3352 Reviewed by Brent Fulgham. Respect "right" text-alignment only if the width of the child does not overflow the width of its containing block. This makes our margin computation more closely conform to section "Block-level, non-replaced elements in normal flow" of the CSS 2.1 spec., , and to the behavior observed in Firefox, Chrome, IE version 9 or later and Microsoft Edge. Test: fast/block/align-overflow-child.html * rendering/RenderBox.cpp: (WebCore::RenderBox::computeInlineDirectionMargins): 2016-09-06 Zalan Bujtas ASSERTION FAILED: !currBox->needsLayout() in WebCore::RenderBlock::checkPositionedObjectsNeedLayout https://bugs.webkit.org/show_bug.cgi?id=120291 Reviewed by David Hyatt. This patch ensures that we always set the 'positioned child needs layout' bit on the containing block when a new positioned descendant gets inserted. It fixes cases for simplified layout when we ended up not laying out the descendant element. Test: fast/block/positioning/assert-when-positioned-descendant-is-not-getting-laid-out.html * rendering/RenderBlock.cpp: (WebCore::RenderBlock::insertPositionedObject): 2016-08-31 Filip Pizlo Butterflies should be allocated in Auxiliary MarkedSpace instead of CopiedSpace and we should rewrite as much of the GC as needed to make this not a regression https://bugs.webkit.org/show_bug.cgi?id=160125 Reviewed by Geoffrey Garen and Keith Miller. No new tests because no new WebCore behavior. Just rewiring #includes. * ForwardingHeaders/heap/HeapInlines.h: Added. * ForwardingHeaders/interpreter/Interpreter.h: Removed. * ForwardingHeaders/runtime/AuxiliaryBarrierInlines.h: Added. * Modules/indexeddb/IDBCursorWithValue.cpp: * Modules/indexeddb/client/TransactionOperation.cpp: * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: * Modules/indexeddb/server/UniqueIDBDatabase.cpp: * bindings/js/JSApplePayPaymentAuthorizedEventCustom.cpp: * bindings/js/JSApplePayPaymentMethodSelectedEventCustom.cpp: * bindings/js/JSApplePayShippingContactSelectedEventCustom.cpp: * bindings/js/JSApplePayShippingMethodSelectedEventCustom.cpp: * bindings/js/JSClientRectCustom.cpp: * bindings/js/JSDOMBinding.cpp: * bindings/js/JSDOMBinding.h: * bindings/js/JSDeviceMotionEventCustom.cpp: * bindings/js/JSDeviceOrientationEventCustom.cpp: * bindings/js/JSErrorEventCustom.cpp: * bindings/js/JSIDBCursorWithValueCustom.cpp: * bindings/js/JSIDBIndexCustom.cpp: * bindings/js/JSPopStateEventCustom.cpp: * bindings/js/JSWebGL2RenderingContextCustom.cpp: * bindings/js/JSWorkerGlobalScopeCustom.cpp: * bindings/js/WorkerScriptController.cpp: * contentextensions/ContentExtensionParser.cpp: * dom/ErrorEvent.cpp: * html/HTMLCanvasElement.cpp: * html/MediaDocument.cpp: * inspector/CommandLineAPIModule.cpp: * loader/EmptyClients.cpp: * page/CaptionUserPreferences.cpp: * page/Frame.cpp: * page/PageGroup.cpp: * page/UserContentController.cpp: * platform/mock/mediasource/MockBox.cpp: * testing/GCObservation.cpp: 2016-09-05 Fujii Hironori [CMake] Duplicated IDL files in WebCore_IDL_FILES https://bugs.webkit.org/show_bug.cgi?id=161592 Reviewed by Darin Adler. * CMakeLists.txt: Removed duplicated IDL files. * DerivedSources.cpp: Added #if ENABLE(USER_MESSAGE_HANDLERS) 2016-09-05 Zan Dobersek MediaPlayerPrivateGStreamerBase: improve build guards in nativeImageForCurrentTime() https://bugs.webkit.org/show_bug.cgi?id=161594 Reviewed by Philippe Normand. Guard the uses of cairo-gl API in nativeImageForCurrentTime() with the USE(CAIRO) && ENABLE(ACCELERATED_2D_CANVAS) pair of build guards. This API is only made available when the ACCELERATED_2D_CANVAS option is enabled. Placing the guards this way thus avoids compilation errors when compiling USE_GSTREAMER_GL code without the accelerated 2D canvas support enabled. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime): 2016-09-04 Antti Koivisto Remove Style::PendingResources https://bugs.webkit.org/show_bug.cgi?id=161574 Reviewed by Andreas Kling. RenderStyle contains all the information needed to initialize resource loads. There is no need for this side structure. * css/CSSFilterImageValue.cpp: (WebCore::CSSFilterImageValue::loadSubimages): Load external SVG resources along with any image resources. * css/CSSToStyleMap.cpp: (WebCore::CSSToStyleMap::styleImage): (WebCore::CSSToStyleMap::mapFillImage): (WebCore::CSSToStyleMap::mapNinePieceImage): * css/CSSToStyleMap.h: * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertStyleImage): (WebCore::StyleBuilderConverter::convertShapeValue): * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueCursor): (WebCore::StyleBuilderCustom::applyValueContent): * css/StyleResolver.cpp: (WebCore::StyleResolver::State::clear): (WebCore::StyleResolver::styleImage): (WebCore::StyleResolver::createFilterOperations): (WebCore::StyleResolver::loadPendingResources): (WebCore::StyleResolver::State::ensurePendingResources): Deleted. (WebCore::StyleResolver::styleCachedImageFromValue): Deleted. (WebCore::StyleResolver::styleGeneratedImageFromValue): Deleted. * css/StyleResolver.h: (WebCore::StyleResolver::State::takePendingResources): Deleted. * platform/graphics/filters/FilterOperation.cpp: (WebCore::ReferenceFilterOperation::loadExternalDocumentIfNeeded): (WebCore::ReferenceFilterOperation::getOrCreateCachedSVGDocumentReference): Deleted. * platform/graphics/filters/FilterOperation.h: (WebCore::ReferenceFilterOperation::cachedSVGDocumentReference): * rendering/style/StyleCachedImage.cpp: (WebCore::StyleCachedImage::StyleCachedImage): * style/StylePendingResources.cpp: (WebCore::Style::loadPendingResources): Trigger resource loads by checking pending resources in RenderStyle unconditionally. Keeping track of them separately wasn't necessary or a meaningful optimization. (WebCore::Style::loadPendingImages): Deleted. (WebCore::Style::loadPendingSVGFilters): Deleted. * style/StylePendingResources.h: 2016-09-04 Antti Koivisto Reverse ownership relation of StyleCachedImage and CSSImageValue https://bugs.webkit.org/show_bug.cgi?id=161447 Reviewed by Andreas Kling. Currently StyleCachedImage (which represents an image in RenderStyle) has a weak ref to the underlying CSSImageValue/CSSImageSetValue which actually owns it. This is awkwards especially since StyleGeneratedImage, the other StyleImage subclass has reversed relationship where it refs the underlying CSSImageGeneratorValue. This patch makes StyleCachedImage similar to StyleGeneratedImage. StyleCachedImage now refs the underlying CSSImageValue/CSSImageSetValue. CSSImageValues no longer need to know about StyleCachedImage. Instead they reference CachedImages (memory cache objects) directly. StyleCachedImage instances are now conceptually unique to RenderStyle instances. Actual resources are shared as before by sharing CachedImages. * css/CSSCursorImageValue.cpp: (WebCore::CSSCursorImageValue::loadImage): (WebCore::CSSCursorImageValue::cachedImage): (WebCore::CSSCursorImageValue::styleImage): Deleted. * css/CSSCursorImageValue.h: * css/CSSImageGeneratorValue.cpp: (WebCore::CSSImageGeneratorValue::cachedImageForCSSValue): * css/CSSImageSetValue.cpp: (WebCore::CSSImageSetValue::~CSSImageSetValue): (WebCore::CSSImageSetValue::loadBestFitImage): (WebCore::CSSImageSetValue::traverseSubresources): (WebCore::CSSImageSetValue::styleImage): Deleted. * css/CSSImageSetValue.h: * css/CSSImageValue.cpp: (WebCore::CSSImageValue::CSSImageValue): (WebCore::CSSImageValue::~CSSImageValue): (WebCore::CSSImageValue::isPending): (WebCore::CSSImageValue::loadImage): (WebCore::CSSImageValue::traverseSubresources): (WebCore::CSSImageValue::knownToBeOpaque): (WebCore::CSSImageValue::styleImage): Deleted. * css/CSSImageValue.h: * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueContent): * css/StyleResolver.cpp: (WebCore::StyleResolver::styleImage): (WebCore::StyleResolver::styleCachedImageFromValue): (WebCore::StyleResolver::styleGeneratedImageFromValue): (WebCore::StyleResolver::cachedOrPendingFromValue): Deleted. (WebCore::StyleResolver::generatedOrPendingFromValue): Deleted. (WebCore::StyleResolver::setOrPendingFromValue): Deleted. (WebCore::StyleResolver::cursorOrPendingFromValue): Deleted. * css/StyleResolver.h: * editing/TextIterator.cpp: (WebCore::fullyClipsContents): * page/PageSerializer.cpp: (WebCore::PageSerializer::retrieveResourcesForProperties): * rendering/style/FillLayer.cpp: (WebCore::FillLayer::imagesIdentical): Compare data equality instead of pointer equality for StyleImages (since StyleImages are no longer shared). (WebCore::layerImagesIdentical): Deleted. * rendering/style/StyleCachedImage.cpp: (WebCore::StyleCachedImage::StyleCachedImage): (WebCore::StyleCachedImage::~StyleCachedImage): (WebCore::StyleCachedImage::cachedImage): (WebCore::StyleCachedImage::cssValue): (WebCore::StyleCachedImage::canRender): (WebCore::StyleCachedImage::isPending): (WebCore::StyleCachedImage::isLoaded): (WebCore::StyleCachedImage::errorOccurred): (WebCore::StyleCachedImage::imageSize): (WebCore::StyleCachedImage::imageHasRelativeWidth): (WebCore::StyleCachedImage::imageHasRelativeHeight): (WebCore::StyleCachedImage::computeIntrinsicDimensions): (WebCore::StyleCachedImage::usesImageContainerSize): (WebCore::StyleCachedImage::setContainerSizeForRenderer): (WebCore::StyleCachedImage::addClient): (WebCore::StyleCachedImage::removeClient): (WebCore::StyleCachedImage::image): (WebCore::StyleCachedImage::knownToBeOpaque): (WebCore::StyleCachedImage::setCachedImage): Deleted. * rendering/style/StyleCachedImage.h: 2016-09-03 Joseph Pecoraro Use ASCIILiteral in some more places https://bugs.webkit.org/show_bug.cgi?id=161557 Reviewed by Darin Adler. * Modules/indexeddb/IDBDatabaseException.cpp: (WebCore::IDBDatabaseException::getErrorName): (WebCore::IDBDatabaseException::getErrorDescription): * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::binaryType): * css/FontFace.cpp: (WebCore::FontFace::stretch): (WebCore::FontFace::unicodeRange): (WebCore::FontFace::featureSettings): * html/canvas/WebGLRenderingContextBase.cpp: * html/parser/HTMLPreloadScanner.cpp: (WebCore::TokenPreloadScanner::initiatorFor): * loader/FormSubmission.cpp: (WebCore::FormSubmission::Attributes::parseEncodingType): * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::toRawString): * platform/graphics/cg/ImageBufferCG.cpp: (WebCore::CGImageToDataURL): (WebCore::ImageBuffer::toDataURL): (WebCore::ImageDataToDataURL): * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::filenameExtension): 2016-09-03 Chris Dumez Align meta element http-equiv="refresh" parsing with the HTML specification https://bugs.webkit.org/show_bug.cgi?id=161543 Reviewed by Darin Adler. Align meta element http-equiv="refresh" parsing with the HTML specification: - https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-http-equiv-refresh Tests: imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing.html * dom/Document.cpp: (WebCore::Document::processHttpEquiv): * html/parser/HTMLParserIdioms.cpp: (WebCore::parseHTTPRefreshInternal): (WebCore::parseMetaHTTPEquivRefresh): * html/parser/HTMLParserIdioms.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::receivedFirstData): * platform/network/HTTPParsers.cpp: (WebCore::skipWhiteSpace): (WebCore::skipEquals): (WebCore::parseHTTPRefresh): (WebCore::parseXSSProtectionHeader): (WebCore::skipValue): Deleted. * platform/network/HTTPParsers.h: 2016-09-02 Zalan Bujtas Should never be reached failure in WebCore::floatValueForLength https://bugs.webkit.org/show_bug.cgi?id=139397 Reviewed by Simon Fraser. floatValueForLength can't resolve unspecified Length types. Filter them out and return 0 as if they were auto. Test: svg/css/assert-on-non-resolvable-dimension.html * svg/SVGLengthContext.cpp: (WebCore::SVGLengthContext::valueForLength): 2016-09-02 Zalan Bujtas ASSERT_NOT_REACHED() is touched in WebCore::valueForLength https://bugs.webkit.org/show_bug.cgi?id=123337 Reviewed by Simon Fraser. Do not try to use unspecified height value while resolving logical height for table row. Test: fast/table/assert-on-non-resolvable-row-dimension.html * rendering/RenderTableCell.h: (WebCore::RenderTableCell::logicalHeightForRowSizing): 2016-09-02 Zalan Bujtas ASSERTION FAILED: !m_committedWidth in WebCore::LineWidth::fitBelowFloats https://bugs.webkit.org/show_bug.cgi?id=149462 Reviewed by David Hyatt. In certain cases (multiple spans on the same line with negativ marings), the LineWidth::m_committedWidth > 0 check is not sufficient to decide if some content has already been committed to the current line. This patch adds a flag to indicate if we ever committed to the current line. Test: fast/text/assert-when-text-with-negative-margin-sibling-does-not-fit.html * rendering/line/BreakingContext.h: (WebCore::BreakingContext::handleText): * rendering/line/LineWidth.h: (WebCore::LineWidth::hasCommitted): 2016-09-02 Chris Dumez REGRESSION (r204839): [mac-wk1] LayoutTest webgl/max-active-contexts-webglcontextlost-prevent-default.html is a flaky timeout https://bugs.webkit.org/show_bug.cgi?id=161205 Reviewed by Geoffrey Garen. Fixes several issues: - Add missing isReachableFromOpaqueRoots() implementation for JSWebGLRenderingContextBase. It used to rely on the one from its JSCanvasRenderingContext base. However, that base was dropped in r204839. - Update JSWebGLRenderingContextBase::visitAdditionalChildren() to add its canvas object as opaque root as well. This used to be taken care of by JSCanvasRenderingContext::visitAdditionalChildren() but it got dropped in r204839. This also refactors the code a bit for clarity. No new tests, unskipped existing test. * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSCanvasRenderingContext.h: Removed. * bindings/js/JSDocumentCustom.cpp: (WebCore::JSDocument::getCSSCanvasContext): * bindings/js/JSHTMLCanvasElementCustom.cpp: (WebCore::JSHTMLCanvasElement::getContext): * bindings/js/JSWebGLRenderingContextBaseCustom.cpp: (WebCore::toJSNewlyCreated): (WebCore::toJS): (WebCore::JSWebGLRenderingContextBaseOwner::isReachableFromOpaqueRoots): (WebCore::JSWebGLRenderingContextBase::visitAdditionalChildren): * html/canvas/CanvasRenderingContext.h: (WebCore::CanvasRenderingContext::is3d): * html/canvas/WebGLRenderingContextBase.h: * html/canvas/WebGLRenderingContextBase.idl: 2016-09-01 Mark Lam Move some JSObject and JSArray inline functions to their respective Inlines.h files. https://bugs.webkit.org/show_bug.cgi?id=161499 Reviewed by Saam Barati. No new tests because there is no behavior change. * ForwardingHeaders/runtime/JSObjectInlines.h: Added. * bindings/js/JSDOMBinding.h: * bindings/js/JSSQLTransactionCustom.cpp: * bindings/js/JSWebGLRenderingContextBaseCustom.cpp: * contentextensions/ContentExtensionParser.cpp: 2016-09-01 Michael Catanzaro Fix ENABLE(CSS_GRID_LAYOUT) guards harder after r205102/r205292 Unreviewed. Silence unused function warning. * css/CSSComputedStyleDeclaration.cpp: 2016-09-01 Javier Fernandez Unreviewed build fix after r205102. The change made in r205102 caused compilation failures on builds with the CSS_GRID_LAYOUT compilation flag disabled. * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::propertyValue): (WebCore::resolveJustifySelfAuto): Deleted. * css/CSSPropertyNames.in: * css/parser/CSSParser.cpp: (WebCore::isKeywordPropertyID): (WebCore::CSSParser::parseValue): 2016-09-01 Fujii Hironori Fix the Mac cmake clean build issue https://bugs.webkit.org/show_bug.cgi?id=157261 Reviewed by Michael Catanzaro. Building WebCoreDerivedSources target failed due to the race condition with building ForwardingHeaders of JavaScriptCore. * CMakeLists.txt: Make WebCoreDerivedSources depends on JavaScriptCore. 2016-09-01 Andreas Kling FocusController should pass KeyboardEvent around by reference. Reviewed by Sam Weinig. Clean up FocusController to pass KeyboardEvent& around internally. Also make FocusController::setInitialFocus() synthesize a dummy KeyboardEvent if one isn't provided, just like nextFocusableElement()/previousFocusableElement() does. This way we can feel confident about dereferencing the formerly KeyboardEvent* everywhere. * page/EventHandler.cpp: (WebCore::EventHandler::defaultArrowEventHandler): (WebCore::EventHandler::defaultTabEventHandler): * page/FocusController.cpp: (WebCore::isFocusableElementOrScopeOwner): (WebCore::isNonFocusableScopeOwner): (WebCore::isFocusableScopeOwner): (WebCore::shadowAdjustedTabIndex): (WebCore::FocusController::findFocusableElementDescendingDownIntoFrameDocument): (WebCore::FocusController::setInitialFocus): (WebCore::FocusController::advanceFocus): (WebCore::FocusController::advanceFocusInDocumentOrder): (WebCore::FocusController::findFocusableElementAcrossFocusScope): (WebCore::FocusController::findFocusableElementWithinScope): (WebCore::FocusController::nextFocusableElementWithinScope): (WebCore::FocusController::previousFocusableElementWithinScope): (WebCore::FocusController::findFocusableElementOrScopeOwner): (WebCore::FocusController::findElementWithExactTabIndex): (WebCore::nextElementWithGreaterTabIndex): (WebCore::previousElementWithLowerTabIndex): (WebCore::FocusController::nextFocusableElement): (WebCore::FocusController::previousFocusableElement): (WebCore::FocusController::nextFocusableElementOrScopeOwner): (WebCore::FocusController::previousFocusableElementOrScopeOwner): (WebCore::FocusController::findFocusCandidateInContainer): (WebCore::FocusController::advanceFocusDirectionallyInContainer): (WebCore::FocusController::advanceFocusDirectionally): * page/FocusController.h: 2016-09-01 Csaba Osztrogonác URTBF after r205161 to fix !ENABLE(WEB_TIMING) build. * bindings/js/JSPerformanceTimingCustom.cpp: 2016-09-01 Myles C. Maxfield Clean up TextRun-related code https://bugs.webkit.org/show_bug.cgi?id=161473 Reviewed by Simon Fraser. Some assorted cleanup, including: - Renaming "AllowTrailingExpansion | ForbidLeadingExpansion" to "DefaultExpansion" - Migrating from pointers to references - Migrating from ints to unsigneds - Using proper character names from CharacterNames.h - Simplifying CoreTextSPI.h No new tests because there is no behavior change. * platform/graphics/TextRun.h: (WebCore::TextRun::TextRun): * platform/graphics/mac/ComplexTextController.cpp: (WebCore::TextLayout::isNeeded): (WebCore::TextLayout::constructTextRun): * platform/spi/cocoa/CoreTextSPI.h: * platform/text/TextFlags.h: * rendering/RenderBlock.cpp: (WebCore::RenderBlock::constructTextRun): * rendering/RenderBlock.h: * rendering/RenderListMarker.cpp: (WebCore::RenderListMarker::computePreferredLogicalWidths): (WebCore::RenderListMarker::getRelativeMarkerRect): * rendering/RenderMenuList.cpp: (RenderMenuList::updateOptionsWidth): * rendering/RenderText.cpp: (WebCore::RenderText::widthFromCache): (WebCore::RenderText::trimmedPrefWidths): (WebCore::hyphenWidth): (WebCore::maxWordFragmentWidth): (WebCore::RenderText::computePreferredLogicalWidths): (WebCore::RenderText::width): * rendering/RenderText.h: * rendering/RenderThemeIOS.mm: * rendering/line/BreakingContext.h: (WebCore::textWidth): (WebCore::tryHyphenating): * rendering/svg/SVGInlineTextBox.cpp: (WebCore::SVGInlineTextBox::offsetForPositionInFragment): (WebCore::SVGInlineTextBox::selectionRectForTextFragment): (WebCore::SVGInlineTextBox::localSelectionRect): (WebCore::SVGInlineTextBox::paintSelectionBackground): (WebCore::SVGInlineTextBox::paint): (WebCore::SVGInlineTextBox::acquirePaintingResource): (WebCore::SVGInlineTextBox::prepareGraphicsContextForTextPainting): (WebCore::SVGInlineTextBox::constructTextRun): (WebCore::SVGInlineTextBox::paintDecorationWithStyle): (WebCore::SVGInlineTextBox::paintTextWithShadows): (WebCore::SVGInlineTextBox::paintText): * rendering/svg/SVGInlineTextBox.h: 2016-08-31 Yusuke Suzuki [JSC] Add initiator parameter to module pipeline https://bugs.webkit.org/show_bug.cgi?id=161470 Reviewed by Saam Barati. No user-observable behavior change. We rename JSModuleLoader to ScriptModuleLoader. The name "JSModuleLoader" is misleading since it seems like this is a JS object. "ModuleLoader" is not good since there is CSS modules. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSBindingsAllInOne.cpp: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::moduleLoaderResolve): (WebCore::JSDOMWindowBase::moduleLoaderFetch): (WebCore::JSDOMWindowBase::moduleLoaderEvaluate): * bindings/js/JSDOMWindowBase.h: * bindings/js/JSMainThreadExecState.h: (WebCore::JSMainThreadExecState::loadModule): (WebCore::JSMainThreadExecState::linkAndEvaluateModule): * bindings/js/JSModuleLoader.cpp: (WebCore::JSModuleLoader::JSModuleLoader): Deleted. (WebCore::JSModuleLoader::resolve): Deleted. (WebCore::JSModuleLoader::fetch): Deleted. (WebCore::JSModuleLoader::evaluate): Deleted. * bindings/js/JSModuleLoader.h: (WebCore::JSModuleLoader::document): Deleted. * bindings/js/ScriptModuleLoader.cpp: Renamed from Source/WebCore/bindings/js/JSModuleLoader.cpp. (WebCore::ScriptModuleLoader::ScriptModuleLoader): (WebCore::ScriptModuleLoader::resolve): (WebCore::ScriptModuleLoader::fetch): (WebCore::ScriptModuleLoader::evaluate): * bindings/js/ScriptModuleLoader.h: Renamed from Source/WebCore/bindings/js/JSModuleLoader.h. (WebCore::ScriptModuleLoader::document): * dom/Document.cpp: (WebCore::Document::Document): * dom/Document.h: (WebCore::Document::moduleLoader): 2016-08-31 Zalan Bujtas ASSERTION FAILED: !flow->layer() && !flow->isInlineElementContinuation() in WebCore::RenderBlock::addContinuationWithOutline https://bugs.webkit.org/show_bug.cgi?id=151022 Reviewed by Simon Fraser. Certain CSS properties like opacity, mask etc (graphical group members) require the layer to be a non-normal flow, self painting layer so that we can manage painting properly. However in addition to those CSS properties, some of the will-change values (again, graphical group members) also require the layer to be non-normal flow, self painting. This patch ensures that when deciding whether a layer should be a normal flow layer, we take the will-change values into account as well. Tests: compositing/layer-creation/assert-on-inline-element-with-will-change.html compositing/layer-creation/will-change-on-normal-flow-content.html * rendering/RenderLayer.cpp: (WebCore::RenderLayer::calculateClipRects): * rendering/style/WillChangeData.cpp: (WebCore::propertyCreatesGraphicalGroup): (WebCore::WillChangeData::addFeature): * rendering/style/WillChangeData.h: (WebCore::WillChangeData::canCreateGraphicalGroup): (WebCore::WillChangeData::canTriggerCompositingOnInline): Deleted. 2016-08-31 Joseph Pecoraro Web Inspector: XHR with text but responseType = "blob" shows blank content https://bugs.webkit.org/show_bug.cgi?id=161422 Reviewed by Brian Burg. Test: inspector/network/xhr-json-blob-has-content.html When an XMLHttpRequest finished loading it was always setting the Inspector's content for that load at the end. However, if the XHR was loading binary data then it was passing an empty string to the inspector and overwriting the data the inspector already had for the resource. Avoid this overwriting. * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::didFinishLoading): When loading binary content we have no decoded text to send to the inspector. * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didFinishXHRLoadingImpl): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didFinishXHRLoading): Switch to an Optional string, and if it is not available don't call through to the NetworkAgent expecting decoded text. * inspector/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::didFinishXHRLoading): * inspector/InspectorNetworkAgent.h: Improve variable name. 2016-08-31 Andreas Kling DOM event handling should pass Event around by reference. Reviewed by Chris Dumez. Start with making Node::defaultEventHandler() take an Event& instead of an Event*, and then spread out from there, propagating the referenceness. * dom/Element.cpp: (WebCore::Element::isKeyboardFocusable): * dom/Element.h: * dom/EventDispatcher.cpp: (WebCore::callDefaultEventHandlersInTheBubblingOrder): * dom/Node.cpp: (WebCore::Node::dispatchDOMActivateEvent): (WebCore::Node::defaultEventHandler): * dom/Node.h: * editing/Editor.cpp: (WebCore::Editor::handleKeyboardEvent): (WebCore::Editor::handleInputMethodKeydown): (WebCore::Editor::handleTextEvent): * editing/Editor.h: * html/BaseCheckableInputType.cpp: (WebCore::BaseCheckableInputType::handleKeydownEvent): (WebCore::BaseCheckableInputType::handleKeypressEvent): * html/BaseCheckableInputType.h: * html/BaseChooserOnlyDateAndTimeInputType.cpp: (WebCore::BaseChooserOnlyDateAndTimeInputType::handleDOMActivateEvent): (WebCore::BaseChooserOnlyDateAndTimeInputType::handleKeydownEvent): (WebCore::BaseChooserOnlyDateAndTimeInputType::handleKeypressEvent): (WebCore::BaseChooserOnlyDateAndTimeInputType::handleKeyupEvent): * html/BaseChooserOnlyDateAndTimeInputType.h: * html/BaseClickableWithKeyInputType.cpp: (WebCore::BaseClickableWithKeyInputType::handleKeydownEvent): (WebCore::BaseClickableWithKeyInputType::handleKeypressEvent): (WebCore::BaseClickableWithKeyInputType::handleKeyupEvent): * html/BaseClickableWithKeyInputType.h: * html/BaseDateAndTimeInputType.cpp: (WebCore::BaseDateAndTimeInputType::isKeyboardFocusable): * html/BaseDateAndTimeInputType.h: * html/CheckboxInputType.cpp: (WebCore::CheckboxInputType::handleKeyupEvent): * html/CheckboxInputType.h: * html/ColorInputType.cpp: (WebCore::ColorInputType::handleDOMActivateEvent): * html/ColorInputType.h: * html/FileInputType.cpp: (WebCore::FileInputType::handleDOMActivateEvent): * html/FileInputType.h: * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::isKeyboardFocusable): (WebCore::HTMLAnchorElement::defaultEventHandler): (WebCore::HTMLAnchorElement::handleClick): (WebCore::HTMLAnchorElement::eventType): (WebCore::isEnterKeyKeydownEvent): * html/HTMLAnchorElement.h: * html/HTMLAreaElement.cpp: (WebCore::HTMLAreaElement::isKeyboardFocusable): * html/HTMLAreaElement.h: * html/HTMLButtonElement.cpp: (WebCore::HTMLButtonElement::defaultEventHandler): * html/HTMLButtonElement.h: * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::isKeyboardFocusable): * html/HTMLFormControlElement.h: * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::submitImplicitly): (WebCore::submitElementFromEvent): (WebCore::HTMLFormElement::validateInteractively): (WebCore::HTMLFormElement::prepareForSubmission): * html/HTMLFormElement.h: * html/HTMLFrameOwnerElement.cpp: (WebCore::HTMLFrameOwnerElement::isKeyboardFocusable): * html/HTMLFrameOwnerElement.h: * html/HTMLFrameSetElement.cpp: (WebCore::HTMLFrameSetElement::defaultEventHandler): * html/HTMLFrameSetElement.h: * html/HTMLIFrameElement.h: * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::isKeyboardFocusable): (WebCore::HTMLInputElement::isTextFormControlKeyboardFocusable): (WebCore::HTMLInputElement::willDispatchEvent): (WebCore::HTMLInputElement::defaultEventHandler): * html/HTMLInputElement.h: * html/HTMLLabelElement.cpp: (WebCore::HTMLLabelElement::defaultEventHandler): * html/HTMLLabelElement.h: * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::defaultEventHandler): * html/HTMLLinkElement.h: * html/HTMLPlugInElement.cpp: (WebCore::HTMLPlugInElement::defaultEventHandler): (WebCore::HTMLPlugInElement::isKeyboardFocusable): * html/HTMLPlugInElement.h: * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::defaultEventHandler): * html/HTMLPlugInImageElement.h: * html/HTMLSelectElement.cpp: (WebCore::HTMLSelectElement::isKeyboardFocusable): (WebCore::HTMLSelectElement::menuListDefaultEventHandler): (WebCore::HTMLSelectElement::listBoxDefaultEventHandler): (WebCore::HTMLSelectElement::defaultEventHandler): * html/HTMLSelectElement.h: * html/HTMLSummaryElement.cpp: (WebCore::HTMLSummaryElement::defaultEventHandler): * html/HTMLSummaryElement.h: * html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::isKeyboardFocusable): (WebCore::HTMLTextAreaElement::defaultEventHandler): (WebCore::HTMLTextAreaElement::handleBeforeTextInsertedEvent): * html/HTMLTextAreaElement.h: * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::forwardEvent): * html/HTMLTextFormControlElement.h: * html/ImageInputType.cpp: (WebCore::ImageInputType::handleDOMActivateEvent): * html/ImageInputType.h: * html/InputType.cpp: (WebCore::InputType::handleClickEvent): (WebCore::InputType::handleMouseDownEvent): (WebCore::InputType::handleDOMActivateEvent): (WebCore::InputType::handleKeydownEvent): (WebCore::InputType::handleKeypressEvent): (WebCore::InputType::handleKeyupEvent): (WebCore::InputType::handleBeforeTextInsertedEvent): (WebCore::InputType::handleTouchEvent): (WebCore::InputType::forwardEvent): (WebCore::InputType::shouldSubmitImplicitly): (WebCore::InputType::dispatchSimulatedClickIfActive): (WebCore::InputType::isKeyboardFocusable): * html/InputType.h: * html/MediaDocument.cpp: (WebCore::MediaDocument::defaultEventHandler): * html/MediaDocument.h: * html/NumberInputType.cpp: (WebCore::NumberInputType::handleKeydownEvent): * html/NumberInputType.h: * html/RadioInputType.cpp: (WebCore::RadioInputType::handleClickEvent): (WebCore::RadioInputType::handleKeydownEvent): (WebCore::RadioInputType::handleKeyupEvent): (WebCore::RadioInputType::isKeyboardFocusable): * html/RadioInputType.h: * html/RangeInputType.cpp: (WebCore::RangeInputType::handleMouseDownEvent): (WebCore::RangeInputType::handleTouchEvent): (WebCore::RangeInputType::handleKeydownEvent): * html/RangeInputType.h: * html/ResetInputType.cpp: (WebCore::ResetInputType::handleDOMActivateEvent): * html/ResetInputType.h: * html/SearchInputType.cpp: (WebCore::SearchInputType::handleKeydownEvent): * html/SearchInputType.h: * html/SubmitInputType.cpp: (WebCore::SubmitInputType::handleDOMActivateEvent): * html/SubmitInputType.h: * html/TextFieldInputType.cpp: (WebCore::TextFieldInputType::isKeyboardFocusable): (WebCore::TextFieldInputType::handleKeydownEvent): (WebCore::TextFieldInputType::handleKeydownEventForSpinButton): (WebCore::TextFieldInputType::forwardEvent): (WebCore::TextFieldInputType::shouldSubmitImplicitly): (WebCore::TextFieldInputType::handleBeforeTextInsertedEvent): * html/TextFieldInputType.h: * html/shadow/AutoFillButtonElement.cpp: (WebCore::AutoFillButtonElement::defaultEventHandler): * html/shadow/AutoFillButtonElement.h: * html/shadow/MediaControlElementTypes.cpp: (WebCore::MediaControlMuteButtonElement::defaultEventHandler): (WebCore::MediaControlSeekButtonElement::defaultEventHandler): (WebCore::MediaControlVolumeSliderElement::defaultEventHandler): * html/shadow/MediaControlElementTypes.h: * html/shadow/MediaControlElements.cpp: (WebCore::MediaControlPanelElement::defaultEventHandler): (WebCore::MediaControlVolumeSliderContainerElement::defaultEventHandler): (WebCore::MediaControlPanelMuteButtonElement::defaultEventHandler): (WebCore::MediaControlPlayButtonElement::defaultEventHandler): (WebCore::MediaControlOverlayPlayButtonElement::defaultEventHandler): (WebCore::MediaControlRewindButtonElement::defaultEventHandler): (WebCore::MediaControlReturnToRealtimeButtonElement::defaultEventHandler): (WebCore::MediaControlToggleClosedCaptionsButtonElement::defaultEventHandler): (WebCore::MediaControlClosedCaptionsTrackListElement::defaultEventHandler): (WebCore::MediaControlTimelineElement::defaultEventHandler): (WebCore::MediaControlFullscreenButtonElement::defaultEventHandler): (WebCore::MediaControlFullscreenVolumeMinButtonElement::defaultEventHandler): (WebCore::MediaControlFullscreenVolumeMaxButtonElement::defaultEventHandler): * html/shadow/MediaControlElements.h: * html/shadow/MediaControls.cpp: (WebCore::MediaControls::defaultEventHandler): (WebCore::MediaControls::containsRelatedTarget): * html/shadow/MediaControls.h: * html/shadow/MediaControlsApple.cpp: (WebCore::MediaControlsApple::defaultEventHandler): (WebCore::MediaControlsApple::handleClickEvent): (WebCore::MediaControlsAppleEventListener::handleEvent): * html/shadow/MediaControlsApple.h: * html/shadow/SliderThumbElement.cpp: (WebCore::SliderThumbElement::defaultEventHandler): (WebCore::SliderThumbElement::handleTouchStart): (WebCore::SliderThumbElement::handleTouchMove): (WebCore::SliderThumbElement::handleTouchEndAndCancel): (WebCore::SliderThumbElement::handleTouchEvent): * html/shadow/SliderThumbElement.h: * html/shadow/SpinButtonElement.cpp: (WebCore::SpinButtonElement::defaultEventHandler): (WebCore::SpinButtonElement::forwardEvent): * html/shadow/SpinButtonElement.h: * html/shadow/TextControlInnerElements.cpp: (WebCore::TextControlInnerTextElement::defaultEventHandler): (WebCore::SearchFieldResultsButtonElement::defaultEventHandler): (WebCore::SearchFieldCancelButtonElement::defaultEventHandler): * html/shadow/TextControlInnerElements.h: * html/shadow/mac/ImageControlsButtonElementMac.cpp: (WebCore::ImageControlsButtonElementMac::defaultEventHandler): * html/shadow/mac/ImageControlsButtonElementMac.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::dispatchBeforeUnloadEvent): * mathml/MathMLElement.cpp: (WebCore::MathMLElement::defaultEventHandler): (WebCore::MathMLElement::isKeyboardFocusable): * mathml/MathMLElement.h: * mathml/MathMLSelectElement.cpp: (WebCore::MathMLSelectElement::defaultEventHandler): * mathml/MathMLSelectElement.h: * page/EventHandler.cpp: (WebCore::didScrollInScrollableArea): (WebCore::handleWheelEventInAppropriateEnclosingBox): (WebCore::EventHandler::defaultWheelEventHandler): (WebCore::EventHandler::keyEvent): (WebCore::handleKeyboardSelectionMovement): (WebCore::EventHandler::handleKeyboardSelectionMovementForAccessibility): (WebCore::EventHandler::defaultKeyboardEventHandler): (WebCore::EventHandler::defaultTextInputEventHandler): (WebCore::EventHandler::defaultSpaceEventHandler): (WebCore::EventHandler::defaultBackspaceEventHandler): (WebCore::EventHandler::defaultArrowEventHandler): (WebCore::EventHandler::defaultTabEventHandler): * page/EventHandler.h: * page/FocusController.cpp: (WebCore::isFocusableElementOrScopeOwner): (WebCore::isNonFocusableScopeOwner): (WebCore::isFocusableScopeOwner): (WebCore::FocusController::advanceFocusInDocumentOrder): (WebCore::FocusController::findFocusCandidateInContainer): * rendering/RenderFrameSet.cpp: (WebCore::RenderFrameSet::userResize): * rendering/RenderFrameSet.h: * svg/SVGAElement.cpp: (WebCore::SVGAElement::defaultEventHandler): (WebCore::SVGAElement::isKeyboardFocusable): * svg/SVGAElement.h: 2016-08-31 Antti Koivisto REGRESSION (r201701): Unable to copy from CodeMirror editor version used in Jenkins install website https://bugs.webkit.org/show_bug.cgi?id=161386 Reviewed by Dan Bernstein. This CodeMirror version uses a hidden