[MinGW-w64] Centralize workaround for pow() implementation
https://bugs.webkit.org/show_bug.cgi?id=105925

Reviewed by Sam Weinig.

As suggested by Sam, move the MinGW-w64 workaround into MathExtras.h
away from the JSC usage.

Source/JavaScriptCore:

* runtime/MathObject.cpp:
(JSC::mathPow):

Source/WTF:

* wtf/MathExtras.h:
(wtf_pow):

Change-Id: I49b2365baae6fdd9700667d1ef53c78bd70f6de3
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138705 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Fix compilation of MathExtras.h with MinGW-w64
https://bugs.webkit.org/show_bug.cgi?id=106105

Patch by Jonathan Liu <net147@gmail.com> on 2013-01-05
Reviewed by Simon Hausmann.

The isfinite and isinf functions are required by wtf_pow but
not defined until after wtf_pow. Move wtf_pow to after
"using std::isfinite" and "using std::isinf" to fix compilation.

* wtf/MathExtras.h:
(wtf_pow):

Change-Id: I40122dfe90460b5281da7a9fe628417805330e0d
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138894 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Only enable MinGW-w64 pow() workaround if needed
https://bugs.webkit.org/show_bug.cgi?id=106099

Patch by Jonathan Liu <net147@gmail.com> on 2013-01-05
Reviewed by Filip Pizlo.

The pow() workaround is no longer needed in the latest version
of MinGW-w64.

* wtf/MathExtras.h:

Change-Id: I0b52577a61734f130ab39d70d99e8cac9b58d9ba
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138903 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
ASSERT_NOT_REACHED in StylePropertySet::fontValue when accessing font style property through JS after setting style font size.

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

Reviewed by Alexander Pavlov.

Source/WebCore:

StylePropertySet::fontValue always assumed that it was called using
style.font after a subsequent call which set the shorthand font. The
ASSERT_NOT_REACHED assumed that all longhands of the font shorthand not
set by the shorthand itself were set to initial. While it's true when
we set the font shorthand (i.e all longhands are set to implicit initial)
it is not true when you set the longhands individually. For example setting
font-size will not set other font properties to initial. It is the behavior of all
other shorthands in WebKit. When reconstructing the shorthand other
properties tests whether the value of each longhands is initial or not
(if not then we omit the value, as we should always construct the
shortest shorthand possible) or if the value is set or not (if set then
we include it in the shorthand if not then we omit it). The comment
removed was also talking about invalid font property potentially built
by fontValue(). So far appendFontLonghandValueIfExplicit will always
construct a valid value as it takes care of adding ' ' or '/' when
needed, so the return value is parsable and correct.

Test: fast/css/font-shorthand-from-longhands.html

* css/StylePropertySet.cpp:
(WebCore::StylePropertySet::appendFontLonghandValueIfExplicit):
(WebCore::StylePropertySet::fontValue):
* css/StylePropertySet.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139313 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Change-Id: I46a4b1d023f3cb8f4e7b4c0b7f176b5b9f850870
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
[EFL][Qt][WK2] Going back to 47-amazing-css3-animation-demos shows nothing or wrong position

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

Reviewed by Simon Hausmann.

When contents size changes, make sure to apply any pending position
change if possible.

This is a cherry-pick of http://trac.webkit.org/changeset/138149
that fixes a frequent positioning issue during navigation.

Change-Id: Ib535f8470b2b8994565d750af06ee535e4153c3c
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
[Qt][Mac] Fix libxslt and libxml2 config tests https://bugs.webkit.org/show_bug.cgi?id=104164

Reviewed by Simon Hausmann.

http://trac.webkit.org/changeset/136837

Source/WebCore:

Avoid using pkg-config on Mac, instead use direct
include paths and add needed libraries to the linker.

No new tests needed.

WebCore.pri:
Tools:

We should not use pkg-config on Mac instead use direct include
paths and add needed libraries to the linker options to detect
libxslt and libxml2 provided by the system.
Previously we would always fall back to qtxmlpatterns.

qmake/config.tests/libxml2/libxml2.pro:
qmake/config.tests/libxslt/libxslt.pro:

Change-Id: I2020c7cdce1f6c6217320b06b4571705eb8af769
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
[Qt][EFL][WK2] Remove redundant device pixel ratio adjustment from PageViewportController

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

Reviewed by Kenneth Rohde Christiansen.

This is a backport of http://trac.webkit.org/changeset/139189.

Since r137597 Qt uses the device pixel ratio of the underlying
platform window as the device pixel ratio in WebCore.
The tiles are rendered with the effective scale (scale adjusted with
the device scale factor) and the projection matrix is also adjusted
with the device pixel ratio when painting.
As a result we can follow the same approach as QtQuick and all the
coordinates in PageViewportController need to be in device independent
pixels (UI pixels) thus we do no longer need to adjust with the device
pixel ratio when calculating the viewport attributes.
This simplifies the logic significantly and increases robustness,
but does not allow to set a custom device pixel ratio different from
the factor of the underlying platform (eg. for testing purposes).
This patch is conceptually a follow-up of r137597 and fixes layout
and canvas size on retina display.

Change-Id: I2485ef0a4aa18726238bacddaa5176cf5869659e
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
[Qt] Fix a crash when the QQuickWebPage is destroyed between the scene graph sync and render.
https://bugs.webkit.org/show_bug.cgi?id=106018

Reviewed by Simon Hausmann.

The main and rendering threads are only guaranteed to be synchronised in
the updatePaintNode call. In every other cases, QQuickItems cannot be
safely accessed from the rendering thread.

Do as the first patch version in
https://bugs.webkit.org/show_bug.cgi?id=104574 was doing and copy the
ratio value directly to fix the issue.

Also add a note about the threading issue in QQuickWebPage::updatePaintNode.

* UIProcess/API/qt/qquickwebpage.cpp:
(QQuickWebPage::updatePaintNode):
* UIProcess/qt/QtWebPageSGNode.cpp:
(WebKit::QtWebPageSGNode::QtWebPageSGNode):
* UIProcess/qt/QtWebPageSGNode.h:
(QtWebPageSGNode):
(WebKit::QtWebPageSGNode::devicePixelRatio):
(WebKit::QtWebPageSGNode::setDevicePixelRatio):

Change-Id: Ie849f0f23ae9e017fcdce6326fb2126f3ad66248
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138715 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
[Qt] Horizontal scrollbars events are offseted making them difficult to use

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

Reviewed by Allan Sandfeld Jensen.

Patch co-authored by Simon Hausmann.

Only copy the layout direction from the facade options if the
current option is Qt::LayoutDirectionAuto in order to prevent
misinterpretations as different layout direction when hit testing.

Tests added to tst_qwebview and tst_qgraphicswebview to verify
that the view actually is scrolled in the right direction.

* WidgetSupport/QStyleFacadeImp.cpp:
(WebKit::initGenericStyleOption):
* tests/qgraphicswebview/resources/scrolltest_page.html: Added.
* tests/qgraphicswebview/tst_qgraphicswebview.cpp:
(tst_QGraphicsWebView):
(tst_QGraphicsWebView::horizontalScrollbarTest):
* tests/qgraphicswebview/tst_qgraphicswebview.qrc:
* tests/qwebview/resources/scrolltest_page.html: Added.
* tests/qwebview/tst_qwebview.cpp:
(tst_QWebView):
(tst_QWebView::horizontalScrollbarTest):
* tests/qwebview/tst_qwebview.qrc:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138933 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Change-Id: I3c8190858f4a0fcd0bf394056771f775677ba30e
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
[Qt] Apply correct patch for the scrolling issue from bug 105014

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

Correct the if condition when overwriting the layout direction option
with the values from the facade options to only overwrite if the facade
direction is not equal to LayoutDirectionAuto.

Reviewed by Allan Sandfeld Jensen.

* WidgetSupport/QStyleFacadeImp.cpp:
(WebKit::initGenericStyleOption):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Change-Id: I95c3e73766ae9351ae24be0270054d318c1775f0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
CSS Animation fails on large layers

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

Accelerated compositing was in some cases causing pixmaps to be
allocated that were larger than allowed. This patch changes the non GL
Texture Mapper to also using tiles, to ensure we don't try to allocate
invalid pixmaps.

Change-Id: I4e0681ec77a2868b2f61efecbf74aa1e1db8f652
Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Fix CONFIG missing link_pkgconfig on Windows
https://bugs.webkit.org/show_bug.cgi?id=106647

Some libraries (e.g. libxslt, libxml2 and sqlite3) fail to link
properly on Windows because they are added to PKGCONFIG but
CONFIG does not contain link_pkgconfig.

This is because link_pkgconfig is added in unix/default_pre.prf
which is only used for UNIX platforms. To fix this, move it to
the general default_pre.prf.

Patch by Jonathan Liu <net147@gmail.com> on 2013-01-13
Reviewed by Simon Hausmann.

* qmake/mkspecs/features/default_pre.prf:
* qmake/mkspecs/features/unix/default_pre.prf:

Change-Id: Idf08d5f0c9ca531605da5d1474cff09c2bc1c042
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139570 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
[Qt] Crash in WebCore::CachedFrame::destroy
https://bugs.webkit.org/show_bug.cgi?id=104525

Reviewed by Adam Barth.

Source/WebCore:

Add an assert to increase the chances of catching this crash
early on in the future.

* dom/Document.cpp:
(WebCore::Document::takeDOMWindowFrom):

Source/WebKit/qt:

Remove the call to HistoryController::setCurrentItem which is ultimately
causing the initial empty document of a page to be added to the page cache.

This re-introduce the bug that was fixed by this line, which will be
properly fixed in a follow-up patch.

* Api/qwebhistory.cpp:
(operator>>):
* tests/qwebhistory/tst_qwebhistory.cpp:
(tst_QWebHistory::saveAndRestore_crash_4): Cover the crash.

Change-Id: Ia96ba570231557f8b53bc586410d50875880e1d1
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139876 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
[Qt] Use the shared HistoryItem serialization for QWebHistory
https://bugs.webkit.org/show_bug.cgi?id=106671

Reviewed by Allan Sandfeld Jensen.

Source/WebCore:

This allows a few things missing from the previous serialization code
to function while using commonly maintained code:
- The itemSequenceNumber and documentSequenceNumber that were needed
  to properly restore same-document navigations
- The form data
- The navigation hierarchy mapping the frame tree

* history/HistoryItem.h:
(HistoryItem):
* history/qt/HistoryItemQt.cpp:
(QDataStreamCoder):
(WebCore):
(WebCore::QDataStreamCoder::QDataStreamCoder):
(WebCore::QDataStreamCoder::encodeBytes):
(WebCore::QDataStreamCoder::encodeBool):
(WebCore::QDataStreamCoder::encodeUInt32):
(WebCore::QDataStreamCoder::encodeUInt64):
(WebCore::QDataStreamCoder::encodeInt32):
(WebCore::QDataStreamCoder::encodeInt64):
(WebCore::QDataStreamCoder::encodeFloat):
(WebCore::QDataStreamCoder::encodeDouble):
(WebCore::QDataStreamCoder::encodeString):
(WebCore::QDataStreamCoder::decodeBytes):
(WebCore::QDataStreamCoder::decodeBool):
(WebCore::QDataStreamCoder::decodeUInt32):
(WebCore::QDataStreamCoder::decodeUInt64):
(WebCore::QDataStreamCoder::decodeInt32):
(WebCore::QDataStreamCoder::decodeInt64):
(WebCore::QDataStreamCoder::decodeFloat):
(WebCore::QDataStreamCoder::decodeDouble):
(WebCore::QDataStreamCoder::decodeString):
(WebCore::HistoryItem::restoreState):
(WebCore::WebCore::HistoryItem::saveState):

Source/WebKit/qt:

Bump the serialization version and change the code to abort the
restore of a previous stream version rather than trying to keep the
support of restoring previous versions. This is mainly to simplify
things given that HistoryItem itself aborts in that case.

* Api/qwebhistory.cpp:
(operator<<):
(operator>>):
* tests/qwebhistory/tst_qwebhistory.cpp:
(tst_QWebHistory::serialize_2): Modify the test to cover same-document navigations.
(tst_QWebHistory::restoreIncompatibleVersion1): Add a previous version
hard-coded stream to verify that the deserialization doesn't hang or
crash.

Change-Id: Ic3944179b7f1cb490722c38adbcfef88e8aa1c08
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139878 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
32-bit build for Qt5 on Mac OS fails https://bugs.webkit.org/show_bug.cgi?id=107094

We need to define NS_BUILD_32_LIKE_64 for 32-bit build for Mac OS.
Fixed 32-bit build detection for support Qt5.

http://trac.webkit.org/changeset/140029

Patch by Poul Sysolyatin <psytonx@gmail.com> on 2013-01-17
Reviewed by Benjamin Poulain.

Change-Id: I2748db966a6dff76add422b791717bce87517e84
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Reviewed-by: Poul Sysolyatin <psytonx@gmail.com>
[Qt] The Qt's configuration isn't honoured regarding the use of the system libpng and libjpeg
https://bugs.webkit.org/show_bug.cgi?id=104909

Reviewed by Simon Hausmann.

To be able to build redistribuable binary packages, Qt's configure switches
-qt-libpng and -qt-libjpeg are used to avoid having the binaries trying to
dynamically link to optional system libraries.
QtWebKit is doing its own configure checks for those libraries, thus adding a
runtime dependency that might not be fulfilled if the packager's machine had
those libraries while the user's machine won't.

Since in most cases where WebKit will want to use those system libraries, Qt will
also be using them, remove these configure tests from WebKit.

* qmake/config.tests/libjpeg/libjpeg.cpp: Removed.
* qmake/config.tests/libjpeg/libjpeg.pro: Removed.
* qmake/config.tests/libpng/libpng.cpp: Removed.
* qmake/config.tests/libpng/libpng.pro: Removed.
* qmake/mkspecs/features/features.prf:

Change-Id: I986fd77e6b54d3553015512548ac24776febc982
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139609 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
[Qt] Update the documentation about the storage of inspector settings
https://bugs.webkit.org/show_bug.cgi?id=106777

Reviewed by Allan Sandfeld Jensen.

Since r76770, QSettings isn't queried anymore to persist inspector
settings like whether or not the debugger is enabled by default.
It still seems to be used for the default attach height.

Update the documentation accordingly.

* WidgetApi/qwebinspector.cpp:

Change-Id: I0f1bacdd628c56771cf74338b5ef8060154993ef
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140326 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
[Qt] Crash in gmail on enabling desktop notifications

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

Patch by David Rosca.
Reviewed by Jocelyn Turcotte.

Protect against callback that may be null. This also matches WebKit2 behaviour.

* WebCoreSupport/NotificationPresenterClientQt.cpp:
(WebCore::NotificationPresenterClientQt::allowNotificationForFrame):

Reviewed-by: jocelyn.turcotte@digia.com

Change-Id: Icac8f0202c378d129895b47224bfabc9b2a53b3d
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Fixing memory read after free in CanvasRenderingContext2D::accessFont

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

Reviewed by Abhishek Arya.

Using a temporary String object to hold ref count on string that is
passed by reference in CanvasRenderingContext2D::accessFont.

Test: fast/canvas/canvas-measureText.html

* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::accessFont):

Change-Id: Icfab9c7b7e870af9ca9ba05a1b803b51a9a329ad
Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Make custom filter render in Wk1 mode

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

Fix CSS shaders so they work in QGraphicsWebView at least when used in
an OpenGL context.

Change-Id: I64e7269cd1347079f02faa3153e262520bc6ad5c
Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>