[GTK] GObject introspection links to installed libs when using jhbuild
https://bugs.webkit.org/show_bug.cgi?id=132220

Reviewed by Martin Robinson.

The problem is that gobject-introspection is linking the temporary
binaries adding the library paths present LDFLAGS environment
variable first, taking precedence over the libraries in the build
dir. Since the libraries paths of the dependencies are already
correctly deduced by gobject-introspection using ldd, we can
just unset the LDFLAGS variable before calling g-ir-scanner to
make sure the libraries in the build dir take predence.

* PlatformGTK.cmake:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167873 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] TextTrackCue API changed in r163649
https://bugs.webkit.org/show_bug.cgi?id=132226

Reviewed by Martin Robinson.

TextTrackCue is now a base class and part of its API was moved to
the derived class VTTCue. Update the GObject DOM bindings to keep
backwards compatibility.

* PlatformGTK.cmake: Generate bindings for DataCue and VTTCue.
* bindings/gobject/WebKitDOMDeprecated.cpp:
(webkit_dom_text_track_cue_get_cue_as_html): Mark as deprecated in
favor of VTTCue API.
(webkit_dom_text_track_cue_get_vertical): Ditto.
(webkit_dom_text_track_cue_set_vertical): Ditto.
(webkit_dom_text_track_cue_get_snap_to_lines): Ditto.
(webkit_dom_text_track_cue_set_snap_to_lines): Ditto.
(webkit_dom_text_track_cue_get_line): Ditto.
(webkit_dom_text_track_cue_set_line): Ditto.
(webkit_dom_text_track_cue_get_position): Ditto.
(webkit_dom_text_track_cue_set_position): Ditto.
(webkit_dom_text_track_cue_get_size): Ditto.
(webkit_dom_text_track_cue_set_size): Ditto.
(webkit_dom_text_track_cue_get_align): Ditto.
(webkit_dom_text_track_cue_set_align): Ditto.
(webkit_dom_text_track_cue_get_text): Ditto.
(webkit_dom_text_track_cue_set_text): Ditto.
* bindings/gobject/WebKitDOMDeprecated.h:
* bindings/gobject/WebKitDOMDeprecated.symbols: Add new deprecated symbols.
* bindings/gobject/WebKitDOMPrivate.cpp:
(WebKit::wrap): Add generic wrap for TextTrackCue now that it's a
base class to generate DataCue or VTTCue objects.
* bindings/gobject/WebKitDOMPrivate.h:
* bindings/gobject/webkitdom.symbols: Add DataCue symbols.
* bindings/scripts/CodeGeneratorGObject.pm:
(IsPolymorphic): Add TextTrackCue to the list of polymorphic classes.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167874 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] TextTrack::addCue can raise an exception since r163974
https://bugs.webkit.org/show_bug.cgi?id=132227

Reviewed by Martin Robinson.

webkit_dom_text_track_add_cue() now receives a GError paramater
which is an API break. Add
webkit_dom_text_track_add_cue_with_error and keep
webkit_dom_text_track_add_cue as deprecated to keep API
compatibility.

* bindings/gobject/WebKitDOMDeprecated.cpp:
(webkit_dom_text_track_add_cue):
* bindings/gobject/WebKitDOMDeprecated.h:
* bindings/gobject/WebKitDOMDeprecated.symbols:
* bindings/gobject/webkitdom.symbols:
* bindings/scripts/CodeGeneratorGObject.pm:
(GetEffectiveFunctionName):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167875 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] TextTrack kind and mode attributes are enums since r166180
https://bugs.webkit.org/show_bug.cgi?id=132228

Reviewed by Martin Robinson.

We don't support enum values yet in GObject DOM bindings, but they
are internally strings anyway, so we can keep the old
implementations using strings as custom functions until we
properly support enums.

* bindings/gobject/WebKitDOMCustom.cpp:
(webkit_dom_text_track_get_kind):
(webkit_dom_text_track_get_mode):
(webkit_dom_text_track_set_mode):
* bindings/gobject/WebKitDOMCustom.h:
* bindings/gobject/WebKitDOMCustom.symbols:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167876 268f45cc-cd09-0410-ab3c-d52691b4dbfc
std::bitset<>::test() does unnecessary bounds checks on CSSPropertyID bitsets
https://bugs.webkit.org/show_bug.cgi?id=131685

Reviewed by Darin Adler.

Use std::bitset<>::operator[]() instead of std::bitset<>::test() to avoid
bounds checks which are not necessary as long as a CSSPropertyID value is used.

* css/CSSParser.cpp:
(WebCore::filterProperties):
* css/StyleProperties.cpp:
(WebCore::StyleProperties::asText):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::CascadedProperties::hasProperty):
(WebCore::StyleResolver::CascadedProperties::set):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167877 268f45cc-cd09-0410-ab3c-d52691b4dbfc
std::bitset<>::test() does unnecessary bounds checks on CSSPropertyID bitsets
https://bugs.webkit.org/show_bug.cgi?id=131685

Patch by Zan Dobersek <zdobersek@igalia.com> on 2014-04-28
Reviewed by Darin Adler.

Use std::bitset<>::operator[]() instead of std::bitset<>::test() to avoid
bounds checks which are not necessary as long as a CSSPropertyID value is used.

* css/CSSParser.cpp:
(WebCore::filterProperties):
* css/StyleProperties.cpp:
(WebCore::StyleProperties::asText):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::CascadedProperties::hasProperty):
(WebCore::StyleResolver::CascadedProperties::set):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167878 268f45cc-cd09-0410-ab3c-d52691b4dbfc
OrderIterator refactoring to avoid extra loops
https://bugs.webkit.org/show_bug.cgi?id=119061

Reviewed by Darin Adler.

This patch removes order values Vector and use a Vector of pairs instead. The pairs are formed by a child
(RenderBox) and the index of this child. In addition, OrderIterator code is simplified.

It provides a helper class OrderIteratorPopulator, used for manipulating the Vector directly. Which allows to
consolidate the code into a single implementation across flexbox and grid. OrderIteratorPopulator part is based
on a patch from Blink r153971 by <jchaffraix@chromium.org>.

Current implementation is O(number of children * number of order values). Now it will just do a sort operation
and then a regular loop. So if you have different order values in a flexbox or grid the performance will
improve.

Comparing results of perf-tests:
* Layout/auto-grid-lots-of-data: ~0.5% worse.
* Layout/fixed-grid-lots-of-data: ~0.5% worse.
* Layout/fixed-grid-lots-of-data (setting 100 different order values): ~50% better.
* Layout/flexbox-lots-of-data: ~5% better.

No new tests, already covered by current tests.

* rendering/OrderIterator.cpp:
(WebCore::OrderIterator::currentChild): Return current child according to m_childrenIndex.
(WebCore::OrderIterator::first): Initialize m_childrenIndex and return current child.
(WebCore::OrderIterator::next): Increase m_childrenIndex and return current child.
(WebCore::compareByOrderValueAndIndex): Sorts the Vector by order value and index.
(WebCore::OrderIteratorPopulator::~OrderIteratorPopulator): Calls compareByOrderValueAndIndex() if there is any
child with non default order value.
(WebCore::OrderIteratorPopulator::collectChild): Adds the child and index to the Vector. Update
m_allChildrenHaveDefaultOrderValue accordingly.
(WebCore::OrderIterator::OrderIterator): Deleted.
(WebCore::OrderIterator::setOrderValues): Deleted.
(WebCore::OrderIterator::reset): Deleted.
* rendering/OrderIterator.h:
(WebCore::OrderIteratorPopulator::OrderIteratorPopulator): New helper class to manipulate the Vector.
(WebCore::OrderIterator::currentChild): Deleted.
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::RenderFlexibleBox): Remove OrderIterator intialization.
(WebCore::RenderFlexibleBox::layoutBlock): Remove unneeded code related to old OrderValues vector.
(WebCore::RenderFlexibleBox::prepareOrderIteratorAndMargins): Populate OrderIterator using collectChild().
(WebCore::RenderFlexibleBox::computeMainAxisPreferredSizes): Deleted.
* rendering/RenderFlexibleBox.h: Rename computeMainAxisPreferredSizes() to prepareOrderIteratorAndMargins().
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::RenderGrid): Remove OrderIterator initialization.
(WebCore::RenderGrid::populateExplicitGridAndOrderIterator): Populate OrderIterator using collectChild().


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167879 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed. Update GObject DOM bindings symbols file.

* bindings/gobject/webkitdom.symbols: Add missing symbols.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167880 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Review media bugs flags
https://bugs.webkit.org/show_bug.cgi?id=132246

Reviewed by Philippe Normand.

* platform/gtk/TestExpectations: Review flags of the GTK media
bugs.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167881 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed GTK gardening. Adding failure expectations for 6
failing and flaky tests. Removed 1.

* platform/gtk/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167882 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Crash in debug build with removing windowed plugin child widgets from the view
https://bugs.webkit.org/show_bug.cgi?id=132252

Reviewed by Philippe Normand.

It crashes due to an assert in HashTable that checks the iterators
validity. The problem is that we are iterating the children map
and the callback called on every iteration might modify the map,
making the iterators invalid. This happens when the WebView is
destroyed, GtkContainer calls gtk_container_foreach() with
gtk_widget_destroy as callback. When a widget inside a container
is destroyed, it's removed from the container, and in our case,
the child widget is removed from the map. This fixes several
crashes when running layout tests in debug bot.

* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseContainerForall): Use copyKeysToVector() instead
of using a range iterator for the map keys and check in every
iteration that the child widget from the keys vector is still
present in the map before calling the callback.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167883 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK][WK2] Missing return statement in webkit_plugin_get_description()
https://bugs.webkit.org/show_bug.cgi?id=132263

Reviewed by Carlos Garcia Campos.

* UIProcess/API/gtk/WebKitPlugin.cpp:
(webkit_plugin_get_description): Actually return the data of the cached
plugin description CString.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167884 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WK2][X11] NetscapePluginModule::scanPlugin() should write UTF-8 strings to stdout
https://bugs.webkit.org/show_bug.cgi?id=132245

Reviewed by Carlos Garcia Campos.

NetscapePluginModule::scanPlugin(), in the helper writeLine function, takes each character
of the given string and writes it out as a UChar, doing two fputc calls for each byte of the
16-bit type.

This fails badly with characters with integer value less than 256 as the most significant byte
of the UChar is written out as a null character. This effectively chops the output that's gathered
in the UIProcess and is parsed in PluginProcessProxy::scanPlugin().

To avoid all this, the UTF-8 encoding of the string is written out in the PluginProcess, and
String::fromUTF8() is called in the UIProcess to properly decode the received string.

* Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:
(WebKit::writeCharacter):
(WebKit::writeLine):
(WebKit::writeByte): Deleted.
* UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
(WebKit::PluginProcessProxy::scanPlugin):


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

* platform/gtk/TestExpectations: Flagged some tests.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167886 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Builtin cursors do not properly handle transparency
https://bugs.webkit.org/show_bug.cgi?id=131866

Reviewed by Gustavo Noronha Silva.

Tested by ManualTests/cursor.html.

* platform/gtk/CursorGtk.cpp:
(WebCore::createNamedCursor): Instead of interpreting the source bitmap as an A1 image, use
it as a 1-bit black and white image. We do this by:
    1. Painting the result to a full color image with transparency instead of an alpha-only surface.
    2. Masking a white background using the cursor alpha surface.
    3. Painting the black parts of the cursor by painting the source surface, where black pixels
    will be interpreted as full opaque pixels.

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

* platform/gtk/TestExpectations: Flagged some tests.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167888 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Deleting properties poisons objects
https://bugs.webkit.org/show_bug.cgi?id=131551

Reviewed by Oliver Hunt.

Source/JavaScriptCore:
This is ~3% progression on Dromaeo with a ~6% progression on the jslib portion of Dromaeo in particular.

* runtime/JSPropertyNameIterator.cpp:
(JSC::JSPropertyNameIterator::create):
* runtime/PropertyMapHashTable.h:
(JSC::PropertyTable::hasDeletedOffset):
(JSC::PropertyTable::hadDeletedOffset): If we ever had deleted properties we can no longer cache offsets when
iterating properties because we're required to iterate properties in insertion order.
* runtime/Structure.cpp:
(JSC::Structure::Structure):
(JSC::Structure::materializePropertyMap): We now re-use deleted properties when materializing the property map.
(JSC::Structure::removePropertyTransition): We allow up to 5 deletes for a particular path through the tree of
Structure transitions. After that, we convert to an uncacheable dictionary like we used to. We don't cache
delete transitions, but we allow transitioning from them.
(JSC::Structure::changePrototypeTransition):
(JSC::Structure::despecifyFunctionTransition):
(JSC::Structure::attributeChangeTransition):
(JSC::Structure::toDictionaryTransition):
(JSC::Structure::preventExtensionsTransition):
(JSC::Structure::addPropertyWithoutTransition):
(JSC::Structure::removePropertyWithoutTransition):
(JSC::Structure::pin): Now does only what it says it does--marks the property table as pinned.
(JSC::Structure::pinAndPreventTransitions): More descriptive version of what the old pin() was doing.
* runtime/Structure.h:
* runtime/StructureInlines.h:
(JSC::Structure::setEnumerationCache):
(JSC::Structure::hadDeletedOffsets):
(JSC::Structure::propertyTable):
(JSC::Structure::checkOffsetConsistency): Rearranged variables to be more sensible.
* tests/stress/for-in-after-delete.js: Added.
(foo):

LayoutTests:
New JS regress test. We're ~3.5x faster on this microbenchmark now.

* js/regress/delete-a-few-properties-then-get-by-id-expected.txt: Added.
* js/regress/delete-a-few-properties-then-get-by-id.html: Added.
* js/regress/script-tests/delete-a-few-properties-then-get-by-id.js: Added.
(MyObject):
(foo):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167889 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[X11] Add missing case for mime type application/x-webkit-test-netscape
https://bugs.webkit.org/show_bug.cgi?id=132278

Patch by Krzysztof Wolanski <k.wolanski@samsung.com> on 2014-04-28
Reviewed by Darin Adler.

Case for x-webkit-test-netscape has been omitted along with r167759.

* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::initialize):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167890 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS WK2] flickery scrolling with overflow-scrolling:touch
https://bugs.webkit.org/show_bug.cgi?id=132150

Source/WebCore:

Reviewed by Tim Horton.

Fix typo in a comment.

* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll):

Source/WebKit2:
<rdar://problem/16683006>

Reviewed by Tim Horton.

Maintain a flag that tells us if the user is interacting
with the UIScrollView, and while set, don't clobber the contentOffset
via scrolling tree updates.

* UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
(-[WKOverflowScrollViewDelegate initWithScrollingTreeNode:WebKit::]):
(-[WKOverflowScrollViewDelegate scrollViewWillBeginDragging:]):
(-[WKOverflowScrollViewDelegate scrollViewDidEndDragging:willDecelerate:]):
(-[WKOverflowScrollViewDelegate scrollViewDidEndDecelerating:]): We need this one,
not scrollViewDidEndScrollingAnimation:, to detect the end of decleration.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateAfterChildren):
(-[WKOverflowScrollViewDelegate scrollViewDidEndScrollingAnimation:]): Deleted.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167891 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS WK2] Make subview rebuilding more incremental
https://bugs.webkit.org/show_bug.cgi?id=132162
<rdar://problem/16718916>

Reviewed by Sam Weinig.

Previously we did bulk replacement of subviews, but that triggers
UIKit to send spurious will/DidMoveToWindow messages, which can
interfere with UIScrollView scrolling.

Make _web_setSubviews more incremental, only removing
deleted subviews, adding new ones, and moving existing ones
into the correct order.

* Shared/mac/RemoteLayerTreePropertyApplier.mm:
(-[UIView _web_setSubviews:]):

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