[BlackBerry] BackingStore accesses tiles even though it's not active
https://bugs.webkit.org/show_bug.cgi?id=87563

Patch by Arvid Nilsson <anilsson@rim.com> on 2012-04-18
Reviewed by Antonio Gomes.

There are many scenarios that can call render and cause tile access,
and they used to be rerouted to the direct rendering code when the
backing store was not active. This was thanks to an implicit check for
isActive() by virtue of calling shouldDirectRenderingToWindow() from
render().

If we're using OpenGL for compositing the backing store contents
however, direct rendering is always disabled and we jump right into the
tile based rendering code.

Fixed by adding an explicit check for isActive() in render(), now that
the implicit check in shouldDirectRenderingToWindow() is conditional on
having raster usage.

Since PR136381/bug83131, when OpenGL compositing is used, and the
backing store is not active, it is not in charge of drawing the root
layer. Instead, we switch off the paintingGoesToWindow flag on the root
RenderLayer so no invalidates will reach the ChromeClient or the
BackingStore any more. Instead, invalidations will cause the root
accelerated compositing layer to be repainted. Any BackingStore render
calls while in this state are pointless, and can safely do an early
return.

Reviewed internally by Jakob Petsovits.

PR #150403

* Api/BackingStore.cpp:
(BlackBerry::WebKit::BackingStorePrivate::render):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118626 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Crash when deleting WebPageCompositor
https://bugs.webkit.org/show_bug.cgi?id=87589

Patch by Arvid Nilsson <anilsson@rim.com> on 2012-05-27
Reviewed by Rob Buis.

The WebPageCompositorPrivate is reference counted, so it may outlive
either the WebPage or the WebPageCompositor, depending on who releases
its reference first.

Fixed by disconnecting the objects properly, regardless of who goes
away first.

Reviewed internally by Mike Lattanzio.

PR #156444

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::setCompositor):
(BlackBerry::WebKit::WebPagePrivate::destroyCompositor):
* Api/WebPageCompositor.cpp:
(BlackBerry::WebKit::WebPageCompositor::~WebPageCompositor):
(BlackBerry::WebKit::WebPageCompositor::client):
* Api/WebPageCompositor_p.h:
(BlackBerry::WebKit::WebPageCompositorPrivate::setPage):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118627 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[watchlist] Improve MathML rule
https://bugs.webkit.org/show_bug.cgi?id=87592

Reviewed by Adam Barth.

The old rule "filename": r".*mathml" works fine because "filename" is a prefix match,
but if this changed the rule would be slow. We protect against this, clarify the rule,
and make it more similar to existing rules.

* Scripts/webkitpy/common/config/watchlist:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118628 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] Trivial unreviewed build fix with newer Qt

* Api/qwebpage.cpp:
(QWebPage::javaScriptPrompt): Don't use deprecated QString/QChar functions.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118629 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed GTK gardening after r118618.

* platform/gtk/test_expectations.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118630 268f45cc-cd09-0410-ab3c-d52691b4dbfc
When pages are loaded from AppCache with DeferredLoading, willSendRequest() is never called
https://bugs.webkit.org/show_bug.cgi?id=87582

Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-05-27
Reviewed by Darin Adler.

Source/WebCore: 

Previously, there was a shortcut when a deferred MainResourceLoader is resumed: If the data
was coming from AppCache we could jump directly to startDataLoadTimer().

The problem with the shortcut is willSendRequest() is never called in that particular case
(substituteData + deferred-resume). The imbalance between willSendRequest() and didReceiveResponse()
causes problems.

This patch removes the shortcut so that MainResourceLoader::loadNow() is used regardless of
the deferred loading. The method MainResourceLoader::loadNow() handle the substituteData as if the loading
was not deferred.

Test: http/tests/appcache/load-from-appcache-defer-resume-crash.html

* loader/MainResourceLoader.cpp:
(WebCore::MainResourceLoader::continueAfterNavigationPolicy):
(WebCore::MainResourceLoader::handleSubstituteDataLoadSoon):
Rename the method to be consistent with the attribute it uses, making the naming more explicit.
(WebCore::MainResourceLoader::loadNow):
(WebCore::MainResourceLoader::setDefersLoading):
* loader/MainResourceLoader.h:
(MainResourceLoader):

Tools: 

Extend DumpRenderTree to support loading the main resource deferred with a delay. This makes it
possible to test pages in a similar way as they are loaded in Browsers.

* DumpRenderTree/LayoutTestController.cpp:
(LayoutTestController::LayoutTestController):
(setUseDeferredFrameLoadingCallback):
(LayoutTestController::staticFunctions):
* DumpRenderTree/LayoutTestController.h:
(LayoutTestController::useDeferredFrameLoading):
(LayoutTestController::setUseDeferredFrameLoading):
(LayoutTestController):
* DumpRenderTree/mac/FrameLoadDelegate.mm:
(-[FrameLoadDelegate webView:didStartProvisionalLoadForFrame:]):

LayoutTests: 

* http/tests/appcache/load-from-appcache-defer-resume-crash-expected.txt: Added.
* http/tests/appcache/load-from-appcache-defer-resume-crash.html: Added.
* http/tests/appcache/resources/load-from-appcache-defer-resume-bounce-back.html: Added.
* http/tests/appcache/resources/load-from-appcache-defer-resume-crash.manifest: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118631 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Update color for tap highlight and selection
https://bugs.webkit.org/show_bug.cgi?id=87606

Patch by Arvid Nilsson <anilsson@rim.com> on 2012-05-27
Reviewed by Antonio Gomes.

PR #154813

* platform/blackberry/RenderThemeBlackBerry.cpp:
(WebCore::RenderThemeBlackBerry::platformTapHighlightColor):
(WebCore::RenderThemeBlackBerry::platformActiveSelectionBackgroundColor):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118632 268f45cc-cd09-0410-ab3c-d52691b4dbfc
fast/dom/shadow/content-element-in-media.html is wrong.
https://bugs.webkit.org/show_bug.cgi?id=81310

Modifying to check() to dump expected and actual text at the same
absolute position, because DumpRenderTree dumps absolute x,y-position
information for a layer which contains RenderVideo. For example,
backgroundClip at (8,163), clip at (8, 163) and so on.

Patch by Takashi Sakamoto <tasak@google.com> on 2012-05-27
Reviewed by Hajime Morita.

* fast/dom/resources/shadow-test-driver.js:
(check):
Disabled actual block when dumping expected block as text, and vice
versa.
* platform/chromium/test_expectations.txt:
Removed BUGWK81310.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118633 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Use StringBuilder in WebKitCSSTransformValue::customCssText() to allow code reuse with CSS Variables.
https://bugs.webkit.org/show_bug.cgi?id=87462

Reviewed by Dimitri Glazkov.

Factor out strings into a const char* array, and use a StringBuilder instead of String concatenation.
This will allow future code to re-use the array of transform names, and StringBuilder is generally faster.

Covered by existing CSS transform tests.

* css/WebKitCSSTransformValue.cpp:
(WebCore):
(WebCore::WebKitCSSTransformValue::customCssText):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118639 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CMake] Make WEBKIT_SET_EXTRA_COMPILER_FLAGS work with clang.
https://bugs.webkit.org/show_bug.cgi?id=87597

Reviewed by Daniel Bates.

Building with clang requires at least the -fPIC option being
passed correctly, just like it is needed with gcc. clang is also
compatible with most of gcc's compiler options, so we only need to
check for clang besides g++ in the macro definition.

* Source/cmake/WebKitHelpers.cmake: Check for "Clang" and use
CMAKE_COMPILER_IS_GNUCXX for the previous check, as it is shorter
and achieves the same effect.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118640 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WTF] Introduce UINT64_C to MathExtras.h
https://bugs.webkit.org/show_bug.cgi?id=87485

Reviewed by Kent Tamura.

Source/WebCore:

This patch introduces UINT64_C for all platforms to avoid using
conditional compilation.

No new tests. This patch doesn't change behavior.

* Modules/websockets/WebSocketFrame.cpp:
(WebCore::WebSocketFrame::parseFrame): Replace conditional compilation with UINT64_C.

Source/WTF:

* wtf/MathExtras.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118643 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Minor code cleaning for the interface of MainResourceLoader
https://bugs.webkit.org/show_bug.cgi?id=87607

Reviewed by Darin Adler.

* loader/MainResourceLoader.cpp:
(WebCore::MainResourceLoader::MainResourceLoader):
(WebCore::MainResourceLoader::handleSubstituteDataLoadNow):
(WebCore::MainResourceLoader::handleSubstituteDataLoadSoon):
* loader/MainResourceLoader.h:
(MainResourceLoader):
-Add the OVERRIDE keyword for the methods inherited from ResourceLoader.
-Remove the useless declaration of handleDataLoad(ResourceRequest&), this method does not exist.
-Rename handleDataLoadNow() to handleSubstituteDataLoadNow() and make the method private. This should
 only be used by handleSubstituteDataLoadSoon() and indirectly through the timer.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118644 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Support multiple shadow roots in event dispatching.
https://bugs.webkit.org/show_bug.cgi?id=87470

Reviewed by Dimitri Glazkov.

Source/WebCore:

The current implementation does not set event's target correctly
if an event happens on DOM tree with multiple shadow roots.  So
this patch updates an event re-targeting algorithm so that it
works even if it is applied to multiple shadow roots.

Tests: fast/dom/shadow/shadow-dom-event-dispatching.html

* dom/ComposedShadowTreeWalker.cpp:
(WebCore::ComposedShadowTreeWalker::traverseParentIncludingInsertionPointAndShadowRoot):
* dom/EventDispatcher.cpp:
(WebCore::EventDispatcher::ensureEventAncestors):

LayoutTests:

* fast/dom/shadow/shadow-dom-event-dispatching-expected.txt:
* fast/dom/shadow/shadow-dom-event-dispatching.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118645 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Weak pointer finalization should be lazy
https://bugs.webkit.org/show_bug.cgi?id=87599

Reviewed by Darin Adler.

* heap/Heap.cpp:
(JSC::Heap::collect): Don't force immediate finalization -- it will
happen lazily.

* heap/MarkedBlock.cpp:
(JSC::MarkedBlock::sweep): Sweep a block's weak set when sweeping the
block. The weak set may not have been swept yet, and this is our last
chance to run weak finalizers before we recycle the memory they reference.

* heap/MarkedBlock.h:
* heap/MarkedSpace.cpp:
(JSC::MarkedBlock::sweepWeakSets):
* heap/MarkedSpace.h:
(JSC::MarkedSpace::sweepWeakSets): Nixed sweepWeakSets because it's unused
now.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118646 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL] Enable blob support for the EFL port
https://bugs.webkit.org/show_bug.cgi?id=85363

Patch by Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> on 2012-05-27
Reviewed by Hajime Morita.

.:

Enable Blob support by default for the EFL port.

* Source/cmake/OptionsEfl.cmake:

Tools:

Enable Blob support by default for the EFL port.

* Scripts/webkitperl/FeatureList.pm:

LayoutTests:

Unskip tests which require blob support to be enabled.

* platform/efl/Skipped:
* platform/efl/test_expectations.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118647 268f45cc-cd09-0410-ab3c-d52691b4dbfc
cut, copy or paste event won't be fired in Shadow DOM.
https://bugs.webkit.org/show_bug.cgi?id=87352

Reviewed by Dimitri Glazkov.

Source/WebCore:

cut, copy or paste event was not fired in Shadow DOM.
Since event re-targeting has been implemented, it should be safe to fire them in Shadow DOM now.

Tests: fast/dom/shadow/cppevent-in-shadow.html
       fast/dom/shadow/cppevent-input-in-shadow.html

* editing/Editor.cpp:
(WebCore::Editor::findEventTargetFrom):

LayoutTests:

* fast/dom/shadow/cppevent-in-shadow-expected.txt: Added.
* fast/dom/shadow/cppevent-in-shadow.html: Added.
* fast/dom/shadow/cppevent-input-in-shadow-expected.txt: Added.
* fast/dom/shadow/cppevent-input-in-shadow.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118648 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix an incorrect assertion in Vector::remove
https://bugs.webkit.org/show_bug.cgi?id=87612

Reviewed by Dan Bernstein.

* wtf/Vector.h: There's no good reason to disallow calling remove
with a size of 0, even when the position is at the end of the vector,
so changed the two-argument Vector::remove assertion to assert that
the position is <= size rather than < size.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118649 268f45cc-cd09-0410-ab3c-d52691b4dbfc
StyleResolver need not allocate each MediaQueryResult on the heap
https://bugs.webkit.org/show_bug.cgi?id=75223

Reviewed by Daniel Bates.

* css/MediaQuery.cpp: Removed some comments that pointed to CSS documents.
There is no guarantee these links will be valid over time.
(WebCore::MediaQuery::MediaQuery): Rewrote for clarity, conventional WebKit coding
style, and simplicity.
(WebCore::MediaQuery::copy): Moved out of line; not performance critical, and this
allows us to cut down header dependencies.
(WebCore::MediaQuery::cssText): Updated for change to data member name.

* css/MediaQuery.h: Removed unneeded includes. Removed non-helpful argument name
"exprs". Changed expressions function to return a reference instead of
a pointer. Changed mediaType and cssText functions to return a reference. Renamed
m_serializationCache to m_serializedQuery. Moved copy function out of header.

* css/MediaQueryEvaluator.cpp: Renamed EvalFunc to MediaFeatureEvaluationFunction.
Broke a FIXME into three and reworded for clarity.
(WebCore::MediaQueryEvaluator): Updated for name changes.
(WebCore::MediaQueryEvaluator::eval): Rewrote this for clarity and to regularize
the logic a bit.
(WebCore::aspect_ratioMediaFeatureEval): Got rid of a != 0 that is contrary to the
normal WebKit style.
(WebCore::device_aspect_ratioMediaFeatureEval): Ditto.
(WebCore::transform_3dMediaFeatureEval): Fixed mangled #if that was here.
(WebCore::view_modeMediaFeatureEval): Replaced UNUSED_PARAM usage with ASSERT_UNUSED.
(WebCore::createFunctionMap): Changed this so it returns the map so we can use a
cleaner style in the caller.
(WebCore::MediaQueryEvaluator::eval): Updated to take a reference and improved the
comments and coding style a bit.

* css/MediaQueryEvaluator.h: Updated comment style. Removed unused constructor.
Removed unneeded destructor declaration. Renamed m_expResult to m_mediaFeatureResult.

* css/StyleResolver.cpp: Moved the MediaQueryResult class into this file
and made it a structure rather than a class.
(WebCore::StyleResolver::addViewportDependentMediaQueryResult): Updated to take
a reference argument instead of a pointer and for the new vector type.
(WebCore::StyleResolver::affectedByViewportChange): Updated for above changes.

* css/StyleResolver.h: Removed many unneeded includes and forward declarations of
classes, including now-unneeded include of MediaQueryExp.h. Replaced MediaQueryResult
definition with a forward declaration. Changed addViewportDependentMediaQueryResult
to take a reference instead of a pointer. Changed m_viewportDependentMediaQueryResults
to be a vector of values rather than of pointers.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118650 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed. Rebaselined run-binding-tests results.

* bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
(WebCore::JSTestActiveDOMObjectOwner::finalize):
* bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
(WebCore::JSTestCustomNamedGetterOwner::finalize):
* bindings/scripts/test/JS/JSTestEventConstructor.cpp:
(WebCore::JSTestEventConstructorOwner::finalize):
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
(WebCore::JSTestEventTargetOwner::finalize):
* bindings/scripts/test/JS/JSTestException.cpp:
(WebCore::JSTestExceptionOwner::finalize):
* bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::JSTestInterfaceOwner::finalize):
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
(WebCore::JSTestMediaQueryListListenerOwner::finalize):
* bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
(WebCore::JSTestNamedConstructorOwner::finalize):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSTestObjOwner::finalize):
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
(WebCore::JSTestSerializedScriptValueInterfaceOwner::finalize):
* bindings/scripts/test/V8/V8TestObj.cpp:
(WebCore::V8TestObj::installPerContextProperties):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118651 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: CodeGeneratorInspector.py: protect typed API from C++ implicit float to int cast
https://bugs.webkit.org/show_bug.cgi?id=87183

Patch by Peter Rybin <peter.rybin@gmail.com> on 2012-05-28
Reviewed by Yury Semikhatsky.

An intermediate C++ class is introduced that uses C++ template technique to control actual type
of its constructor argument.
All input parameters of type "int" now have type ExactlyInt.
All usage sites are fixed accordingly.

* inspector/CodeGeneratorInspector.py:
(TypeModel.RefPtrBased):
(TypeModel.Enum):
(TypeModel.ValueType):
(TypeModel.ValueType.get_opt_output_type_):
(TypeModel.ValueType.ValueOptional.get_command_return_pass_model):
(TypeModel.ExactlyInt):
(TypeModel.ExactlyInt.__init__):
(TypeModel.ExactlyInt.get_input_param_type_text):
(TypeModel.ExactlyInt.get_opt_output_type_):
(TypeModel.init_class):
(ExactlyInt):
* inspector/InspectorAgent.cpp:
(WebCore::InspectorAgent::enable):
(WebCore::InspectorAgent::didCreateWorker):
(WebCore::InspectorAgent::didDestroyWorker):
(WebCore::InspectorAgent::evaluateForTestInFrontend):
* inspector/InspectorApplicationCacheAgent.cpp:
(WebCore::InspectorApplicationCacheAgent::updateApplicationCacheStatus):
(WebCore::InspectorApplicationCacheAgent::getFramesWithManifests):
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::buildObjectForNode):
* inspector/InspectorMemoryAgent.cpp:
(WebCore::jsHeapInfo):
(WebCore::InspectorMemoryAgent::getProcessMemoryDistribution):
* inspector/PageRuntimeAgent.cpp:
(WebCore::PageRuntimeAgent::notifyContextCreated):

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