[EFL] Memory leak in RenderThemeEfl
https://bugs.webkit.org/show_bug.cgi?id=86609

Patch by Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> on 2012-05-16
Reviewed by Martin Robinson.

Fix a memory leak by freeing the cairo surface with
cairo_surface_destroy.

* platform/efl/RenderThemeEfl.cpp:
(WebCore::RenderThemeEfl::cacheThemePartFlush):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL] Rounding errors on 32-bit machines causes tests to fail
https://bugs.webkit.org/show_bug.cgi?id=86194

Patch by Christophe Dumez <christophe.dumez@intel.com> on 2012-05-16
Reviewed by Martin Robinson.

Pass additional CXXFLAGS to CMake in an attempt to harmonize floating
point values between 32-bit and 64-bit architectures.
Same flags are already used by Qt and GTK ports.

* Scripts/webkitdirs.pm:
(determineArchitecture):
(generateBuildSystemFromCMakeProject):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117298 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Support script snippets saving.
https://bugs.webkit.org/show_bug.cgi?id=86632

Reviewed by Pavel Feldman.

Source/WebCore:

Added SnippetJavaScriptSource extending JavaScriptSource and overriding isEditable() and commitWorkingCopy() methods.
ScriptSnippetModel now creates instances of this new class for snippets.
Also maps in ScriptSnippetModel simplified.

* inspector/front-end/JavaScriptSource.js:
(WebInspector.JavaScriptSource.prototype.commitWorkingCopy):
(WebInspector):
* inspector/front-end/JavaScriptSourceFrame.js:
(WebInspector.JavaScriptSourceFrame.prototype.commitEditing):
* inspector/front-end/ScriptSnippetModel.js:
(WebInspector.ScriptSnippetModel):
(WebInspector.ScriptSnippetModel.prototype._addScriptSnippet):
(WebInspector.ScriptSnippetModel.prototype.deleteScriptSnippet):
(WebInspector.ScriptSnippetModel.prototype.renameScriptSnippet):
(WebInspector.ScriptSnippetModel.prototype.setScriptSnippetContent):
(WebInspector.ScriptSnippetModel.prototype._uiSourceCodeList):
(WebInspector.ScriptSnippetModel.prototype._releasedUISourceCodes):
(WebInspector.SnippetJavaScriptSource):
(WebInspector.SnippetJavaScriptSource.prototype.isEditable):
(WebInspector.SnippetJavaScriptSource.prototype.commitWorkingCopy):
(WebInspector.SnippetJavaScriptSource.prototype.get snippetId):
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype.set _fileRenamed):
(WebInspector.ScriptsPanel.prototype._snippetCreationRequested.callback):
(WebInspector.ScriptsPanel.prototype._snippetCreationRequested):

LayoutTests:

* inspector/debugger/script-snippet-model.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117299 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Double Clicking on "No watch expressions" should add an expression
https://bugs.webkit.org/show_bug.cgi?id=86631

Reviewed by Vsevolod Vlasov.

A double-click listener for the section element adds a new watch expression if the correct element
has been clicked.
Drive-by: do not persist deleted (null) watch expressions.

* inspector/front-end/WatchExpressionsSidebarPane.js:
(WebInspector.WatchExpressionsSection.prototype._sectionDoubleClick):
(WebInspector.WatchExpressionsSection.prototype.updateExpression):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=86638
Bump the version number on the WKBundlePageLoaderClient

Reviewed by Dan Bernstein.

* WebProcess/InjectedBundle/API/c/WKBundlePage.h: s/1/2/
* Shared/APIClientTraits.cpp: Update client traits for the BundlePageLoaderClient
* Shared/APIClientTraits.h: Update client traits for the BundlePageLoaderClient

* ChangeLog: Change a confusing ChangeLog entry to reflect the actual client that was changed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117301 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: extract CompositeUISourceCodeProvider from DebuggerScriptMapping.
https://bugs.webkit.org/show_bug.cgi?id=86634

Reviewed by Vsevolod Vlasov.

Source/WebCore:

Extract refactoring.

* inspector/front-end/DebuggerScriptMapping.js:
(WebInspector.DebuggerScriptMapping):
(WebInspector.DebuggerScriptMapping.prototype.uiSourceCodeProviders):
(WebInspector.DebuggerScriptMapping.prototype._parsedScriptSource):
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype._loadUISourceCodes):
(WebInspector.ScriptsPanel.prototype._toggleFormatSource):
(WebInspector.CompositeUISourceCodeProvider):
(WebInspector.CompositeUISourceCodeProvider.prototype._registerUISourceCodeProvider):
(WebInspector.CompositeUISourceCodeProvider.prototype._handleUISourceCodeAdded):
(WebInspector.CompositeUISourceCodeProvider.prototype._handleUISourceCodeReplaced):
(WebInspector.CompositeUISourceCodeProvider.prototype._handleUISourceCodeRemoved):
(WebInspector.CompositeUISourceCodeProvider.prototype.uiSourceCodes):
* inspector/front-end/UISourceCode.js:
(WebInspector.UISourceCodeProvider.prototype.uiSourceCodes):
(WebInspector.UISourceCodeProvider.prototype.addEventListener):
(WebInspector.UISourceCodeProvider.prototype.removeEventListener):

LayoutTests:

* http/tests/inspector/compiler-script-mapping.html:
* http/tests/inspector/debugger-test.js:
(initialize_DebuggerTest):
* inspector/debugger/linkifier.html:
* inspector/debugger/scripts-panel.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117302 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=86643
http/tests/security/contentSecurityPolicy/script-src-redirect.html fails on Mac bots

* platform/mac/Skipped: Add to skipped list while Oliver and Michael are exploring it.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117303 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Missing RenderApplet cast check in HTMLAppletElement::renderWidgetForJSBindings.
https://bugs.webkit.org/show_bug.cgi?id=86627

Reviewed by Andreas Kling.

Source/WebCore:

Test: java/inline-applet-crash.html

* html/HTMLAppletElement.cpp:
(WebCore::HTMLAppletElement::renderWidgetForJSBindings):

LayoutTests:

* java/inline-applet-crash-expected.txt: Added.
* java/inline-applet-crash.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117304 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Add API to get plugins to WebKit2 GTK+
https://bugs.webkit.org/show_bug.cgi?id=86356

Reviewed by Martin Robinson.

* GNUmakefile.list.am: Add new files to compilation.
* UIProcess/API/gtk/WebKitMimeInfo.cpp: Added.
(_WebKitMimeInfo): Boxed type to represent MIME type information.
(webkitMimeInfoCreate): Ceate a new WebKitMimeInfo.
(webkit_mime_info_ref):
(webkit_mime_info_unref):
(webkit_mime_info_get_mime_type): Return the mime type.
(webkit_mime_info_get_description): Return the mime type
description.
(webkit_mime_info_get_extensions): Return the list of extensions
associated to the mime type.
* UIProcess/API/gtk/WebKitMimeInfo.h: Added.
* UIProcess/API/gtk/WebKitMimeInfoPrivate.h: Added.
* UIProcess/API/gtk/WebKitPlugin.cpp: Added.
(webkitPluginFinalize):
(webkit_plugin_init):
(webkit_plugin_class_init):
(webkitPluginCreate): Create a new WebKitPlugin for the given
PluginModuleInfo.
(webkit_plugin_get_name): Return the plugin name.
(webkit_plugin_get_description): Return the plugin description.
(webkit_plugin_get_path): Return the path where the plugin is
installed.
(webkit_plugin_get_mime_info_list): Return the list of mime types
handled by the plugin.
* UIProcess/API/gtk/WebKitPlugin.h: Added.
* UIProcess/API/gtk/WebKitPluginPrivate.h: Added.
* UIProcess/API/gtk/WebKitWebContext.cpp:
(webkit_web_context_set_additional_plugins_directory): Set an
additional directory to be scanned for plugins.
(GetPluginsAsyncData): Helper struct used to asynchronously get
the list of plugins.
(getPluginsAsyncDataCreate): Create a GetPluginsAsyncData struct.
(getPluginsAsyncDataDestroy): Destroy a GetPluginsAsyncData
struct.
(webkitWebContextGetPluginThread): Thread body to get the list of
plugins installed.
(webkit_web_context_get_plugins): Asynchronously get the list of
plugins installed.
(webkit_web_context_get_plugins_finish): Finish async operation
started by webkit_web_context_get_plugins() returning a list of
WebKitPlugin.
* UIProcess/API/gtk/WebKitWebContext.h:
* UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Add new section for
WebKitPlugin.
* UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbols.
* UIProcess/API/gtk/docs/webkit2gtk.types: Add new types.
* UIProcess/API/gtk/tests/GNUmakefile.am:
* UIProcess/API/gtk/tests/TestWebKitWebContext.cpp:
(testWebContextGetPlugins):
(beforeAll):
* UIProcess/API/gtk/webkit2.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117305 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Pressing esc after requesting snippet creation should remove snippet.
https://bugs.webkit.org/show_bug.cgi?id=86639

Reviewed by Pavel Feldman.

Added committed parameter to NavigatorView.rename() callback.

* inspector/front-end/NavigatorView.js:
(WebInspector.NavigatorView.prototype.rename.commitHandler):
(WebInspector.NavigatorView.prototype.rename.cancelHandler):
(WebInspector.NavigatorView.prototype.rename.afterEditing):
* inspector/front-end/ScriptsNavigator.js:
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype._snippetCreationRequested.callback):
(WebInspector.ScriptsPanel.prototype._snippetCreationRequested):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117306 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Avoid jumpscroll when entering new text in a multi-line editor.
https://bugs.webkit.org/show_bug.cgi?id=82875

Reviewed by Ryosuke Niwa

Scroll caret to the edge of the viewport in case if a line break or a paragraph
separator is inserted at the end of a multi-line editor.  This avoids
undesirable jumpscroll in cases when there is content under the editor.

Tests: editing/input/scroll-to-edge-if-line-break-at-end-of-document-contenteditable.html
       editing/input/scroll-to-edge-if-line-break-at-end-of-document-textarea.html
       editing/input/scroll-to-edge-if-paragraph-separator-at-end-of-document-contenteditable.html

* editing/Editor.cpp:
(WebCore::Editor::insertLineBreak):
(WebCore::Editor::insertParagraphSeparator):
(WebCore::Editor::revealSelectionAfterEditingOperation):
* editing/Editor.h:
(Editor):

* editing/input/resources/reveal-utilities.js:
(performJumpAtTheEdgeTest):
* editing/input/scroll-to-edge-if-line-break-at-end-of-document-contenteditable-expected.txt: Added.
* editing/input/scroll-to-edge-if-line-break-at-end-of-document-contenteditable.html: Added.
* editing/input/scroll-to-edge-if-line-break-at-end-of-document-textarea-expected.txt: Added.
* editing/input/scroll-to-edge-if-line-break-at-end-of-document-textarea.html: Added.
* editing/input/scroll-to-edge-if-paragraph-separator-at-end-of-document-contenteditable-expected.txt: Added.
* editing/input/scroll-to-edge-if-paragraph-separator-at-end-of-document-contenteditable.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117307 268f45cc-cd09-0410-ab3c-d52691b4dbfc
New baselines required after r117187.
https://bugs.webkit.org/show_bug.cgi?id=86486

Unreviewed gardening.

* platform/chromium-linux/svg/custom/pointer-events-image-css-transform-expected.png:
* platform/chromium-linux/svg/custom/pointer-events-image-expected.png:
* platform/chromium-mac-leopard/svg/custom/pointer-events-image-css-transform-expected.png:
* platform/chromium-mac-leopard/svg/custom/pointer-events-image-expected.png:
* platform/chromium-mac-snowleopard/svg/custom/pointer-events-image-css-transform-expected.png:
* platform/chromium-mac-snowleopard/svg/custom/pointer-events-image-expected.png:
* platform/chromium-mac/svg/custom/pointer-events-image-css-transform-expected.png:
* platform/chromium-mac/svg/custom/pointer-events-image-expected.png:
* platform/chromium-win/svg/custom/pointer-events-image-css-transform-expected.png:
* platform/chromium-win/svg/custom/pointer-events-image-expected.png:
* platform/chromium/test_expectations.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117308 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Crash due to first-letter not getting computed on RenderTableCell
https://bugs.webkit.org/show_bug.cgi?id=86133

Reviewed by Abhishek Arya.

Source/WebCore:

RenderTableCell overrides RenderBlock::layout() but doesn't call
updateFirstLetter() in it. This is normally not a problem because
updateFirstLetter() gets called during preferred logical width
computation, but there exist rare occasions when layout of the table
cell happens without preferred logical widths being dirty, in which
case the first-letter update can be skipped.

This patch adds a call to updateFirstLetter() to
RenderTableCell::layout(). This ensures that the first-letter is up
to date before commencing block layout.

* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::layout)

LayoutTests:

Test to exercise crashing condition in bug 86133.

* fast/css-generated-content/first-letter-table-cell-format-block-crash-expected.txt: Added
* fast/css-generated-content/first-letter-table-cell-format-block-crash.html: Added


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117309 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Change ascents and descent back to ints for now
https://bugs.webkit.org/show_bug.cgi?id=86518

Reviewed by Eric Seidel.

Change ascents and descent calculation back to integers for now as it
looks like we'll need to support both the 1/60 and 1/1 implementations of
FractionalLayoutUnit for the immediate future to ensure that text is
rendered at the same offset and with the height regardless of the
ENABLE_SUBPIXEL_LAYOUT flag.

This ensures that most websites will look the same at 100% zoom
regardless of the flag and also allows us to the same test expectations
for the vast majority of layout tests.

Eventually we want to move those back to FractionalLayoutUnits as that
will result in more correct rendering.

Source/WebCore: 

No new tests, no change in functionality.

* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::computeLogicalBoxHeights):
* rendering/RootInlineBox.cpp:
(WebCore::setAscentAndDescent):
(WebCore::RootInlineBox::ascentAndDescentForBox):
* rendering/RootInlineBox.h:
(RootInlineBox):

LayoutTests: 

* platform/chromium-win/fast/block/float/overhanging-tall-block-expected.txt:
* platform/mac/fast/block/float/overhanging-tall-block-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117310 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Make things build with DUMP_HASHTABLE_STATS=1
https://bugs.webkit.org/show_bug.cgi?id=86571

Reviewed by Geoffrey Garen.

DUMP_HASHTABLE_STATS bitrotted after the WTF separation. This patch
makes it build.

Added WTF_EXPORTDATA to the global data, and WTF_EXPORT_PRIVATE to
the static HashTableStats methods. Added a dumpStats() method
that is not yet called anywhere; we can no longer rely on destroying
a global object to dump the stats because global destructors are
disallowed.

* wtf/HashTable.cpp:
(WTF):
(WTF::HashTableStats::recordCollisionAtCount):
(WTF::HashTableStats::dumpStats):
* wtf/HashTable.h:
(HashTableStats):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117311 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Chromium] Use ThrottledTextureUploader with threaded compositing.
https://bugs.webkit.org/show_bug.cgi?id=85848

Patch by David Reveman <reveman@chromium.org> on 2012-05-16
Reviewed by Adrienne Walker.

Switch to ThrottledUploader in CCThreadProxy.

* platform/graphics/chromium/cc/CCThreadProxy.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117312 268f45cc-cd09-0410-ab3c-d52691b4dbfc
FrameView::scrollContentsFastPath should use painted area to determine whether to drop out of the fast path
https://bugs.webkit.org/show_bug.cgi?id=86651
<rdar://problem/11459243>

Reviewed by Simon Fraser.

Previously, we decided to fall out of the fast scrolling path by the number of fixed-position elements
on the page. This was less than ideal if a single fixed position element took up a significant portion
of the page, or if there were many small, cheap-to-paint fixed elements.

Instead, we should use the fast path if less than 50% of the page will be repainted by fixed-position
elements, and otherwise fall back to the slow path.

I've tested a few different thresholds with an internal test; 50% seems to work relatively well,
but the ideal value is hard to determine and likely depends on hardware.

No new tests, performance improvement with few large fixed-position objects or many small ones.

* page/FrameView.cpp:
(WebCore::FrameView::scrollContentsFastPath):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117313 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Scrollbar layers should respect accelerated drawing setting
https://bugs.webkit.org/show_bug.cgi?id=86644
<rdar://problem/11462038>

Reviewed by Simon Fraser.

When creating scrollbar layers, pass through the accelerated drawing setting.

No new tests.

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateOverflowControlsLayers):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117314 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WinCairo] Unreviewed build change after r115385.  Several Cairo
image routines were modified to use new wrapper classes, but the
relevant WinCairo sources were not updated to match.

* WebCore.vcproj/WebCore.vcproj:
* platform/graphics/win/ImageCairoWin.cpp:
(WebCore::BitmapImage::create):
(WebCore::BitmapImage::drawFrameMatchingSourceSize):
* platform/win/DragImageCairoWin.cpp:
(WebCore::createDragImageFromImage):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117322 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Avoid reparsing the style attribute when cloning elements.
<http://webkit.org/b/86574>

Reviewed by Antti Koivisto.

Refactor cloning of attributes a bit to dodge the styleAttr reparse previously
caused by ElementAttributeData::setAttributes().

Introduced Element::cloneDataFromElement() which takes care of cloning the
ElementAttributeData as well as "non-attribute properties" (which is currently
specific to HTMLInputElement.)

Also includes some additional dodging of attribute vector traversal to find
old/new 'id' and 'name' attributes.

I'm seeing a ~10% improvement on PerformanceTests/DOM/CloneNodes locally.

* dom/Document.cpp:
(WebCore::Document::importNode):
* dom/Element.cpp:
(WebCore::Element::cloneElementWithoutChildren):
(WebCore::Element::cloneAttributesFromElement):
(WebCore::Element::cloneDataFromElement):
* dom/Element.h:
(WebCore::Element::copyNonAttributePropertiesFromElement):
* dom/ElementAttributeData.cpp:
(WebCore::ElementAttributeData::cloneDataFrom):
* dom/ElementAttributeData.h:
(ElementAttributeData):
* dom/Node.h:
* dom/StyledElement.cpp:
(WebCore::StyledElement::styleAttributeChanged):
(WebCore::StyledElement::parseAttribute):
* dom/StyledElement.h:
* editing/ReplaceNodeWithSpanCommand.cpp:
(WebCore::swapInNodePreservingAttributesAndChildren):
* html/HTMLElement.cpp:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::copyNonAttributePropertiesFromElement):
* html/HTMLInputElement.h:
* inspector/DOMPatchSupport.cpp:
(WebCore::DOMPatchSupport::innerPatchNode):
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::setNodeName):
* svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::expandSymbolElementsInShadowTree):
(WebCore::SVGUseElement::transferUseAttributesToReplacedElement):

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