Cut down on double hashing and code needlessly using hash table iterators
https://bugs.webkit.org/show_bug.cgi?id=120611

Reviewed by Andreas Kling.

Source/WebCore:

Some of these changes are primarily code cleanup, but others could provide
a small code size and speed improvement by avoiding extra hashing.

* Modules/geolocation/Geolocation.cpp:
(WebCore::Geolocation::Watchers::find): Use get instead of find.
(WebCore::Geolocation::Watchers::remove): Use take instead of find.
(WebCore::Geolocation::makeCachedPositionCallbacks): Use the return
value from remove to avoid hashing twice.

* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::addAutomaticPullNode): Use the return value from
add to avoid hashing twice.
(WebCore::AudioContext::removeAutomaticPullNode): Use the return value
from remove to avoid hashing twice.

* Modules/webaudio/AudioNodeInput.cpp:
(WebCore::AudioNodeInput::connect): Use the return value from add to avoid
hashing twice.
(WebCore::AudioNodeInput::disconnect): Use the return value from remove
to avoid hashing twice.

* Modules/webaudio/AudioParam.cpp:
(WebCore::AudioParam::connect): Use the return value from add to avoid
hashing twice.
(WebCore::AudioParam::disconnect): Use the return value from remove to
avoid hashing twice.

* bridge/NP_jsobject.cpp:
(ObjectMap::remove): Use remove instead of find/remove.

* dom/Node.cpp:
(WebCore::Node::~Node): Use the return value from remove instead of
find/remove.

* inspector/InspectorProfilerAgent.cpp:
(WebCore::InspectorProfilerAgent::removeProfile): Remove needless
calls to contains.

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::removeSubresourceLoader): Use the return
value from remove instead of find/remove.

* loader/ResourceLoadScheduler.cpp:
(WebCore::ResourceLoadScheduler::HostInformation::remove): Use the
return value from remove to avoid hashing twice.

* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::disassociateDocumentLoader): Use
remove instead of find/remove.
(WebCore::ApplicationCacheGroup::cacheDestroyed): Removed a needless
call to contains to avoid hashing twice. It's fine to do the check
for an empty hash table unconditionally.

* page/DOMWindow.cpp:
(WebCore::addUnloadEventListener): Eliminated a local variable for clarity.
(WebCore::removeUnloadEventListener): Ditto. Also use remove instead
of find/remove.
(WebCore::removeAllUnloadEventListeners): Ditto. Also use removeAll instead
of find/removeAll.
(WebCore::addBeforeUnloadEventListener): Ditto.
(WebCore::removeBeforeUnloadEventListener): Ditto.
(WebCore::removeAllBeforeUnloadEventListeners): Ditto.

* page/FrameView.cpp:
(WebCore::FrameView::removeViewportConstrainedObject): Use the return
value from remove to avoid hashing twice.
(WebCore::FrameView::removeScrollableArea): Use the return value from
remove instead of find/remove.
(WebCore::FrameView::containsScrollableArea): Use && instead of an if
statement in a way that is idiomatic for this kind of function.

* page/Page.cpp:
(WebCore::Page::addRelevantRepaintedObject): Use the return value from
remove instead of find/remove.

* page/PageGroup.cpp:
(WebCore::PageGroup::removeUserScriptsFromWorld): Use remove instead
of find/remove.
(WebCore::PageGroup::removeUserStyleSheetsFromWorld): Use the return
value from remove instead of find/remove.

* page/PerformanceUserTiming.cpp:
(WebCore::clearPeformanceEntries): Removed a needless call to contains.

* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::removeClient): Use the return value
from remove instead of find/remove.
(WebCore::DisplayRefreshMonitorManager::displayDidRefresh): Use remove
instead of find/remove.

* platform/graphics/blackberry/LayerRenderer.cpp:
(WebCore::LayerRenderer::removeLayer): Use the return value from remove
instead of find/remove.

* platform/win/WindowMessageBroadcaster.cpp:
(WebCore::WindowMessageBroadcaster::removeListener): Use remove instead
of find/remove. It's fine to do the check for an empty hash table unconditionally.

* plugins/PluginDatabase.cpp:
(WebCore::PluginDatabase::removeDisabledPluginFile): Use the return value
from remove instead of find/remove.

* rendering/style/StyleCustomFilterProgramCache.cpp:
(WebCore::StyleCustomFilterProgramCache::lookup): Use get instead of find.
(WebCore::StyleCustomFilterProgramCache::add): Use contains instead of find
in an assertion.
(WebCore::StyleCustomFilterProgramCache::remove): Use remove instead of
find/remove.

* svg/SVGCursorElement.cpp:
(WebCore::SVGCursorElement::removeClient): Use the return value from remove
instead of find/remove.

* svg/SVGDocumentExtensions.cpp:
(WebCore::SVGDocumentExtensions::removeResource): Removed an unneeded call
to contains.
(WebCore::SVGDocumentExtensions::removeAllTargetReferencesForElement): Use
remove instead of find/remove. It's fine to do the check for an empty hash
table unconditionally.
(WebCore::SVGDocumentExtensions::removeAllElementReferencesForTarget): Use
remove instead of find/remove. Also removed unhelpful assertions. One is
already done by HashMap, and the other is just checking a basic invariant
of every HashMap that doesn't need to be checked.

* svg/graphics/SVGImageCache.cpp:
(WebCore::SVGImageCache::removeClientFromCache): Removed an unneeded call
to contains.

* svg/properties/SVGAnimatedProperty.cpp:
(WebCore::SVGAnimatedProperty::~SVGAnimatedProperty): Use the version of
remove that takes an iterator rather than the one that takes a key, so
we don't need to redo the hashing.

Source/WebKit2:

* Platform/CoreIPC/Connection.cpp:
(CoreIPC::Connection::waitForMessage): Use take instead of find/remove.

* UIProcess/WebPreferences.cpp:
(WebKit::WebPreferences::removePageGroup): Use the return value from remove
instead of find/remove.

* WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
(WebKit::GeolocationPermissionRequestManager::cancelRequestForGeolocation):
(WebKit::GeolocationPermissionRequestManager::didReceiveGeolocationPermissionDecision):
Use take instead of find/remove.

* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::frameDidFinishLoading): Use take instead of find/remove.
(WebKit::NetscapePlugin::frameDidFail): Use take instead of find/remove.

* WebProcess/WebPage/WebBackForwardListProxy.cpp:
(WebKit::WebBackForwardListProxy::removeItem): Use take instead of find/remove.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didFinishCheckingText): Use take instead of get/remove so we
hash only once.
(WebKit::WebPage::didCancelCheckingText): Ditto.
(WebKit::WebPage::stopExtendingIncrementalRenderingSuppression): Use the return
value from remove instead of contains/remove so we hash only once.

Source/WTF:

Double hashing is common in code that needs to combine a remove with some
action to only be done if the code is removed. The only way to avoid it is
to write code using find and a hash table iterator. To help with this, add
a boolean return value to remove functions to indicate if anything was removed.

Double hashing also happens in code that does a get followed by a remove.
The take function is helpful in this case. To help with this, add a takeFirst
funciton to ListHashSet.

* wtf/HashCountedSet.h:
(WTF::HashCountedSet::removeAll): Added a boolean return value, analogous to the one
that the HashCountedSet::remove function already has.

* wtf/HashMap.h:
(WTF::HashMap::remove): Added a boolean return value, true if something was removed.
* wtf/HashSet.h:
(WTF::HashSet::remove): Ditto.
* wtf/RefPtrHashMap.h:
(WTF::RefPtrHashMap::remove): Ditto.

* wtf/ListHashSet.h:
(WTF::ListHashSet::takeFirst): Added.
(WTF::ListHashSet::takeLast): Added.
(WTF::ListHashSet::remove): Added a boolean return value, true if something was removed.

* wtf/WTFThreadData.h:
(JSC::IdentifierTable::remove): Use the new remove return value to get rid of most of
the code in this function.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154967 268f45cc-cd09-0410-ab3c-d52691b4dbfc
* inspector/InspectorProfilerAgent.cpp:
(WebCore::InspectorProfilerAgent::removeProfile): Fix braces here; a review
comment I forgot to address in my last check-in.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154968 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GStreamer] Video player sets system volume to 100%
https://bugs.webkit.org/show_bug.cgi?id=118974

Reviewed by Philippe Normand.

In order to preserve the system volume we need to keep track of
the volume being initialized in the HTMLMediaElement and then just
setting the volume to the sink when initializing the pipeline if
that volume was changed before.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement): Initialized
attribute to false.
(WebCore::HTMLMediaElement::setVolume): Set the attribute to true
when volume is changed.
(WebCore::HTMLMediaElement::updateVolume): Set the volume only if
volume was initialized.
(WebCore::HTMLMediaElement::mediaPlayerPlatformVolumeConfigurationRequired):
Platform volume configuration is required only if volume was not
initialized before.
* html/HTMLMediaElement.h: Added attribute and interface method.
* platform/graphics/MediaPlayer.h:
(WebCore::MediaPlayerClient::mediaPlayerPlatformVolumeConfigurationRequired):
Declared and added default implementation for the interface method.
(WebCore::MediaPlayer::platformVolumeConfigurationRequired):
Asked the client, meaning the HTMLMediaElement if the platform
volume configuration is required.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::mediaPlayerPrivateVolumeChangedCallback): Added log.
(WebCore::MediaPlayerPrivateGStreamerBase::setVolume): Added log.
(WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement):
Set the volume only if not platform volume is required and added log.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154970 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Remove LayerData::LayerProgram
https://bugs.webkit.org/show_bug.cgi?id=120601

Reviewed by Anders Carlsson.

JIRA 490672
All layer contents are RGBA now, so there's no need to support BGRA any
more and the LayerData::LayerProgram enum can be removed. Related dead
code was removed.

No new tests, no change in behavior.

* platform/graphics/blackberry/EGLImageLayerWebKitThread.cpp:
(WebCore::EGLImageLayerWebKitThread::EGLImageLayerWebKitThread):
* platform/graphics/blackberry/LayerData.h:
(WebCore::LayerData::LayerData):
* platform/graphics/blackberry/LayerRenderer.cpp:
(WebCore::LayerRenderer::compositeLayersRecursive):
(WebCore::LayerRenderer::createProgram):
* platform/graphics/blackberry/LayerRenderer.h:
* platform/graphics/blackberry/LayerWebKitThread.h:
* platform/graphics/blackberry/PluginLayerWebKitThread.cpp:
(WebCore::PluginLayerWebKitThread::setPluginView):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154971 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] libsoup upversion to fix a gstreamer issue, bug115354
https://bugs.webkit.org/show_bug.cgi?id=120613

Reviewed by Philippe Normand.

Up version of libsoup to 2.43.90. But the exact version which we'll use is not 2.43.90.
To fix bug115354, we need the Andre's patch for libsoup, but the lastest release
does not contain it. https://bugzilla.gnome.org/show_bug.cgi?id=706338
For the reason, we'll use libsoup git repo directly for a while until the next
libsoup release.

* gtk/jhbuild.modules:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154972 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Regions] position: fixed is computed relative to the first region, not the viewport
https://bugs.webkit.org/show_bug.cgi?id=111176

Reviewed by David Hyatt.

Source/WebCore:

Fixed positioned elements inside a named flow should be positioned and sized relative to the viewport,
not on the first region, as described in the spec: http://dev.w3.org/csswg/css-regions/#the-flow-into-property.
While the flow thread will still act as containing block for the fixed positioned elements, the painting and hit
testing for the fixed positioned elements is done by RenderView. The layers for the fixed positioned elements
are collected by the flow thread.

Tests: fast/regions/element-in-named-flow-absolute-from-fixed.html
       fast/regions/element-in-named-flow-fixed-from-absolute.html
       fast/regions/element-inflow-fixed-from-outflow-static.html
       fast/regions/element-outflow-static-from-inflow-fixed.html
       fast/regions/fixed-element-transformed-parent.html
       fast/regions/fixed-in-named-flow-scroll.html
       fast/regions/fixed-inside-fixed-in-named-flow.html
       fast/regions/fixed-inside-named-flow-zIndex.html
       fast/regions/fixed-pos-elem-in-namedflow-noregions.html
       fast/regions/fixed-pos-region-in-nested-flow.html

* rendering/FlowThreadController.cpp:
(WebCore::FlowThreadController::collectFixedPositionedLayers):
Return the list of layers for the fixed positioned elements with named flows as containing blocks.
Used in RenderLayer:: paintFixedLayersInNamedFlows and RenderLayer:: hitTestFixedLayersInNamedFlows.
* rendering/FlowThreadController.h:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::mapLocalToContainer):
(WebCore::RenderBox::containingBlockLogicalWidthForPositioned):
(WebCore::RenderBox::containingBlockLogicalHeightForPositioned):
For fixed positioned elements, width and height are given by the view instead of the first region.
* rendering/RenderLayer.cpp:
(WebCore::accumulateOffsetTowardsAncestor):
Modified for the fixed positioned elements inside named flows with the named flows as containing block
to take into account the view scroll.
(WebCore::compareZIndex):
Moved upwards because it is used in RenderLayer::paintFixedLayersInNamedFlows.
(WebCore::RenderLayer::paintFixedLayersInNamedFlows):
Paint the list of fixed layers directly from the RenderView instead of painting them through regions -> named flows.
(WebCore::RenderLayer::paintLayerContents):
(WebCore::RenderLayer::paintList):
(WebCore::RenderLayer::hitTestFixedLayersInNamedFlows):
Hit test the layers for the fix positioned elements inside named flows from the RenderView layer
instead of the region -> named flow layer.
(WebCore::RenderLayer::hitTestLayer):
(WebCore::RenderLayer::calculateRects):
* rendering/RenderLayer.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateLayerTreeGeometry):
We do not support yet the accelerated compositing for elements in named flows,
so bail out early here. We need to revisit fixed elements once we finish accelerated compositing for elements in named flows.
* rendering/RenderObject.cpp:
(WebCore::RenderObject::fixedPositionedWithNamedFlowContainingBlock):
(WebCore::hasFixedPosInNamedFlowContainingBlock):
(WebCore::RenderObject::containerForRepaint):
Changed to take into account that RenderView should be the repaintContainer for the
fixed positioned elements with named flow as the containing block.
* rendering/RenderObject.h:

LayoutTests:

Added new tests and changed the existing ones that were relying on incorrect positioning
for fixed elements.

* fast/regions/element-in-named-flow-absolute-from-fixed-expected.txt: Added.
* fast/regions/element-in-named-flow-absolute-from-fixed.html: Added.
* fast/regions/element-in-named-flow-fixed-from-absolute-expected.txt: Added.
* fast/regions/element-in-named-flow-fixed-from-absolute.html: Added.
* fast/regions/element-inflow-fixed-from-outflow-static-expected.txt: Added.
* fast/regions/element-inflow-fixed-from-outflow-static.html: Added.
* fast/regions/element-outflow-static-from-inflow-fixed-expected.txt: Added.
* fast/regions/element-outflow-static-from-inflow-fixed.html: Added.
* fast/regions/fixed-element-transformed-parent-expected.txt: Added.
* fast/regions/fixed-element-transformed-parent.html: Added.
* fast/regions/fixed-in-named-flow-scroll-expected.txt: Added.
* fast/regions/fixed-in-named-flow-scroll.html: Added.
* fast/regions/fixed-inside-fixed-in-named-flow-expected.html: Added.
* fast/regions/fixed-inside-fixed-in-named-flow.html: Added.
* fast/regions/fixed-inside-named-flow-zIndex-expected.html: Added.
* fast/regions/fixed-inside-named-flow-zIndex.html: Added.
* fast/regions/fixed-pos-elem-in-namedflow-noregions-expected.html: Added.
* fast/regions/fixed-pos-elem-in-namedflow-noregions.html: Added.
* fast/regions/fixed-pos-elem-in-region-expected.html:
* fast/regions/fixed-pos-elem-in-region.html:
* fast/regions/fixed-pos-region-in-nested-flow-expected.html: Added.
* fast/regions/fixed-pos-region-in-nested-flow.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154973 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt][WK1] PageVisibility tests are flaky
https://bugs.webkit.org/show_bug.cgi?id=120418

Reviewed by Jocelyn Turcotte.

Source/WebKit/qt:

* WebCoreSupport/DumpRenderTreeSupportQt.cpp:
(DumpRenderTreeSupportQt::resetPageVisibility):
* WebCoreSupport/DumpRenderTreeSupportQt.h:

Tools:

Implement resetPageVisibility so we can reset visibility without
emiting visibility state change events.

* DumpRenderTree/qt/TestRunnerQt.cpp:
(TestRunner::resetPageVisibility):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154974 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] Remove dead code for QtXmlPatterns
https://bugs.webkit.org/show_bug.cgi?id=120624

Reviewed by Simon Hausmann.

Remove code supporting XSLT using QtXmlPatterns which has been
dead for some time.

* Target.pri:
* WebCore.pri:
* dom/TransformSourceQt.cpp: Removed.
* xml/XSLStyleSheetQt.cpp: Removed.
* xml/XSLTProcessorQt.cpp: Removed.
* xml/parser/XMLDocumentParserQt.cpp:
(WebCore::XMLDocumentParser::doEnd):
(WebCore::XMLDocumentParser::parseProcessingInstruction):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore: [AX][ATK] Added support for sort and help attributes.
https://bugs.webkit.org/show_bug.cgi?id=120456

Patch by Krzysztof Czech <k.czech@samsung.com> on 2013-09-03
Reviewed by Chris Fleizach.

Added support for aria-sort and aria-help attributes.

Test: accessibility/aria-sort.html

* accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
(webkitAccessibleGetAttributes):

Tools: [AX][ATK] Added support for sort and help attributes
https://bugs.webkit.org/show_bug.cgi?id=120456

Patch by Krzysztof Czech <k.czech@samsung.com> on 2013-09-03
Reviewed by Chris Fleizach.

Added missing implementation to AccessibilityUIElement::helpText and support for
aria-sort attribute.

* DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:
(coreAttributeToAtkAttribute):
* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::coreAttributeToAtkAttribute):
(WTR::AccessibilityUIElement::helpText):

LayoutTests: [AX][ATK] Added support for sort and help attributes
https://bugs.webkit.org/show_bug.cgi?id=120456

Patch by Krzysztof Czech <k.czech@samsung.com> on 2013-09-03
Reviewed by Chris Fleizach.

Sharing aria-sort.html specific mac test with efl and gtk.
Changing specific expectations of some accessibility tests.

* accessibility/aria-sort-expected.txt: Renamed from LayoutTests/platform/mac/accessibility/aria-sort-expected.txt.
* accessibility/aria-sort.html: Renamed from LayoutTests/platform/mac/accessibility/aria-sort.html.
* platform/efl-wk2/TestExpectations:
* platform/efl-wk2/accessibility/image-link-expected.txt:
* platform/efl-wk2/accessibility/image-map2-expected.txt:
* platform/efl-wk2/accessibility/table-cell-spans-expected.txt:
* platform/efl-wk2/accessibility/table-cells-expected.txt:
* platform/gtk/accessibility/image-link-expected.txt:
* platform/gtk/accessibility/image-map2-expected.txt:
* platform/gtk/accessibility/table-cell-spans-expected.txt:
* platform/gtk/accessibility/table-cells-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154976 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[gstreamer] Disable HTTP request "Accept-Encoding:" header field on gstreamer source element to avoid receiving the wrong size when retrieving data
https://bugs.webkit.org/show_bug.cgi?id=115354

Patch by Andre Moreira Magalhaes <andre.magalhaes@collabora.co.uk> on 2013-09-03
Reviewed by Philippe Normand.

Source/WebCore:

Also disable Accept-Encoding on ResourceRequest::toSoupMessage accordingly.

* platform/network/soup/ResourceRequestSoup.cpp:
(WebCore::ResourceRequest::toSoupMessage):
Call ResourceRequest::updateSoupMessage from ResourceRequest::toSoupMessage so that the
Accept-Encoding header is also respected.

LayoutTests:

Add test to check that video requests will send no "Accept-Encoding" header.

* http/tests/media/video-accept-encoding-expected.txt: Added.
* http/tests/media/video-accept-encoding.cgi: Added.
* http/tests/media/video-accept-encoding.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154977 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CMake] Fix detection of x86_64 platform with MSVC
https://bugs.webkit.org/show_bug.cgi?id=116662

Reviewed by Gyuyoung Kim.

Use ${MSVC_CXX_ARCHITECTURE_ID} instead of ${CMAKE_SYSTEM_PROCESSOR}, since
the later one just resolves to the host processor on Windows.

* CMakeLists.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154978 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL] accessibility/aria-describedby-on-input.html is failing
https://bugs.webkit.org/show_bug.cgi?id=112027

Unreviewed EFL gardening.

accessibility/aria-describedby-on-input.html passes after r154976.

Patch by Krzysztof Czech <k.czech@samsung.com> on 2013-09-03

* platform/efl-wk2/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154979 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] Unreviewed gardening. Skip some failing tests.

* platform/qt-wk1/TestExpectations:
* platform/qt/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154980 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION(r154967): http appcache tests crashing on WK1
https://bugs.webkit.org/show_bug.cgi?id=120620

Reviewed by Andreas Kling.

* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::cacheDestroyed): Reintroduce pre-r154967 behavior that returned early in
this method if the passed-in ApplicationCache object was not found in the ApplicationCacheGroup's HashSet
of all the caches. This is now done by checking that the HashSet<T>::remove(T) returns true (meaning the
object was found in the HashSet and removed from it) in addition to that HashSet being subsequently empty
before the method moves on to destroying its ApplicationCacheGroup instance.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154981 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSSRegions] Pseudo-elements as regions should not be exposed to JS
https://bugs.webkit.org/show_bug.cgi?id=120633

Reviewed by Andreas Kling.

Source/WebCore:

Until we properly implement the Region interface (http://dev.w3.org/csswg/css-regions/#the-region-interface)
for pseudo-elements, we should not return these as regions in JS.

Tests: fast/regions/get-regions-by-content-pseudo.html
       fast/regions/webkit-named-flow-get-regions-pseudo.html

* dom/WebKitNamedFlow.cpp:
(WebCore::WebKitNamedFlow::firstEmptyRegionIndex): Skip pseudo-elements as regions here too,
otherwise we may get an index that cannot be used with getRegions().
(WebCore::WebKitNamedFlow::getRegionsByContent):
(WebCore::WebKitNamedFlow::getRegions):

LayoutTests:

Add tests with pseudo-elements as regions checking the following API:
WebKitNamedFlow::getRegions(), WebKitNamedFlow::getRegionsByContent()
Because we do not return the pseudo-elements as regions in the region list,
i modified WebKitNamedFlow::firstEmptyRegionIndex to skip these regions too.

* fast/regions/get-regions-by-content-pseudo-expected.txt: Added.
* fast/regions/get-regions-by-content-pseudo.html: Added.
* fast/regions/webkit-named-flow-get-regions-pseudo-expected.txt: Added.
* fast/regions/webkit-named-flow-get-regions-pseudo.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154982 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] Tiled-backing store not clipped to frame or visible rect
https://bugs.webkit.org/show_bug.cgi?id=120606

Reviewed by Jocelyn Turcotte.

Clip painting from the tiled-backing store to the frame rect.

* WebCoreSupport/QWebFrameAdapter.cpp:
(QWebFrameAdapter::renderFromTiledBackingStore):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154983 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WinCairo] Unneeded code in method GlyphPage::fill().
https://bugs.webkit.org/show_bug.cgi?id=120634

Patch by peavo@outlook.com <peavo@outlook.com> on 2013-09-03
Reviewed by Andreas Kling.

* platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp:
(WebCore::GlyphPage::fill): Remove unneeded call to GetTextMetrics() function.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154984 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] Images scaled poorly on composited canvas
https://bugs.webkit.org/show_bug.cgi?id=120632

Reviewed by Jocelyn Turcotte.

Explicitly set a imageInterpolationQuality on the TextureMapper, because
InterpolationDefault may be interpreted differently by nested GraphicsContexts.

* WebCoreSupport/TextureMapperLayerClientQt.cpp:
(TextureMapperLayerClientQt::renderCompositedLayers):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154985 268f45cc-cd09-0410-ab3c-d52691b4dbfc
CodeBlock::jettison() should be implicit
https://bugs.webkit.org/show_bug.cgi?id=120567

Reviewed by Oliver Hunt.
        
This is a risky change from a performance standpoint, but I believe it's
necessary. This makes all CodeBlocks get swept by GC. Nobody but the GC
can delete CodeBlocks because the GC always holds a reference to them.
Once a CodeBlock reaches just one reference (i.e. the one from the GC)
then the GC will free it only if it's not on the stack.
        
This allows me to get rid of the jettisoning logic. We need this for FTL
tier-up. Well; we don't need it, but it will help prevent a lot of bugs.
Previously, if you wanted to to replace one code block with another, you
had to remember to tell the GC that the previous code block is
"jettisoned". We would need to do this when tiering up from DFG to FTL
and when dealing with DFG-to-FTL OSR entry code blocks. There are a lot
of permutations here - tiering up to the FTL, OSR entering into the FTL,
deciding that an OSR entry code block is not relevant anymore - just to
name a few. In each of these cases we'd have to jettison the previous
code block. It smells like a huge source of future bugs.
        
So I made jettisoning implicit by making the GC always watch out for a
CodeBlock being owned solely by the GC.
        
This change is performance neutral.

* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::CodeBlock):
(JSC::CodeBlock::~CodeBlock):
(JSC::CodeBlock::visitAggregate):
(JSC::CodeBlock::jettison):
* bytecode/CodeBlock.h:
(JSC::CodeBlock::setJITCode):
(JSC::CodeBlock::shouldImmediatelyAssumeLivenessDuringScan):
(JSC::CodeBlockSet::mark):
* dfg/DFGCommonData.h:
(JSC::DFG::CommonData::CommonData):
* heap/CodeBlockSet.cpp: Added.
(JSC::CodeBlockSet::CodeBlockSet):
(JSC::CodeBlockSet::~CodeBlockSet):
(JSC::CodeBlockSet::add):
(JSC::CodeBlockSet::clearMarks):
(JSC::CodeBlockSet::deleteUnmarkedAndUnreferenced):
(JSC::CodeBlockSet::traceMarked):
* heap/CodeBlockSet.h: Added.
* heap/ConservativeRoots.cpp:
(JSC::ConservativeRoots::add):
* heap/ConservativeRoots.h:
* heap/DFGCodeBlocks.cpp: Removed.
* heap/DFGCodeBlocks.h: Removed.
* heap/Heap.cpp:
(JSC::Heap::markRoots):
(JSC::Heap::deleteAllCompiledCode):
(JSC::Heap::deleteUnmarkedCompiledCode):
* heap/Heap.h:
* interpreter/JSStack.cpp:
(JSC::JSStack::gatherConservativeRoots):
* interpreter/JSStack.h:
* runtime/Executable.cpp:
(JSC::ScriptExecutable::installCode):
* runtime/Executable.h:
* runtime/VM.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] [WK2] TestContextMenu default-menu fails
https://bugs.webkit.org/show_bug.cgi?id=120459

Patch by Brian Holt <brian.holt@samsung.com> on 2013-09-03
Reviewed by Gustavo Noronha Silva.

Add context menu items for downloading media elements.

* UIProcess/API/gtk/WebKitContextMenuActions.cpp:
(webkitContextMenuActionGetActionTag):
(webkitContextMenuActionGetForContextMenuItem):
(webkitContextMenuActionGetLabel):
* UIProcess/API/gtk/WebKitContextMenuActions.h:
* UIProcess/API/gtk/tests/TestContextMenu.cpp:

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