Invalid block doesn't make declaration invalid
https://bugs.webkit.org/show_bug.cgi?id=115709

Reviewed by Andreas Kling.

From Blink r149446 by <serya@chromium.org>

Source/WebCore:

Added a new rule "declaration_recovery:" which covers any kind of
"invalid_block_list maybe_space" sequence. By appending this new
rule to every rule reductable to "declaration:" we can remove some
redundant rules and improve error recovery of some others that
were only accepting exactly one error.

One of the rules being removed was preventing invalid blocks in a
declaration to invalidate the whole declaration. The rule was
reporting the syntax error but at the same time accepting the
invalid block as part of a valid declaration.

* css/CSSGrammar.y.in:

LayoutTests:

* fast/css/parsing-error-recovery.html: Added 2 new test cases.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150803 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Refactoring CSS grammar
https://bugs.webkit.org/show_bug.cgi?id=116679

Reviewed by Andreas Kling.

From Blink r149948 by <serya@chromium.org>

Added "closing_parenthesis:" and "error_recovery:" to avoid code
duplication in a couple of error recovery rules. Some other rules
were also refactored which allows to reduce the the number of
shift/reduce conflicts by 2.

No new tests required as this is just a refactoring, no new
functionality added.

* css/CSSGrammar.y.in:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150804 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Move Node::dispatchChangeEvent() to HTMLFormControlElement.
<http://webkit.org/b/116866>

Reviewed by Anders Carlsson.

...and devirtualize it, since it had no overrides.

* dom/Node.h:
* dom/Node.cpp:
* html/HTMLFormControlElement.h:
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::dispatchChangeEvent):
(WebCore::HTMLFormControlElement::dispatchFormControlChangeEvent):
* html/FileInputType.cpp:
(WebCore::FileInputType::setFiles):
* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::dispatchFormControlChangeEvent):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150805 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix GTK+ CMake build

Source/WebKit2:

* PlatformGTK.cmake: After r150336, the name of the WebKit2
library target is simply "WebKit2."

Tools:

* MiniBrowser/gtk/CMakeLists.txt: After r150336, the name of the WebKit2
library target is simply "WebKit2."

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150806 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Connection issues in repeated WebProcess crash/reloads.
https://bugs.webkit.org/show_bug.cgi?id=115880

Reviewed by Anders Carlsson.

When stressing the WebProcess creation/destruction, WebKitGTK can
often run into socket issues like bad file descriptor errors or
polling a socket indefinitely.

Currently WebKitGTK has three places where a socket can be
closed.

- childFinishedFunction (in ProcessLauncherGtk.cpp)
- Connection::platformInvalidate (in ConnectionUnix.cpp)
- WorkQueue EventSource destruction (in WorkQueueGtk.cpp)

To avoid these race conditions, socket closing will be handled
by the event source callback in WorkQueueGtk.cpp.

* Platform/CoreIPC/unix/ConnectionUnix.cpp:
(CoreIPC::Connection::platformInvalidate): Do not close the socket
when the connection is invalidated, the socket event source is
unregistered in this method and the socket is closed when the
GSocket associated to the event source is destroyed.
* UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp:
(WebKit::ProcessLauncher::launchProcess): Do not monitor child
process to close the connection on termination. This was needed in
the past when we used DGRAM sockets, we currently use always
connection oriented sockets, so that when the other end closes
the connection we are notified and the connection is invalidated.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150808 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] backface-visibility: hidden doesn't work properly with masks and filters
https://bugs.webkit.org/show_bug.cgi?id=116616

Reviewed by Carlos Garcia Campos.

The BlackBerry::Platform::Graphics::GraphicsContext generates geometry
with a different winding order than the accelerated compositing backend
of the BlackBerry port. So, when we switched from Skia to this new
rendering engine, we switched from glFrontFace(GL_CCW) to
glFrontFace(GL_CW), and all was well when drawing display lists.
However, we forgot to update the winding order of geometry generated
within the accelerated compositing backend, which is used for masks and
filters, so they were getting erroneously culled out when
backface-visibility: hidden was applied to them. Fixed by switching the
winding order of all geometry generated up here, which has the added
benefit of enabling us to use TransformationMatrix::mapQuad instead of
transforming point-by-point.

To further complicate matters, a right-side up transform is used when
drawing layers into surfaces, reversing the winding order and requiring
us to switch back to glFrontFace(GL_CCW) temporarily, when drawing
layers to surfaces, or the layers will get culled out inside the
surface.

Also fix spelling error, "drawed" should be "drawn".

No new tests, this is only detectable by pixel tests, which the
BlackBerry port currently doesn't support.

PR 341945.

* platform/graphics/blackberry/EGLImageLayerCompositingThreadClient.cpp:
(WebCore::EGLImageLayerCompositingThreadClient::drawTextures):
* platform/graphics/blackberry/LayerCompositingThread.cpp:
(WebCore::LayerCompositingThread::setDrawTransform):
(WebCore::getTransformedRect):
(WebCore::LayerCompositingThread::drawTextures):
(WebCore::LayerCompositingThread::drawSurface):
* platform/graphics/blackberry/LayerCompositingThread.h:
(LayerCompositingThread):
(WebCore::LayerCompositingThread::origin):
* platform/graphics/blackberry/LayerFilterRenderer.cpp:
(WebCore):
* platform/graphics/blackberry/LayerRenderer.cpp:
(WebCore::LayerRenderer::compositeLayers):
(WebCore):
(WebCore::LayerRenderer::drawLayersOnSurfaces):
* platform/graphics/blackberry/LayerRendererSurface.cpp:
(WebCore::LayerRendererSurface::drawRect):
(WebCore::LayerRendererSurface::transformedBounds):
* platform/graphics/blackberry/LayerRendererSurface.h:
(WebCore::LayerRendererSurface::origin):
(LayerRendererSurface):
* platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
(WebCore):
(WebCore::loadBufferingImageData):
(WebCore::MediaPlayerPrivate::drawBufferingAnimation):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150809 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Made AudioNode an EventTarget
https://bugs.webkit.org/show_bug.cgi?id=116871

Source/WebCore:

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

Reviewed by Darin Adler.

Tests: webaudio/audionode-expected.txt:
       webaudio/audionode.html:

Add the requisite boilerplate to allow AudioNode to become an EventTarget. Remove
all that same boilerplate from ScriptProcessorNode now that it's base class
is an EventTarget.

* Modules/webaudio/AudioNode.cpp:
(WebCore::AudioNode::interfaceName): Added boilerplate.
(WebCore::AudioNode::scriptExecutionContext): Return the AudioContext's context.
(WebCore::AudioNode::processIfNecessary): Whitespace.
* Modules/webaudio/AudioNode.h:
* Modules/webaudio/AudioNode.idl: Make AudioNode an EventTarget.
* Modules/webaudio/ScriptProcessorNode.cpp: Remove EventTarget boilerplate.
* Modules/webaudio/ScriptProcessorNode.h: Ditto.
* Modules/webaudio/ScriptProcessorNode.idl: Ditto.
* dom/EventTarget.h: Mark AudioNode as an EventTarget.
* dom/EventTargetFactory.in: Ditto.

LayoutTests:

Reviewed by Darin Adler.

* webaudio/audionode-expected.txt:
* webaudio/audionode.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150810 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Fix style issues in BlackBerry accelerated compositing backend
https://bugs.webkit.org/show_bug.cgi?id=116604

Reviewed by Carlos Garcia Campos.

Source/WebCore:

PR 273550, 99638

Remove the "get" prefix from getters in the WebKit- and compositing-
thread layer classes, as well as LayerRendererSurface. Clarify which
geometry-related getters return normalized device coordinates by adding
a comment.

Also remove dead code related to LayerData::m_holePunchClipRect, which
was part of an eventually disabled fix for video clipping in iframes,
PR 99638. Since we now use AC layers for iframes, the bug is no longer
reproducible, and the dead code will never need to be enabled again.

No change in behavior, no new tests.

* platform/graphics/blackberry/EGLImageLayerCompositingThreadClient.cpp:
(WebCore::EGLImageLayerCompositingThreadClient::drawTextures):
* platform/graphics/blackberry/LayerCompositingThread.cpp:
(WebCore::LayerCompositingThread::setDrawTransform):
(WebCore::LayerCompositingThread::transformedHolePunchRect):
(WebCore::LayerCompositingThread::drawTextures):
(WebCore::LayerCompositingThread::drawSurface):
* platform/graphics/blackberry/LayerCompositingThread.h:
(WebCore::LayerCompositingThread::sublayers): Removed "get" prefix
(LayerCompositingThread):
(WebCore::LayerCompositingThread::boundingBox): Renamed from "getDrawRect"
(WebCore::LayerCompositingThread::transformedBounds): Removed "get" prefix
(WebCore::LayerCompositingThread::transformedHolePunchRect): Removed "get" prefix
* platform/graphics/blackberry/LayerData.h:
(LayerData): Removed unused data member "m_holePunchClipRect"
* platform/graphics/blackberry/LayerFilterRenderer.cpp:
(WebCore::LayerFilterRenderer::applyActions):
* platform/graphics/blackberry/LayerRenderer.cpp:
(WebCore::LayerRenderer::compositeLayers):
(WebCore::LayerRenderer::drawDebugBorder):
(WebCore::LayerRenderer::drawHolePunchRect):
(WebCore::LayerRenderer::prepareFrameRecursive):
(WebCore::LayerRenderer::updateLayersRecursive):
(WebCore::collect3DPreservingLayers):
(WebCore::LayerRenderer::compositeLayersRecursive):
* platform/graphics/blackberry/LayerRendererSurface.cpp:
(WebCore::LayerRendererSurface::boundingBox):
* platform/graphics/blackberry/LayerRendererSurface.h:
(WebCore::LayerRendererSurface::boundingBox): Renamed from "drawRect" because that sounds like a verb, and this is a getter
* platform/graphics/blackberry/LayerWebKitThread.h:
(WebCore::LayerWebKitThread::sublayers): Removed "get" prefix
* platform/graphics/blackberry/VideoLayerWebKitThread.cpp:
(WebCore::VideoLayerWebKitThread::setHolePunchRect):
(WebCore::VideoLayerWebKitThread::boundsChanged):

Source/WebKit/blackberry:

Adapt to the removal of "get" prefix from getters in the WebKit- and
compositing-thread layer classes.

* Api/WebOverlay.cpp:
(BlackBerry::WebKit::WebOverlayPrivateCompositingThread::pixelViewportRect):
* Api/WebPageCompositor.cpp:
(BlackBerry::WebKit::WebPageCompositorPrivate::attachOverlays):
(BlackBerry::WebKit::WebPageCompositorPrivate::removeOverlay):
(BlackBerry::WebKit::WebPageCompositorPrivate::findFixedElementRect):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150817 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] GraphicsContext: add missing definitions.
https://bugs.webkit.org/show_bug.cgi?id=115515

Patch by Alberto Garcia <agarcia@igalia.com> on 2013-05-28
Reviewed by Rob Buis.

* platform/graphics/GraphicsContext.h:
(Graphics):
Add definition for PlatformGraphicsContext.
* platform/graphics/blackberry/GraphicsContextBlackBerry.cpp:
Include RoundedRect.h

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150820 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix line endings in test added in r150602

Unreviewed.

* fast/css/text-overflow-ellipsis-behind-floats.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150822 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Crash in DumpRenderTree at com.apple.WebCore: WebCore::RenderTextTrackCue::repositionGenericCue + 154
https://bugs.webkit.org/show_bug.cgi?id=116882

Reviewed by Eric Carlson.

Remove an inappropriate assert. No cues coming through repositionGenericCue will be WebVTT ones.

* rendering/RenderTextTrackCue.cpp:
(WebCore::RenderTextTrackCue::repositionGenericCue):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150827 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Windows] Silence a few failures to get bot green.
https://bugs.webkit.org/show_bug.cgi?id=116564

* platform/win/TestExpectations: Disable some tests.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150830 268f45cc-cd09-0410-ab3c-d52691b4dbfc
r150199 is very wrong
https://bugs.webkit.org/show_bug.cgi?id=116876

JSValue needs to protect its internal JSValueRef.

Reviewed by Darin Adler.

* API/JSValue.mm:
(-[JSValue initWithValue:inContext:]):
(-[JSValue dealloc]):
* API/tests/testapi.mm: Added a simple test to make sure that we protect the
underlying JavaScript value across garbage collections.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150831 268f45cc-cd09-0410-ab3c-d52691b4dbfc
String(new Date(2010,10,1)) is wrong in KRAT, YAKT
https://bugs.webkit.org/show_bug.cgi?id=106750

Reviewed by Darin Adler.

First part of a fix, simplfy date handling code, instead of operating separately
on the UTC-standard and standard-DST offsets, just generate a combined UTC-local
offset (this is what we actually need, and what the OS gives us).

../JavaScriptCore: 

* runtime/JSDateMath.cpp:
(JSC::getLocalTimeOffset):
    - removed getUTCOffset, converted getDSTOffset -> getLocalTimeOffset
(JSC::gregorianDateTimeToMS):
(JSC::msToGregorianDateTime):
(JSC::parseDateFromNullTerminatedCharacters):
    - call getLocalTimeOffset instead of getUTCOffset/getDSTOffset
* runtime/VM.cpp:
(JSC::VM::resetDateCache):
    - removed cachedUTCOffset, converted DSTOffsetCache -> LocalTimeOffsetCache
* runtime/VM.h:
(JSC::LocalTimeOffsetCache::LocalTimeOffsetCache):
(JSC::LocalTimeOffsetCache::reset):
(LocalTimeOffsetCache):
    - removed cachedUTCOffset, converted DSTOffsetCache -> LocalTimeOffsetCache

../WTF: 

* wtf/DateMath.cpp:
(WTF::calculateUTCOffset):
(WTF::calculateDSTOffset):
    - made static, now not called from outside of this file.
(WTF::calculateLocalTimeOffset):
    - This combines the 2038 related adjustment from calculateDSTOffset with the
      maxUnixTime adjustment from calculateDSTOffsetSimple. Then, if HAVE(TM_GMTOFF)
      just call getLocalTime, if not use calculateUTCOffset/calculateDSTOffset.
(WTF::parseDateFromNullTerminatedCharacters):
    - call calculateLocalTimeOffset instead of calculateUTCOffset/calculateDSTOffset
* wtf/DateMath.h:
(WTF::LocalTimeOffset::LocalTimeOffset):
(LocalTimeOffset):
(WTF::LocalTimeOffset::operator==):
    - new struct type, a tuple of UTC-local offset & isDST flag.
    - replaced calculateUTCOffset/calculateDSTOffset with calculateLocalTimeOffset
* wtf/GregorianDateTime.cpp:
(WTF::GregorianDateTime::setToCurrentLocalTime):
    - call calculateLocalTimeOffset instead of calculateUTCOffset/calculateDSTOffset



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150833 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Windows] Unreviewed build fix after r150833

* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreExports.def:
A CR/LF combination was lost in the file, combining two symbols.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150834 268f45cc-cd09-0410-ab3c-d52691b4dbfc
String(new Date(2010,10,1)) is wrong in KRAT, YAKT
https://bugs.webkit.org/show_bug.cgi?id=106750

Reviewed by Darin Adler.

* runtime/JSDateMath.cpp:
(JSC::msToGregorianDateTime):
    - Additional review comment fix.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150835 268f45cc-cd09-0410-ab3c-d52691b4dbfc
AX: WKView is unable to set AXFocused to YES and does not handle keyboard events as expected
https://bugs.webkit.org/show_bug.cgi?id=116756

Reviewed by Tim Horton.

If AXFocused is set to true, but the WebView is not the first responder, then the call will
not do anything. This change asks the Chrome to make the WebView the first responder before
trying to set focus within the page.

Was not able to make a test, it requires on interplay between areas outside the web view.

* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilitySetValue:forAttribute:]):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150836 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Create a html/forms subdirectory and move FileIconLoader there
https://bugs.webkit.org/show_bug.cgi?id=116880

Reviewed by Jessie Berlin.

A lot (if not the majority) of files in html/ are forms related, so it makes sense to begin splitting
them out into a separate subdirectory, html/forms.

Begin my moving FileIconLoader from platform to html/forms. It is related to HTML forms (it's only used by
the file upload element), and is not really a platform abstraction so it doesn't belong in platform.

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* html/forms/FileIconLoader.cpp: Renamed from Source/WebCore/platform/FileIconLoader.cpp.
* html/forms/FileIconLoader.h: Renamed from Source/WebCore/platform/FileIconLoader.h.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150837 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Rendering suppression extension tokens shouldn't be 0, should handle overflow
https://bugs.webkit.org/show_bug.cgi?id=116886
<rdar://problem/14004474>

Reviewed by Darin Adler.

Don't use invalid HashSet values as tokens, and ensure that
we're not already using a token before returning it.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::extendIncrementalRenderingSuppression):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150838 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Windows] Unreviewed build fix.  Remove ?byteCompile symbol that
is no longer accessible during link.

* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreExports.def:
* JavaScriptCore.vcxproj/JavaScriptCoreExportGenerator/JavaScriptCoreExports.def.in:



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