Fix rendering of WebKit2 QML WebView with ANGLE.

The WebKit2 QML WebView was not rendered on ANGLE builds
due to a precision mismatch for a uniform matrix used in
in both vertex and fragment shaders which made the ANGLE
compiler bail out on linking the shader program.

This was fixed by overriding the precision to highp in
both shaders.

Task-number: QTBUG-37043
Change-Id: I840f8e348d5de1c5900576e7d68c3f8ddcdfa4a7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Fix build on Android

Atomic increment/decrement was defined twice on Android, and gamepad support
doesn't build. This removesthe redundant definition, and disables gamepad
support on android.

Change-Id: I62ceae141564c4dec7a1b941ef832889e82736fb
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
Crash when submitting form in a document with null encoding

https://bugs.webkit.org/show_bug.cgi?id=123975

Reviewed by Alexey Proskuryakov.

Source/WebCore:

Merge https://chromium.googlesource.com/chromium/blink/+/bba01a7fff09e3053ada96ababac2a6e4261fe5f

The CString object which is passed to normalizeLineEndingsToCRLF() can be
a null string. It is created in FormDataList::appendString(), and it
produces a null CString if FormDataList::m_encoding is a null encoding.

Test: fast/forms/form-submit-in-image-document.html

* platform/text/LineEnding.cpp:
(internalNormalizeLineEndingsToCRLF):

Change-Id: Ia36bcf292fb4d1da7e4bb21e2eddf1146eecd71c
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158868 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Flash of garbage pixels when playing a show on Hulu

<https://webkit.org/b/119871>

Source/WebCore:

Reviewed by Tim Horton.

When starting a show on Hulu, there's a layer that gets marked as
opaque because it has a child RenderLayer whose background fills the
compositing layer. That child RenderLayer was recently position:fixed
but outside the viewport, so its viewportConstrainedNotCompositedReason
was set to a non-zero value.

However, we failed to clear the viewportConstrainedNotCompositedReason
when the layer became non-fixed. This caused painting the opaque
layer to bail in RenderLayer::paintLayer(), leaving garbage.

Test: compositing/contents-opaque/fixed-to-nonfixed.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintLayer): Add an assertion to catch this error in future.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateBacking): Make sure we clear the
ViewportConstrainedNotCompositedReason if the layer is no longer fixed.

Change-Id: Ie1aa935b8271cd8cc3159f5337d483a77d74b8a0
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154147 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Fix cast from QByteArray to QString

QUrl::toEncoded() returns a QByteArray which we should not try to append
directly to a QString. Instead convert it first from ascii/latin1.

Change-Id: I54fd1ef939cf25c81ad4f4ceab91fc4053b627ba
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Bump MODULE_VERSION to 5.3.1

Change-Id: Icef24bc1b350ed0e382578b0c6509589097effcd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Merge remote-tracking branch 'origin/release' into stable

Change-Id: Icd2b7e87cdd837d76f9bc11c65f6ee5a90407312
Fix build with clang on linux

Fixes a few issues with clang builds using libstdc++

Change-Id: I68d3af2c48bce42e2c5319c517e9b57bed2b729a
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Do not try to create invalid sized XPixmaps

If a visible plugin is resized to an empty size we request an empty
sized xpixmap which is illegal.

Instead hide and only free the exiting drawable.

Task-number: QTBUG-38541
Change-Id: I2cb3d221d656b1b18391c479168221bcd0aa73b1
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Merge "Merge remote-tracking branch 'origin/release' into stable" into refs/staging/stable
Fix stack initialization when running under .NET.

Under .NET, on WinXP and sometimes on Win7 we will have two blocks
of uncommited memory before the guard page, so look one block further.

In debug mode it would crash due to assert
guardPage.Protect & PAGE_GUARD

In release mode it would crash due to only using a 4K stack.

Change-Id: If9f2c84122ba95a18403a8f413d080dd5cc58250
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Reduce the command line length when generating bindings

With a working directory of only a few characters longer than our
build machines it's easy to end up getting a
"NMAKE : fatal error U1095" on Windows.

Unlike when invoking the compiler or the linker, we do not use
response files to pass to perl when generating JavaScript bindings.

Reduce the likeliness of getting this error for people building
QtWebKit themselves by avoiding specifying disabled features.
The binding generators do not include Platform.h like the normal
code does.

Task-Number: QTBUG-38632
Change-Id: Iaa1a1c75e8f6a6391f896067adbc5f3b55b59007
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Zooming transforms results in blurry backgrounds

An optimization to speedup pattern transforms results in blurry
background images when using CSS transforms.

This patch disables the optimization when QPainter already has a
transform, and the optimization would be both wrong and probably slower.

Test: svg/as-background-image/svg-transformed-background.html

Task-number: QTBUG-38588
Change-Id: I58739e21fd925048bc91f0ac973fae2036bcf713
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Update RenderImage when the image src is cleared

When the src is removed via JavaScript, the image loader now
updates the renderer.

BUG=123017

Review URL: https://chromiumcodereview.appspot.com/20473002

git-svn-id: svn://svn.chromium.org/blink/trunk@155294 bbb929c8-8fbe-4397-9dbb-9b2b20218538

Task-number: QTBUG-38287
Change-Id: I49c353cfa4ad1f7c1ceac80df81b8cb713d291df
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Fix problems with divot and lineStart mismatches.

https://bugs.webkit.org/show_bug.cgi?id=118662.

Reviewed by Oliver Hunt.

Source/JavaScriptCore:

r152494 added the recording of lineStart values for divot positions.
This is needed for the computation of column numbers. Similarly, it also
added the recording of line numbers for the divot positions. One problem
with the approach taken was that the line and lineStart values were
recorded independently, and hence were not always guaranteed to be
sampled at the same place that the divot position is recorded. This
resulted in potential mismatches that cause some assertions to fail.

The solution is to introduce a JSTextPosition abstraction that records
the divot position, line, and lineStart as a single quantity. Wherever
we record the divot position as an unsigned int previously, we now record
its JSTextPosition which captures all 3 values in one go. This ensures
that the captured line and lineStart will always match the captured divot
position.

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitCall):
(JSC::BytecodeGenerator::emitCallEval):
(JSC::BytecodeGenerator::emitCallVarargs):
(JSC::BytecodeGenerator::emitConstruct):
(JSC::BytecodeGenerator::emitDebugHook):
- Use JSTextPosition instead of passing line and lineStart explicitly.
* bytecompiler/BytecodeGenerator.h:
(JSC::BytecodeGenerator::emitExpressionInfo):
- Use JSTextPosition instead of passing line and lineStart explicitly.
* bytecompiler/NodesCodegen.cpp:
(JSC::ThrowableExpressionData::emitThrowReferenceError):
(JSC::ResolveNode::emitBytecode):
(JSC::BracketAccessorNode::emitBytecode):
(JSC::DotAccessorNode::emitBytecode):
(JSC::NewExprNode::emitBytecode):
(JSC::EvalFunctionCallNode::emitBytecode):
(JSC::FunctionCallValueNode::emitBytecode):
(JSC::FunctionCallResolveNode::emitBytecode):
(JSC::FunctionCallBracketNode::emitBytecode):
(JSC::FunctionCallDotNode::emitBytecode):
(JSC::CallFunctionCallDotNode::emitBytecode):
(JSC::ApplyFunctionCallDotNode::emitBytecode):
(JSC::PostfixNode::emitResolve):
(JSC::PostfixNode::emitBracket):
(JSC::PostfixNode::emitDot):
(JSC::DeleteResolveNode::emitBytecode):
(JSC::DeleteBracketNode::emitBytecode):
(JSC::DeleteDotNode::emitBytecode):
(JSC::PrefixNode::emitResolve):
(JSC::PrefixNode::emitBracket):
(JSC::PrefixNode::emitDot):
(JSC::UnaryOpNode::emitBytecode):
(JSC::BinaryOpNode::emitStrcat):
(JSC::BinaryOpNode::emitBytecode):
(JSC::ThrowableBinaryOpNode::emitBytecode):
(JSC::InstanceOfNode::emitBytecode):
(JSC::emitReadModifyAssignment):
(JSC::ReadModifyResolveNode::emitBytecode):
(JSC::AssignResolveNode::emitBytecode):
(JSC::AssignDotNode::emitBytecode):
(JSC::ReadModifyDotNode::emitBytecode):
(JSC::AssignBracketNode::emitBytecode):
(JSC::ReadModifyBracketNode::emitBytecode):
(JSC::ForInNode::emitBytecode):
(JSC::WithNode::emitBytecode):
(JSC::ThrowNode::emitBytecode):
- Use JSTextPosition instead of passing line and lineStart explicitly.
* parser/ASTBuilder.h:
- Replaced ASTBuilder::PositionInfo with JSTextPosition.
(JSC::ASTBuilder::BinaryOpInfo::BinaryOpInfo):
(JSC::ASTBuilder::AssignmentInfo::AssignmentInfo):
(JSC::ASTBuilder::createResolve):
(JSC::ASTBuilder::createBracketAccess):
(JSC::ASTBuilder::createDotAccess):
(JSC::ASTBuilder::createRegExp):
(JSC::ASTBuilder::createNewExpr):
(JSC::ASTBuilder::createAssignResolve):
(JSC::ASTBuilder::createExprStatement):
(JSC::ASTBuilder::createForInLoop):
(JSC::ASTBuilder::createReturnStatement):
(JSC::ASTBuilder::createBreakStatement):
(JSC::ASTBuilder::createContinueStatement):
(JSC::ASTBuilder::createLabelStatement):
(JSC::ASTBuilder::createWithStatement):
(JSC::ASTBuilder::createThrowStatement):
(JSC::ASTBuilder::appendBinaryExpressionInfo):
(JSC::ASTBuilder::appendUnaryToken):
(JSC::ASTBuilder::unaryTokenStackLastStart):
(JSC::ASTBuilder::assignmentStackAppend):
(JSC::ASTBuilder::createAssignment):
(JSC::ASTBuilder::setExceptionLocation):
(JSC::ASTBuilder::makeDeleteNode):
(JSC::ASTBuilder::makeFunctionCallNode):
(JSC::ASTBuilder::makeBinaryNode):
(JSC::ASTBuilder::makeAssignNode):
(JSC::ASTBuilder::makePrefixNode):
(JSC::ASTBuilder::makePostfixNode):
- Use JSTextPosition instead of passing line and lineStart explicitly.
* parser/Lexer.cpp:
(JSC::::lex):
- Added support for capturing the appropriate JSTextPositions instead
    of just the character offset.
* parser/Lexer.h:
(JSC::Lexer::currentPosition):
(JSC::::lexExpectIdentifier):
- Added support for capturing the appropriate JSTextPositions instead
    of just the character offset.
* parser/NodeConstructors.h:
(JSC::Node::Node):
(JSC::ResolveNode::ResolveNode):
(JSC::EvalFunctionCallNode::EvalFunctionCallNode):
(JSC::FunctionCallValueNode::FunctionCallValueNode):
(JSC::FunctionCallResolveNode::FunctionCallResolveNode):
(JSC::FunctionCallBracketNode::FunctionCallBracketNode):
(JSC::FunctionCallDotNode::FunctionCallDotNode):
(JSC::CallFunctionCallDotNode::CallFunctionCallDotNode):
(JSC::ApplyFunctionCallDotNode::ApplyFunctionCallDotNode):
(JSC::PostfixNode::PostfixNode):
(JSC::DeleteResolveNode::DeleteResolveNode):
(JSC::DeleteBracketNode::DeleteBracketNode):
(JSC::DeleteDotNode::DeleteDotNode):
(JSC::PrefixNode::PrefixNode):
(JSC::ReadModifyResolveNode::ReadModifyResolveNode):
(JSC::ReadModifyBracketNode::ReadModifyBracketNode):
(JSC::AssignBracketNode::AssignBracketNode):
(JSC::AssignDotNode::AssignDotNode):
(JSC::ReadModifyDotNode::ReadModifyDotNode):
(JSC::AssignErrorNode::AssignErrorNode):
(JSC::WithNode::WithNode):
(JSC::ForInNode::ForInNode):
- Use JSTextPosition instead of passing line and lineStart explicitly.
* parser/Nodes.cpp:
(JSC::StatementNode::setLoc):
- Use JSTextPosition instead of passing line and lineStart explicitly.
* parser/Nodes.h:
(JSC::Node::lineNo):
(JSC::Node::startOffset):
(JSC::Node::lineStartOffset):
(JSC::Node::position):
(JSC::ThrowableExpressionData::ThrowableExpressionData):
(JSC::ThrowableExpressionData::setExceptionSourceCode):
(JSC::ThrowableExpressionData::divot):
(JSC::ThrowableExpressionData::divotStart):
(JSC::ThrowableExpressionData::divotEnd):
(JSC::ThrowableSubExpressionData::ThrowableSubExpressionData):
(JSC::ThrowableSubExpressionData::setSubexpressionInfo):
(JSC::ThrowableSubExpressionData::subexpressionDivot):
(JSC::ThrowableSubExpressionData::subexpressionStart):
(JSC::ThrowableSubExpressionData::subexpressionEnd):
(JSC::ThrowablePrefixedSubExpressionData::ThrowablePrefixedSubExpressionData):
(JSC::ThrowablePrefixedSubExpressionData::setSubexpressionInfo):
(JSC::ThrowablePrefixedSubExpressionData::subexpressionDivot):
(JSC::ThrowablePrefixedSubExpressionData::subexpressionStart):
(JSC::ThrowablePrefixedSubExpressionData::subexpressionEnd):
- Use JSTextPosition instead of passing line and lineStart explicitly.
* parser/Parser.cpp:
(JSC::::Parser):
(JSC::::parseInner):
- Use JSTextPosition instead of passing line and lineStart explicitly.
(JSC::::didFinishParsing):
- Remove setting of m_lastLine value. We always pass in the value from
    m_lastLine anyway. So, this assignment is effectively a nop.
(JSC::::parseVarDeclaration):
(JSC::::parseVarDeclarationList):
(JSC::::parseForStatement):
(JSC::::parseBreakStatement):
(JSC::::parseContinueStatement):
(JSC::::parseReturnStatement):
(JSC::::parseThrowStatement):
(JSC::::parseWithStatement):
(JSC::::parseTryStatement):
(JSC::::parseBlockStatement):
(JSC::::parseFunctionDeclaration):
(JSC::LabelInfo::LabelInfo):
(JSC::::parseExpressionOrLabelStatement):
(JSC::::parseExpressionStatement):
(JSC::::parseAssignmentExpression):
(JSC::::parseBinaryExpression):
(JSC::::parseProperty):
(JSC::::parsePrimaryExpression):
(JSC::::parseMemberExpression):
(JSC::::parseUnaryExpression):
- Use JSTextPosition instead of passing line and lineStart explicitly.
* parser/Parser.h:
(JSC::Parser::next):
(JSC::Parser::nextExpectIdentifier):
(JSC::Parser::getToken):
(JSC::Parser::tokenStartPosition):
(JSC::Parser::tokenEndPosition):
(JSC::Parser::lastTokenEndPosition):
(JSC::::parse):
- Use JSTextPosition instead of passing line and lineStart explicitly.
* parser/ParserTokens.h:
(JSC::JSTextPosition::JSTextPosition):
(JSC::JSTextPosition::operator+):
(JSC::JSTextPosition::operator-):
(JSC::JSTextPosition::operator int):
- Added JSTextPosition.
* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::makeFunctionCallNode):
(JSC::SyntaxChecker::makeAssignNode):
(JSC::SyntaxChecker::makePrefixNode):
(JSC::SyntaxChecker::makePostfixNode):
(JSC::SyntaxChecker::makeDeleteNode):
(JSC::SyntaxChecker::createResolve):
(JSC::SyntaxChecker::createBracketAccess):
(JSC::SyntaxChecker::createDotAccess):
(JSC::SyntaxChecker::createRegExp):
(JSC::SyntaxChecker::createNewExpr):
(JSC::SyntaxChecker::createAssignResolve):
(JSC::SyntaxChecker::createForInLoop):
(JSC::SyntaxChecker::createReturnStatement):
(JSC::SyntaxChecker::createBreakStatement):
(JSC::SyntaxChecker::createContinueStatement):
(JSC::SyntaxChecker::createWithStatement):
(JSC::SyntaxChecker::createLabelStatement):
(JSC::SyntaxChecker::createThrowStatement):
(JSC::SyntaxChecker::appendBinaryExpressionInfo):
(JSC::SyntaxChecker::operatorStackPop):
- Use JSTextPosition instead of passing line and lineStart explicitly.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153477 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Task-number: QTBUG-38708
Change-Id: Ic6a65e8915c634dffe76b7181b38d6be0ab4a45d
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Origin spoofing possible due to inappropriate URL escape sequence decoding

https://bugs.webkit.org/show_bug.cgi?id=131837
rdar://problem/15211936

Reviewed by Anders Carlsson and Dave Hyatt.

Tests: fast/dom/DOMURL/parsing.html
       fast/dom/HTMLAnchorElement/anchor-element-href-parsing.html

* platform/URL.cpp:
(WebCore::URL::host): Removed unnecessary call to
decodeURLEscapeSequences, which caused
problems and was not needed.

Change-Id: Idddc6efe310389b8e68db2d8c312c2098121e6d9
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167480 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Fix crash in pixmapToImageData binding

The result of JSContextGetGlobalObject is a wrapper-object not a
direct pointer to the global object. Instead access the global object
directly since we are already using other parts of the internal JS API.

The patch also adds a missing API shim that should be held when using the
internal JS API.

Task-number: QTBUG-38809
Change-Id: I76eccbbd6cb1b9fd3322596bb7d6a3f9b0e694b8
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Fix leak of QSensors on QWebPage creation

The WebCore page supplements are not deleted when the page is, so we
need to track them in QWebPageAdapter and delete them there.

Task-number: QTBUG-38857
Change-Id: Ib3e41074de3bebf00f017523d28efc1c923250f3
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Stop the clearContentsTimer when removing an image backing.

It creates a race condition that can lead to crashes when the WebView's
visible property is set to false and the image backing is removed
shortly after.

Task-number: QTBUG-38841
Change-Id: I0775ba33fda9cee5f86ef50a4fbe048602564296
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Fix scrollbar handles so it follows cursor position when on a page

When a webpage contains a scrollbar as part of an element inside it
then the scrollbar handle should be in sync with the cursor when
the handle is moved.

Task-number: QTBUG-38360
Change-Id: I1f5474ad9b5e8dc232b307f4c5927833577afe1b
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>