Fixed backgrounds in composited layers not repainted on scrolling
https://bugs.webkit.org/show_bug.cgi?id=117684

Source/WebCore:

Reviewed by Tim Horton.

FrameView is aware that "slow-repaint objects" (i.e. renderers with
background-attachment:fixed) require a slow-scrolling path. However,
it was ignorant of the fact that such objects could be painting into
compositing layers; it simply dirtied the main tiles, and nothing else.

Fix by having FrameView track the slow-repaints objects explicitly, as we
do for position:fixed, and repaint each of them on scrolling.

Test: compositing/repaint/fixed-background-scroll.html

* page/FrameView.cpp:
(WebCore::FrameView::FrameView): No need to initialize m_slowRepaintObjectCount,
which is now an OwnPtr<RenderObjectSet>.
(WebCore::FrameView::useSlowRepaints): Use hasSlowRepaintObjects() now.
(WebCore::FrameView::addSlowRepaintObject): Now adds the object to a set,
allocating the set if necessary.
(WebCore::FrameView::removeSlowRepaintObject): Remove the object from the set,
and deallocate the set if empty.
(WebCore::FrameView::scrollContentsSlowPath): Call repaintSlowRepaintObjects();
this is the change that fixes the bug for always-composited implementations (e.g.
tile cache). This is a conservative change; we still invalidate the tile cache
as well. This could be optimized later.
(WebCore::FrameView::repaintSlowRepaintObjects): Repaint each object in the set.
Their appropriate compositing ancestor will be repainted.
(WebCore::FrameView::scrollPositionChangedViaPlatformWidget): Call
repaintSlowRepaintObjects() so that fixed backgrounds in composited layers are
correctly repainted; this fixes the bug for WebKit1.
* page/FrameView.h: Replace m_slowRepaintObjectCount with a HashSet of
RenderObjects.
(WebCore::FrameView::hasSlowRepaintObject): Takes a RenderObject* now.
(WebCore::FrameView::hasSlowRepaintObjects): Ditto.
* rendering/RenderObject.cpp:
(WebCore::RenderObject::styleWillChange): Pass the RenderObject.
(WebCore::RenderObject::willBeDestroyed): Assert that this RenderObject
has been removed from FrameView's set of slow-repaint objects already, if
the document is not being destroyed.
(WebCore::RenderObject::willBeRemovedFromTree): Pass the RenderObject.

LayoutTests:

Reviewed by Tim Horton.

Test that verifies that a composited layer with a fixed background is repainted
on scrolling.

* compositing/repaint/fixed-background-scroll-expected.txt: Added.
* compositing/repaint/fixed-background-scroll.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151624 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed. Added new baselines for some of editing/selection tests as r151533 on EFL port.

* platform/efl/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151625 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed. Added new baselines for some of editing/style tests, which works on EFL port.

* platform/efl/TestExpectations:
* platform/efl/editing/style/5017613-1-expected.png: Added.
* platform/efl/editing/style/5017613-1-expected.txt: Added.
* platform/efl/editing/style/5046875-1-expected.png: Added.
* platform/efl/editing/style/5046875-1-expected.txt: Added.
* platform/efl/editing/style/5065910-expected.png: Added.
* platform/efl/editing/style/5065910-expected.txt: Added.
* platform/efl/editing/style/5228141-expected.png: Added.
* platform/efl/editing/style/5228141-expected.txt: Added.
* platform/efl/editing/style/5279521-expected.png: Added.
* platform/efl/editing/style/5279521-expected.txt: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151626 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix two assertion failures in Range::insertNode
https://bugs.webkit.org/show_bug.cgi?id=116511

Reviewed by Ryosuke Niwa.

Source/WebCore:

> ASSERTION FAILED: childBefore == (offset ? container->childNode(offset - 1) : 0)
> third_party/WebKit/Source/WebCore/dom/RangeBoundaryPoint.h(115) : void WebCore::RangeBoundaryPoint::set(PassRefPtr<WebCore::Node>, int, WebCore::Node *)

> ASSERTION FAILED: child->parentNode()
> ../../third_party/WebKit/Source/core/dom/RangeBoundaryPoint.h(133) : void WebCore::RangeBoundaryPoint::setToBeforeChild(WebCore::Node *)
>  1   0x87594b2 WebCore::RangeBoundaryPoint::setToBeforeChild(WebCore::Node*)
>  2   0x87534a9 WebCore::Range::insertNode(WTF::PassRefPtr<WebCore::Node>, int&)

Range::insertNode calls Node::insertBefore, in which an event handler
can update the DOM structure so that RangeBoundaryPoint don't like. We
postpone event dispatching by EventQueueScope.

Also, remove old comments about Acid3. The behavior is standardized.
(Step 9 of http://dom.spec.whatwg.org/#dom-range-insertnode)

This patch imports http://src.chromium.org/viewvc/blink?view=revision&revision=150470 .

Test: fast/dom/Range/range-insertNode-assertion.html

* dom/Range.cpp:
(WebCore::Range::insertNode):
 - Add EventQueueScope
 - Remove obsolete comments

LayoutTests:

We need to update fast/dom/insertBefore-refChild-crash.html because the
test caused recursive calls to the event handler. container.innerHTML=''
did nothing before this CL. Now container has the newChild because
DOMNodeRemoved event dispatching is delayed until Range::insertNode
completion.

We need to update fast/text/split-text-crash.xhtml so that it doesn't
stop when the event handler is called twice. I'm not sure why the test
worked before this CL.

* fast/dom/Range/range-insertNode-assertion-expected.txt: Added.
* fast/dom/Range/range-insertNode-assertion.html: Added.
* fast/dom/insertBefore-refChild-crash.html:
* fast/text/split-text-crash.xhtml:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151627 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove a redundant virtual call to hostWindow() in FrameView::invalidateRect()
https://bugs.webkit.org/show_bug.cgi?id=117685

Reviewed by Andreas Kling.

From Blink r152490 by <vivek.vg@samsung.com>

* page/FrameView.cpp:
(WebCore::FrameView::invalidateRect): Avoid hostWindow() twice call.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151628 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix test assertion after r151624

An assertion was hit in RenderObject::willBeDestroyed()
for fast/css/getComputedStyle/getComputedStyle-background-shorthand.html
because the code asserted that the RenderObject had been removed from
the FrameView's slowRepaintObject set before remove() was called,
so move the assertion to after that call.

* rendering/RenderObject.cpp:
(WebCore::RenderObject::willBeDestroyed):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151629 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Blending] Update the background-blend-mode-image-color-dynamic test to use the repaint test logic

Updating testcase verifying if background blend modes are updated dynamically from script. This now
properly uses the repaint test mechanism. Also, the background image resource is addded.

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

Patch by Mihai Tica <mitica@adobe.com> on 2013-06-16
Reviewed by Dean Jackson.

* fast/repaint/background-blend-mode-image-color-dynamic-expected.html:
* fast/repaint/background-blend-mode-image-color-dynamic.html:
* fast/repaint/resources/ducky.png: Added.

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

* platform/gtk-wk1/TestExpectations: Add a crashing expectation for a test that most likely regressed with r151021.
* platform/gtk/TestExpectations: Add failure expectations for a couple of tests failing due to stack size misbehavior.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151631 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Context menu grammar checking items are available when GRAMMAR_CHECKING macro is off
https://bugs.webkit.org/show_bug.cgi?id=117585

Reviewed by Anders Carlsson.

Source/WebCore:

Do not add "Check Grammar With Spelling" and "Ignore Grammar" to the context menu
when GRAMMAR_CHECKING is off.
Replace "Spelling and Grammar" with "Spelling" as the sub menu title and "Show/Hide Spelling
and Grammar" with "Show/Hide Spelling" when GRAMMAR_CHECKING is off.

Additionally, guard grammar checking in context menu code to not necessarily
compile it.

No new layout tests because every port has a different way of showing
spelling/grammar context menu items.

* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected):
(WebCore::ContextMenuController::createAndAppendSpellingAndGrammarSubMenu):
(WebCore::ContextMenuController::populate):
(WebCore::ContextMenuController::checkOrEnableIfNeeded):
* platform/LocalizedStrings.cpp:
(WebCore::contextMenuItemTagCheckGrammarWithSpelling):
(WebCore::contextMenuItemTagSpellingMenu):
(WebCore::contextMenuItemTagShowSpellingPanel):
* platform/LocalizedStrings.h:
* platform/efl/LocalizedStringsEfl.cpp:
(WebCore::contextMenuItemTagCheckGrammarWithSpelling):
(WebCore::contextMenuItemTagSpellingMenu):
(WebCore::contextMenuItemTagShowSpellingPanel):
* platform/gtk/LocalizedStringsGtk.cpp:
(WebCore::contextMenuItemTagCheckGrammarWithSpelling):
(WebCore::contextMenuItemTagSpellingMenu):
(WebCore::contextMenuItemTagShowSpellingPanel):
* platform/qt/LocalizedStringsQt.cpp:
(WebCore::contextMenuItemTagCheckGrammarWithSpelling):
(WebCore::contextMenuItemTagSpellingMenu):
(WebCore::contextMenuItemTagShowSpellingPanel):

Source/WebKit/gtk:

Add GRAMMAR_CHECKING guard to the context menu grammar items.

* webkit/webkitglobals.cpp:
(webkit_context_menu_item_get_action):

Source/WebKit/mac:

Add GRAMMAR_CHECKING guard to the context menu grammar items.

* WebCoreSupport/WebContextMenuClient.mm:
(fixMenusReceivedFromOldClients):

Source/WebKit2:

Add GRAMMAR_CHECKING guard to the context menu grammar items.

* Shared/API/c/WKSharedAPICast.h:
(WebKit::toAPI):
(WebKit::toImpl):
* UIProcess/API/efl/ewk_context_menu_item.cpp:
(getEwkActionFromWKTag):
* UIProcess/API/efl/tests/test_ewk2_text_checker.cpp:
(checkSpellingItemsAvailability):
Change callback name, to be consistent with a newly added.

(checkSpellingAndGrammarSubmenuAvailability):
(checkGrammarWithSpellingItemAvailability):
Add two unit tests for EFL to check whether context menu grammar items are
available only when GRAMMAR_CHECKING macro is enabled.

* UIProcess/API/gtk/WebKitContextMenuActions.cpp:
(webkitContextMenuActionGetActionTag):
(webkitContextMenuActionGetForContextMenuItem):
(webkitContextMenuActionGetLabel):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::contextMenuItemSelected):

Source/WTF:

Enable GRAMMAR_CHECKING for WebKit ports that use/implement it.

* wtf/Platform.h:

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

* Scripts/run-gtk-tests:
(TestRunner): Skip three WebKit2APITests suites that are currently timing out.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151633 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] Unreviewed gardening. Rebaselining repaint tests, see bug 115372.

* platform/qt-5.0-wk2/fast/repaint/change-overflow-and-display-of-relative-expected.txt: Rebaselining after r151549.
* platform/qt-5.0-wk2/fast/repaint/fixed-background-scroll-expected.txt: Rebaselining after r151624.
* platform/qt-5.0-wk2/fast/repaint/positioned-movement-expected.txt: Rebaselining after r151622.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151634 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed. Rename gobject_introspection_required variable.

As gobject_introspection_required_version for consistency with all
other required_version variables.

* Source/autotools/FindDependencies.m4:
* Source/autotools/Versions.m4:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151635 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] Unreviewed gardening. Correcting rebaselining after r151634.

* platform/qt-5.0-wk2/compositing/repaint/fixed-background-scroll-expected.txt: Renamed from LayoutTests/platform/qt-5.0-wk2/fast/repaint/fixed-background-scroll-expected.txt.
* platform/qt-5.0-wk2/compositing/repaint/positioned-movement-expected.txt: Renamed from LayoutTests/platform/qt-5.0-wk2/fast/repaint/positioned-movement-expected.txt.

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