SimplifyMarkupCommand takes a disproportionally long time to run when there are many nodes to remove
https://bugs.webkit.org/show_bug.cgi?id=101144

Reviewed by Enrica Casucci.

The bug was caused by attach() happening between each node removal. Since the command was trying
to remove millions of node in some cases, attach()ing render objects for each node being reinserted
imposed a huge runtime cost.

Fixed the bug by using lazy attach when removing nodes and avoiding calls to isContentEditable.
Also remove all ancestors at once when they are direct child/parent of each other so that we don't
remove an ancestor and then insert its child back only to remove it again in the next iteration.

No new tests since it doesn't change the asymptotic performance, and adding a new performance test for
this specific case is not the worth the increase in the bot cycle time. I'll note that the email
attached in the original radar bug (<rdar://problem/12179712>) took 100 seconds to open now only takes
7 seconds to open on my MacPro.

* editing/AppendNodeCommand.cpp:
(WebCore::AppendNodeCommand::doApply): Takes a flag indicating whether we should assume nodes are editable
without calling isContentEditable or not.
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyInlineStyleToPushDown): Update the style as later code requires render
object.
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::insertNodeBefore): Passes a flag to the command.
(WebCore::CompositeEditCommand::removeNode): Ditto.
(WebCore::CompositeEditCommand::removeNodePreservingChildren): Ditto.
* editing/CompositeEditCommand.h:
(CompositeEditCommand):
* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::removeNode): Takes a flag indicating whether we should assume nodes are
editable without calling isContentEditable or not.
* editing/DeleteSelectionCommand.h:
(DeleteSelectionCommand):
* editing/EditCommand.h:
* editing/InsertIntoTextNodeCommand.cpp:
(WebCore::InsertIntoTextNodeCommand::doApply): Update the layout when password echo is enabled since
we need to have render objects for echoing.
* editing/InsertNodeBeforeCommand.cpp:
(WebCore::InsertNodeBeforeCommand::InsertNodeBeforeCommand): Ditto.
(WebCore::InsertNodeBeforeCommand::doApply): Ditto; also always use lazy attach.
(WebCore::InsertNodeBeforeCommand::doUnapply):
* editing/InsertNodeBeforeCommand.h:
(WebCore::InsertNodeBeforeCommand::create):
(InsertNodeBeforeCommand):
* editing/RemoveNodeCommand.cpp:
(WebCore::RemoveNodeCommand::RemoveNodeCommand): Ditto about the flag.
(WebCore::RemoveNodeCommand::doApply):
* editing/RemoveNodeCommand.h:
(WebCore::RemoveNodeCommand::create):
(RemoveNodeCommand):
* editing/RemoveNodePreservingChildrenCommand.cpp:
(WebCore::RemoveNodePreservingChildrenCommand::RemoveNodePreservingChildrenCommand): Ditto.
(WebCore::RemoveNodePreservingChildrenCommand::doApply):
* editing/RemoveNodePreservingChildrenCommand.h:
(WebCore::RemoveNodePreservingChildrenCommand::create):
(RemoveNodePreservingChildrenCommand):
* editing/SimplifyMarkupCommand.cpp:
(WebCore::SimplifyMarkupCommand::doApply):
(WebCore::SimplifyMarkupCommand::pruneSubsequentAncestorsToRemove): Added to optimize removals of multiple
ancestors.
* editing/SimplifyMarkupCommand.h:
(SimplifyMarkupCommand):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@133820 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, clean up chromium-mac-mountainlion for remaining compositing, css3 (non selectors3) tests.

* platform/chromium-mac-lion/css3/css3-modsel-33-expected.png: Copied from LayoutTests/platform/chromium-mac/css3/css3-modsel-33-expected.png.
* platform/chromium-mac-lion/css3/css3-modsel-35-expected.png: Copied from LayoutTests/platform/chromium-mac/css3/css3-modsel-35-expected.png.
* platform/chromium-mac-lion/css3/css3-modsel-36-expected.png: Copied from LayoutTests/platform/chromium-mac/css3/css3-modsel-36-expected.png.
* platform/chromium-mac-lion/css3/css3-modsel-37-expected.png: Copied from LayoutTests/platform/chromium-mac/css3/css3-modsel-37-expected.png.
* platform/chromium-mac-lion/css3/flexbox/repaint-expected.png: Copied from LayoutTests/platform/chromium-mac/css3/flexbox/repaint-expected.png.
* platform/chromium-mac-lion/css3/font-feature-settings-rendering-expected.png: Copied from LayoutTests/platform/chromium-mac/css3/font-feature-settings-rendering-expected.png.
* platform/chromium-mac-lion/css3/unicode-bidi-isolate-basic-expected.png: Copied from LayoutTests/platform/chromium-mac/css3/unicode-bidi-isolate-basic-expected.png.
* platform/chromium-mac-mountainlion/TestExpectations:
* platform/chromium-mac/compositing/text-on-scaled-layer-expected.png: Added.
* platform/chromium-mac/compositing/text-on-scaled-surface-expected.png: Added.
* platform/chromium-mac/css3/css3-modsel-33-expected.png:
* platform/chromium-mac/css3/css3-modsel-35-expected.png:
* platform/chromium-mac/css3/css3-modsel-36-expected.png:
* platform/chromium-mac/css3/css3-modsel-37-expected.png:
* platform/chromium-mac/css3/flexbox/repaint-expected.png:
* platform/chromium-mac/css3/font-feature-settings-rendering-expected.png:
* platform/chromium-mac/css3/unicode-bidi-isolate-basic-expected.png:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@133821 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, fix mistakenly added pngs for failing compositing ref tests :(.

* platform/chromium-mac/compositing/text-on-scaled-layer-expected.png: Removed.
* platform/chromium-mac/compositing/text-on-scaled-surface-expected.png: Removed.
* platform/chromium/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@133822 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[V8] Prepare DOMDataStore to be able to store ScriptWrappable wrappers inline
https://bugs.webkit.org/show_bug.cgi?id=101523

Unreviewed. Technically this patch hasn't been reviewed, but it is part
of a patch that was reviewed by Kentaro Hara.

Sadly, my patch for bug 101110 triggered the regression again. This
patch is a smaller incremental step towards the patch in bug 101110. It
doesn't make that much sense on its own, but it will help me isolate
the source of the regression.

* bindings/v8/DOMDataStore.h:
(WebCore::DOMDataStore::get):
(DOMDataStore):
(WebCore::DOMDataStore::set):
(WebCore::DOMDataStore::wrapperIsStoredInObject):
(WebCore::DOMDataStore::getWrapperFromObject):
(WebCore::DOMDataStore::setWrapperInObject):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@133823 268f45cc-cd09-0410-ab3c-d52691b4dbfc
IndexedDB: Prepare for IDBBackingStore merge by renaming IDBLevelDBBackingStore.cpp
https://bugs.webkit.org/show_bug.cgi?id=101486

Reviewed by Ojan Vafai.

Rename IDBLevelDBBackingStore.cpp to IDBBackingStore.cpp in
preparation for merging these classes. This will make the merge
diffs sane. See https://bugs.webkit.org/show_bug.cgi?id=101415
for the final goal.

No new tests, this is is just a rename and minor style fix.

* CMakeLists.txt:
* GNUmakefile.list.am:
* Modules/indexeddb/IDBBackingStore.cpp: Renamed from Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp.
* WebCore.gypi:
* WebCore.xcodeproj/project.pbxproj:


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

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@133826 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add empty RemoteLayerTree class
https://bugs.webkit.org/show_bug.cgi?id=101524

Reviewed by Simon Fraser.

Add a new RemoteLayerTree class which will contain the remote graphics layers.

* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebPage/mac/RemoteLayerTree.h: Added.
* WebProcess/WebPage/mac/RemoteLayerTree.mm: Added.
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
(RemoteLayerTreeDrawingArea):
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@133827 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WK2] Make WebVibrationProxy to be a member of WebPageProxy.
https://bugs.webkit.org/show_bug.cgi?id=100334

Patch by Byungwoo Lee <bw80.lee@samsung.com> on 2012-11-07
Reviewed by Anders Carlsson.

WebVibrationProxy should be a member of WebPageProxy, because the IPC
messages of WebVibrationProxy have page destination ID.

The r132386 proposed a way to add/delete message receivers that can
handle IPC messages with destination ID.

Previous implementation that creating WebVibrationProxy as a WebContext
member and using the global message receiver for the proxy can make
assertions after r132386.

To handle the vibration IPC messages properly, this patch will do the
followings.

1) Instead of WebContext, WebPageProxy will have the WebVibrationProxy.

2) WebVibrationProxy will add itself to the message receiver map of
   the WebContext with page destination ID.

3) When WebProcessProxy received vibration ipc messages, it will
   forward the messages to the WebContext first. Then the message
   receiver map of the WebContext will handle the messages with the
   registered WebVibrationProxy.

4) APIs will be modified to apply these changes.
   a) WK API to get WKVibrationRef will use WKPageRef not WKContextRef.
   b) EFL APIs and API test for the vibration will also be changed.
      - EwkViewImpl will have vibration client. (EwkContext will not
        have it)
      - Previous API to register the vibration callback will be removed.
      - New signals for vibration will be added to the EwkViewImpl.
      - VibrationProxy will be renamed to VibrationClient for the
        consistency with other clients in EwkViewImpl.
      - VibrationClient will use EwkViewImpl instead of EwkContext.
      - Previous API test for vibration will be moved from context test
        to view test, and it will use the changed API.

* PlatformEfl.cmake:
* UIProcess/API/C/WKContext.cpp:
* UIProcess/API/C/WKContext.h:
* UIProcess/API/C/WKPage.cpp:
(WKPageGetVibration):
* UIProcess/API/C/WKPage.h:
* UIProcess/API/efl/EwkViewCallbacks.h:
(EwkViewCallbacks):
* UIProcess/API/efl/EwkViewImpl.cpp:
(EwkViewImpl::EwkViewImpl):
* UIProcess/API/efl/EwkViewImpl.h:
(WebKit):
(EwkViewImpl):
* UIProcess/API/efl/ewk_context.cpp:
(EwkContext::EwkContext):
* UIProcess/API/efl/ewk_context.h:
* UIProcess/API/efl/ewk_context_private.h:
(WebKit):
(EwkContext):
* UIProcess/API/efl/ewk_view.h:
* UIProcess/API/efl/tests/test_ewk2_context.cpp:
* UIProcess/API/efl/tests/test_ewk2_view.cpp:
(VibrationCbData):
(onVibrate):
(onCancelVibration):
(loadVibrationHTMLString):
(TEST_F):
* UIProcess/WebContext.cpp:
(WebKit::WebContext::WebContext):
(WebKit::WebContext::~WebContext):
(WebKit::WebContext::disconnectProcess):
* UIProcess/WebContext.h:
(WebKit):
(WebContext):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::close):
(WebKit::WebPageProxy::processDidCrash):
* UIProcess/WebPageProxy.h:
(WebKit):
(WebPageProxy):
(WebKit::WebPageProxy::vibration):
* UIProcess/WebVibrationProxy.cpp:
(WebKit::WebVibrationProxy::create):
(WebKit::WebVibrationProxy::WebVibrationProxy):
(WebKit::WebVibrationProxy::~WebVibrationProxy):
(WebKit::WebVibrationProxy::invalidate):
* UIProcess/WebVibrationProxy.h:
(WebKit):
(WebVibrationProxy):
* UIProcess/efl/VibrationClientEfl.cpp: Renamed from Source/WebKit2/UIProcess/efl/VibrationProvider.cpp.
(toVibrationClient):
(VibrationClientEfl::vibrateCallback):
(VibrationClientEfl::cancelVibrationCallback):
(VibrationClientEfl::create):
(VibrationClientEfl::VibrationClientEfl):
(VibrationClientEfl::~VibrationClientEfl):
* UIProcess/efl/VibrationClientEfl.h: Renamed from Source/WebKit2/UIProcess/efl/VibrationProvider.h.
(WebKit):
(VibrationClientEfl):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@133828 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[V8] Don't leak <img> elements in content scripts
https://bugs.webkit.org/show_bug.cgi?id=101525

Reviewed by Ojan Vafai.

I found the leak that was causing a problem for bug 101110. We weren't
filling in the derefObjectFunction for HTMLImageElements (and
potentially some other types of elements). That manifests today as a
memory leak in content scripts (which use the derefObjectFunction for
nodes) and caused a memory leak after bug 101110 because we started
using the derefObjectFunction in the main world as well.

This patch adds ASSERTs so that we won't make this mistake in the future.

* bindings/scripts/CodeGeneratorV8.pm:
(GenerateNamedConstructorCallback):
* bindings/v8/DOMDataStore.cpp:
(WebCore::DOMDataStore::weakCallback):
* bindings/v8/DOMWrapperMap.h:
(WebCore::DOMWrapperMap::defaultWeakCallback):
* bindings/v8/custom/V8HTMLImageElementConstructor.cpp:
(WebCore):


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