DidFirstFlushForHeaderLayer can be called too soon on pages that redirect
https://bugs.webkit.org/show_bug.cgi?id=116749
-and corresponding-
<rdar://problem/13886753>

Reviewed by Simon Fraser.

Only start m_paintRelatedMilestonesTimer if we have actually painted.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::flushPendingLayerChanges):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150671 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fixing invalid block recovery in some declaration list.
https://bugs.webkit.org/show_bug.cgi?id=115159

Patch by Sergio Villar Senin <svillar@igalia.com> on 2013-05-24
Reviewed by Darin Adler.

From Blink r148889 by <serya@chromium.org>

Source/WebCore:

Improves the detection of some invalid block declarations inside a
declaration list. This allows the parser not to completely discard
a whole declaration list that contains an invalid block. In
particular grammar failed in tests 8, 12, 13, 15, 16 and 17 in the
new test added by this change.

Test: fast/css/parsing-invalid-block-recovery.html

* css/CSSGrammar.y.in:

LayoutTests:

* fast/css/parsing-invalid-block-recovery-expected.txt: Added.
* fast/css/parsing-invalid-block-recovery.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150672 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Build fix after r150664.

* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150675 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Inline TCMalloc_Central_FreeList's RemoveRange and FetchFromSpansSafe
https://bugs.webkit.org/show_bug.cgi?id=116700

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

The two functions only have one call site each.

* wtf/FastMalloc.cpp:
(WTF::TCMalloc_Central_FreeList::RemoveRange):
(WTF::TCMalloc_Central_FreeList::FetchFromSpansSafe):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150676 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed build fix. Don't use new NRWT logic needed
by Windows yet. Activate (and fix test) when we cut over.

* Scripts/webkitpy/port/driver.py:
(Driver._setup_environ_for_driver):
(Driver._start):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150677 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed change to get Windows bots green.  Disable a number
of crashes and failures.  Crashes are tracked under
https://bugs.webkit.org/show_bug.cgi?id=116562, failures under
https://bugs.webkit.org/show_bug.cgi?id=116564.

* platform/win/TestExpectations:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150678 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL] Build fix after r150669
https://bugs.webkit.org/show_bug.cgi?id=116750

Patch by Seokju Kwon <seokju.kwon@gmail.com> on 2013-05-24
Reviewed by Anders Carlsson.

* CMakeLists.txt:
* WebProcess/Battery/WebBatteryManager.cpp:
(WebKit::WebBatteryManager::registerWebPage):
(WebKit::WebBatteryManager::unregisterWebPage):
* WebProcess/NetworkInfo/WebNetworkInfoManager.cpp:
(WebKit::WebNetworkInfoManager::registerWebPage):
(WebKit::WebNetworkInfoManager::unregisterWebPage):
(WebKit::WebNetworkInfoManager::bandwidth):
(WebKit::WebNetworkInfoManager::metered):
* WebProcess/WebCoreSupport/WebVibrationClient.cpp:
(WebKit::WebVibrationClient::vibrate):
(WebKit::WebVibrationClient::cancelVibration):
* WebProcess/soup/WebSoupRequestManager.cpp:
(WebKit::WebSoupRequestManager::didReceiveURIRequestData):
(WebKit::WebSoupRequestManager::send):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL] Remove obsolete Page forward declaration from InspectorClientEfl.h
https://bugs.webkit.org/show_bug.cgi?id=116752

Patch by Seokju Kwon <seokju.kwon@gmail.com> on 2013-05-24
Reviewed by Christophe Dumez.

* WebCoreSupport/InspectorClientEfl.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150680 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt][GTK] Build fix after r150669
https://bugs.webkit.org/show_bug.cgi?id=116751

Patch by Seokju Kwon <seokju.kwon@gmail.com> on 2013-05-24
Reviewed by Christophe Dumez.

* GNUmakefile.list.am:
* Target.pri:
* WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
(WebKit::WebEditorClient::getEditorCommandsForKeyEvent):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150681 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reducing CSS code duplication in declaration list error recovery
https://bugs.webkit.org/show_bug.cgi?id=115157

Reviewed by Andreas Kling.

From Blink r148974 by <serya@chromium.org>

Refactor "invalid_block_list error | /* empty */" in a new
decl_list_recovery rule that allows to remove 4 redundant rules.

No new test required as we're just refactoring code, no new behaviour.

* css/CSSGrammar.y.in:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150682 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Document::formController() should return a reference.
<http://webkit.org/b/116758>

Reviewed by Antti Koivisto.

The formController() is created on demand, so return a reference instead.

* dom/Document.h:
* dom/Document.cpp:
(WebCore::Document::formController):
(WebCore::Document::setStateForNewFormElements):
* html/HTMLFormControlElementWithState.cpp:
(WebCore::HTMLFormControlElementWithState::HTMLFormControlElementWithState):
(WebCore::HTMLFormControlElementWithState::~HTMLFormControlElementWithState):
(WebCore::HTMLFormControlElementWithState::didMoveToNewDocument):
(WebCore::HTMLFormControlElementWithState::finishParsingChildren):
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::~HTMLFormElement):
(WebCore::HTMLFormElement::finishParsingChildren):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::~HTMLInputElement):
(WebCore::HTMLInputElement::didMoveToNewDocument):
(WebCore::HTMLInputElement::checkedRadioButtons):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150683 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Move "hover" state logic from Node to Element.
<http://webkit.org/b/116757>

Reviewed by Antti Koivisto.

Resolve a 7 year old FIXME by merging the "hover" state logic from Node and ContainerNode
and moving it all to Element instead.

* dom/Node.cpp:
(WebCore::Node::detach):
* dom/Element.cpp:
(WebCore::Element::detach):

    Move Document::hoveredNodeDetached() call from Node::detach() to Element::detach().

(WebCore::Element::isUserActionElementHovered):
(WebCore::Element::setHovered):
* dom/Element.h:
(WebCore::Element::hovered):

    Moved here from Node/ContainerNode.

* dom/UserActionElementSet.h:
(WebCore::UserActionElementSet::setHovered):
(WebCore::UserActionElementSet::setFlags):

    Make setHovered() take an Element* instead of a Node*. I'd like to do this will all
    of these methods eventually, so added a setFlags() helper with the tighter type.

* html/HTMLLabelElement.h:
* html/shadow/SpinButtonElement.h:

    Sprinkle OVERRIDE on setHovered() overrides.

* dom/Document.cpp:
(WebCore::Document::updateHoverActiveState):
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::isHovered):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::isHovered):

    Check if the inspected Node is an element before asking if it's hovered.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150684 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Direct pattern compositing breaks when no-repeat is set on a large layer
https://bugs.webkit.org/show_bug.cgi?id=116140

Source/WebCore:

Reviewed by Antti Koivisto.

In some cases the directly composited background color logic overrides the layer's
contentsRect, which results in wrong rendering of tiled images.
This patch makes sure that the background image is applied after the solid color,
which ensures the correct contentsRect.

Test: compositing/patterns/direct-pattern-compositing-contain-no-repeat.html

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateDirectlyCompositedContents):

LayoutTests:

Added a ref-test to make sure that direct pattern compositing works well with no-repeat
in a particular geometry.

Reviewed by Antti Koivisto.

* compositing/patterns/direct-pattern-compositing-contain-no-repeat-expected.html: Added.
* compositing/patterns/direct-pattern-compositing-contain-no-repeat.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150685 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Begin moving "focus" state logic from Node to Element.
<http://webkit.org/b/116760>

Reviewed by Antti Koivisto.

Only Elements can be focused, so merge the "focus" state logic from Node and ContainerNode
and move it into Element. There's a lot more iceberg under this tip, but we'll be starting
with setFocus(bool) and focused().

* dom/Node.h:
* dom/ContainerNode.cpp:
* dom/ContainerNode.h:
* dom/Element.cpp:
(WebCore::Element::isUserActionElementFocused):
(WebCore::Element::setFocus):
* dom/Element.h:
(WebCore::Element::focused):
* dom/Node.cpp:

    Move focused() and setFocus(bool) from Node/ContainerNode to Element.

* dom/Document.cpp:
(WebCore::Document::setFocusedNode):
* page/EventHandler.cpp:
(WebCore::EventHandler::dispatchMouseEvent):

    Check if the inspected Node is an Element before asking if it's focused.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150686 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Move Node::isKeyboardFocusable() to Element.
<http://webkit.org/b/116761>

Reviewed by Antti Koivisto.

Only Elements can be keyboard-focusable. Move the base isKeyboardFocusable() implementation to Element
and sprinkle OVERRIDE on subclass overrides.
FocusController gets some temporary type checks that will go away as that code moves to dealing in
Elements instead of Node.

* dom/Node.h:
* dom/Node.cpp:
* dom/Element.h:
* dom/Element.cpp:
(WebCore::Element::isKeyboardFocusable):

    Move isKeyboardFocusable() from Node to Element.

* page/FocusController.cpp:
(WebCore::isNonFocusableShadowHost):
(WebCore::isFocusableShadowHost):
(WebCore::shouldVisit):
(WebCore::FocusController::advanceFocusInDocumentOrder):

    Check that the inspected Node is an Element before querying isKeyboardFocusable().

* html/HTMLAnchorElement.h:
* html/HTMLAreaElement.h:
* html/HTMLFormControlElement.h:
* html/HTMLFrameOwnerElement.h:
* html/HTMLInputElement.h:
* html/HTMLPlugInElement.h:
* html/HTMLSelectElement.h:
* html/HTMLTextAreaElement.h:
* svg/SVGAElement.h:
* svg/SVGStyledElement.h:

    Sprinkle OVERRIDE.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150687 268f45cc-cd09-0410-ab3c-d52691b4dbfc
<rdar://problem/13924889> -webView:didPerformClientRedirectFromURL:toURL:inFrame: should be given the redirecting URL as the “from” URL
https://bugs.webkit.org/show_bug.cgi?id=116733

Reviewed by Adele Peterson.

By the time the history controller calls updateGlobalHistoryRedirectLinks(), the document
loader already reflects the destination URL. In order to be able to provide the immediate
source URL to the delegate, we make WebFrame track a URL and provisional URL, updating them
in response to FrameLoader callbacks in exactly the same way WebFrameProxy maintains its
m_url and m_provisionalURL member variables.

* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad): Update
provisionalURL.
(WebFrameLoaderClient::dispatchDidChangeLocationWithinPage): Update url.
(WebFrameLoaderClient::dispatchDidPushStateWithinPage): Ditto.
(WebFrameLoaderClient::dispatchDidReplaceStateWithinPage): Ditto.
(WebFrameLoaderClient::dispatchDidPopStateWithinPage): Ditto.
(WebFrameLoaderClient::dispatchDidStartProvisionalLoad): Update provisionalURL.
(WebFrameLoaderClient::dispatchDidCommitLoad): Update URL and provisionalURL.
(WebFrameLoaderClient::dispatchDidFailProvisionalLoad): Clear provisionalURL.
(WebFrameLoaderClient::dispatchDidFailLoad): Added an assertion.
(WebFrameLoaderClient::dispatchDidFinishLoad): Ditto.
(WebFrameLoaderClient::updateGlobalHistoryRedirectLinks): Pass the last committed URL as the
source, rather than clientRedirectSourceForHistory().
* WebView/WebFrameInternal.h: Added url and provisionalURL ivars to WebFramePrivate.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150688 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebFrameProxy::didFailLoad clears frame title for no apparent reason
https://bugs.webkit.org/show_bug.cgi?id=116655

Patch by Santosh Mahto <santosh.ma@samsung.com> on 2013-05-25
Reviewed by Alexey Proskuryakov.

* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::didFailLoad):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150689 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION: WebProcess is terminated when all Safari windows are closed.
<rdar://problem/13990901>
<http://webkit.org/b/116766>

Reviewed by Alexey Proskuryakov.

When closing the last page, only disconnect the web process if we're using a network process.
Otherwise there might be session state in the web process getting lost.

* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::removeWebPage):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150691 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Move Node::isMouseFocusable() to Element.
<http://webkit.org/b/116762>

Reviewed by Anders Carlsson.

Source/WebCore:

Node::isMouseFocusable() would just return isFocusable(), which is never true for a non-Element
since Node::supportsFocus() always returns false. So move it to Element!

* dom/Node.h:
* dom/Node.cpp:
* dom/Element.h:
* dom/Element.cpp:
(WebCore::Element::isMouseFocusable):

    Moved here from Node.

* editing/FrameSelection.cpp:
(WebCore::FrameSelection::setFocusedNodeIfNeeded):
* page/EventHandler.cpp:
(WebCore::EventHandler::dispatchMouseEvent):

    Walk up the parent chain with parentOrShadowHostElement() instead of parentOrShadowHostNode().
    Removed a misleading no-op hunk about mouse-focusable ShadowRoots, since ShadowRoots are not
    Elements and thus cannot be mouse-focusable.

* page/TouchAdjustment.cpp:
(WebCore::TouchAdjustment::nodeRespondsToTapGesture):

    Check that the Node is an Element before asking if it's mouse-focusable.

* html/HTMLAnchorElement.h:
* html/HTMLAreaElement.h:
* html/HTMLFormControlElement.h:
* html/HTMLInputElement.h:
* html/HTMLMediaElement.h:
* html/HTMLSelectElement.h:
* html/HTMLTextAreaElement.h:
* html/shadow/ClearButtonElement.h:
* html/shadow/TextControlInnerElements.h:
* svg/SVGAElement.h:
* svg/SVGStyledElement.h:

    Sprinkle OVERRIDE.

Source/WebKit2:

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

    Check that the potentially activated Node is an Element before asking if it's mouse-focusable.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150692 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Updated expected results after r150688.

Reviewed by Andreas Kling.

* http/tests/globalhistory/history-delegate-basic-refresh-redirect-expected.txt: Now shows
the URL that performed the client redirect, as expected.



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