Move seamless stylesheet collecting to DocumentStyleSheetCollection
https://bugs.webkit.org/show_bug.cgi?id=100655

Reviewed by Andreas Kling.

Move the code from StyleResolver to DocumentStyleSheetCollection. StyleResolver should focus on resolving style.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::StyleResolver):
        
    Use standard create() pattern.

(WebCore):
* css/StyleResolver.h:
(StyleResolver):
* dom/Document.cpp:
(WebCore::Document::Document):
* dom/DocumentStyleSheetCollection.cpp:
(WebCore::collectActiveCSSStyleSheetsFromSeamlessParents):
        
    Since parent activeAuthorStyleSheets() contains all seamlessly inherited sheets too, this does not need to
    iterate to ancestors anymore.

(WebCore):
(WebCore::DocumentStyleSheetCollection::updateActiveStyleSheets):
* dom/DocumentStyleSheetCollection.h:
(WebCore::DocumentStyleSheetCollection::create):
(DocumentStyleSheetCollection):
(WebCore::DocumentStyleSheetCollection::styleSheetsForStyleSheetList):
(WebCore::DocumentStyleSheetCollection::activeAuthorStyleSheets):
        
    activeAuthorStyleSheets() now includes the stylesheets inherited from the seamless parent too.

(WebCore::DocumentStyleSheetCollection::needsUpdateActiveStylesheetsOnStyleRecalc):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132787 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Timeline: make cpu-monitoring feature available only on capable browsers
https://bugs.webkit.org/show_bug.cgi?id=100530

Patch by Eugene Klyuchnikov <eustas.bug@gmail.com> on 2012-10-29
Reviewed by Yury Semikhatsky.

Motivation: cpu-monitoring feature looks like a glitch,
when it is not supported by browser.

Source/WebCore:

* inspector/Inspector.json: Added capability getter to protocol.
* inspector/InspectorClient.h: Added capability getter.
* inspector/InspectorTimelineAgent.cpp: Proxy to request to client.
* inspector/InspectorTimelineAgent.h: Added capability getter.
* inspector/front-end/Settings.js: Added capability field.
* inspector/front-end/TimelinePanel.js: Check capability.
* inspector/front-end/inspector.js: Forward capability value.

Source/WebKit/chromium:

* src/InspectorClientImpl.cpp: Implemented capability getter.
* src/InspectorClientImpl.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132788 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Timeline: Overview bars do not correspond to timeline bars
https://bugs.webkit.org/show_bug.cgi?id=100500

Patch by Eugene Klyuchnikov <eustas.bug@gmail.com> on 2012-10-29
Reviewed by Yury Semikhatsky.

Fix: do not shorten bars by nested records of the same category.

* inspector/front-end/TimelineOverviewPane.js: Check added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Fix vertical alignment in toolbar backgrounds and overflow button.
https://bugs.webkit.org/show_bug.cgi?id=100373

Patch by Patrick Dubroy <dubroy@chromium.org> on 2012-10-29
Reviewed by Pavel Feldman.

Fix the background image for the selected toolbar item to be vertically centered.
Make close button and toolbar overflow button vertically centered for any toolbar
height.

* inspector/front-end/Toolbar.js: Remove unused variable.
* inspector/front-end/inspector.css:
(.toolbar-item.toggleable):
(body.compact .toolbar-item.toggleable):
(.toolbar-item.toggleable.toggled-on):
(body.compact .toolbar-label):
(#toolbar-dropdown-arrow):
(#close-button-left, #close-button-right):
(.toolbar-item.close-left):
* inspector/front-end/inspector.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132790 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Refactoring] Use isActiveInsertionPoint() instead of isInsertionPoint()
https://bugs.webkit.org/show_bug.cgi?id=100459

Reviewed by Hajime Morita.

Checking InsertionPoint and its activeness with two if-statement is error-prone. We would like to
use a utility function which checks both at once.

We rewrite some lines with such function.

No new tests, simple refactoring.

* dom/ComposedShadowTreeWalker.cpp:
(WebCore::ComposedShadowTreeWalker::traverseNode):
* html/shadow/ContentDistributor.cpp:
(WebCore::ContentDistributor::populate):
(WebCore::ContentDistributor::distribute):
(WebCore::ContentDistributor::distributeNodeChildrenTo):
* html/shadow/InsertionPoint.h:
(WebCore::isInsertionPoint): Since our convention is the argument of this kind of function should not be null,
we would like to make it similar to the other functions.
(WebCore::toInsertionPoint):
(WebCore::isLowerEncapsulationBoundary):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132791 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Fix a build error
https://bugs.webkit.org/show_bug.cgi?id=100649

Patch by Robin Cao <robin.cao@torchmobile.com.cn> on 2012-10-29
Reviewed by Kentaro Hara.

r127876 changed the signature of WebCore::EventHandler::hitTestResultAtPoint()
and this commit was later reverted. We need to update a call site in the
BlackBerry port to make it build.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::hitTestResult):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132792 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Error/warning count is one pixel off.
https://bugs.webkit.org/show_bug.cgi?id=100660

Reviewed by Pavel Feldman.

The error/warning count div had a top padding of 6. That was one pixel
too many.

* inspector/front-end/inspector.css:
(#error-warning-count):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132793 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Drag and drop a URL in inspector is not working as expected
https://bugs.webkit.org/show_bug.cgi?id=100527

Reviewed by Yury Semikhatsky.

Inhibit custom dragstart handling when the active element is A.

* inspector/front-end/ElementsTreeOutline.js:
(WebInspector.ElementsTreeOutline.prototype._ondragstart):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132794 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Shaders] Implement CustomFilterArrayParameter::blend
https://bugs.webkit.org/show_bug.cgi?id=96437

Reviewed by Dean Jackson.

Source/WebCore:

This patch adds the missing code to blend values within
an array() when using Custom Filters.

Test: css3/filters/custom/custom-filter-array-blending.html

* platform/graphics/filters/CustomFilterArrayParameter.h:
(WebCore::CustomFilterArrayParameter::blend):

LayoutTests:

New tests to asses the correctness of CustomFilterArrayParameter::blend.

* animations/resources/animation-test-helpers.js:
(customFilterParameterMatch): A check for functions' parameters length has been added.
* css3/filters/custom/custom-filter-array-blending-expected.txt: Added.
* css3/filters/custom/custom-filter-array-blending.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132795 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL][WK2] REGRESSION(r132342): fast/events/frame-tab-focus.html fails
https://bugs.webkit.org/show_bug.cgi?id=100646

Reviewed by Kenneth Rohde Christiansen.

Tools: 

* WebKitTestRunner/efl/PlatformWebViewEfl.cpp:
(WTR::PlatformWebView::focus): Improve the check we perform to
decide whether the focus should be taken out of the view before
focusing it again so that we do not unnecessarily unfocus it and
cause blur/focus events to be triggered. Instead of just verifying
if the Evas_Object representing the view has focus, use the WK C
API to check that the currently focused frame is not the main
frame.

LayoutTests: 

* platform/efl-wk2/TestExpectations: Unskip
fast/events/frame-tab-focus.html.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132796 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Toolbar overflow appears outside window
https://bugs.webkit.org/show_bug.cgi?id=100663

Patch by Patrick Dubroy <dubroy@chromium.org> on 2012-10-29
Reviewed by Pavel Feldman.

Since the search bar was removed from the toolbar, the overflow menu appears too far
to the right, and is unreadable. Fixed this by aligning it relative to the right side
of the window, rather than the left.

* inspector/front-end/Toolbar.js:
(WebInspector.ToolbarDropdown.prototype.show):
* inspector/front-end/inspector.css:
(#toolbar-dropdown .toolbar-label):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132797 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[TexMap] Make GraphicsLayerAnimation choose a proper timing function.
https://bugs.webkit.org/show_bug.cgi?id=100623

Patch by Huang Dongsung <luxtella@company100.net> on 2012-10-29
Reviewed by Noam Rosenthal.

Currently, GraphicsLayerAnimation chooses a timing function in the wrong
way. Other GraphicsLayers choose a timing function in the similar way to
GraphicsLayerCA::timingFunctionForAnimationValue(). The way consists of
the following steps.
1. Try to query the timing function of the current keyframe animation value.
2. If the timing function of #1 is null, try to query the timing function of Animation.
3. If the timing function of #2 is null, return CubicBezierTimingFunction::defaultTimingFunction().

This patch makes GraphicsLayerAnimation choose a timing function in the same way
to other implementations.

Covered by existing animations tests.

* platform/graphics/GraphicsLayerAnimation.cpp:
(WebCore::timingFunctionForAnimationValue):
(WebCore::GraphicsLayerAnimation::apply):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132798 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL][AC] Fix bugs preventing us from running layout tests with AC turned on
https://bugs.webkit.org/show_bug.cgi?id=100598

Patch by Yael Aharon <yael.aharon@intel.com> on 2012-10-29
Reviewed by Kenneth Rohde Christiansen.

Make sure to use opengl_x11 engine when AC is turned on and X11 is in use.
We cannot create a gl context otherwise.

* MiniBrowser/efl/main.c:
(elm_main):
* WebKitTestRunner/efl/PlatformWebViewEfl.cpp:
(WTR::initEcoreEvas):
* DumpRenderTree/efl/DumpRenderTree.cpp:
(initEcoreEvas):
* EWebLauncher/efl/main.c:
(windowCreate):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132799 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL][WK2] Avoid useless assignment in EwkViewImpl::setCustomTextEncodingName()
https://bugs.webkit.org/show_bug.cgi?id=100667

Patch by Christophe Dumez <christophe.dumez@intel.com> on 2012-10-29
Reviewed by Kenneth Rohde Christiansen.

Remove useless m_customEncoding assignment in EwkViewImpl::setCustomTextEncodingName()
since the member is anyway assigned in EwkViewImpl::customTextEncodingName().

Have EwkViewImpl::setCustomTextEncodingName() take a String in argument instead
of a const char* to make the API more C++ and since we don't need a const char*
to assign to m_customEncoding anymore.

* UIProcess/API/efl/EwkViewImpl.cpp:
(EwkViewImpl::setCustomTextEncodingName):
* UIProcess/API/efl/EwkViewImpl.h:
(EwkViewImpl):
* UIProcess/API/efl/ewk_view.cpp:
(ewk_view_setting_encoding_custom_set):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132800 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Coordinated Graphics: Make sure that we release images immediately when purging resources
https://bugs.webkit.org/show_bug.cgi?id=100661

Reviewed by Noam Rosenthal.

When we purge, we do both on the UI and web process at the same time,
both are expected to release references of the other process.
This creates problem when delaying the release of directly composited
images.

Release them immediately in that case.

Fixes the tst_QQuickWebView::removeFromCanvas API test.

* WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp:
(WebKit::LayerTreeCoordinator::flushPendingLayerChanges):
(WebKit::LayerTreeCoordinator::purgeReleasedImages):
(WebKit):
(WebKit::LayerTreeCoordinator::purgeBackingStores):
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h:
(LayerTreeCoordinator):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132801 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] Text with zero font size renders as X px sometimes, causing fast/text/zero-font-size-2.html to fail
https://bugs.webkit.org/show_bug.cgi?id=100115

Reviewed by Noam Rosenthal.

Source/WebCore:

* platform/graphics/qt/FontQt.cpp:
(WebCore::Font::drawGlyphs):

LayoutTests:

* platform/qt/TestExpectations: Unskip fast/text/zero-font-size-2.html.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132802 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL][WK2] Fix cursor change detection in EwkViewImpl::setCursor()
https://bugs.webkit.org/show_bug.cgi?id=100662

Patch by Christophe Dumez <christophe.dumez@intel.com> on 2012-10-29
Reviewed by Kenneth Rohde Christiansen.

Cursor change detection in EwkViewImpl::setCursor() relies on
addresses returned by Cursor::platformCursor(). However, the
value returned is currently assigned to a WKEinaSharedString
instead of a raw pointer. Therefore, the address is always
different and we keep recreating Evas Objects for the same
cursor.

* UIProcess/API/efl/EwkViewImpl.cpp:
(EwkViewImpl::EwkViewImpl):
(EwkViewImpl::setCursor): Call smartData() after same cursor
detection since it is not needed if the cursor has not changed
and it may affect performance.
* UIProcess/API/efl/EwkViewImpl.h:
(EwkViewImpl):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132803 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WK2][WKTR] Enable Shadow DOM at runtime if compiled with SHADOW_DOM support
https://bugs.webkit.org/show_bug.cgi?id=100668

Patch by Christophe Dumez <christophe.dumez@intel.com> on 2012-10-29
Reviewed by Kenneth Rohde Christiansen.

Source/WebKit2:

Add Bundle API to enable Shadow DOM functionality. This is
now needed by WebKitTestRunner.

* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleSetShadowDOMEnabled):
* WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::setShadowDOMEnabled):
(WebKit):
* WebProcess/InjectedBundle/InjectedBundle.h:
(InjectedBundle):

Tools:

Enable Shadow DOM functionality at run time in WebKitTestRunner
if compiled with SHADOW_DOM flag set. This is needed to run
the Shadow DOM layout tests.

* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::beginTesting):

LayoutTests:

Remove Shadow DOM layout tests from the global wk2 TestExpectations
and add it to the mac-wk2 one. EFL and GTK ports have Shadow DOM
enabled so they don't need to be skipped for those ports. The Qt port
is already skipping those tests in its global TestExpectations file.

* platform/efl-wk2/TestExpectations:
* platform/mac-wk2/TestExpectations:
* platform/wk2/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132804 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Typo in WebPagePrivate::postponeDocumentRecalcStyle()
https://bugs.webkit.org/show_bug.cgi?id=100377

Patch by Mike Lattanzio <mlattanzio@rim.com> on 2012-10-29
Reviewed by Adam Treat.

Should be void, not bool.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::postponeDocumentStyleRecalc):
* Api/WebPage_p.h:
(WebPagePrivate):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132805 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Try to fix 32-bit builds after my incompletely tested m_identifier change.

Not reviewed.

* loader/ResourceLoader.h:
(WebCore::ResourceLoader::identifier): Revert my "unsigned long" -> "uint64_t" change in two places.

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