Heap-use-after-free in WebCore::HTMLConstructionSite::mergeAttributesFromTokenIntoElement
https://bugs.webkit.org/show_bug.cgi?id=105780

Reviewed by Eric Seidel.

Source/WebCore:

This was regression was created by the HTMLTemplateElement implementation. The issue was a missed instance of
"fragment or template contents" case related to the parsing of colgroups.

* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::processColgroupEndTagForInColumnGroup):
(WebCore::HTMLTreeBuilder::processStartTag):
(WebCore::HTMLTreeBuilder::processCharacterBuffer):
(WebCore::HTMLTreeBuilder::processEndOfFile):

LayoutTests:

* html5lib/resources/template.dat:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138537 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Appease the Windows Gods.

* WebProcess/Notifications/WebNotificationManager.cpp:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138538 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Remove unused BackingStorePrivate::m_defersBlit
https://bugs.webkit.org/show_bug.cgi?id=105811
RIM PR 272067

Reviewed by George Staikos.
Internally Reviewed by Jakob Petsovits.

BackingStorePrivate::m_defersBlit is not used anywhere, it should
be removed to simplify the code and to avoid confusion.
* Api/BackingStore.cpp:
(BlackBerry::WebKit::BackingStorePrivate::BackingStorePrivate):
(BlackBerry::WebKit::BackingStorePrivate::blitVisibleContents):
* Api/BackingStore.h:
* Api/BackingStore_p.h:
(BackingStorePrivate):


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

* platform/chromium-win-xp/svg/dynamic-updates/SVGFEComponentTransferElement-svgdom-tableValues-prop-expected.png: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138540 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Slightly clean up WebCore's Base.xcconfig
https://bugs.webkit.org/show_bug.cgi?id=105808

Reviewed by Sam Weinig.

* Configurations/Base.xcconfig: Simplify the definition of GCC_GENERATE_DEBUGGING_SYMBOLS,
which is always YES.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138541 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] DrawingBuffer initialization loop breaks if completely out of memory
https://bugs.webkit.org/show_bug.cgi?id=105732

Patch by Brandon Jones <bajones@chromium.org> on 2012-12-28
Reviewed by Kenneth Russell.

When DrawingBuffer allocation fails because s_currentResourceUsePixels is maxed out
it now forces WebGLRenderingContext creation to fail gracefully.

* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::create): On Chromium, check for failure to allocate a DrawingBuffer

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138542 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION (r138196): Regions with text-overflow: ellipsis; are being ellipsized unnecessarily
https://bugs.webkit.org/show_bug.cgi?id=105600

Source/WebCore: 

Reviewed by Darin Adler.
        
Pixel-snap lineBoxEdge before comparing with the block edge as
the lineBox edge isn't guaranteed to be snapped to device pixels
on all platforms.

Test: fast/sub-pixel/ellipsis-table.html

* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::checkLinesForTextOverflow):

LayoutTests: 

Reviewed by Darin Adler.
        
Add test for text-overflow: ellipsis inside a table. 

* fast/sub-pixel/ellipsis-table-expected.html: Added.
* fast/sub-pixel/ellipsis-table.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138543 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK][WK2] Add support for IME Composition
https://bugs.webkit.org/show_bug.cgi?id=65093

Reviewed by Carlos Garcia Campos.

Source/WebCore:

No new tests. The GtkInputMethodFilter is covered by unit tests in TestWebKitAPI.
Doing functional tests for this behavior is much more complex.

* platform/gtk/GtkInputMethodFilter.cpp:
(WebCore::GtkInputMethodFilter::sendCompositionAndPreeditWithFakeKeyEvents): Now
pass along whether or not an event was faked.
* platform/gtk/GtkInputMethodFilter.h: Ditto.

Source/WebKit/gtk:

Update the method signatures for concrete WebKit1 implementation of
the GtkInputMethodFilter.

* WebCoreSupport/WebViewInputMethodFilter.cpp:
(WebKit::WebViewInputMethodFilter::sendSimpleKeyEvent):
(WebKit::WebViewInputMethodFilter::sendKeyEventWithCompositionResults):
* WebCoreSupport/WebViewInputMethodFilter.h:
(WebViewInputMethodFilter):

Source/WebKit2:

Add a WebKit2 implementation of the GtkInputMethodFilter and provide
the necessary plumbing to pass composition information along with
input method events.

* GNUmakefile.list.am: Add new files to the source list.
* Shared/EditorState.cpp: The cursorRect is now passed for GTK+ as well as
Qt, so update the encode and decode methods to pass that along.
* Shared/EditorState.h: Add the cursorRect member for GTK+ as well.
* Shared/NativeWebKeyboardEvent.h:
(NativeWebKeyboardEvent): Keyboard events should also have knowledge of
the compositionResults and whether or not the event was faked for composition
purposes.
* Shared/gtk/NativeWebKeyboardEventGtk.cpp: Ditto.
* Shared/gtk/WebEventFactory.cpp:
(WebKit::WebEventFactory::createWebKeyboardEvent): Copy the logic of PlatformKeyEvent,
for properly setting the windows key code and the event text from the composition
results.
* Shared/gtk/WebEventFactory.h: The createWebKeyboardEvent factory now takes a
CompositionResults argument.
* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::doneWithKeyEvent): Don't forward keyboard events that
were faked for composition reasons. These events originated from WebKit and should
never be passed to parent classes.
(WebKit::PageClientImpl::updateTextInputState): Plumb through the updateTextInputState
method to the WebViewBase.
* UIProcess/API/gtk/PageClientImpl.h:
(PageClientImpl): Add a updateTextInputState method.
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(_WebKitWebViewBasePrivate): Instead of having an input method context as a member
keep a WebViewBaseInputMethodFilter.
(webkitWebViewBaseRealize): Set the filter widget when the WebViewBase is realized.
(webkit_web_view_base_init): No longer create a input method context during init.
(webkitWebViewBaseFocusInEvent): Pass along focus in events to the filter.
(webkitWebViewBaseFocusOutEvent): Pass along focus out events to the filter.
(webkitWebViewBaseKeyPressEvent): Instead of passing key presses directly to the WebProcess,
filter them through the input method filter.
(webkitWebViewBaseKeyReleaseEvent): Ditto.
(webkitWebViewBaseButtonPressEvent): Notify the input method filter about button press events.
(webkitWebViewBaseGetIMContext): The input method filter owns the input method now.
(webkitWebViewBaseSetInputMethodState): Add a bit of plumbing for the PageClient.
(webkitWebViewBaseUpdateTextInputState): Ditto.
* UIProcess/API/gtk/WebKitWebViewBasePrivate.h: Add plumbing declarations.
* UIProcess/API/gtk/WebViewBaseInputMethodFilter.cpp: Added. An implementation of GtkInputMethodFilter for WebKit2.
* UIProcess/API/gtk/WebViewBaseInputMethodFilter.h: Copied from Source/WebKit/gtk/WebCoreSupport/WebViewInputMethodFilter.h.
* UIProcess/PageClient.h:
(PageClient): updateInputMethod state is now for both Qt and GTK+.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::editorStateChanged): Pass the editor state for GTK+ as well as Qt.
(WebKit::WebPageProxy::setComposition): Moved this method from WebPageProxyQt as it's used for GTK+ now as well.
(WebKit::WebPageProxy::confirmComposition): Ditto.
(WebKit::WebPageProxy::cancelComposition): Ditto.
* UIProcess/WebPageProxy.h:
(WebPageProxy): The setInputMethodState message is for GTK+ as well as Qt now.
* UIProcess/WebPageProxy.messages.in: Ditto.
* UIProcess/gtk/WebPageProxyGtk.cpp:
(WebKit::WebPageProxy::setInputMethodState): Ditto.
* UIProcess/qt/WebPageProxyQt.cpp: Move some methods to the platform-independent file.
* WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp: More closely match the WebKit1
logic for dealing with key events so that composition events will be handled properly.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::editorState): Properly pass the cursorRect for GTK+.
(WebKit::targetFrameForEditing): Moved from the Qt file, because its used by GTK+ as well. They
now pass along the updated EditorState as well, just like the Mac versions.
(WebKit::WebPage::confirmComposition): Ditto.
(WebKit::WebPage::setComposition): Ditto.
(WebKit::WebPage::cancelComposition): Ditto.
* WebProcess/WebPage/WebPage.h: The above messages are now for GTK+ as well as Qt.
* WebProcess/WebPage/WebPage.messages.in: Ditto.
* WebProcess/WebPage/qt/WebPageQt.cpp: Moved some methods to the platform-independent file.

Tools:

Update unit tests for GtkInputMethodFilter to note whether or not an event
was a fake event synthesized for composition purposes. This is now used
for WebKit2.

* TestWebKitAPI/Tests/gtk/InputMethodFilter.cpp:
(TestWebKitAPI::TestInputMethodFilter::sendSimpleKeyEvent):
(TestWebKitAPI::TestInputMethodFilter::sendKeyEventWithCompositionResults):
(TestWebKitAPI::TEST):
* gtk/generate-gtkdoc:
(get_webkit2_options): Skip new files in the WebKit2 source directory for documentation
generation.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GStreamer] GstMessage handler in AudioDestination
https://bugs.webkit.org/show_bug.cgi?id=105292

Reviewed by Martin Robinson.

Handle GStreamer warnings and errors coming from the playback
pipeline. For now we only display warnings on the console.

* platform/audio/gstreamer/AudioDestinationGStreamer.cpp:
(WebCore::messageCallback):
(WebCore):
(WebCore::AudioDestinationGStreamer::AudioDestinationGStreamer):
(WebCore::AudioDestinationGStreamer::finishBuildingPipelineAfterWavParserPadReady):
(WebCore::AudioDestinationGStreamer::handleMessage):
* platform/audio/gstreamer/AudioDestinationGStreamer.h:
(AudioDestinationGStreamer):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138545 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Templates]: Fix assert in colgroup parse handling
https://bugs.webkit.org/show_bug.cgi?id=105837

Reviewed by Eric Seidel.

Source/WebCore:

Tests added to html5lib.

* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::processEndTag):

LayoutTests:

* html5lib/resources/template.dat:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138546 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix assert seen when adding a custom protocol handler before an initial
web process has been created.

* UIProcess/WebContext.h:
(WebKit::WebContext::sendToNetworkingProcess):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138547 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Roll Chromium DEPS to r174739
https://bugs.webkit.org/show_bug.cgi?id=105813

Unreviewed.


* DEPS:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138548 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Templates]: Fix assert in colgroup parse handling
https://bugs.webkit.org/show_bug.cgi?id=105837

Patch by Rafael Weinstein <rafaelw@chromium.org> on 2012-12-28
Reviewed by Eric Seidel.

* html5lib/resources/template.dat:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138549 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed updated TestExpectations. Mark test as fail on XP only.

* platform/chromium/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138550 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed updated test expectations

* platform/chromium/TestExpectations:

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

* platform/chromium-win-xp/inspector/extensions/extensions-resources-expected.txt: Removed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138552 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Move logic for extracting the OS X marketing version in to WebCore
<http://webkit.org/b/105841> / <rdar://problem/10736041>

Reviewed by Dan Bernstein.

Source/WebCore:

The logic for extracting the OS X markerting version is moved in to systemMarketingVersion
from WebKitSystemInterface (post-10.8) and WebKit (pre-10.8).

* WebCore.exp.in: Export systemMarketingVersion and remove the old WKSI symbol.
* WebCore.xcodeproj/project.pbxproj: Add the new files.
* platform/mac/SystemVersionMac.h: Added.
* platform/mac/SystemVersionMac.mm: Added.
(WebCore::createSystemMarketingVersion): Read the marketing version out of SystemVersion.plist
(WebCore::callGestalt):
(WebCore::createSystemMarketingVersion): Build the marketing version by piecing together the results
of calls to Gestalt.
(WebCore::systemMarketingVersion): Return the cached string.
* platform/mac/WebCoreSystemInterface.h: Remove the old WKSI symbol.
* platform/mac/WebCoreSystemInterface.mm: Ditto.

Source/WebKit/mac:

* WebCoreSupport/WebSystemInterface.mm:
(InitWebCoreSystemInterface): Remove the code related to the WKSI symbol.
* WebView/WebView.mm:
(systemMarketingVersionForUserAgentString): Call the WebCore function instead of the WKSI function.
(+[WebView _standardUserAgentWithApplicationName:]): Retain the result now that our helper doesn't
do that for us.

Source/WebKit2:

* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::systemMarketingVersionForUserAgentString): Call the WebCore function instead
of the WKSI function.
(WebKit::WebPageProxy::standardUserAgent):
* WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
(InitWebCoreSystemInterface): Remove the code related to the WKSI symbol.

WebKitLibraries:

* WebKitSystemInterface.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138553 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL][WK2] Implement ewk_context_resource_cache_clear
https://bugs.webkit.org/show_bug.cgi?id=104782

The purpose of this API is to clear HTTP caches in local storage and
all resources cached in memory such as images, CSS, JavaScript, XSL,
and fonts.

Reviewed by Kenneth Rohde Christiansen.

* UIProcess/API/efl/ewk_context.cpp:
(EwkContext::clearResourceCache): Call WebResourceCacheManager::ClearCacheForAllOrigins.
(ewk_context_resource_cache_clear):
* UIProcess/API/efl/ewk_context.h: Add ewk_context_resource_cache_clear.
* UIProcess/API/efl/ewk_context_private.h:
(EwkContext):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138554 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Texmap] Edge antialiasing in TextureMapper could be done with less per-pixel calls
https://bugs.webkit.org/show_bug.cgi?id=105377

Patch by No'am Rosenthal <noam@webkit.org> on 2012-12-28
Reviewed by Kenneth Rohde Christiansen.

Instead of passing 8 quad edge coefficients as uniforms and analyze the distance in the
fragment shader, we render the antialiased quad as 4 edge triangles, which originate in the
center of the quad.

The vertex shader expands the quad based on the screen transform, and applies a value to each vertex to be interpolated by the GPU.

It is very difficult to test performance gain; However, the following is apparent:
- The matrix multiplications and inversions done before in the quad inflation code were
  always visible in instruments/valgrind and they are now gone.
- We now perform a single smoothstep() command per pixel instead of 8 clamp(dot()) commands.
- It should now be possible to antialias individual edges.

Covered by existing tests.

* platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::TextureMapperGLData::getStaticVBO):
    Cache the unit-rect and edge-triangle vertex data in a VBO.

(WebCore::TextureMapperGLData::~TextureMapperGLData):
    Clear the cached VBOs upon destruction.

(WebCore::TextureMapperGL::drawBorder):
(WebCore::TextureMapperGL::drawTexture):
    Removed call to useProgram, since it's already called in drawTexturedQuadWithProgram.

(WebCore::TextureMapperGL::drawTexturedQuadWithProgram):
(WebCore::TextureMapperGL::drawSolidColor):
    Use the new signature "draw" instead of "drawQuad".

(WebCore::TextureMapperGL::drawEdgeTriangles):
(WebCore::TextureMapperGL::drawUnitRect):
(WebCore::TextureMapperGL::draw):
    Removed DrawQuad, instead draw either a unit rect or edge triangles.

(WebCore::TextureMapperGL::beginClip):
    Use the new setMatrix function.

* platform/graphics/texmap/TextureMapperGL.h:
    Added a paint flag for antialiasing.

* platform/graphics/texmap/TextureMapperShaderManager.cpp:
(WebCore::TextureMapperShaderProgram::setMatrix):
    Since we now set the matrix in multiple locations, added a convenience
    function for matrix uniform.

(WebCore::getShaderSpec):
    Update the vertex and fragment shader to account for the new antialiasing
    mechanism.
* platform/graphics/texmap/TextureMapperShaderManager.h:
(TextureMapperShaderProgram):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138555 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Texmap] Use a transform uniform instead of u_flip/u_textureSize
https://bugs.webkit.org/show_bug.cgi?id=105809

Patch by No'am Rosenthal <noam@webkit.org> on 2012-12-28
Reviewed by Martin Robinson.

In order to support tiled-patterns, we'd have to apply texture-space transformations in the
vertex shader.
This patch cleans up the current texture-space transformations, and uses
single matrix uniform instead of the current uniforms.

No new tests, refactor only.

* platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::TextureMapperGL::drawTexturedQuadWithProgram):
* platform/graphics/texmap/TextureMapperShaderManager.cpp:
(WebCore):
* platform/graphics/texmap/TextureMapperShaderManager.h:
(TextureMapperShaderProgram):

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