[BlackBerry] Fix crash for detached node when validating selection change.
https://bugs.webkit.org/show_bug.cgi?id=98926

Reviewed by Rob Buis.

PR 220628.

Guard against detached nodes when generating selection rect.

* WebKitSupport/DOMSupport.cpp:
(BlackBerry::WebKit::DOMSupport::visibleTextQuads):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130991 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Chromium] Update selection on long press to match normal delimiters.
https://bugs.webkit.org/show_bug.cgi?id=98947

Reviewed by Adam Barth.

Make the long press selection behaviour consistent.

* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::handleGestureEvent):
(WebKit::WebViewImpl::detectContentOnTouch):
* src/WebViewImpl.h:
(WebViewImpl):
* tests/WebViewTest.cpp:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130992 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Do not perform backing store blit for animations during one-shot drawing synchronization
https://bugs.webkit.org/show_bug.cgi?id=98944

Patch by Andrew Lo <anlo@rim.com> on 2012-10-10
Reviewed by Rob Buis.

Internally reviewed by: Arvid Nilsson.
Internal PR 220014
Prevent animations from causing a backing store blit during a
one-shot drawing synchronization.

* Api/WebPageCompositor.cpp:
(BlackBerry::WebKit::WebPageCompositorPrivate::animationFrameChanged):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130993 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Chromium] Smoother animation for non-RAF 2D canvas animations
https://bugs.webkit.org/show_bug.cgi?id=97918

Patch by Justin Novosad <junov@chromium.org> on 2012-10-10
Reviewed by Stephen White.

Source/WebCore:

Reduces animation jank by preventing the accumulation of multiple
frames of backlog in the deferred canvas rendering queue. When the
animation is more than one full frame ahead of the compositor, an
immediate flush is triggered.  This takes into account overdraw
elimination by the skip-on-clear optimization that is built-in to
SkDeferredCanvas, to allow non-RAF animations that clear the canvas at
each frame to run without any rate limiting. This change also
incidentally improves frame rate in many cases by providing more
granular batching of GPU API calls, resulting in better pipelining
through the command buffer.

Test: webkit_unit_test Canvas2DLayerManagerTest.testDeferredFrame

* platform/graphics/chromium/Canvas2DLayerBridge.cpp:
(WebCore::Canvas2DLayerBridge::Canvas2DLayerBridge):
(WebCore::Canvas2DLayerBridge::limitPendingFrames):
Called at the end of a task (usually a scheduled script action) that
invoked 2d canvas rendering context methods. The end of the task
marks the completion of a displayable frame. This method will trigger
a flush if it detects that the layer has pending draw commands that
are more that one frame old.
(WebCore):
(WebCore::Canvas2DLayerBridge::flushedDrawCommands):
(WebCore::Canvas2DLayerBridge::didFlushPendingCommands):
(WebCore::Canvas2DLayerBridge::skippedPendingDrawCommands):
(WebCore::Canvas2DLayerBridge::flush):
(WebCore::Canvas2DLayerBridge::contextAcquired):
* platform/graphics/chromium/Canvas2DLayerBridge.h:
(Canvas2DLayerBridge):
* platform/graphics/chromium/Canvas2DLayerManager.cpp:
(WebCore::Canvas2DLayerManager::~Canvas2DLayerManager):
(WebCore::Canvas2DLayerManager::willProcessTask):
(WebCore):
(WebCore::Canvas2DLayerManager::didProcessTask):
(WebCore::Canvas2DLayerManager::layerDidDraw):
* platform/graphics/chromium/Canvas2DLayerManager.h:
(Canvas2DLayerManager):

Source/WebKit/chromium:

New unit test to verify the automatic flushing of deferred 2d canvas
layers when scripted animations are more than one full frame ahead
of the compositor. Also verifies that automatic flushing does not
kick-in when the skip on clear optimization fires

* DEPS:
* tests/Canvas2DLayerManagerTest.cpp:
(FakeCanvas2DLayerBridge::fakeSkipPendingDrawCommands):
To fake the skip on clear optimization
(FakeCanvas2DLayerBridge):
(Canvas2DLayerManagerTest):
(Canvas2DLayerManagerTest::doDeferredFrameTestTask):
Method that simulates a javascript scheduled action that draws to
a 2D canvas layer
(DeferredFrameTestTask):
Task object to simulate a scheduled action. This is so the unit
test can cover the TaskObserver behavior of Canvas2DLayerManager.
(Canvas2DLayerManagerTest::DeferredFrameTestTask::DeferredFrameTestTask):
(Canvas2DLayerManagerTest::deferredFrameTest):
The unit test implementation, which uses the WebThread run loop to
post tasks that touch the canvas layer.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130994 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Invalid values for media query features are not handled
https://bugs.webkit.org/show_bug.cgi?id=97006

Patch by Alexander Shalamov <alexander.shalamov@intel.com> on 2012-10-10
Reviewed by Kenneth Rohde Christiansen.

Source/WebCore:

This patch improves pass rate of CSS3 Media Queries test suite
by making media expressions compliant with W3C specification. Few
performance issues are fixed by removal of string comparison during
media expression evaluation.

Tests: fast/media/w3c/test_media_queries.html

* css/CSSGrammar.y: Handle media query expression with specified media restrictor as invalid.
* css/MediaQuery.cpp:
(WebCore::MediaQuery::serialize): Serialize invalid query according to specification.
* css/MediaQueryEvaluator.cpp:
(WebCore::orientationMediaFeatureEval): Compare CSSValueID instead of strings.
(WebCore::view_modeMediaFeatureEval): Compare CSSValueID instead of strings.
(WebCore::pointerMediaFeatureEval): Compare CSSValueID instead of strings.
* css/MediaQueryExp.cpp:
(WebCore::MediaQueryExp::MediaQueryExp): Check that media features initialized with correct values.

LayoutTests:

Imported CSS3 Media Queries test suite from http://www.w3.org/Style/CSS/Test/MediaQueries/20120229/

* fast/media/media-query-invalid-value.html: Fixed invalid media query.
* fast/media/media-query-serialization.html: Fixed invalid media query.
* fast/media/w3c/README: Added.
* fast/media/w3c/resources/media_queries_iframe.html: Added. (Imported from w3c test suite)
* fast/media/w3c/test_media_queries-expected.txt: Added.
* fast/media/w3c/test_media_queries.html: Added. (Imported from w3c test suite)

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130995 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WK2] Safari crashes on error when using CFNetwork
https://bugs.webkit.org/show_bug.cgi?id=98965

Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-10-10
Reviewed by Sam Weinig.

The code of ResourceErrorMac when using CFNetwork was assuming
there is always either a CFError or an NSError associated with
any ResourceError.

This is not true on WebKit2 where error can be generic errors
in the WebProcess (for example a cannotShowURLError).
The code was crashing when trying to invoke function on the
non-existing CFError.

This patch fixes the issue by handling that third case separately.
If the ResourceError is a generic error, a new NSError is created,
similarily to what is done in the non-CFNetwork case.

* platform/network/mac/ResourceErrorMac.mm:
(WebCore::ResourceError::nsError):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130996 268f45cc-cd09-0410-ab3c-d52691b4dbfc
column-count: 0 should not prevent margin-collapse through
https://bugs.webkit.org/show_bug.cgi?id=65159

Patch by Tab Atkins <jackalmage@gmail.com> on 2012-10-10
Reviewed by Tony Chang.

Source/WebCore:

This patch makes "column-count:0" be properly recognized as invalid syntax,
as it violates the property grammar in the spec.

Tests: fast/multicol/zeroColumnCount.html

* css/CSSParser.cpp:
(WebCore::CSSParser::validUnit):
(WebCore::CSSParser::parseValue):
* css/CSSParser.h:

LayoutTests:

Fixed the zeroColumnCount.html test to properly test that "0" is an invalid CSS value,
rather than just ensuring that it doesn't crash.

* fast/multicol/zeroColumnCount-expected.txt:
* fast/multicol/zeroColumnCount.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130997 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Add entrypoints to set frame contents and recycle resources in WebDelegatedRendererLayer
https://bugs.webkit.org/show_bug.cgi?id=98833

Reviewed by James Robinson.

This is needed for https://codereview.chromium.org/10915298

* chromium/public/WebDelegatedRendererLayer.h:
(cc):
(WebKit):
(WebDelegatedRendererLayer):


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