Commit 89621194 authored by Alberto Garcia's avatar Alberto Garcia
Browse files

New upstream version 2.30.3

parent a38669eb
================
WebKitGTK 2.30.3
================
What's new in WebKitGTK 2.30.3?
- Add new build option USE(64KB_PAGE_BLOCK).
- Fix backdrop filters with rounded borders.
- Fix scrolling iframes when async scrolling is enabled.
- Allow applications to handle drag and drop on the web view again.
- Update Outlook user agent quirk.
- Fix the build with video support disabled.
- Fix several crashes and rendering issues.
================
WebKitGTK 2.30.2
================
......
......@@ -123,6 +123,8 @@ public:
{
if (!(mask + 1))
return top<T>();
if (mask < 0)
return IntRange(INT_MIN & mask, mask & INT_MAX);
return IntRange(0, mask);
}
......
......@@ -804,6 +804,7 @@ void testCheckAddRemoveCheckWithZExt32(int32_t);
void testCheckSubImm();
void testCheckSubBadImm();
void testCheckSub();
void testCheckSubBitAnd();
double doubleSub(double, double);
void testCheckSub64();
void testCheckSubFold(int, int);
......
......@@ -496,6 +496,7 @@ void run(const char* filter)
RUN(testCheckSubImm());
RUN(testCheckSubBadImm());
RUN(testCheckSub());
RUN(testCheckSubBitAnd());
RUN(testCheckSub64());
RUN(testCheckSubFold(100, 200));
RUN(testCheckSubFoldFail(-2147483647, 100));
......
......@@ -1125,6 +1125,38 @@ void testCheckSub()
CHECK(invoke<double>(*code, -2147483647, 42) == -2147483689.0);
}
void testCheckSubBitAnd()
{
Procedure proc;
if (proc.optLevel() < 1)
return;
BasicBlock* root = proc.addBlock();
Value* zero = root->appendNew<Const32Value>(proc, Origin(), 0);
Value* arg1 = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0);
Value* truncatedArg1 = root->appendNew<Value>(proc, Trunc, Origin(), arg1);
Value* minusTwo = root->appendNew<Const32Value>(proc, Origin(), -2);
Value* bitAnd = root->appendNew<Value>(proc, BitAnd, Origin(), truncatedArg1, minusTwo);
CheckValue* checkSub = root->appendNew<CheckValue>(proc, CheckSub, Origin(), zero, bitAnd);
checkSub->setGenerator([&] (CCallHelpers& jit, const StackmapGenerationParams&) {
AllowMacroScratchRegisterUsage allowScratch(jit);
jit.move(CCallHelpers::TrustedImm32(42), GPRInfo::returnValueGPR);
jit.emitFunctionEpilogue();
jit.ret();
});
root->appendNewControlValue(proc, Return, Origin(), checkSub);
auto code = compileProc(proc);
CHECK_EQ(invoke<int>(*code, 1), 0);
CHECK_EQ(invoke<int>(*code, 2), -2);
CHECK_EQ(invoke<int>(*code, 3), -2);
CHECK_EQ(invoke<int>(*code, -1), 2);
CHECK_EQ(invoke<int>(*code, -2), 2);
CHECK_EQ(invoke<int>(*code, -3), 4);
CHECK_EQ(invoke<int>(*code, INT_MAX), -(INT_MAX - 1));
CHECK_EQ(invoke<int>(*code, INT_MIN), 42);
}
NEVER_INLINE double doubleSub(double a, double b)
{
return a - b;
......
......@@ -49,10 +49,10 @@ namespace WTF {
// Use 64 KiB for any unknown CPUs to be conservative.
#if OS(DARWIN) || PLATFORM(PLAYSTATION)
constexpr size_t CeilingOnPageSize = 16 * KB;
#elif USE(64KB_PAGE_BLOCK) || CPU(PPC) || CPU(PPC64) || CPU(PPC64LE) || CPU(UNKNOWN)
constexpr size_t CeilingOnPageSize = 64 * KB;
#elif OS(WINDOWS) || CPU(MIPS) || CPU(MIPS64) || CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64)
constexpr size_t CeilingOnPageSize = 4 * KB;
#elif CPU(UNKNOWN) || CPU(PPC) || CPU(PPC64) || CPU(PPC64LE)
constexpr size_t CeilingOnPageSize = 64 * KB;
#else
#error Must set CeilingOnPageSize in PageBlock.h when adding a new CPU architecture!
#endif
......
......@@ -917,6 +917,8 @@ bool portAllowed(const URL& url)
3659, // apple-sasl / PasswordServer [Apple addition]
4045, // lockd
4190, // ManageSieve [Apple addition]
5060, // SIP
5061, // SIPS
6000, // X11
6665, // Alternate IRC [Apple addition]
6666, // Alternate IRC [Apple addition]
......
......@@ -29,6 +29,7 @@
#include "AudioContext.h"
#include "DefaultAudioDestinationNode.h"
#include "Document.h"
#include "JSDOMPromiseDeferred.h"
#include <wtf/IsoMallocInlines.h>
......
......@@ -77,6 +77,8 @@ protected:
void reportExposedUnfilledArea(MonotonicTime, unsigned unfilledArea) override;
void reportSynchronousScrollingReasonsChanged(MonotonicTime, OptionSet<SynchronousScrollingReason>) override;
RefPtr<AsyncScrollingCoordinator> m_scrollingCoordinator;
private:
bool isThreadedScrollingTree() const override { return true; }
void propagateSynchronousScrollingReasons(const HashSet<ScrollingNodeID>&) override;
......@@ -89,8 +91,6 @@ private:
Seconds maxAllowableRenderingUpdateDurationForSynchronization();
RefPtr<AsyncScrollingCoordinator> m_scrollingCoordinator;
enum class SynchronizationState : uint8_t {
Idle,
WaitingForRenderingUpdate,
......
......@@ -47,6 +47,8 @@ public:
static Ref<ScrollingTreeFrameScrollingNode> create(ScrollingTree&, ScrollingNodeType, ScrollingNodeID);
virtual ~ScrollingTreeFrameScrollingNodeNicosia();
RefPtr<Nicosia::CompositionLayer> rootContentsLayer() const { return m_rootContentsLayer; }
private:
ScrollingTreeFrameScrollingNodeNicosia(ScrollingTree&, ScrollingNodeType, ScrollingNodeID);
......
......@@ -30,6 +30,8 @@
#if ENABLE(ASYNC_SCROLLING) && USE(NICOSIA)
#include "AsyncScrollingCoordinator.h"
#include "NicosiaPlatformLayer.h"
#include "ScrollingTreeFixedNode.h"
#include "ScrollingTreeFrameHostingNode.h"
#include "ScrollingTreeFrameScrollingNodeNicosia.h"
......@@ -73,6 +75,68 @@ Ref<ScrollingTreeNode> ScrollingTreeNicosia::createScrollingTreeNode(ScrollingNo
RELEASE_ASSERT_NOT_REACHED();
}
using Nicosia::CompositionLayer;
static void collectDescendantLayersAtPoint(Vector<RefPtr<CompositionLayer>>& layersAtPoint, RefPtr<CompositionLayer> parent, const FloatPoint& point)
{
bool childExistsAtPoint = false;
parent->accessPending([&](const CompositionLayer::LayerState& state) {
for (auto child : state.children) {
bool containsPoint = false;
FloatPoint transformedPoint;
child->accessPending([&](const CompositionLayer::LayerState& childState) {
if (!childState.transform.isInvertible())
return;
float originX = childState.anchorPoint.x() * childState.size.width();
float originY = childState.anchorPoint.y() * childState.size.height();
auto transform = *(TransformationMatrix()
.translate3d(originX + childState.position.x(), originY + childState.position.y(), childState.anchorPoint.z())
.multiply(childState.transform)
.translate3d(-originX, -originY, -childState.anchorPoint.z()).inverse());
auto childPoint = transform.projectPoint(point);
if (FloatRect(FloatPoint(), childState.size).contains(childPoint)) {
containsPoint = true;
transformedPoint.set(childPoint.x(), childPoint.y());
}
});
if (containsPoint) {
childExistsAtPoint = true;
collectDescendantLayersAtPoint(layersAtPoint, child, transformedPoint);
}
}
});
if (!childExistsAtPoint)
layersAtPoint.append(parent);
}
RefPtr<ScrollingTreeNode> ScrollingTreeNicosia::scrollingNodeForPoint(FloatPoint point)
{
auto* rootScrollingNode = rootNode();
if (!rootScrollingNode)
return nullptr;
LayerTreeHitTestLocker layerLocker(m_scrollingCoordinator.get());
auto rootContentsLayer = static_cast<ScrollingTreeFrameScrollingNodeNicosia*>(rootScrollingNode)->rootContentsLayer();
Vector<RefPtr<CompositionLayer>> layersAtPoint;
collectDescendantLayersAtPoint(layersAtPoint, rootContentsLayer, point);
ScrollingTreeNode* returnNode = nullptr;
for (auto layer : WTF::makeReversedRange(layersAtPoint)) {
layer->accessCommitted([&](const CompositionLayer::LayerState& state) {
auto* scrollingNode = nodeForID(state.scrollingNodeID);
if (is<ScrollingTreeScrollingNode>(scrollingNode))
returnNode = scrollingNode;
});
if (returnNode)
break;
}
return returnNode ? returnNode : rootScrollingNode;
}
} // namespace WebCore
#endif // ENABLE(ASYNC_SCROLLING) && USE(NICOSIA)
......@@ -41,6 +41,8 @@ private:
explicit ScrollingTreeNicosia(AsyncScrollingCoordinator&);
Ref<ScrollingTreeNode> createScrollingTreeNode(ScrollingNodeType, ScrollingNodeID) override;
RefPtr<ScrollingTreeNode> scrollingNodeForPoint(FloatPoint) final;
};
} // namespace WebCore
......
......@@ -140,7 +140,7 @@ static bool urlRequiresMacintoshPlatform(const URL& url)
// Microsoft Outlook Web App forces users with WebKitGTK's standard user
// agent to use the light version. Earlier versions even block users from
// accessing the calendar.
if (domain == "outlook.live.com"
if (domain == "outlook.office.com"
|| domain == "mail.ntu.edu.tw"
|| domain == "exchange.tu-berlin.de")
return true;
......
......@@ -394,7 +394,7 @@ void ImageDecoderGStreamer::pushEncodedData(const SharedBuffer& buffer)
}
}
m_innerDecoder = nullptr;
callOnMainThread([this] {
callOnMainThreadAndWait([&] {
if (m_encodedDataStatusChangedCallback)
m_encodedDataStatusChangedCallback(encodedDataStatus());
});
......
......@@ -37,6 +37,7 @@
#include "NicosiaAnimatedBackingStoreClient.h"
#include "NicosiaAnimation.h"
#include "NicosiaSceneIntegration.h"
#include "ScrollTypes.h"
#include "TransformationMatrix.h"
#include <wtf/Function.h>
#include <wtf/Lock.h>
......@@ -134,6 +135,7 @@ public:
bool animatedBackingStoreClientChanged : 1;
bool repaintCounterChanged : 1;
bool debugBorderChanged : 1;
bool scrollingNodeChanged : 1;
};
uint32_t value { 0 };
};
......@@ -183,6 +185,7 @@ public:
RefPtr<CompositionLayer> replica;
RefPtr<CompositionLayer> mask;
RefPtr<CompositionLayer> backdropLayer;
WebCore::FloatRoundedRect backdropFiltersRect;
RefPtr<ContentLayer> contentLayer;
RefPtr<BackingStore> backingStore;
......@@ -198,6 +201,8 @@ public:
float width { 0 };
bool visible { false };
} debugBorder;
WebCore::ScrollingNodeID scrollingNodeID { 0 };
};
template<typename T>
......@@ -248,6 +253,8 @@ public:
staging.filters = pending.filters;
if (pending.delta.backdropFiltersChanged)
staging.backdropLayer = pending.backdropLayer;
if (pending.delta.backdropFiltersRectChanged)
staging.backdropFiltersRect = pending.backdropFiltersRect;
if (pending.delta.animationsChanged)
staging.animations = pending.animations;
......@@ -266,6 +273,9 @@ public:
if (pending.delta.debugBorderChanged)
staging.debugBorder = pending.debugBorder;
if (pending.delta.scrollingNodeChanged)
staging.scrollingNodeID = pending.scrollingNodeID;
if (pending.delta.backingStoreChanged)
staging.backingStore = pending.backingStore;
if (pending.delta.contentLayerChanged)
......@@ -290,6 +300,13 @@ public:
functor(m_state.committed);
}
template<typename T>
void accessPending(const T& functor)
{
LockHolder locker(PlatformLayer::m_state.lock);
functor(m_state.pending);
}
template<typename T>
void accessCommitted(const T& functor)
{
......
......@@ -47,6 +47,15 @@ ImageBackingTextureMapperImpl::~ImageBackingTextureMapperImpl() = default;
void ImageBackingTextureMapperImpl::flushUpdate()
{
LockHolder locker(m_update.lock);
// If the update happens for the same image and there's no buffer, keep the current one
// so it can be received by the CoordinatedGraphicsScene. In that case we only need to update
// the isVisible flag.
if ((m_layerState.update.nativeImageID == m_update.update.nativeImageID) && !m_layerState.update.buffer) {
m_update.update.isVisible = m_layerState.update.isVisible;
return;
}
m_update.update = WTFMove(m_layerState.update);
}
......
......@@ -60,6 +60,7 @@ public:
bool isVisible { false };
RefPtr<Nicosia::Buffer> buffer;
uintptr_t nativeImageID { 0 };
};
// An immutable layer-side state object. flushUpdate() prepares
......@@ -72,7 +73,6 @@ public:
LayerState& operator=(LayerState&&) = delete;
uintptr_t imageID { 0 };
uintptr_t nativeImageID { 0 };
Update update;
};
LayerState& layerState() { return m_layerState; }
......
......@@ -80,6 +80,7 @@ void BitmapTextureGL::didReset()
m_shouldClear = true;
m_colorConvertFlags = TextureMapperGL::NoFlag;
m_filterInfo = FilterInfo();
if (m_textureSize == contentSize())
return;
......
......@@ -62,6 +62,37 @@ void ClipStack::setStencilIndex(int stencilIndex)
clipStateDirty = true;
}
void ClipStack::addRoundedRect(const FloatRoundedRect& roundedRect, const TransformationMatrix& matrix)
{
if (clipState.roundedRectCount >= s_roundedRectMaxClips)
return;
// Ensure that the vectors holding the components have the required size.
m_roundedRectComponents.grow(s_roundedRectComponentsArraySize);
m_roundedRectInverseTransformComponents.grow(s_roundedRectInverseTransformComponentsArraySize);
// Copy the RoundedRect components to the appropriate position in the array.
int basePosition = clipState.roundedRectCount * s_roundedRectComponentsPerRect;
m_roundedRectComponents[basePosition] = roundedRect.rect().x();
m_roundedRectComponents[basePosition + 1] = roundedRect.rect().y();
m_roundedRectComponents[basePosition + 2] = roundedRect.rect().width();
m_roundedRectComponents[basePosition + 3] = roundedRect.rect().height();
m_roundedRectComponents[basePosition + 4] = roundedRect.radii().topLeft().width();
m_roundedRectComponents[basePosition + 5] = roundedRect.radii().topLeft().height();
m_roundedRectComponents[basePosition + 6] = roundedRect.radii().topRight().width();
m_roundedRectComponents[basePosition + 7] = roundedRect.radii().topRight().height();
m_roundedRectComponents[basePosition + 8] = roundedRect.radii().bottomLeft().width();
m_roundedRectComponents[basePosition + 9] = roundedRect.radii().bottomLeft().height();
m_roundedRectComponents[basePosition + 10] = roundedRect.radii().bottomRight().width();
m_roundedRectComponents[basePosition + 11] = roundedRect.radii().bottomRight().height();
// Copy the TransformationMatrix components to the appropriate position in the array.
basePosition = clipState.roundedRectCount * s_roundedRectInverseTransformComponentsPerRect;
memcpy(m_roundedRectInverseTransformComponents.data() + basePosition, matrix.toColumnMajorFloatArray().data(), s_roundedRectInverseTransformComponentsPerRect * sizeof(float));
clipState.roundedRectCount++;
}
void ClipStack::apply()
{
if (clipState.scissorBox.isEmpty())
......
......@@ -21,22 +21,41 @@
#ifndef ClipStack_h
#define ClipStack_h
#include "FloatRoundedRect.h"
#include "IntRect.h"
#include "IntSize.h"
#include "TransformationMatrix.h"
#include <wtf/Vector.h>
namespace WebCore {
// Because GLSL uniform arrays need to have a defined size, we need to put a limit to the number of simultaneous
// rounded rectangle clips that we're going to allow. Currently this is defined to 10.
// This value must be kept in sync with the sizes defined in TextureMapperShaderProgram.cpp.
static const unsigned s_roundedRectMaxClips = 10;
// When converting a rounded rectangle to an array of floats, we need 12 elements. So the size of the array
// required to contain the 10 rectangles is 12 * 10 = 120.
// This value must be kept in sync with the sizes defined in TextureMapperShaderProgram.cpp.
static const unsigned s_roundedRectComponentsPerRect = 12;
static const unsigned s_roundedRectComponentsArraySize = s_roundedRectMaxClips * s_roundedRectComponentsPerRect;
// When converting a transformation matrix to an array of floats, we need 16 elements. So the size of the array
// required to contain the 10 matrices is 16 * 10 = 160.
// This value must be kept in sync with the sizes defined in TextureMapperShaderProgram.cpp.
static const unsigned s_roundedRectInverseTransformComponentsPerRect = 16;
static const unsigned s_roundedRectInverseTransformComponentsArraySize = s_roundedRectMaxClips * s_roundedRectInverseTransformComponentsPerRect;
class ClipStack {
public:
struct State {
State(const IntRect& scissors = IntRect(), int stencil = 1)
explicit State(const IntRect& scissors = IntRect())
: scissorBox(scissors)
, stencilIndex(stencil)
{ }
IntRect scissorBox;
int stencilIndex;
int stencilIndex { 1 };
unsigned roundedRectCount { 0 };
};
// Y-axis should be inverted only when painting into the window.
......@@ -54,6 +73,13 @@ public:
void setStencilIndex(int);
int getStencilIndex() const { return clipState.stencilIndex; }
void addRoundedRect(const FloatRoundedRect&, const TransformationMatrix&);
const float* roundedRectComponents() const { return m_roundedRectComponents.data(); }
const float* roundedRectInverseTransformComponents() const { return m_roundedRectInverseTransformComponents.data(); }
unsigned roundedRectCount() const { return clipState.roundedRectCount; }
bool isRoundedRectClipEnabled() const { return !!clipState.roundedRectCount; }
bool isRoundedRectClipAllowed() const { return clipState.roundedRectCount < s_roundedRectMaxClips; }
void apply();
void applyIfNeeded();
......@@ -65,6 +91,8 @@ private:
IntSize size;
bool clipStateDirty { false };
YAxisMode yAxisMode { YAxisMode::Default };
Vector<float, s_roundedRectComponentsArraySize> m_roundedRectComponents;
Vector<float, s_roundedRectInverseTransformComponentsArraySize> m_roundedRectInverseTransformComponents;
};
} // namespace WebCore
......
......@@ -498,7 +498,7 @@ void GraphicsLayerTextureMapper::updateBackingStoreIncludingSubLayers()
if (maskLayer())
downcast<GraphicsLayerTextureMapper>(*maskLayer()).updateBackingStoreIfNeeded();
if (replicaLayer())
downcast<GraphicsLayerTextureMapper>(*replicaLayer()).updateBackingStoreIfNeeded();
downcast<GraphicsLayerTextureMapper>(*replicaLayer()).updateBackingStoreIncludingSubLayers();
for (auto& child : children())
downcast<GraphicsLayerTextureMapper>(child.get()).updateBackingStoreIncludingSubLayers();
}
......
......@@ -37,6 +37,7 @@ class BitmapTexturePool;
class GraphicsLayer;
class TextureMapper;
class FilterOperations;
class FloatRoundedRect;
class TextureMapper {
WTF_MAKE_FAST_ALLOCATED;
......@@ -75,7 +76,7 @@ public:
// makes a surface the target for the following drawTexture calls.
virtual void bindSurface(BitmapTexture* surface) = 0;
virtual void beginClip(const TransformationMatrix&, const FloatRect&) = 0;
virtual void beginClip(const TransformationMatrix&, const FloatRoundedRect&) = 0;
virtual void endClip() = 0;
virtual IntRect clipBounds() = 0;
virtual Ref<BitmapTexture> createTexture() = 0;
......
......@@ -29,6 +29,7 @@
#include "ExtensionsGL.h"
#include "FilterOperations.h"
#include "FloatQuad.h"
#include "FloatRoundedRect.h"
#include "GLContext.h"
#include "GraphicsContext.h"
#include "Image.h"
......@@ -442,6 +443,15 @@ static TransformationMatrix colorSpaceMatrixForFlags(TextureMapperGL::Flags flag
return matrix;
}
static void prepareRoundedRectClip(TextureMapperShaderProgram& program, const float* rects, const float* transforms, int nRects)
{
glUseProgram(program.programID());
glUniform1i(program.roundedRectNumberLocation(), nRects);
glUniform4fv(program.roundedRectLocation(), 3 * nRects, rects);
glUniformMatrix4fv(program.roundedRectInverseTransformMatrixLocation(), nRects, false, transforms);
}
void TextureMapperGL::drawTexture(const BitmapTexture& texture, const FloatRect& targetRect, const TransformationMatrix& matrix, float opacity, unsigned exposedEdges)
{
if (!texture.isValid())
......@@ -489,11 +499,19 @@ void TextureMapperGL::drawTexture(GLuint texture, Flags flags, const IntSize& te
if (useAntialiasing || opacity < 1)
flags |= ShouldBlend;
if (clipStack().isRoundedRectClipEnabled()) {
options |= TextureMapperShaderProgram::RoundedRectClip;
flags |= ShouldBlend;
}
Ref<TextureMapperShaderProgram> program = data().getShaderProgram(options);
if (filter)
prepareFilterProgram(program.get(), *filter.get(), data().filterInfo->pass, textureSize, filterContentTextureID);
if (clipStack().isRoundedRectClipEnabled())
prepareRoundedRectClip(program.get(), clipStack().roundedRectComponents(), clipStack().roundedRectInverseTransformComponents(), clipStack().roundedRectCount());
drawTexturedQuadWithProgram(program.get(), texture, flags, textureSize, targetRect, modelViewMatrix, opacity);
}
......@@ -552,11 +570,19 @@ void TextureMapperGL::drawTexturePlanarYUV(const std::array<GLuint, 3>& textures
if (useAntialiasing || opacity < 1)
flags |= ShouldBlend;
if (clipStack().isRoundedRectClipEnabled()) {
options |= TextureMapperShaderProgram::RoundedRectClip;
flags |= ShouldBlend;
}
Ref<TextureMapperShaderProgram> program = data().getShaderProgram(options);
if (filter)
prepareFilterProgram(program.get(), *filter.get(), data().filterInfo->pass, textureSize, filterContentTextureID);
if (clipStack().isRoundedRectClipEnabled())
prepareRoundedRectClip(program.get(), clipStack().roundedRectComponents(), clipStack().roundedRectInverseTransformComponents(), clipStack().roundedRectCount());
Vector<std::pair<GLuint, GLuint> > texturesAndSamplers = {
{ textures[0], program->samplerYLocation() },
{ textures[1], program->samplerULocation() },
......@@ -602,11 +628,19 @@ void TextureMapperGL::drawTextureSemiPlanarYUV(const std::array<GLuint, 2>& text
if (useAntialiasing || opacity < 1)
flags |= ShouldBlend;
if (clipStack().isRoundedRectClipEnabled()) {
options |= TextureMapperShaderProgram::RoundedRectClip;
flags |= ShouldBlend;
}
Ref<TextureMapperShaderProgram> program = data().getShaderProgram(options);
if (filter)
prepareFilterProgram(program.get(), *filter.get(), data().filterInfo->pass, textureSize, filterContentTextureID);
if (clipStack().isRoundedRectClipEnabled())
prepareRoundedRectClip(program.get(), clipStack().roundedRectComponents(), clipStack().roundedRectInverseTransformComponents(), clipStack().roundedRectCount());
Vector<std::pair<GLuint, GLuint> > texturesAndSamplers =